:root {
    --ai-bg: #ffffff;
    --ai-ink: #111111;
    --ai-text: #222222;
    --ai-text2: #444444;
    --ai-body: #1d1d1d;
    --ai-muted: #6b6b6b;
    --ai-rule: #dcdcdc;
    --ai-red: #c8102e;
    --ai-soft: #f6f6f4;
    --ai-serif: Georgia, "Noto Serif", "Times New Roman", serif;
    --ai-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --ai-w: 1120px;
    --background-color: #ffffff;
}

body {
    font-family: var(--ai-sans);
    color: var(--ai-text);
    background: var(--ai-bg);
    -webkit-font-smoothing: antialiased;
}

.gh-viewport {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.ai-wrap {
    width: 100%;
    box-sizing: border-box;
    max-width: var(--ai-w);
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

.ai-main {
    flex: 1 0 auto;
    width: 100%;
    padding-top: 24px;
    padding-bottom: 40px;
}

/* ---------- заглавна лента ---------- */

.ai-topbar { border-bottom: 1px solid var(--ai-rule); font-size: 12px; color: var(--ai-muted); }
.ai-topbar-in { display: flex; justify-content: space-between; padding-top: 8px; padding-bottom: 8px; }
.ai-date::first-letter { text-transform: uppercase; }
.ai-topbar a { text-decoration: none; }
.ai-topbar a:hover { color: var(--ai-red); }

.ai-brand { text-align: center; padding-top: 22px; padding-bottom: 14px; }
.ai-title {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    font-family: var(--ai-serif);
    font-weight: 700;
    color: var(--ai-ink);
}
.ai-mark {
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #c8102e;
    color: #ffffff;
    font-size: 20px;
    line-height: 1;
    letter-spacing: -1px;
}
.ai-title-text { font-size: clamp(22px, 4.2vw, 40px); line-height: 1.12; letter-spacing: -0.5px; text-align: left; }
.ai-logo { max-height: 56px; width: auto; }
.ai-sub { margin: 8px 0 0; font-size: 14px; color: var(--ai-muted); }

.ai-nav { border-top: 3px double var(--ai-ink); border-bottom: 1px solid var(--ai-ink); }
.ai-nav-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ai-nav-links { flex: 1; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.ai-nav-links::-webkit-scrollbar { display: none; }
.ai-nav .nav { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.ai-nav .nav a {
    display: block;
    padding: 12px 12px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    color: var(--ai-ink);
}
.ai-nav .nav a:hover, .ai-nav .nav-current a { color: var(--ai-red); }
.ai-search { background: none; border: 0; padding: 8px; cursor: pointer; color: var(--ai-ink); display: flex; }
.ai-search svg { width: 20px; height: 20px; }

/* ---------- начална страница ---------- */

.ai-lead {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--ai-ink);
}
.ai-lead-side { border-left: 1px solid var(--ai-rule); padding-left: 28px; }
.ai-lead-side .ai-item:first-child { border-top: 0; padding-top: 0; }

.ai-hero-link, .ai-item-link { display: block; text-decoration: none; color: inherit; }
.ai-hero-img img { width: 100%; height: auto; display: block; margin-bottom: 14px; }

.ai-tag {
    display: inline-block;
    font: 600 11px/1 var(--ai-sans);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--ai-red);
    text-decoration: none;
}

.ai-hero-title {
    font-family: var(--ai-serif);
    font-weight: 700;
    font-size: clamp(26px, 3.6vw, 40px);
    line-height: 1.18;
    margin: 10px 0 12px;
    color: var(--ai-ink);
}
.ai-hero-excerpt { font-family: var(--ai-serif); font-size: 18px; line-height: 1.6; color: var(--ai-text2); margin: 0 0 12px; }
.ai-meta { font-size: 12px; color: var(--ai-muted); }

.ai-item { padding: 16px 0; border-top: 1px solid var(--ai-rule); }
.ai-item-title { font-family: var(--ai-serif); font-weight: 700; font-size: 18px; line-height: 1.32; margin: 6px 0; color: var(--ai-ink); }
.ai-item-excerpt { font-size: 14px; line-height: 1.55; color: var(--ai-text2); margin: 0 0 6px; }

.ai-hero-link:hover .ai-hero-title,
.ai-item-link:hover .ai-item-title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.ai-section-title {
    display: inline-block;
    font: 700 13px/1 var(--ai-sans);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 28px 0 4px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--ai-red);
    color: var(--ai-ink);
}

.ai-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
.ai-rows .ai-item:nth-child(-n+2) { border-top: 0; }
.ai-empty { padding: 60px 0; text-align: center; color: var(--ai-muted); }

.ai-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--ai-ink); font-size: 14px; }
.ai-pager:not(:has(a)) { display: none; }
.ai-pager a { color: var(--ai-ink); font-weight: 600; text-decoration: none; }
.ai-pager a:hover { color: var(--ai-red); }
.ai-pager-info { color: var(--ai-muted); font-size: 12px; }
.ai-pager-next { margin-left: auto; }

/* ---------- архив, етикет, автор ---------- */

