:root {
    color-scheme: light dark;
    --page: #f4f1ea;
    --surface: rgba(255, 255, 255, 0.76);
    --surface-solid: #fffdf8;
    --ink: #171816;
    --muted: #66685f;
    --line: rgba(23, 24, 22, 0.14);
    --accent: #315f55;
    --accent-strong: #1f4c43;
    --accent-soft: rgba(49, 95, 85, 0.10);
    --shadow: 0 24px 80px rgba(30, 35, 31, 0.10);
    --radius: 22px;
    --shell: 1180px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --page: #101311;
        --surface: rgba(25, 30, 27, 0.78);
        --surface-solid: #191e1b;
        --ink: #f2f0e8;
        --muted: #b3b7ae;
        --line: rgba(242, 240, 232, 0.13);
        --accent: #8ab9a9;
        --accent-strong: #b0d4c7;
        --accent-soft: rgba(138, 185, 169, 0.12);
        --shadow: 0 28px 90px rgba(0, 0, 0, 0.30);
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at 8% 0%, var(--accent-soft), transparent 32rem),
        linear-gradient(180deg, var(--page), var(--page));
    color: var(--ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.17em;
}

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

button,
input {
    font: inherit;
}

.shell {
    width: min(calc(100% - 40px), var(--shell));
    margin-inline: auto;
}

.narrow {
    max-width: 840px;
}

.skip-link {
    position: fixed;
    left: 16px;
    top: -80px;
    z-index: 100;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--ink);
    color: var(--page);
}

.skip-link:focus {
    top: 16px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--page) 88%, transparent);
    backdrop-filter: blur(18px);
}

.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand,
.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    font-size: 20px;
    font-weight: 760;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand-mark {
    width: 28px;
    height: 28px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: end;
    gap: 3px;
}

.brand-mark span {
    display: block;
    border-radius: 8px 8px 3px 3px;
    background: var(--accent);
}

.brand-mark span:nth-child(1) { height: 55%; }
.brand-mark span:nth-child(2) { height: 100%; }
.brand-mark span:nth-child(3) { height: 73%; }

.desktop-navigation {
    display: flex;
    align-items: center;
    gap: 19px;
    margin-right: auto;
}

.desktop-navigation a {
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
}

