/* architecture.tools — global stylesheet  (warm sheet theme)
   All pages import this. Override locally only when necessary.

   THEME, in one breath: warm paper instead of cool white; each page is a sheet
   lifted on that paper; controls are raised "keys" that depress to the family
   accent when chosen; the fields you type into are recessed wells; structural
   lines are soft warm hairlines; the accent is reserved for selection + the
   answer, black for everything secondary.

   PALETTE: the canonical color tokens (family accents, ink, hairline, the
   grounds) live in tokens.css, imported below — including --paper, the
   brand's warm white, defined there and only there. This sheet's working
   surfaces are --card (the sheet itself, a hair off --paper) and --gray-100
   (the page field behind it). Each page declares its tool family on the root
   element — <html data-family="drafting"> — and the accent system follows in
   both schemes; a page that declares nothing gets drafting (the blueprint
   anchor). The dark scheme at the end of this sheet recuts surfaces, text,
   lines and shadows once for every page; only the family accent differs.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500&display=swap');
@import url('tokens.css');   /* canonical palette — resolves relative to this file */

/* A static preview loader here can drop the first rule after @import; this
   harmless guard absorbs it. Safe to keep in production. */
.theme-guard { color: inherit; }

/* ---- FAMILY SELECTION ----
   tokens.css defines one accent family per tool genre (see
   docs/In Progress/calculator-suite-map.md). --family / --family-tint /
   --family-dark are the three hooks the engine tokens below consume; pages
   pick a family with data-family on <html>. */
:root,
[data-family="drafting"]      { --family: var(--drafting);      --family-tint: var(--drafting-tint);      --family-dark: var(--drafting-dark); }
[data-family="picker"]        { --family: var(--picker);        --family-tint: var(--picker-tint);        --family-dark: var(--picker-dark); }
[data-family="egress"]        { --family: var(--egress);        --family-tint: var(--egress-tint);        --family-dark: var(--egress-dark); }
[data-family="building"]      { --family: var(--building);      --family-tint: var(--building-tint);      --family-dark: var(--building-dark); }
[data-family="envelope"]      { --family: var(--envelope);      --family-tint: var(--envelope-tint);      --family-dark: var(--envelope-dark); }
[data-family="accessibility"] { --family: var(--accessibility); --family-tint: var(--accessibility-tint); --family-dark: var(--accessibility-dark); }
[data-family="material"]      { --family: var(--material);      --family-tint: var(--material-tint);      --family-dark: var(--material-dark); }

