:root {
  --ink:        #0f1721;
  --ink-2:      #2a3644;
  --slate:      #5c6b7c;
  --line:       #d9e0e8;
  --line-soft:  #eaeff4;
  --paper:      #f4f7fa;
  --card:       #ffffff;

  /* Primary: institutional blue, used for chrome, links and actions */
  --brand:      #1565c0;
  --brand-deep: #0d47a1;
  --brand-wash: #e8f1fb;

  /* Legacy aliases retained so existing rules keep working */
  --teal:       #1565c0;
  --teal-deep:  #0d47a1;
  --teal-wash:  #e8f1fb;
  --amber:      #a35a00;
  --amber-wash: #fdf1e0;
  --red:        #a02222;
  --red-wash:   #fbeceb;

  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  /* Numerals and the wordmark are set in a serif face for a formal, reference-manual feel */
  --serif: "Times New Roman", Times, "Liberation Serif", serif;

  /* Result readout palette */
  --readout-bg:   #14233f;
  --readout-bg-2: #1f3560;
  --readout-num:  #f0b429;

  --rail-w: 292px;
  --radius: 3px;

  /* Category hues: each family carries one identity colour across the app */
  --indigo: #4338ca; --indigo-wash: #eef0fd;
  --teal:   #0d6a72; --teal-wash:   #e3f0f1;
  --amber:  #b45309; --amber-wash:  #fdf3e3;
  --green:  #15803d; --green-wash:  #e8f6ec;
  --violet: #7c3aed; --violet-wash: #f3ecfe;
  --blue:   #1d4ed8; --blue-wash:   #e8effd;
  --rose:   #be123c; --rose-wash:   #fdeaef;
  --cyan:   #0e7490; --cyan-wash:   #e4f3f8;
  --orange: #c2410c; --orange-wash: #fdeee5;
  --slate-h:#475569; --slate-wash:  #eef1f5;

  /* Type scale: body 16px, secondary 14px, headings 20/18/16px */
  --fs-body:  16px;
  --fs-small: 14px;
  --fs-h1:    20px;
  --fs-h2:    18px;
  --fs-h3:    16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-deep); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: .6rem 1rem;
}
.skip:focus { left: 0; }

/* ---------- Masthead ---------- */

.masthead {
  background: linear-gradient(90deg, var(--readout-bg) 0%, var(--readout-bg-2) 100%);
  color: #fff;
  border-bottom: 3px solid var(--readout-num);
}

.masthead-inner {
  max-width: 1440px; margin: 0 auto;
  padding: .85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}

.brand {
  display: flex; align-items: center; gap: .75rem;
  color: #fff; text-decoration: none;
}

.brand-mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  background: var(--readout-num); color: var(--readout-bg);
  font-family: var(--serif);
  font-size: 22px; font-style: italic; font-weight: 700;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.wordmark {
  font-family: var(--serif);
  font-size: 21px; font-weight: 700;
  letter-spacing: .045em;
  text-transform: uppercase;
  line-height: 1.15;
}
.wordmark em {
  font-style: normal; font-weight: 400;
  color: var(--readout-num);
  letter-spacing: .08em;
}
.brand-text > span {
  font-size: 12px; color: #9db0bd;
  letter-spacing: .16em; text-transform: uppercase; margin-top: .15rem;
}

