:root {
    /* Palette: navy + gold, institutional */
    --navy-950: #081729;
    --navy-900: #0C2240;
    --navy-800: #133158;
    --gold-600: #A8843C;
    --gold-500: #B68B40;
    --gold-400: #C9A45C;
    --gold-100: #EFE6D3;

    /* Theme: dark (default) */
    --bg: #0A1626;
    --bg-alt: #0D1C30;
    --heading: #F4F1E9;
    --body: #A3B0C2;
    --muted: #6F7E93;
    --line: rgba(244, 241, 233, 0.12);
    --nav-bg: rgba(10, 22, 38, 0.9);
    --btn-primary-bg: var(--gold-500);
    --btn-primary-bg-hover: var(--gold-400);
    --btn-primary-fg: #0A1626;
    --card-bg: rgba(255, 255, 255, 0.02);
    --card-hover: rgba(201, 164, 92, 0.06);
    --hero-glow: rgba(201, 164, 92, 0.11);
    --accent: var(--gold-400);
    --accent-strong: #E4C98C;
    color-scheme: dark;

    --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --container: 1120px;
    --nav-height: 72px;
}

[data-theme="light"] {
    --bg: #FFFFFF;
    --bg-alt: #F8F6F1;
    --heading: #14233C;
    --body: #46586F;
    --muted: #76859B;
    --line: #E5E1D6;
    --nav-bg: rgba(255, 255, 255, 0.92);
    --btn-primary-bg: var(--navy-900);
    --btn-primary-bg-hover: var(--navy-800);
    --btn-primary-fg: #FFFFFF;
    --card-bg: rgba(20, 35, 60, 0.02);
    --card-hover: rgba(182, 139, 64, 0.05);
    --hero-glow: rgba(182, 139, 64, 0.12);
    --accent: var(--gold-600);
    --accent-strong: #8F6B2C;
    color-scheme: light;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-height) + 16px); }

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--body);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color .3s ease, color .3s ease;
}

h1, h2, h3 {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--heading);
    line-height: 1.15;
    text-wrap: balance;
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 3px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

.eyebrow {
    display: block;
    font-family: var(--font-sans);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 14px;
}

section { padding: 96px 0; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section-head { max-width: 720px; margin-bottom: 56px; }
.section-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); margin-bottom: 16px; }
.section-head p { font-size: 1.08rem; }

/* Nav */
.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-height);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.brand { display: flex; align-items: baseline; gap: 2px; font-family: var(--font-serif); font-size: 1.28rem; font-weight: 600; color: var(--heading); }
.brand .tld { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 30px; list-style: none; }
.nav-links a { font-size: .92rem; font-weight: 500; color: var(--body); transition: color .2s; }
.nav-links a:hover { color: var(--heading); }
.theme-toggle {
    background: none; border: 1px solid var(--line); border-radius: 50%;
    width: 36px; height: 36px; cursor: pointer; color: var(--body);
    font-size: .95rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
    transition: color .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--heading); border-color: var(--accent); }
.nav-cta {
    display: inline-block; padding: 9px 18px; border-radius: 6px;
    background: var(--btn-primary-bg); color: var(--btn-primary-fg) !important;
    font-weight: 600; font-size: .9rem; transition: background .2s;
}
.nav-cta:hover { background: var(--btn-primary-bg-hover); }

/* Hero */
.hero {
    position: relative;
    padding: calc(var(--nav-height) + 96px) 0 110px;
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute; top: -240px; right: -160px;
    width: 720px; height: 720px; border-radius: 50%;
    background: radial-gradient(circle, var(--hero-glow) 0%, transparent 65%);
    pointer-events: none;
}
.hero-inner { position: relative; max-width: 780px; }
.hero h1 { font-size: clamp(2.4rem, 5.4vw, 3.9rem); margin-bottom: 24px; }
.hero h1 em { font-style: normal; color: var(--accent-strong); }
.hero p.lede { font-size: 1.18rem; max-width: 640px; margin-bottom: 36px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
    display: inline-block; padding: 13px 26px; border-radius: 6px;
    font-weight: 600; font-size: .98rem; transition: background .2s, border-color .2s, color .2s;
}
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); }
.btn-primary:hover { background: var(--btn-primary-bg-hover); }
.btn-ghost { border: 1px solid var(--line); color: var(--heading); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); }

.hero-chart { position: absolute; bottom: 0; left: 0; right: 0; height: 190px; opacity: .55; pointer-events: none; }
.hero-chart svg { width: 100%; height: 100%; display: block; }

