/* Hydrogen electrolysis project site */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-variable.woff2") format("woff2-variations"), url("fonts/archivo-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f2f5f6;
  --surface: #ffffff;
  --ink: #142128;
  --muted: #536570;
  --line: #d3dde1;
  --h2: #0f6e83;
  --h2-soft: #dcecf0;
  --theory: #8a99a3;
  --warn: #b5651d;
  --warn-soft: #f6eadf;
  --focus: #0f6e83;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1619; --surface: #162026; --ink: #e3ebee; --muted: #9bb0ba; --line: #283840;
    --h2: #5cc3d8; --h2-soft: #183039; --theory: #6f828c; --warn: #e2a066; --warn-soft: #33261b; --focus: #5cc3d8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1619; --surface: #162026; --ink: #e3ebee; --muted: #9bb0ba; --line: #283840;
  --h2: #5cc3d8; --h2-soft: #183039; --theory: #6f828c; --warn: #e2a066; --warn-soft: #33261b; --focus: #5cc3d8;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 17px; line-height: 1.6; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--h2); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.12; margin: 0; font-variation-settings: "wdth" 116; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
sub { font-size: .7em; }

.wrap { width: min(1140px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 24px; min-height: 60px; }
.brand { color: var(--ink); text-decoration: none; font-weight: 700; font-variation-settings: "wdth" 112; white-space: nowrap; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--surface); }
.theme { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; cursor: pointer; }
.theme svg { width: 18px; height: 18px; fill: currentColor; }

