/* ===========================================================================
   What Can You REALLY See in Seismic?
   Shared stylesheet — OU crimson / cream identity
   =========================================================================== */

:root {
  --ink:        #16191C;
  --ink-soft:   #2C3239;
  --paper:      #E2E6EA;
  --panel:      #FFFFFF;
  --crimson:    #841617;
  --crimson-dp: #5A0E0F;
  --cream:      #F5ECEB;
  --cream-edge: #E6D9AE;
  --slate:      #5C6670;
  --rule:       rgba(22, 25, 28, 0.14);

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body:    "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --maxw: 1220px;

  /* used by the conceptual set's teaching components */
  --sans:   var(--body);
  --teal:   #0B7285;
  --olive:  #6B7A2E;
  --grid:   #C9CDD2;

  /* table and callout fill from the house palette, and a short alias for the
     crimson so the drop-in scripts can name it without a fallback */
  --fill:   #F4F6F7;
  --crim:   var(--crimson);
}

* { box-sizing: border-box; }

/* author display rules outrank the UA sheet's [hidden] rule, so make it stick */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* Crimson hairline that runs across the very top of every page */
body::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--crimson-dp), var(--crimson) 45%, #A8302C);
}

a { color: var(--crimson); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--crimson-dp); }

:focus-visible {
  outline: 2.5px solid var(--crimson);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* --- eyebrow / labels ---------------------------------------------------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--crimson);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

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

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 0;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand b { color: var(--crimson); font-weight: 600; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--crimson);
  flex: none;
}
.masthead nav { display: flex; gap: 20px; font-size: 13px; }
.masthead nav a { color: var(--slate); text-decoration: none; }
.masthead nav a:hover { color: var(--crimson); }

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

.hero { padding: 44px 0 20px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
}

h1.title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.6rem, 6.4vw, 4.4rem);
  line-height: 0.94;
  letter-spacing: -0.026em;
  margin: 0 0 20px;
  text-wrap: balance;
}
h1.title em {
  font-style: normal;
  color: var(--crimson);
  position: relative;
  white-space: nowrap;
}
/* underline that reads like a picked horizon */
h1.title em::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0.07em;
  height: 5px;
  background: var(--cream);
  border-bottom: 2px solid var(--crimson);
  z-index: -1;
}

.lede {
  font-size: 1.12rem;
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 0 26px;
}
.lede strong { color: var(--ink); font-weight: 600; }

/* --- hero live panel ----------------------------------------------------- */

.hero-panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 0 rgba(22,25,28,.05), 0 14px 34px -20px rgba(22,25,28,.4);
  padding: 14px 14px 10px;
}
.hero-panel canvas { display: block; width: 100%; height: auto; }
.hero-cap {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--slate);
  padding-top: 9px;
  margin-top: 9px;
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.hero-cap b { color: var(--crimson); font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--body); font-size: 14px; font-weight: 500;
  padding: 11px 20px;
  border: 1px solid var(--crimson);
  background: var(--crimson);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.btn:hover { background: var(--crimson-dp); border-color: var(--crimson-dp); color: #fff; transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--crimson); }
.btn.ghost:hover { background: var(--cream); color: var(--crimson-dp); }
.btn.small { padding: 7px 13px; font-size: 12.5px; }

/* --- primer strip -------------------------------------------------------- */

.primer {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-top: 40px;
  padding: 30px 0;
}
.primer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; }
.primer h3 {
  font-family: var(--mono); font-size: 11px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--crimson); margin: 0 0 8px;
}
.primer p { margin: 0; font-size: 14.5px; color: var(--ink-soft); }
.primer .eq {
  font-family: var(--mono); font-size: 15px; color: var(--ink);
  background: var(--cream); border-left: 3px solid var(--crimson);
  padding: 5px 10px; display: inline-block; margin-bottom: 9px;
}

/* --- module cards -------------------------------------------------------- */