.masthead-nav { display: flex; gap: 1.25rem; font-size: var(--fs-small); }
.masthead-nav a { color: #b8c7d2; text-decoration: none; }
.masthead-nav a:hover { color: #fff; }
.masthead-nav a.is-current {
  color: var(--readout-num); font-weight: 700;
  border-bottom: 2px solid var(--readout-num); padding-bottom: 2px;
}

/* ---------- Home page ---------- */

.home-block { max-width: 1000px; }
.home-block h2 { }
.home-block h3 { margin: 0 0 .4rem; font-size: var(--fs-body); }
.home-block p { max-width: 82ch; }

.split { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin: 1rem 0; }
.split-col { padding: .9rem 1rem; border-radius: 5px; background: var(--hue-wash); border-left: 4px solid var(--hue); }
.split-col h3 { color: var(--hue); }
.split-col p { margin: 0 0 .5rem; font-size: var(--fs-small); }
.split-col ul { margin: 0; padding-left: 1.1rem; font-size: var(--fs-small); }
.split-col li { margin-bottom: .25rem; }

.callout {
  margin-top: 1rem; padding: .7rem .9rem;
  background: var(--amber-wash); border-left: 4px solid var(--amber);
  border-radius: 4px; font-size: var(--fs-small); color: #6b4405;
}

.levels { margin: .5rem 0 0; }
.levels dt { margin-top: .7rem; font-weight: 700; color: var(--readout-bg-2); font-size: var(--fs-small); }
.levels dd { margin: .15rem 0 0 1.2rem; font-size: var(--fs-small); color: var(--ink-2); }

.method-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 1rem 0; }
.mcard { padding: .9rem 1rem; border-radius: 5px; border: 1px solid var(--line); border-top: 4px solid var(--hue); }
.mcard h3 { color: var(--hue); }
.mcard p { margin: 0; font-size: var(--fs-small); }

.steps { margin: .6rem 0 0; padding-left: 1.3rem; }
.steps li { margin-bottom: .45rem; font-size: var(--fs-small); }
.drivers { margin: .5rem 0 1rem; padding-left: 1.3rem; }
.drivers li { margin-bottom: .35rem; font-size: var(--fs-small); }

/* ---------- Rich method specification panel ---------- */

.spec-name {
  margin: 0 0 .2rem; font-weight: 700; font-size: var(--fs-body);
  color: var(--readout-bg-2);
}
.spec-short { margin: 0 0 1rem; color: var(--slate); }

.spec-grid, .spec-cols {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  margin-bottom: 1rem;
}
.spec-item { padding: .75rem .9rem; border-radius: 4px; background: var(--paper); border-left: 3px solid var(--slate); }
.spec-item.ok { background: var(--green-wash); border-left-color: var(--green); }
.spec-item.warn { background: var(--rose-wash); border-left-color: var(--rose); }
.spec-item h3, .spec-cols h3 {
  margin: 0 0 .3rem; font-size: var(--fs-small); text-transform: uppercase;
  letter-spacing: .07em; color: var(--slate); font-weight: 700;
}
.spec-item.ok h3 { color: var(--green); }
.spec-item.warn h3 { color: var(--rose); }
.spec-item p { margin: 0; font-size: var(--fs-small); }

.spec-hyp {
  padding: .8rem .95rem; margin-bottom: 1rem;
  background: var(--indigo-wash); border-left: 3px solid var(--indigo); border-radius: 4px;
}
.spec-hyp h3 { color: var(--indigo); }
.spec-hyp p { margin: 0 0 .35rem; font-size: var(--fs-small); }
.spec-hyp .hyp { font-family: var(--serif); font-size: var(--fs-body); }

.spec-cols ul, .spec-cols ol { margin: 0; padding-left: 1.2rem; }
.spec-cols li { font-size: var(--fs-small); margin-bottom: .3rem; color: var(--ink-2); }
.spec-cols p { margin: 0; font-size: var(--fs-small); }

/* ---------- Shell ---------- */

.shell {
  max-width: 1440px; margin: 0 auto;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  align-items: start;
}

/* ---------- Rail ---------- */

.rail {
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding-bottom: 3rem;
}

.rail-disclosure { border: 0; }

/* The summary is a mobile-only control; on desktop the rail is always open. */
.rail-summary { display: none; }

.rail-search { padding: 1rem; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--card); }

.rail-search input {
  width: 100%; padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit; font-size: var(--fs-small);
  background: var(--paper);
}
.rail-search input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }

.rail-group { padding: .9rem 1rem .3rem; }

.rail-group-title {
  display: flex; align-items: center; gap: .5rem;
  margin: 0 0 .45rem;
  font-size: var(--fs-small); text-transform: uppercase; letter-spacing: .09em;
  color: var(--slate); font-weight: 700;
}

