/* Shared structure. Each site sets its own identity in a .t-* block below:
   fonts, palette, corners and one signature element drawn from its subject. */
:root {
  --page: #ffffff;
  --panel: #ffffff;
  --ink: #1b1e24;
  --ink-2: #474c55;
  --ink-3: #6a707b;
  --rule: #dfe2e7;
  --accent: #1d3c6e;
  --accent-ink: #ffffff;
  --ok: #1f6b3a;
  --warn: #8a5a00;
  --bad: #a3241b;
  --radius: 3px;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: var(--body);
  --size: 17px;
  --lead: 1.6;
  --measure: 68ch;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: var(--size)/var(--lead) var(--body); font-variant-numeric: lining-nums; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.measure, main .wrap > .body > p, main .wrap > .body > ul, main .wrap > .body > ol, main .wrap > .body > blockquote, .faq p, .brief p { max-width: var(--measure); }

header.site { border-bottom: 1px solid var(--rule); }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding-top: 16px; padding-bottom: 10px; }
.wordmark { font: 700 20px/1.25 var(--display); color: var(--ink); text-decoration: none; }
.byline { font-size: 14px; color: var(--ink-3); }
nav.top { width: 100%; display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: 15px; margin-top: 4px; }
nav.top a { color: var(--ink-2); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
nav.top a:hover { color: var(--ink); }
nav.top a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

main { padding: 28px 0 48px; }
.crumbs { font-size: 14px; margin: 0 0 6px; }
.crumbs a { color: var(--ink-3); }
h1 { font: 700 clamp(30px, 5vw, 42px)/1.12 var(--display); margin: 0 0 10px; letter-spacing: -0.015em; max-width: 30ch; }
h2 { font: 700 26px/1.25 var(--display); margin: 44px 0 10px; }
h3 { font: 700 19px/1.35 var(--display); margin: 28px 0 6px; }
.meta { font-size: 14px; color: var(--ink-3); margin: 0 0 22px; }
.meta a { color: var(--ink-3); }

/* The answer in brief: the lede of every page. */
.brief { margin: 0 0 30px; padding: 2px 0 2px 18px; border-left: 3px solid var(--accent); }
main .brief h2 { font: 700 15px/1.4 var(--body); margin: 0 0 4px; color: var(--ink-2); border: 0; padding: 0; letter-spacing: 0; font-stretch: 100%; }
.brief p { font-size: 1.15em; line-height: 1.5; margin: 0; }

.body ul, .body ol { padding-left: 22px; }
.body li { margin: 5px 0; }
.body blockquote { margin: 18px 0; padding: 0 0 0 18px; border-left: 2px solid var(--rule); color: var(--ink-2); }
.body img { max-width: 100%; }
.table-wrap { overflow-x: auto; margin: 18px 0 22px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums lining-nums; }
th, td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-weight: 700; border-bottom: 2px solid var(--ink); }
caption { text-align: left; padding: 8px 0 0; font-size: 13px; color: var(--ink-3); caption-side: bottom; }
details { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 10px 0; margin: 14px 0; }
details + details { margin-top: -15px; }
summary { cursor: pointer; font-weight: 700; }
details[open] > summary { margin-bottom: 8px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 32px 0; }

.faq h3 { font-size: 18px; }
.sources ol { font-size: 15px; color: var(--ink-2); padding-left: 22px; }
.sources .checked { color: var(--ink-3); }
dl.glossary { margin: 8px 0 0; max-width: var(--measure); }
dl.glossary dt { font: 700 19px/1.35 var(--display); margin-top: 22px; }
dl.glossary dd { margin: 4px 0 0; }

/* Reviews */
.review { margin: 0 0 22px; break-inside: avoid; }
.review blockquote { margin: 0; padding: 0; border: 0; color: var(--ink); }
.review blockquote p { margin: 0; }
.review figcaption { margin-top: 8px; font-size: 14px; color: var(--ink-3); }

/* Call to action: a ruled block, one per page */
.cta { margin: 48px 0 0; padding: 18px 0 0; border-top: 2px solid var(--accent); max-width: var(--measure); }
.cta p { margin: 0 0 14px; color: var(--ink-2); }
.cta a.button { display: inline-block; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; padding: 11px 18px; border-radius: var(--radius); }
.cta a.button:hover { filter: brightness(1.1); }

footer.site { border-top: 1px solid var(--rule); font-size: 15px; color: var(--ink-2); }
footer.site .wrap { padding-top: 24px; padding-bottom: 32px; }
footer.site h2 { font: 700 16px/1.4 var(--body); margin: 0 0 8px; border: 0; padding: 0; font-stretch: 100%; }
footer.site ul { list-style: none; padding: 0; margin: 0 0 18px; columns: 2 220px; column-gap: 24px; }
footer.site li { margin: 0 0 6px; }
footer.site .fine { color: var(--ink-3); font-size: 14px; max-width: var(--measure); }

