/* Ephor — the shift (the chain) and the engine levels. */

/* the shell (tokens.css): panels span it, text runs on its inset line */
.shift-inner, .levels, .ask, .faq > * {
  inline-size: var(--shell); margin-inline: auto;
}
.shift-inner, .faq > *, .levels-head, .ask-head { padding-inline: var(--inset); }

/* ---- the shift ---- */
.shift { position: relative; padding-block: var(--section-pad); isolation: isolate; }
.shift-scenery {
  position: absolute; inset-block-start: 0; inset-inline-end: 0;
  inline-size: 44.875rem; max-inline-size: 60%; block-size: 29.9375rem; opacity: 0.92;
  background:
    linear-gradient(90deg, #fff 28%, #ffffffd9 55%, #ffffff00 88%) 0 0/100% 100%,
    linear-gradient(#ffffff00 50%, #fff 97%) 0 0/100% 100%,
    url("../assets/img/shift-scenery.webp") right center/cover;
  pointer-events: none; z-index: -1;
}
.shift-header { position: relative; z-index: 1; }
/* the one lede of two paragraphs: the section-head's lede, as a block */
.shift-lede { max-inline-size: var(--measure); color: var(--mutek); font-size: var(--fs-lede); line-height: var(--lh-body); }
.shift-lede p { margin-block-end: var(--s-4); }
.shift-lede strong { font-weight: 500; color: var(--carbon); }

/* ---- the chain: one event, six symptoms (owner, 2026-10-07) ----
   Replaces the before/after slides, which read as a copy of thor.ai's. It is
   the Orion film's convergence (site/index.html, act 09), told in the order
   Orion reasons — web/src/lib/agents.js CHAIN, held by
   web/tests/ephorPage.test.js — each number beside the excuse it got in its
   own meeting. A light pulse walks the line, the film's motion. */
.chain { position: relative; z-index: 1; }
/* a lead-in, not a title: the lede's size and its two inks, the dark words
   first. At the card-title size it read as a second heading (owner,
   2026-10-08: "it looks weird and big") */
.chain-intro { margin: 0 0 var(--s-5); max-inline-size: var(--measure); font-size: var(--fs-lede); font-weight: 500; line-height: var(--lh-body); }
.chain-intro span { font-weight: 400; color: var(--mutek); }
/* inline text, not flex: on a phone a flex row split "The event:" into a
   column of its own beside the sentence */
.chain-cause {
  display: inline-block; margin: 0 0 var(--s-10); padding: var(--s-2) var(--s-4);
  border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--paper); font-size: var(--fs-body);
}
.chain-cause i {
  display: inline-block; vertical-align: middle; inline-size: 0.5rem; block-size: 0.5rem;
  margin-inline-end: var(--s-2); border-radius: 50%; background: var(--navy);
}
.chain-steps {
  position: relative; list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-6);
}
/* the line the six sit on, and the pulse that walks it (symmetric, so it
   needs no writing direction) */
.chain-steps::before, .chain-steps::after {
  content: ""; position: absolute; inset-block-start: 0.45rem; pointer-events: none;
}
.chain-steps::before { inset-inline: 0.45rem; block-size: 2px; margin-block-start: -1px; background: #16294e26; }
.chain-steps::after {
  inset-inline-start: 0; inline-size: 9%; block-size: 4px; margin-block-start: -2px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, #16294e00, #16294eb3, #16294e00);
  animation: chain-walk 5.7s linear infinite;
}
@keyframes chain-walk { to { inset-inline-start: 91%; } }
.chain-step { position: relative; display: flex; flex-direction: column; gap: var(--s-2); }
.chain-node {
  position: relative; z-index: 1; inline-size: 0.9rem; block-size: 0.9rem; margin-block-end: var(--s-2);
  border: 2px solid var(--c); border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px var(--white);
}
.chain-seat { margin: 0; font-size: var(--fs-micro); font-weight: 600; letter-spacing: var(--ls-caps); color: var(--c); }
.chain-seat span { font-weight: 500; letter-spacing: normal; color: var(--grey); }
.chain-figure {
  margin: 0; font-size: var(--fs-title); font-weight: 500; letter-spacing: var(--ls-heading); line-height: var(--lh-tight);
  color: var(--navy); white-space: nowrap; unicode-bidi: isolate;
}
.chain-what { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--slate); }
.chain-excuse { margin-block-start: auto; font-size: var(--fs-small); line-height: var(--lh-body); }
/* each excuse is something the reader has heard in their own meetings
   (owner, 2026-10-17): a speech bubble in its seat's tint, opened by who said
   it — "Your workshop" — and pointing up at the figure it explained away.
   Inside the excuse's own row, so the subgrid below still lines the six up */