/* ---- TOKENS ---- */
:root {
  /* both schemes are first-class — UA widgets/scrollbars follow the page */
  color-scheme: light dark;

  /* Warm neutral foundation. Text, hairlines and --paper come from the
     canonical palette (tokens.css); the page field behind the sheet is
     --gray-100 (see body). */
  --card:   #fbfaf6;             /* the sheet / input / control surface */
  --card-2: #f2efe7;             /* inset boxes (priority / note) */
  --ink:    var(--ink-text);     /* primary text + heavy rules */
  --ink-2:  #5b5346;             /* secondary text */
  --ink-3:  #8a8170;             /* micro-labels */

  /* Legacy names, re-valued warm (existing rules keep working) */
  --black: var(--ink);
  --gray-900: #2a241c;
  --gray-800: var(--gray-900);
  --gray-700: #5b5346;
  --gray-600: #6b6354;
  --gray-500: #8a8170;
  --gray-400: #a89e8a;
  --gray-300: #c6bdac;
  --gray-200: #d8d1c1;
  --gray-100: #e7e0d1;
  --gray-50:  #f1ece0;
  --white:   var(--card);

  /* Family accent — selection + the answer (see FAMILY SELECTION above) */
  --accent:      var(--family);
  --accent-ink:  #fff;                                      /* text on accent */
  --accent-soft: var(--family-tint);
  --selected-bg: var(--accent);
  --accent-light: var(--accent-soft);

  /* Answer surfaces (result wells) share ONE tone knob — a half-step below
     the sheet, well short of the page field. Diagram label halos read it too
     (e.g. svg.nl text), so a retint never fringes. */
  --answer-surface: color-mix(in srgb, var(--card) 50%, var(--card-2));

  /* Number-line figure strokes — numberline.js routes its SVG through these
     so the figure inverts with the scheme. Unused (harmless) off the
     calculator pages. */
  --nl-ink: #0a0a0a; --nl-hatch: #0a0a0a; --nl-tick: #bbb; --nl-axis: #999;

  /* Type */
  --font-body: 'Verlag', 'Jost', 'Futura PT', sans-serif;

  /* Scale */
  --text-xs: 0.6875rem; --text-sm: 0.8125rem; --text-base: 0.9375rem;
  --text-md: 1.0625rem; --text-lg: 1.25rem;   --text-xl: 1.625rem; --text-2xl: 2.5rem;

  /* Spacing */
  --space-xs: 0.25rem; --space-sm: 0.5rem; --space-md: 0.75rem;
  --space-lg: 1.25rem; --space-xl: 2rem;   --space-2xl: 3rem;

  /* Soft warm hairlines (was hard near-black); --rule is the palette's
     canonical hairline */
  --rule:   var(--hairline);
  --rule-2: #bbb2a2;
  --border-light: 1px solid var(--rule);
  --border-mid:   1px solid var(--rule-2);
  --border-heavy: 2px solid var(--ink);

  /* Depth — one tactile material across sheet, keys and wells */
  --radius: 0px;
  --shadow-card: 0 1px 2px rgba(58,48,32,.05), 0 12px 26px rgba(58,48,32,.11), 0 2px 6px rgba(58,48,32,.05);
  --shadow-key:       inset 0 1px 0 rgba(255,255,255,.6), 0 1px 0 rgba(82,64,32,.18), 0 2px 3px rgba(82,64,32,.13);
  --shadow-key-hover: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 0 rgba(82,64,32,.16), 0 4px 7px rgba(82,64,32,.16);
  --shadow-press:     inset 0 2px 4px rgba(0,0,0,.40), inset 0 -1px 0 rgba(255,255,255,.07);
  --shadow-well:      inset 0 2px 3px rgba(82,64,32,.16), inset 0 -1px 0 rgba(255,255,255,.45);
}

/* ---- RESET ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
/* ONE base size site-wide (the picker's iterated 18px is the reference);
   pages must not override it — the whole rem scale rides on it. */
html { font-size: 18px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* interactive controls are real <button>s; strip the UA font/color so they
   inherit the page like the divs they replaced */
button { font: inherit; color: inherit; letter-spacing: inherit; }
body {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--ink);
  /* the field behind the sheet, stepped darker than the sheet (--card) so
     the bright panel reads as distinct */
  background-color: var(--gray-100);
  /* faint paper grain — shows in the margins around the sheet */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- LAYOUT — the page is a sheet lifted on the paper ---- */
.page,
.page-wide {
  margin: 0 auto;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  position: relative;
}
.page      { max-width: 720px;  padding: var(--space-2xl) var(--space-xl) 5rem; }
.page-wide { max-width: 1080px; padding: var(--space-2xl) var(--space-xl) 5rem; }
.page-full { margin: 0; padding: 0; background: none; border: none; box-shadow: none; }

/* ---- PAGE HEADER — the title block. Like a sheet's title block, the
   crumb line above the title locates the page in the set: the site title
   (a link home) then the set trail. Static, never sticky — the way back
   up lives at the top, the back-link at the bottom. Segments don't break
   mid-name; the line wraps at separators on narrow screens. ---- */
.page-header { margin-bottom: var(--space-2xl); padding-bottom: var(--space-xl); border-bottom: var(--border-heavy); }
.page-crumb { font-size: var(--text-xs); font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--space-sm); line-height: 1.9; }
.page-crumb span, .page-crumb a { white-space: nowrap; }
.page-crumb a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule-2); transition: color 0.15s, border-color 0.15s; }
.page-crumb a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.page-crumb .crumb-sep { margin: 0 0.1em; }   /* real spaces between segments carry the wrap points */
.page-header h1 { font-size: var(--text-xl); font-weight: 400; letter-spacing: -0.01em; margin-bottom: var(--space-xs); }
.page-header p { font-size: var(--text-sm); color: var(--ink-2); font-weight: 300; max-width: 50em; line-height: 1.6; }