.modules { padding: 46px 0 30px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--rule);
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  transition: transform .16s, box-shadow .16s, border-color .16s;
  position: relative;
  overflow: hidden;
}
a.card:hover {
  transform: translateY(-3px);
  border-color: rgba(132,22,23,.5);
  box-shadow: 0 16px 30px -22px rgba(22,25,28,.55);
}
.card canvas { display: block; width: 100%; height: auto; background: #fff; }
.card-body { padding: 15px 17px 18px; flex: 1; display: flex; flex-direction: column; }
.card-no {
  font-family: var(--mono); font-size: 11px; color: var(--crimson);
  letter-spacing: .1em; margin-bottom: 5px;
}
.card h3 {
  font-family: var(--display); font-weight: 700; font-size: 1.14rem;
  margin: 0 0 6px; line-height: 1.2; letter-spacing: -0.012em;
}
.card p { margin: 0; font-size: 13.6px; color: var(--slate); line-height: 1.5; }
.card .q {
  margin-top: 10px; font-size: 13px; color: var(--ink-soft);
  border-left: 2px solid var(--cream-edge); padding-left: 10px; font-style: italic;
}

/* card artwork: one flat illustration per module, drawn from that module's
   own subject rather than a generic glyph */
.thumb {
  border-bottom: 1px solid var(--rule);
  background: #F6F4EE;
  line-height: 0;
  overflow: hidden;
}
.thumb svg { display: block; width: 100%; height: auto; }
a.card:hover .thumb { background: #FBF9F4; }

.card.planned { opacity: .62; }
.card.planned .thumb {
  height: 96px; background: repeating-linear-gradient(
    -45deg, #fff, #fff 7px, #F4F4F1 7px, #F4F4F1 14px);
}
.flag {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .11em;
  text-transform: uppercase; padding: 3px 7px;
  background: var(--ink); color: #fff;
}
.flag.next { background: var(--crimson); }

/* --- landing page: section heads, hero buttons, about --------------------- */

.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

.sec-head { margin-bottom: 22px; max-width: 76ch; }
.sec-head h2 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.6rem, 3.2vw, 2.1rem); letter-spacing: -0.02em;
  margin: 0 0 8px; line-height: 1.05;
}
.sec-head p { margin: 0; color: var(--ink-soft); font-size: 15.5px; }

.about {
  border-top: 1px solid var(--rule);
  padding: 30px 0 6px;
}
.about h2 {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--crimson); margin: 0 0 12px;
}
.about p { margin: 0 0 10px; color: var(--ink-soft); font-size: 15px; max-width: 78ch; }

/* --- next module ---------------------------------------------------------- */

.nextup {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--crimson);
  padding: 16px 20px 18px;
  margin: 26px 0 2px;
}
.nextup .eyebrow { margin-bottom: 9px; }
.nextup h3 {
  font-family: var(--display); font-weight: 700; font-size: 1.24rem;
  margin: 0 0 7px; letter-spacing: -0.012em; line-height: 1.2;
}
.nextup h3 a { color: var(--ink); text-decoration: none; }
.nextup h3 a:hover { color: var(--crimson); }
.nextup p { margin: 0 0 13px; font-size: 14.5px; color: var(--ink-soft); max-width: 82ch; }
.nextup .btn { margin-right: 8px; }

/* --- disclaimer ---------------------------------------------------------- */

.disclaimer {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--slate);
  padding: 15px 20px 16px;
  margin: 10px 0 6px;
}
.disclaimer h4 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--slate); margin: 0 0 7px;
}
.disclaimer p {
  margin: 0; font-size: 13.5px; color: var(--ink-soft); max-width: 96ch; line-height: 1.55;
}
.disclaimer p + p { margin-top: 7px; }
.disclaimer b { color: var(--ink); font-weight: 600; }

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

footer {
  /* Break out of .wrap so the rule and the background cross the whole window;
     the text inside stays on the same grid as the rest of the page. */
  margin: 34px calc(50% - 50vw) 0;
  width: 100vw;
  border-top: 1px solid var(--rule);
  background: #FAFAF8;
  padding: 26px 24px 40px;
  font-size: 13px; line-height: 1.62; color: var(--slate);
}
footer .foot-grid {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; gap: 6px 40px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  align-items: start;
}
footer p { margin: 0; max-width: none; }
@media (max-width: 700px) {
  footer { padding: 22px 16px 34px; }
  footer .foot-grid { gap: 10px; }
}

/* ===========================================================================
   MODULE PAGES
   =========================================================================== */

.mod-head { padding: 22px 0 18px; border-bottom: 1px solid var(--rule); }
.mod-head h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.8rem, 3.6vw, 2.5rem); letter-spacing: -0.022em;
  margin: 8px 0 8px; line-height: 1.03;
}
.mod-head .sub { margin: 0; color: var(--ink-soft); max-width: 92ch; font-size: 15.5px; }

.lab {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 26px;
  padding: 26px 0 10px;
  align-items: start;
}

/* control rail */
.rail {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 16px 16px 18px;
  position: sticky; top: 14px;
}
.rail h2, .ctl-col h2 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .15em;
  text-transform: uppercase; color: var(--crimson);
  margin: 0 0 13px; padding-bottom: 8px; border-bottom: 1px solid var(--rule);
}
.rail h2:not(:first-child) { margin-top: 22px; }