.rail-letter {
  width: 18px; height: 18px; flex: none;
  display: grid; place-items: center;
  background: var(--hue, var(--teal)); color: #fff;
  font-family: var(--mono); font-size: 12px; font-weight: 700; border-radius: 3px;
}

.rail-nav ul { list-style: none; margin: 0; padding: 0; }

.rail-nav a {
  display: flex; gap: .55rem; align-items: baseline;
  padding: .32rem .4rem .32rem .1rem;
  font-size: var(--fs-small); line-height: 1.35;
  color: var(--ink-2); text-decoration: none;
  border-radius: var(--radius);
}
.rail-nav a:hover { background: var(--hue-wash, var(--paper)); color: var(--hue, var(--teal-deep)); }

.rail-nav a.is-active {
  background: var(--hue-wash, var(--teal-wash));
  color: var(--hue, var(--teal-deep)); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--hue, var(--teal));
}

.rail-no {
  font-family: var(--serif); font-size: var(--fs-small);
  color: var(--slate); min-width: 1.4em; text-align: right; flex: none;
}

.rail-empty { padding: 1rem; color: var(--slate); font-size: var(--fs-small); }

/* ---------- Main ---------- */

.main { padding: 2.25rem 2.25rem 4rem; min-width: 0; }

.eyebrow {
  margin: 0 0 .5rem;
  font-size: var(--fs-small); text-transform: uppercase; letter-spacing: .12em;
  color: var(--slate); font-weight: 700;
}
.eyebrow a { color: var(--teal-deep); text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
.eyebrow .dot { margin: 0 .35rem; }

/* ---------- Hero ---------- */

.hero { margin-bottom: 2.5rem; }
.hero h1, .hero-lede { max-width: 62ch; }

.hero h1 {
  margin: 0 0 .75rem;
  font-size: var(--fs-h1);
  line-height: 1.18; letter-spacing: -.02em; font-weight: 700;
}
.hero h1 em { font-style: italic; color: var(--teal-deep); }

.hero-lede { margin: 0; color: var(--ink-2); font-size: var(--fs-body); }

.hero-stats {
  display: flex; flex-wrap: wrap; gap: 2.25rem;
  margin: 1.75rem 0 0; padding: 1rem 0 0;
  border-top: 1px solid var(--line);
}
.hero-stats div { margin: 0; }
.hero-stats dt {
  font-size: var(--fs-small); text-transform: uppercase; letter-spacing: .1em;
  color: var(--slate); font-weight: 700;
}
.hero-stats dd {
  margin: .15rem 0 0;
  font-family: var(--mono); font-size: var(--fs-h1); font-weight: 600;
  color: var(--teal-deep);
}

/* ---------- Category hues ---------- */

.hue-indigo { --hue: var(--indigo); --hue-wash: var(--indigo-wash); }
.hue-teal   { --hue: var(--teal);   --hue-wash: var(--teal-wash); }
.hue-amber  { --hue: var(--amber);  --hue-wash: var(--amber-wash); }
.hue-green  { --hue: var(--green);  --hue-wash: var(--green-wash); }
.hue-violet { --hue: var(--violet); --hue-wash: var(--violet-wash); }
.hue-blue   { --hue: var(--blue);   --hue-wash: var(--blue-wash); }
.hue-rose   { --hue: var(--rose);   --hue-wash: var(--rose-wash); }
.hue-cyan   { --hue: var(--cyan);   --hue-wash: var(--cyan-wash); }
.hue-orange { --hue: var(--orange); --hue-wash: var(--orange-wash); }
.hue-slate  { --hue: var(--slate-h);--hue-wash: var(--slate-wash); }

/* ---------- Stat strip ---------- */

.stat-strip {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 1.75rem; max-width: 900px;
}

.stat {
  padding: .9rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--hue, var(--teal));
  background: var(--hue-wash, var(--teal-wash));
}
.stat-a { --hue: var(--indigo); --hue-wash: var(--indigo-wash); }
.stat-b { --hue: var(--green);  --hue-wash: var(--green-wash); }
.stat-c { --hue: var(--violet); --hue-wash: var(--violet-wash); }
.stat-d { --hue: var(--amber);  --hue-wash: var(--amber-wash); }

