/* The Engine section, as the owner asked for it on 2026-10-09: the card is
   CORE ORION; its three panels read as one night — your files arrive in the
   evening, Orion works through them overnight, the briefing is ready in the
   morning — with a pulse of light running along the wires in that order; and
   the four add-on modules sit below the core, each plugged up into its bottom
   edge, each opening a panel about itself. The card, its columns and its
   wires are story.css and js/wires.js; the modules' panel is js/engine-modules.js. */

/* ---- Core Orion: the card's own title ---- */
.core-head {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4);
  padding: var(--s-2) var(--s-6) var(--s-4); border-block-end: 1px solid var(--line);
}
.core-tag {
  display: inline-flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4);
  border-radius: var(--r-pill); background: var(--navy); color: var(--white);
  font-size: var(--fs-micro); font-weight: 500; letter-spacing: var(--ls-caps); text-transform: uppercase;
}
.core-head p { flex: 1 1 18rem; margin: 0; font-size: var(--fs-small); color: var(--mutek); line-height: var(--lh-snug); }

/* ---- one header per panel: when, then what happens. Out of flow, at the
   same height in all three (story.css keeps the room above each card) ---- */
.panel-head {
  position: absolute; inset-block-start: var(--s-5); inset-inline: var(--s-4); margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: var(--s-1); text-align: center;
}
.panel-when {
  display: inline-flex; align-items: center; gap: var(--s-1); color: var(--wire);
  font-size: var(--fs-micro); font-weight: 500; letter-spacing: var(--ls-caps); text-transform: uppercase;
}
.panel-head b { font-size: var(--fs-body); font-weight: 500; color: var(--carbon); line-height: var(--lh-snug); }
/* the systems the files come from, inside the file card */
.ledger-from { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-3) 0 0; font-size: var(--fs-caption); color: var(--mutek); }
.ledger-from b {
  padding: var(--s-1) var(--s-2); border: 1px solid #0000001a; border-radius: var(--r-sm); background: #fff;
  font-size: var(--fs-caption); font-weight: 500; color: var(--carbon);
}