/* --- controls as a band across the top (used by the fault module) -------- */

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 4px 26px;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 17px 22px 20px;
  margin-top: 20px;
}
.ctl-col { min-width: 0; }
.ctl-col h2 { margin-top: 0; }
.ctl-col .btn { width: 100%; justify-content: center; margin-top: 7px; }

/* --- editable layer table (1D model module) ------------------------------ */

.ltab { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ltab th {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--slate); font-weight: 500;
  text-align: left; padding: 0 5px 6px; white-space: nowrap;
}
.ltab td { padding: 3px 5px; border-top: 1px solid var(--rule); vertical-align: middle; }
.ltab input {
  width: 100%; min-width: 54px;
  font-family: var(--mono); font-size: 12.5px; padding: 4px 6px;
  border: 1px solid var(--rule); background: #fff; color: var(--ink);
}
.ltab input:disabled { background: #F4F5F3; color: var(--slate); }
.ltab .ro {
  font-family: var(--mono); font-size: 12px; color: var(--crimson-dp);
  text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ltab .name { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.ltab .chip {
  width: 15px; height: 15px; display: inline-block; vertical-align: -3px;
  border: 1px solid rgba(22,25,28,.3); margin-right: 7px;
}
.ltab .rowbtn {
  border: 1px solid var(--rule); background: #fff; color: var(--slate);
  font-family: var(--mono); font-size: 13px; line-height: 1;
  padding: 4px 7px; cursor: pointer;
}
.ltab .rowbtn:hover { border-color: var(--crimson); color: var(--crimson); }
.tab-wrap { overflow-x: auto; }

/* --- stat strip under the section --------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 16px;
}
.stat {
  background: var(--cream);
  padding: 8px 12px 9px;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.stat span { font-size: 11px; color: var(--ink-soft); line-height: 1.32; }
.stat b {
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  color: var(--crimson-dp); font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat.key { background: var(--crimson); }
.stat.key span { color: rgba(255,255,255,.82); }
.stat.key b { color: #fff; font-size: 15px; }
.stat.wide { grid-column: span 2; }
@media (max-width: 520px) {
  .stat.wide { grid-column: span 1; }
}

.ctl { margin-bottom: 14px; }
.ctl label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; color: var(--ink-soft); margin-bottom: 5px; gap: 8px;
}
.ctl label .val {
  font-family: var(--mono); font-size: 12.5px; color: var(--crimson);
  font-weight: 500; font-variant-numeric: tabular-nums;
}
.ctl input[type=range] {
  width: 100%; margin: 0; height: 18px;
  -webkit-appearance: none; appearance: none; background: transparent;
}
.ctl input[type=range]::-webkit-slider-runnable-track {
  height: 3px; background: var(--rule);
}
.ctl input[type=range]::-moz-range-track { height: 3px; background: var(--rule); }
.ctl input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--crimson); margin-top: -6px; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--crimson);
}
.ctl input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff;
  background: var(--crimson); cursor: pointer; box-shadow: 0 0 0 1px var(--crimson);
}
.ctl select, .ctl input[type=number] {
  width: 100%; font-family: var(--body); font-size: 13px;
  padding: 6px 8px; border: 1px solid var(--rule); background: #fff; color: var(--ink);
}

.seg { display: flex; border: 1px solid var(--rule); }
.seg button {
  flex: 1; font-family: var(--body); font-size: 12px; padding: 7px 4px;
  background: #fff; border: 0; border-right: 1px solid var(--rule);
  color: var(--slate); cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--crimson); color: #fff; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 9px; }
.check input { accent-color: var(--crimson); width: 15px; height: 15px; }

.rail .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* readouts */
.readout {
  background: var(--cream); border: 1px solid var(--cream-edge);
  padding: 11px 12px; margin-top: 4px;
}
.readout dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; }
.readout dt { font-size: 12px; color: var(--ink-soft); }
.readout dd {
  margin: 0; font-family: var(--mono); font-size: 12.5px;
  color: var(--crimson-dp); font-weight: 500; text-align: right;
  font-variant-numeric: tabular-nums;
}
.readout dd.big { font-size: 14px; color: var(--crimson); }

/* plot stack */
.stage { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.plot {
  background: var(--panel); border: 1px solid var(--rule); padding: 13px 14px 12px;
}
.plot-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 9px; flex-wrap: wrap;
}
.plot-head h3 {
  font-family: var(--display); font-size: 1rem; font-weight: 700;
  margin: 0; letter-spacing: -0.008em;
}
.plot-head .hint {
  font-family: var(--mono); font-size: 10.5px; color: var(--slate);
  text-align: right; flex: 0 1 auto; min-width: 0;
}
.plot canvas { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; }

/* section and its trace panel, side by side and sharing a time axis */
/* Side-by-side panels.

   The columns share the row equally. They used to be `flex: none`, which left
   each column's width to be settled by its content — and since the content is
   a canvas whose width is read back from the column, the two ended up slightly
   different depending on how long each sublabel happened to be. Two panels
   meant to be compared were drawn at different sizes, which reads as sloppy
   before it reads as anything else. `flex: 1 1 0` with `min-width: 0` gives
   every column the same width whatever is written above it. */
.sec-row { display: flex; gap: 10px; align-items: flex-start; }
.sec-row > .panel-col { flex: 1 1 0; min-width: 0; }
.sec-row canvas { width: 100%; display: block; }
@media (max-width: 700px) {
  .sec-row { flex-direction: column; gap: 14px; }
}

/* stacked panels: layer model, seismic, traces */
#modelWrap { margin-bottom: 16px; }
.panel-col { min-width: 0; max-width: 100%; }
.hint-line {
  font-family: var(--mono); font-size: 10.5px; color: var(--slate);
  margin: -4px 0 12px;
}
.sublabel {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-soft);
  margin: 0 0 6px; display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap;
}
.sublabel b {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; flex: none;
  background: var(--crimson); color: #fff;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0; border-radius: 50%;
}
.sublabel .note {
  text-transform: none; letter-spacing: 0; color: var(--slate);
  font-size: 10.5px;
}
/* Panels in a row must start at the same height, or their plot boxes will not
   line up. A caption that wraps to two lines in a narrow column would otherwise
   push its canvas down relative to its neighbours. */
.sec-row .sublabel { min-height: 30px; align-content: flex-start; }

.legend {
  display: flex; gap: 7px 14px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10.5px; color: var(--slate);
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule);
  min-width: 0; max-width: 100%;
}
.legend span { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* prose legends: a paragraph, not a row of keyed swatches */
.legend.prose { display: block; }
.legend.prose span { display: block; line-height: 1.65; max-width: none; }
.legend i {
  width: 15px; height: 0; flex: none;
  border-top-width: 2px; border-top-style: solid; display: inline-block;
}
.legend i.sw {
  width: 15px; height: 10px; border: 1px solid rgba(22,25,28,.35);
  border-top-width: 1px;
}

/* teaching blocks */
.teach { display: grid; grid-template-columns: 1.12fr 1fr; gap: 22px; padding: 30px 0 10px; }
@media (min-width: 1100px) {
  .takeaway ul { columns: 2; column-gap: 26px; }
  .takeaway li { break-inside: avoid; }
}

.tryit {
  background: var(--cream); border: 1px solid var(--cream-edge);
  border-left: 4px solid var(--crimson); padding: 18px 22px 20px;
}
.tryit h3 {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--crimson-dp); margin: 0 0 12px;
}
.tryit ol { margin: 0; padding-left: 19px; }
.tryit li { margin-bottom: 12px; font-size: 14.5px; }
.tryit li:last-child { margin-bottom: 0; }
.tryit li b { font-weight: 600; }
.tryit .ans {
  display: block; margin-top: 4px; font-size: 13.5px; color: var(--ink-soft);
}

