:root {
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --line: #dbe3ee;
    --paper: #ffffff;
    --paper-soft: #f8fafc;
    --navy: #172554;
    --blue: #1d4ed8;
    --blue-dark: #1e3a8a;
    --gold: #d99b22;
    --gold-soft: #fff7df;
    --rose: #9f1239;
    --success: #047857;
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.1);
    --radius: 22px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper-soft);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
    border-radius: 6px;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    padding: 12px 16px;
    color: white;
    background: var(--ink);
    border-radius: 10px;
    transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.app-home {
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 9% 4%, rgba(217, 155, 34, 0.13), transparent 24rem),
        linear-gradient(180deg, #f8fafc 0%, #ffffff 36%, #f8fafc 100%);
}

.site-header {
    position: sticky;
    z-index: 50;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    padding: max(12px, env(safe-area-inset-top)) clamp(20px, 5vw, 72px) 12px;
    border-bottom: 1px solid rgba(219, 227, 238, 0.9);
    background: rgba(248, 250, 252, 0.94);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 2px solid var(--gold);
    border-radius: 13px 13px 6px 6px;
    color: #fff;
    background: var(--navy);
    font-family: Georgia, serif;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: 0 8px 20px rgba(23, 37, 84, 0.18);
}
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 17px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }

.header-nav { display: flex; align-items: center; gap: 8px; }
.header-nav a {
    min-height: 44px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
}
.header-nav a:hover { color: var(--blue-dark); background: #e8eefb; }

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: clamp(36px, 6vw, 84px);
    align-items: center;
    max-width: 1280px;
    min-height: 650px;
    margin: 0 auto;
    padding: clamp(64px, 10vw, 128px) clamp(24px, 6vw, 80px);
}
.eyebrow {
    margin: 0 0 14px;
    color: var(--rose);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.hero h1 {
    max-width: 850px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(44px, 6.4vw, 80px);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 0.98;
}
.hero-lead {
    max-width: 760px;
    margin: 28px 0 0;
    color: var(--ink-soft);
    font-size: clamp(18px, 2vw, 22px);
    line-height: 1.65;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 14px 22px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 850;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { color: #fff; background: var(--navy); box-shadow: 0 12px 28px rgba(23, 37, 84, 0.22); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { border-color: var(--line); background: #fff; }
.button-secondary:hover { border-color: #9fb0c7; box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08); }
.trust-list { display: flex; flex-wrap: wrap; gap: 18px; padding: 0; margin: 28px 0 0; color: var(--muted); list-style: none; font-size: 13px; font-weight: 750; }
.trust-list li::before { content: "✓"; margin-right: 6px; color: var(--success); font-weight: 900; }

.hero-panel {
    padding: clamp(26px, 4vw, 42px);
    border: 1px solid rgba(217, 155, 34, 0.45);
    border-radius: 28px;
    color: #fff;
    background: linear-gradient(145deg, #0f172a, #172554 72%, #1e3a8a);
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.24);
}
.panel-kicker { margin: 0 0 26px; color: #f7d78d; font-size: 12px; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; }
.course-path { display: grid; gap: 0; padding: 0; margin: 0; list-style: none; }
.course-path li { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 0 14px; min-height: 94px; padding-bottom: 22px; }
.course-path li:not(:last-child)::after { content: ""; position: absolute; top: 38px; bottom: 0; left: 18px; width: 1px; background: rgba(247, 215, 141, 0.35); }
.course-path span { z-index: 1; display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(247, 215, 141, 0.55); border-radius: 50%; color: #f7d78d; background: #172554; font-size: 11px; font-weight: 900; }
.course-path strong { align-self: center; font-family: Georgia, serif; font-size: 21px; }
.course-path small { grid-column: 2; color: #cbd5e1; font-size: 13px; line-height: 1.5; }

.study-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    max-width: 1180px;
    margin: 0 auto 36px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--line);
    box-shadow: var(--shadow);
}
.study-strip article { display: flex; gap: 16px; align-items: center; padding: 26px; background: #fff; }
.study-strip article > span { display: grid; flex: 0 0 auto; width: 44px; height: 44px; place-items: center; border-radius: 12px; color: var(--navy); background: var(--gold-soft); font-family: Georgia, serif; font-size: 22px; font-weight: 800; }
.study-strip h2 { margin: 0; font-family: Georgia, serif; font-size: 20px; }
.study-strip p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.web-ad-shell {
    width: min(100% - 40px, 1180px);
    min-height: 112px;
    margin: 34px auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    text-align: center;
}
.web-ad-shell > span {
    display: block;
    margin-bottom: 8px;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.web-ad-slot { min-height: 70px; }
.web-ad-shell[data-ad-disabled="true"] { display: none; }
#chapter > .web-ad-shell,
#home > .web-ad-shell { width: 100%; margin: 34px 0 0; }

.library { max-width: 1280px; margin: 0 auto; padding: 86px clamp(24px, 6vw, 80px) 100px; }
.section-heading { display: flex; justify-content: space-between; gap: 32px; align-items: end; margin-bottom: 36px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(36px, 5vw, 54px); letter-spacing: -0.035em; }
.search-wrap { width: min(100%, 390px); }
.search-wrap label { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 800; }
.search-field { display: flex; overflow: hidden; border: 1px solid #b8c5d6; border-radius: 12px; background: #fff; box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06); }
.search-field:focus-within { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16); }
.search-field input { min-width: 0; flex: 1; min-height: 48px; padding: 12px 14px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-field button { border: 0; padding: 0 14px; color: var(--blue-dark); background: transparent; font-size: 13px; font-weight: 800; cursor: pointer; }
.search-status { margin: 7px 2px 0; color: var(--muted); font-size: 12px; }

.chapter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.chapter-card {
    position: relative;
    display: flex;
    min-height: 330px;
    flex-direction: column;
    padding: clamp(24px, 4vw, 36px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.065);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.chapter-card:hover { transform: translateY(-4px); border-color: #a9b8cc; box-shadow: 0 22px 48px rgba(15, 23, 42, 0.12); }
.chapter-card[hidden] { display: none; }
.chapter-card-featured { border-color: rgba(217, 155, 34, 0.7); background: linear-gradient(145deg, #fff, #fffaf0); }
.chapter-number { position: absolute; top: 18px; right: 24px; color: #e6ebf2; font-family: Georgia, serif; font-size: 64px; font-weight: 800; line-height: 1; }
.chapter-card-featured .chapter-number { color: #f4dfad; }
.chapter-day { position: relative; margin: 0; color: var(--rose); font-size: 11px; font-weight: 900; letter-spacing: 0.15em; text-transform: uppercase; }
.chapter-card h3 { position: relative; max-width: 82%; margin: 22px 0 14px; font-family: Georgia, serif; font-size: clamp(25px, 3vw, 34px); line-height: 1.12; }
.chapter-card > p:not(.chapter-day) { max-width: 620px; margin: 0; color: var(--ink-soft); line-height: 1.65; }
.chapter-card ul { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 22px 0 26px; list-style: none; }
.chapter-card li { padding: 6px 9px; border-radius: 7px; color: var(--ink-soft); background: #edf2f7; font-size: 11px; font-weight: 800; }
.chapter-card a { align-self: flex-start; margin-top: auto; color: var(--blue-dark); font-weight: 900; text-decoration: none; }
.chapter-card a::after { content: ""; position: absolute; inset: 0; }
.chapter-card a span { display: inline-block; margin-left: 6px; transition: transform 160ms ease; }
.chapter-card:hover a span { transform: translateX(4px); }
.empty-state { padding: 50px 24px; border: 1px dashed #9fb0c7; border-radius: var(--radius); color: var(--muted); text-align: center; background: #fff; }

.disclaimer { display: grid; grid-template-columns: auto 1fr; gap: 20px; max-width: 1120px; margin: 0 auto 100px; padding: 28px 32px; border: 1px solid #f1d692; border-radius: var(--radius); background: var(--gold-soft); }
.disclaimer > div:first-child { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 50%; color: #fff; background: var(--navy); font-family: Georgia, serif; font-size: 26px; }
.disclaimer h2 { margin: 0; font-family: Georgia, serif; font-size: 22px; }
.disclaimer p { margin: 7px 0 0; color: #5d4a1e; line-height: 1.65; }

.site-footer {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 26px;
    padding: 42px clamp(24px, 6vw, 80px) max(38px, env(safe-area-inset-bottom));
    color: #cbd5e1;
    background: var(--ink);
}
.site-footer strong { color: #fff; font-family: Georgia, serif; font-size: 18px; }
.site-footer p { margin: 6px 0 0; font-size: 13px; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 18px; }
.site-footer a { min-height: 36px; color: #e2e8f0; font-size: 13px; font-weight: 750; text-underline-offset: 4px; }
.copyright { grid-column: 1 / -1; padding-top: 20px; border-top: 1px solid #334155; color: #94a3b8; }

/* Standalone policy, terms, and support pages */
.legal-page { min-height: 100vh; color: var(--ink); background: var(--paper-soft); }
.legal-page .site-header { position: relative; }
.legal-main { width: min(100% - 32px, 920px); margin: 46px auto 80px; }
.legal-hero { padding: clamp(28px, 5vw, 52px); border-radius: 26px; color: #fff; background: linear-gradient(145deg, #0f172a, #172554); box-shadow: var(--shadow); }
.legal-hero .eyebrow { color: #f7d78d; }
.legal-hero h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(38px, 7vw, 62px); letter-spacing: -0.035em; }
.legal-hero p:last-child { max-width: 700px; margin: 18px 0 0; color: #dbe4f1; font-size: 17px; line-height: 1.65; }
.legal-card { margin-top: 22px; padding: clamp(24px, 5vw, 42px); border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 12px 34px rgba(15, 23, 42, 0.055); }
.legal-card h2 { margin: 0 0 14px; font-family: Georgia, serif; font-size: 26px; }
.legal-card h3 { margin: 26px 0 10px; font-size: 17px; }
.legal-card p, .legal-card li { color: var(--ink-soft); line-height: 1.72; }
.legal-card ul { padding-left: 22px; }
.legal-card a { color: var(--blue); font-weight: 750; text-underline-offset: 3px; }
.legal-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; margin: 18px 0 0; list-style: none; color: #cbd5e1; font-size: 13px; }
.notice { padding: 18px 20px; border-left: 4px solid var(--gold); border-radius: 8px; background: var(--gold-soft); }
.support-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.support-item { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.support-item h2 { font-size: 21px; }
.support-email { display: inline-flex; min-height: 48px; align-items: center; margin-top: 10px; padding: 12px 16px; border-radius: 10px; color: #fff !important; background: var(--navy); text-decoration: none; }

/* Course-wide menu injected into each preserved chapter page */
.course-library-nav {
    margin: 0 0 16px;
    padding: 0 0 16px;
    border-bottom: 1px solid #dbe3ee;
}
.course-library-label { margin: 0 12px 8px; color: #64748b; font-size: 10px; font-weight: 900; letter-spacing: 0.15em; text-transform: uppercase; }
.course-library-home,
.course-library-link,
.course-legal-link {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 9px;
    margin: 2px 4px;
    padding: 9px 11px;
    border-radius: 9px;
    color: #334155;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.25;
    text-decoration: none;
}
.course-library-home { margin-bottom: 8px; color: #fff; background: #172554; }
.course-library-home:hover { background: #1e3a8a; }
.course-library-link:hover,
.course-legal-link:hover { color: #172554; background: #e9eef7; }
.course-library-link[aria-current="page"] { color: #172554; background: #dfe8f7; box-shadow: inset 3px 0 0 #d99b22; }
.course-library-number { display: grid; flex: 0 0 28px; height: 28px; place-items: center; border: 1px solid #cbd5e1; border-radius: 8px; color: #475569; font-size: 10px; font-weight: 900; }
.course-library-link[aria-current="page"] .course-library-number { border-color: #172554; color: #fff; background: #172554; }
.course-legal-links { margin-top: 12px; padding-top: 12px; border-top: 1px solid #dbe3ee; }
.course-legal-link { min-height: 38px; padding-top: 7px; padding-bottom: 7px; color: #475569; }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; min-height: auto; }
    .hero-panel { max-width: 640px; }
    .study-strip { margin-inline: 20px; grid-template-columns: 1fr; }
    .section-heading { align-items: stretch; flex-direction: column; }
    .search-wrap { width: 100%; }
}

@media (max-width: 680px) {
    .site-header { align-items: flex-start; gap: 12px; }
    .header-nav { gap: 2px; }
    .header-nav a { padding-inline: 8px; font-size: 12px; }
    .brand small { display: none; }
    .hero { padding-top: 54px; }
    .hero h1 { font-size: clamp(40px, 13vw, 58px); }
    .chapter-grid { grid-template-columns: 1fr; }
    .chapter-card { min-height: 310px; }
    .chapter-card h3 { max-width: 88%; }
    .disclaimer { margin-inline: 20px; padding: 22px; }
    .site-footer { grid-template-columns: 1fr; }
    .site-footer nav { justify-content: flex-start; }
    .copyright { grid-column: 1; }
    .support-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
    .site-header, .site-footer, .hero-actions, .search-wrap { display: none !important; }
    .web-ad-shell { display: none !important; }
    .app-home, .legal-page { background: #fff; }
    .hero, .library, .legal-main { max-width: none; padding: 24px; margin: 0; }
    .hero-panel, .legal-hero { color: #000; border: 1px solid #aaa; background: #fff; box-shadow: none; }
    .chapter-card, .legal-card { break-inside: avoid; box-shadow: none; }
}
