:root {
  --ink: #172033;
  --muted: #59657a;
  --paper: #fbfaf6;
  --surface: #ffffff;
  --line: #dce1e8;
  --chem: #087f6b;
  --chem-soft: #e5f5f0;
  --phys: #3157a4;
  --phys-soft: #eaf0fb;
  --accent: #b7521c;
  --shadow: 0 10px 30px rgba(23, 32, 51, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; line-height: 1.6; background: radial-gradient(circle at 90% 0, #eef2f8 0, transparent 28rem), var(--paper); }
a { color: inherit; text-decoration-thickness: .08em; text-underline-offset: .16em; }
a:hover { text-decoration-thickness: .14em; }
a:focus-visible, button:focus-visible { outline: 3px solid #f0a34c; outline-offset: 3px; border-radius: .3rem; }
.skip { position: absolute; left: -999rem; top: .5rem; z-index: 10; padding: .6rem 1rem; background: var(--ink); color: #fff; }
.skip:focus { left: .5rem; }
.wrap { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.site-header { padding: 1rem 0; border-bottom: 1px solid rgba(23,32,51,.1); background: rgba(251,250,246,.9); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .68rem; }
.home-link { font-size: .92rem; font-weight: 700; }
main { padding: clamp(2rem, 6vw, 5.5rem) 0 4rem; }
.hero { max-width: 850px; }
.eyebrow { color: var(--accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -.025em; }
h1 { font-size: clamp(2.25rem, 7vw, 5.25rem); margin: .35rem 0 1rem; }
h2 { font-size: clamp(1.55rem, 4vw, 2.3rem); margin: 2.7rem 0 1rem; }
h3 { font-size: 1.2rem; }
.lead { color: var(--muted); font-size: clamp(1.05rem, 2.5vw, 1.3rem); max-width: 68ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .65rem; margin: 1.5rem 0 0; }
.actions, .portal-grid, .resources { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .85rem; margin-top: 1.5rem; }
.action, .chapter-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: 1.1rem; box-shadow: var(--shadow); text-decoration: none; }
.action:hover, .chapter-card:hover { border-color: currentColor; transform: translateY(-2px); }
.action { font-weight: 800; }
.action span, .chapter-card span { display: block; margin-top: .3rem; color: var(--muted); font-size: .9rem; font-weight: 500; }
.resource { padding: 1rem 0; border-top: 2px solid var(--line); }
.resource strong { display: block; margin-bottom: .25rem; }
.resource span { color: var(--muted); font-size: .92rem; }
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: .8rem; }
.chapter-card { border-left: .32rem solid var(--phys); }
.chapter-card.chemistry { border-left-color: var(--chem); }
.chapter-card strong { display: block; }
.chapter-card .number { color: var(--phys); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.chapter-card.chemistry .number { color: var(--chem); }
.section-label { display: flex; align-items: center; gap: .65rem; }
.section-label::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.portal-head { padding-left: 1.2rem; border-left: .38rem solid var(--phys); }
.chemistry .portal-head { border-left-color: var(--chem); }
.portal-head h1 { font-size: clamp(2rem, 6vw, 4rem); }
.portal-grid .action:first-child { color: var(--accent); }
.chapter-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.chapter-nav a { font-weight: 750; }
.script-card { background: var(--surface); border: 1px solid var(--line); border-radius: 1.1rem; padding: clamp(1rem, 3vw, 1.7rem); margin: 1.2rem 0; box-shadow: var(--shadow); }
.instructions { max-width: 80ch; color: #303b4f; }
.instructions code, .instructions .math { background: #f1f3f6; border-radius: .25rem; padding: .05rem .28rem; font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
.downloads { display: flex; flex-wrap: wrap; gap: .65rem; margin: 1rem 0; }
.button { display: inline-block; border-radius: .65rem; background: var(--ink); color: #fff; padding: .65rem .9rem; font-weight: 800; text-decoration: none; }
.button.secondary { background: #eef1f5; color: var(--ink); }
pre { overflow: auto; max-height: 34rem; padding: 1rem; border-radius: .75rem; background: #111827; color: #edf2f7; font: .86rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 4; }
.notice { padding: 1.2rem; border: 1px solid #d7c48e; background: #fff8dd; border-radius: .8rem; max-width: 70ch; }
.site-footer { padding: 2rem 0 3rem; color: var(--muted); border-top: 1px solid var(--line); font-size: .88rem; }
.footer-inner { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; }
.footer-links { display: flex; flex-wrap: wrap; gap: .55rem 1.25rem; }
.site-footer a { color: inherit; text-underline-offset: .2em; }
.site-footer a:hover { color: var(--ink); }
.legal-head { max-width: 49rem; }
.legal-copy { max-width: 49rem; padding-bottom: 2rem; }
.legal-copy section { padding: 1.5rem 0; border-top: 1px solid var(--line); }
.legal-copy h2 { margin: 0 0 .65rem; font-size: 1.25rem; }
.legal-copy p { margin: .45rem 0; line-height: 1.75; }
.legal-date { color: var(--muted); font-size: .88rem; }
.errata-head { border-left-color: var(--accent); }
.errata-copy .notice { margin-top: .8rem; }
.pill { display: inline-block; padding: .25rem .55rem; border-radius: 999px; background: var(--phys-soft); color: var(--phys); font-weight: 800; font-size: .75rem; }
.chemistry .pill { background: var(--chem-soft); color: var(--chem); }

@media (max-width: 560px) {
  .site-header .wrap { align-items: flex-start; }
  .brand { max-width: 16rem; }
  .chapter-nav { flex-direction: column; }
  h1 { overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
