/* Layout: one reading column; calculator pages open on a two-pane "workbench" (inputs | adding-machine tape) */
:root {
  --paper: #F1F4F2;
  --surface: #FFFFFF;
  --ink: #16212A;
  --muted: #56626B;
  --line: #D3DBD7;
  --key: #E6ECE9;
  --accent: #1B6853;
  --accent-soft: #D9ECE4;
  --on-accent: #FFFFFF;
  --tape: #FBF6E1;
  --tape-ink: #2B2921;
  --tape-rule: #CFC497;
  --err: #A33B2B;
  --focus: #2A77C9;
  --shadow: rgba(22, 33, 42, .16);

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r: 10px;
  --measure: 68ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10171B; --surface: #172026; --ink: #E4EBE7; --muted: #9AA8A1; --line: #2B373D; --key: #202B31;
    --accent: #62C3A2; --accent-soft: #1C3A31; --on-accent: #0C1A15;
    --tape: #23251B; --tape-ink: #EEE7C9; --tape-rule: #57543B; --err: #F08F7E; --focus: #7DB6F0; --shadow: rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10171B; --surface: #172026; --ink: #E4EBE7; --muted: #9AA8A1; --line: #2B373D; --key: #202B31;
  --accent: #62C3A2; --accent-soft: #1C3A31; --on-accent: #0C1A15;
  --tape: #23251B; --tape-ink: #EEE7C9; --tape-rule: #57543B; --err: #F08F7E; --focus: #7DB6F0; --shadow: rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; margin: 0; }
h2 { font-size: clamp(1.45rem, 3vw, 1.8rem); }
h3 { font-size: 1.15rem; }
code, .mono { font-family: var(--f-mono); }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 6px; z-index: 20; }
.skip:focus { left: 16px; }

/* ---------- header / footer ---------- */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap; padding-block: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--f-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em; }
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 500; font-size: 0.95rem; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--accent-soft); }

.site-foot { margin-top: 72px; border-top: 1px solid var(--line); background: var(--surface); font-size: 0.92rem; }
.site-foot .wrap { padding-block: 40px 32px; display: grid; gap: 28px; }
.foot-cols { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
.foot-cols h2 { font-size: 0.78rem; font-family: var(--f-body); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 10px; }
.foot-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.foot-cols a { color: var(--ink); text-decoration: none; }
.foot-cols a:hover { color: var(--accent); text-decoration: underline; }
.foot-cols p { margin: 8px 0 0; color: var(--muted); max-width: 38ch; }
.foot-base { color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; }
@media (max-width: 760px) { .foot-cols { grid-template-columns: 1fr 1fr; } .foot-cols > :first-child { grid-column: 1 / -1; } }

/* ---------- home ---------- */
.hero { padding-block: 56px 48px; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 3.9rem); line-height: 1.02; letter-spacing: -0.035em; margin-bottom: 18px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 54ch; margin: 0; }
.hero-points { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-points li { font-size: 0.88rem; font-weight: 500; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.hero-demo { display: grid; gap: 14px; min-width: 0; }
.hero-demo .calc-form { padding: 18px; }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: 1fr; gap: 32px; } .hero { padding-block: 36px 32px; } }

.shelf { padding-block: 28px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.shelf-head p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .cards { grid-template-columns: 1fr; } }
.card { display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none; transition: border-color 0.15s, transform 0.15s; min-width: 0; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { font-size: 1.12rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.5; flex: 1; }
.card .sample { font-family: var(--f-mono); font-size: 0.78rem; background: var(--tape); color: var(--tape-ink); padding: 6px 9px; border-radius: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.promise { padding-block: 40px 8px; }
.promise-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 20px; }
.promise-grid h3 { margin-bottom: 6px; }
.promise-grid p { margin: 0; color: var(--muted); }
@media (max-width: 760px) { .promise-grid { grid-template-columns: 1fr; gap: 18px; } }

/* ---------- calculator page ---------- */
.crumbs { font-size: 0.85rem; color: var(--muted); padding-block: 20px 0; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; opacity: 0.6; }
.crumbs a { color: var(--muted); }
.calc-head { padding-block: 14px 26px; display: grid; gap: 12px; }
.calc-head h1 { font-size: clamp(2rem, 4.6vw, 3rem); letter-spacing: -0.03em; }
.calc-head .lede { font-size: 1.08rem; }
.eyebrow { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); }
.meta { font-size: 0.85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }

.workbench { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .workbench { grid-template-columns: 1fr; } }

.calc-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; display: grid; gap: 20px; min-width: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .label { font-weight: 600; font-size: 0.9rem; }
.hint { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.input { display: flex; align-items: stretch; min-width: 0; background: var(--paper); border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; }
.input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input input, .input select { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink); font: 500 1.02rem/1.3 var(--f-mono); padding: 10px 12px; outline: none; }
.input input[type="text"] { font-family: var(--f-body); }
.input select { cursor: pointer; }
.pre, .suf { display: flex; align-items: center; padding: 0 11px; background: var(--key); color: var(--muted); font-family: var(--f-mono); font-size: 0.92rem; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; font-size: 0.95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.seg-wrap { border: 0; padding: 0; margin: 0; min-width: 0; }
.seg-wrap legend { font-weight: 600; font-size: 0.9rem; padding: 0; margin-bottom: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 14px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper); font-weight: 500; font-size: 0.92rem; }
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn { font: 600 0.92rem var(--f-body); border-radius: 999px; padding: 8px 16px; cursor: pointer; border: 1.5px solid var(--line); background: transparent; color: var(--ink); }
.btn:hover { border-color: var(--ink); }
.btn-solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-solid:hover { filter: brightness(1.08); border-color: var(--accent); }
.form-foot .hint { margin: 0; }

