/* Ann Arbor Tuition Ledger — single stylesheet, mobile-first */
:root {
  --bg: #F5F6F4;
  --surface: #FFFFFF;
  --ink: #1F2A33;
  --ink-soft: #4A5762;
  --rule: #D9DED9;
  --rule-strong: #B9C1BB;
  --green: #1E7B4F;
  --green-dark: #165E3C;
  --green-tint: #E6F1EB;
  --amber: #D99A1E;
  --amber-tint: #FBF1DC;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --measure: 70ch;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

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

a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--green-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: var(--s2) var(--s4); z-index: 10;
}
.skip:focus { left: var(--s4); top: var(--s2); }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--s4); }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: var(--s4);
}
.brand { display: inline-flex; align-items: center; gap: var(--s3); text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand .mark { flex: none; }
.wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.wm-top { font-weight: 700; font-size: 1.125rem; letter-spacing: -0.01em; }
.wm-sub { font-family: var(--mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin-top: 3px; }

.nav-toggle {
  font: inherit; font-size: 0.9375rem; font-weight: 600;
  background: transparent; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: 6px 14px; cursor: pointer;
}
.nav-toggle[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.site-nav { display: none; }
.site-nav.is-open {
  display: block;
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border-bottom: 1px solid var(--rule);
  box-shadow: 0 8px 16px rgba(31, 42, 51, 0.08);
  z-index: 5;
}
.site-nav ul { list-style: none; margin: 0; padding: var(--s2) var(--s4) var(--s4); }
.site-nav li { border-top: 1px solid var(--rule); }
.site-nav li:first-child { border-top: 0; }
.site-nav a { display: block; padding: var(--s3) 0; color: var(--ink); text-decoration: none; font-weight: 500; }
.site-nav a[aria-current="page"] { color: var(--green); box-shadow: inset 3px 0 0 var(--green); padding-left: var(--s3); }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav, .site-nav.is-open { display: block; position: static; box-shadow: none; border: 0; }
  .site-nav ul { display: flex; gap: var(--s5); padding: 0; }
  .site-nav li { border: 0; }
  .site-nav a { padding: var(--s2) 0; font-size: 0.9375rem; }
  .site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--green); padding-left: 0; }
}

/* Main content */
main.wrap { padding-top: var(--s6); padding-bottom: var(--s8); }
main > article { max-width: 800px; }

.breadcrumbs ol { list-style: none; margin: 0 0 var(--s4); padding: 0; display: flex; flex-wrap: wrap; font-size: 0.875rem; color: var(--ink-soft); }
.breadcrumbs li + li::before { content: "/"; margin: 0 var(--s2); color: var(--rule-strong); }

.page-head { margin-bottom: var(--s5); }
.kicker {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--green); margin: 0 0 var(--s2);
}
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); font-weight: 700; margin: 0 0 var(--s3); }
h2 { font-size: clamp(1.3rem, 3.4vw, 1.625rem); font-weight: 600; margin: var(--s7) 0 var(--s3); padding-top: var(--s4); border-top: 1px solid var(--rule); }
h3 { font-size: 1.125rem; font-weight: 600; margin: var(--s5) 0 var(--s2); }
p, ul, ol { max-width: var(--measure); margin: 0 0 var(--s4); }
li { margin-bottom: var(--s2); }
.byline { font-size: 0.875rem; color: var(--ink-soft); margin: 0; }
.lede { font-size: 1.125rem; }

.fig, .num, .stat dd { font-family: var(--mono); font-feature-settings: "tnum" 1; }
.fig { font-weight: 600; white-space: nowrap; }

/* Quick answer */
.quick-answer {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: var(--s4) var(--s5);
  margin: 0 0 var(--s5);
}
.quick-answer p:last-child { margin-bottom: 0; }
.qa-title, .toc-title, .callout-title, .worked-title {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--green); margin: 0 0 var(--s2); padding: 0; border: 0;
}
.quick-answer strong.fig { background: linear-gradient(transparent 62%, var(--amber-tint) 62%); }

/* Stat row */
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); margin: 0 0 var(--s5); overflow: hidden; }
.stat { background: var(--surface); padding: var(--s3) var(--s4); }
.stat dt { font-size: 0.8125rem; color: var(--ink-soft); line-height: 1.4; }
.stat dd { margin: var(--s1) 0 0; font-size: 1.25rem; font-weight: 600; color: var(--ink); }
.stat:last-child dd { color: var(--green); }
@media (min-width: 768px) { .stat-row { grid-template-columns: repeat(4, 1fr); } .stat dd { font-size: 1.375rem; } }

