/* ------------------------------------------------------------------
   Typefaces, served from this repo rather than from Google Fonts.
   The visitor's browser makes no third-party request; see
   fonts/README.md for the files and their OFL licenses.

   Each family is one variable file per subset, so the weight range is
   declared rather than a single weight.
   ------------------------------------------------------------------ */

/* Bricolage Grotesque — latin-ext */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 700 800;
  font-stretch: 100%;
  font-display: swap;
  src: url(fonts/bricolage-grotesque-700-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Bricolage Grotesque — latin */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 700 800;
  font-stretch: 100%;
  font-display: swap;
  src: url(fonts/bricolage-grotesque-700-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Instrument Sans — latin-ext */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(fonts/instrument-sans-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Instrument Sans — latin */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(fonts/instrument-sans-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* JetBrains Mono — latin-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url(fonts/jetbrains-mono-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* JetBrains Mono — latin */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url(fonts/jetbrains-mono-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* ------------------------------------------------------------------
   Light Limits — string light electrical load planner
   Direction: a wiring worksheet lit by filament glow. Cool paper and
   indigo ink everywhere; the boldness is spent on one dark gauge panel
   where the amber load bars actually glow.

   Conventions
     - Every color, size and space is a token declared in :root.
       Nothing below should introduce a raw hex or an off-scale length.
     - Type and spacing are in rem so the reader's browser font-size
       setting is honoured. 1rem = 16px at the default setting.
     - Breakpoints: 900px (calculator goes one column), 560px (mobile
       chrome), 430px (split-header rows stack).
   ------------------------------------------------------------------ */

:root {
  color-scheme: light;

  /* --- palette: paper side --- */
  --paper:      #F4F6FA;
  --paper-2:    #E8ECF4;
  --card:       #FFFFFF;
  --ink:        #131B31;
  --ink-2:      #2F3A57;   /* lede, answers */
  --ink-3:      #414C69;   /* card subtitles */
  --ink-4:      #39435C;   /* control labels on tinted grounds */
  --rule:       #DFE4EE;   /* hairlines and dividers */
  --rule-strong:#8089A2;   /* form and control borders — 3:1, WCAG 1.4.11 */
  --muted:      #5A6379;   /* 5.2:1 on paper — the lightest text tone allowed */

  /* --- palette: night side --- */
  --night:      #0B1120;
  --night-2:    #161F38;
  --night-3:    #141D38;   /* bar track */
  --night-rule: #232E4D;
  --night-rule-2: #212B49;
  --night-dots: #303B57;
  --on-night:      #E9ECF5;
  --on-night-2:    #C4CCE0;
  --on-night-3:    #AAB3C9;
  --on-night-4:    #99A3BF;
  --on-night-5:    #8A94B2;
  --on-night-6:    #78829E;  /* 4.9:1 on night — the lightest allowed */

  /* --- accents --- */
  --filament:     #FFB020;
  --filament-ink: #96600A;  /* amber that still reads on paper */
  --filament-deep:#9E6407;  /* the bulb cap in the logo */
  --glow:         #FFD98A;
  --signal:       #E03A2F;  /* non-text: rules, bar fills */
  --signal-deep:  #B92218;  /* text and text grounds — 6.3:1 with white */
  --binding-ink:  #33240A;  /* type on the amber binding panel */
  --warn-tint:    #FFC9C3;  /* warning prose on the night ground */
  --fill-amber-a: #C97E12;
  --fill-amber-b: #FF7A6E;
  --fill-red-a:   #8E2018;
  --glow-amber:   rgba(255,176,32,.5);
  --glow-red:     rgba(224,58,47,.55);

  /* page gutter, widened at larger viewports in the responsive section */
  --gutter: var(--s-6);

  /* --- measure --- */
  --shell: 1180px;
  --shell-narrow: 750px;
  --measure: 68ch;

  /* --- radius --- */
  --r: 6px;
  --r-sm: 3px;

  /* --- space scale --- */
  --s-1: 0.25rem;   /*  4px */
  --s-2: 0.5rem;    /*  8px */
  --s-3: 0.75rem;   /* 12px */
  --s-4: 1rem;      /* 16px */
  --s-5: 1.25rem;   /* 20px */
  --s-6: 1.5rem;    /* 24px */
  --s-7: 2rem;      /* 32px */
  --s-8: 3rem;      /* 48px */
  --s-9: 4rem;      /* 64px */

  /* --- type scale --- */
  --fs-3xs:  0.6875rem;  /* 11px — micro caps labels */
  --fs-2xs:  0.75rem;    /* 12px — mono meta */
  --fs-xs:   0.8125rem;  /* 13px — dense readouts, helper notes */
  --fs-sm:   0.875rem;   /* 14px — secondary prose */
  --fs-md:   0.9375rem;  /* 15px — tables, callouts */
  --fs-base: 1rem;       /* 16px — form controls; never smaller, or iOS
                            zooms the page on focus */
  --fs-lg:   1.0625rem;  /* 17px — body copy */
  --fs-xl:   1.1875rem;  /* 19px — lede, card titles, wordmark */
  --fs-2xl:  1.25rem;    /* 20px — h3 */

  /* --- minimum comfortable hit area (WCAG 2.5.8 asks 24px) --- */
  --tap: 1.75rem;        /* 28px */

  --display: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* --- base -------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--fs-lg);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}

img, svg, video, canvas { max-width: 100%; height: auto; }

a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--muted); }
a:hover { text-decoration-color: var(--filament-ink); }
:focus-visible { outline: 3px solid var(--filament-ink); outline-offset: 2px; }

button, input, select { font: inherit; }

/* The page gutter. Every section sits in one of these, so the gutter is
   set here and nowhere else — see the note on .hero. padding-inline so a
   later rule setting vertical padding cannot flatten it. */
.shell { max-width: var(--shell); margin: 0 auto; padding-inline: var(--gutter); }
.shell-narrow { max-width: var(--shell-narrow); margin: 0 auto; padding-inline: var(--gutter); }

/* --- type -------------------------------------------------------- */

h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 6vw, 3.75rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.0625rem); margin: var(--s-8) 0 var(--s-4); }
h3 { font-size: var(--fs-2xl); margin: var(--s-7) 0 var(--s-2); }

.eyebrow {
  font-family: var(--mono);
  font-size: var(--fs-2xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--s-3);
}
.lede { font-size: var(--fs-xl); color: var(--ink-2); max-width: 62ch; text-wrap: pretty; }

/* --- header ------------------------------------------------------ */

.masthead { background: var(--night); color: var(--on-night); }
.masthead .shell {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-2) var(--s-5); min-height: 3.75rem; flex-wrap: wrap;
  padding-block: var(--s-2);
}
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: var(--fs-xl);
  color: #FFF; text-decoration: none; letter-spacing: -0.02em;
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding-block: var(--s-1);
}
/* The mark: a bulb whose filament is the two limits the site is about.
   Fills come from the palette, so it follows any colour change. The glow is
   a drop-shadow rather than a box-shadow so it follows the glass, not a box. */