/* ---- SECTION LABELS ---- */
/* --ink-2, not --ink-3: the micro-label gray read too light on the bright sheet */
.section-label { font-size: var(--text-xs); font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: var(--space-md); }

/* ---- PANEL SECTIONS ---- */
.panel-section { margin-bottom: var(--space-lg); }
.panel-label { font-size: var(--text-xs); font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--space-sm); padding-bottom: var(--space-xs); border-bottom: var(--border-light); }

/* ---- INPUTS — recessed wells (the field you type INTO) ---- */
.input-section { margin-bottom: var(--space-xl); }
.input-row { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: flex-end; }
.input-group { display: flex; flex-direction: column; }
.input-group label { font-size: var(--text-xs); font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--space-xs); }
.input-group input,
.input-group select,
.field-input,
.field-select {
  font-family: var(--font-body); font-weight: 300; color: var(--ink);
  background: var(--card); border: 1px solid var(--rule-2); border-radius: var(--radius);
  box-shadow: var(--shadow-well); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
}
.input-group input, .input-group select { font-size: var(--text-base); padding: 0.5rem 0.65rem; }
.input-group input:focus, .input-group select:focus,
.field-input:focus, .field-select:focus { border-color: var(--accent); box-shadow: var(--shadow-well), 0 0 0 2px var(--accent-soft); }

.field-row { display: flex; align-items: center; margin-bottom: 0.4rem; gap: var(--space-sm); }
.field-label { font-size: var(--text-sm); font-weight: 300; color: var(--ink-2); flex: 1; min-width: 0; }
.field-input { font-size: var(--text-sm); padding: 0.3rem 0.45rem; width: 85px; text-align: right; }
.field-input.narrow { width: 60px; }
.field-unit { font-size: var(--text-xs); color: var(--ink-3); width: 35px; flex-shrink: 0; }
.field-select { font-size: var(--text-sm); padding: 0.3rem 0.4rem; cursor: pointer; }

/* ---- PILLS / TOGGLES — raised keys that depress to a blueprint fill ----
   These render as <button type="button"> for keyboard access; text-align
   keeps button content reading like the divs they replaced. ---- */
.option-pill,
.app-toggle {
  border: 1px solid var(--rule-2); border-radius: var(--radius);
  background: var(--card); color: var(--ink); text-align: left;
  box-shadow: var(--shadow-key); cursor: pointer; user-select: none;
  font-weight: 400; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s;
}
.option-pill { padding: 0.55rem 1rem; font-size: var(--text-sm); }
.app-toggle  { padding: 0.4rem 0.75rem; font-size: var(--text-sm); position: relative; white-space: nowrap; }
.option-pill:hover,
.app-toggle:hover { border-color: var(--ink-3); box-shadow: var(--shadow-key-hover); }
.option-pill.active,
.app-toggle.active {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  box-shadow: var(--shadow-press); transform: translateY(1px);
}
.option-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.option-pill .pill-detail { display: block; font-size: var(--text-xs); font-weight: 300; opacity: 0.7; margin-top: 0.15rem; }
.option-pill.active .pill-detail { opacity: 0.7; }

/* keyboard focus — one consistent ring on every interactive control */
.option-pill:focus-visible, .app-toggle:focus-visible, .mini-pill:focus-visible,
.grid-box:focus-visible, .bare-ask .pick:focus-visible, .sw-nav-item:focus-visible,
.mon-config:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* touch devices: lift the small controls toward a comfortable hit height */
@media (pointer: coarse) {
  .option-pill, .app-toggle, .mini-pill, .grid-box, .bare-ask .pick { min-height: 2.25rem; }
}

/* ---- RESULT ROWS ---- */
.result-row { display: flex; align-items: baseline; padding: 0.55rem 0; border-bottom: var(--border-light); }
.result-row:last-child { border-bottom: none; }
.result-label { width: 160px; flex-shrink: 0; font-size: var(--text-xs); font-weight: 400; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); }
.result-value { font-size: var(--text-md); font-weight: 300; }
.output-row { display: flex; align-items: baseline; margin-bottom: 0.35rem; }
.output-label { font-size: var(--text-sm); font-weight: 300; color: var(--ink-2); flex: 1; }
.output-value { font-size: var(--text-base); font-weight: 300; text-align: right; }
.output-big { font-size: 1.5rem; font-weight: 300; }