.ai-archive-head { padding: 12px 0 8px; border-bottom: 3px double var(--ai-ink); margin-bottom: 8px; }
.ai-archive-title { font-family: var(--ai-serif); font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 0 0 8px; color: var(--ai-ink); }
.ai-archive-desc { font-size: 16px; line-height: 1.55; color: var(--ai-text2); margin: 0 0 8px; }
.ai-error { text-align: center; padding-top: 70px; }
.ai-error-code { font: 700 14px/1 var(--ai-sans); letter-spacing: 2px; color: var(--ai-red); }

/* ---------- статия ---------- */

.ai-article-head { max-width: 760px; margin: 0 auto; padding: 36px 20px 8px; box-sizing: border-box; }
.ai-article-title { font-family: var(--ai-serif); font-weight: 700; font-size: clamp(28px, 4.6vw, 44px); line-height: 1.15; letter-spacing: -0.5px; margin: 12px 0; color: var(--ai-ink); }
.ai-article-lead { font-family: var(--ai-serif); font-size: 20px; line-height: 1.55; color: var(--ai-text2); margin: 0 0 18px; }
.ai-article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--ai-muted); padding: 12px 0; border-top: 1px solid var(--ai-rule); border-bottom: 1px solid var(--ai-rule); margin-bottom: 8px; }
.ai-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ai-muted); }

.gh-content.ai-content { font-family: var(--ai-serif); font-size: 19px; line-height: 1.75; color: var(--ai-body); padding-bottom: 24px; }
.gh-content.ai-content h2, .gh-content.ai-content h3 { font-family: var(--ai-serif); font-weight: 700; color: var(--ai-ink); line-height: 1.25; }
.gh-content.ai-content h2 { font-size: 26px; margin: 1.8em 0 0.5em; }
.gh-content.ai-content h3 { font-size: 21px; margin: 1.6em 0 0.4em; }
.gh-content.ai-content a { color: var(--ai-red); text-underline-offset: 3px; }
.gh-content.ai-content hr { border: 0; border-top: 1px solid var(--ai-rule); margin: 2.2em 0 1em; }
.gh-content.ai-content hr + p { font-family: var(--ai-sans); font-size: 14px; line-height: 1.6; color: var(--ai-muted); }
.gh-content.ai-content hr + p em { font-style: normal; }

.ai-related .ai-rows { margin-bottom: 8px; }

/* ---------- долна част ---------- */

.ai-foot { margin-top: auto; border-top: 3px double var(--ai-ink); background: var(--ai-soft); padding: 28px 0 22px; font-size: 14px; color: var(--ai-muted); }
.ai-foot-top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.ai-foot-brand strong { font-family: var(--ai-serif); font-size: 18px; color: var(--ai-ink); }
.ai-foot-brand p { margin: 6px 0 0; max-width: 480px; line-height: 1.5; }
.ai-foot .nav { display: flex; gap: 16px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.ai-foot a { color: var(--ai-ink); text-decoration: none; }
.ai-foot a:hover { color: var(--ai-red); }
.ai-disclaimer { margin: 20px 0 16px; padding-top: 16px; border-top: 1px solid var(--ai-rule); font-size: 13px; line-height: 1.55; }
.ai-foot-bar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; }

/* ---------- малки екрани ---------- */

@media (max-width: 860px) {
    .ai-lead { grid-template-columns: 1fr; }
    .ai-lead-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--ai-ink); padding-top: 20px; }
    .ai-rows { grid-template-columns: 1fr; }
    .ai-rows .ai-item:nth-child(2) { border-top: 1px solid var(--ai-rule); }
    .ai-content { font-size: 18px; }
}
@media (max-width: 560px) {
    .ai-topbar-links { display: none; }
    .ai-mark { width: 38px; height: 38px; font-size: 16px; }
}

/* ---------- превключвател на темата ---------- */

.ai-theme { background: none; border: 0; padding: 8px; cursor: pointer; color: var(--ai-ink); display: flex; }
.ai-theme svg { width: 20px; height: 20px; }
.ai-theme .ai-icon-sun { display: none; }
html[data-theme="dark"] .ai-theme .ai-icon-sun { display: block; }
html[data-theme="dark"] .ai-theme .ai-icon-moon { display: none; }
.ai-nav-tools { display: flex; align-items: center; }

/* ---------- тъмна тема ---------- */

html[data-theme="dark"] {
    color-scheme: dark;
    --ai-bg: #0f1115;
    --ai-ink: #f2f2f0;
    --ai-text: #dcdcda;
    --ai-text2: #c5c8cc;
    --ai-body: #e4e5e7;
    --ai-muted: #9ba1a9;
    --ai-rule: #2b2f36;
    --ai-red: #ff5a6b;
    --ai-soft: #161a20;
    --background-color: #0f1115;
}
html[data-theme="dark"] .ai-mark { background: #c8102e; color: #ffffff; }
html[data-theme="dark"] .ai-hero-img img,
html[data-theme="dark"] .gh-content img { filter: brightness(0.92); }
html[data-theme="dark"] .gh-content.ai-content a { color: var(--ai-red); }