.wordmark .mark {
  width: 22px; height: 22px; flex: none;
  filter: drop-shadow(0 0 7px rgba(255, 176, 32, .55));
}
.wordmark .mark .glass { fill: var(--filament); }
.wordmark .mark .filament { fill: var(--night); }
.wordmark .mark .cap { fill: var(--filament-deep); }
.masthead nav { display: flex; gap: var(--s-1) var(--s-5); flex-wrap: wrap; }
.masthead nav a {
  color: var(--on-night-3); text-decoration: none; font-family: var(--mono);
  font-size: var(--fs-2xs); letter-spacing: 0.04em;
  display: inline-flex; align-items: center; min-height: var(--tap);
}
.masthead nav a:hover { color: var(--filament); }

.crumbs {
  font-family: var(--mono); font-size: var(--fs-2xs); color: var(--muted);
  padding-top: var(--s-4);
}
.crumbs a { color: var(--muted); }

/* --- hero -------------------------------------------------------- */

/* padding-block, not the padding shorthand: this rule comes after .shell
   with equal specificity, so a horizontal value here would wipe out the
   shell's side gutter and let the hero run to the screen edge. */
.hero { padding-block: clamp(var(--s-7), 6vw, var(--s-8)) var(--s-2); }
.hero h1 { max-width: 17ch; }
.hero .lede { margin-top: var(--s-4); }