.chain-excuse {
  position: relative; display: flex; flex-direction: column; gap: var(--s-1);
  padding: var(--s-3); border-radius: var(--r-md); color: var(--slate);
  background: color-mix(in srgb, var(--c) 9%, var(--white));
}
.chain-excuse::before {
  content: ""; position: absolute; inset-block-start: calc(var(--s-3) / -2); inset-inline-start: var(--s-4);
  inline-size: var(--s-3); block-size: var(--s-3); border-radius: 1px; rotate: 45deg;
  background: color-mix(in srgb, var(--c) 9%, var(--white));
}
.chain-by { font-size: var(--fs-micro); font-weight: 600; color: var(--c); }
/* the chain's conclusion, sized to its words like the event pill that opens
   it: full width, with the words held to the measure, it left a third of
   the band empty (owner, 2026-10-08: "why so much empty space?") */
.chain-close {
  display: flex; align-items: center; gap: var(--s-4); margin-block-start: var(--s-12);
  inline-size: fit-content; max-inline-size: 100%;
  padding: var(--s-5) var(--s-6); border-radius: var(--r-panel); background: var(--navy); color: var(--on-navy);
}
.chain-close p { margin: 0; max-inline-size: var(--measure); font-size: var(--fs-body-lg); line-height: var(--lh-body); }
.chain-close b { font-weight: 500; color: var(--white); }
.chain-close strong { font-weight: 600; color: var(--white); unicode-bidi: isolate; }
.chain-close .belt { flex: none; }

/* entrance: the six arrive in the order Orion reads them */
.chain-step {
  transition: opacity 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) calc(var(--i, 0) * 120ms + 150ms),
              translate 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) calc(var(--i, 0) * 120ms + 150ms);
}
html.anim-armed.reveals-armed .shift:not(.is-revealed) .chain-step { opacity: 0; translate: 0 1rem; }

/* mid widths: three across, two rows — a line through two rows would read as
   two chains, so the nodes stand alone and the order carries the chain */
@media (min-width: 768px) and (max-width: 1199px) {
  .chain-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: var(--s-10); }
  .chain-steps::before, .chain-steps::after { display: none; }
}
/* a phone: the six stack, the line running down their start side */
@media (max-width: 767px) {
  .chain-steps { grid-template-columns: minmax(0, 1fr); gap: var(--s-8); padding-inline-start: var(--s-10); }
  .chain-steps::before { inset-inline: 0.45rem auto; inset-block: 0.45rem; inline-size: 2px; block-size: auto; margin: 0; margin-inline-start: -1px; }
  .chain-steps::after { display: none; }
  .chain-node { position: absolute; inset-inline-start: -2.25rem; inset-block-start: 0; margin: 0; }
  .chain-excuse { margin-block-start: var(--s-2); }
}

/* side by side, each step's five lines share the row's tracks, so the six
   excuses start on one line however long the words above them run. The
   list's own row gap becomes the steps' line gap (a subgrid keeps its
   parent's gutters), and the second row of three steps its room itself.
   After the width rules above: same specificity, so source order decides. */
@supports (grid-template-rows: subgrid) {
  @media (min-width: 768px) {
    .chain-steps { row-gap: var(--s-2); }
    .chain-step { display: grid; grid-row: span 5; grid-template-rows: subgrid; }
    .chain-excuse { margin-block-start: var(--s-2); }
  }
  @media (min-width: 768px) and (max-width: 1199px) {
    .chain-step:nth-child(n + 4) .chain-node { margin-block-start: var(--s-8); }
  }
}

/* ---- the engine levels ---- */
.levels { padding-block: var(--section-pad); }
.levels-card {
  /* minmax(0,…) — a bare 1fr floors at the track's min-content width, and the
     ledger card inside is wide enough to push the column past the card edge */
  position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4); overflow: hidden; padding: var(--s-4);
  border: 1px solid #0000001a; border-radius: var(--r-card); background: #fff;
  box-shadow: var(--shadow-card);
}
.levels-wires { z-index: 2; pointer-events: none; position: absolute; inset: 0; }
.levels-wires svg { position: absolute; inset-block-start: 0; inset-inline-start: 0; display: block; }
/* The DRAWN state is the default and the animation runs FROM hidden (backwards
   fill covers the delay). Gating visibility on the animation instead meant a
   tab that never ran it — backgrounded, throttled — showed no wires at all. */
.levels.is-revealed .lv-wire {
  stroke-dasharray: 1; stroke-dashoffset: 0;
  animation: lv-draw 0.9s ease 0.9s backwards;
}
.levels.is-revealed .lv-nodes { opacity: 1; animation: lv-nodes-in 0.4s ease 1.4s backwards; }
@keyframes lv-draw { from { stroke-dashoffset: 1px; } }
.levels-col { position: relative; z-index: 1; padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-8); }
.levels-colhead { text-align: center; display: flex; flex-direction: column; gap: var(--s-2); }
.levels-coltitle { font-size: var(--fs-h3); font-weight: 500; margin: 0; line-height: var(--lh-snug); }
/* centred lines, balanced: no word left alone on the last one */
.levels-coldesc { font-size: var(--fs-body); color: var(--mutek); line-height: var(--lh-body); margin: 0; text-wrap: balance; }

