/* ==========================================================================
   NDN — тема Ghost. Палитра и типографика взяты из лаунчера New Dragon Nest.
   ========================================================================== */

@font-face {
    font-family: 'Poppins NDN';
    src: url('../fonts/poppins-regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Poppins NDN';
    src: url('../fonts/poppins-700.ttf') format('truetype');
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg: #08090c;
    --panel: #12151b;
    --panel-soft: rgba(255, 255, 255, 0.03);
    --line: #171b22;
    --line-strong: #232833;
    --tx: #e7eaf0;
    --tx-2: #cdd3dd;
    --tx-3: #9aa3b2;
    --tx-4: #7b8494;
    --tx-5: #5c6472;
    --acc: #d1571f;
    --acc-lt: #d87243;
    --acc-dk: #a74619;
    --ok: #3ecf8e;
    --warn: #e0a83c;
    --font: 'Poppins NDN', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Inter Tight', 'Poppins NDN', system-ui, sans-serif;
    --wrap: 1296px;
    --pad: 72px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--tx);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--acc); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--acc-lt); }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.018em;
    line-height: 1.2;
    margin: 0;
    text-wrap: pretty;
}

.wrap {
    width: 100%;
    max-width: calc(var(--wrap) + var(--pad) * 2);
    margin: 0 auto;
    padding: 0 var(--pad);
}

/* --- прогресс чтения ------------------------------------------------------ */
.progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--panel);
    z-index: 50;
}
.progress__bar {
    width: 0;
    height: 2px;
    background: var(--acc);
    transition: width .1s linear;
}

/* --- шапка ---------------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header__inner {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.site-header__left { display: flex; align-items: center; gap: 48px; min-width: 0; }
.site-header__right { display: flex; align-items: center; gap: 22px; flex: none; }

.brand { display: block; }

.wordmark { display: flex; flex-direction: column; line-height: 1; }
.wordmark__top {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: var(--acc-lt);
    padding-left: 2px;
}
.wordmark__main {
    font-family: var(--font-display);
    font-size: 23px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--tx);
    margin-top: 5px;
    white-space: nowrap;
}
.brand:hover .wordmark__main { color: #fff; }

.nav { display: flex; align-items: center; gap: 30px; }
.nav__item {
    font-size: 15px;
    color: var(--tx-3);
    padding-bottom: 6px;
    border-bottom: 2px solid transparent;
}
.nav__item:hover { color: var(--tx); }
.nav__item--active { color: var(--tx); font-weight: 700; border-bottom-color: var(--acc); }

.icon-btn {
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--tx-4);
    cursor: pointer;
}
.icon-btn:hover { color: var(--tx); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 12px 26px;
    white-space: nowrap;
}
.btn--accent {
    color: #fff;
    border-radius: 8px;
    background: linear-gradient(180deg, var(--acc-lt) 0%, var(--acc) 55%, var(--acc-dk) 100%);
    box-shadow: 0 8px 26px rgba(209, 87, 31, 0.28);
}
.btn--accent:hover { color: #fff; filter: brightness(1.07); }
.btn--ghost { color: var(--tx-2); border: 1px solid var(--line-strong); padding: 12px 32px; }
.btn--ghost:hover { color: var(--tx); border-color: var(--tx-5); }

body.accent-flat .btn--accent { background: var(--acc); box-shadow: none; }

/* --- общие метки ---------------------------------------------------------- */
.eyebrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.eyebrow__label {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--acc);
}
.eyebrow__rule { width: 36px; height: 1px; background: var(--line-strong); }
.eyebrow__meta { font-size: 12px; color: var(--tx-4); }

.byline { display: flex; align-items: center; gap: 12px; }
.byline__avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.byline__avatar--fallback {
    background: linear-gradient(180deg, var(--acc-lt), var(--acc-dk));
}
.byline__name { font-size: 13px; color: var(--tx-2); }

/* --- главная: последнее обновление --------------------------------------- */
.lead { padding-top: 64px; }
.lead__text { display: flex; flex-direction: column; gap: 22px; }
.lead__title {
    font-size: clamp(34px, 4.4vw, 60px);
    line-height: 1.05;
    letter-spacing: -0.025em;
    max-width: 1100px;
}
.lead__title a { color: var(--tx); }
.lead__title a:hover { color: var(--acc-lt); }
.lead__excerpt {
    margin: 0;
    font-size: 18px;
    line-height: 1.65;
    color: var(--tx-3);
    max-width: 820px;
}
.lead__media {
    display: block;
    margin-top: 40px;
    border: 1px solid #1c212a;
    background: var(--panel);
    overflow: hidden;
}
.lead__media img { width: 100%; aspect-ratio: 1296 / 440; object-fit: cover; }