/* The hairlines between these are the container background showing through
   1px gaps, so a part-filled row would paint a solid grey block. There are
   always exactly three items, so go straight from one column to three and
   never leave an empty cell. */
.thesis {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  margin-top: var(--s-6);
  overflow: hidden;
}
.thesis > div { background: var(--card); padding: var(--s-4) var(--s-5); }
.thesis dt {
  font-family: var(--mono); font-size: var(--fs-3xs); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-2);
}
.thesis dd { margin: 0; font-size: var(--fs-md); line-height: 1.5; }
.thesis dd b { font-weight: 600; }

/* --- calculator layout -------------------------------------------- */

.calc {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--s-7); align-items: start; margin: var(--s-7) 0 var(--s-2);
}

.panel {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--r); padding: var(--s-5);
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-1) var(--s-3); flex-wrap: wrap;
  margin-bottom: var(--s-4); padding-bottom: var(--s-3);
  border-bottom: 2px solid var(--ink);
}
.panel-head h2 {
  margin: 0; font-size: var(--fs-sm); letter-spacing: 0.13em;
  text-transform: uppercase; font-weight: 700; font-family: var(--display);
}

/* --- controls ----------------------------------------------------- */

.field { margin-bottom: var(--s-4); }
.field-label, .field > label {
  display: block; font-family: var(--mono); font-size: var(--fs-2xs);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: var(--s-2);
}

input[type="number"], input[type="text"], select {
  font-family: var(--mono); font-size: var(--fs-base); color: var(--ink);
  background: #FFF; border: 1px solid var(--rule-strong); border-radius: var(--r);
  padding: var(--s-3); width: 100%; min-width: 0;
}
input:focus, select:focus { border-color: var(--ink); }
select {
  appearance: none; cursor: pointer; padding-right: var(--s-7);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.75rem, 1fr)); gap: var(--s-3); }

.seg { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.seg button {
  font-family: var(--mono); font-size: var(--fs-2xs); letter-spacing: 0.04em;
  background: var(--paper-2); color: var(--ink-4); border: 1px solid var(--rule-strong);
  border-radius: var(--r); padding: var(--s-2) var(--s-3); cursor: pointer;
  min-height: var(--tap);
}
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #FFF; }
.seg button:hover { border-color: var(--ink); }

/* light set rows */
.set-row {
  border: 1px solid var(--rule); border-left: 3px solid var(--ink);
  border-radius: var(--r); padding: var(--s-3); margin-bottom: var(--s-3); background: #FFF;
}
.set-row header {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-3); margin-bottom: var(--s-2);
}
.set-row h3 {
  margin: 0; font-family: var(--mono); font-size: var(--fs-2xs); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
}
.link-btn {
  background: none; border: 0; padding: var(--s-2) 0; font-family: var(--mono);
  font-size: var(--fs-2xs); color: var(--muted); cursor: pointer; text-decoration: underline;
  min-height: var(--tap);
}
.link-btn:hover { color: var(--signal-deep); }

.add-row {
  width: 100%; background: transparent; border: 1px dashed var(--muted);
  border-radius: var(--r); padding: var(--s-3); font-family: var(--mono);
  font-size: var(--fs-xs); cursor: pointer; color: var(--ink-4);
  min-height: var(--tap);
}
.add-row:hover { border-style: solid; background: var(--paper-2); }