/* Stats strip */
.stats { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg-alt); padding: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 34px 24px; text-align: center; border-left: 1px solid var(--line); }
.stat:first-child { border-left: none; }
.stat .num { font-family: var(--font-serif); font-size: 2rem; font-weight: 600; color: var(--heading); display: block; }
.stat .lbl { font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* Story */
.story-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 64px; align-items: start; }
.story-copy p + p { margin-top: 18px; }
.story-copy strong { color: var(--heading); font-weight: 600; }
.pull-quote {
    border-left: 3px solid var(--gold-500);
    padding: 26px 30px;
    background: var(--card-bg);
    border-radius: 0 8px 8px 0;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    line-height: 1.5;
    color: var(--heading);
    position: sticky; top: calc(var(--nav-height) + 32px);
}
.pull-quote footer { margin-top: 16px; font-family: var(--font-sans); font-size: .85rem; color: var(--muted); }

/* Timeline */
.timeline { list-style: none; margin-top: 48px; border-left: 1px solid var(--line); padding-left: 0; }
.timeline li { position: relative; padding: 0 0 34px 34px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: ""; position: absolute; left: -5px; top: 8px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--gold-500);
}
.timeline .year { font-family: var(--font-serif); font-weight: 600; color: var(--accent-strong); margin-right: 10px; }
.timeline .evt { color: var(--body); }
.timeline .evt b { color: var(--heading); font-weight: 600; }

/* Rules */
.rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.rule-card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 30px 28px;
    transition: background .2s, border-color .2s;
}
.rule-card:hover { background: var(--card-hover); border-color: rgba(201, 164, 92, .35); }
.rule-card .idx { font-family: var(--font-serif); font-size: .95rem; color: var(--accent); display: block; margin-bottom: 12px; }
.rule-card h3 { font-size: 1.18rem; margin-bottom: 10px; }
.rule-card p { font-size: .95rem; }

.systems-table { margin-top: 56px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { text-align: left; padding: 15px 18px; border-bottom: 1px solid var(--line); font-size: .95rem; }
th { font-family: var(--font-serif); color: var(--heading); font-size: 1.02rem; font-weight: 600; }
td:first-child { color: var(--heading); font-weight: 500; white-space: nowrap; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--card-hover); }
.table-note { margin-top: 14px; font-size: .85rem; color: var(--muted); }

/* Turtles / lessons */
.lessons-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.lesson {
    display: flex; gap: 18px; align-items: flex-start;
    background: var(--card-bg); border: 1px solid var(--line);
    border-radius: 10px; padding: 26px;
}
.lesson .glyph {
    flex: none; width: 42px; height: 42px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(201, 164, 92, .12); color: var(--accent-strong);
    font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600;
}
.lesson h3 { font-size: 1.08rem; margin-bottom: 6px; }
.lesson p { font-size: .93rem; }