/* TOC */
.toc { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s4) var(--s5); margin: var(--s5) 0; }
.toc ol { margin: 0; padding-left: 1.25rem; columns: 1; }
.toc li { margin-bottom: var(--s1); break-inside: avoid; }
@media (min-width: 768px) { .toc ol { columns: 2; column-gap: var(--s6); } }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: var(--s4) 0 var(--s5); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.45; }
caption { text-align: left; font-weight: 600; font-size: 0.875rem; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); color: var(--ink); }
th, td { padding: 10px var(--s3); text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
thead th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); font-weight: 600; background: #FAFBFA; vertical-align: bottom; }
tbody th { font-weight: 500; }
.table-wrap th[scope="row"] { min-width: 9.5rem; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tfoot th, tfoot td { font-weight: 600; border-top: 2px solid var(--ink); border-bottom: 0; }
tfoot td.num { color: var(--green); }
.num { text-align: right; white-space: nowrap; }
th.num { text-align: right; }
.nowrap { white-space: nowrap; }
.table-note { font-size: 0.875rem; color: var(--ink-soft); }

/* Callouts and worked examples */
.callout { background: var(--green-tint); border-radius: var(--radius); padding: var(--s4) var(--s5); margin: var(--s5) 0; max-width: var(--measure); }
.callout p:last-child { margin-bottom: 0; }
.worked { background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid var(--amber); border-radius: var(--radius); padding: var(--s4) var(--s5); margin: var(--s5) 0; max-width: var(--measure); }
.worked-title { color: var(--ink); }
.worked-lines { list-style: none; padding: 0; margin: 0; }
.worked-lines li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s1) var(--s4); padding: var(--s2) 0; border-bottom: 1px dashed var(--rule); margin: 0; }
.worked-lines li .num { margin-left: auto; }
.worked-lines li.total { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 600; }
.worked-lines li.total .num { color: var(--green); }
.worked-foot { font-size: 0.9375rem; color: var(--ink-soft); margin: var(--s3) 0 0; }

.columns { columns: 1; }
@media (min-width: 640px) { .columns { columns: 2; column-gap: var(--s6); } .columns li { break-inside: avoid; } }

/* Calculator */
.calc-section { scroll-margin-top: var(--s4); }
.calc { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s4) var(--s5); display: grid; gap: var(--s4); }
.calc > * { min-width: 0; }
.calc fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.calc legend, .calc .field > label { font-weight: 600; font-size: 0.9375rem; margin-bottom: var(--s2); padding: 0; display: block; }
.choice { display: flex; align-items: flex-start; gap: var(--s2); font-size: 0.9375rem; padding: 4px 0; cursor: pointer; }
.choice input { margin-top: 6px; accent-color: var(--green); width: 16px; height: 16px; flex: none; }
.calc select, .calc input[type="number"] {
  font: inherit; font-size: 1rem; width: 100%; max-width: 100%;
  padding: 10px var(--s3); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink);
}
.calc input[type="number"] { font-family: var(--mono); }
.hint { font-size: 0.8125rem; color: var(--ink-soft); margin: var(--s1) 0 0; }
@media (min-width: 768px) {
  .calc { grid-template-columns: 1fr 1fr; column-gap: var(--s6); }
  #off-field { grid-column: 1 / -1; }
}
.calc-result { margin-top: var(--s4); }
.result-table { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.result-table td.num { font-size: 1rem; }
.result-table tfoot tr:first-child td { font-size: 1.375rem; }
.result-table tfoot tr.sub th, .result-table tfoot tr.sub td { border-top: 1px solid var(--rule); font-weight: 500; font-size: 0.9375rem; color: var(--ink); }
.calc-note { font-size: 0.875rem; color: var(--ink-soft); margin-top: var(--s3); }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--rule); max-width: var(--measure); }
.faq-item summary { cursor: pointer; font-weight: 600; padding: var(--s3) var(--s6) var(--s3) 0; list-style: none; position: relative; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-family: var(--mono); position: absolute; right: var(--s2); top: var(--s3); color: var(--green); font-weight: 600; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { margin: 0 0 var(--s4); }

/* Related and sources */
.related-list { list-style: none; padding: 0; display: grid; gap: var(--s3); max-width: none; }
@media (min-width: 640px) { .related-list { grid-template-columns: 1fr 1fr; } }
.related-list li { margin: 0; }
.related-list a { display: block; height: 100%; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s4); text-decoration: none; color: var(--ink); }
.related-list a:hover { border-color: var(--green); }
.rl-title { display: block; font-weight: 600; color: var(--green); margin-bottom: var(--s1); }
.rl-desc { display: block; font-size: 0.9375rem; color: var(--ink-soft); line-height: 1.5; }
.sources ul { font-size: 0.9375rem; }
.sources li { margin-bottom: var(--s1); }

/* Map */
.map-wrap { position: relative; width: 100%; max-width: var(--measure); aspect-ratio: 4 / 3; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.map-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Footer */
.site-footer { background: var(--ink); color: #DCE2E6; padding: var(--s7) 0 var(--s5); font-size: 0.9375rem; }
.site-footer a { color: #FFFFFF; }
.site-footer a:hover { color: #FFFFFF; text-decoration-thickness: 2px; }
.footer-grid { display: grid; gap: var(--s5); }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; gap: var(--s6); } }
.footer-brand { font-weight: 700; color: #fff; margin-bottom: var(--s2); }
.footer-head { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: #AEB9C1; margin-bottom: var(--s2); }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: var(--s1); }
.independence { line-height: 1.6; }
.independence strong { color: #fff; }
.footer-meta { border-top: 1px solid #3A4752; margin-top: var(--s5); padding-top: var(--s4); font-size: 0.8125rem; color: #AEB9C1; max-width: none; }

.notfound ul { margin-top: var(--s4); }

@media print {
  .site-header, .site-footer, .toc, .calc-section { display: none; }
  body { background: #fff; }
}

/* long domains in emails and URLs must wrap on phones */
a[href^="mailto:"], a[href^="http"] { overflow-wrap: anywhere; } /* long domains */