.subtle {
  font-size: var(--fs-xs); color: var(--muted); margin: var(--s-2) 0 0;
  line-height: 1.5; text-wrap: pretty;
}

details.extra { margin-top: var(--s-4); border-top: 1px solid var(--rule); padding-top: var(--s-1); }
details.extra summary {
  font-family: var(--mono); font-size: var(--fs-2xs); letter-spacing: 0.1em;
  text-transform: uppercase; cursor: pointer; color: var(--ink); list-style: none;
  padding: var(--s-2) 0;
}
details.extra summary::-webkit-details-marker { display: none; }
details.extra summary::before { content: "+ "; color: var(--muted); }
details.extra[open] summary::before { content: "– "; }
details.extra .body { margin-top: var(--s-3); padding-bottom: var(--s-2); }

.reset-line { margin: var(--s-4) 0 0; }

/* --- THE GAUGE — signature element -------------------------------- */

.gauge-wrap { position: sticky; top: var(--s-4); }

.gauge {
  background: var(--night); color: var(--on-night);
  border-radius: var(--r); padding: var(--s-5);
  box-shadow: 0 18px 40px -22px rgba(14,21,38,.75);
}
.gauge-top {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s-1) var(--s-3); flex-wrap: wrap;
  padding-bottom: var(--s-3); margin-bottom: var(--s-4);
  border-bottom: 1px solid var(--night-rule);
}
.gauge-top .g-title {
  font-family: var(--display); font-weight: 700; font-size: var(--fs-md);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.gauge-top .g-region { font-family: var(--mono); font-size: var(--fs-3xs); color: var(--on-night-5); }

.bar-block { margin-bottom: var(--s-5); }
.bar-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s-1) var(--s-2); margin-bottom: var(--s-2);
}
.bar-name {
  font-family: var(--mono); font-size: var(--fs-3xs); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--on-night-4);
}
.bar-num {
  font-family: var(--mono); font-size: var(--fs-xs); font-weight: 500;
  color: #FFF; white-space: nowrap;
}

.bar {
  position: relative; height: var(--s-6); border-radius: var(--r-sm);
  background: var(--night-3);
  overflow: hidden; border: 1px solid var(--night-rule-2);
}
.bar-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: linear-gradient(90deg, var(--fill-amber-a), var(--filament) 70%, var(--glow));
  box-shadow: 0 0 18px 1px var(--glow-amber);
  transition: width .25s ease;
}
.bar-fill.over {
  background: linear-gradient(90deg, var(--fill-red-a), var(--signal) 70%, var(--fill-amber-b));
  box-shadow: 0 0 18px 1px var(--glow-red);
}
.bar-foot {
  font-family: var(--mono); font-size: var(--fs-3xs); color: var(--on-night-6);
  margin-top: var(--s-2); line-height: 1.5;
}
.bar-foot b { color: var(--on-night-2); font-weight: 500; }

.binding {
  background: var(--filament); color: var(--binding-ink);
  border-radius: var(--r); padding: var(--s-4); margin-top: var(--s-1);
}
.binding.over { background: var(--signal-deep); color: #FFF; }
.binding .b-label {
  font-family: var(--mono); font-size: var(--fs-3xs); letter-spacing: 0.16em;
  text-transform: uppercase; opacity: .85;
}
.binding .b-val {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.4375rem, 3.6vw, 1.875rem); line-height: 1.12; margin-top: var(--s-1);
  text-wrap: balance;
}
.binding .b-sub { font-family: var(--mono); font-size: var(--fs-2xs); margin-top: var(--s-1); opacity: .9; }

