/* =============================================================================
   Safiery — "Follow the power" energy system experience (homepage)
   A dark, full-bleed stage: five energy domains linked by live conduits.
   Battery (storage) is the centre of the universe; drag out in any direction.
   Scoped: .sysmap (hero overview) + .energy / .ex-* (explorer stage).
   ========================================================================== */

:root {
  --ex-bg:       #060b15;
  --ex-bg-2:     #0a1424;
  --ex-line:     rgba(126, 160, 205, .16);
  --ex-line-2:   rgba(126, 160, 205, .30);
  --ex-text:     #ecf3fc;
  --ex-dim:      #a3b5cc;
  --ex-mut:      #64768e;

  /* domain accents */
  --ex-storage:      #5fa8ff;
  --ex-production:   #ffb547;
  --ex-conversion:   #ff8a3d;
  --ex-distribution: #58b0ff;
  --ex-consumption:  #9fe0ff;
}

/* =============================================================================
   1. HOME PAGE CHROME — the page belongs to the explorer.
   body.home-dark turns the whole page (header, band, stage, footer) into one
   dark surface; --dm is the accent of the domain you're currently at.
   ========================================================================== */
body.home-dark { --dm: var(--ex-storage); }
body.home-dark[data-domain="production"]   { --dm: var(--ex-production); }
body.home-dark[data-domain="conversion"]   { --dm: var(--ex-conversion); }
body.home-dark[data-domain="distribution"] { --dm: var(--ex-distribution); }
body.home-dark[data-domain="consumption"]  { --dm: var(--ex-consumption); }

body.home-dark {
  background: var(--ex-bg);
  background-image:
    radial-gradient(1100px 500px at 85% -12%, rgba(62,120,189,.20), transparent 70%),
    radial-gradient(800px 400px at 4% 2%, rgba(46,90,150,.16), transparent 70%);
  background-repeat: no-repeat;
  color: var(--ex-text);
  color-scheme: dark;
}

