/* console.css — styles for the landing page's console (index.qmd + console.js). Hand-maintained.
   Colors are tokens so one drawing works on both of the theme's grounds: the light values sit on
   :root and body.quarto-dark redefines the ones that change. The theme toggles that class itself. */

:root {
  --c-ink: #262c2d;
  --c-ink-2: #4f5856;
  --c-muted: #6c7578;
  --c-rule: #dcd9d2;
  --c-card: #ece9e1;
  --c-panel: #a9b5aa;
  --c-panel-2: #8d9b90;
  --c-panel-3: #5b6a68;
  --c-panel-edge: #3b4745;
  --c-label: #23302e;
  --c-mustard: #c8a23c;
  --c-mustard-2: #e4c25a;
  --c-mustard-3: #8f7228;
  --c-rose: #c49a95;
  --c-part-research: #8b719b;
  --c-part-reference: #718795;
  --c-red: #c4463f;
  --c-blue: #34568b;
  --c-blue-2: #5a7cb0;
  --c-olive: #7c8a3a;
  --c-metal: #98a3a8;
  --c-metal-2: #6e7a80;
  --c-metal-3: #4a555a;
  --c-plate: #b7c0c4;
  --c-hat-fedora: #55635b;
  --c-hat-fedora-2: #6f7f76;
  --c-hat-band: #8f7228;
  --c-hat-bowler: #4a5358;
  --c-hat-bowler-2: #626b70;
  --c-sole: #1f2424;
  --c-shirt: #dcb8b2;   /* dusty rose contrasts with the paper ground */
  --c-screen: #0f1a14;
  --c-phosphor: #9fd8a8;
  --c-glass: rgba(90, 124, 176, 0.18);
  --c-glow: rgba(200, 162, 60, 0.55);
  --c-paper: #f7f4ec;
  --c-ground: #f7f4ec;
  --c-console-inscription: #f7f4ec;
  --c-focus: #c8a23c;
  --c-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
body.quarto-dark {
  --c-ink: #e6e9ed;
  --c-ink-2: #c4cbd3;
  --c-muted: #9aa5b5;
  --c-part-research: #c76d7f;
  --c-part-reference: #9aaebb;
  --c-rule: #2b333c;
  --c-card: #1d232b;
  --c-panel: #6f7d74;
  --c-panel-2: #566359;
  --c-panel-3: #38443f;
  --c-panel-edge: #1d2523;
  --c-label: #0f1513;
  --c-olive: #a8b455;
  --c-red: #d9534c;
  --c-metal: #8d989d;
  --c-plate: #aab3b7;
  --c-hat-fedora: #7c8d83;
  --c-hat-fedora-2: #94a49a;
  --c-hat-band: #c8a23c;
  --c-hat-bowler: #8a949a;
  --c-hat-bowler-2: #a3adb2;
  --c-sole: #2b3336;
  --c-paper: #e9e4d8;
  --c-glass: rgba(143, 176, 224, 0.16);
  --c-ground: #14181e;
  --c-console-inscription: #bbc4c1;
  --c-shirt: #efe9d8;   /* dark keeps the cream, which reads well on the dark ground */
}

/* The landing page uses page-layout: custom, which drops the theme's grid, so the wrapper sets the
   width itself: the navbar container's 1368px box with its 28px padding, like the training index. */
.console-page { max-width: 1368px; margin: 0 auto; padding: 1rem 28px 2rem; }
body:has(.console-page) #title-block-header { display: none; }   /* the title lives in the readout */
.console-scene svg { display: block; width: 100%; height: auto; max-width: 100%; }

/* ---- the speech bubble, and the readout in it ----
   The readout sits in a foreignObject in the bubble, so its type scales with the drawing. Below 760px that is too
   small to read, and console.js moves the readout out under the scene, where it is a card again. */
#bubble .bubble-shape { fill: var(--c-card); stroke: var(--c-muted); stroke-width: 2; stroke-linejoin: round; transition: stroke .15s; }
#bubble:has(#readout[data-preview="1"]) .bubble-shape { stroke: var(--c-mustard); }
#bubble foreignObject { pointer-events: none; }
#bubble a { pointer-events: auto; }
#bubble-home { display: flow-root; font-family: Montserrat, Questrial, sans-serif; color: var(--c-ink); }

.console-readout {
  background: var(--c-card);
  border: 1px solid var(--c-rule);
  border-radius: 6px;
  padding: 18px 26px 18px;
  margin-top: 6px;
}
.console-readout[data-preview="1"] { border-color: var(--c-mustard); }
.console-readout .eyebrow {
  font-family: var(--c-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--c-muted); display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.console-readout .eyebrow i {
  width: 10px; height: 10px; border-radius: 50%; background: var(--dot, var(--c-mustard));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--c-mustard)) 25%, transparent);
}
.console-readout h1, .console-readout h2 {
  font-size: 1.45rem; line-height: 1.2; margin: 0 0 8px; padding: 0; border: 0; text-wrap: balance; color: var(--c-ink);
}
.console-readout h2 .n { color: var(--c-mustard); margin-right: 0.35em; }
.console-readout p { margin: 0 0 6px; color: var(--c-ink-2); }
.console-readout .intro p.how b { color: var(--c-ink); font-weight: 600; }
.console-readout .main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 28px; }
.console-readout .main p { flex: 1 1 40ch; }
.console-readout .go { font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--c-mustard); padding-bottom: 1px; }
.console-readout .go:hover, .console-readout .go:focus-visible { border-bottom-color: currentColor; outline: none; }
.console-readout .hint { color: var(--c-muted); font-size: 0.85rem; margin-top: 6px; }
/* in the bubble: no card, and sizes set for the drawing's scale */
#bubble .console-readout { background: none; border: 0; border-radius: 0; padding: 0; margin: 0; }
#bubble .console-readout h1 { font-size: 26px; line-height: 1.15; margin: 0 0 12px; font-weight: 600; }
#bubble .console-readout h2 { font-size: 22px; line-height: 1.2; margin: 0 0 8px; }
#bubble .console-readout p { font-size: 15.5px; line-height: 1.45; margin: 0 0 12px; }
#bubble .console-readout .intro p.how { border-top: 1px solid var(--c-rule); padding-top: 11px; margin: 0; }
#bubble .console-readout .main { display: block; }
#bubble .console-readout .main p { margin: 0 0 8px; }
#bubble .console-readout .go { font-size: 15px; }
#bubble .console-readout .hint { font-size: 13px; margin-top: 4px; }
.console-legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; padding-left: 2px;
  font-family: var(--c-mono); font-size: 12px; color: var(--c-muted);
}
.console-legend span::before {
  content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--dot);
}

