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

:root {
  color-scheme: light;
  --paper: #f7f6f2;
  --surface: #fffefa;
  --ink: #202925;
  --muted: #69736d;
  --line: #dce2d9;
  --accent: #176f5b;
  --accent-soft: #e7f3ee;
  --code: #182a26;
  --code-ink: #f0f7f2;
  --shadow: 0 18px 60px rgba(24, 49, 37, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101815;
  --surface: #17231e;
  --ink: #eaf2e9;
  --muted: #a5b5aa;
  --line: #2d4336;
  --accent: #7ecbac;
  --accent-soft: #213d31;
  --code: #0c1511;
  --code-ink: #eaf2e9;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: 'DM Sans', Arial, sans-serif; font-size: 16px; line-height: 1.65; }
button, input { font: inherit; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.skip-link { position: absolute; top: -80px; left: 12px; z-index: 100; padding: 8px 14px; background: var(--ink); color: var(--paper); }
.skip-link:focus { top: 12px; }

.site-header { height: 74px; display: flex; align-items: center; gap: 28px; padding: 0 32px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.brand { flex: 0 0 234px; color: var(--ink); font: 600 28px/1 'Fraunces', Georgia, serif; text-decoration: none; letter-spacing: -1px; }
.brand-dot { color: var(--accent); }
.top-nav { display: flex; gap: 28px; align-items: center; }
.top-nav a { color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; }
.top-nav a:hover { color: var(--ink); }
.header-actions { margin-left: auto; display: flex; gap: 10px; }
.search-button, .theme-button { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); min-height: 38px; }
.search-button { width: 170px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; font-size: 13px; color: var(--muted); }
.search-button kbd { font: inherit; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.theme-button { padding: 0 11px; font-size: 12px; font-weight: 700; }

.site-shell { display: grid; grid-template-columns: 266px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.side-nav { border-right: 1px solid var(--line); padding: 38px 20px 28px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.side-label, .eyebrow, .on-this-page > span { font-size: 11px; line-height: 1.3; font-weight: 700; letter-spacing: 0.15em; color: var(--accent); }
.side-label { padding: 0 14px 14px; }
.nav-link { display: block; border-radius: 8px; padding: 9px 14px; color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.35; text-decoration: none; }
.nav-link:hover, .nav-link.active { color: var(--ink); background: var(--accent-soft); }
.side-coverage { margin-top: 12px; border-top: 1px solid var(--line); border-radius: 0; padding-top: 16px; }
.side-foot { margin-top: auto; padding: 28px 14px 0; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); line-height: 1.8; }
main { min-width: 0; }
.hero, .home-section, .page-intro, .course-block, .coverage-table { max-width: 1100px; margin-left: auto; margin-right: auto; }

.hero { padding: 106px 64px 98px; border-bottom: 1px solid var(--line); position: relative; }
.hero:after { content: ''; position: absolute; width: 160px; height: 160px; right: 10%; top: 18%; border: 1px solid var(--line); border-radius: 50%; box-shadow: 0 0 0 28px var(--paper), 0 0 0 29px var(--line), 0 0 0 57px var(--paper), 0 0 0 58px var(--line); opacity: 0.8; pointer-events: none; }
.hero h1, .page-intro h1 { font: 600 clamp(58px, 7vw, 100px)/1.04 'Fraunces', Georgia, serif; letter-spacing: -0.055em; margin: 20px 0 24px; max-width: 740px; }
.hero h1 em { color: var(--accent); font-weight: 500; }
.hero p { max-width: 580px; color: var(--muted); font-size: 18px; line-height: 1.75; margin: 0; position: relative; z-index: 1; }
.hero-actions { display: flex; align-items: center; gap: 26px; margin-top: 38px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--surface); border-radius: 8px; padding: 11px 18px; font-size: 14px; font-weight: 700; text-decoration: none; min-height: 46px; }
html[data-theme="dark"] .primary-button { color: #102018; }
.primary-button:hover { opacity: 0.9; }
.text-button { font-weight: 700; font-size: 14px; }
.home-section { padding: 64px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 24px; }
.section-heading h2 { font: 600 30px/1.2 'Fraunces', Georgia, serif; letter-spacing: -0.035em; margin: 10px 0 0; }
.section-heading p, .section-heading > span { color: var(--muted); margin: 0; font-size: 14px; }
.subject-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.subject-card { display: flex; flex-direction: column; min-height: 224px; padding: 25px 28px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .18s, transform .18s, box-shadow .18s; }
.subject-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.subject-number { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .14em; }
.subject-card h2 { font: 600 28px/1.15 'Fraunces', Georgia, serif; margin: 28px 0 8px; letter-spacing: -0.03em; }
.subject-card p { color: var(--muted); font-size: 14px; margin: 0; }
.card-footer { margin-top: auto; padding-top: 18px; font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }

.page-intro { padding: 58px 64px 44px; }
.page-intro h1 { font-size: clamp(45px, 5vw, 72px); margin: 12px 0 14px; }
.page-intro p { color: var(--muted); font-size: 17px; max-width: 650px; margin: 0; }
.stat-line { color: var(--muted); margin-top: 22px; font-size: 13px; }
.stat-line strong { color: var(--ink); font-weight: 700; }
.stat-line span { margin: 0 10px; }
.course-block { padding: 12px 64px 54px; }
.course-block .section-heading h2 { font-size: 27px; }
.module { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; margin: 10px 0; overflow: hidden; }
.module summary { display: flex; justify-content: space-between; gap: 18px; padding: 14px 19px; font-weight: 700; cursor: pointer; list-style: none; }
.module summary::-webkit-details-marker { display: none; }
.module summary:before { content: '+'; color: var(--accent); margin-right: 12px; }
.module[open] summary:before { content: '-'; }
.module summary span:first-child { margin-right: auto; }
.module summary span:last-child { color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.topic-list { list-style: none; margin: 0; padding: 4px 20px 12px 46px; border-top: 1px solid var(--line); }
.topic-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; scroll-margin-top: 96px; }
.topic-list li:last-child { border-bottom: 0; }
.topic-title small { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; margin-top: 2px; }
.topic-title a { font-weight: 700; text-decoration: none; }
.topic-title a:hover { text-decoration: underline; }
.state { flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.state.ready { color: var(--accent); background: var(--accent-soft); }
.state.planned { color: var(--muted); background: var(--paper); }

.article-layout { display: grid; grid-template-columns: minmax(0, 760px) 180px; justify-content: center; gap: 68px; padding: 50px 58px 90px; }
.article { min-width: 0; }
.breadcrumbs { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); margin: 0 0 46px; }
.breadcrumbs a { color: var(--muted); }
.article > h1 { font: 600 clamp(43px, 4.3vw, 64px)/1.08 'Fraunces', Georgia, serif; letter-spacing: -.045em; margin: 12px 0 36px; }
.article-body { font-size: 17px; line-height: 1.78; }
.article-body > p:first-child { font-size: 19px; color: var(--muted); line-height: 1.7; }
.article-body h2 { font: 600 29px/1.2 'Fraunces', Georgia, serif; letter-spacing: -.025em; margin: 52px 0 18px; scroll-margin-top: 98px; }
.article-body h3 { font-size: 19px; margin: 32px 0 12px; scroll-margin-top: 98px; }
.article-body p { margin: 0 0 18px; }
.article-body ul, .article-body ol { padding-left: 23px; margin: 0 0 22px; }
.article-body li { margin: 6px 0; }
.article-body pre { background: var(--code); color: var(--code-ink); border-radius: 9px; padding: 22px 25px; overflow-x: auto; line-height: 1.55; font-size: 14px; margin: 22px 0 28px; }
.article-body code { font-family: Consolas, 'Courier New', monospace; font-size: .88em; background: var(--accent-soft); border-radius: 3px; padding: 2px 4px; }
.article-body pre code { background: none; padding: 0; font-size: inherit; }
.article-body blockquote { margin: 26px 0; padding: 12px 20px; border-left: 3px solid var(--accent); background: var(--accent-soft); color: var(--ink); }
.article-body blockquote p { margin: 0; }
.on-this-page { position: sticky; top: 116px; align-self: start; display: flex; flex-direction: column; gap: 12px; padding-top: 15px; border-top: 1px solid var(--line); }
.on-this-page > span { margin-bottom: 4px; }
.on-this-page a { color: var(--muted); font-size: 12px; line-height: 1.4; text-decoration: none; }
.on-this-page a:hover { color: var(--accent); }
.article-end { margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.article-end h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink); }
.article-end ul { padding-left: 18px; }
.article-end li { margin: 5px 0; }
.coverage-table { padding: 0 64px 80px; }
.coverage-table table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
.coverage-table th, .coverage-table td { text-align: left; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.coverage-table th:not(:first-child), .coverage-table td:not(:first-child) { text-align: right; }
.coverage-table thead th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.coverage-table tbody th { font-weight: 600; }
.coverage-table tbody th a { text-decoration: none; }

.search-dialog { width: min(680px, calc(100vw - 26px)); max-height: min(78vh, 720px); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 0; box-shadow: var(--shadow); position: fixed; top: 12vh; }
.search-dialog::backdrop { background: rgba(10, 20, 15, .55); }
.search-top { display: flex; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.search-top input { flex: 1; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 9px 12px; outline: none; }
.search-top button { background: none; border: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.search-results { overflow-y: auto; max-height: 59vh; padding: 8px; }
.search-result { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; color: var(--ink); text-decoration: none; border-radius: 7px; }
.search-result:hover, .search-result:focus { background: var(--accent-soft); }
.search-result span { font-weight: 600; font-size: 14px; }
.search-result small { color: var(--muted); font-size: 11px; text-align: right; }
.search-empty { padding: 24px; color: var(--muted); font-size: 14px; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 22px 32px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 11px; }
.site-footer span:first-child { font-weight: 700; color: var(--ink); }

@media (max-width: 1180px) {
  .article-layout { grid-template-columns: minmax(0, 760px); }
  .on-this-page { display: none; }
}
@media (max-width: 900px) {
  .brand { flex-basis: auto; }
  .site-shell { grid-template-columns: minmax(0, 1fr); }
  .side-nav { flex-direction: row; overflow-x: auto; padding: 10px 18px; border-right: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
  .side-label, .side-foot { display: none; }
  .nav-link { padding: 7px 10px; font-size: 12px; }
  .side-coverage { margin-top: 0; border-top: 0; border-radius: 8px; padding-top: 7px; }
  .hero:after { opacity: .3; right: 3%; }
}
@media (max-width: 640px) {
  .site-header { height: 62px; padding: 0 16px; gap: 14px; }
  .brand { font-size: 24px; }
  .top-nav { display: none; }
  .search-button { width: 58px; justify-content: center; font-size: 12px; color: var(--ink); }
  .search-button kbd { display: none; }
  .theme-button { padding: 0 8px; }
  .hero { padding: 70px 24px 64px; }
  .hero:after { display: none; }
  .hero h1 { font-size: 59px; }
  .hero p { font-size: 16px; }
  .home-section, .page-intro, .course-block, .coverage-table { padding-left: 24px; padding-right: 24px; }
  .home-section { padding-top: 46px; }
  .subject-grid { grid-template-columns: 1fr; }
  .subject-card { min-height: 190px; }
  .section-heading { align-items: start; }
  .section-heading > p { display: none; }
  .module summary { font-size: 13px; }
  .topic-list { padding-left: 20px; }
  .article-layout { padding: 36px 24px 72px; }
  .article > h1 { font-size: 46px; }
  .article-body { font-size: 16px; }
  .article-body pre { margin-left: -24px; margin-right: -24px; border-radius: 0; }
  .site-footer { flex-direction: column; padding: 20px 24px; }
}
