/* mid.css (2026-10-24 night, the middle ground; mid.js). The base page's look stays: black, one sans, quiet small-caps
   labels in the chapter colours, chum blue as the accent. README section 71. */

/* ---- a picture that stays while its steps pass */
.md-hold { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); margin-top: clamp(1.5rem, 4vw, 3rem); }
.md-pic { position: sticky; top: calc(var(--barh, 56px) + .25rem); z-index: 2; height: calc(42svh - var(--barh, 56px) * .25); display: flex; align-items: center; justify-content: center; gap: .75rem; background: var(--bg); }
.md-steps { list-style: none; margin: 0; padding: 0 0 18svh; position: relative; z-index: 1; }
.md-steps > li { min-height: 58svh; display: flex; flex-direction: column; justify-content: center; opacity: .22; transition: opacity .45s ease; text-align: center; }
.md-steps > li.on { opacity: 1; }
.md-k { margin: 0 0 .5rem; font-size: .8125rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--md-c, var(--chum-text, #248FD3)); }
.md-steps h3 { margin: 0; font-size: clamp(1.5rem, 5.4vw, 2.25rem); font-weight: 600; line-height: 1.08; letter-spacing: -.035em; color: var(--strong); text-wrap: balance; }
.md-t { max-width: 30rem; margin: .6rem auto 0; color: var(--grey); font-size: clamp(1rem, 1.3vw, 1.125rem); line-height: 1.45; text-wrap: pretty; }
@media (min-width: 64rem) {
  .md-hold { grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); column-gap: clamp(3rem, 5vw, 5rem); align-items: start; width: min(70rem, calc(100vw - 22rem)); margin-left: calc(50% - min(35rem, 50vw - 11rem)); }
  .md-pic { grid-column: 1; grid-row: 1; top: calc(var(--barh, 56px) + 2rem); height: calc(100vh - var(--barh, 56px) - 4rem); }
  .md-steps { grid-column: 2; grid-row: 1; padding: 34vh 0 30vh; }
  .md-steps > li { min-height: 62vh; align-items: flex-start; text-align: left; }
  .md-t { margin-left: 0; }
}
.md-art { display: block; width: 100%; height: auto; max-height: 100%; overflow: visible; }
@media (prefers-reduced-motion: reduce) { .md-steps > li { opacity: 1; } }

/* names on the pictures */
.md-lbl { font: 600 8px/1 var(--sans, system-ui, sans-serif); letter-spacing: .04em; fill: rgba(255, 255, 255, .82); paint-order: stroke; stroke: rgba(0, 0, 0, .6); stroke-width: 2.2px; transition: opacity .35s ease; }
:root[data-theme="light"] .md-lbl { fill: rgba(0, 0, 0, .75); stroke: rgba(255, 255, 255, .75); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .md-lbl { fill: rgba(0, 0, 0, .75); stroke: rgba(255, 255, 255, .75); } }

/* ---- Setup: the walk through */
.md-walk { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; gap: 1rem; }
.md-walk .md-walkmk { height: 100%; width: auto; aspect-ratio: 768 / 1679; margin: 0; }
.md-walk .md-walkmk .mk-stage { height: 100%; width: auto; }
.md-walking .mk-p:not(.md-hi), .md-walking .mk-hot:not(.md-hi) { opacity: .28; transition: opacity .35s ease; }
.md-walk .md-hi { opacity: 1 !important; filter: drop-shadow(0 0 10px rgb(36 143 211 / 85%)) drop-shadow(0 0 2px #248FD3); }
.md-walk .mk-hot.md-hi { outline: 2px solid #248FD3; outline-offset: 2px; border-radius: 8px; background: rgb(36 143 211 / 14%); }
.md-card { width: clamp(5.5rem, 18vw, 9rem); display: grid; justify-items: center; gap: .4rem; opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; }
.md-card.on { opacity: 1; transform: none; }
.md-card img { width: 100%; max-height: 8rem; object-fit: contain; }
.md-card b { font-size: .75rem; font-weight: 600; text-align: center; color: var(--strong); line-height: 1.25; }
.md-hold-walk .md-k { --md-c: var(--c-water, #4FB3F0); }

/* ---- CO2: light, gas, food, algae */
.md-hold-grow .md-k { --md-c: var(--c-co2, #A88BF5); }
.md-grow .md-film { fill: rgb(143 154 60 / 35%); }
.md-grow .md-hair { fill: none; stroke: #8f9a3c; stroke-width: .9; stroke-linecap: round; }
.md-pipe { fill: none; stroke: rgba(200, 236, 250, .45); stroke-width: 1.8; stroke-linecap: round; }
.md-strainer { fill: rgba(200, 236, 250, .18); stroke: rgba(200, 236, 250, .5); stroke-width: .8; }
.md-lead { fill: none; stroke: rgba(255, 255, 255, .35); stroke-width: .7; }
:root[data-theme="light"] .md-lead { stroke: rgba(0, 0, 0, .3); }
.md-wash, .md-glow { transition: opacity .4s ease; }
.md-gc { text-anchor: middle; }
.md-gauge .md-gl:first-child { font-size: 9px; fill: var(--strong, #fff); }
.md-cyl { fill: #c9ced4; stroke: #8a9096; }
.md-line { fill: none; stroke: #8a9096; stroke-width: 1.5; }
.md-gas { fill: none; stroke: #9fd8f5; stroke-width: 2.4; stroke-dasharray: 3 9; stroke-linecap: round; }
.md-diff { fill: #d9eef8; stroke: #8a9096; }
.md-bub circle { fill: rgb(207 234 247 / 25%); stroke: #cfeaf7; stroke-width: .8; }
.md-gtrack { fill: color-mix(in srgb, var(--grey) 22%, transparent); }
.md-gband { fill: none; stroke: #4CC38A; stroke-width: 1.5; }
.md-gfill { fill: #248FD3; transition: fill .3s; }
.md-gauge.in .md-gfill { fill: #4CC38A; }
.md-gl { font: 600 8px var(--sans, system-ui); fill: var(--grey); text-anchor: end; }
.md-gtxt { font: 700 10px var(--sans, system-ui); fill: #248FD3; text-anchor: start; }
.md-gauge.in .md-gtxt { fill: #4CC38A; }
.md-food path { fill: #f0b75e; }
.md-grow .p7-carpet path { will-change: transform; }

/* ---- the scape */
.md-hold-scape .md-k { --md-c: var(--c-plant, #4DC46B); }
.md-scape g { transition: opacity .45s ease; }
.md-cut { display: block; flex: none; width: 5rem; height: 5rem; margin: 0 auto .75rem; }
.md-cut img { width: 100%; height: 100%; object-fit: contain; }
@media (min-width: 64rem) { .md-cut { margin-left: 0; } }

/* ---- the fish: stops, to scale */
.md-fishfig { position: relative; width: 100%; max-height: 100%; aspect-ratio: 400 / 244; }
.md-fishfig .md-tank { width: 100%; height: 100%; }
.md-swim { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.md-f { position: absolute; left: 0; top: 0; height: auto; opacity: 0; transition: opacity 1.2s ease; will-change: transform; }
.md-f.in { opacity: 1; }
/* the big swim-by crosses the whole screen (mid.js sets left/width to the screen's): it comes in and goes out at the
   screen's edges, never at a box edge inside the page (10/24, "clear sidebars that interrupt the fish") */
.md-big { position: absolute; top: -6%; bottom: 0; left: 0; width: 100vw; pointer-events: none; overflow: hidden; }
.md-big .md-sb { position: absolute; left: 0; top: 0; height: auto; animation: none; filter: none; will-change: transform; }
.md-big img:not(.md-sb) { position: absolute; top: 8%; left: 0; width: clamp(9rem, 22vw, 18rem); animation: md-swimby 11s linear 1 forwards; filter: drop-shadow(0 12px 24px rgb(0 0 0 / 45%)); }
@keyframes md-swimby {
  0% { transform: translate(-102%, 10px); }
  50% { transform: translate(calc(var(--bw, 100vw) * .5 - 50%), -8px); }
  100% { transform: translate(calc(var(--bw, 100vw) + 2%), 6px); }
}
.md-hold-fish .md-k { --md-c: var(--c-fish, #F2C94C); }
.md-big-type h3 { font-size: clamp(2.25rem, 6.4vw, 4.25rem); line-height: 1; letter-spacing: -.05em; }
.md-who { display: flex; align-self: stretch; flex-wrap: wrap; gap: .4rem; justify-content: center; margin: 1rem 0 0; }
@media (min-width: 64rem) { .md-who { justify-content: flex-start; } }
.md-pill { padding: .35rem .8rem; border: 0; border-radius: 999px; background: var(--raise); color: var(--text); font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; }
.md-pill:hover { background: color-mix(in srgb, #248FD3 22%, var(--raise)); }

/* ---- the nitrogen cycle, one loop */
.md-cyc { width: auto; height: 100%; max-width: 100%; aspect-ratio: 1; }
.md-ring { fill: none; stroke: color-mix(in srgb, var(--grey) 25%, transparent); stroke-width: 2; }
.md-arc { fill: none; stroke: #248FD3; stroke-width: 2.5; stroke-linecap: round; transition: stroke-dashoffset .2s linear; }
.md-dot { fill: #9fd8f5; }
.md-nc { fill: var(--bg); stroke: var(--c); stroke-width: 2; transition: fill .35s ease, transform .35s ease; }
.md-node { transition: opacity .35s ease; }
.md-node .md-nc { transform-box: fill-box; transform-origin: center; }
.md-node.on .md-nc { fill: color-mix(in srgb, var(--c) 28%, var(--bg)); transform: scale(1.12); }
.md-nt { font: 600 11px var(--sans, system-ui); fill: var(--strong); }
.md-nv { font: 600 9px var(--sans, system-ui); fill: var(--c); }
.md-hold-cyc .md-steps > li .md-k { --md-c: var(--c); text-transform: none; letter-spacing: .04em; }

/* ---- KH: a plain meter under the tests */
.khm { max-width: 26rem; margin: 1.25rem auto 0; padding: 1rem 1.15rem; border-radius: 18px; background: var(--raise); text-align: left; }
.khm-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.khm-top b { font-size: 1.125rem; font-weight: 600; color: var(--strong); }
.khm-trk { position: relative; height: 8px; margin: .7rem 0 .35rem; border-radius: 99px; background: color-mix(in srgb, var(--grey) 22%, transparent); overflow: hidden; }
.khm-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: #d9b93c; }
.khm-ends { display: flex; justify-content: space-between; font-size: .75rem; color: var(--grey); }
.khm-say { margin: .6rem 0 0; font-size: .875rem; color: var(--grey); line-height: 1.4; }

/* ---- links and the quiet line */
.md-carelink { margin: 2rem 0 0; text-align: center; }
.md-carelink a { display: inline-block; padding: .55rem 1.2rem; border-radius: 999px; background: #248FD3; color: #fff; font-weight: 600; font-size: .9375rem; text-decoration: none; }
.md-menucare { display: block; margin-top: .5rem; }
.md-others { margin: 0 0 .5rem; color: var(--grey); font-size: .8125rem; }
