/* ==========================================================================
   Premise — the essay on paper, then the argument as six constraints,
   each drawn in the vernacular of its own physics.
   ========================================================================== */

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- head ---------- */
.pm-head {
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--head) + clamp(4rem, 10vw, 8rem));
  padding-bottom: clamp(3.5rem, 8vw, 6.5rem);
  background:
    radial-gradient(70% 70% at 12% 0%, rgba(47, 116, 128, 0.2), transparent 60%),
    var(--night);
}
/* ice falling through the head: the premise in one texture */
.pm-head::before {
  content: "";
  position: absolute;
  inset: -40% 0 0 0;
  background-image:
    radial-gradient(1.2px 1.2px at 20% 30%, rgba(216, 241, 245, 0.55), transparent 60%),
    radial-gradient(1px 1px at 70% 10%, rgba(216, 241, 245, 0.45), transparent 60%),
    radial-gradient(1.4px 1.4px at 45% 70%, rgba(216, 241, 245, 0.4), transparent 60%),
    radial-gradient(1px 1px at 85% 55%, rgba(216, 241, 245, 0.5), transparent 60%),
    radial-gradient(1.1px 1.1px at 8% 85%, rgba(216, 241, 245, 0.35), transparent 60%);
  background-size: 190px 190px, 260px 260px, 330px 330px, 210px 210px, 280px 280px;
  animation: specks 26s linear infinite;
  pointer-events: none;
  opacity: 0.8;
}
@keyframes specks { to { transform: translateY(40%); } }
.pm-head-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 3rem clamp(2rem, 6vw, 6rem);
  align-items: end;
}
.pm-kicker { color: var(--signal); }
.pm-title { font-size: var(--t-xxl); font-weight: 200; margin-top: 1.25rem; }
.pm-deck { margin-top: 1.5rem; color: var(--mist); max-width: 26rem; }
.pm-chain-label { color: var(--haze); margin-bottom: 0.9rem; }
.pm-chain ol { border-top: 1px solid rgba(143, 195, 198, 0.2); }
.pm-chain li { border-bottom: 1px solid rgba(143, 195, 198, 0.2); }
.pm-chain a {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: baseline;
  padding: 0.72rem 0;
  text-decoration: none;
  color: var(--salt);
  transition: padding 0.25s var(--ease);
}
.pm-chain a:hover { padding-left: 0.4rem; }
.pm-chain-n { font-family: var(--f-mono); font-size: var(--t-xxs); color: var(--haze); }
.pm-chain-name { font-size: 1.05rem; }
.pm-chain-val { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--signal); text-align: right; }
@media (max-width: 56rem) {
  .pm-head-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- the short version: the author's essay on paper ---------- */
.essay { background: var(--paper); color: var(--ink); padding-block: clamp(4.5rem, 10vw, 8rem); }
.essay-grid { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); gap: 2.5rem clamp(2rem, 4vw, 4rem); }
.essay-head .label { color: var(--ink-3); }
.essay-title { font-size: var(--t-l); font-weight: 300; margin-top: 0.8rem; }
.essay-head .essay-by { margin-top: 1.1rem; color: var(--stamp); }
.essay-body { display: grid; gap: 1.25rem; font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.3rem); line-height: 1.62; }
.ep {
  display: grid;
  grid-template-columns: minmax(0, 36rem) minmax(0, 14rem);
  column-gap: clamp(2rem, 3.5vw, 3.5rem);
  align-items: start;
}
.ep > p { grid-column: 1; text-wrap: pretty; }
.essay-open::first-letter {
  font-family: var(--f-display);
  font-weight: 250;
  float: left;
  font-size: 4.9em;
  line-height: 0.76;
  margin: 0.07em 0.09em 0 -0.03em;
}
.sn-ref {
  font-family: var(--f-mono);
  font-size: 0.58em;
  font-weight: 600;
  color: var(--stamp);
  text-decoration: none;
  vertical-align: super;
  line-height: 0;
  padding: 0 0.12em;
  margin-left: 0.08em;
}
.sn {
  grid-column: 2;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-2);
  border-top: 1px solid rgba(11, 24, 32, 0.28);
  padding-top: 0.45rem;
  margin-top: 0.35rem;
}
.sn-n { font-family: var(--f-mono); font-size: 0.7rem; font-weight: 600; color: var(--stamp); margin-right: 0.55rem; }
.sn a {
  display: inline-block;
  margin-top: 0.3rem;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}