/* ---- the nightly run: four steps on one line, lit in turn, then a light that keeps running down it ---- */
.run-steps { list-style: none; margin: 0; padding: var(--s-1) 0; }
.run-steps li {
  position: relative; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) auto; align-items: center;
  column-gap: var(--s-3); padding: var(--s-2) var(--s-4);
}
/* the line, through every node: from the first node's centre to the last's */
.run-steps li::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: calc(var(--s-4) + 1.125rem - 1px);
  inline-size: 2px; background: #2a859333;
}
.run-steps li:first-child { --from: 50%; }
.run-steps li:last-child { --to: 50%; }
.run-steps li:first-child::before { inset-block-start: 50%; }
.run-steps li:last-child::before { inset-block-end: 50%; }
.run-node {
  position: relative; z-index: 1; display: grid; place-items: center; inline-size: 2.25rem; block-size: 2.25rem;
  border-radius: 50%; background: var(--wire); color: var(--white); box-shadow: 0 0 0 4px #fff;
}
.run-text { display: grid; gap: 2px; min-inline-size: 0; }
.run-text b { font-size: var(--fs-small); font-weight: 500; color: var(--carbon); line-height: var(--lh-snug); }
.run-text small { font-size: var(--fs-caption); color: var(--mutek); line-height: var(--lh-snug); }
.run-tick { display: grid; color: var(--found); }
/* the light: one dot per step's stretch of the line, each taking its turn */
.run-steps li::after {
  content: ""; position: absolute; z-index: 2; inset-inline-start: calc(var(--s-4) + 1.125rem - 3px);
  inline-size: 6px; block-size: 6px; border-radius: 50%; background: var(--wire);
  box-shadow: 0 0 8px 2px #2a8593aa; opacity: 0;
}
/* the pulse on the wires, drawn by js/wires.js as a second path over each one */
.lv-flow {
  stroke: #9fe3ea; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 0.12 1.3; stroke-dashoffset: 0.12;
  opacity: 0; filter: drop-shadow(0 0 3px #2a8593);
}

/* ---- the add-on modules: below the core, each plugged up into its bottom edge ---- */
.mods { position: relative; z-index: 3; margin-block-start: var(--s-10); }
.mods-tag {
  position: absolute; inset-block-end: calc(100% + var(--s-10)); inset-inline: 0; translate: 0 50%;
  display: flex; align-items: center; gap: var(--s-1); inline-size: max-content; margin: 0 auto;
  padding: var(--s-1) var(--s-3); border: 1px dashed var(--wire); border-radius: var(--r-pill);
  background: var(--white); color: var(--wire);
  font-size: var(--fs-micro); font-weight: 500; letter-spacing: var(--ls-caps); text-transform: uppercase;
}
.mods-tag span { font-size: var(--fs-small); line-height: 1; }
/* dense: the module panel takes a whole row right after the module it
   explains, and the rest of that module's row moves back up beside it */
.mods-row {
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: row dense; gap: var(--s-4);
}
.mod {
  position: relative; border: 1px dashed #2a859380; border-radius: var(--r-md); background: var(--white);
  box-shadow: var(--shadow-soft); transition: translate 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.mod-open {
  all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start;
  row-gap: var(--s-1); column-gap: var(--s-3); inline-size: 100%; block-size: 100%; padding: var(--s-4);
  border-radius: inherit; cursor: pointer;
}
.mod-open:focus-visible { outline: 2px solid var(--wire); outline-offset: 2px; }
.mod-open b { grid-column: 1; padding-inline-end: var(--s-6); font-size: var(--fs-small); font-weight: 500; color: var(--carbon); line-height: var(--lh-snug); }
.mod-open small { grid-column: 1; font-size: var(--fs-caption); color: var(--mutek); line-height: var(--lh-snug); }
.mod-open .seat-dots { grid-column: 2; grid-row: 2; padding-block-start: var(--s-1); }
.mod-plus {
  position: absolute; inset-block-start: var(--s-3); inset-inline-end: var(--s-3); display: grid; place-items: center;
  inline-size: 1.25rem; block-size: 1.25rem; border-radius: 50%; background: #e5f0f5; color: var(--wire);
  font-size: var(--fs-small); font-weight: 500; line-height: 1; transition: rotate 0.25s ease, background 0.25s ease, color 0.25s ease;
}
/* the plug: a line up into the core's bottom edge, ending in a socket in the
   colours of the specialists whose data the module uses */
.mod::before {
  content: ""; position: absolute; inset-block-end: 100%; inset-inline: 0; margin-inline: auto;
  inline-size: 2px; block-size: calc(var(--s-10) + 1px); background: var(--wire); transform-origin: bottom;
}
.mod::after {
  content: ""; position: absolute; inset-block-end: calc(100% + var(--s-10) - 0.3125rem); inset-inline: 0; margin-inline: auto;
  inline-size: 0.75rem; block-size: 0.75rem; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--wire);
  background: linear-gradient(90deg, var(--c1) 50%, var(--c2) 50%);
}
.mod:hover, .mod.is-open { border-style: solid; border-color: var(--wire); box-shadow: var(--shadow-card); }
.mod:hover { translate: 0 -2px; }
.mod.is-open .mod-plus { rotate: 45deg; background: var(--wire); color: var(--white); }
.mod.is-open::after { box-shadow: 0 0 0 1px var(--wire), 0 0 0 6px #2a859333; }

/* ---- a module's panel ---- */
.mod-detail {
  position: relative; grid-column: 1 / -1; padding: var(--s-6); border: 1px solid var(--wire);
  border-radius: var(--r-card); background: var(--white); box-shadow: var(--shadow-card);
}
/* the notch points at the module it explains (--notch is set by js/engine-modules.js) */
.mod-detail::before {
  content: ""; position: absolute; inset-block-start: -0.4375rem; inset-inline-start: calc(var(--notch, 50%) - 0.4375rem);
  inline-size: 0.875rem; block-size: 0.875rem; border-block-start: 1px solid var(--wire); border-inline-start: 1px solid var(--wire);
  background: var(--white); rotate: 45deg;
}
.mod-close {
  position: absolute; inset-block-start: var(--s-3); inset-inline-end: var(--s-3); display: grid; place-items: center;
  inline-size: 2rem; block-size: 2rem; border: 0; border-radius: 50%; background: #e5f0f5; color: var(--wire); cursor: pointer;
}
.mod-detail-head { max-inline-size: 46rem; padding-inline-end: var(--s-10); }
.mod-from { margin: 0 0 var(--s-1); font-size: var(--fs-caption); color: var(--mutek); }
.mod-from em { font-style: normal; font-weight: 500; }
.mod-detail-head h3 { margin: 0; font-size: var(--fs-h3); font-weight: 500; line-height: var(--lh-heading); }
.mod-pitch { margin: var(--s-2) 0 0; font-size: var(--fs-body-lg); color: var(--slate); line-height: var(--lh-body); text-wrap: pretty; }
.mod-cols {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-6);
  margin-block-start: var(--s-6); padding-block-start: var(--s-6); border-block-start: 1px solid var(--line);
}
.mod-cols h4 {
  margin: 0 0 var(--s-2); color: var(--wire);
  font-size: var(--fs-micro); font-weight: 500; letter-spacing: var(--ls-caps); text-transform: uppercase;
}
.mod-cols p { margin: 0; font-size: var(--fs-small); color: var(--slate); line-height: var(--lh-body); }
.mod-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4);
  margin-block-start: var(--s-6); padding-block-start: var(--s-4); border-block-start: 1px solid var(--line);
}
.mod-foot ul { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.mod-foot li {
  padding: var(--s-1) var(--s-3); border-radius: var(--r-pill); background: #e5f0f5; color: var(--wire);
  font-size: var(--fs-caption); font-weight: 500;
}

/* ---- the motion, in the story's order. The reduced-motion rule in
   responsive.css switches all of it off, and the pulses stay unseen ---- */
@keyframes run-on { from { background: #e5f0f5; color: var(--wire); scale: 0.9; } }
@keyframes run-tick { from { opacity: 0; scale: 0.4; } }
@keyframes run-light {
  0% { inset-block-start: var(--from, 0%); opacity: 1; }
  12.4% { inset-block-start: var(--to, 100%); opacity: 1; }
  12.5%, 100% { opacity: 0; }
}
@keyframes lv-flow {
  0% { stroke-dashoffset: 0.12; opacity: 1; }
  16% { stroke-dashoffset: -1; opacity: 1; }
  16.1%, 100% { stroke-dashoffset: -1; opacity: 0; }
}
@keyframes mod-rise { from { opacity: 0; translate: 0 1rem; } }
@keyframes mod-wire { from { scale: 1 0; } }
@keyframes mod-click { from { scale: 0; } 60% { scale: 1.6; } }
@keyframes mod-fade { from { opacity: 0; } }
@keyframes mod-open { from { opacity: 0; translate: 0 -0.5rem; } }
/* the run lights up, step by step, once the wires are drawn (story.css) */
html.anim-armed .levels.is-revealed .run-node { animation: run-on 0.35s ease calc(1.2s + var(--i) * 0.45s) backwards; }
html.anim-armed .levels.is-revealed .run-tick { animation: run-tick 0.3s ease-out calc(1.4s + var(--i) * 0.45s) backwards; }
/* then ONE 4.8s cycle, for good: into the run (0-0.8s), down its four steps
   (0.8-3.2s), out to the council (3.2-4s), and a breath */
html.anim-armed .levels.is-revealed .lv-flow-in { animation: lv-flow 4.8s linear 4.2s infinite; }
html.anim-armed .levels.is-revealed .run-steps li::after { animation: run-light 4.8s linear calc(5s + var(--i) * 0.6s) infinite; }
html.anim-armed .levels.is-revealed .lv-flow-out { animation: lv-flow 4.8s linear 7.4s infinite; }
/* and the modules rise and plug in once the core has built */
html.anim-armed .levels.is-revealed .mods-tag { animation: mod-fade 0.5s ease 2.6s backwards; }
html.anim-armed .levels.is-revealed .mod { animation: mod-rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) calc(2.8s + var(--i) * 0.18s) backwards; }
html.anim-armed .levels.is-revealed .mod::before { animation: mod-wire 0.3s ease-out calc(3.2s + var(--i) * 0.18s) backwards; }
html.anim-armed .levels.is-revealed .mod::after { animation: mod-click 0.35s ease-out calc(3.45s + var(--i) * 0.18s) backwards; }
html.anim-armed .mod-detail:not([hidden]) { animation: mod-open 0.3s ease; }

/* ---- narrower ---- */
@media (max-width: 1279px) { .mod-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* three narrow columns on a laptop: the run keeps its four steps and its
   light, and drops the second lines and the ticks */
@media (min-width: 992px) and (max-width: 1279px) {
  .run-steps li { grid-template-columns: 1.75rem minmax(0, 1fr); column-gap: var(--s-2); padding-inline: var(--s-3); }
  .run-node { inline-size: 1.75rem; block-size: 1.75rem; }
  .run-steps li::before { inset-inline-start: calc(var(--s-3) + 0.875rem - 1px); }
  .run-steps li::after { inset-inline-start: calc(var(--s-3) + 0.875rem - 3px); }
  .run-text small, .run-tick { display: none; }
}
/* one column of core: the modules sit in a grid below it, unplugged, the tag on the card's edge */
@media (max-width: 991px) {
  .mods { margin-block-start: var(--s-8); }
  .mods-tag { inset-block-end: calc(100% + var(--s-8)); }
  .mods-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mod::before, .mod::after { display: none; }
  .core-head { padding-inline: var(--s-4); }
}
@media (max-width: 599px) {
  .mods-row, .mod-cols { grid-template-columns: minmax(0, 1fr); }
  .mod-detail { padding: var(--s-4); }
  .mod-detail::before { display: none; }
}