.stat-num {
  display: block;
  font-family: var(--serif); font-weight: 700;
  font-size: var(--fs-h1); line-height: 1.1;
  color: var(--hue);
}
.stat-label {
  display: block; margin-top: .2rem;
  font-size: var(--fs-small); color: var(--ink-2);
}

/* ---------- Quick jump chips ---------- */

.quickjump {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin: 1.75rem 0 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.chip {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .4rem .7rem .4rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: var(--fs-small);
  color: var(--ink-2); text-decoration: none;
  transition: border-color .12s, background .12s, color .12s;
}
.chip:hover { border-color: var(--hue); background: var(--hue-wash); color: var(--hue); }

.chip-letter {
  width: 20px; height: 20px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--hue); color: #fff;
  font-family: var(--mono); font-size: 12px; font-weight: 700;
}
.chip-count { font-family: var(--serif); font-weight: 700; color: var(--slate); font-size: var(--fs-small); }

/* ---------- Catalogue ---------- */

.cat { margin-bottom: 2.5rem; }

.cat-head {
  display: flex; align-items: center; gap: .85rem;
  padding: .7rem .9rem; margin-bottom: 1rem;
  border-radius: 6px;
  background: var(--hue-wash);
  border-left: 5px solid var(--hue);
}

.cat-letter {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  background: var(--hue); color: #fff;
  font-family: var(--mono); font-weight: 700; font-size: var(--fs-body);
  border-radius: var(--radius);
}

.cat-head h2 { margin: 0; font-size: var(--fs-h2); letter-spacing: -.01em; color: var(--hue); }
.cat-head p { margin: 0; font-size: var(--fs-small); color: var(--slate); }
.cat-head > div { flex: 1 1 auto; min-width: 0; }

.cat-count {
  font-family: var(--serif); font-size: var(--fs-small);
  color: var(--hue); background: #fff;
  border: 1px solid var(--hue);
  padding: .1rem .55rem; border-radius: 999px; white-space: nowrap;
}

.cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
}