/* ---- controls ---- */
.hot { cursor: pointer; text-decoration: none; }
.hot:focus { outline: none; }
.hot .ring { fill: none; stroke: transparent; stroke-width: 2; opacity: 0; transition: opacity .12s; }
.hot:focus-visible .ring, .hot:hover .ring { stroke: var(--c-focus); stroke-width: 3; opacity: 1; }
.hot.on .ring { stroke: var(--c-mustard-2); stroke-width: 3; opacity: 1; }
.hot .lamp { transition: fill .15s; }
.hot.on .lamp, .hot:hover .lamp { fill: var(--c-mustard-2); filter: drop-shadow(0 0 5px var(--c-glow)); }
.hot.on .glow, .hot:hover .glow { filter: drop-shadow(0 0 5px var(--c-glow)); }
.lbl { font-family: var(--c-mono); font-size: 12px; fill: var(--c-label); letter-spacing: 0.02em; pointer-events: none; }
.eng { font-family: Questrial, Montserrat, sans-serif; font-size: 12.5px; letter-spacing: 0.16em; fill: var(--c-label); opacity: 0.8; pointer-events: none; }
.tiny { font-family: var(--c-mono); font-size: 9px; fill: var(--c-ink); pointer-events: none; }
.tag { font-family: var(--c-mono); font-size: 7px; font-weight: 600; letter-spacing: 0.06em; fill: var(--c-label); opacity: 0.8; pointer-events: none; }
.scr { font-family: var(--c-mono); font-size: 7.5px; fill: var(--c-phosphor); pointer-events: none; }