/* ---- ANSWER CARD — the calculators' result panel, a DEBOSSED well: soft
   answer-surface fill + inset shadow so the answer reads as a panel recessed
   into the brighter sheet, not floating above it. The hatch + nearest marker
   live ON the diagram inside (a fill, not a nested box) so there's no
   box-in-a-box. Mark the nearest value with var(--accent), secondary
   rows/labels with --ink-2 / --ink-3. ---- */
.answer-card {
  background: var(--answer-surface); border: 1px solid color-mix(in srgb, var(--rule) 58%, transparent);
  border-radius: var(--radius); box-shadow: var(--shadow-well);
  padding: 1rem 1.25rem 0.5rem; margin-top: var(--space-sm);
}
.answer-card-label { font-size: var(--text-xs); font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--space-sm); }
.is-answer { color: var(--accent); }   /* the snapped / nearest value */

/* ---- CALCULATOR SHELL — the shared anatomy of every engine tool page:
   dimension input → echo (the parsed reading) → constraint control →
   answer card (figure + rows) → engine footnote. Graduated here from
   convert.html so the next tool page (partition, slope, …) starts from the
   same parts. See docs/HANDOFF.md §3. ---- */

/* the free-text dimension field — a recessed well, mono so digits align */
.field-wrap { margin-bottom: var(--space-lg); max-width: 100%; }
.dim-input { font-family: 'SF Mono', ui-monospace, 'Menlo', monospace;
             font-size: 1.35rem; font-weight: 400; line-height: 1.5;
             color: var(--ink); background: var(--card);
             padding: 0.7rem 0.8rem; border: 1px solid var(--rule-2);
             box-shadow: var(--shadow-well);
             width: 100%; box-sizing: border-box;
             outline: none; -webkit-appearance: none; appearance: none; border-radius: var(--radius); }
.dim-input:focus { border-color: var(--accent); box-shadow: var(--shadow-well), 0 0 0 2px var(--accent-soft); }

/* anything typed that didn't parse, shown quietly under the field */
.field-note { margin-top: 0.4rem; font-size: var(--text-sm); color: var(--ink-2); min-height: 1.1em; line-height: 1.5; }
.field-note .pending { color: var(--ink-2); }
.field-note .why { color: var(--ink-2); font-style: italic; }

/* contextual bare-number unit choice — only when a number has no unit */
.bare-ask { margin-top: 0.4rem; font-size: var(--text-sm); color: var(--ink-2); }
.bare-ask:empty { display: none; }
.bare-ask .pick { cursor: pointer; padding: 0.1rem 0.45rem; border: 1px solid var(--gray-300);
                  background: none; font-size: inherit; margin-left: 0.3rem; user-select: none; }
.bare-ask .pick.active { background: var(--selected-bg); color: var(--white); border-color: var(--selected-bg); }

/* option line — small inline control clusters (e.g. "convert to") */
.opt-line { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; margin-bottom: var(--space-lg); }
.opt-cluster { display: flex; align-items: center; gap: 0.5rem; }
.opt-cluster .section-label { margin-bottom: 0; }
.mini-pill { padding: 0.3rem 0.7rem; border: 1px solid var(--rule-2); cursor: pointer;
             font-size: var(--text-sm); background: var(--card); color: var(--ink); user-select: none;
             box-shadow: var(--shadow-key); border-radius: var(--radius);
             transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s; }
.mini-pill:hover { border-color: var(--ink-3); box-shadow: var(--shadow-key-hover); }
.mini-pill.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
                    box-shadow: var(--shadow-press); transform: translateY(1px); }

/* echo — the parsed reading + exact result, a debossed well. Stated tokens
   carry a heavy underline ("what you told me"), inferred a light one ("what
   I assumed") — the page's verification thesis in one line. */
.echo { margin: var(--space-md) 0 var(--space-lg); padding: 0.85rem 1.1rem; background: var(--answer-surface);
        border: 1px solid color-mix(in srgb, var(--rule) 58%, transparent); border-radius: var(--radius);
        box-shadow: var(--shadow-well); }