.card {
  display: flex; gap: .7rem; height: 100%;
  padding: .8rem .9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none; color: inherit;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.card { border-top: 3px solid var(--hue, var(--teal)); }
.card:hover {
  border-color: var(--hue, var(--teal));
  box-shadow: 0 4px 14px rgba(16, 22, 28, .10);
  transform: translateY(-2px);
}

.card-no {
  font-family: var(--serif); font-size: var(--fs-body); font-weight: 700;
  color: var(--hue, var(--teal)); flex: none; padding-top: .12rem; min-width: 1.6em;
}

.card-body { display: flex; flex-direction: column; gap: .18rem; min-width: 0; }
.card-body strong { font-size: var(--fs-small); line-height: 1.3; }
.card-body span { font-size: var(--fs-small); color: var(--slate); line-height: 1.4; }

/* ---------- Reference ---------- */

.reference { margin-top: 3rem; padding-top: 1.75rem; border-top: 1px solid var(--line); }
.reference h2 { margin: 0 0 1.1rem; font-size: var(--fs-h2); }

.ref-grid {
  display: grid; gap: 1.1rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}
.ref-card {
  padding: .9rem 1rem;
  background: var(--hue-wash);
  border-radius: 6px;
  border-left: 4px solid var(--hue);
}
.ref-grid h3 {
  margin: 0 0 .3rem; font-size: var(--fs-body);
  color: var(--hue, var(--teal-deep));
}
.ref-grid p { margin: 0; font-size: var(--fs-small); color: var(--ink-2); }

/* ---------- Method overview (before the inputs) ---------- */

.intro { margin-bottom: 1.25rem; }
.intro-lede { margin: 0 0 .8rem; max-width: 85ch; color: var(--ink-2); }
.intro-methods { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.intro-methods li {
  padding: .6rem .8rem; border-radius: 4px;
  background: var(--paper); border-left: 3px solid var(--line);
}
.intro-methods li.is-active { background: var(--indigo-wash); border-left-color: var(--indigo); }
.intro-methods strong { display: block; font-size: var(--fs-small); color: var(--ink); }
.intro-methods li.is-active strong { color: var(--indigo); }
.intro-methods span { display: block; margin-top: .2rem; font-size: var(--fs-small); color: var(--slate); }

/* ---------- Two-column input grid ---------- */

.field-grid {
  display: grid; gap: 0 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.field-grid .field-wide { grid-column: 1 / -1; }   /* the method selector spans both columns */

@media (max-width: 700px) {
  .field-grid { grid-template-columns: 1fr; }
}

/* ---------- Conclusion ---------- */

.conclusion-box {
  margin-top: .4rem; padding: .85rem 1rem;
  background: var(--green-wash); border-left: 4px solid var(--green);
  border-radius: 4px;
}
.conclusion-box h3 { margin: 0 0 .3rem; color: var(--green); font-size: var(--fs-body); }
.conclusion-box p { margin: 0; font-size: var(--fs-small); color: var(--ink-2); }

.spec-cols .pros h3 { color: var(--green); }
.spec-cols .cons h3 { color: var(--rose); }

/* ---------- Calculator page ---------- */

.calc-head { max-width: 68ch; margin-bottom: 1.75rem; }
.calc-head h1 {
  margin: 0 0 .45rem;
  font-size: var(--fs-h1);
  letter-spacing: -.015em; line-height: 1.2;
}
.calc-desc { margin: 0; color: var(--ink-2); }

.calc-grid { display: block; }

.results { margin: 1.25rem 0 0; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}
.panel + .panel { margin-top: 1rem; }

.panel-title {
  margin: 0 0 .9rem;
  font-size: var(--fs-small); text-transform: uppercase; letter-spacing: .11em;
  color: var(--slate); font-weight: 700;
  padding-bottom: .5rem; border-bottom: 1px solid var(--line-soft);
}

/* Form */

.field { margin-bottom: .95rem; }
.field label {
  display: block; margin-bottom: .28rem;
  font-size: var(--fs-small); font-weight: 600; color: var(--ink-2);
}

.field input, .field select {
  width: 100%; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; font-size: var(--fs-body); font-family: var(--serif);
  background: #fff; color: var(--ink);
}
.field select { font-family: var(--sans); }
.field input:focus, .field select:focus {
  outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal);
}

.field.has-error input, .field.has-error select { border-color: var(--red); }

.hint { margin: .25rem 0 0; font-size: var(--fs-small); color: var(--slate); }
.error-text { margin: .25rem 0 0; font-size: var(--fs-small); color: var(--red); font-weight: 600; }

.form-actions {
  display: flex; align-items: center; gap: 1rem;
  padding-top: .5rem; border-top: 1px solid var(--line-soft); margin-top: 1.1rem;
}

.btn {
  background: var(--teal); color: #fff;
  border: 0; border-radius: var(--radius);
  padding: .6rem 1.1rem;
  font: inherit; font-size: var(--fs-small); font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--teal-deep); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.btn-ghost { font-size: var(--fs-small); color: var(--slate); text-decoration: none; }
.btn-ghost:hover { color: var(--teal-deep); text-decoration: underline; }

/* Readout — the signature element */

.readout {
  background: linear-gradient(135deg, var(--readout-bg) 0%, var(--readout-bg-2) 100%);
  border-color: var(--readout-bg);
  color: #fff;
  padding: 1rem 1.15rem;
  display: flex; flex-direction: column;
  border-radius: 5px;
}

.readout-label {
  margin: 0;
  font-size: var(--fs-small); letter-spacing: .06em;
  color: #b9c9de; font-weight: 600;
}

.readout-value {
  margin: .15rem 0 0;
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 700; line-height: 1.05;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  color: var(--readout-num);
}

.readout.is-idle { background: var(--card); border-color: var(--line); color: var(--ink); }
.readout.is-idle .readout-value { font-family: var(--serif); }
.readout.is-idle .readout-label { color: var(--slate); }
.readout.is-idle .readout-value { color: var(--line); }
.readout.is-idle .readout-note { color: var(--slate); }

.readout-note { margin: .6rem 0 0; font-size: var(--fs-small); color: #a9bad4; }


.readout.is-error {
  background: var(--red-wash); border-color: #e6b8b5; color: var(--ink);
  display: block; min-width: 0;
}
.readout.is-error .readout-label { color: var(--red); }
.readout-error {
  margin: .35rem 0 0; font-size: var(--fs-body); font-weight: 600; color: var(--red);
}
.readout.is-error .readout-note { color: var(--slate); }

/* Detail table */

.detail { width: 100%; border-collapse: collapse; }
.detail th, .detail td {
  padding: .45rem 0; border-bottom: 1px solid var(--line-soft);
  text-align: left; vertical-align: baseline;
}
.detail th { font-weight: 500; color: var(--ink-2); font-size: var(--fs-small); }
.detail td {
  text-align: right;
  font-family: var(--serif); font-size: var(--fs-body); font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--teal-deep); white-space: nowrap; padding-left: 1rem;
}
.detail tr:last-child th, .detail tr:last-child td { border-bottom: 0; }

.note { background: var(--amber-wash); border-color: #eddcc0; }
.note .panel-title { color: var(--amber); border-bottom-color: #eddcc0; }
.note p { margin: 0; font-size: var(--fs-small); color: #6b4405; }

.used { list-style: none; margin: 0; padding: 0; }
.used li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .3rem 0; border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-small);
}
.used li:last-child { border-bottom: 0; }
.used span { color: var(--slate); }
.used b { font-family: var(--mono); color: var(--ink-2); white-space: nowrap; }

/* ---------- Formulas ---------- */

.formula {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--teal);
  border-radius: 4px;
  overflow-x: auto;
}
.formula:last-child { margin-bottom: 0; }

.formula math {
  font-size: 19px;
  color: var(--ink);
}

.formula figcaption {
  margin-top: .6rem;
  font-size: var(--fs-small);
  color: var(--slate);
}

/* ---------- When to use ---------- */

.use-when {
  margin: .85rem 0 0;
  padding: .7rem .9rem;
  background: var(--amber-wash);
  border-left: 4px solid var(--amber);
  border-radius: 4px;
  font-size: var(--fs-small);
  color: #6b4405;
  max-width: 80ch;
}
.use-when strong { color: var(--amber); }

/* ---------- Method badge on the readout ---------- */

.readout-method {
  margin: .5rem 0 0; padding-top: .45rem;
  border-top: 1px solid rgba(255,255,255,.18);
  font-size: 13px; color: #b9c9de;
}

/* ---------- Standard quantities ---------- */

.quantiles {
  margin-top: 1.1rem; padding: .9rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}
.quantiles h3 {
  margin: 0 0 .5rem; font-size: var(--fs-body);
  color: var(--teal-deep);
}
.quantiles p { margin: 0 0 .6rem; font-size: var(--fs-small); }
.quantiles .qnote { margin: .6rem 0 0; color: var(--slate); }

.qgrid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: .35rem .9rem;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}
.qgrid li {
  font-family: var(--serif); font-size: var(--fs-small);
  color: var(--ink-2);
  padding: .25rem .5rem;
  background: #fff; border: 1px solid var(--line-soft); border-radius: 3px;
}
.qgrid span { font-weight: 700; color: var(--readout-bg-2); margin-right: .4rem; }

/* ---------- Parameter glossary (prose, not tabular) ---------- */

.where {
  margin: 1.1rem 0 .6rem;
  font-size: var(--fs-body); font-weight: 600;
  color: var(--ink-2);
}

.glossary { margin: 0; }

.glossary dt {
  display: flex; align-items: baseline; gap: .55rem;
  margin-top: .6rem; flex-wrap: wrap;
}
.glossary dt:first-child { margin-top: 0; }

.gl-sym {
  font-family: var(--serif);
  font-size: var(--fs-body); font-weight: 700;
  color: var(--readout-bg-2);
  min-width: 3.2rem; flex: none;
}
.gl-name { font-size: var(--fs-small); font-weight: 600; color: var(--ink); }

.glossary dd {
  margin: .1rem 0 0 3.75rem;
  margin-top: -1.5rem;
  font-size: var(--fs-small);
  color: var(--ink-2);
  line-height: 1.5;
}

.gl-range {
  display: inline-block; margin-left: .4rem;
  padding: .02rem .4rem;
  border-radius: 3px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  font-family: var(--serif);
  color: var(--slate);
}

/* ---------- Interpretation ---------- */

.doc-block.interpretation {
  background: linear-gradient(135deg, var(--readout-bg) 0%, var(--readout-bg-2) 100%);
  border-color: var(--readout-bg);
  color: #dbe4f0;
}
.doc-block.interpretation h2 {
  color: var(--readout-num);
  border-bottom-color: rgba(240, 180, 41, .45);
}
.doc-block.interpretation p { color: #dbe4f0; }

/* ---------- Methodology / references ---------- */

.docs { margin-top: 2rem; }

.doc-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

.doc-block h2 {
  margin: 0 0 .85rem;
  font-size: var(--fs-h2);
  letter-spacing: -.01em;
  padding-bottom: .55rem;
  border-bottom: 2px solid var(--teal);
  color: var(--teal-deep);
}

.doc-block p {
  margin: 0 0 .8rem;
  max-width: 80ch;
  color: var(--ink-2);
}
.doc-block p:last-child { margin-bottom: 0; }






.refs { margin: 0; padding-left: 1.4rem; }
.refs li {
  margin-bottom: .6rem;
  font-size: var(--fs-small);
  color: var(--ink-2);
  line-height: 1.5;
}
.refs li:last-child { margin-bottom: 0; }
.refs a {
  margin-left: .35rem;
  font-size: var(--fs-small);
  white-space: nowrap;
}

/* ---------- Footer ---------- */

.footer { background: var(--ink); color: #8fa6b4; margin-top: 2rem; }
.footer-inner {
  max-width: 1440px; margin: 0 auto; padding: 1.5rem;
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
}
.footer p { margin: 0; font-size: var(--fs-small); max-width: 70ch; }
.footer-meta { color: #63798a; font-family: var(--mono); font-size: var(--fs-small); }

/* ---------- Responsive ---------- */



@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static; height: auto;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .rail-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .main { padding: 1.5rem 1.15rem 3rem; }

  .rail-summary {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .85rem 1.15rem;
    font-size: var(--fs-small); font-weight: 600; color: var(--ink-2);
    cursor: pointer; list-style: none;
  }
  .rail-summary::-webkit-details-marker { display: none; }
  .rail-summary::after {
    content: "＋"; font-family: var(--mono); color: var(--teal); font-size: var(--fs-body);
  }
  .rail-disclosure[open] .rail-summary::after { content: "−"; }
  .rail-disclosure[open] .rail-summary { border-bottom: 1px solid var(--line-soft); }
  .rail-summary:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }

  .rail-summary-count {
    margin-left: auto; margin-right: .25rem;
    font-family: var(--mono); font-size: var(--fs-small); color: var(--slate);
    border: 1px solid var(--line); border-radius: 999px; padding: .05rem .45rem;
  }

  .rail-search { position: static; }
  .glossary dd { margin-left: 0; }
  .glossary dt { flex-wrap: wrap; gap: .35rem; }
  .rail { padding-bottom: 0; }
  .rail-disclosure[open] .rail-nav { padding-bottom: 1.5rem; }

  /* The answer is what the reader came for — put it above the long input list. */
  .calc-grid { display: flex; flex-direction: column; }
  .calc-grid .results { order: -1; }

  .masthead-inner { flex-wrap: wrap; gap: .75rem 1rem; }
  .masthead-nav { font-size: var(--fs-small); gap: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .card:hover { transform: none; }
}
