/* ==========================================================
   Promise Grace · Mission Control

   This page used to carry its own copy of the notebook's palette with nine
   extra values bolted on, which is how the site ended up with three answers
   to "what colour is a link". Everything is now declared in ../tokens.css
   and this file only names the two surfaces that are genuinely local to it.
   ========================================================== */

:root{
  /* A third surface, between the page and a panel, used by the learning
     plan and the calculation bench. */
  --paper-cool: var(--paper-deep);

  /* The dark housing the crystal sits in, which is a plot surface rather
     than a theme. Kept in both themes for the same reason the thin film
     panel is kept: what it is showing is colour. */
  --dark:#1B1A24;
  --dark-soft:#B9B4C4;

  --body-size:1.0625rem;
  --lh:1.7;

  /* Kept as an alias for the handful of rules still reaching for it by
     name. Nothing new should. */
  --sage: var(--brand);
}

html{scroll-behavior:smooth}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}

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

/* ruling derived from the same baseline the text sits on */
body::before{
  content:'';
  position:fixed; inset:0;
  background:repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--baseline) - 1px),
    var(--rule) calc(var(--baseline) - 1px),
    var(--rule) var(--baseline)
  );
  opacity:.22;
  pointer-events:none;
  z-index:0;
}

main,header,footer{position:relative;z-index:1}

.skip{
  position:absolute;left:-9999px;
  background:var(--brand);color:var(--on-brand);padding:.6rem 1rem;
  font-family:var(--f-mono);font-size:.8125rem;text-decoration:none;
}
.skip:focus{left:.5rem;top:.5rem;z-index:99}

/* ---------- top bar ---------- */
.topbar{
  position:sticky;top:0;z-index:20;
  background:color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter:blur(6px);
  border-bottom:1px solid var(--rule);
}
.topbar-in{
  max-width:1180px;margin:0 auto;
  padding:.55rem 1.25rem;
  display:flex;align-items:center;justify-content:space-between;gap:1rem;
}
.topbar-name{
  font-family:var(--f-mono);font-size:.7rem;letter-spacing:.11em;
  text-transform:uppercase;color:var(--ink-soft);
}
.topbar-nav{display:flex;gap:1rem;flex-wrap:wrap}
.topbar-nav a{
  font-family:var(--f-mono);font-size:.72rem;letter-spacing:.05em;
  color:var(--brand);text-decoration:none;
  border-bottom:1px solid transparent;padding-bottom:2px;
}
.topbar-nav a:hover,.topbar-nav a:focus-visible{border-bottom-color:var(--brand)}

/* ---------- shared layout ---------- */
section{
  max-width:1180px;margin:0 auto;
  padding:4.5rem 1.25rem 3rem;
  position:relative;
}
@media(min-width:900px){
  section{padding-left:5.5rem}
  section::before{
    content:'';position:absolute;left:3.4rem;top:3rem;bottom:1.5rem;
    width:1px;background:var(--rule);
  }
}

.section-num{
  font-family:var(--f-mono);font-size:.7rem;letter-spacing:.14em;
  color:var(--ink-soft);margin:0 0 .4rem;
}
@media(min-width:900px){
  .section-num{position:absolute;left:1.25rem;top:4.4rem;margin:0}
}

h1{
  font-family:var(--f-display);
  font-variation-settings:'SOFT' 40,'WONK' 1;
  font-weight:600;
  font-size:clamp(2.1rem,6vw,4.1rem);
  line-height:1.02;letter-spacing:-.02em;
  margin:.2rem 0 1.4rem;
  max-width:19ch;
}
h2{
  font-family:var(--f-display);
  font-variation-settings:'SOFT' 40,'WONK' 1;
  font-weight:600;
  font-size:clamp(1.5rem,3.2vw,2.2rem);
  line-height:1.15;margin:0 0 1rem;
}
h3{
  font-family:var(--f-display);font-weight:600;
  font-size:1.22rem;line-height:1.3;margin:0 0 .35rem;
}
p{margin:0 0 var(--baseline);max-width:66ch}
.lead{color:var(--ink-soft);max-width:62ch}

.eyebrow{
  font-family:var(--f-mono);font-size:.72rem;letter-spacing:.14em;
  text-transform:uppercase;color:var(--ink-soft);margin:0 0 .9rem;
}

.margin-note{
  font-family:var(--f-hand);font-size:1.16rem;color:var(--aside);
  transform:rotate(-1.1deg);margin:0 0 .8rem;line-height:1.35;
}
@media(min-width:1100px){
  .margin-note{position:absolute;left:-1rem;width:12rem;text-align:right;transform:rotate(-2deg)}
}

/* correction colour: functional only, never interface */
.correction{color:var(--correction)}
.term{border-bottom:2px solid var(--correction);padding-bottom:1px}

