:root {
    --ink: #17243a;
    --muted: #5f6d7c;
    --navy: #173f66;
    --navy-deep: #0d2d4c;
    --blue: #2675a9;
    --blue-soft: #edf6fb;
    --cyan: #35a7c7;
    --gold: #d6a23e;
    --gold-soft: #fff7e3;
    --green: #22795c;
    --green-soft: #eaf7f1;
    --line: #d9e2ea;
    --surface: #ffffff;
    --page: #f3f6f9;
    --shadow: 0 16px 42px rgba(21, 48, 76, 0.09);
    --radius: 18px;
    --content: 1240px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--page);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.7;
    text-rendering: optimizeLegibility;
}

a {
    color: #176c9f;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--navy-deep);
}

img,
svg {
    max-width: 100%;
}

.container {
    width: min(calc(100% - 36px), var(--content));
    margin-inline: auto;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    padding: 10px 16px;
    color: #fff;
    background: var(--navy-deep);
    border-radius: 8px;
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

.development-notice {
    padding: 7px 0;
    color: #583f0d;
    background: var(--gold-soft);
    border-bottom: 1px solid #ead6a5;
    font-size: 0.83rem;
}

.site-header {
    color: #fff;
    background:
        radial-gradient(circle at 85% 15%, rgba(53, 167, 199, 0.32), transparent 30%),
        linear-gradient(135deg, var(--navy-deep), var(--navy));
    box-shadow: 0 8px 28px rgba(13, 45, 76, 0.17);
}

.brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-height: 116px;
    padding-block: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: #fff;
    text-decoration: none;
}

.brand:hover {
    color: #fff;
}

.brand-mark {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 58px;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 14px;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.09);
}

.brand-mark span {
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    font-weight: 800;
}

.brand-mark span:first-child {
    background: rgba(255, 255, 255, 0.15);
}

.brand-mark span:last-child {
    color: #163653;
    background: #91d7e8;
}

.brand-copy {
    display: grid;
    line-height: 1.08;
}

.brand-copy strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    letter-spacing: 0.02em;
}

.brand-copy small {
    margin-top: 6px;
    color: #cbdce9;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.brand-tagline {
    max-width: 460px;
    margin: 0;
    color: #e6f3fa;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1rem, 2vw, 1.25rem);
    text-align: right;
}

.primary-nav {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(4, 24, 44, 0.28);
}

.nav-row {
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.nav-row a {
    position: relative;
    flex: 0 0 auto;
    padding: 13px 18px 12px;
    color: #eaf3f8;
    font-size: 0.91rem;
    font-weight: 700;
    text-decoration: none;
}

.nav-row a::after {
    position: absolute;
    right: 18px;
    bottom: 0;
    left: 18px;
    height: 3px;
    content: "";
    background: transparent;
    border-radius: 3px 3px 0 0;
}

.nav-row a:hover,
.nav-row a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-row a.active::after {
    background: #7bd2e7;
}

.content-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding-block: 32px 58px;
}

.content-shell.has-sidebar {
    grid-template-columns: 276px minmax(0, 1fr);
    align-items: start;
}

.guide-sidebar {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    overflow: auto;
    padding: 20px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 15px;
    box-shadow: 0 10px 28px rgba(21, 48, 76, 0.06);
}