/* --- архив списком -------------------------------------------------------- */
.archive { padding-top: 72px; }
.archive--standalone { padding-top: 44px; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}
.section-head__title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--tx-4);
}
.section-head__meta { font-size: 13px; color: var(--tx-5); }

.archive-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}
.archive-head__text { display: flex; flex-direction: column; gap: 8px; }
.archive-head__kicker {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--acc);
}
.archive-head__title { font-size: clamp(30px, 3.4vw, 44px); letter-spacing: -0.025em; line-height: 1; }
.archive-head__desc { margin: 6px 0 0; font-size: 15px; color: var(--tx-3); max-width: 640px; }
.archive-head__count { font-size: 13px; color: var(--tx-5); flex: none; }

.rows { display: flex; flex-direction: column; }
.row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) 220px 120px;
    gap: 28px;
    align-items: center;
    padding: 28px 0;
    border-bottom: 1px solid var(--line);
    color: var(--tx);
}
.row:hover { color: var(--tx); }
.row:hover .row__title { color: var(--acc-lt); }
.row:hover .row__day { color: var(--acc-lt); }

.row__date { display: flex; align-items: baseline; gap: 8px; }
.row__day {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    transition: color .15s ease;
}
.row__month { font-size: 13px; color: var(--tx-4); }
.row__title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    transition: color .15s ease;
}
.row__author { font-size: 13px; color: var(--tx-4); }
.row__read { font-size: 13px; color: var(--tx-5); text-align: right; }

.pager {
    padding-top: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.pager__gap { width: 1px; height: 20px; background: var(--line-strong); }

/* --- запись --------------------------------------------------------------- */
.post { padding-top: 64px; padding-bottom: 8px; }
.post__header {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 964px;
}
.post__title { font-size: clamp(32px, 4vw, 54px); line-height: 1.06; letter-spacing: -0.025em; }

.post__media { margin: 44px auto 0; }
.post__media img {
    width: 100%;
    aspect-ratio: 1296 / 400;
    object-fit: cover;
    border: 1px solid #1c212a;
}
.post__media figcaption {
    margin-top: 12px;
    font-size: 13px;
    color: var(--tx-5);
    text-align: center;
}

.content--meta { margin-top: 0; }

.content {
    max-width: 820px;
    margin: 56px auto 0;
    font-size: 18px;
    line-height: 1.75;
    color: var(--tx-2);
}
.content > * + * { margin-top: 26px; }
.content > h2 { margin-top: 48px; font-size: clamp(26px, 2.4vw, 32px); color: var(--tx); }
.content > h3 { margin-top: 36px; font-size: 22px; color: var(--tx); }
.content p { margin: 0; text-wrap: pretty; }
.content strong { color: var(--tx); }

.content ul, .content ol { margin: 0; padding-left: 0; list-style: none; }
.content ul li, .content ol li { position: relative; padding-left: 26px; }
.content li + li { margin-top: 14px; }
.content ul li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--acc);
}
.content ol { counter-reset: ndn; }
.content ol li { counter-increment: ndn; }
.content ol li::before {
    content: counter(ndn);
    position: absolute;
    left: 0;
    color: var(--acc);
    font-weight: 700;
}

.content blockquote {
    margin: 0;
    padding: 6px 0 6px 24px;
    border-left: 2px solid var(--acc);
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--tx);
}
.content blockquote p { margin: 0; }

.content hr { border: 0; border-top: 1px solid var(--line); margin: 44px 0; }

.content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}
.content th {
    padding: 0 12px 12px 0;
    text-align: left;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tx-4);
    border-bottom: 1px solid var(--line-strong);
}
.content td {
    padding: 16px 12px 16px 0;
    border-bottom: 1px solid var(--line);
    color: var(--tx-2);
}
.content tr:last-child td { border-bottom: 0; }

.content figure { margin: 44px 0; }
.content figcaption {
    margin-top: 12px;
    font-size: 13px;
    color: var(--tx-5);
    text-align: center;
}
.content .kg-width-wide { max-width: 1040px; margin-inline: calc((820px - min(1040px, 100%)) / 2); }
.content .kg-width-full { max-width: none; }