/* header melts into the stage and picks up the current domain's colour */
body.home-dark .site-header {
  background: rgba(7, 13, 24, .70);
  border-bottom: 1px solid rgba(126, 160, 205, .16);
}
body.home-dark .site-header::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent 4%, var(--dm) 50%, transparent 96%);
  opacity: .85;
  transition: background .7s ease;
  pointer-events: none;
}
body.home-dark .brand-logo { filter: brightness(0) invert(1); opacity: .92; }
body.home-dark .nav > a, body.home-dark .nav-trigger { color: #9fb2c9; }
body.home-dark .nav > a:hover, body.home-dark .nav > a.active,
body.home-dark .nav-trigger:hover, body.home-dark .nav-trigger.open, body.home-dark .nav-trigger.active { color: #fff; background: rgba(120, 165, 220, .12); }
body.home-dark .icon-btn, body.home-dark .search-input {
  background: rgba(10, 20, 38, .5); border-color: rgba(150, 185, 230, .3); color: #cfe0f5;
}
body.home-dark .icon-btn:hover { border-color: var(--dm); color: #fff; background: rgba(120, 165, 220, .1); }
body.home-dark .cart-count { border-color: #0a1424; }

/* the homepage is a locked, single-screen app: nav bar + stage, no page
   scroll. JS adds .ex-locked to <html> when the drag universe boots (fine
   pointers); the vertical story on touch keeps normal scrolling, and very
   short windows fall back to scrolling so nothing is ever unreachable. */
/* a horizontal trackpad/touch swipe on a scroll-less page triggers the
   browser's back-navigation glide (page slides out and bounces back) —
   kill overscroll chaining so swipes belong to the universe alone */
html.home, html.home body { overscroll-behavior: none; }
html.ex-locked, html.ex-locked body { height: 100%; }
@media (min-height: 560px) {
  html.ex-locked, html.ex-locked body { overflow: hidden; }
  /* iOS rubber-bands overflow:hidden documents; a fixed body cannot move */
  html.ex-locked body { position: fixed; inset: 0; width: 100%; }
}
body.home-dark { display: flex; flex-direction: column; }
body.home-dark .site-header { flex: none; }
.home-shell { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.home-shell .energy { margin-top: 0; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.home-shell .ex-stage { flex: 1 1 auto; border-top: 0; border-bottom: 0; }
.home-shell .ex-stage.ex-ready { height: auto; min-height: 500px; }
html.ex-locked .home-shell .ex-stage.ex-ready { min-height: 0; }

/* screen-reader headline — the visible page is the product itself */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =============================================================================
   2. THE EXPLORER STAGE
   ========================================================================== */
.energy { padding: 0; margin-top: 30px; }
.ex-stage {
  position: relative;
  background:
    radial-gradient(1100px 520px at 50% 118%, rgba(37,72,128,.34), transparent 70%),
    radial-gradient(900px 420px at 8% -10%, rgba(46,90,150,.25), transparent 70%),
    linear-gradient(180deg, #081020, var(--ex-bg) 30%, var(--ex-bg) 70%, #081020);
  border-top: 1px solid rgba(126,160,205,.18);
  border-bottom: 1px solid rgba(126,160,205,.18);
  overflow: hidden;
  color: var(--ex-text);
}
/* JS-upgraded desktop universe */
.ex-stage.ex-ready { height: clamp(660px, 94vh, 1080px); touch-action: none; user-select: none; }
.ex-stage.ex-ready.ex-grabbing { cursor: grabbing; }
.ex-stage.ex-ready { cursor: grab; }

.ex-world { position: relative; }
.ex-stage.ex-ready .ex-world {
  position: absolute; top: 0; left: 0;
  width: 300%; height: 300%;
  will-change: transform;
}
.ex-stage.ex-ready .ex-world.ex-spring { transition: transform .62s cubic-bezier(.22, .9, .26, 1); }
/* dot grid across the whole world */
.ex-stage.ex-ready .ex-world::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(110,150,205,.13) 1px, transparent 1px);
  background-size: 30px 30px;
}

/* ---- wires ---- */
.ex-wires { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; display: block; }
.ex-wires path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* backlight glow — breathes slowly, each link on its own phase */
.ex-wires .wglow { stroke-width: 12; opacity: .2; filter: blur(9px); transition: opacity .5s ease; animation: exbreath 5.4s ease-in-out infinite; }
.ex-wires g.ex-link:nth-of-type(2) .wglow { animation-delay: -1.35s; }
.ex-wires g.ex-link:nth-of-type(3) .wglow { animation-delay: -2.7s; }
.ex-wires g.ex-link:nth-of-type(4) .wglow { animation-delay: -4.05s; }
@keyframes exbreath { 0%, 100% { opacity: .16; } 50% { opacity: .32; } }
/* dark casing under the coloured core — the conduit reads as a physical
   busbar laid over the dot grid, glow spilling out from behind it */
.ex-wires .wcase { stroke: #040910; stroke-width: 6.5; opacity: .9; }
.ex-wires .wbase { stroke-width: 2.6; opacity: .92; transition: opacity .5s ease; }
.ex-wires .wtrack { stroke: none; }
/* surge — a long bright bar sweeping the line; faint ambient, vivid on hot */
.ex-wires .wsurge {
  stroke-width: 4.2; opacity: .12;
  stroke-dasharray: 92 556;
  animation: exsurge 2.3s linear infinite;
  transition: opacity .5s ease;
}
@keyframes exsurge { to { stroke-dashoffset: -648; } }
/* twin tick trains: crisp white current on top, a slower fainter train
   beneath it for depth */
.ex-wires .wflow {
  stroke: #fff; stroke-width: 2; opacity: .9;
  stroke-dasharray: 5 33;
  animation: exflow 2.6s linear infinite;
  transition: opacity .5s ease;
}
.ex-wires .wflow.rev { animation-name: exflow-rev; }
.ex-wires .wflow.w2 { stroke-width: 1.2; opacity: .38; stroke-dasharray: 2 23; animation: exflow2 5.2s linear infinite; }
@keyframes exflow     { to { stroke-dashoffset: -228; } }
@keyframes exflow-rev { to { stroke-dashoffset:  228; } }
@keyframes exflow2    { to { stroke-dashoffset: -250; } }
/* junction vias at the routed elbows */
.ex-wires .wvia { fill: #060b15; stroke-width: 1.5; opacity: .9; transition: opacity .5s ease; }
.ex-wires .wpacket { transition: opacity .5s ease; }
.ex-wires g.ex-link.dim .wbase   { opacity: .26; }
.ex-wires g.ex-link.dim .wglow   { opacity: .07; animation: none; }
.ex-wires g.ex-link.dim .wflow   { opacity: .18; }
.ex-wires g.ex-link.dim .wsurge  { opacity: 0; }
.ex-wires g.ex-link.dim .wvia    { opacity: .35; }
.ex-wires g.ex-link.dim .wpacket { opacity: .18; }
.ex-wires g.ex-link.hot .wbase   { opacity: 1; }
.ex-wires g.ex-link.hot .wglow   { opacity: .48; animation: none; }
.ex-wires g.ex-link.hot .wflow   { opacity: 1; animation-duration: 1.15s; }
.ex-wires g.ex-link.hot .wflow.w2 { animation-duration: 2.4s; }
.ex-wires g.ex-link.hot .wsurge  { opacity: .55; }
/* decorative stubs (engine belt in, house circuits out) — the dashes drift
   the direction the power actually travels */
.ex-wires .wstub { stroke-width: 2; stroke-dasharray: 3 7; opacity: .5; animation: exstub 1.05s linear infinite; }
.ex-wires .wstub.in { animation-direction: reverse; }
@keyframes exstub { to { stroke-dashoffset: -10; } }
.ex-wires g.ex-link.dim + .ex-stubs { opacity: .3; }

/* connector ports — the exact spot power enters/leaves each product */
.ex-port {
  position: absolute; z-index: 6; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff 0 28%, var(--pc, #5fa8ff) 62%, rgba(0,0,0,.4));
  box-shadow: 0 0 0 2px rgba(255,255,255,.22), 0 0 14px 2px var(--pc, #5fa8ff);
  pointer-events: none;
}
.ex-port::after {
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  border: 1.5px solid var(--pc, #5fa8ff); opacity: .8;
  animation: exping 2.5s cubic-bezier(.2, .6, .3, 1) infinite;
}
@keyframes exping { 0% { transform: scale(.55); opacity: .9; } 75%, 100% { transform: scale(1.9); opacity: 0; } }

/* floating line labels */
.ex-wlabel {
  position: absolute; z-index: 5; transform: translate(-50%, -50%);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: #d7e6f9; white-space: nowrap;
  background: rgba(9, 18, 34, .78);
  border: 1px solid rgba(130, 168, 216, .34);
  border-radius: 100px; padding: 5px 11px 5px 9px;
  backdrop-filter: blur(6px);
  display: inline-flex; align-items: center; gap: 7px;
  pointer-events: none;
  transition: opacity .5s ease;
}
.ex-wlabel .wl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pc, #5fa8ff); box-shadow: 0 0 8px 1px var(--pc, #5fa8ff); }
.ex-wlabel.dim { opacity: .35; }

/* ---- cells ---- */
.ex-cell { position: relative; z-index: 2; display: grid; align-items: center; padding: clamp(14px, 2.2vh, 30px) clamp(26px, 5vw, 84px); }
.ex-stage.ex-ready .ex-cell { position: absolute; width: 33.3334%; height: 33.3334%; }
.ex-inner {
  width: 100%; max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(300px, 5fr) 7fr;
  gap: clamp(22px, 4vw, 64px); align-items: center; position: relative;
}
.ex-cell[data-cell="distribution"] .ex-inner { grid-template-columns: 7fr minmax(300px, 5fr); }
.ex-cell[data-cell="distribution"] .ex-copy  { order: 2; }
.ex-cell[data-cell="distribution"] .ex-media { order: 1; }

/* the centre of the universe gets a stacked, shrine-like layout */
.ex-cell[data-cell="storage"] .ex-inner { grid-template-columns: 1fr; justify-items: center; gap: 10px; max-width: 980px; }
.ex-cell[data-cell="storage"] .ex-copy { text-align: center; max-width: 66ch; }
.ex-cell[data-cell="storage"] .ex-lede { margin-left: auto; margin-right: auto; }
.ex-cell[data-cell="storage"] .ex-chips, .ex-cell[data-cell="storage"] .ex-ctas { justify-content: center; }
.ex-cell[data-cell="storage"] .ex-media { max-width: 720px; }
.ex-cell[data-cell="storage"] .ex-media::before {
  content: ""; position: absolute; inset: -12% -16%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(95,168,255,.24), rgba(95,168,255,.05) 55%, transparent 75%);
  animation: exaura 5.5s ease-in-out infinite; z-index: -1;
}
@keyframes exaura { 0%,100% { opacity: .65; transform: scale(.97); } 50% { opacity: 1; transform: scale(1.03); } }

.ex-num {
  position: absolute; top: clamp(6px, 3vh, 34px); left: clamp(18px, 3vw, 44px); z-index: 1;
  font-family: var(--display); font-weight: 800; line-height: 1;
  font-size: clamp(90px, 13vw, 190px);
  color: rgba(190, 215, 245, .05);
  pointer-events: none; user-select: none;
}
.ex-copy { position: relative; z-index: 2; }
.ex-kicker {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ac, var(--ex-storage)); display: inline-flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.ex-kicker::before { content: ""; width: 24px; height: 2px; border-radius: 2px; background: var(--ac, var(--ex-storage)); box-shadow: 0 0 10px 0 var(--ac, var(--ex-storage)); }
.ex-copy h3 { font-size: clamp(28px, 3.4vw, 50px); color: var(--ex-text); letter-spacing: -.025em; margin: 0 0 14px; }
.ex-copy h3 .hl { color: var(--ac, var(--ex-storage)); }
.ex-prod {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .06em; color: var(--ex-dim); margin: 0 0 12px;
}
.ex-lede { color: var(--ex-dim); font-size: 15.5px; line-height: 1.65; max-width: 48ch; margin: 0 0 18px; }
.ex-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; }
.ex-chips li {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; color: #d9e7f8;
  border: 1px solid rgba(140, 175, 220, .3); border-radius: 8px; padding: 7px 11px;
  background: linear-gradient(180deg, rgba(120,165,220,.10), rgba(120,165,220,.03));
  display: inline-flex; align-items: center; gap: 8px;
}
.ex-chips li::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--ac, var(--ex-storage)); box-shadow: 0 0 8px 0 var(--ac, var(--ex-storage)); }
.ex-ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-ghost-dark {
  background: rgba(10, 20, 38, .5); border: 1px solid rgba(150, 185, 230, .32); color: #e6eefb;
}
.btn-ghost-dark:hover { border-color: var(--ac, var(--ex-storage)); color: #fff; background: rgba(95,168,255,.12); }

.ex-media { position: relative; z-index: 2; }
.ex-media img {
  width: auto; height: auto; max-width: 100%; max-height: clamp(220px, 44vh, 560px); margin: 0 auto;
  filter: drop-shadow(0 34px 50px rgba(0, 0, 0, .55)) drop-shadow(0 0 42px var(--mg, rgba(95,168,255,.10)));
  animation: exfloat 7s ease-in-out infinite;
}
/* the battery is the hero — storage.webp is alpha-trimmed to the case, so
   every budgeted pixel is visible product. The stacked shrine must share one
   locked screen with its copy, so the budget is derived, not guessed:
   corridor = 100vh − header 79 − N/S prompt zones 85+85; battery gets
   corridor − copy − grid gap − ~20px breathing room (the art bobs ±5px).
   Copy = the 48 V 3C block: measured ~433px above 820px viewports (~501
   above 1080), ~360 below — remeasure these if the homepage copy changes. */
.ex-cell[data-cell="storage"] .ex-media img { max-height: min(calc(100vh - 700px), 560px); }
/* the satellite products the copy points at get a touch more presence;
   distribution keeps the stock 44vh (these beat later .ex-media img rules
   on specificity, so every branch below re-states the trio) */
.ex-cell[data-cell="production"] .ex-media img,
.ex-cell[data-cell="conversion"] .ex-media img,
.ex-cell[data-cell="consumption"] .ex-media img { max-height: clamp(230px, 46vh, 600px); }
@media (min-height: 1081px) {
  .ex-cell[data-cell="storage"] .ex-media img { max-height: min(calc(100vh - 770px), 560px); }
}
/* narrow-but-tall desktop windows: the Scotty's widest corner and the
   right-anchored "back to storage" chip converge — rein the art in just
   there (the stock size already grazed the chip in this window) */
@media (min-width: 921px) and (max-width: 1460px) and (min-height: 821px) {
  .ex-cell[data-cell="conversion"] .ex-media img { max-height: min(40vh, 336px); }
}
/* the stage scales itself to the display: progressively tighten type and
   art as the viewport gets shorter so every cell always fits the screen */
@media (max-height: 1080px) {
  .ex-copy h3 { font-size: clamp(24px, 2.5vw, 38px); margin-bottom: 10px; }
  .ex-lede { font-size: 14.5px; margin-bottom: 14px; }
  .ex-chips { margin-bottom: 16px; }
  .ex-chips li { padding: 6px 10px; font-size: 11px; }
  .ex-cell[data-cell="storage"] .ex-lede { max-width: 62ch; }
}
@media (max-height: 820px) {
  .ex-media img { max-height: 40vh; }
  .ex-cell[data-cell="production"] .ex-media img,
  .ex-cell[data-cell="conversion"] .ex-media img,
  .ex-cell[data-cell="consumption"] .ex-media img { max-height: 42vh; }
  /* same corridor arithmetic with this branch's tighter copy (~360px) and
     6px gap; the floor only matters below the 560px lock threshold, where
     the page scrolls instead of clipping */
  .ex-cell[data-cell="storage"] .ex-media img { max-height: clamp(120px, calc(100vh - 620px), 460px); }
  .ex-copy h3 { font-size: clamp(21px, 2.2vw, 30px); margin-bottom: 6px; }
  .ex-lede { font-size: 13px; line-height: 1.45; margin-bottom: 10px; }
  .ex-prod { font-size: 11.5px; margin-bottom: 6px; }
  .ex-kicker { margin-bottom: 6px; }
  .ex-chips { gap: 6px; margin-bottom: 10px; }
  .ex-num { font-size: 84px; }
  .ex-cell[data-cell="storage"] .ex-inner { gap: 6px; }
}
/* below the single-screen lock threshold the page scrolls — no corridor to
   respect, so give the battery a fixed, generous size (phones get their own
   svh sizes from the width branches below, which win by file order) */
@media (max-height: 559px) {
  .ex-cell[data-cell="storage"] .ex-media img { max-height: 240px; }
}
@keyframes exfloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
/* the trimmed battery is budgeted to the pixel — a gentler bob keeps its top
   edge clear of the CTA row and its bottom clear of the drag-down prompt */
@keyframes exfloat-soft { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.ex-cell[data-cell="storage"] .ex-media img { animation-name: exfloat-soft; }
.ex-cell[data-cell="production"]   { --ac: var(--ex-production);   --mg: rgba(255,181,71,.12); }
.ex-cell[data-cell="conversion"]   { --ac: var(--ex-conversion);   --mg: rgba(255,138,61,.12); }
.ex-cell[data-cell="storage"]      { --ac: var(--ex-storage);      --mg: rgba(95,168,255,.14); }
.ex-cell[data-cell="distribution"] { --ac: var(--ex-distribution); --mg: rgba(88,176,255,.12); }
.ex-cell[data-cell="consumption"]  { --ac: var(--ex-consumption);  --mg: rgba(159,224,255,.12); }

/* cell entrance when it becomes current */
.ex-stage.ex-ready .ex-cell .ex-copy > *, .ex-stage.ex-ready .ex-cell .ex-media {
  transition: opacity .55s ease, transform .55s cubic-bezier(.2, .7, .2, 1);
}
.ex-stage.ex-ready .ex-cell:not(.is-here) .ex-copy > * { opacity: .28; transform: translateY(8px); }
.ex-stage.ex-ready .ex-cell:not(.is-here) .ex-media    { opacity: .55; }
.ex-stage.ex-ready .ex-cell.is-here .ex-copy > *  { opacity: 1; transform: none; }
.ex-stage.ex-ready .ex-cell.is-here .ex-media     { opacity: 1; }
.ex-stage.ex-ready .ex-cell.is-here .ex-copy > *:nth-child(2) { transition-delay: .06s; }
.ex-stage.ex-ready .ex-cell.is-here .ex-copy > *:nth-child(3) { transition-delay: .1s; }
.ex-stage.ex-ready .ex-cell.is-here .ex-copy > *:nth-child(4) { transition-delay: .14s; }
.ex-stage.ex-ready .ex-cell.is-here .ex-copy > *:nth-child(5) { transition-delay: .18s; }
.ex-stage.ex-ready .ex-cell.is-here .ex-copy > *:nth-child(6) { transition-delay: .22s; }

/* =============================================================================
   3. HUD — journey rail, prev/next, onboarding hint
   ========================================================================== */
.ex-hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.ex-hud > * { pointer-events: auto; }

/* one-time onboarding line — visible only while the attract-loop wiggle plays */
.ex-hint {
  position: absolute; top: 66px; left: 50%; transform: translate(-50%, -6px);
  z-index: 11;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: #cfe2fa; background: rgba(9,18,34,.7); border: 1px solid rgba(140,175,220,.35);
  border-radius: 100px; padding: 8px 16px; backdrop-filter: blur(8px); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .5s ease, transform .5s ease;
}
.ex-hint.show { opacity: 1; transform: translate(-50%, 0); }

/* journey rail — a persistent, clickable stepper. Numbering earns its place
   here: this really is a fixed five-step sequence, not five separate pages,
   so 01–05 tells a visitor exactly where the tour is right now. */
.ex-rail {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 11; display: flex; align-items: center; gap: 4px;
  background: rgba(9,18,34,.66); border: 1px solid rgba(140,175,220,.3);
  border-radius: 100px; padding: 7px 8px; backdrop-filter: blur(8px);
  max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none;
}
.ex-rail::-webkit-scrollbar { display: none; }
.ex-rail-step {
  display: flex; align-items: center; gap: 6px; flex: none;
  background: none; border: 0; cursor: pointer; border-radius: 100px;
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .07em;
  padding: 7px 10px; color: var(--ex-mut); white-space: nowrap;
  transition: color .18s ease, background-color .18s ease;
}
.ex-rail-step:hover { color: #cfe2fa; }
.ex-rail-step .rn { font-size: 9.5px; opacity: .7; }
.ex-rail-step .rl { font-size: 11px; }
.ex-rail-step[aria-current="true"] { color: #fff; background: rgba(150,185,230,.16); }
.ex-rail-step[aria-current="true"] .rn { color: var(--pc, #5fa8ff); opacity: 1; }
.ex-rail-line { width: 12px; height: 1px; background: rgba(140,175,220,.32); flex: none; }

/* prev / next — one destination-based control, planted near the content
   instead of the screen edges. Only "previous"/"next" ever exist: the story
   is a straight line now, so there's nothing else to offer. */
.ex-nav {
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 11; display: flex; align-items: center; gap: 12px;
  max-width: calc(100vw - 24px);
}
.ex-prev, .ex-next {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  background: rgba(9,18,34,.62); border: 1px solid rgba(140,175,220,.3); border-radius: 100px;
  padding: 10px 16px; color: var(--ex-dim); backdrop-filter: blur(8px); transition: .16s;
}
.ex-prev:hover, .ex-next:hover { color: #fff; border-color: rgba(180,210,245,.6); }
.ex-prev[hidden], .ex-next[hidden] { display: none; }
.ex-prev .chev, .ex-next .chev { width: 16px; height: 16px; color: var(--gc, #9db8da); flex: none; }
.ex-prev .nt, .ex-next .nt { display: flex; flex-direction: column; }
.ex-next .nt { align-items: flex-end; }
.ex-prev .n1, .ex-next .n1 { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: inherit; }
.ex-prev .n2, .ex-next .n2 { font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; color: #dfeafa; }
.ex-prev .chev { animation: nudge-w 2s ease-in-out infinite; }
.ex-next .chev { animation: nudge-e 2s ease-in-out infinite; }
@keyframes nudge-w { 0%,100% { transform: translateX(2px);  opacity:.6; } 50% { transform: translateX(-3px); opacity:1; } }
@keyframes nudge-e { 0%,100% { transform: translateX(-2px); opacity:.6; } 50% { transform: translateX(3px);  opacity:1; } }

.ex-keys {
  position: absolute; left: 22px; bottom: 20px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ex-mut);
  display: flex; gap: 8px; align-items: center;
}
.ex-keys .k { border: 1px solid rgba(140,175,220,.32); border-radius: 5px; padding: 2px 6px; color: var(--ex-dim); }

/* "keep going" edge cue — the current domain's accent bleeds faintly up from
   the bottom edge, standing in for a literal peek at the next section (the
   3×3 grid is hand-tuned to fill the stage edge-to-edge; resizing cells to
   show a sliver of the neighbour risks that maths — see energy.js CELLS).
   Fades out entirely once there's nowhere further to go. */
.ex-stage.ex-ready::after {
  content: ""; position: absolute; z-index: 9; left: 0; right: 0; bottom: 0; height: 130px;
  background: linear-gradient(to top, var(--dm, var(--ex-storage)) 0%, transparent 100%);
  opacity: .14; pointer-events: none; transition: opacity .5s ease;
}
.ex-stage.ex-ready.ex-at-end::after { opacity: 0; }

/* =============================================================================
   4. FALLBACK / MOBILE — vertical story with a live bus down the page
   ========================================================================== */
.ex-stage:not(.ex-ready) .ex-cell { min-height: min(94svh, 860px); border-bottom: 1px solid rgba(126,160,205,.10); }
.ex-stage:not(.ex-ready) .ex-cell:last-of-type { border-bottom: 0; }
.ex-stage:not(.ex-ready) .ex-hud .ex-rail,
.ex-stage:not(.ex-ready) .ex-hud .ex-nav,
.ex-stage:not(.ex-ready) .ex-hud .ex-hint,
.ex-stage:not(.ex-ready) .ex-skip,
.ex-stage:not(.ex-ready) .ex-keys { display: none; }
.ex-stage:not(.ex-ready) .ex-head, .ex-stage:not(.ex-ready) .ex-skip { position: absolute; }
.ex-stage.ex-flow .ex-cell { scroll-snap-align: start; }

@media (max-width: 920px) {
  .ex-inner, .ex-cell[data-cell="distribution"] .ex-inner { grid-template-columns: 1fr; gap: 14px; }
  .ex-cell[data-cell="distribution"] .ex-copy { order: 2; } /* media stays first */
  .ex-media { order: 1; }
  .ex-copy { order: 2; }
  .ex-media img { max-height: 34svh; }
  /* stacked cells put copy + art in one column — rein the hero sizes in */
  .ex-cell[data-cell="production"] .ex-media img,
  .ex-cell[data-cell="conversion"] .ex-media img,
  .ex-cell[data-cell="consumption"] .ex-media img { max-height: 36svh; }
  .ex-cell[data-cell="storage"] .ex-media img { max-height: 30svh; }
  /* stacked cells leave no clear lanes for floating chips — the in-cell
     spec chips carry that info; wires + ports still tell the story */
  .ex-wlabel, .ex-stubs { display: none; }
  /* the wire lane owns the top-left margin on stacked layouts, so the
     ghost numeral moves to the bottom-left corner, which no route crosses */
  .ex-num { font-size: 96px; top: auto; bottom: 10px; left: 42px; }
  /* keep copy clear of the lane (line + glow) that runs down the left edge */
  .ex-cell { padding-left: clamp(40px, 6vw, 56px); }
}
/* only the stacked layout AND a short window together starve the budget —
   conversion's extra (6th) chip row rides into the DRAG hint there unless
   its stacked photo gives back the room; everything above 820px tall
   already clears, so keep this scoped and leave the siblings alone */
@media (max-width: 920px) and (max-height: 820px) {
  .ex-cell[data-cell="conversion"] .ex-media img { max-height: 26svh; }
}

/* phones — the same universe, compacted so every cell fits the locked screen */
@media (max-width: 700px) {
  /* extra left padding reserves the wire lane — no copy ever sits under it */
  .ex-cell { padding: 12px 18px 12px 34px; }
  .ex-media img { max-height: 26svh; }
  .ex-cell[data-cell="production"] .ex-media img,
  .ex-cell[data-cell="conversion"] .ex-media img,
  .ex-cell[data-cell="consumption"] .ex-media img { max-height: 28svh; }
  .ex-cell[data-cell="storage"] .ex-media img { max-height: 26svh; }
  .ex-copy h3 { font-size: clamp(19px, 5.6vw, 24px); margin-bottom: 8px; }
  .ex-kicker { font-size: 10px; margin-bottom: 6px; }
  .ex-prod { font-size: 10.5px; margin-bottom: 8px; }
  .ex-lede { font-size: 12.5px; line-height: 1.5; margin-bottom: 10px; }
  .ex-chips { gap: 5px; margin-bottom: 12px; }
  .ex-chips li { padding: 5px 8px; font-size: 9.5px; }
  .ex-ctas { gap: 8px; }
  .ex-ctas .btn { padding: 10px 14px; font-size: 13px; }
  .ex-num { font-size: 64px; bottom: 8px; }
  .ex-keys { display: none; }
  /* journey rail shrinks to bare numbers, clear of the content */
  .ex-rail { top: 10px; padding: 6px; gap: 2px; }
  .ex-rail-step { padding: 6px 7px; gap: 0; }
  .ex-rail-step .rl { display: none; }
  .ex-rail-line { width: 7px; }
  /* prev/next collapse to icon pills so they never sit on the copy */
  .ex-nav { bottom: 14px; gap: 10px; }
  .ex-prev, .ex-next { padding: 9px; gap: 0; }
  .ex-prev .nt, .ex-next .nt { display: none; }
  .ex-prev .chev, .ex-next .chev { width: 15px; height: 15px; }
}

/* =============================================================================
   5. Motion safety
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .sysmap-nodes::after, .sysmap-cap .scroll-cue svg, .sysnode--core::before,
  .ex-wires .wflow, .ex-wires .wglow, .ex-wires .wstub, .ex-media img, .ex-port::after,
  .ex-prev .chev, .ex-next .chev, .ex-cell[data-cell="storage"] .ex-media::before { animation: none !important; }
  .ex-stage.ex-ready .ex-world.ex-spring { transition-duration: .2s; }
  /* packets are built only when motion is allowed (energy.js checks too);
     a frozen surge bar would read as a broken line — hide both outright */
  .ex-wires .wdot, .ex-wires .wpacket, .ex-wires .wsurge { display: none; }
}