/* GPA rows */
.gpa-head, .gpa-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 0.8fr) minmax(0, 0.9fr) 36px; gap: 8px; align-items: center; }
.gpa-head { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.gpa-rows { display: grid; gap: 8px; }
.row-del { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.row-del:hover { color: var(--err); border-color: var(--err); }
@media (max-width: 480px) {
  .gpa-head { display: none; }
  .gpa-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; }
  .gpa-row > :first-child { grid-column: 1 / -1; }
}

/* ---------- the adding-machine tape ---------- */
.tape {
  position: sticky; top: 16px;
  background: var(--tape); color: var(--tape-ink);
  padding: 20px 22px 24px;
  border-radius: 3px 3px 0 0;
  font-family: var(--f-mono);
  box-shadow: 0 18px 30px -22px var(--shadow);
  margin-bottom: 10px;
  min-width: 0;
}
.tape::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 10px;
  background:
    linear-gradient(135deg, var(--tape) 5px, transparent 0) 0 0 / 10px 10px repeat-x,
    linear-gradient(225deg, var(--tape) 5px, transparent 0) 0 0 / 10px 10px repeat-x;
}
@media (max-width: 860px) { .tape { position: relative; top: 0; } }
.tape-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px dashed var(--tape-rule); }
.tape-rows { margin: 0; display: grid; gap: 7px; }
.tape-row { display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.tape-row dt { display: flex; align-items: baseline; gap: 8px; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.tape-row dt::after { content: ""; flex: 1 1 12px; min-width: 12px; border-bottom: 1px dotted var(--tape-rule); }
.tape-row dd { margin: 0; text-align: right; font-weight: 600; max-width: 62%; overflow-wrap: anywhere; }
.tape-row.lead { display: grid; gap: 2px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px dashed var(--tape-rule); }
.tape-row.lead dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; }
.tape-row.lead dt::after { display: none; }
.tape-row.lead dd { text-align: left; max-width: none; font-size: clamp(1.6rem, 4.4vw, 2.1rem); line-height: 1.15; letter-spacing: -0.02em; }
.tape-row.gap { margin-top: 10px; }
.tape-row.head dt { font-weight: 600; }
.tape-row.head dt::after { display: none; }
.tape-row.total { border-top: 3px double var(--tape-ink); padding-top: 8px; margin-top: 4px; }
.tape-row.total dd { font-size: 1.05rem; }
.tape-row.err dt { color: var(--err); font-family: var(--f-body); }
.tape-row.err dt::after { display: none; }
.tape-note { margin: 16px 0 0; font: 0.8rem/1.45 var(--f-body); opacity: 0.85; }

/* ---------- year-by-year table ---------- */
.extra { margin-top: 36px; display: grid; gap: 14px; }
.extra p { margin: 0; color: var(--muted); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); max-height: 460px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
th, td { padding: 9px 14px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { position: sticky; top: 0; background: var(--key); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
th:first-child { text-align: left; }
tbody th { font-weight: 500; }
tbody tr:last-child > * { border-bottom: 0; }
td { font-family: var(--f-mono); }

/* ---------- article content ---------- */
.guide { margin-top: 56px; display: grid; gap: 36px; max-width: var(--measure); }
.guide section { display: grid; gap: 12px; }
.guide p, .guide li { margin: 0; }
.guide ul, .guide ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.formula { font-family: var(--f-mono); background: var(--key); border-left: 3px solid var(--accent); padding: 14px 16px; border-radius: 0 6px 6px 0; overflow-x: auto; font-size: 0.95rem; line-height: 1.7; }
.formula span { display: block; white-space: nowrap; }
.example { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; display: grid; gap: 10px; }
.example h3 { font-size: 1rem; }
.guide .table-scroll { max-height: none; }
.guide table td, .guide table th { white-space: normal; }

.faq { margin-top: 48px; max-width: var(--measure); display: grid; gap: 14px; }
.faq details { border-bottom: 1px solid var(--line); padding-block: 4px 12px; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 1.04rem; padding-block: 8px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--f-mono); color: var(--accent); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 4px 0 0; color: var(--ink); }

.related { margin-top: 56px; display: grid; gap: 16px; }
.related .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .related .cards { grid-template-columns: 1fr; } }

/* ---------- plain pages ---------- */
.page { padding-block: 40px 0; }
.prose { max-width: var(--measure); display: grid; gap: 14px; }
.prose h1 { font-size: clamp(2rem, 4.6vw, 2.8rem); letter-spacing: -0.03em; margin-bottom: 4px; }
.prose h2 { font-size: 1.35rem; margin-top: 18px; }
.prose p, .prose ul { margin: 0; }
.prose ul { padding-left: 1.3em; display: grid; gap: 6px; }
.prose .meta { margin-bottom: 8px; }
.contact-card { background: var(--tape); color: var(--tape-ink); padding: 20px 22px; border-radius: 4px; font-family: var(--f-mono); display: grid; gap: 6px; }
.contact-card a { color: var(--tape-ink); font-size: 1.1rem; font-weight: 600; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- guides (articles) ---------- */
.article { max-width: var(--measure); font-size: 1.04rem; }
.article > * { margin: 0; }
.article > * + * { margin-top: 1.05em; }
.article h2 { margin-top: 2em; }
.article h3 { margin-top: 1.5em; }
.article ul, .article ol { padding-left: 1.3em; display: grid; gap: 6px; }
.article .example { margin-top: 1.4em; }
.article .example > * { margin: 0; }
.article .table-scroll { max-height: none; }
.article table td, .article table th { white-space: normal; text-align: left; }
.article table td { font-family: var(--f-mono); font-size: 0.9rem; }
.callout { background: var(--accent-soft); border-radius: var(--r); padding: 16px 20px; font-weight: 500; }
.callout p { margin: 0; }
.callout a { font-weight: 700; }
.sources { margin-top: 40px; max-width: var(--measure); display: grid; gap: 10px; }
.sources h2 { font-size: 1.1rem; }
.sources ul { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; font-size: 0.92rem; color: var(--muted); }
.calc-head.page { padding-block: 40px 8px; }