.echo-line { font-size: var(--text-base); font-weight: 300; line-height: 1.7; color: var(--gray-700); }
.echo .tok { padding-bottom: 1px; }
.echo .tok.stated   { border-bottom: 2px solid var(--black); color: var(--black); }
.echo .tok.inferred { border-bottom: 1px solid var(--ink-3); color: var(--ink-2); }
.echo .op { color: var(--ink-2); padding: 0 0.15em; }
.echo .eq { color: var(--ink-2); padding: 0 0.2em; }
.echo .result { font-weight: 400; color: var(--black); }
.echo-assumptions { margin-top: 0.45rem; font-size: var(--text-sm); color: var(--ink-2); }
.echo-assumptions div::before { content: '— '; color: var(--ink-2); }

/* constraint dial — preset boxes + custom input (snap grid, module, …) */
.grid-presets { margin-bottom: var(--space-md); }
.grid-box { padding: 0.45rem 0.7rem; border: 1px solid var(--rule-2); cursor: pointer;
            font-size: var(--text-sm); background: var(--card); color: var(--ink); user-select: none;
            min-width: 2.4rem; text-align: center; box-shadow: var(--shadow-key); border-radius: var(--radius);
            transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s; }
.grid-box:hover { border-color: var(--ink-3); box-shadow: var(--shadow-key-hover); }
.grid-box.active { border-color: var(--accent); background: var(--accent); color: var(--accent-ink);
                   box-shadow: var(--shadow-press); transform: translateY(1px); }
.grid-sep { width: 1px; align-self: stretch; background: var(--rule); margin: 0 0.3rem; }
.grid-custom { width: 84px; font-family: inherit; font-size: 16px; padding: 0.35rem 0.5rem;
               color: var(--ink); background: var(--card); box-shadow: var(--shadow-well);
               border: 1px solid var(--rule-2); border-radius: var(--radius);
               outline: none; -webkit-appearance: none; appearance: none; }
.grid-custom:focus { border-color: var(--accent); box-shadow: var(--shadow-well), 0 0 0 2px var(--accent-soft); }
.grid-group-label { font-size: var(--text-xs); color: var(--ink-2); letter-spacing: 0.08em; text-transform: uppercase; }
.grid-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.4rem; }
.grid-row:last-child { margin-bottom: 0; }

/* the figure — numberline.js SVG; the label halo tracks --answer-surface so
   retinting the card never fringes */
.figure-wrap { margin: var(--space-lg) 0; overflow-x: auto; }
.answer-card .figure-wrap { margin: 0; }
svg.nl { display: block; max-width: 100%; }
svg.nl text { font-family: var(--font-body); stroke: var(--answer-surface); }
.nl-axis-label  { font-size: 10px; fill: var(--ink-2); letter-spacing: 0.06em; text-transform: uppercase; }
.nl-snap-val    { font-size: 12px; fill: var(--black); font-weight: 400; }
.nl-snap-role   { font-size: 9px;  fill: var(--ink-2); letter-spacing: 0.04em; text-transform: uppercase; }
.nl-src-val     { font-size: 10px; fill: var(--ink-2); }
.nl-residual    { font-size: 10px; fill: var(--gray-700); }
.nl-true-role   { font-size: 10px; fill: var(--black); letter-spacing: 0.06em; text-transform: uppercase; }
.nl-true-val    { font-size: 13px; fill: var(--black); font-weight: 400; }
.nl-note        { font-size: 10px; fill: var(--ink-2); font-style: italic; }
.nl-nearest     { font-weight: 600; }

/* snap rows — flat rows inside the answer card, a hairline off the figure;
   the nearer bound leads and its value carries the accent (= the answer) */