@media (max-width: 84rem) {
  .essay-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 60rem) {
  .ep { grid-template-columns: minmax(0, 38rem); }
  .sn { grid-column: 1; margin: 0.9rem 0 0.4rem 1.25rem; max-width: 30rem; }
}

/* ---------- the long version ---------- */
.long { background: var(--night); }
.long-intro { padding-top: clamp(5rem, 11vw, 9rem); padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.long-kicker { color: var(--signal); }
.long-title { font-size: var(--t-xl); font-weight: 250; margin-top: 1rem; max-width: 12ch; }
.long-lede { color: var(--mist); margin-top: 1.5rem; max-width: 34rem; }

.c { padding-block: clamp(4rem, 9vw, 7.5rem); border-top: 1px solid rgba(143, 195, 198, 0.12); }
.c-water { background: var(--night); }
.c-source { background: var(--deep); }
.c-energy { background: #03080b; }
.c-form { background: var(--night); }
.c-setpoint { background: linear-gradient(180deg, #02070a 0%, #06121a 42%, #0c2531 100%); }
.c-ozone { background: var(--deep); }

.c-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem clamp(2rem, 6vw, 6rem);
  align-items: end;
}
.c-grid--flip .c-head { order: 2; }
.c-step { color: var(--haze); }
.c-title { font-size: var(--t-l); font-weight: 300; margin-top: 0.75rem; }
.c-big {
  font-family: var(--f-display);
  font-weight: 200;
  font-size: var(--t-xl);
  line-height: 0.95;
  color: var(--signal);
  margin-top: 0.9rem;
  white-space: nowrap;
}
.c-big--words { font-size: var(--t-l); white-space: normal; line-height: 1; }
.c-text { color: var(--mist); }
.c-text strong { color: var(--salt); font-weight: 500; }
.c-fig { margin-top: clamp(2.5rem, 5vw, 4.5rem); }
.c-fig > svg { width: 100%; height: auto; overflow: visible; }
.c-fig > .fig-spheres { overflow: hidden; }
.fig-tall { display: none; }
@media (max-width: 62rem) {
  .c-grid { grid-template-columns: minmax(0, 1fr); }
  .c-grid--flip .c-head { order: 0; }
  .fig-wide { display: none; }
  .c-fig > .fig-tall { display: block; max-width: 34rem; margin-inline: auto; }
}

/* svg type — sizes are in each figure's own units */
.svg-label { font-family: var(--f-mono); font-size: 15px; font-weight: 500; letter-spacing: 0.12em; fill: var(--salt); }
.svg-label--signal { fill: var(--signal); }
.svg-sub { font-family: var(--f-mono); font-size: 14px; fill: var(--mist); }
.svg-note { font-family: var(--f-text); font-style: italic; font-size: 19px; fill: var(--mist); }
.svg-axis { stroke: rgba(143, 195, 198, 0.35); stroke-width: 1; }
.svg-zero { stroke: #7d959c; stroke-width: 1.5; }
.svg-tick { stroke: rgba(143, 195, 198, 0.5); stroke-width: 1; }
.svg-row { font-family: var(--f-mono); font-size: 15px; fill: var(--mist); }
.svg-row--strong { fill: var(--salt); font-weight: 500; }
.svg-val { font-family: var(--f-mono); font-size: 16px; font-weight: 500; fill: var(--salt); }
.svg-val--strong { font-size: 22px; }
.svg-legend text { font-family: var(--f-mono); font-size: 14px; fill: var(--mist); }
.fig-tall .svg-label { font-size: 22px; }
.fig-tall .svg-sub { font-size: 20px; }
.fig-tall .svg-note { font-size: 24px; }
.fig-tall .svg-row { font-size: 21px; }
.fig-tall .svg-val { font-size: 22px; }
.fig-tall .svg-val--strong { font-size: 28px; }
.fig-tall .svg-legend text { font-size: 20px; }
.bar path { transition: opacity 0.2s; }
.bar:hover path { opacity: 0.8; }

/* ---------- 3: the two planets ---------- */
.planets {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr) minmax(0, 1fr);
  gap: 2.5rem 2rem;
  align-items: start;
}
.planet { width: min(100%, 21rem); height: auto; margin-inline: auto; overflow: visible; }
.planet-cap { text-align: center; margin-top: 0.25rem; display: grid; gap: 0.4rem; }
.planet-k { color: var(--haze); }
.planet-v { color: var(--salt); }
.planet-v .num { color: var(--signal); margin-right: 0.35rem; }
.planet-end { font-style: italic; color: var(--mist); margin-top: 0.35rem; }
.planet-sum {
  align-self: center;
  display: grid;
  gap: 1.1rem;
  padding-block: 1rem;
}
.planet-sum p { display: grid; gap: 0.2rem; }
.planet-sum .num { font-size: 1.15rem; color: var(--salt); }
.planet-sum p > span:last-child:not(.num) { font-family: var(--f-mono); font-size: var(--t-xs); letter-spacing: 0.03em; color: var(--mist); }
.planet-sum-total { border-top: 1px solid rgba(242, 169, 59, 0.45); padding-top: 1rem; }
.planet-sum-total .num { color: var(--signal); font-size: 1.45rem; }
.planet-sum-note { font-style: italic; color: var(--mist); font-size: 1rem; line-height: 1.5; }
@media (max-width: 62rem) {
  .planets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planet-sum { grid-column: 1 / -1; order: 3; max-width: 30rem; }
}
@media (max-width: 36rem) {
  .planets { grid-template-columns: minmax(0, 1fr); }
}

.therefore {
  margin-top: clamp(3rem, 6vw, 5rem);
  display: grid;
  grid-template-columns: minmax(0, 10rem) minmax(0, 1fr);
  gap: 1rem 3rem;
  border-top: 1px solid var(--signal);
  padding-top: 1.6rem;
}
.therefore-k { color: var(--signal); padding-top: 0.5rem; }
.therefore-text { grid-column: 2; font-family: var(--f-display); font-weight: 300; font-size: var(--t-l); line-height: 1.04; text-wrap: balance; }
.therefore-fine { grid-column: 2; color: var(--mist); max-width: 40rem; }
@media (max-width: 44rem) {
  .therefore { grid-template-columns: minmax(0, 1fr); }
  .therefore-text, .therefore-fine { grid-column: 1; }
}

/* ---------- 4: the ledger chart ---------- */
.ledger-fig > svg.fig-wide { max-width: 62rem; margin-inline: auto; }
.ledger-fig .table-view { max-width: 62rem; margin-inline: auto; }

/* ---------- 5: the setpoint ---------- */
.setpoint-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 3rem clamp(2rem, 6vw, 6rem);
  align-items: start;
}
.setpoint-words { position: sticky; top: calc(var(--head) + 2.5rem); }
.setpoint-prose { margin-top: 2rem; color: var(--mist); }
.setpoint-eq {
  display: grid;
  gap: 0.3rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid rgba(242, 169, 59, 0.38);
  background: rgba(242, 169, 59, 0.05);
  color: var(--signal);
  font-size: var(--t-xs);
}
.setpoint-fig .fig-atmo { width: 100%; height: auto; }
.atmo-band { fill: rgba(143, 195, 198, 0.025); }
.atmo-band--alt { fill: rgba(143, 195, 198, 0.065); }
.atmo-layer { font-family: var(--f-mono); font-size: 13px; font-weight: 500; letter-spacing: 0.16em; fill: var(--haze); }
.atmo-curve { fill: none; stroke: var(--salt); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.atmo-release { stroke: var(--signal); stroke-width: 2; }
.atmo-release-label { font-family: var(--f-mono); font-size: 15px; font-weight: 600; letter-spacing: 0.14em; fill: var(--signal); }
.atmo-note { font-family: var(--f-mono); font-size: 14px; fill: var(--salt); }
.atmo-note--dim { fill: var(--haze); }
.atmo-note--heat { fill: #e8a07a; }
.atmo-note--cool { fill: #7cc6dc; }
.atmo-trap { stroke: #8fc3c6; stroke-width: 3; }
.atmo-rise { stroke: #8fc3c6; stroke-width: 1.4; fill: none; }
.ice-fall circle { fill: #d8f1f5; animation: icefall 4.6s linear infinite; }
@keyframes icefall {
  0% { transform: translateY(0); opacity: 0; }
  8% { opacity: 1; }
  78% { opacity: 0.85; }
  100% { transform: translateY(200px); opacity: 0; }
}
@media (max-width: 62rem) {
  .setpoint-grid { grid-template-columns: minmax(0, 1fr); }
  .setpoint-words { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .ice-fall circle { animation: none; opacity: 0.8; }
  .pm-head::before { animation: none; }
}

/* scroll containers for the diagrams that need their width */
.scroll-hint { display: none; font-family: var(--f-mono); font-size: var(--t-xxs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--haze); margin-bottom: 0.6rem; }
@media (max-width: 40rem) {
  .scroll-hint { display: block; }
  .fig-scroll { overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .fig-scroll > svg { min-width: 33rem; }
}

/* ---------- 6: ozone ---------- */
.hox {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 2rem clamp(2rem, 5vw, 5rem);
  align-items: center;
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.fig-hox { width: 100%; height: auto; }
.hox-node { fill: #0a1a23; stroke: var(--spray); stroke-width: 1.5; }
.hox-sp { font-family: var(--f-mono); font-size: 24px; font-weight: 500; fill: var(--salt); }
.hox-arc { fill: none; stroke: var(--salt); stroke-width: 1.5; }
.hox-in { fill: none; stroke: var(--mist); stroke-width: 1.2; }
.hox-eq { font-family: var(--f-mono); font-size: 18px; fill: var(--mist); }
.hox-eq--heat { fill: #e8a07a; }
.hox-note { font-family: var(--f-text); font-style: italic; font-size: 17px; fill: var(--haze); }
.hox-text { color: var(--mist); }
.hox-text strong { color: var(--salt); font-weight: 500; }
.hox-chem {
  display: grid;
  gap: 0.35rem;
  font-family: var(--f-mono);
  font-size: 0.95rem;
  color: var(--salt);
  padding: 1rem 1.25rem;
  border-left: 2px solid #d4703f;
  background: rgba(212, 112, 63, 0.07);
}
@media (max-width: 62rem) {
  .hox { grid-template-columns: minmax(0, 1fr); }
}

.duty { margin-top: clamp(3.5rem, 7vw, 6rem); }
.duty-k { color: var(--haze); margin-bottom: 1.25rem; }
.duty-rows { display: grid; gap: 0.9rem; }
.duty-row {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) 7.5rem;
  gap: 1rem;
  align-items: center;
}
.duty-name { color: var(--mist); }
.duty-track { position: relative; height: 18px; background: rgba(143, 195, 198, 0.07); }
.duty-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; }
.duty-fill--run { width: 100%; background: #35a3c4; }
.duty-fill--rated { width: 2px; border-radius: 0; background: var(--signal); box-shadow: 0 0 10px rgba(242, 169, 59, 0.8); }
.duty-val { color: var(--salt); font-size: var(--t-s); }
.duty-cap { display: grid; gap: 0.8rem; margin-top: 1.4rem; color: var(--mist); max-width: 46rem; }
@media (max-width: 30rem) {
  .duty-row { grid-template-columns: 3rem minmax(0, 1fr); }
  .duty-val { grid-column: 2; font-size: var(--t-xs); }
}

/* ---------- A. the original post: margin notes that mark revisions, and the reply ---------- */
@media (min-width: 84.01rem) {
  /* the essay is long now; its title stays in view beside it */
  .essay-head { position: sticky; top: calc(var(--head) + 2.5rem); align-self: start; }
}
.essay-note { margin-top: 1.4rem; max-width: 22rem; font-size: 0.9375rem; line-height: 1.5; font-style: italic; color: var(--ink-2); }
/* a paragraph spans the rows its margin notes stack in */
.ep > p { grid-row: 1 / span 3; }
.sn--rev { border-top-color: var(--stamp); }
.sn-rev { font-family: var(--f-mono); font-size: 0.625rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--stamp); margin-right: 0.45rem; }
.thread { display: grid; gap: 1.4rem; max-width: 36rem; margin-top: clamp(1.5rem, 3vw, 2.5rem); }
.thread-reader { background: var(--paper-2); border-left: 3px solid rgba(11, 24, 32, 0.3); padding: 1rem 1.2rem 1.1rem; font-size: 1.0625rem; line-height: 1.55; color: var(--ink-2); }
.thread-reader .label { color: var(--ink-3); margin-bottom: 0.45rem; }
.thread-reader p + p { font-style: italic; }
.thread-k { color: var(--stamp); padding-top: 1.4rem; border-top: 1px solid rgba(11, 24, 32, 0.28); }

/* ---------- B. why the valve opens: the depot drawn as a plant's mimic board ---------- */
.valve { background: linear-gradient(180deg, #06121a 0%, var(--night) 100%); padding-block: clamp(5rem, 10vw, 8.5rem); }
.valve-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 2rem clamp(2rem, 6vw, 6rem); align-items: end; }
.valve-k { color: var(--signal); }
.valve-title { font-size: var(--t-xl); font-weight: 250; margin-top: 1rem; }
.valve-lede { color: var(--spray); }
.valve-prose { margin-top: 1.5rem; color: var(--mist); }
.valve-last { color: var(--salt); }
.valve-fig { margin-top: clamp(2.5rem, 5vw, 4rem); }
.valve-fig > svg { width: 100%; height: auto; overflow: visible; }
.valve-fig .caption { margin-top: 1rem; }
@media (max-width: 62rem) {
  .valve-grid { grid-template-columns: minmax(0, 1fr); }
  .valve-fig > .fig-tall { display: block; max-width: 34rem; margin-inline: auto; }
}

.mm-panel { fill: #0a1a22; stroke: rgba(143, 195, 198, 0.3); }
.mm-rule { stroke: rgba(143, 195, 198, 0.22); }
.mm-k { font-family: var(--f-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.14em; fill: var(--haze); }
.mm-k--hot { fill: var(--signal); }
.mm-dim { fill: var(--haze); }
.mm-pipe { fill: none; stroke: #3f8e99; stroke-width: 4; stroke-linejoin: round; }
.mm-pipe--hot { stroke: #c98a2c; }
.mm-flow { fill: none; stroke: #c9e2e2; stroke-width: 2; stroke-dasharray: 2 14; stroke-linecap: round; stroke-linejoin: round; animation: mm-flow 1.1s linear infinite; }
.mm-flow--hot { stroke: #ffe0a8; }
@keyframes mm-flow { to { stroke-dashoffset: -16; } }
.mm-arrow { fill: #8fc3c6; }
.mm-glow { fill: rgba(143, 195, 198, 0.16); }
.mm-lamp { fill: #a9dde2; stroke: #0a1a22; stroke-width: 2; }
.mm-lamp--dead { fill: #0a1a22; stroke: #5c7077; stroke-width: 1.5; }
.mm-tank { fill: #0a1a22; stroke: #8fc3c6; stroke-width: 2; }
.mm-water { fill: #2f7480; }
.mm-limit { stroke: var(--signal); stroke-width: 1.5; stroke-dasharray: 4 3; }
.mm-dead, .mm-idle { fill: none; stroke: #5c7077; stroke-width: 3; stroke-dasharray: 7 7; }
.mm-x { fill: none; stroke: #e4675c; stroke-width: 3; stroke-linecap: round; }
.mm-valve { stroke-width: 2; stroke-linejoin: round; }
.mm-valve--open { fill: #0a1a22; stroke: var(--signal); }
.mm-valve--shut { fill: #5c7077; stroke: #5c7077; }
.mm-opt { fill: rgba(10, 26, 34, 0.9); stroke: #5c7077; stroke-width: 1.5; stroke-dasharray: 6 5; }
.mm-opt--hot { fill: rgba(242, 169, 59, 0.07); stroke: var(--signal); stroke-dasharray: none; }
.mm-nozzle { fill: #c98a2c; }
.mm-ice line { stroke: #e6f4f4; stroke-width: 1.6; stroke-linecap: round; animation: mm-fall 1.6s linear infinite; }
@keyframes mm-fall { from { transform: translateY(0); opacity: 0.95; } to { transform: translateY(40px); opacity: 0; } }
.fig-tall .mm-k { font-size: 16px; }

/* the annunciator: lit is what the machine is doing; dark is what only a person could do */
.annun {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  margin-top: 0.9rem;
  padding: 10px;
  background: #070f14;
  border: 1px solid rgba(143, 195, 198, 0.22);
  border-radius: 6px;
}
.annun li {
  display: grid;
  place-items: center;
  min-height: 4.4rem;
  padding: 0.5rem 0.4rem;
  text-align: center;
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.3;
  text-transform: uppercase;
  color: #74888f;
  background: #0d1a20;
  border: 1px solid #1f323a;
  border-radius: 3px;
}
.annun .is-lit {
  color: #3a2305;
  background: radial-gradient(120% 120% at 50% 40%, #ffd48a 0%, #f2a93b 55%, #c9821f 100%);
  border-color: #f2c16e;
  box-shadow: 0 0 18px rgba(242, 169, 59, 0.35);
}
.annun .is-alarm {
  color: #3a0d08;
  background: radial-gradient(120% 120% at 50% 40%, #ffb9ac 0%, #e4675c 55%, #b8453b 100%);
  border-color: #f09a8f;
  box-shadow: 0 0 18px rgba(228, 103, 92, 0.35);
}
.annun .is-blink { animation: annun-blink 2.4s steps(1, end) infinite; }
@keyframes annun-blink { 50% { color: #8a6a3a; background: #2a1f10; border-color: #4a3a22; box-shadow: none; } }
@media (max-width: 62rem) {
  .annun { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 34rem; margin-inline: auto; }
}
@media (max-width: 26rem) {
  .annun { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .mm-flow, .mm-ice line { animation: none !important; }
}