.readout { margin-top: var(--s-4); border-top: 1px solid var(--night-rule); padding-top: var(--s-2); }
.readout .r {
  display: flex; align-items: baseline; gap: var(--s-2);
  font-family: var(--mono); font-size: var(--fs-2xs); padding: var(--s-2) 0;
}
.readout .r-label { color: var(--on-night-5); white-space: nowrap; }
.readout .r-dots { flex: 1 1 auto; border-bottom: 1px dotted var(--night-dots); transform: translateY(-4px); }
.readout .r-val { color: #FFF; white-space: nowrap; }

.note-strip {
  font-family: var(--mono); font-size: var(--fs-2xs); line-height: 1.6;
  color: var(--on-night-3); background: var(--night-2);
  border-left: 3px solid var(--filament); padding: var(--s-3); margin-top: var(--s-4);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.note-strip.warn { border-left-color: var(--signal); color: var(--warn-tint); }
.note-strip b { color: #FFF; font-weight: 500; }

.gauge-caveat {
  font-size: var(--fs-2xs); line-height: 1.6; color: var(--on-night-5);
  margin: var(--s-4) 0 0; padding-top: var(--s-3);
  border-top: 1px solid var(--night-rule); text-wrap: pretty;
}
.gauge-caveat a { color: var(--filament); text-underline-offset: 2px; }

.gauge-empty {
  font-family: var(--mono); font-size: var(--fs-2xs); color: var(--on-night-5);
  text-align: center; padding: var(--s-6) 0; line-height: 1.7;
}

/* --- content ------------------------------------------------------ */

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 var(--s-4); text-wrap: pretty; }
.prose ul, .prose ol { margin: 0 0 var(--s-4); padding-left: var(--s-5); }
.prose li { margin-bottom: var(--s-2); }

.wrap-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
table.data {
  width: 100%; min-width: 34rem; border-collapse: collapse;
  margin: var(--s-4) 0 var(--s-6); font-size: var(--fs-md);
}
table.data th, table.data td {
  text-align: left; padding: var(--s-3); border-bottom: 1px solid var(--rule); vertical-align: top;
}
table.data th {
  font-family: var(--mono); font-size: var(--fs-3xs); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--ink);
}
table.data td:first-child { font-weight: 600; }
table.data tbody tr:hover { background: var(--paper-2); }

.callout {
  border: 1px solid var(--rule); border-left: 4px solid var(--filament);
  background: var(--card); border-radius: 0 var(--r) var(--r) 0;
  padding: var(--s-4); margin: var(--s-6) 0; font-size: var(--fs-md);
}
.callout.danger { border-left-color: var(--signal); }
.callout .c-title {
  font-family: var(--mono); font-size: var(--fs-3xs); letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-2);
}
.callout p:last-child { margin-bottom: 0; }

.faq { border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  cursor: pointer; padding: var(--s-4) 0; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; gap: var(--s-4); align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; font-family: var(--mono); color: var(--muted);
  font-size: var(--fs-xl); flex: none;
}
.faq details[open] summary::after { content: "–"; }
.faq .answer { padding-bottom: var(--s-4); color: var(--ink-2); max-width: var(--measure); }
.faq .answer p { margin: 0 0 var(--s-3); text-wrap: pretty; }

/* --- page cards --------------------------------------------------- */

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(14.6875rem, 1fr));
  gap: var(--s-3); margin: var(--s-6) 0 var(--s-2);
}
.pcard {
  display: block; text-decoration: none; background: var(--card);
  border: 1px solid var(--rule); border-radius: var(--r); padding: var(--s-4);
  transition: transform .12s ease, border-color .12s ease;
}
.pcard:hover { transform: translateY(-2px); border-color: var(--ink); }
/* the card's three parts are spans in a block link, so they need to be told
   to stack — left inline they run together as one paragraph and the margin
   on .p-name is silently dropped */
.pcard .p-tag, .pcard .p-name, .pcard .p-sub { display: block; }
.pcard .p-tag {
  font-family: var(--mono); font-size: var(--fs-3xs); letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted);
}
.pcard .p-name {
  font-family: var(--display); font-weight: 700; font-size: var(--fs-xl);
  line-height: 1.15; margin: var(--s-2) 0;
}
.pcard .p-sub { font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.5; }