/* ---- parts kit ---- */
.part { display: none; }
.part.show { display: block; }
#figure { --coat: #6f7f76; --coat-dk: #55635b; --coat-lt: #8a9a90; --gloves: #7a5535; --gloves-dk: #5c3f27; }
.coat { fill: var(--coat); }
.coat-dk { fill: var(--coat-dk); }
.coat-lt { fill: var(--coat-lt); }
#figure, #held, .arm-seg { transition: transform .3s ease; }
@media (prefers-reduced-motion: reduce) { #figure, #held, .arm-seg, .hot .ring, .hot .lamp, #bubble .bubble-shape { transition: none; } }

/* ---- the page-not-found figure ----
   The agent with its hands up, on the one page that is not a chapter. It is the same parts kit, dressed
   by split-chapters.py from a recipe written for this page rather than for a chapter, then pasted in:
   404.qmd is hand-maintained like index.qmd and is not part of the sync. Centred, not floated. */
.lost-agent { max-width: 260px; margin: 0 auto 4px; }
.lost-agent svg { display: block; width: 100%; height: auto; }

/* Give chapter titles the full reading width above the floated opening agent. */
main:has(.chapter-agent) #title-block-header .quarto-title { display: block; }
/* Quarto wraps the duplicated body heading in a level-one section. */
.chapter-agent + section.level1 > h1:first-child,
.chapter-agent + h1 { display: none; }

/* Keep the first troubleshooting heading and table below the opening agent. */
.chapter-agent + section.level1 > #troubleshoot-work {
  clear: right;
}

/* Add text clearance only for the opening agents that need more room. */
@media (min-width: 701px) {
  main:has(#troubleshoot-work) > .chapter-agent { margin-left: 0; }
}

/* Physical instrument materials retain contrast on both console faces. */
:root {
  --c-instrument-blue: #91aabc;
  --c-instrument-sage: #a4b59a;
  --c-instrument-cream: #e3dac5;
  --c-instrument-rose: #bd8d83;
  --c-instrument-check: #4d7060;
  --c-instrument-lens: rgba(145, 170, 188, .25);
  --c-printer-case: #899da5;
  --c-rerun: #59806a;
  --c-rerun-dark: #3f5e4c;
  --c-sequence: #286b8c;
  --c-sequence-halo: #b3e0ed;
  --c-sequence-label: #d7edf2;
}
body.quarto-dark {
  --c-instrument-blue: #a1b9c9;
  --c-instrument-sage: #b6c3aa;
  --c-instrument-cream: #ded4bd;
  --c-instrument-rose: #c89b93;
  --c-printer-case: #9dafb7;
  --c-rerun: #6b967b;
  --c-rerun-dark: #486851;
  --c-sequence: #8dd3eb;
  --c-sequence-halo: #64abc5;
  --c-sequence-label: #d0e9ed;
}
.sequence-badge { display: none; pointer-events: none; }
.hot:is(.sequence-next, .sequence-start) .sequence-badge { display: block; }
.hot:is(.sequence-next, .sequence-start) .chapter-number { visibility: hidden; }
.sequence-badge rect { stroke: var(--c-sequence); stroke-width: 1.1; }
.sequence-label { font-family: var(--c-mono); font-size: 8.5px; fill: #214453; font-weight: 600; }
.hot.sequence-next .control-art {
  filter: drop-shadow(0 0 1px var(--c-sequence-label)) drop-shadow(0 0 4px var(--c-sequence));
}
.hot.sequence-next .ring { opacity: 1; stroke: var(--c-sequence); stroke-width: 1.5; }
.hot.sequence-start .control-art { animation: console-start-glow 3s ease-in-out infinite; }
@keyframes console-start-glow {
  0%, 100% { filter: drop-shadow(0 0 2px var(--c-sequence-halo)); }
  50% { filter: drop-shadow(0 0 3px var(--c-sequence-label)) drop-shadow(0 0 8px var(--c-sequence)); }
}
.sequence-actions { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 10px; }
.sequence-next-link { color: var(--c-sequence); font-weight: 600; font-size: .9rem; }
#bubble .sequence-next-link { font-size: 14px; }
.sequence-next-link[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .hot.sequence-start .control-art { animation: none; filter: drop-shadow(0 0 4px var(--c-sequence)); }
}