/* Controls */
button, .btn { font: 700 15px/1 var(--body); padding: 12px 16px; min-height: 44px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button.secondary { background: transparent; color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
input[type="text"], input[type="number"], select { font: 17px/1.2 var(--body); padding: 9px 10px; min-height: 44px; border: 1px solid var(--ink-3); border-radius: var(--radius); background: var(--panel); color: var(--ink); width: 100%; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }

/* Tools */
.tool { margin: 10px 0 34px; padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }
.tool .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.tool .prompt { font-size: 1.12em; line-height: 1.5; margin: 6px 0 12px; max-width: var(--measure); }
.tool .steps { display: grid; gap: 4px; margin: 14px 0 0; }
.tool .step { display: grid; grid-template-columns: 1fr 170px; gap: 2px 14px; align-items: center; padding: 6px 0; }
.tool .step label { font-weight: 600; font-size: 15px; }
.tool .step .result { grid-column: 1 / -1; font-size: 14px; margin: 0; min-height: 0; }
.tool .step .result:empty { display: none; }
.tool .correct { color: var(--ok); }
.tool .follows, .tool .close { color: var(--warn); }
.tool .wrong { color: var(--bad); }
.tool .assumptions th { width: 44%; font-weight: 600; }
.tool .grid2 { align-items: end; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 16px; }
.tool .grid2 label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.quiz-card { padding: 4px 0 12px; }
ol.solution { padding-left: 22px; max-width: var(--measure); }
.small { font-size: 14px; }

/* Paper LBO worksheet: the problem on the left, the answer column on the right. */
.worksheet .modes { margin-top: 0; }
.worksheet .ws-grid { display: grid; grid-template-columns: 1fr; gap: 8px 36px; }
.worksheet .ws-h { font-size: 18px; margin: 14px 0 6px; padding: 0; border: 0; }
.worksheet .prompt { font-size: 1.05em; }
dl.assume { margin: 10px 0 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; font-size: 15px; }
dl.assume div { padding: 6px 0; border-bottom: 1px solid var(--rule); }
dl.assume dt { color: var(--ink-3); font-size: 13px; }
dl.assume dd { margin: 1px 0 0; font-weight: 600; }
.worksheet .steps { gap: 0; margin-top: 6px; }
.worksheet .step { grid-template-columns: 1fr 132px; padding: 7px 0; border-bottom: 1px dashed var(--rule); }
.worksheet .step label { display: flex; gap: 10px; align-items: baseline; }
.worksheet .step .n { color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 1.1em; text-align: right; }
.worksheet .field { position: relative; display: block; }
.worksheet .field input { text-align: right; padding-right: 10px; }
.worksheet .field.pre input { padding-left: 22px; }
.worksheet .field.pre::before { content: attr(data-unit); position: absolute; left: 9px; top: 50%; transform: translateY(-52%); color: var(--ink-3); pointer-events: none; }
.worksheet .field.post input { padding-right: 26px; }
.worksheet .field.post::after { content: attr(data-unit); position: absolute; right: 10px; top: 50%; transform: translateY(-52%); color: var(--ink-3); pointer-events: none; }
.worksheet .actions { margin-top: 16px; }
.worksheet .clock { margin-left: auto; font-variant-numeric: tabular-nums; }
.worksheet .ws-solution { margin-top: 14px; }
@media (min-width: 860px) {
  .worksheet .ws-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .worksheet .ws-problem { position: sticky; top: 12px; align-self: start; }
}

ol.solution li { margin: 6px 0; }

@media (max-width: 560px) {
  nav.top a { padding: 11px 0; }
  h2 { font-size: 23px; }
  .brief p { font-size: 1.05em; }
  .tool { padding: 14px; }
  .tool .step { grid-template-columns: 1fr; }
  .worksheet .step { grid-template-columns: 1fr 116px; }
  dl.assume { grid-template-columns: 1fr 1fr; gap: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ============================================================
   1. Comparison site: a banker's comps sheet.
   ============================================================ */
.t-comps {
  --page: #ffffff; --panel: #ffffff; --ink: #18212d; --ink-2: #3e4856; --ink-3: #5f6977; --rule: #d3d9e1;
  --accent: #1c3a69; --highlight: #fff1b8; --radius: 0px;
  --body: "Libre Franklin", "Franklin Gothic Medium", Arial, sans-serif; --display: var(--body); --size: 16.5px;
}
.t-comps h1 { font-weight: 800; letter-spacing: -0.02em; }
.t-comps h2 { font-weight: 800; font-size: 24px; }
.t-comps header.site { border-bottom: 3px double var(--ink); }
.t-comps thead th { border-bottom: 4px double var(--ink); font-weight: 700; font-size: 13.5px; vertical-align: bottom; }
.t-comps td { font-size: 15px; }
.t-comps td:not(:first-child) { white-space: normal; }
.t-comps tbody tr.pick td { background: var(--highlight); }
.t-comps tbody tr.pick td:first-child { box-shadow: inset 3px 0 0 var(--accent); padding-left: 9px; font-weight: 700; }
.t-comps .brief { border-left: 0; border-top: 4px solid var(--accent); border-bottom: 1px solid var(--rule); padding: 12px 0 16px; }

/* ============================================================
   2. paperlbo.org: a green engineering pad.
   ============================================================ */
.t-pad {
  --page: #eaf2e3; --panel: #f6faf2; --ink: #222c24; --ink-2: #435046; --ink-3: #5c6b60; --rule: #c4d6b8;
  --accent: #2c5d3f; --pencil: #b3261e; --grid: rgba(78, 128, 88, 0.13); --radius: 2px;
  --body: "Barlow", "Helvetica Neue", Arial, sans-serif; --display: "Barlow Semi Condensed", "Barlow", Arial, sans-serif; --size: 17.5px;
  --bad: #b3261e;
}
.t-pad body, body.t-pad {
  background-color: var(--page);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
}
.t-pad h1, .t-pad h2, .t-pad h3, .t-pad .wordmark, .t-pad dl.glossary dt { font-weight: 700; letter-spacing: 0; }
.t-pad main .wrap { background: var(--panel); border-left: 2px solid var(--pencil); padding-top: 22px; padding-bottom: 26px; }
.t-pad header.site { background: var(--panel); border-bottom: 1px solid var(--rule); }
.t-pad footer.site { background: var(--panel); }
.t-pad .brief { border-left-color: var(--pencil); }
.t-pad .tool { background: #ffffff; border: 1px solid var(--rule); border-top: 3px solid var(--accent); }
.t-pad .tool input[type="text"] { font: 600 18px/1.2 var(--display); border: 0; border-bottom: 2px solid var(--ink-2); border-radius: 0; background: transparent; min-height: 40px; }
.t-pad .tool input[type="text"]:focus { background: #f2f8ec; }
.t-pad .tool .correct::before { content: "\2713  "; }
.t-pad .tool .wrong::before { content: "\2717  "; }
.t-pad .cta { border-top-color: var(--pencil); }
@media (min-width: 900px) { .t-pad main .wrap { padding-left: 28px; padding-right: 28px; } }

/* ============================================================
   3. Reviews: a wall of quotes.
   ============================================================ */
.t-quotes {
  --page: #f3f5f8; --panel: #ffffff; --ink: #1d2129; --ink-2: #464c58; --ink-3: #636a77; --rule: #d9dde4;
  --accent: #5b2a6f; --radius: 6px;
  --body: "Karla", "Helvetica Neue", Arial, sans-serif; --display: "Crimson Pro", Georgia, serif; --size: 17px;
}
.t-quotes h1 { font-weight: 600; font-size: clamp(34px, 6vw, 50px); }
.t-quotes h2, .t-quotes h3, .t-quotes dl.glossary dt { font-weight: 600; }
.t-quotes .brief p { font-family: var(--display); font-size: 1.3em; }
.t-quotes .body:has(> figure.review + figure.review) { columns: 2 300px; column-gap: 34px; }
.t-quotes .body:has(> figure.review + figure.review) > *:not(figure) { column-span: all; }
.t-quotes .review { border-top: 1px solid var(--rule); padding: 16px 0 6px; display: inline-block; width: 100%; margin: 0 0 14px; }
.t-quotes .review blockquote p { font: 400 23px/1.36 var(--display); }
.t-quotes .review blockquote p::before { content: "\201C"; margin-left: -0.42em; color: var(--accent); }
.t-quotes .review blockquote p::after { content: "\201D"; color: var(--accent); }
.t-quotes .review figcaption { font-weight: 600; color: var(--accent); }
.t-quotes .body > figure.review:first-of-type:has(+ figure.review) { column-span: all; border-top: 2px solid var(--ink); padding-top: 22px; margin-bottom: 26px; }
.t-quotes .body > figure.review:first-of-type:has(+ figure.review) blockquote p { font-size: clamp(28px, 4.4vw, 38px); line-height: 1.22; max-width: 26ch; }

/* ============================================================
   4. Superday site: the day's agenda.
   ============================================================ */
.t-agenda {
  --page: #ffffff; --panel: #ffffff; --ink: #14171e; --ink-2: #434956; --ink-3: #626977; --rule: #e1e4ea;
  --accent: #841b3c; --radius: 3px;
  --body: "Archivo", "Helvetica Neue", Arial, sans-serif; --display: var(--body); --size: 17px;
}
.t-agenda h1 { font-weight: 800; font-stretch: 85%; font-size: clamp(32px, 6vw, 48px); letter-spacing: -0.01em; }
.t-agenda h2 { font-weight: 750; font-stretch: 90%; padding-top: 14px; border-top: 1px solid var(--ink); }
.t-agenda h3 { font-stretch: 95%; }
.t-agenda header.site { border-bottom: 4px solid var(--accent); }
.t-agenda td:first-child, .t-agenda tbody th { font-weight: 700; font-stretch: 80%; white-space: nowrap; }
.t-agenda thead th { font-stretch: 85%; }

/* ============================================================
   5. Questions site: a study guide, questions numbered in the margin.
   ============================================================ */
.t-guide {
  --page: #fdfdfb; --panel: #ffffff; --ink: #1c1e1a; --ink-2: #474a43; --ink-3: #64685f; --rule: #dedfd8;
  --accent: #1f5a3d; --radius: 3px;
  --body: "Alegreya Sans", "Gill Sans", Arial, sans-serif; --display: "Alegreya", Georgia, serif; --size: 18.5px; --lead: 1.55;
}
.t-guide h1, .t-guide h2 { font-weight: 700; }
.t-guide .body { counter-reset: q; }
.t-guide .body h3 { counter-increment: q; position: relative; font: 700 21px/1.35 var(--display); margin-top: 34px; max-width: var(--measure); }
.t-guide .body h3::before { content: counter(q); position: absolute; left: -46px; width: 34px; text-align: right; color: var(--accent); font-variant-numeric: lining-nums; }
.t-guide .body h2 + h3 { margin-top: 18px; }
@media (max-width: 1000px) { .t-guide .body h3::before { position: static; display: inline-block; width: auto; margin-right: 10px; } }
.t-guide .body p.difficulty { margin: -2px 0 8px; font-size: 14px; color: var(--ink-3); }

/* ============================================================
   6. DCF site: a script you say out loud; calculator in model colors.
   ============================================================ */
.t-script {
  --page: #ffffff; --panel: #ffffff; --ink: #191c22; --ink-2: #444a55; --ink-3: #636a76; --rule: #e0e3e8;
  --accent: #1d4fb8; --input-blue: #0b3fd1; --radius: 4px;
  --body: "Atkinson Hyperlegible", Verdana, sans-serif; --display: var(--body); --size: 17px;
}
.t-script h1 { font-size: clamp(34px, 6.4vw, 54px); letter-spacing: -0.02em; }
.t-script .brief { border-left-width: 5px; padding-left: 22px; }
.t-script .brief p { font-size: 1.28em; line-height: 1.45; }
.t-script .body blockquote { border-left: 4px solid var(--accent); padding: 4px 0 4px 20px; color: var(--ink); font-size: 1.1em; line-height: 1.62; }
.t-script .body blockquote p { margin: 0 0 12px; }
.t-script .body blockquote p:last-child { margin-bottom: 0; }
.t-script .tool input[type="number"], .t-script .tool select { color: var(--input-blue); font-weight: 700; }
.t-script .tool table td { color: var(--ink); }

/* ============================================================
   Dark mode for every site.
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; }
  body[class] { --page: #15171b; --panel: #1c1f24; --ink: #eceef2; --ink-2: #c8ccd4; --ink-3: #9aa1ad; --rule: #343941; --ok: #6fcf8f; --warn: #e6b450; --bad: #f08a8a; --accent-ink: #15171b; }
  body.t-comps { --accent: #8fb3f0; --highlight: #3b3419; }
  body.t-pad { --page: #14201a; --panel: #1a2820; --rule: #2e4236; --accent: #8fd1a5; --pencil: #ef8a80; --grid: rgba(143, 209, 165, 0.07); }
  body.t-pad .tool, body.t-pad .tool input[type="text"] { background: #1d2c24; }
  body.t-quotes { --accent: #d4a8e6; }
  body.t-agenda { --accent: #f08ba8; }
  body.t-guide { --accent: #8fd1ad; }
  body.t-script { --accent: #8fb0ff; --input-blue: #9db8ff; }
  thead th { border-bottom-color: var(--ink-2); }
}
