:root {
    --ink: #14151A;
    --ink-soft: #3A3B42;
    --ink-muted: #63646B;
    --surface: #FFFFFF;
    --surface-2: #F4F2F7;
    --line: #ECEAF1;
    --line-strong: #DBD8E2;
    --accent: #E6007E;
    --accent-strong: #BD0068;
    --bg: #FFFFFF;
    --radius: 18px;
    --content: 720px;
    --z-sticky: 100;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

.container { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: saturate(140%) blur(14px);
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    border-bottom: 1px solid var(--line);
}
.site-header__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.site-header__brand {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--ink);
    letter-spacing: -0.03em;
}
.site-header__brand:hover { color: var(--ink); }
.site-header__nav { display: flex; align-items: center; }
.site-header__nav a { color: var(--ink-soft); font-weight: 600; margin-left: 22px; }
.site-header__nav a:hover { color: var(--accent); }
.site-header__langs { display: inline-flex; gap: 4px; margin-left: 22px; padding-left: 22px; border-left: 1px solid var(--line); }
.site-header__langs a { margin-left: 0; padding: 3px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; color: var(--ink-muted); }
.site-header__langs a:hover { color: var(--accent); }
.site-header__langs a.is-active { background: var(--accent); color: #fff; }

main { flex: 1 0 auto; padding: 48px 0 80px; }

.page-head { max-width: var(--content); margin: 0 auto 26px; }
.page-head h1 {
    font-size: clamp(2rem, 4.5vw, 2.9rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.08;
    margin: 0 0 12px;
    text-wrap: balance;
}
.page-head p { color: var(--ink-muted); margin: 0; font-size: 1.05rem; max-width: 65ch; }

.cats { display: flex; flex-wrap: wrap; gap: 8px; max-width: var(--content); margin: 20px auto 40px; }
.cats a {
    display: inline-block;
    padding: 7px 15px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 600;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.cats a:hover { border-color: var(--accent); color: var(--accent); }
.cats a.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 26px;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .2s cubic-bezier(.22,1,.36,1), box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
    transform: translateY(-4px);
    border-color: var(--line-strong);
    box-shadow: 0 18px 40px -16px rgba(20, 21, 26, 0.22);
}
.card__cover { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; background: var(--surface-2); display: block; }
.card__body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card__cat { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.card__cat:hover { color: var(--accent); }
.card__title { font-size: 1.18rem; font-weight: 700; line-height: 1.28; margin: 0; color: var(--ink); letter-spacing: -0.01em; }
.card__title a:hover { color: var(--accent); }
.card__excerpt { color: var(--ink-muted); font-size: 0.93rem; margin: 0; }
.card__date { margin-top: auto; color: var(--ink-muted); font-size: 0.8rem; }
.badge-draft { align-self: flex-start; display: inline-block; padding: 0.18rem 0.55rem; border-radius: 999px; background: #f59e0b; color: #fff; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

.empty { text-align: center; color: var(--ink-muted); padding: 80px 0; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 48px; }
.pagination a, .pagination span {
    min-width: 40px; text-align: center; padding: 9px 13px;
    border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface);
    color: var(--ink-soft); font-weight: 600; font-size: 0.9rem;
    transition: border-color .15s ease, color .15s ease;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .disabled span { opacity: .4; }

.article {
    max-width: var(--content);
    margin: 0 auto;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
}

.article__rail { display: none; }

.article:has(.article__rail .ad) {
    max-width: 1080px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    column-gap: 48px;
    align-items: start;
}
.article:has(.article__rail .ad) > * { grid-column: 1; min-width: 0; }
.article:has(.article__rail .ad) .article__rail {
    display: block;
    grid-column: 2;
    grid-row: 1 / span 50;
    position: sticky;
    top: 88px;
}

.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 0.85rem; font-weight: 600; margin-bottom: 18px; }
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb a:last-child { color: var(--ink); }
.breadcrumb__sep { color: var(--accent); font-weight: 700; }

.article__title {
    font-size: clamp(2.1rem, 5vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -0.038em;
    margin: 0 0 24px;
    line-height: 1.06;
    text-wrap: balance;
}

.byline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin: 0 0 30px;
}
.byline__author { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 44px; height: 44px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #FF6FB8);
    color: #fff; font-weight: 800; font-size: 0.95rem; letter-spacing: 0.02em;
    user-select: none;
}
.byline__meta { display: flex; flex-direction: column; line-height: 1.35; }
.byline__name { font-weight: 700; color: var(--ink); font-size: 0.95rem; }
.byline__sub { color: var(--ink-muted); font-size: 0.85rem; }
.byline__dot { margin: 0 6px; }

.share { display: flex; align-items: center; gap: 8px; }
.share__btn {
    width: 36px; height: 36px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease, transform .15s ease;
}
.share__btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.share__btn.is-copied { color: #fff; background: var(--accent); border-color: var(--accent); }

.article__cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--surface-2);
    margin: 0 0 34px;
    box-shadow: 0 24px 60px -28px rgba(20, 21, 26, 0.4);
}

.article__body { font-size: 1.1rem; color: var(--ink-soft); }
.article__body > :first-child { margin-top: 0; }
.article__body h2 { font-size: clamp(1.55rem, 3vw, 2rem); font-weight: 800; color: var(--ink); margin: 1.7em 0 .55em; letter-spacing: -0.025em; line-height: 1.15; text-wrap: balance; }
.article__body h3 { font-size: 1.3rem; font-weight: 700; color: var(--ink); margin: 1.5em 0 .45em; letter-spacing: -0.015em; }
.article__body p { margin: 0 0 1.15em; max-width: 68ch; text-wrap: pretty; }
.article__body a { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1.5px; }
.article__body a:hover { color: var(--accent); }
.article__body ul, .article__body ol { padding-left: 1.4em; margin: 0 0 1.15em; max-width: 68ch; }
.article__body li { margin: 0 0 .4em; }
.article__body img { max-width: 100%; height: auto; border-radius: 12px; background: var(--surface-2); }
.article__body figure { margin: 1.9em 0; }
.article__body figure img { width: 100%; display: block; }
.article__body figcaption {
    margin-top: .85em;
    padding-left: 14px;
    border-left: 3px solid var(--ink);
    color: var(--ink-soft);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.45;
}
.article__body blockquote {
    margin: 1.4em 0; padding: 2px 0 2px 20px; border-left: 3px solid var(--accent);
    color: var(--ink); font-style: italic; font-size: 1.15rem;
}
.article__body pre {
    background: var(--surface-2); border: 1px solid var(--line);
    padding: 16px 18px; border-radius: 12px; overflow-x: auto; font-size: 0.92rem;
}
.article__body code { font-size: 0.92em; }
.article__body hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

.related { max-width: var(--content); margin: 64px auto 0; padding-top: 40px; border-top: 1px solid var(--line); }
.related h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 22px; }
.related .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }

.ad { max-width: var(--content); margin: 40px auto; }
.ad ins { display: block; width: 100%; }
.ad--banner { min-height: 120px; }
.ad--inline { min-height: 100px; }
.ad--square { min-height: 280px; }
.ad--grid { grid-column: 1 / -1; max-width: none; margin: 0; min-height: 110px; }
.ad--rail { max-width: none; margin: 0; min-height: 600px; }
.ad--mobile { display: none; }
.ad--empty {
    display: grid;
    place-items: center;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    background: var(--surface-2);
}
.ad__label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
}

.site-footer {
    border-top: 1px solid var(--line);
    padding: 32px 0;
    color: var(--ink-muted);
    font-size: 0.875rem;
    text-align: center;
}

:where(a, button):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

@media (max-width: 900px) {
    .article:has(.article__rail .ad) {
        display: block;
        max-width: var(--content);
    }
    .article:has(.article__rail .ad) .article__rail { display: none; }
    .ad--mobile { display: block; }
    .ad--mobile.ad--empty { display: grid; }
}

@media (max-width: 640px) {
    .container { padding: 0 18px; }
    main { padding: 32px 0 56px; }
    .article__cover { margin-bottom: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    .card:hover { transform: none; }
}