.takeaway { background: var(--panel); border: 1px solid var(--rule); padding: 18px 22px 20px; }
.takeaway h3 {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--crimson); margin: 0 0 12px;
}
.takeaway ul { margin: 0; padding-left: 18px; }
.takeaway li { margin-bottom: 10px; font-size: 14.5px; }
.takeaway li:last-child { margin-bottom: 0; }

code, .k { font-family: var(--mono); font-size: 0.92em; background: rgba(22,25,28,.055); padding: 1px 5px; }

details.notes { margin: 22px 0 0; border-top: 1px solid var(--rule); padding-top: 14px; }
details.notes summary {
  cursor: pointer; font-family: var(--mono); font-size: 11px;
  letter-spacing: .13em; text-transform: uppercase; color: var(--crimson);
}
details.notes p, details.notes li { font-size: 14px; color: var(--ink-soft); max-width: 92ch; }

/* --- tabbed module layout ------------------------------------------------ */
/* A long module is hard to work through by scrolling, because the controls and
   the data end up off screen by the time you reach the discussion. These three
   pieces keep the live panel and its sliders pinned at the top while the
   explanation changes underneath. */

.labhead {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 10px 14px 8px;
  margin: 16px 0 0;
  /* sticks to the top so the sliders stay reachable while you read the result
     further down the page. Changing a parameter and watching the answer move
     is the entire point, and that cannot happen if they are never both on
     screen at once. */
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 6px 14px -8px rgba(22, 25, 28, .35);
}
.labhead .labgrid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 18px; align-items: start;
}
.labhead canvas { display: block; width: 100%; height: auto; }
.labhead .controls {
  margin: 0; border: 0; padding: 0; background: none;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px; align-items: start;
}
.labhead .ctl-col { display: contents; }
.labhead .ctl { margin-bottom: 4px; }
.labhead .ctl label { font-size: 10px; margin-bottom: 1px; }
.labhead .ctl input[type="range"] { margin: 0; }
.labhead .ctl-col h2 {
  grid-column: 1 / -1; font-size: 9.5px; margin: 5px 0 1px;
  padding-bottom: 2px;
}
.labhead .ctl-col h2:first-child { margin-top: 0; }
/* the long explanations belong in the step that introduces them, not in a
   header that has to stay short */