/* Hero */
.hero { padding: 64px 0 80px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 56px; align-items: center; }
.kicker { color: var(--muted); font-weight: 500; margin-bottom: 14px; }
.hero h1 { font-size: clamp(30px, 3.7vw, 46px); font-weight: 800; font-variation-settings: "wdth" 110; letter-spacing: -.015em; margin-bottom: 20px; max-width: 22ch; }
.lede { font-size: 19px; color: var(--muted); max-width: 52ch; }
.stats { display: grid; grid-template-columns: repeat(2, max-content); gap: 18px 48px; margin: 28px 0 0; padding: 22px 0 0; border-top: 1px solid var(--line); }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-size: 14px; color: var(--muted); }
.stats dd { margin: 0; font-size: 28px; font-weight: 700; font-variation-settings: "wdth" 108; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats div:first-child dd { color: var(--h2); }
.hero-chart { position: relative; padding: 20px 20px 14px; }
.tip { min-height: 1.5em; margin: 6px 0 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Sections */
.section { padding: 88px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-alt .panel { background: var(--bg); }
.section-head { margin-bottom: 40px; max-width: 64ch; }
.section-head h2 { font-size: clamp(30px, 3.6vw, 42px); font-weight: 750; margin-bottom: 10px; }
.section-head p { color: var(--muted); font-size: 18px; margin: 0; }

.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: start; }
.split-even { grid-template-columns: 1fr 1fr; }
.prose { max-width: 60ch; }
.prose h3 { font-size: 20px; margin: 0 0 10px; }
.prose ul + h3, .prose p + h3 { margin-top: 30px; }
.small { font-size: 14.5px; color: var(--muted); }

.panel { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.panel img { border-radius: 6px; }
.panel figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: start; }
.photos .panel { padding: 10px; }
.photos img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.photos figcaption { font-size: 13px; line-height: 1.45; }
.split-methods { grid-template-columns: 1fr 1fr; }
.split-methods .photos { margin-bottom: 22px; }

.specs { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.specs li { display: grid; grid-template-columns: 8.5em 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.specs span { color: var(--muted); }

/* Theory */
.eqs { margin: 0 0 24px; padding: 16px 0; border-block: 1px solid var(--line); }
.eqs p { display: grid; grid-template-columns: 5.5em 1fr; margin: 4px 0; font-size: 18px; }
.eqs span { color: var(--muted); font-size: 15px; padding-top: 2px; }
.formula { font-size: 24px; margin: 26px 0 10px; display: flex; align-items: center; gap: .35em; }
.formula i { font-style: italic; font-variation-settings: "wdth" 100; }
.frac { display: inline-flex; flex-direction: column; text-align: center; vertical-align: middle; }
.frac > span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 .25em; }
.frac > span:last-child { padding: 0 .25em; }
.worked { padding: 24px; }
.worked h3 { font-size: 18px; margin-bottom: 14px; }
.worked ol { list-style: none; margin: 0 0 12px; padding: 0; counter-reset: s; }
.worked li { counter-increment: s; display: grid; grid-template-columns: 1.6em 1fr; column-gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.worked li::before { content: counter(s); grid-row: span 2; color: var(--muted); font-weight: 600; font-size: 14px; padding-top: 1px; }
.worked li span { font-size: 14px; color: var(--muted); }
.worked li b { font-weight: 600; font-variant-numeric: tabular-nums; }
.worked-result b { color: var(--h2); font-size: 20px; }

/* Findings */
.finding h3 { font-size: 24px; }
.page-cont { border-top: 1px solid var(--line); }
.finding { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; }
.finding-flip > figure { order: 2; }
.finding .panel { padding: 18px 18px 12px; }

/* Chart */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; font-family: inherit; }
.chart .grid { stroke: var(--line); }
.chart .axis { stroke: var(--muted); }
.chart .tick { fill: var(--muted); font-size: 12px; }
.chart .alab { fill: var(--muted); font-size: 12.5px; }
.chart .theory { fill: none; stroke: var(--theory); stroke-width: 2; stroke-dasharray: 6 5; }
.chart .fit { fill: none; stroke: var(--h2); stroke-width: 2; opacity: .55; }
.chart .ext { fill: none; stroke: var(--theory); stroke-width: 1.5; stroke-dasharray: 3 4; }
.chart .pt { fill: var(--h2); fill-opacity: .85; stroke: var(--surface); stroke-width: 1.5; cursor: pointer; }
.section-alt .chart .pt, .section-alt .chart .mean { stroke: var(--bg); }
.chart .pt:hover, .chart .pt:focus { fill-opacity: 1; stroke: var(--ink); outline: none; }
.chart .mean { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.chart .meanline { fill: none; stroke: var(--ink); stroke-width: 2; }
.chart .zone { fill: var(--warn-soft); }
.chart .zlab { fill: var(--warn); font-size: 12px; font-weight: 600; }
.chart .note { fill: var(--ink); font-size: 12.5px; font-weight: 600; }
.chart .marker { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.key { display: inline-block; width: 16px; height: 0; margin: 0 6px 3px 0; vertical-align: middle; }
.key + .key, figcaption .key:not(:first-child) { margin-left: 14px; }
.key-meas { width: 10px; height: 10px; border-radius: 50%; background: var(--h2); }
.key-theory { border-top: 2px dashed var(--theory); }
.key-mean { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }

/* Hero link to the model */
.try { margin: 14px 0 0; font-weight: 600; }
@media (min-width: 1200px) {
  .hero-copy { position: relative; }
  .try { position: absolute; right: 0; bottom: 0; margin: 0; font-size: 15.5px; white-space: nowrap; }
  .stats { column-gap: 36px; }
}
.try a::after { content: " →"; }

/* Model */
.model .section-head { max-width: none; }
.model .section-head p { font-size: 16.5px; }
.model-grid { display: grid; grid-template-columns: minmax(280px, 320px) 1fr 1fr; grid-template-areas: "ctl iv h2" "ctl bar bar"; gap: 14px; align-items: stretch; }
.model-side { grid-area: ctl; display: flex; flex-direction: column; gap: 14px; }
.model-controls { display: flex; flex-direction: column; gap: 6px; }
.model-readout { flex: 1; display: flex; align-items: center; }
.m-iv { grid-area: iv; } .m-h2 { grid-area: h2; } .m-bar { grid-area: bar; display: flex; flex-direction: column; justify-content: center; }
.model .panel { padding: 12px 14px 8px; }
.model .panel figcaption { margin-top: 4px; font-size: 13px; line-height: 1.5; }
.ctl { display: grid; grid-template-columns: 5.4em 1fr 4.4em; column-gap: 8px; align-items: center; }
.ctl label { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.ctl .tag { margin-top: 2px; }
.ctl .unit { color: var(--muted); font-weight: 400; }
.ctl input[type="range"] { width: 100%; margin: 0; accent-color: var(--h2); min-height: 28px; }
.ctl input[type="number"] { width: 100%; font: inherit; font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; line-height: 1.45; color: var(--warn); border: 1px solid currentColor; border-radius: 999px; padding: 0 7px; vertical-align: 1px; }
.model-out { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; width: 100%; }
.model-out div { display: flex; flex-direction: column-reverse; }
.model-out .wide { grid-column: span 2; }
.model-out dt { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.model-out dd { margin: 0; font-size: 18px; font-weight: 700; font-variation-settings: "wdth" 106; font-variant-numeric: tabular-nums; }
.reset { align-self: flex-start; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.reset:hover { border-color: var(--muted); }
.chart .model { fill: none; stroke: var(--h2); stroke-width: 2.5; }
.chart .model90 { fill: none; stroke: var(--h2); stroke-width: 2; stroke-dasharray: 5 4; opacity: .6; }
.chart .sel { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: .45; }
.chart .seg-rev { fill: var(--theory); }
.chart .seg-act { fill: var(--warn); }
.chart .seg-ohm { fill: var(--h2); }
.chart .seglab { fill: var(--surface); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.key-model { border-top: 3px solid var(--h2); }
.key-model90 { border-top: 2px dashed var(--h2); opacity: .7; }
.key-sw { width: 12px; height: 10px; border-radius: 2px; }
.nw { white-space: nowrap; }
.nw + .nw .key { margin-left: 14px; }
.key-rev { background: var(--theory); } .key-act { background: var(--warn); } .key-ohm { background: var(--h2); }
.model-notes { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; margin-top: 12px; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.model-notes h3 { font-size: 15px; color: var(--ink); margin: 0 0 4px; }
.model-notes ul { margin: 0; padding-left: 1.1em; }
.model-notes li { margin-bottom: 1px; }
.model-notes p { margin: 0; }

/* Run the experiment */
.lab { --graphite: #343b40; --graphite-edge: #1c2125; --wire-neg: #1f2427; --wire-pos: #c7362b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lab { --graphite: #4b555c; --graphite-edge: #6f7d86; --wire-neg: #7d8a93; --wire-pos: #e2584c; } }
:root[data-theme="dark"] .lab { --graphite: #4b555c; --graphite-edge: #6f7d86; --wire-neg: #7d8a93; --wire-pos: #e2584c; }
.lab .section-head p { font-size: 16.5px; }
.lab-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; align-items: stretch; }
.lab .panel { padding: 12px 14px; }
.lab-scene { display: flex; align-items: center; justify-content: center; }
.lab-scene > div { width: 100%; }
.lab-svg { display: block; width: 100%; height: auto; font-family: inherit; }
.lab-side { display: flex; flex-direction: column; gap: 12px; }
.lab-controls { display: flex; flex-direction: column; gap: 6px; }
.lab-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.run { font: inherit; font-size: 14.5px; font-weight: 700; color: var(--surface); background: var(--h2); border: 1px solid var(--h2); border-radius: 6px; padding: 5px 18px; cursor: pointer; min-width: 7.5em; }
.run:hover { filter: brightness(1.08); }
.lab-buttons .reset { align-self: auto; }
.speed { font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.speed input { accent-color: var(--h2); margin: 0; }
.lab-out { padding-top: 10px; border-top: 1px solid var(--line); }
.lab-compare { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); min-height: 4.5em; }
.lab-svg .bench { stroke: var(--line); stroke-width: 2; }
.lab-svg .psu-body { fill: #1b2024; stroke: var(--line); }
.lab-svg .psu-lcd { fill: #0c0e0f; }
.lab-svg .seg { fill: #ff3d2e; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 25px; font-weight: 700; letter-spacing: 1px; }
.lab-svg .seg-u { fill: #ff3d2e; font-size: 13px; font-weight: 700; }
.lab-svg .psu-lab { fill: #9aa5ad; font-size: 10px; font-weight: 600; letter-spacing: .5px; }
.lab-svg .led { fill: #253226; }
.lab-svg .led-on { fill: #3ddc5c; }
.lab-svg .knob { fill: #2b3237; stroke: #0f1215; stroke-width: 2; }
.lab-svg .term-neg { fill: #111; stroke: #4a5258; stroke-width: 2; }
.lab-svg .term-pos { fill: #c0392b; stroke: #7d241b; stroke-width: 2; }
.lab-svg .liquid { fill: color-mix(in srgb, var(--h2) 24%, transparent); }
.lab-svg .meniscus { stroke: var(--h2); stroke-width: 1.5; opacity: .55; }
.lab-svg .gas { fill: var(--surface); }
.lab-svg .gas-line { stroke: var(--h2); stroke-width: 1.4; }
.lab-svg .glass { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linejoin: round; }
.lab-svg .beaker { stroke: var(--ink); stroke-width: 2.4; opacity: .7; }
.lab-svg .tube { stroke-width: 1.6; }
.lab-svg .rod { fill: var(--graphite); stroke: var(--graphite-edge); stroke-width: 1; }
.lab-svg .clip { stroke: rgba(0,0,0,.35); stroke-width: 1; }
.lab-svg .clip-neg { fill: var(--wire-neg); }
.lab-svg .clip-pos { fill: var(--wire-pos); }
.lab-svg .wire { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.lab-svg .wire-neg { stroke: var(--wire-neg); }
.lab-svg .wire-pos { stroke: var(--wire-pos); }
.lab-svg .grad { stroke: var(--muted); stroke-width: 1; }
.lab-svg .grad-t { fill: var(--muted); font-size: 9.5px; }
.lab-svg .elab { fill: var(--ink); font-size: 12px; font-weight: 600; }
.lab-svg .elab-g { fill: var(--h2); font-size: 12px; font-weight: 700; }
.lab-svg .bub { fill: var(--surface); fill-opacity: .9; stroke: var(--h2); stroke-width: .8; }

/* Error analysis */
.errors { margin: 0; padding: 0 0 0 1.3em; }
.errors li { padding: 0 0 14px 4px; }
.errors li::marker { color: var(--muted); font-weight: 600; }
.errors b { font-weight: 650; }
.next { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; }
.next ul { margin: 0; padding-left: 1.1em; }
.next li { margin-bottom: 8px; }

/* Data */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.data th, .data td { padding: 11px 16px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data th { font-weight: 600; color: var(--muted); font-size: 14px; background: var(--bg); }
.data th:first-child, .data td:first-child { text-align: left; }
.data td.note { text-align: left; white-space: normal; min-width: 18em; color: var(--muted); }
.data tbody tr:last-child td { border-bottom: 0; }
.data .pm { color: var(--muted); font-weight: 400; }
.data tr.best td { background: var(--h2-soft); font-weight: 600; }
.raw { margin-top: 20px; }
.raw summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.raw .table-wrap { margin-top: 8px; }
.downloads { margin-top: 20px; color: var(--muted); }

/* Footer */
.foot { padding: 32px 0 40px; color: var(--muted); font-size: 15px; border-top: 1px solid var(--line); }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.foot p { margin: 0; }

@media (max-width: 900px) {
  .hero { padding: 36px 0 56px; }
  .hero-grid, .split, .split-even, .finding { grid-template-columns: 1fr; gap: 28px; }
  .finding-flip > figure { order: 0; }
  .section { padding: 64px 0; }
  .nav { display: none; }
  .theme { margin-left: auto; }
  .model-grid { grid-template-columns: 1fr; grid-template-areas: "ctl" "iv" "bar" "h2"; }
  .model-notes { grid-template-columns: 1fr; gap: 16px; }
  .lab-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .stats { gap: 16px 28px; }
  .stats dd { font-size: 24px; }
  .specs li { grid-template-columns: 1fr; gap: 0; }
  .eqs p { grid-template-columns: 1fr; }
  .formula { font-size: 20px; }
  .worked { padding: 18px; }
}

/* One section per screen on desktop */
@media (min-width: 900px) and (min-height: 640px) {
  html { scroll-snap-type: y proximity; scroll-padding-top: 61px; }
  .page { min-height: calc(100vh - 61px); min-height: calc(100svh - 61px); display: flex; flex-direction: column; justify-content: center; padding: 36px 0; scroll-snap-align: start; }
  .hero.page { padding: 28px 0; }
  .hero h1 { margin-bottom: 14px; }
  .hero .lede { font-size: 17.5px; }
  .stats { margin-top: 20px; padding-top: 16px; gap: 12px 36px; }
  .stats dd { font-size: 24px; }
  .eqs { margin-bottom: 16px; padding: 10px 0; }
  .formula { margin: 16px 0 6px; }
  .page > .wrap { width: min(1140px, 100% - 32px); }
  .page .section-head { margin-bottom: 28px; }
  .chart svg { max-height: calc(100svh - 300px); margin-inline: auto; }
  .hero-chart .chart svg { max-height: calc(100svh - 260px); }
  .worked { padding: 20px 24px; }
  .worked li { padding: 5px 0; }
  .worked h3 { margin-bottom: 8px; }
  .model.page { padding: 20px 0; }
  .model .section-head { margin-bottom: 14px; }
  .model .section-head h2 { margin-bottom: 4px; }
  .model .m-iv .chart svg, .model .m-h2 .chart svg { max-height: calc(100svh - 578px); min-height: 160px; }
  .lab-svg { max-height: calc(100svh - 240px); }
  .lab .section-head { margin-bottom: 18px; }
  .model .section-head { display: flex; align-items: baseline; gap: 6px 24px; flex-wrap: wrap; }
}