.snap-rows { margin-top: var(--space-sm); padding-top: var(--space-sm); border-top: 1px solid var(--rule); }
.snap-row { display: flex; align-items: baseline; padding: 0.5rem 0; border-bottom: var(--border-light); }
.snap-row:last-child { border-bottom: none; }
.snap-name { width: 150px; flex-shrink: 0; font-size: var(--text-xs); font-weight: 400;
             text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.snap-gloss { display: block; font-size: var(--text-xs); font-weight: 300; color: var(--ink-2);
              text-transform: none; letter-spacing: 0; }
.snap-value { flex: 1; font-size: var(--text-md); font-weight: 300; }
.snap-dec { display: block; font-size: var(--text-xs); font-weight: 300; color: var(--ink-2); }
.snap-resid { width: 120px; text-align: right; flex-shrink: 0; font-size: var(--text-sm); color: var(--ink-2); }
.snap-row.is-exact .snap-resid { color: var(--black); }
.snap-row.is-primary .snap-name { color: var(--black); }
.snap-row.is-primary .snap-value { font-size: var(--text-lg); font-weight: 400; color: var(--accent); }
.snap-row.is-ref { border-top: 1px solid var(--gray-200); }
.snap-row.is-ref .snap-name, .snap-row.is-ref .snap-value { color: var(--ink-2); }

/* bonus outputs (ratio / area) — same debossed material as the echo */
.ratio-box { margin: var(--space-lg) 0; padding: 1rem 1.2rem; background: var(--answer-surface);
             border: 1px solid color-mix(in srgb, var(--rule) 58%, transparent); border-radius: var(--radius);
             box-shadow: var(--shadow-well); }
.ratio-big { font-size: var(--text-xl); font-weight: 300; }

/* the engine's exact integer math, shown as an auditable footnote */
.mathnote { margin-top: var(--space-xl); padding-top: var(--space-md); border-top: 1px solid var(--gray-100);
            font-family: 'SF Mono', ui-monospace, monospace; font-size: var(--text-xs);
            color: var(--ink-2); line-height: 1.7; }
.mathnote b { color: var(--ink); font-weight: 400; }
.mathnote:empty { display: none; }

@media (max-width: 480px) {
  .dim-input { font-size: 1.1rem; }
  .snap-name { width: 96px; }
  .snap-resid { width: 96px; }
}

/* ---- BOXES ---- */
.result-box { padding: 1rem 1.25rem; border: var(--border-heavy); border-radius: var(--radius); margin-top: var(--space-md); }
.priority-box { margin-top: var(--space-lg); padding: 1rem 1.25rem; background: var(--card-2); border: 1px solid var(--rule); border-radius: var(--radius); }
.priority-box-label { font-size: var(--text-xs); font-weight: 400; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 0.35rem; }
.priority-box p { font-size: var(--text-sm); font-weight: 300; color: var(--ink-2); line-height: 1.6; }
.note-box { padding: 0.85rem 1.1rem; background: var(--card-2); border: 1px solid var(--rule); border-radius: var(--radius); font-size: var(--text-sm); font-weight: 300; color: var(--ink-2); line-height: 1.6; }
.note-box strong { font-weight: 500; color: var(--ink); }

/* ---- LINKS ---- */
.card-link, .back-link { font-size: var(--text-sm); font-weight: 400; color: var(--ink); border-bottom: 1px solid var(--ink); text-decoration: none; transition: color 0.15s, border-color 0.15s; }
.card-link { display: inline-block; padding-bottom: 1px; margin-right: var(--space-lg); }
.card-link:hover, .back-link:hover { color: var(--accent); border-bottom-color: var(--accent); opacity: 1; }

/* ---- TABLES ---- */
.ref-table table, .scale-table { width: 100%; border-collapse: collapse; }
.ref-table th, .scale-table th { font-size: var(--text-xs); font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); text-align: left; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--ink-2); }
.ref-table td { font-size: var(--text-sm); font-weight: 300; padding: 0.45rem 0.65rem; border-bottom: var(--border-light); transition: background 0.1s; }
.ref-table tr:hover td { background: var(--card-2); }
.scale-table td { font-size: var(--text-sm); font-weight: 300; padding: 0.5rem 0.75rem; border-bottom: var(--border-light); }

/* ---- SPEC BLOCKS ---- */
.spec-block { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; margin-bottom: var(--space-lg); }
.spec-item-label { font-size: var(--text-xs); font-weight: 400; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 0.2rem; }
.spec-item-value { font-size: var(--text-md); font-weight: 400; }
.spec-item-note { font-size: var(--text-sm); color: var(--ink-2); font-weight: 300; margin-top: 0.1rem; max-width: 22em; }

/* ---- DIVIDERS ---- */
.divider { border: none; border-top: 2px solid var(--ink); margin: var(--space-2xl) 0; }