.sidebar-kicker {
    margin: 0 0 18px;
    color: var(--navy);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sidebar-group + .sidebar-group {
    margin-top: 20px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
}

.sidebar-group h2 {
    margin: 0 0 8px;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-group ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-group li + li {
    margin-top: 3px;
}

.sidebar-group a {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 9px;
    color: #41566a;
    border-radius: 8px;
    font-size: 0.83rem;
    line-height: 1.35;
    text-decoration: none;
}

.sidebar-group a:hover {
    color: var(--navy-deep);
    background: var(--blue-soft);
}

.sidebar-group a.current {
    color: var(--navy-deep);
    background: #e3f1f8;
    box-shadow: inset 3px 0 0 var(--cyan);
    font-weight: 750;
}

.sidebar-group a small {
    flex: 0 0 auto;
    color: #8a7441;
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.main-content {
    min-width: 0;
}

.page-card {
    overflow: hidden;
    padding: clamp(26px, 5vw, 58px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.page-card > :first-child,
.page-card > .div1 > :first-child {
    margin-top: 0;
}

h1,
h2,
h3,
h4,
.scr1,
.scr2 {
    color: var(--navy-deep);
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.22;
}

h1,
.scr1 {
    margin: 0 0 16px;
    font-size: clamp(2rem, 4vw, 3.25rem);
    letter-spacing: -0.025em;
}

h2,
.scr2 {
    margin: 2.2em 0 0.7em;
    font-size: clamp(1.42rem, 2.6vw, 2rem);
}

h3 {
    margin: 1.8em 0 0.5em;
    font-size: 1.24rem;
}

p {
    margin: 0 0 1.15em;
}

ul,
ol,
.ul1,
.ol1 {
    margin: 0 0 1.3em;
    padding-left: 1.4em;
}

li + li {
    margin-top: 0.45em;
}

strong {
    color: #153e61;
}

.page-intro,
.hero {
    position: relative;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
}

.page-intro::after,
.hero::after {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 92px;
    height: 3px;
    content: "";
    background: linear-gradient(90deg, var(--cyan), var(--gold));
    border-radius: 3px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--blue);
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.lede {
    max-width: 850px;
    margin-bottom: 0;
    color: #41566a;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.06rem, 2vw, 1.28rem);
    line-height: 1.65;
}

.principle-note,
.status-panel {
    margin: 24px 0 0;
    padding: 17px 20px;
    background: var(--gold-soft);
    border: 1px solid #ead5a3;
    border-left: 5px solid var(--gold);
    border-radius: 10px;
}

.principle-note strong,
.status-panel strong {
    color: #674b13;
}

.guide-section {
    padding-top: 4px;
}

.guide-section + .guide-section {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #edf1f4;
}

.formula-panel,
.formula,
.p2:has(> strong:only-child) {
    overflow-x: auto;
}

.formula-panel {
    margin: 22px 0;
    padding: 17px 20px;
    background: #f2f8fc;
    border: 1px solid #cfe3ef;
    border-radius: 11px;
}

.formula-panel .formula,
p.formula {
    margin: 0.3em 0;
    color: var(--navy-deep);
    font-family: "Cambria Math", Cambria, Georgia, serif;
    font-size: 1.08rem;
    font-weight: 700;
    white-space: nowrap;
}

.example-panel,
.related-guides,
.toc-panel {
    margin: 24px 0;
    padding: 20px 22px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.example-panel h3,
.related-guides h2,
.toc-panel h2 {
    margin-top: 0;
}

.example-panel > :last-child,
.related-guides > :last-child,
.toc-panel > :last-child,
.principle-note > :last-child,
.status-panel > :last-child {
    margin-bottom: 0;
}

.diagram-link a {
    display: inline-flex;
    padding: 9px 13px;
    color: var(--navy);
    background: var(--blue-soft);
    border: 1px solid #cfe3ef;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 750;
    text-decoration: none;
}

.table-wrap {
    max-width: 100%;
    margin: 22px 0;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

table,
.data-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.91rem;
}

th,
td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    text-align: left;
}

th {
    color: #fff;
    background: var(--navy);
    font-size: 0.79rem;
    letter-spacing: 0.025em;
}

tbody tr:nth-child(even) {
    background: #f7fafc;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.p2,
.s1,
.s2,
.s4 {
    font: inherit;
}

.p2 > strong:first-child > .s1,
.p2 > strong:first-child {
    color: var(--navy-deep);
}

.home-page .page-card {
    padding: 0;
}

.home-page .hero {
    padding: clamp(34px, 6vw, 72px);
    color: #fff;
    background:
        radial-gradient(circle at 82% 22%, rgba(121, 215, 232, 0.25), transparent 30%),
        linear-gradient(140deg, #0e3559, #1a5c82);
}

.home-page .hero h1,
.home-page .hero strong {
    color: #fff;
}

.home-page .hero .eyebrow {
    color: #96ddec;
}

.home-page .hero .lede {
    color: #e5f0f6;
}

.hero-equation {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    margin: 28px 0 0;
    padding: 13px 18px;
    color: #fff;
    background: rgba(3, 25, 44, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    font-family: "Cambria Math", Cambria, Georgia, serif;
    font-size: 1.05rem;
}

.home-section {
    padding: clamp(30px, 5vw, 56px);
}

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

.home-section h2 {
    margin-top: 0;
}

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

.objective-card,
.rule-card,
.guide-card {
    padding: 20px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 13px;
}

.objective-card h3,
.rule-card h3,
.guide-card h3 {
    margin-top: 0;
}

.guide-group + .guide-group {
    margin-top: 44px;
}

.guide-group-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 17px;
}

.guide-group-header h3 {
    margin: 0;
    font-size: 1.42rem;
}

.guide-group-header p {
    max-width: 690px;
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.guide-card {
    display: flex;
    flex-direction: column;
    min-height: 190px;
}

.guide-card h4 {
    margin: 0 0 8px;
    font-size: 1.06rem;
}

.guide-card p {
    color: var(--muted);
    font-size: 0.9rem;
}

.guide-card a {
    margin-top: auto;
    font-size: 0.86rem;
    font-weight: 800;
}

.status-badge {
    display: inline-flex;
    align-self: flex-start;
    margin-bottom: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 850;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.status-badge.available {
    color: var(--green);
    background: var(--green-soft);
}

.status-badge.planned {
    color: #7d611e;
    background: var(--gold-soft);
}

.progress-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 18px 0 0;
}

.progress-summary span {
    padding: 7px 11px;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.82rem;
}

.site-footer {
    padding: 38px 0;
    color: #bcd0df;
    background: #0a2944;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 36px;
}

.site-footer strong {
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
}

.site-footer p {
    max-width: 420px;
    margin: 8px 0 0;
    font-size: 0.86rem;
}

.site-footer nav,
.footer-status {
    display: grid;
    align-content: start;
    gap: 7px;
}

.site-footer a {
    color: #dbe9f2;
    font-size: 0.86rem;
}

.footer-status {
    color: #9db4c5;
    font-size: 0.8rem;
}

@media (max-width: 1020px) {
    .content-shell.has-sidebar {
        grid-template-columns: 1fr;
    }

    .guide-sidebar {
        position: static;
        max-height: none;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
    }

    .sidebar-kicker {
        grid-column: 1 / -1;
        margin-bottom: 0;
    }

    .sidebar-group + .sidebar-group {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }

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

@media (max-width: 700px) {
    body {
        font-size: 15px;
    }

    .container {
        width: min(calc(100% - 22px), var(--content));
    }

    .brand-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
        min-height: 0;
    }

    .brand-tagline {
        text-align: left;
    }

    .nav-row a {
        padding-inline: 13px;
    }

    .content-shell {
        padding-block: 18px 34px;
    }

    .page-card {
        padding: 25px 20px;
        border-radius: 13px;
    }

    .home-page .page-card {
        padding: 0;
    }

    .home-page .hero,
    .home-section {
        padding: 28px 21px;
    }

    .guide-sidebar,
    .objective-grid,
    .rule-grid,
    .guide-grid,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .guide-group-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .hero-equation {
        display: flex;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media print {
    .development-notice,
    .site-header,
    .guide-sidebar,
    .site-footer,
    .diagram-link {
        display: none !important;
    }

    body {
        background: #fff;
        font-size: 11pt;
    }

    .content-shell,
    .content-shell.has-sidebar {
        display: block;
        width: 100%;
        padding: 0;
    }

    .page-card {
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    a {
        color: inherit;
    }
}