.desktop-navigation a:hover,
.desktop-navigation a[aria-current="page"] {
    color: var(--ink);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-switcher {
    position: relative;
}

.language-trigger {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--accent);
    cursor: pointer;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.language-trigger:hover,
.language-trigger:focus-visible {
    transform: translateY(-1px);
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
    outline: none;
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.language-planet {
    width: 28px;
    height: 28px;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.language-planet-orbit {
    stroke-width: 1.45;
    opacity: 0.78;
}

.language-planet-satellite {
    fill: currentColor;
    stroke: none;
}

.language-popover {
    width: min(960px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    overflow: visible;
}

.language-popover[popover] {
    display: none;
}

.language-popover[popover]:popover-open {
    display: block;
}

.language-popover::backdrop {
    background: rgba(12, 17, 14, 0.56);
    backdrop-filter: blur(10px);
}

.language-popover.is-open {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    width: 100%;
    max-height: none;
    padding: 16px;
    background: rgba(12, 17, 14, 0.56);
}

.language-popover-panel {
    width: 100%;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--surface-solid);
    box-shadow: 0 34px 110px rgba(18, 25, 21, 0.30);
}

.language-popover-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.language-popover-header h2 {
    margin: 0;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.1;
}

.language-popover-eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.language-popover-close {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 3px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--muted);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
}

.language-popover-close:hover,
.language-popover-close:focus-visible {
    border-color: var(--accent);
    color: var(--ink);
    outline: none;
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.language-card {
    min-height: 82px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.language-card:hover,
.language-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}

.language-card[aria-current="page"] {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.language-code {
    min-width: 43px;
    padding: 7px 8px;
    border-radius: 10px;
    background: var(--surface-solid);
    color: var(--accent);
    font-size: 12px;
    font-weight: 820;
    letter-spacing: 0.06em;
    text-align: center;
}

.language-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
}

.language-card-state {
    color: var(--muted);
    font-size: 18px;
    font-weight: 800;
}

.language-card[aria-current="page"] .language-card-state {
    color: var(--accent);
}

body.language-popover-open {
    overflow: hidden;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 11px 20px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 720;
    text-decoration: none;
    transition: transform 150ms ease, background 150ms ease;
}

.button:hover {
    transform: translateY(-1px);
    background: var(--accent-strong);
}

.button-small {
    min-height: 40px;
    padding: 8px 15px;
    font-size: 13px;
}

.section {
    padding-block: 72px;
}

.section-hero {
    padding-top: 82px;
    padding-bottom: 54px;
    border-bottom: 1px solid var(--line);
}

.section-main {
    padding-top: 54px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin-top: 0;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 520;
    line-height: 1.12;
    text-wrap: balance;
}

h1 {
    margin-bottom: 22px;
    font-size: clamp(42px, 7vw, 76px);
    letter-spacing: -0.045em;
}

h2 {
    font-size: clamp(27px, 4vw, 40px);
    letter-spacing: -0.03em;
}

h3 {
    font-size: 24px;
    letter-spacing: -0.02em;
}

.lead {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: clamp(19px, 2.5vw, 23px);
    line-height: 1.58;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 30px;
    color: var(--muted);
    font-size: 13px;
}

.breadcrumbs a {
    text-decoration: none;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 54px;
}

.category-card {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 12px 40px rgba(30, 35, 31, 0.04);
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease;
}

.category-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.category-index {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.category-card h2 {
    margin: 32px 0 12px;
    font-size: 28px;
}

.category-card p {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.category-card strong {
    margin-top: auto;
    color: var(--accent);
    font-size: 13px;
}

.search-panel {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
    gap: 26px;
    align-items: end;
    margin: 0 0 58px;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.search-panel h2 {
    margin-bottom: 0;
    font-size: 32px;
}

.search-field input {
    width: 100%;
    min-height: 54px;
    padding: 12px 18px;
    border: 1px solid var(--line);
    border-radius: 15px;
    outline: none;
    background: var(--surface-solid);
    color: var(--ink);
}

.search-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-results {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.search-results[hidden] {
    display: none;
}

.search-result {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface-solid);
}

.search-result h3 {
    margin-bottom: 7px;
    font-size: 21px;
}

.search-result p {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 14px;
}

.search-empty {
    grid-column: 1 / -1;
    padding: 20px;
    color: var(--muted);
    text-align: center;
}

.section-heading-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.section-heading-row h2 {
    margin-bottom: 0;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.article-card {
    min-height: 310px;
    display: flex;
    flex-direction: column;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.article-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.article-card h2 {
    margin: 30px 0 14px;
    font-size: 29px;
}

.article-card h2 a {
    text-decoration: none;
}

.article-card p {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 15px;
}

.text-link {
    margin-top: auto;
    color: var(--accent);
    font-size: 14px;
    font-weight: 720;
    text-decoration: none;
}

.empty-state {
    padding: 44px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

.section-cta {
    padding-top: 30px;
}

.cta-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 36px;
    padding: 40px;
    border-radius: calc(var(--radius) + 6px);
    background: var(--ink);
    color: var(--page);
    box-shadow: var(--shadow);
}

.cta-panel h2 {
    margin-bottom: 10px;
    color: inherit;
}

.cta-panel p:not(.eyebrow) {
    max-width: 720px;
    margin: 0;
    color: color-mix(in srgb, var(--page) 72%, transparent);
}

.article-header {
    padding-bottom: 44px;
    border-bottom: 1px solid var(--line);
}

.article-shell {
    max-width: 920px;
}

.article-header h1 {
    max-width: 900px;
}

.article-byline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin-top: 28px;
    color: var(--muted);
    font-size: 13px;
}

.article-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 760px);
    justify-content: center;
    gap: 64px;
    align-items: start;
}

.article-toc {
    position: sticky;
    top: 104px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--muted);
    font-size: 13px;
}

.article-toc strong {
    display: block;
    margin-bottom: 10px;
    color: var(--ink);
}

.article-toc nav > ul {
    margin: 0;
    padding-left: 18px;
}

.article-toc a {
    text-decoration: none;
}

.article-content {
    min-width: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    line-height: 1.78;
}

.article-content h2 {
    margin-top: 2.3em;
    margin-bottom: 0.7em;
    font-size: 38px;
}

.article-content h3 {
    margin-top: 1.9em;
    margin-bottom: 0.6em;
    font-size: 28px;
}

.article-content p,
.article-content ul,
.article-content ol,
.article-content blockquote {
    margin-block: 1.15em;
}

.article-content li + li {
    margin-top: 0.48em;
}

.article-content blockquote {
    margin-inline: 0;
    padding: 18px 24px;
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
}

.article-content code {
    padding: 0.12em 0.32em;
    border-radius: 6px;
    background: var(--accent-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.88em;
}

.article-related-links {
    margin-top: 48px;
    padding: 26px 28px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--accent-soft);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

.article-related-links strong {
    display: block;
    color: var(--ink);
    font-size: 16px;
}

.article-related-links ul {
    margin: 14px 0 0;
    padding-left: 22px;
}

.article-related-links li + li {
    margin-top: 9px;
}

.article-related-links a {
    color: var(--accent);
    font-weight: 700;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.article-notice {
    margin-top: 48px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

.article-notice p {
    margin: 6px 0 0;
    color: var(--muted);
}

.related-section {
    border-top: 1px solid var(--line);
}

.related-section .article-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 920px;
}

.related-section .article-card {
    min-height: 270px;
}

.site-footer {
    margin-top: 54px;
    padding: 54px 0 24px;
    border-top: 1px solid var(--line);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 44px;
}

.footer-grid p {
    max-width: 420px;
    color: var(--muted);
    font-size: 14px;
}

.footer-grid nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-grid nav a {
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}

.footer-grid nav a:hover {
    color: var(--ink);
}

.footer-bottom {
    margin-top: 38px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1040px) {
    .desktop-navigation {
        display: none;
    }

    .header-actions {
        margin-left: auto;
    }

    .category-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .article-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .article-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .article-toc {
        position: static;
        max-width: 760px;
        width: 100%;
        margin-inline: auto;
    }

    .article-content {
        max-width: 760px;
        margin-inline: auto;
    }
}

@media (max-width: 860px) {
    .language-popover-panel {
        width: min(650px, 100%);
        padding: 24px;
    }

    .language-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .language-popover {
        width: min(calc(100% - 20px), 960px);
        max-height: calc(100dvh - 20px);
    }

    .language-popover-panel {
        max-height: calc(100vh - 20px);
        padding: 20px;
        border-radius: 22px;
    }

    .language-popover-header {
        margin-bottom: 18px;
    }

    .language-popover-header h2 {
        font-size: 30px;
    }

    .language-grid {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .language-card {
        min-height: 68px;
        padding: 12px 14px;
    }

    .shell {
        width: min(calc(100% - 28px), var(--shell));
    }

    .header-inner {
        min-height: 64px;
        gap: 12px;
    }

    .brand {
        font-size: 18px;
    }

    .brand-mark {
        width: 24px;
        height: 24px;
    }

    .button-small {
        display: none;
    }

    .section {
        padding-block: 52px;
    }

    .section-hero {
        padding-top: 56px;
        padding-bottom: 40px;
    }

    h1 {
        font-size: clamp(38px, 13vw, 58px);
    }

    .category-grid,
    .article-grid,
    .search-results,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .category-card {
        min-height: 210px;
    }

    .search-panel {
        grid-template-columns: 1fr;
        padding: 22px;
    }

    .search-results {
        grid-column: auto;
    }

    .article-card {
        min-height: 0;
    }

    .cta-panel {
        align-items: flex-start;
        flex-direction: column;
        padding: 28px;
    }

    .article-content {
        font-size: 18px;
    }

    .article-content h2 {
        font-size: 31px;
    }

    .article-related-links {
        margin-top: 38px;
        padding: 21px;
    }

    .related-section .article-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        gap: 26px;
    }
}