/* --- ads ---------------------------------------------------------- */

/* A slot with nothing in it collapses, so visitors never see an empty frame.
   Paste a real unit in and the slot lays itself out again — nothing here to
   remember to undo. A slot holding only an HTML comment still counts as empty. */
.ad:empty { display: none; }
.ad { margin: var(--s-7) auto; text-align: center; min-height: 90px;
      display: flex; align-items: center; justify-content: center; }
.ad-label {
  font-family: var(--mono); font-size: var(--fs-3xs); letter-spacing: 0.17em;
  text-transform: uppercase; color: var(--muted); display: block; margin-bottom: var(--s-2);
}

/* --- footer -------------------------------------------------------- */

.foot {
  background: var(--night); color: var(--on-night-3); margin-top: var(--s-9);
  padding: var(--s-8) 0 var(--s-7); font-size: var(--fs-md);
}
.foot a { color: var(--on-night); }
.foot .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5625rem, 1fr)); gap: var(--s-6); }
.foot h4 {
  font-family: var(--mono); font-size: var(--fs-3xs); letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--filament); margin: 0 0 var(--s-3); font-weight: 500;
}
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: var(--s-1); }
.foot li a { display: inline-block; padding: var(--s-1) 0; }
.foot .fine {
  margin: var(--s-7) 0 0; padding-top: var(--s-4); border-top: 1px solid var(--night-rule);
  font-family: var(--mono); font-size: var(--fs-2xs); color: var(--on-night-6); line-height: 1.7;
}

/* --- responsive ---------------------------------------------------- */

/* the calculator and its gauge stack; the gauge stops following */
@media (max-width: 900px) {
  .calc { grid-template-columns: 1fr; gap: var(--s-6); }
  .gauge-wrap { position: static; }
}

@media (min-width: 760px) {
  .thesis { grid-template-columns: repeat(3, 1fr); }
}

/* more air around the content once there is room for it */
@media (min-width: 900px) {
  :root { --gutter: var(--s-7); }
}

/* phone chrome: tighter gutters, shorter section rhythm */
@media (max-width: 560px) {
  :root { --gutter: var(--s-4); }
  h2 { margin-top: var(--s-7); }
  .foot { margin-top: var(--s-8); padding: var(--s-7) 0 var(--s-6); }
  .foot .cols { gap: var(--s-5); }
  .ad { margin: var(--s-6) auto; }
  .thesis > div { padding: var(--s-3) var(--s-4); }
}

/* narrow phones: split rows put their two halves on separate lines
   rather than interleaving mid-wrap */
@media (max-width: 430px) {
  .panel-head, .gauge-top, .bar-head {
    flex-direction: column; align-items: flex-start;
  }
  .bar-head { gap: var(--s-1); }
  .readout .r { flex-wrap: wrap; }
}

/* --- print --------------------------------------------------------- */

@media print {
  .masthead nav, .ad, .foot .cols, .add-row, .link-btn, .seg { display: none; }
  body { background: #FFF; color: #000; font-size: 11pt; }
  .gauge { background: #FFF; color: #000; box-shadow: none; border: 1px solid #000; }
  .gauge-top .g-region, .bar-name, .bar-foot, .readout .r-label { color: #333; }
  .bar-num, .readout .r-val, .note-strip b, .bar-foot b { color: #000; }
  .note-strip { background: #FFF; color: #000; border-left: 3px solid #000; }
  .gauge-caveat { color: #333; border-top-color: #000; }
  .gauge-caveat a { color: #000; }
  .binding, .binding.over { background: #FFF; color: #000; border: 2px solid #000; }
  .panel, .pcard, .callout, .thesis > div { break-inside: avoid; }
  .faq details { break-inside: avoid; }
  .faq .answer { display: block !important; }
  .wrap-scroll { overflow: visible; }
  table.data { min-width: 0; }
  a { text-decoration: none; }
}

/* --- motion -------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