/* The three column HEADS wrap to different line counts, which pushed each
   panel to a different height and left the middle card looking misaligned.
   Subgrid puts every head in one shared row, so the panels — and the cards
   the wires attach to — start on the same line. Must sit AFTER the
   .levels-col rule above: same specificity, so source order decides. The
   first row is the card's own title, CORE ORION (engine.css). */
@supports (grid-template-rows: subgrid) {
  .levels-card { grid-template-rows: auto auto 1fr; }
  .levels-col { display: grid; grid-row: 2 / span 2; grid-template-rows: subgrid; }
}
.levels-panel {
  /* the top padding is the room for the panel's header (evening, overnight,
     morning — engine.css), which sits out of flow so that each panel's card is
     the only thing centred: all three panels share it, so the cards sit on
     one line, which is what the connecting wires attach to */
  min-block-size: 24.125rem; padding: calc(var(--s-16) + var(--s-5)) var(--s-6) var(--s-6); border-radius: var(--r-md); overflow: hidden;
  position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: var(--haze) radial-gradient(120% 90% at 78% -8%, #aec3de 0%, #d5deec 37%, var(--haze) 73%);
}
.levels-col:nth-of-type(2) .levels-panel { background: var(--haze) radial-gradient(120% 90% at 78% -8%, #c8d0d7 0%, #e3e8ec 37%, var(--haze) 73%); }
.levels-col:nth-of-type(3) .levels-panel { background: var(--haze) radial-gradient(120% 90% at 78% -8%, #a0caca 0%, #d1e5e5 37%, var(--haze) 73%); }
.ledger-glass {
  max-inline-size: min(20.625rem, 100%); padding: var(--s-4); border-radius: var(--r-md);
  background: var(--glass); backdrop-filter: blur(15px); box-shadow: var(--shadow-soft);
}
.ledger-table { background: #fff; border-radius: var(--r-sm); overflow: hidden; }
.ledger-row {
  display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-3);
  border-block-end: 1px solid #0000000d; font-size: var(--fs-small); font-weight: 500; color: var(--mutek);
}
.ledger-row:last-child { border-block-end: 0; }
.ledger-row span:last-child { text-align: end; color: var(--carbon); }
.ledger-status { display: inline-flex; align-items: center; gap: var(--s-1); }
.ledger-status i { inline-size: 0.4375rem; block-size: 0.4375rem; border-radius: 50%; background: var(--green); }
.pipe-card { inline-size: 100%; max-inline-size: min(20.625rem, 100%); border-radius: var(--r-md); background: #fff; overflow: hidden; box-shadow: var(--shadow-soft); }
.pipe-pill {
  padding: var(--s-1) var(--s-2); border-radius: var(--r-xs); background: #e5f0f5; color: var(--wire);
  font-size: var(--fs-micro); font-weight: 500; text-transform: uppercase; font-style: normal;
}
.targets { inline-size: 100%; max-inline-size: 12.9375rem; display: flex; flex-direction: column; gap: var(--s-3); }
.target-row {
  display: flex; align-items: center; gap: var(--s-4); inline-size: 100%; padding: var(--s-3);
  border-radius: var(--r-card); background: #fff; font-size: var(--fs-small); font-weight: 500;
  box-shadow: var(--shadow-soft);
}
.target-row i {
  display: grid; place-items: center; flex: none; inline-size: 2.875rem; block-size: 2.875rem;
  border: 1px solid #2a85934d; border-radius: var(--r-sm); background: var(--mint); color: var(--wire);
}
html.anim-armed .levels.is-revealed .levels-col { opacity: 0; translate: 0 1.75rem; animation: levels-rise 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) forwards; }
html.anim-armed .levels.is-revealed .levels-col:nth-of-type(2) { animation-delay: 0.15s; }
html.anim-armed .levels.is-revealed .levels-col:nth-of-type(3) { animation-delay: 0.3s; }
html.anim-armed .levels.is-revealed .ledger-glass,
html.anim-armed .levels.is-revealed .pipe-card { opacity: 0; translate: 0 0.875rem; scale: 0.97; animation: levels-pop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.45s forwards; }
html.anim-armed .levels.is-revealed .targets .target-row { opacity: 0; translate: 0 0.75rem; animation: levels-target 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.5) forwards; }
html.anim-armed .levels.is-revealed .targets .target-row:nth-child(1) { animation-delay: 0.85s; }
html.anim-armed .levels.is-revealed .targets .target-row:nth-child(2) { animation-delay: 0.95s; }
html.anim-armed .levels.is-revealed .targets .target-row:nth-child(3) { animation-delay: 1.05s; }
@keyframes levels-rise { to { opacity: 1; translate: 0 0; } }
@keyframes levels-pop { to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes levels-target { to { opacity: 1; translate: 0 0; } }
@keyframes levels-fade { to { opacity: 1; } }
@keyframes lv-nodes-in { from { opacity: 0; } }