.labhead .hint-line, .labhead .btn { display: none; }
.labhead .cap {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .11em;
  text-transform: uppercase; color: var(--crimson); margin: 0 0 5px;
}
.labhead .cap span { text-transform: none; letter-spacing: 0; color: var(--slate); }

/* The tab strip has to read as a set of file tabs sitting on top of the panel
   it opens, otherwise it looks like a toolbar and nobody clicks it. */

.tabhint {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--slate); margin: 16px 0 6px;
}
.tabhint b { color: var(--crimson); font-weight: 600; }

/* Pop the exercises out, and hand out a link to an exact setup. Both sit
   above the tab strip so they are reachable from whichever step is open. */
.modbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 2px; }
.modbar .hint { font-family: var(--mono); font-size: 12px; color: var(--slate); }
@media print { .modbar { display: none; } }

.tabs {
  display: flex; flex-wrap: wrap; gap: 3px;
  border-bottom: 2px solid var(--crimson); margin: 0;
  position: sticky; top: 0; z-index: 29; background: var(--paper);
  padding-top: 14px;
}
.tabs button {
  font-family: var(--body); font-size: 12.5px; padding: 9px 12px 8px;
  background: var(--cream); color: var(--slate); cursor: pointer;
  border: 1px solid var(--rule); border-bottom: 0;
  border-top: 3px solid transparent;
  white-space: nowrap; position: relative; top: 1px;
}
.tabs button:hover { color: var(--ink); background: #fff; }
.tabs button[aria-selected="true"] {
  background: var(--panel); color: var(--crimson); font-weight: 600;
  border-top-color: var(--crimson); top: 0; padding-bottom: 10px;
}
/* The spacer pushes the two meta tabs to the right of the strip. They are
   wrapped in .tabs-meta so that when the strip is too narrow for one line they
   move down together and stay right-aligned, instead of the spacer splitting
   them and leaving one stranded alone on a second row at the left. */
.tabs .gap { flex: 1 0 14px; border: 0; background: none; pointer-events: none; }
.tabs-meta { display: flex; gap: 3px; margin-left: auto; }
@media (max-width: 900px) {
  /* Below this the strip is going to wrap whatever we do, so the steps take
     the room they need and the meta tabs sit under them on their own row. */
  .tabs .gap { flex-basis: 100%; }
  .tabs-meta { margin-left: 0; }
}

.tabpane {
  background: var(--panel); border: 1px solid var(--rule); border-top: 0;
  padding: 22px 26px 24px; animation: fade .18s ease-out;
}

/* Body copy inside a pane. One rule rather than a width pinned onto every
   paragraph, which is what left the text stopping short at different places. */
.tabpane .lede {
  font-size: 15.5px; color: var(--ink-soft); margin: 0 0 13px;
  max-width: none; overflow-wrap: break-word;
}
.tabpane .lede:last-of-type { margin-bottom: 16px; }
.tabpane .lede b { color: var(--ink); }
.tabpane > .plot-head { margin-bottom: 14px; }
.tabpane .legend { max-width: none; }

/* a numbered badge, so you always know where you are in the sequence */
.tabpane .plot-head h3 {
  font-size: 1.16rem; display: flex; align-items: center; gap: 10px;
}
.stepno {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--crimson); color: #fff;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.stepno.ref { background: var(--slate); font-size: 11px; }

/* keep the tab fills when the page is printed or saved as a PDF, otherwise
   the selected tab loses the only thing marking it as selected */
.tabs button, .tabs button[aria-selected="true"], .tabpane, .labhead, .btn {
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* forward and back inside the module, so the way on is never the way out */
.stepnav {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--rule);
}
/* three equal cells, so the middle label really is in the middle and the
   forward button sits flush right even on the first step where there is no
   back button to balance it */
.stepnav > * { flex: 1 1 0; min-width: 0; }
.stepnav > *:first-child { text-align: left; }
.stepnav > *:last-child { text-align: right; }
.stepnav .btn { margin: 0; }
.stepnav .where {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  color: var(--slate); align-self: center;
}

/* --- reveal-on-demand answers -------------------------------------------- */

details.reveal { margin: 8px 0 0; }
details.reveal summary {
  cursor: pointer; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--crimson);
  list-style: none; display: inline-block;
  border: 1px solid var(--rule); padding: 3px 10px; background: #fff;
}
details.reveal summary::-webkit-details-marker { display: none; }
details.reveal summary:hover { background: var(--cream); }
details.reveal[open] summary { background: var(--cream); border-color: var(--cream-edge); }
details.reveal .ans { display: block; margin-top: 9px; }