/* ---------- cover ---------- */
.cover{padding-top:3.5rem;min-height:78vh}
.cover-note{margin-bottom:1.6rem}
.cover-body p{font-size:1.09rem}

.status{
  margin-top:2.4rem;border-left:3px solid var(--rule);
  padding-left:1rem;max-width:60ch;
}
.status-old{
  color:var(--ink-soft);text-decoration:line-through;
  text-decoration-color:var(--correction);
  font-size:.95rem;margin:0 0 .2rem;opacity:.72;
}
.status-now{margin:.5rem 0 0;font-size:1.05rem}
.status-label{
  font-family:var(--f-mono);font-size:.66rem;letter-spacing:.13em;
  color:var(--brand);margin-right:.6rem;
}

/* ==========================================================
   ENVIRONMENT · MATHS · the calculation bench
   semi-log graph paper, burettes, pH strips, lab arithmetic
   ========================================================== */
.env-maths{
  background-image:
    repeating-linear-gradient(to right,transparent 0,transparent 23px,rgba(48,36,58,.09) 23px,rgba(48,36,58,.09) 24px),
    repeating-linear-gradient(to bottom,transparent 0,transparent 23px,rgba(48,36,58,.09) 23px,rgba(48,36,58,.09) 24px),
    /* compressed log divisions */
    repeating-linear-gradient(to bottom,
      rgba(48,36,58,.055) 0,rgba(48,36,58,.055) 1px,transparent 1px,transparent 34px,
      rgba(48,36,58,.055) 34px,rgba(48,36,58,.055) 35px,transparent 35px,transparent 55px,
      rgba(48,36,58,.055) 55px,rgba(48,36,58,.055) 56px,transparent 56px,transparent 70px,
      rgba(48,36,58,.055) 70px,rgba(48,36,58,.055) 71px,transparent 71px,transparent 82px);
  background-blend-mode:multiply;
}

.burette-row{display:grid;gap:2rem;align-items:start}
@media(min-width:760px){.burette-row{grid-template-columns:auto 1fr}}

.burette{text-align:center;min-width:96px}
.burette-tube{
  position:relative;width:34px;height:230px;margin:0 auto .7rem;
  border:1.5px solid var(--ink);border-radius:3px 3px 9px 9px;
  background:var(--paper-deep);overflow:hidden;
}
.burette-fill{
  position:absolute;left:0;right:0;bottom:0;
  background:linear-gradient(to bottom,rgba(48,36,58,.30),rgba(48,36,58,.55));
  border-top:2px solid var(--ink);
  transition:height .12s linear;
}
@media(prefers-reduced-motion:reduce){.burette-fill{transition:none}}
.burette-marks{
  position:absolute;inset:0;
  background:repeating-linear-gradient(to bottom,
    var(--ink) 0,var(--ink) 1px,transparent 1px,transparent 23px);
  opacity:.34;
}
.burette label{
  display:block;font-family:var(--f-mono);font-size:.68rem;
  letter-spacing:.06em;color:var(--ink-soft);margin-bottom:.35rem;
}
.burette input[type=range]{width:110px;height:44px}

/* lab arithmetic */
.calc{
  font-family:var(--f-mono);font-size:.86rem;line-height:1.85;
  background:var(--paper-deep);padding:.9rem 1rem;
  border:1px solid var(--rule);max-width:34ch;
}
.calc-line{display:block;text-align:right}
.calc-line em{color:var(--ink-soft);font-style:normal;font-size:.8em}
.calc-rule{display:block;border-top:1px solid var(--ink);margin:.35rem 0}
.calc-res b{font-size:1.1em}

.ph-panels,.arr-panels{display:grid;gap:1.3rem}
.scale-block{max-width:36ch}
.scale-title{
  font-family:var(--f-mono);font-size:.68rem;letter-spacing:.1em;
  color:var(--ink-soft);margin:0 0 .3rem;text-transform:uppercase;
}
.linear-track{height:16px;background:var(--paper-deep);border:1px solid var(--rule);position:relative}
.linear-bar{height:100%;background:var(--ink);width:50%;transition:width .12s linear}
@media(prefers-reduced-motion:reduce){.linear-bar{transition:none}}
.scale-cap{font-size:.85rem;color:var(--ink-soft);margin:.3rem 0 0}

/* A universal indicator strip. These eight are the colours the paper on the
   bench actually turns, so they are not brand colours and are not up for
   negotiation with one. */