.content .kg-callout-card {
    display: flex;
    gap: 16px;
    padding: 20px 24px;
    background: rgba(224, 168, 60, 0.06);
    border: 1px solid rgba(224, 168, 60, 0.22);
    color: var(--tx);
    font-size: 16px;
    line-height: 1.6;
}
.content .kg-callout-emoji { flex: none; }

.content .kg-bookmark-card {
    border: 1px solid var(--line-strong);
    background: var(--panel-soft);
}

.tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 44px; }
.tags a {
    font-size: 12px;
    color: var(--tx-2);
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.05);
}
.tags a:hover { color: #fff; background: var(--acc); }

.author-card {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 26px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}
.author-card__avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; }
.author-card__avatar--fallback {
    background: linear-gradient(180deg, var(--acc-lt), var(--acc-dk));
}
.author-card__text { display: flex; flex-direction: column; gap: 4px; }
.author-card__label {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tx-4);
}
.author-card__name { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--tx); }
.author-card__name:hover { color: var(--acc-lt); }

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 56px;
    border-top: 1px solid var(--line);
}
.post-nav__cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 30px 32px 30px 0;
    border-right: 1px solid var(--line);
    min-height: 118px;
}
.post-nav__cell--next { padding: 30px 0 30px 32px; border-right: 0; text-align: right; }
.post-nav__label {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tx-4);
}
.post-nav__title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--tx);
}
.post-nav__title:hover { color: var(--acc-lt); }

/* --- 404 ------------------------------------------------------------------ */
.error { min-height: 62vh; display: grid; place-items: center; }
.error__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
    padding: 80px 0;
}
.error__code {
    font-family: var(--font-display);
    font-size: clamp(64px, 10vw, 96px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--acc);
}
.error__title { font-size: 24px; font-weight: 600; }
.error__text { margin: 0; font-size: 15px; color: var(--tx-3); max-width: 420px; }
.error__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* --- футер ---------------------------------------------------------------- */
.site-footer { margin-top: 72px; border-top: 1px solid var(--line); }
.site-footer__inner {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding-top: 28px;
    padding-bottom: 28px;
}
.site-footer__left { display: flex; align-items: center; gap: 18px; }
.site-footer__logo { height: 40px; width: auto; }
.site-footer__copy { font-size: 12px; color: var(--tx-5); }
.site-footer__right { display: flex; align-items: center; gap: 24px; }
.site-footer__link { font-size: 12px; color: var(--tx-4); }
.site-footer__link:hover { color: var(--tx); }
.site-footer__social { display: flex; align-items: center; gap: 16px; }
.icon-link { color: var(--tx-4); display: grid; place-items: center; }
.icon-link:hover { color: var(--tx); }

/* --- адаптив -------------------------------------------------------------- */
@media (max-width: 1100px) {
    :root { --pad: 40px; }
    .row { grid-template-columns: 96px minmax(0, 1fr) 100px; }
    .row__author { display: none; }
    .row__day { font-size: 28px; }
    .row__title { font-size: 20px; }
}

@media (max-width: 720px) {
    :root { --pad: 20px; }
    body { font-size: 16px; }
    .site-header__inner { min-height: 72px; flex-wrap: wrap; gap: 16px; }
    .site-header__left { gap: 24px; width: 100%; justify-content: space-between; }
    .wordmark__top { font-size: 9px; letter-spacing: 0.34em; }
    .wordmark__main { font-size: 17px; letter-spacing: 0.1em; margin-top: 4px; }
    .nav { gap: 18px; }
    .site-header__right { width: 100%; justify-content: space-between; }
    .btn--accent { flex: 1; }

    .lead { padding-top: 36px; }
    .lead__media { margin-top: 28px; }
    .lead__media img { aspect-ratio: 16 / 10; }

    .archive { padding-top: 48px; }
    .row { grid-template-columns: 64px minmax(0, 1fr); gap: 16px; padding: 20px 0; }
    .row__read { display: none; }
    .row__date { flex-direction: column; align-items: flex-start; gap: 2px; }
    .row__day { font-size: 24px; }

    .post { padding-top: 36px; }
    .post__media { margin-top: 28px; }
    .post__media img { aspect-ratio: 16 / 10; }
    .content { margin-top: 36px; font-size: 17px; }
    .content .kg-width-wide { margin-inline: 0; }

    .post-nav { grid-template-columns: 1fr; }
    .post-nav__cell { padding: 24px 0; border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; }
    .post-nav__cell--next { padding: 24px 0; text-align: left; border-bottom: 0; }

    .site-footer__inner { flex-direction: column; align-items: flex-start; }
}