.foot-grid .lic {
  font-size: 12.5px; color: var(--slate); max-width: 78ch; margin: 8px 0 0;
}
.foot-grid .lic .k { font-family: var(--mono); font-size: 12px; color: var(--crimson); }

.pager {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 26px 0 0; margin-top: 22px; border-top: 1px solid var(--rule); flex-wrap: wrap;
}

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

@media (max-width: 940px) {
  .labhead .labgrid { grid-template-columns: 1fr; gap: 16px; }
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .primer-grid { grid-template-columns: 1fr; gap: 22px; }
  .lab { grid-template-columns: 1fr; }
  .rail { position: static; }
  .teach { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .masthead nav { gap: 14px; }
  h1.title { font-size: 2.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  a.card:hover, .btn:hover { transform: none; }
}

@media print {
  .rail, .masthead nav, .pager, .btn { display: none; }
  body { background: #fff; }
  .lab { grid-template-columns: 1fr; }

  /* A card split by a page break loses the end of its blurb and its question,
     which is how the landing page printed before this rule existed. */
  .card, .pillars > div, .miscon, .whymatters, .disclaimer,
  .check > li, table.menu tr {
    break-inside: avoid; page-break-inside: avoid;
  }
  /* Keep the hero in two columns. Flattening it stretched the text to an
     unreadable measure right across the page. */
  .hero-grid { grid-template-columns: 1.05fr 1fr; gap: 26px; }
  .hero-panel { box-shadow: none; }
  h1.title { font-size: 2.2rem; }
  .card-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .thumb { max-height: 110px; }
  footer { margin: 18px 0 0; width: auto; background: none; padding: 14px 0 0; }
}

/* Well-data acknowledgement on the landing page. */
.about-copy .datacite {
  font-size: 13.5px; color: var(--slate);
  border-left: 3px solid var(--teal); padding-left: 14px;
}

/* ===========================================================================
   CONCEPTUAL SET — components the advanced set does not have.
   Misconception callouts, self-check questions, instructor notes, glossary.
   =========================================================================== */

/* --- misconception callout ------------------------------------------------ */
.miscon {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--crimson);
  background: #FCF8F8;
  padding: 14px 18px; margin: 20px 0;
}
.miscon h4 {
  margin: 0 0 6px; font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--crimson);
}
.miscon .said {
  margin: 0 0 10px; font-size: 15px; font-style: italic; color: var(--ink);
}
.miscon .fix { margin: 0; font-size: 14.5px; line-height: 1.65; color: #40474E; }
.miscon .fix b { color: var(--ink); }

/* --- why this matters ----------------------------------------------------- */
.whymatters {
  border-top: 2px solid var(--ink);
  padding-top: 12px; margin: 24px 0 0;
}
.whymatters h4 {
  margin: 0 0 8px; font-family: var(--sans); font-weight: 700;
  font-size: 16px; color: var(--ink);
}
.whymatters p { margin: 0 0 8px; font-size: 15px; line-height: 1.65; color: #40474E; }

/* --- check yourself: short questions with explained feedback -------------- */
.check { margin: 0; padding: 0; list-style: none; }
.check > li {
  border: 1px solid var(--rule); padding: 16px 18px; margin: 0 0 14px;
  background: #fff;
}
.check .qtext {
  margin: 0 0 12px; font-size: 15.5px; font-weight: 600; color: var(--ink);
  line-height: 1.5;
}
.check .opts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.check .opt {
  font: 14px/1.3 var(--sans); text-align: left;
  border: 1px solid var(--rule); background: #fff; color: var(--ink);
  padding: 9px 14px; cursor: pointer;
}
.check .opt:hover { border-color: var(--slate); }
.check .opt:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.check .opt.right { border-color: var(--olive); background: #F3F6EC; }
.check .opt.wrong { border-color: var(--crimson); background: #FBF3F3; }
.check .why {
  margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--grid);
  font-size: 14.5px; line-height: 1.65; color: #40474E;
}
.check .why[hidden] { display: none; }
.check .why b { color: var(--ink); }

/* --- instructor notes, behind a toggle ------------------------------------ */
.instr { margin: 26px 0 0; }
.instr > summary {
  cursor: pointer; font-family: var(--mono); font-size: 11px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--slate);
  padding: 8px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.instr > summary:hover { color: var(--ink); }
.instr .instr-body { padding: 16px 0 4px; }
.instr h5 {
  margin: 14px 0 5px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--crimson);
}
.instr h5:first-child { margin-top: 0; }
.instr p, .instr li { font-size: 14.5px; line-height: 1.65; color: #40474E; }
.instr ul { margin: 0; padding-left: 20px; }

/* --- numeric parameter inputs, preferred over sliders for real quantities -- */
.numrow { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.numrow label { flex: 1 1 auto; font-size: 13.5px; color: #40474E; }
.numrow input[type="number"] {
  width: 84px; font: 500 14px var(--mono); color: var(--ink);
  border: 1px solid var(--rule); background: #fff; padding: 6px 8px;
  text-align: right;
}
.numrow input[type="number"]:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.numrow .unit {
  width: 52px; font: 11px var(--mono); color: var(--slate); letter-spacing: .04em;
}
.numrow.layer-a input { border-left: 3px solid #8C7B6B; }
.numrow.layer-b input { border-left: 3px solid #C6A664; }
.numrow.layer-c input { border-left: 3px solid #7E8B96; }

/* --- glossary ------------------------------------------------------------- */
.gloss { display: grid; gap: 0; }
.gloss dt {
  font-weight: 700; color: var(--ink); font-size: 15px;
  padding-top: 14px; border-top: 1px solid var(--rule);
}
.gloss dd {
  margin: 4px 0 12px; font-size: 14.5px; line-height: 1.65; color: #40474E;
}
.gloss dd a { font-size: 13.5px; }

/* --- reset button --------------------------------------------------------- */
.btn.reset { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; }

/* All six modules are built, so there is no not-yet-built card style here.
   If one is ever added back, .card.planned in the shared block above covers it. */

/* "What this set leaves out" on the landing page: a plain section rather than
   the boxed disclaimer, so the two do not read as the same kind of note. */
.leftout { margin: 36px 0 0; }
.leftout h4 {
  margin: 0 0 10px; font-family: var(--mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--crimson);
  border-bottom: 1px solid var(--rule); padding-bottom: 8px;
}
.leftout p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.65; color: #40474E; }
.leftout p b { color: var(--ink); }
@media print { .leftout { break-inside: auto; } }

/* --- rocklist -------------------------------------------------------------
   A short list of rocks that share one measured value, used wherever a module
   makes non-uniqueness concrete. Set apart from the surrounding prose because
   the items are the argument rather than an aside to it. */
.rocklist {
  margin: 4px 0 16px; padding: 12px 16px 12px 30px;
  list-style: none; border-left: 3px solid var(--rule);
  background: var(--fill);
}
.rocklist > li {
  position: relative; margin: 0 0 9px;
  font-size: 14.5px; line-height: 1.6; color: #40474E;
}
.rocklist > li:last-child { margin-bottom: 0; }
.rocklist > li::before {
  content: ''; position: absolute; left: -18px; top: 9px;
  width: 6px; height: 6px; background: var(--crimson); opacity: .55;
}
.rocklist > li b { color: var(--ink); }

/* --- requirements table ---------------------------------------------------
   What each inversion method needs before it can be run. Alternating rows so a
   long row can be followed across, and a fixed first column so the method
   names line up down the left. */
.reqtable { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 13.5px; }
.reqtable th, .reqtable td {
  text-align: left; vertical-align: top; padding: 9px 11px;
  border-bottom: 1px solid var(--rule); line-height: 1.5;
}
.reqtable thead th {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--crimson);
  border-bottom: 1px solid var(--slate); white-space: nowrap;
}
.reqtable tbody tr:nth-child(even) { background: var(--fill); }
.reqtable td:first-child { font-weight: 600; color: var(--ink); width: 22%; }
.reqtable .need { color: var(--crimson); font-weight: 600; }
.reqtable .no { color: var(--slate); }
.reqtable .out { font-family: var(--mono); font-size: 12px; }
@media (max-width: 720px) {
  .reqtable { font-size: 12.5px; }
  .reqtable th, .reqtable td { padding: 7px 7px; }
}

/* --- "two things to know" on the landing page -----------------------------
   The two ideas the whole set keeps returning to, set out before the module
   cards so that the cards have something to refer back to. */
.twothings { margin: 40px 0 0; }
.twogrid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 18px;
}
.twogrid > div {
  background: var(--panel); border: 1px solid var(--rule);
  border-top: 3px solid var(--crimson); padding: 20px 22px 18px;
}
.twogrid h4 {
  margin: 0 0 12px; font-family: var(--display); font-size: 16.5px;
  line-height: 1.3; color: var(--ink);
}
.twogrid p {
  margin: 0 0 11px; font-size: 14.5px; line-height: 1.65; color: #40474E;
}
.twogrid p:last-child { margin-bottom: 0; }
.twogrid p b { color: var(--ink); }
@media (max-width: 860px) { .twogrid { grid-template-columns: 1fr; gap: 18px; } }

/* --- reveal bar -----------------------------------------------------------
   A button that uncovers an answer the student is meant to attempt first, with
   a line beside it saying what the button is for. */
.revealbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 12px 0 0; padding: 10px 14px;
  background: var(--fill); border-left: 3px solid var(--rule);
}
.revealbar .note {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em;
  color: var(--slate); text-transform: none;
}

/* --- callout --------------------------------------------------------------
   What to do on a step, set apart from the argument around it so a student who
   is looking for the instruction can find it without reading the prose. */
.callout {
  margin: 4px 0 18px; padding: 13px 16px;
  background: #FCF8F2; border-left: 3px solid var(--crimson);
  font-size: 14.5px; line-height: 1.65; color: #40474E;
}
.callout b { color: var(--ink); }

/* --- start line -----------------------------------------------------------
   One line between the hero and the module cards: what a reader needs before
   starting, and the short path through the set. It replaces three separate
   panels that pushed the cards off the first screen. */
.startline {
  max-width: 76ch; margin: 26px 0 2px;
  font-size: 15px; line-height: 1.65; color: #40474E;
}
.startline b { color: var(--ink); }

/* --- four-types table -----------------------------------------------------
   The two divisions that account for the four names a beginner meets first,
   with a row between them naming what each division is about. */
.reqtable.fourtypes td:first-child { width: 16%; }
.reqtable .grouphead td {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--slate);
  background: var(--fill); padding-top: 11px; padding-bottom: 7px;
  border-bottom: 1px solid var(--slate);
}
.reqtable tbody tr.grouphead:nth-child(even) { background: var(--fill); }

/* --- aside ----------------------------------------------------------------
   A methodological point that is worth having on the page but not worth
   interrupting a first read for. Folded shut by default. */
.aside {
  margin: 8px 0 16px; border-left: 3px solid var(--rule);
  background: var(--fill); padding: 0 16px;
}
.aside > summary {
  cursor: pointer; padding: 10px 0; list-style: none;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--crimson);
}
.aside > summary::-webkit-details-marker { display: none; }
.aside > summary::before { content: '+ '; font-weight: 700; }
.aside[open] > summary::before { content: '– '; }
.aside p {
  margin: 0 0 12px; font-size: 14px; line-height: 1.65; color: #40474E;
}

/* --- glossary index -------------------------------------------------------
   The entries themselves run in the order the modules introduce them, which
   reads well straight through but is no use for looking one term up. This is
   the alphabetical way in. */
.gloss-index {
  margin: 0 0 28px; padding: 16px 20px 18px;
  background: var(--panel); border: 1px solid var(--rule);
  border-left: 3px solid var(--crimson);
}
.idx-head {
  margin: 0 0 10px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .09em; text-transform: uppercase; color: var(--slate);
}
.idx-links { display: flex; flex-wrap: wrap; gap: 4px 0; }
.idx-links a {
  font-size: 13.5px; color: var(--ink-soft); text-decoration: none;
  padding: 2px 10px; border-right: 1px solid var(--rule); line-height: 1.5;
}
.idx-links a:first-child { padding-left: 0; }
.idx-links a:last-child { border-right: 0; }
.idx-links a:hover { color: var(--crimson); text-decoration: underline; }
.gloss dt:target { background: var(--cream); box-shadow: -8px 0 0 var(--cream); }