/* Books */
.books-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.book {
    display: flex; flex-direction: column;
    background: var(--card-bg); border: 1px solid var(--line);
    border-radius: 10px; overflow: hidden;
    transition: transform .2s, border-color .2s, background .2s;
}
.book:hover { transform: translateY(-4px); border-color: rgba(201, 164, 92, .4); background: var(--card-hover); }
.book-spine {
    padding: 30px 24px;
    min-height: 168px;
    display: flex; flex-direction: column; justify-content: flex-end;
    background: linear-gradient(160deg, var(--navy-900), var(--navy-950));
    border-bottom: 2px solid var(--gold-500);
}
.book-spine .bk-title { font-family: var(--font-serif); font-size: 1.22rem; font-weight: 600; color: var(--gold-100); line-height: 1.25; }
.book-spine .bk-author { margin-top: 8px; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-400); }
.book-body { padding: 22px 24px 26px; display: flex; flex-direction: column; flex: 1; }
.book-body .tag { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.book-body p { font-size: .9rem; flex: 1; }
.book-link {
    margin-top: 20px; display: inline-flex; align-items: center; gap: 8px;
    font-weight: 600; font-size: .9rem; color: var(--accent-strong);
}
.book-link .arrow { transition: transform .2s; }
.book:hover .book-link .arrow { transform: translateX(4px); }
.books-more { margin-top: 44px; display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

/* FAQ */
.faq { max-width: 780px; }
details {
    border-bottom: 1px solid var(--line);
    padding: 6px 0;
}
summary {
    cursor: pointer; list-style: none;
    display: flex; justify-content: space-between; align-items: center; gap: 20px;
    padding: 18px 0;
    font-family: var(--font-serif); font-size: 1.12rem; font-weight: 600; color: var(--heading);
}
summary::-webkit-details-marker { display: none; }
summary .chev { flex: none; color: var(--accent); transition: transform .25s; font-size: .85rem; }
details[open] summary .chev { transform: rotate(45deg); }
details .faq-a { padding: 0 0 22px; font-size: .97rem; max-width: 680px; }

/* Footer */
footer.site {
    border-top: 1px solid var(--line);
    background: var(--bg-alt);
    padding: 56px 0 40px;
    font-size: .87rem;
    color: var(--muted);
}
.footer-grid { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; margin-bottom: 36px; }
.footer-brand { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; color: var(--heading); margin-bottom: 8px; }
.footer-nav { display: flex; gap: 22px; list-style: none; flex-wrap: wrap; }
.footer-nav a:hover { color: var(--heading); }
.fine-print { border-top: 1px solid var(--line); padding-top: 26px; }
.fine-print p + p { margin-top: 10px; }

/* Responsive */
@media (max-width: 960px) {
    section { padding: 72px 0; }
    .nav-links li.hide-m { display: none; }
    .story-grid { grid-template-columns: 1fr; gap: 40px; }
    .pull-quote { position: static; }
    .rules-grid { grid-template-columns: 1fr 1fr; }
    .books-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat:nth-child(3) { border-left: none; }
    .stat { border-top: 1px solid var(--line); }
    .stat:nth-child(-n+2) { border-top: none; }
}
@media (max-width: 600px) {
    .rules-grid, .books-grid, .lessons-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .hero { padding-top: calc(var(--nav-height) + 64px); }
    .nav-links { gap: 12px; }
    .container { padding: 0 18px; }
    .brand { font-size: 1.05rem; }
    .nav-cta { padding: 8px 14px; font-size: .85rem; }
    .theme-toggle { width: 32px; height: 32px; }
    .stat .num { font-size: 1.6rem; }
}

/* Article pages
   ========================================================================== */

.page-hero {
    position: relative;
    padding: calc(var(--nav-height) + 80px) 0 64px;
    overflow: hidden;
}

.page-hero::before {
    content: "";
    position: absolute; top: -260px; right: -180px;
    width: 640px; height: 640px; border-radius: 50%;
    background: radial-gradient(circle, var(--hero-glow) 0%, transparent 65%);
    pointer-events: none;
}

.page-hero .inner { position: relative; max-width: 840px; }
.page-hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.1rem); margin-bottom: 20px; }
.page-hero .lede { font-size: 1.14rem; max-width: 720px; }

.breadcrumbs { font-size: .85rem; color: var(--muted); margin-bottom: 26px; }
.breadcrumbs a { color: var(--accent); }
.breadcrumbs a:hover { color: var(--accent-strong); }
.breadcrumbs .sep { margin: 0 9px; opacity: .6; }

.article { max-width: 780px; padding: 24px 0 96px; }
.article h2 { font-size: 1.72rem; margin: 56px 0 6px; }
.article h3 { font-size: 1.24rem; margin: 36px 0 0; }
.article p { margin-top: 18px; }
.article ul, .article ol { margin: 18px 0 0 24px; }
.article li + li { margin-top: 10px; }
.article li::marker { color: var(--accent); }
.article strong { color: var(--heading); font-weight: 600; }
.article .systems-table { margin-top: 28px; }

.inline-link { color: var(--accent-strong); border-bottom: 1px solid rgba(201, 164, 92, .35); transition: border-color .2s; }
.inline-link:hover { border-bottom-color: var(--accent-strong); }

.callout {
    border-left: 3px solid var(--gold-500);
    background: var(--card-bg);
    border-radius: 0 8px 8px 0;
    padding: 20px 26px;
    margin-top: 28px;
    font-size: .95rem;
}
.callout strong { color: var(--heading); }

.cta-panel {
    margin-top: 72px;
    border: 1px solid var(--line);
    background: var(--card-bg);
    border-radius: 12px;
    padding: 42px 36px;
    text-align: center;
}
.cta-panel h2 { margin: 0 0 12px; font-size: 1.55rem; }
.cta-panel p { max-width: 580px; margin: 0 auto 26px; }
.cta-panel .hero-actions { justify-content: center; }

.section-more { margin-top: 44px; text-align: center; }

/* Guide cards
   ========================================================================== */

.guides-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 8px; }
.guide-card {
    display: flex; flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 30px 28px;
    transition: transform .2s, border-color .2s, background .2s;
}
.guide-card:hover { transform: translateY(-4px); border-color: rgba(201, 164, 92, .4); background: var(--card-hover); }
.guide-card .g-tag {
    font-size: .72rem; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase; color: var(--accent); margin-bottom: 12px;
}
.guide-card h2, .guide-card h3 { font-size: 1.22rem; margin-bottom: 10px; }
.guide-card p { font-size: .93rem; flex: 1; }
.guide-card .book-link { margin-top: 18px; }
.guide-card:hover .book-link .arrow { transform: translateX(4px); }
@media (max-width: 960px) { .guides-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .guides-grid { grid-template-columns: 1fr; } }