/* ---- PRICE ---- */
.price-summary { font-size: var(--text-lg); font-weight: 300; margin-bottom: var(--space-lg); }

/* ---- PURCHASE PATHS ---- */
.purchase-paths { margin-bottom: 1rem; }
.purchase-path { margin-bottom: 1rem; }
.purchase-path-label { font-size: var(--text-xs); font-weight: 400; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 0.35rem; }
.purchase-path p { font-size: var(--text-sm); font-weight: 300; color: var(--ink-2); line-height: 1.6; margin-bottom: var(--space-sm); }
.purchase-path strong { font-weight: 500; color: var(--ink); }

/* ---- PICKS ---- */
.pick { margin-bottom: var(--space-lg); }
.pick-name { font-size: var(--text-md); font-weight: 400; margin-bottom: 0.15rem; }
.pick-price { font-size: var(--text-sm); font-weight: 300; color: var(--ink-2); margin-bottom: 0.15rem; }
.pick-note { font-size: var(--text-sm); font-weight: 300; color: var(--ink-2); line-height: 1.55; }
.or-divider { font-size: var(--text-xs); font-weight: 300; color: var(--ink-3); letter-spacing: 0.1em; text-transform: uppercase; margin: var(--space-md) 0; }

/* ---- BADGES — blueprint chip ---- */
.fit-badge, .rec-badge { font-size: 0.55rem; background: var(--accent); color: var(--accent-ink); padding: 1px 5px; letter-spacing: 0.1em; text-transform: uppercase; border-radius: var(--radius); }

/* ---- FOOTER ---- */
.page-footer { margin-top: var(--space-2xl); padding-top: var(--space-lg); border-top: 1px solid var(--rule-2); font-size: var(--text-xs); color: var(--ink-3); font-weight: 300; line-height: 1.7; }

/* ---- UTILITY ---- */
.hidden { display: none !important; }

/* ---- RESPONSIVE ---- */
@media (max-width: 820px) { .page-wide { padding: var(--space-xl) var(--space-lg) var(--space-2xl); } .spec-block { gap: 1rem 2rem; } }
@media (max-width: 480px) { .page { padding: var(--space-xl) var(--space-lg) var(--space-2xl); } .input-row { flex-direction: column; } .result-label { width: 110px; } }

/* ---- DARK — one shared scheme for every page; only the family accent
   differs (it swaps to its lifted dark variant via --family-dark). ---- */
@media (prefers-color-scheme: dark) {
  :root {
    /* surfaces — derived from --lightbox: backdrop darkest, sheet lifts */
    --gray-100: #0F1115; --gray-50: var(--lightbox);
    --card: #181B21; --white: #181B21; --card-2: #20242B;
    /* text — palette text-on-dark */
    --ink: var(--text-on-dark); --black: var(--text-on-dark); --ink-2: #ADA89F; --ink-3: #7E7A72;
    --gray-700: #B8B4AB; --gray-900: #D8D4CB; --gray-400: #6A665F;
    /* lines */
    --rule: #2E323A; --rule-2: #3C414B; --gray-200: #2A2E36; --gray-300: #383D46;
    /* family accent — the lifted dark variant */
    --accent: var(--family-dark);
    --accent-ink: var(--lightbox);
    --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
    --selected-bg: var(--accent);
    /* number-line strokes — inverted for the dark field */
    --nl-ink: #CBC8C2; --nl-hatch: #6E727C; --nl-tick: #3F434B; --nl-axis: #6E727B;
    /* shadows recut for a dark field (warm browns -> deep blacks) */
    --shadow-card: 0 1px 2px rgba(0,0,0,.5), 0 16px 34px rgba(0,0,0,.55);
    --shadow-key: inset 0 1px 0 rgba(255,255,255,.05), 0 1px 2px rgba(0,0,0,.55);
    --shadow-key-hover: inset 0 1px 0 rgba(255,255,255,.06), 0 3px 7px rgba(0,0,0,.6);
    --shadow-press: inset 0 2px 5px rgba(0,0,0,.65);
    --shadow-well: inset 0 2px 4px rgba(0,0,0,.5), inset 0 -1px 0 rgba(255,255,255,.04);
  }
}