.ph-strip{
  height:18px;
  background:linear-gradient(to right,
    #C0392B 0%,#E8743B 14%,#E9C978 28%,#8FBF6B 43%,
    #4E9E7E 57%,#3E7FA8 71%,#5B5BA0 85%,#6E4C8F 100%);
  border:1px solid var(--rule);
}
.ph-marker-track{position:relative;height:14px}
.ph-marker{
  position:absolute;top:0;width:2px;height:11px;background:var(--ink);
  transform:translateX(-1px);transition:left .12s linear;
}
@media(prefers-reduced-motion:reduce){.ph-marker{transition:none}}

.chart-pair{display:grid;gap:1rem}
@media(min-width:620px){.chart-pair{grid-template-columns:1fr 1fr}}
.chart-pair figure{margin:0}
.chart-pair figcaption{
  font-family:var(--f-mono);font-size:.68rem;letter-spacing:.06em;
  color:var(--ink-soft);margin-bottom:.3rem;
}
.chart-pair canvas{width:100%;height:auto;border:1px solid var(--rule);background:var(--paper-deep)}

/* ==========================================================
   ENVIRONMENT · PHYSICS · the spectroscopy bench
   emission bands, dark instrument panels, wavelength sliders
   ========================================================== */
.env-physics{
  background-image:
    linear-gradient(to right,transparent 0,transparent 100%),
    /* sodium D doublet and hydrogen Balmer lines, at real positions */
    linear-gradient(to right,
      transparent 0%,transparent 20.4%,rgba(138,90,43,.14) 20.4%,rgba(138,90,43,.14) 20.9%,
      transparent 20.9%,transparent 32.1%,rgba(138,90,43,.11) 32.1%,rgba(138,90,43,.11) 32.5%,
      transparent 32.5%,transparent 46.7%,rgba(138,90,43,.13) 46.7%,rgba(138,90,43,.13) 47.2%,
      transparent 47.2%,transparent 58.3%,rgba(138,90,43,.16) 58.3%,rgba(138,90,43,.16) 58.9%,
      transparent 58.9%,transparent 59.3%,rgba(138,90,43,.16) 59.3%,rgba(138,90,43,.16) 59.8%,
      transparent 59.8%,transparent 76.4%,rgba(138,90,43,.10) 76.4%,rgba(138,90,43,.10) 76.8%,
      transparent 76.8%,transparent 100%);
}
.env-physics h2,.env-physics h3{color:var(--ink)}

.spectral-panel{
  background:var(--dark);
  border:1px solid #2E2C3A;
  padding:1.5rem;
  color:var(--dark-soft);
}
.spectral-panel canvas{width:100%;height:auto;display:block}

.wl-label{
  display:block;font-family:var(--f-mono);font-size:.68rem;
  letter-spacing:.1em;text-transform:uppercase;color:var(--dark-soft);
  margin:1.2rem 0 .4rem;
}
/* 44px tall, because 20px of track and a 12px thumb is not something a thumb
   can hit. The bar reads as a heavier instrument at this size, which suits a
   dark panel better anyway. */
.wl-slider{
  width:100%;-webkit-appearance:none;appearance:none;height:44px;
  background:linear-gradient(to right,
    #000 0%,#4B0082 8%,#3F2AC4 16%,#2E6FE0 25%,
    #35C4C4 36%,#4FD14F 46%,#E4E44A 58%,#E88A2E 70%,
    #C0392B 80%,#5A1E18 90%,#000 100%);
  border:1px solid #3A3746;outline-offset:3px;box-sizing:border-box;
}
.wl-slider.plain{background:linear-gradient(to right,#2A2838,#5F5B72)}
.wl-slider::-webkit-slider-thumb{
  -webkit-appearance:none;width:16px;height:52px;
  background:#F3F1F7;border:1px solid #16151C;cursor:pointer;
}
.wl-slider::-moz-range-thumb{
  width:16px;height:52px;background:#F3F1F7;border:1px solid #16151C;cursor:pointer;
  border-radius:0;
}

.tele-dark{
  margin-top:1.2rem;font-family:var(--f-mono);font-size:.78rem;
  border-top:1px solid #33303F;padding-top:.7rem;
}
.tele-dark .tel-row{
  display:flex;justify-content:space-between;gap:1rem;
  padding:.18rem 0;color:var(--dark-soft);
}
/* display:flex above beats the browser's own rule for the hidden attribute,
   which left a row on screen that was meant to be gone. */
.tele-dark .tel-row[hidden]{display:none}
.tele-dark .tel-row b{color:#F1EFF5;font-weight:500}

/* energy levels */
.levels{margin-top:1.6rem;font-family:var(--f-mono);font-size:.74rem}
.lev-label{margin:0;color:var(--dark-soft);letter-spacing:.06em}
.lev-cb{border-top:2px solid var(--brand-lift);padding-top:.3rem}
.lev-vb{border-bottom:2px solid #D89A7F;padding-bottom:.3rem}
.lev-gap{
  height:78px;position:relative;margin:.4rem 0;
  border-left:1px dashed #4A4757;
}
.lev-arrow{
  position:absolute;left:26px;bottom:0;width:3px;background:var(--butter);
  transition:height .15s ease;
}
@media(prefers-reduced-motion:reduce){.lev-arrow{transition:none}}
.lev-gap-txt{position:absolute;left:44px;top:50%;transform:translateY(-50%);color:var(--butter)}

.mat-list{
  margin-top:1.3rem;display:flex;flex-wrap:wrap;gap:.4rem;
  font-family:var(--f-mono);font-size:.7rem;
}
.mat-chip{
  border:1px solid #3A3746;padding:.24rem .6rem;color:var(--dark-soft);
}
.mat-chip.on{border-color:var(--butter);color:var(--butter)}

/* ---------- a slider you can actually hit with a thumb ----------
   A range input is 20px of target and a thumb is 12px wide. Neither is
   reachable on a phone, so the slider gets a 44px row of its own and a pair
   of steppers beside it for setting a value exactly rather than aiming. */
.slider-row{display:flex;align-items:center;gap:.6rem}
.slider-row .wl-slider{flex:1 1 auto;min-width:0}
.stepper{display:flex;gap:.4rem;flex-shrink:0}
.stepper button{
  min-width:44px;min-height:44px;
  background:none;border:1px solid #4A4757;color:#F1EFF5;
  font-family:var(--f-mono);font-size:1rem;line-height:1;cursor:pointer;
}
.stepper button:hover{border-color:var(--butter);color:var(--butter)}

.panel-note{
  margin:1rem 0 0;font-size:.9rem;line-height:1.55;color:var(--dark-soft);
  max-width:60ch;
}
.handoff{
  margin:1rem 0 0;padding:.7rem .9rem;border-left:3px solid var(--brand-lift);
  background:rgba(127,168,216,0.08);
  font-family:var(--f-mono);font-size:.74rem;line-height:1.6;color:#CFE0F2;
  max-width:66ch;
}
.spectral-panel .btn-quiet{margin-top:1.1rem;min-height:44px}

/* ---------- show the working ---------- */
.working{margin:1.1rem 0 0;border-top:1px solid var(--rule);padding-top:.6rem}
.working>summary{
  font-family:var(--f-mono);font-size:.72rem;letter-spacing:.08em;
  text-transform:uppercase;color:var(--ink-soft);cursor:pointer;
  padding:.7rem 0;min-height:44px;display:flex;align-items:center;
}
.working>summary:hover{color:var(--brand)}
.assume-title{
  font-family:var(--f-mono);font-size:.66rem;letter-spacing:.11em;
  color:var(--ink-soft);margin:.9rem 0 .35rem;
}
.working .code{
  background:var(--dark);color:#D8D4E2;padding:1rem;overflow-x:auto;
  font-family:var(--f-mono);font-size:.72rem;line-height:1.65;margin:0;
}
.working .assumptions{margin:0;padding-left:1.1rem;font-size:.92rem;max-width:62ch}
.working .assumptions li{margin:.4rem 0}

/* ==========================================================
   ENVIRONMENT · SOLAR LAB · instrument housings and telemetry
   ========================================================== */
.env-lab{
  background:var(--paper-cool);
  background-image:
    radial-gradient(circle at 12px 12px,rgba(53,87,183,.13) 1.4px,transparent 1.4px),
    radial-gradient(circle at 36px 33px,rgba(53,87,183,.13) 1.4px,transparent 1.4px);
  background-size:48px 42px,48px 42px;
}

.viewport{
  position:relative;background:var(--paper-deep);
  border:1px solid var(--rule);padding:1.2rem;
  min-height:300px;
}
.viewport.small{min-height:auto;padding:.8rem}
.brackets i{
  position:absolute;width:14px;height:14px;border:2px solid var(--brand);
}
.brackets i:nth-child(1){top:6px;left:6px;border-right:0;border-bottom:0}
.brackets i:nth-child(2){top:6px;right:6px;border-left:0;border-bottom:0}
.brackets i:nth-child(3){bottom:6px;left:6px;border-right:0;border-top:0}
.brackets i:nth-child(4){bottom:6px;right:6px;border-left:0;border-top:0}

.run-id{
  font-family:var(--f-mono);font-size:.64rem;letter-spacing:.1em;
  color:var(--ink-soft);margin:.7rem 0 0;text-align:right;
}

#crystal-canvas{width:100%;height:390px;cursor:grab}
#crystal-canvas:active{cursor:grabbing}
#cell-canvas{width:100%;height:260px;cursor:grab}
#cell-canvas canvas,#crystal-canvas canvas{display:block;width:100%!important;height:100%!important}

.crystal-wrap{display:grid;gap:1.6rem}
@media(min-width:840px){.crystal-wrap{grid-template-columns:1fr 270px}}

.telemetry{font-family:var(--f-mono);font-size:.78rem}
.tel-row{
  display:flex;justify-content:space-between;gap:.8rem;
  padding:.32rem 0;border-bottom:1px solid var(--rule);
}
.tel-row span{color:var(--ink-soft);letter-spacing:.05em;font-size:.7rem}
.tel-row b{font-weight:500}
.tel-row.big{padding:.55rem 0}
.tel-row.big b{font-size:1.5rem;font-family:var(--f-display)}
.tel-controls{margin-top:1rem}
.tel-alt{position:absolute;left:-9999px}
.tel-label{
  display:block;font-family:var(--f-mono);font-size:.66rem;
  letter-spacing:.08em;color:var(--ink-soft);margin:.9rem 0 .25rem;
  text-transform:uppercase;
}
.telemetry input[type=range]{width:100%;height:44px}

.lab-grid{display:grid;gap:1.5rem}
@media(min-width:840px){.lab-grid{grid-template-columns:1fr 230px}}
.lab-grid canvas{width:100%;height:auto;display:block}

.crystal-note{margin-top:2rem;max-width:64ch}
.crystal-punch{
  border-left:3px solid var(--brand);padding-left:1rem;
  font-size:1.05rem;
}

.cell-btns{display:flex;flex-direction:column;gap:.4rem;margin-top:1rem}

/* ---------- the plan ---------- */
.plan-legend{
  display:flex;flex-wrap:wrap;gap:.8rem;align-items:center;
  margin-bottom:2rem;
}
.legend-hint{font-size:.86rem;color:var(--ink-soft);max-width:44ch}

.phase{
  border-top:1px solid var(--rule);
  padding:1.1rem 0;
}
.phase-head{
  width:100%;background:none;border:0;padding:0;cursor:pointer;
  display:flex;align-items:baseline;gap:1rem;text-align:left;
  font-family:inherit;color:inherit;
  /* A revised estimate makes .phase-w twice its usual width, and a long title
     plus that no longer fits on one line at 320. Let the duration drop to its
     own line rather than push the page sideways. */
  flex-wrap:wrap;
}
.phase-n{
  font-family:var(--f-mono);font-size:.72rem;color:var(--ink-soft);
  letter-spacing:.1em;flex-shrink:0;
}
.phase-t{
  font-family:var(--f-display);font-weight:600;font-size:1.14rem;
  flex:1;line-height:1.3;
}
.phase-w{font-family:var(--f-mono);font-size:.72rem;color:var(--ink-soft);flex-shrink:0}
.phase-w del{color:var(--correction);text-decoration-color:var(--correction)}
.phase-body{padding:1rem 0 .3rem}
@media(min-width:900px){.phase-body{padding-left:5.6rem}}

.phase-why{color:var(--ink-soft);font-size:.95rem;max-width:60ch}
.phase-why.new{border-left:2px solid var(--correction);padding-left:.8rem}

.item{display:flex;gap:.7rem;align-items:flex-start;padding:.3rem 0;max-width:64ch}
.item input{margin-top:.45rem;flex-shrink:0;accent-color:var(--brand);width:16px;height:16px}
.item label{cursor:pointer;font-size:.98rem;line-height:1.55}
.item.done label{color:var(--ink-soft)}

.output-box{
  margin-top:1rem;border:1px solid var(--rule);background:var(--paper-deep);
  padding:.8rem 1rem;max-width:60ch;
}
.output-box p{margin:0;font-size:.92rem}
.output-lab{
  font-family:var(--f-mono);font-size:.66rem;letter-spacing:.1em;
  color:var(--brand);text-transform:uppercase;display:block;margin-bottom:.25rem;
}

.difficulty{margin-top:1rem;max-width:60ch}
.diff-lab{
  font-family:var(--f-mono);font-size:.66rem;letter-spacing:.1em;
  color:var(--ink-soft);text-transform:uppercase;display:block;margin-bottom:.4rem;
}
.diff-opts{display:flex;flex-direction:column;gap:.25rem}
.diff-opts button{
  background:none;border:1px solid var(--rule);text-align:left;
  font-family:var(--f-hand);font-size:1.08rem;color:var(--aside);
  padding:.3rem .7rem;cursor:pointer;
}
.diff-opts button[aria-pressed=true]{border-color:var(--brand);color:var(--brand)}

.hours{margin-top:1rem;display:flex;gap:.6rem;align-items:center;flex-wrap:wrap}
.hours input{width:70px;font-family:var(--f-mono);padding:.3rem}
.hours label{font-family:var(--f-mono);font-size:.68rem;letter-spacing:.08em;color:var(--ink-soft)}

/* ---------- visualisations ---------- */
.viz{margin:2.6rem 0 3.4rem;border-top:1px solid var(--rule);padding-top:1.4rem}
.viz-lead{color:var(--ink-soft);max-width:60ch;font-size:.98rem}
.viz-cap{
  font-family:var(--f-mono);font-size:.66rem;letter-spacing:.07em;
  color:var(--ink-soft);margin-top:1rem;
}
.env-physics .viz-cap{color:var(--ink-soft)}

.predict{
  border:1px dashed var(--rule);padding:1rem 1.1rem;margin:1.2rem 0;
  max-width:56ch;background:color-mix(in srgb,var(--paper-deep) 60%,transparent);
}
.predict-q{font-family:var(--f-hand);font-size:1.2rem;color:var(--aside);margin:0 0 .6rem;max-width:none}
.predict-opts{display:flex;flex-direction:column;gap:.35rem}
.predict-opts button{
  background:none;border:1px solid var(--rule);padding:.4rem .8rem;
  font-family:inherit;font-size:.93rem;text-align:left;cursor:pointer;color:var(--ink);
}
.predict-opts button:hover{border-color:var(--brand)}
.predict-result{margin:.8rem 0 0;font-size:.95rem}
.predict-result.right{color:var(--brand)}
.predict-result.wrong{color:var(--correction)}

.annotation{
  margin-top:1.2rem;border-left:3px solid var(--butter);
  padding-left:1rem;max-width:62ch;
}
.annotation p{margin:0;font-size:.97rem}

/* ---------- before after later ---------- */
.baf{border-top:1px solid var(--rule);padding:1.4rem 0}
.baf h3{margin-bottom:1rem}
.baf-cols{display:grid;gap:1.2rem}
@media(min-width:820px){.baf-cols{grid-template-columns:repeat(3,1fr)}}
.baf-col h4{
  font-family:var(--f-mono);font-size:.66rem;letter-spacing:.1em;
  text-transform:uppercase;color:var(--ink-soft);margin:0 0 .45rem;
}
.baf-col p{font-size:.95rem;margin:0}
.baf-col.before p{font-family:var(--f-hand);font-size:1.14rem;color:var(--aside);line-height:1.45}
.baf-col.later{border-left:2px solid var(--rule);padding-left:.9rem}
.baf-empty{color:var(--ink-soft);font-style:italic;font-size:.92rem}

/* ---------- papers ---------- */
.paper{border-top:1px solid var(--rule);padding:1.2rem 0;max-width:66ch}
.paper h3{font-size:1.05rem;margin-bottom:.2rem}
.paper-doi{font-family:var(--f-mono);font-size:.7rem;color:var(--ink-soft);margin:0 0 .8rem}
.pf{margin:0 0 .7rem}
.pf-q{
  display:block;font-family:var(--f-mono);font-size:.65rem;letter-spacing:.09em;
  text-transform:uppercase;color:var(--ink-soft);margin-bottom:.15rem;
}
.pf.key{border-left:3px solid var(--brand);padding-left:.9rem}
.pf.key .pf-q{color:var(--brand)}

.adder{margin-top:1.6rem;max-width:60ch}
.adder summary{
  cursor:pointer;font-family:var(--f-mono);font-size:.76rem;
  letter-spacing:.06em;color:var(--brand);
}
.adder-body{margin-top:1rem;display:flex;flex-direction:column;gap:.2rem}
.adder-body label{
  font-family:var(--f-mono);font-size:.66rem;letter-spacing:.08em;
  color:var(--ink-soft);margin-top:.7rem;text-transform:uppercase;
}
.adder-body input,.adder-body textarea{
  font-family:var(--f-body);font-size:.95rem;padding:.45rem .6rem;
  border:1px solid var(--rule);background:var(--paper);color:var(--ink);width:100%;
}
.field-hint{font-size:.86rem;color:var(--ink-soft);margin:.5rem 0 .8rem}

/* ---------- writing tool ---------- */
.wblock{border-top:1px solid var(--rule);padding:1.1rem 0;max-width:66ch}
.wblock h3{font-size:1.02rem}
.wblock textarea{
  width:100%;font-family:var(--f-body);font-size:.98rem;line-height:1.6;
  padding:.7rem .8rem;border:1px solid var(--rule);background:var(--paper);color:var(--ink);
}
.wprompt{font-size:.9rem;color:var(--ink-soft);margin:.2rem 0 .5rem}
.wq{
  margin-top:.7rem;border-left:3px solid var(--correction);padding-left:.9rem;
}
.wq p{
  font-family:var(--f-hand);font-size:1.14rem;color:var(--correction);
  margin:0 0 .2rem;line-height:1.4;
}
.writer-actions{display:flex;gap:.8rem;flex-wrap:wrap;margin-top:1.6rem}
.writer-out{
  margin-top:1.4rem;border:1px solid var(--rule);background:var(--paper-deep);
  padding:1rem;font-family:var(--f-mono);font-size:.82rem;white-space:pre-wrap;
  max-height:340px;overflow:auto;
}

/* ---------- letters ---------- */
.letter{
  border:1px solid var(--rule);background:var(--paper-deep);
  padding:1rem 1.2rem;margin-bottom:.9rem;max-width:58ch;
}
.letter-meta{
  font-family:var(--f-mono);font-size:.66rem;letter-spacing:.09em;
  color:var(--ink-soft);margin:0 0 .3rem;text-transform:uppercase;
}
.letter.sealed{border-style:dashed}
.letter.sealed p.letter-body{color:var(--ink-soft);font-style:italic;margin:0}
.letter-body{margin:0;font-family:var(--f-hand);font-size:1.2rem;color:var(--aside);line-height:1.5}

/* ---------- achievements ---------- */
.streak-block{max-width:26rem;margin-bottom:2rem}
.streak-note{font-size:.9rem;color:var(--ink-soft);margin-top:.7rem}
#ach-list{display:grid;gap:.55rem}
@media(min-width:700px){#ach-list{grid-template-columns:1fr 1fr}}
.ach{
  border:1px solid var(--rule);padding:.55rem .85rem;
  font-size:.93rem;display:flex;gap:.6rem;align-items:baseline;
}
.ach.locked{opacity:.42}
.ach-mark{font-family:var(--f-mono);font-size:.72rem;color:var(--brand);flex-shrink:0}
.ach.locked .ach-mark{color:var(--ink-soft)}
.ach.honest{border-color:var(--aside)}
.ach.honest .ach-mark{color:var(--aside)}

/* ---------- data ---------- */
.data-actions{display:flex;gap:.8rem;flex-wrap:wrap;align-items:center}
.file-in{position:relative;overflow:hidden;display:inline-block}
.file-in input{position:absolute;left:-9999px}
.data-msg{margin-top:.9rem;font-size:.92rem;color:var(--brand);min-height:1.4rem}

/* ---------- buttons ---------- */
.btn,.btn-quiet{
  font-family:var(--f-mono);font-size:.76rem;letter-spacing:.06em;
  padding:.5rem 1rem;cursor:pointer;border:1px solid var(--brand);
}
.btn{background:var(--brand);color:var(--on-brand)}
.btn-quiet{background:none;color:var(--brand)}
.btn:hover,.btn-quiet:hover{background:var(--brand);color:var(--on-brand)}
.spectral-panel .btn-quiet{border-color:var(--brand-lift);color:var(--brand-lift)}

:focus-visible{outline:2px solid var(--brand);outline-offset:3px}
.spectral-panel :focus-visible{outline-color:var(--butter)}

/* ---------- footer ---------- */
.foot{
  max-width:1180px;margin:3rem auto 0;padding:2.5rem 1.25rem 3.5rem;
  border-top:1px solid var(--rule);
}
@media(min-width:900px){.foot{padding-left:5.5rem}}
.foot-line{font-size:1.06rem;max-width:52ch}
.foot-meta{
  font-family:var(--f-mono);font-size:.68rem;letter-spacing:.1em;
  color:var(--ink-soft);margin:0;
}

.fallback{font-size:.93rem;color:var(--ink-soft);max-width:52ch}

/* ---------- reduced motion ---------- */
@media(prefers-reduced-motion:reduce){
  *{animation:none!important;transition:none!important}
}


/* ---------- session log ---------- */
.hours{display:grid;gap:.4rem;grid-template-columns:1fr;align-items:end}
@media(min-width:620px){.hours{grid-template-columns:auto 1fr auto;gap:.6rem}}
.hours .note-in{
  font-family:var(--f-body);font-size:.95rem;padding:.35rem .55rem;
  border:1px solid var(--rule);background:var(--paper);color:var(--ink);width:100%;
}
.hours-total{
  font-family:var(--f-mono);font-size:.7rem;letter-spacing:.05em;
  color:var(--ink-soft);margin:.6rem 0 0;
}
.sessions{margin-top:.9rem;border-left:2px solid var(--rule);padding-left:.9rem;max-width:56ch}
.session{margin:0 0 .3rem;font-size:.93rem}
.session-d{
  font-family:var(--f-mono);font-size:.66rem;letter-spacing:.06em;
  color:var(--ink-soft);margin-right:.7rem;
}

/* ---------- defect tooltip ---------- */
.defect-tip{
  position:absolute;z-index:5;pointer-events:none;margin:0;
  background:var(--ink);color:var(--paper);
  font-family:var(--f-mono);font-size:.68rem;line-height:1.4;
  padding:.35rem .6rem;max-width:20rem;
}

/* ---------- letters ---------- */
.letter textarea{
  width:100%;font-family:var(--f-hand);font-size:1.18rem;color:var(--aside);
  line-height:1.5;padding:.6rem .7rem;border:1px solid var(--rule);
  background:var(--paper);margin-bottom:.6rem;
}

/* ==========================================================
   TOUCH TARGETS
   Nothing you are meant to press is allowed to be smaller than
   44px in its short direction. Some of the audience for this page
   is reading it on a phone, one handed, and a 33px button is a
   button you miss.
   ========================================================== */
.btn,.btn-quiet{
  min-height:44px;display:inline-flex;align-items:center;justify-content:center;
}
.predict-opts button{min-height:44px;text-align:left}
.phase-head{min-height:44px}
summary{min-height:44px;display:flex;align-items:center;gap:.5rem}
summary::marker{content:''}
summary::-webkit-details-marker{display:none}
summary::before{content:'+';font-family:var(--f-mono);opacity:.65}
details[open]>summary::before{content:'\2212'}

/* ---------- telemetry, two owners kept apart ---------- */
.tel-group{
  font-family:var(--f-mono);font-size:.62rem;letter-spacing:.13em;
  color:var(--ink-soft);margin:1rem 0 .2rem;
  border-bottom:1px solid var(--rule);padding-bottom:.25rem;
}
.tel-group:first-child{margin-top:0}
.status-age{color:var(--correction);display:inline}

/* The top bar was the last thing under 44px. Six links stacked at 44px each
   would eat a third of a phone screen in sticky header, so on a narrow
   screen the row keeps its height and scrolls sideways instead. The page
   itself still does not overflow. */
.skip{padding:.85rem 1rem}
.topbar-nav a{
  min-height:44px;display:inline-flex;align-items:center;
}
@media(max-width:40rem){
  .topbar-in{gap:.6rem}
  .topbar-nav{
    flex-wrap:nowrap;overflow-x:auto;white-space:nowrap;
    scrollbar-width:none;-webkit-overflow-scrolling:touch;
  }
  .topbar-nav::-webkit-scrollbar{display:none}
}

/* Which unit cell is showing, said by the button and not only by the
   readout. Shape as well as colour: the pressed one gains a filled edge. */
[data-cell][aria-pressed="true"]{
  border-color:var(--brand);background:var(--brand);color:var(--on-brand);
}

/* ---------- three depths ----------
   Same class names as the notebook, so there is one idea and not two. */
html[data-depth="picture"] .depth-not-picture{display:none}
html:not([data-depth="maths"]) .depth-only-maths{display:none}

.depth{display:flex;gap:.4rem;flex-wrap:wrap;margin:1rem 0 .4rem}
.depth-btn{
  min-height:44px;padding:.5rem .9rem;
  font-family:var(--f-mono);font-size:.72rem;letter-spacing:.05em;
  background:none;border:1px solid var(--rule);color:var(--ink-soft);
  cursor:pointer;
}
.depth-btn:hover{border-color:var(--brand);color:var(--brand)}
.depth-btn[aria-pressed="true"]{
  border-color:var(--brand);background:var(--brand);color:var(--on-brand);
}

/* the crystal is draggable and now focusable, so it says so */
.crystal-how{
  font-family:var(--f-mono);font-size:.72rem;letter-spacing:.05em;
  color:var(--ink-soft);margin:0 0 .6rem;
}
#crystal-canvas:focus-visible,#cell-canvas:focus-visible{
  outline:2px solid var(--brand);outline-offset:3px;
}

/* ==========================================================
   PRINT

   This page had no print rules at all, so printing it gave dark
   instrument panels as solid blocks of toner and every control
   that cannot be pressed on paper. Same treatment as the notebook.
   ========================================================== */
@media print{
  body{background:#fff;color:#000;font-size:10.5pt;line-height:1.45}
  body::before{display:none}                 /* the ruling */
  section{padding:0 0 1.5rem;max-width:none}
  section::before{display:none}

  /* nothing you can press on paper */
  .topbar,.skip,.plan-legend,.tel-controls,.data-actions,.predict-opts,
  .wprompt,.letter textarea,.btn,.btn-quiet,.stepper,.slider-row,
  input[type=range],.cell-btns,.depth,.working>summary{display:none !important}

  /* an interactive becomes its prose and its caption, which is the same
     fallback the noscript reader already gets */
  canvas{display:none !important}
  .viewport,.spectral-panel canvas{display:none !important}
  noscript{display:block}
  .fallback{display:block !important;border-left:2px solid #999;padding-left:.8rem}
  .viz-cap{font-size:9pt;color:#333}

  /* dark panels invert rather than printing as a slab */
  .spectral-panel,.tele-dark,.working .code{
    background:#fff !important;color:#000 !important;border-color:#999 !important;
  }
  .spectral-panel *,.tele-dark *,.working .code *{color:#000 !important}

  /* the working stays open on paper, because that is the part worth reading */
  .working{border-top:1px solid #999}
  .working[open],.working{display:block}
  .working>*:not(summary){display:block !important}
  details>summary{display:none}
  details>*:not(summary){display:block !important}

  /* a link on paper says where it goes */
  a[href^="http"]::after,a[href^="mailto"]::after{
    content:" (" attr(href) ")";font-family:var(--f-mono);font-size:8.5pt;word-break:break-all;
  }
  a[href^="#"]::after{content:""}

  h2,h3{page-break-after:avoid;break-after:avoid}
  .viz{page-break-inside:auto;break-inside:auto}
  figure{page-break-inside:avoid;break-inside:avoid}
}
