@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
    --bg: #fff8ee;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #fffdf9;
    --line: rgba(16, 61, 63, 0.12);
    --ink: #103d3f;
    --muted: #566f6c;
    --teal: #1d7675;
    --rust: #be5d38;
    --gold: #d4942a;
    --shadow: 0 18px 44px rgba(16, 61, 63, 0.12);
    --radius-xl: 34px;
    --radius-lg: 26px;
    --radius-md: 18px;
    --content-width: min(1220px, calc(100vw - 40px));
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(29, 118, 117, 0.08), transparent 26rem),
        radial-gradient(circle at bottom left, rgba(190, 93, 56, 0.08), transparent 28rem),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

code,
pre {
    font-family: "SFMono-Regular", "Consolas", monospace;
}

.page-shell {
    width: var(--content-width);
    margin: 0 auto;
    padding: 24px 0 56px;
}

.site-header {
    position: sticky;
    top: 16px;
    z-index: 30;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.86);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--teal), #11484a);
    color: #fffdf9;
    font-weight: 700;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.08;
}

.brand-text strong {
    font-size: 1rem;
}

.brand-text span:last-child {
    color: var(--muted);
    font-size: 0.82rem;
}

.site-nav {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
}

.site-nav a {
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--muted);
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    background: rgba(29, 118, 117, 0.10);
    color: var(--ink);
    transform: translateY(-1px);
}

.hero,
.detail-hero,
.section-shell,
.metric-tile,
.algorithm-card,
.detail-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.hero,
.detail-hero {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 24px;
    padding: 30px;
    margin-top: 28px;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.eyebrow,
.card-category,
.detail-breadcrumb {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero h1,
.detail-hero h1,
.section-header h2,
.detail-card h2,
.detail-card h3,
.algorithm-card h3 {
    margin: 0;
    font-family: "Fraunces", Georgia, serif;
    letter-spacing: -0.03em;
}

.hero h1 {
    font-size: clamp(2.6rem, 5vw, 4.8rem);
    line-height: 0.95;
}

.detail-hero h1,
.section-header h2 {
    font-size: clamp(1.9rem, 4vw, 3rem);
    line-height: 1;
}

.hero-text,
.detail-summary,
.card-summary,
.card-metric,
.detail-metric,
.site-footer {
    color: var(--muted);
    line-height: 1.6;
}

.hero-actions,
.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-actions {
    margin-top: 20px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 700;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(16, 61, 63, 0.12);
}

.button-primary {
    background: linear-gradient(145deg, var(--teal), #11484a);
    color: #fffdf9;
}

.button-secondary {
    background: rgba(255, 255, 255, 0.84);
    border-color: var(--line);
}

.hero-mosaic {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.hero-mosaic img,
.card-figure,
.detail-figure {
    width: 100%;
    border-radius: 22px;
    object-fit: cover;
}

.hero-mosaic img {
    min-height: 178px;
    background: var(--surface-strong);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.metric-tile {
    padding: 20px;
}

.metric-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.metric-label {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.section-shell,
.category-section {
    padding: 24px;
    margin-top: 20px;
}

.section-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-pill,
.chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.84);
    color: var(--muted);
    font-size: 0.92rem;
}

.category-pill {
    appearance: none;
    cursor: pointer;
    font: inherit;
}

.category-pill:hover,
.category-pill.is-active {
    background: rgba(29, 118, 117, 0.10);
    color: var(--ink);
}

.atlas-grid {
    margin-top: 18px;
}

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

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

.algorithm-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.card-figure {
    display: block;
    aspect-ratio: 16 / 10;
    background: var(--surface-strong);
    border-bottom: 1px solid var(--line);
}

.card-body,
.card-actions {
    padding: 18px;
}

.card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.card-summary {
    margin: 10px 0 0;
    font-size: 0.98rem;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.card-metric,
.detail-metric {
    margin: 14px 0 0;
    font-size: 0.95rem;
}

.card-actions {
    display: flex;
    gap: 10px;
    padding-top: 0;
}

.card-actions .button {
    flex: 1 1 0;
}

.detail-hero {
    align-items: center;
}

.detail-copy {
    display: flex;
    flex-direction: column;
}

.detail-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-figure {
    aspect-ratio: 16 / 10;
    background: var(--surface-strong);
}

.detail-figure-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-figure-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.detail-grid {
    margin-top: 20px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-card {
    padding: 22px;
}

.detail-card h2,
.detail-card h3 {
    font-size: 1.5rem;
}

.check-list,
.link-list {
    margin: 14px 0 0;
    padding-left: 18px;
    line-height: 1.7;
}

.link-list li,
.check-list li {
    margin-bottom: 8px;
}

.link-list a {
    font-weight: 700;
}

.link-list code {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.88rem;
    word-break: break-word;
}

.command-block {
    margin: 14px 0 0;
    padding: 18px;
    border-radius: var(--radius-md);
    background: #123537;
    color: #fff9ef;
    overflow: auto;
}

.compact-card .card-actions {
    padding-top: 0;
}

.accent-teal {
    box-shadow: 0 18px 44px rgba(29, 118, 117, 0.12);
}

.accent-rust {
    box-shadow: 0 18px 44px rgba(190, 93, 56, 0.12);
}

.accent-gold {
    box-shadow: 0 18px 44px rgba(212, 148, 42, 0.12);
}

.site-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
    padding: 0 4px;
}

.site-footer p {
    margin: 0;
}

@media (max-width: 1100px) {
    .hero,
    .detail-hero,
    .card-grid,
    .compact-grid,
    .detail-grid,
    .hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .page-shell {
        width: min(100vw - 24px, 100%);
        padding-top: 14px;
    }

    .site-header {
        position: static;
        border-radius: 28px;
        flex-direction: column;
        align-items: stretch;
    }

    .site-nav {
        justify-content: space-between;
    }

    .hero,
    .detail-hero,
    .hero-stats,
    .hero-mosaic,
    .card-grid,
    .compact-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .hero,
    .detail-hero,
    .section-shell,
    .category-section {
        padding: 20px;
    }

    .card-actions {
        flex-direction: column;
    }
}
