/* ==========================================================================
   Switchboard (switchboard/index.html)
   The CV's top control panel rebuilt in navy enamel: one jack per project on
   the left (a tablist), the console with the connected project on the right.
   1. Fonts   2. Tokens & base   3. Masthead   4. Panel & lines
   5. Console & cards   6. Buttons   7. Without JavaScript, print, motion
   Contrast of every text pair: docs/stories/02-switchboard-page.md
   ========================================================================== */

/* 1. Fonts (the CV's self-hosted variable fonts, SIL Open Font License) --- */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/bricolage-grotesque-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/bricolage-grotesque-latin-ext.woff2) format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(../fonts/figtree-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(../fonts/figtree-latin-ext.woff2) format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url(../fonts/jetbrains-mono-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 2. Tokens & base -------------------------------------------------------- */

:root {
  --night: #0b1830; /* page */
  --enamel: #13274a; /* the panel */
  --enamel-hi: #1c3560;
  --rim: #2c4675;
  --brass: #c9a24a; /* screws, jack rims, labels: 6.2:1 on enamel */
  --brass-hi: #f0d79a;
  --brass-lo: #6e5419;
  --engrave: #f3ead3; /* engraved cream text: 12.4:1 on enamel */
  --engrave-soft: #a9b6c9; /* quiet text: 6.1:1 or more on every panel surface */
  --line-bg: #10223f;
  --line-hover: #162b4f;
  --line-on: #1b3359;
  --screen: #fffdf8; /* the console screen, the CV's card color */
  --ink: #10233a; /* 15.6:1 on screen */
  --soft: #4a5a6c; /* 7.0:1 on screen */
  --chip: #f6f1e5;
  --chip-line: #d9d1bf;
  /* one lamp per world; as text they're 4.7:1 or more on every line background */
  --l-mc: #8ac800;
  --l-nv: #a98bff;
  --l-cb: #39e66b;
  --l-tr: #f0a43a;
  --l-cv: #6cc4ff;
  --display: "Bricolage Grotesque", "Arial Black", sans-serif;
  --body: "Figtree", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

[data-lamp="mc"] { --lamp: var(--l-mc); }
[data-lamp="nv"] { --lamp: var(--l-nv); }
[data-lamp="cb"] { --lamp: var(--l-cb); }
[data-lamp="tr"] { --lamp: var(--l-tr); }
[data-lamp="cv"] { --lamp: var(--l-cv); }

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 85% -10%, rgb(108 196 255 / 10%), transparent 60%),
    radial-gradient(800px 600px at 0% 100%, rgb(169 139 255 / 8%), transparent 60%),
    var(--night);
  color: var(--engrave);
  font: 16px/1.6 var(--body);
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--brass-hi);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 99;
  padding: 8px 12px;
  background: #fff;
  color: #000;
}

.label {
  font: 500 12px/1.4 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}

.wrap,
.top,
.foot {
  max-width: 1160px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.top {
  padding-top: 18px;
}
.home {
  display: inline-grid;
  font: 800 1.05rem/1.2 var(--display);
  color: #fff;
  text-decoration: none;
}
.home small {
  font: 500 11.5px/1.5 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--engrave-soft);
}
.home:hover small {
  color: var(--engrave);
}

.wrap {
  display: grid;
  gap: 32px;
  padding-top: 24px;
  padding-bottom: 48px;
}

.foot {
  padding-bottom: 32px;
  font-size: 0.95rem;
  color: var(--engrave-soft);
}

/* 3. Masthead ------------------------------------------------------------- */

.mast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 28px;
  align-items: center;
}
.kicker {
  margin: 0;
}
.kicker::before {
  content: "● ";
  content: "● " / ""; /* decorative: screen readers skip it */
}
h1 {
  font: 800 clamp(2.2rem, 5.6vw, 4rem)/0.98 var(--display);
  margin: 10px 0 14px;
  color: #fff;
  text-wrap: balance;
}
.intro {
  margin: 0;
  max-width: 46ch;
  font-size: 1.08rem;
}
.plate {
  margin: 0;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--rim);
  box-shadow: 0 20px 40px rgb(0 0 0 / 45%);
  background: var(--enamel);
}
.plate img {
  display: block;
  width: 100%;
  height: auto;
}

/* 4. Panel & lines -------------------------------------------------------- */

.panel {
  position: relative;
  background:
    linear-gradient(160deg, rgb(255 255 255 / 7%), transparent 40%),
    linear-gradient(180deg, var(--enamel-hi), var(--enamel));
  border: 1px solid var(--rim);
  border-radius: 28px;
  padding: 34px clamp(16px, 3vw, 34px);
  box-shadow:
    0 1px 0 rgb(255 255 255 / 10%) inset,
    0 -2px 0 rgb(0 0 0 / 35%) inset,
    0 26px 50px rgb(0 0 0 / 50%);
}
.screw {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--brass-hi), var(--brass) 55%, var(--brass-lo));
  box-shadow: 0 1px 1px rgb(0 0 0 / 50%);
}
.screw::after {
  content: "";
  position: absolute;
  inset: 6px 2px;
  background: var(--brass-lo);
  border-radius: 1px;
  transform: rotate(35deg);
}
.screw.tl { top: 14px; left: 14px; }
.screw.tr { top: 14px; right: 14px; }
.screw.bl { bottom: 14px; left: 14px; }
.screw.br { bottom: 14px; right: 14px; }

.board {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.lines-head {
  margin: 0 0 12px;
}
.lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  text-decoration: none;
  cursor: pointer;
  background: var(--line-bg);
  border: 1px solid rgb(255 255 255 / 6%);
  transition: background-color 0.2s, border-color 0.2s;
}
.line:hover {
  background: var(--line-hover);
}
.line[aria-selected="true"] {
  background: var(--line-on);
  border-color: var(--lamp);
}
.line:focus-visible {
  outline-offset: 2px;
}

/* the socket plate: lamp and jack mounted on one small enamel plate */
.jack-col {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 7px;
  width: 44px;
  padding: 8px 0 9px;
  border-radius: 11px;
  background: linear-gradient(180deg, #0a1730, #0f2140);
  box-shadow:
    inset 0 2px 3px rgb(0 0 0 / 60%),
    inset 0 -1px 0 rgb(255 255 255 / 8%),
    0 0 0 1px rgb(201 162 74 / 35%);
}
.lamp {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / 70%), color-mix(in srgb, var(--lamp) 55%, var(--night)) 60%);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 40%);
  transition: background 0.25s, box-shadow 0.25s;
}
.line[aria-selected="true"] .lamp {
  background: radial-gradient(circle at 35% 30%, #fff, var(--lamp) 50%, color-mix(in srgb, var(--lamp) 70%, #000));
  box-shadow: 0 0 10px 2px color-mix(in srgb, var(--lamp) 70%, transparent);
}
/* an empty jack: a recessed hole with a thin brass bushing */
.jack {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle, #02060e 0 54%, #4b3b14 58% 74%, #2a210b 78%);
  box-shadow: 0 1px 0 rgb(255 255 255 / 10%);
}
/* connected: a plug is seated in the jack, its collar lit by the lamp */
.line[aria-selected="true"] .jack {
  background: radial-gradient(circle at 40% 35%, var(--brass-hi), var(--brass) 45%, #7a5e1c 80%);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--lamp) 80%, transparent),
    0 0 8px color-mix(in srgb, var(--lamp) 60%, transparent);
}
.arrow {
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border-top: 2px solid var(--lamp);
  border-right: 2px solid var(--lamp);
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}
.line[aria-selected="true"] .arrow {
  opacity: 1;
  transform: rotate(45deg) translate(1px, -1px);
}
.line-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.line-name {
  font: 800 1.08rem/1.2 var(--display);
  color: #fff;
}
.line-sub {
  font: 500 11.5px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lamp);
}
.line-sub .part {
  color: var(--engrave-soft);
}

/* 5. Console & cards ------------------------------------------------------ */

.console {
  background: linear-gradient(180deg, #0a1428, #0d1a33);
  border: 1px solid var(--rim);
  border-radius: 22px;
  padding: 12px;
  box-shadow: 0 3px 0 rgb(0 0 0 / 45%) inset, 0 0 0 6px rgb(0 0 0 / 18%);
}
.console-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 2px 6px 10px;
}
.console-top .label {
  color: var(--engrave-soft);
}
.rec {
  display: none;
  align-items: center;
  gap: 8px;
  font: 500 11.5px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--engrave);
}
.js .rec {
  display: inline-flex;
}
.rec i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lamp);
  box-shadow: 0 0 8px var(--lamp);
}

.screen {
  display: grid;
  gap: 12px;
}
.pane {
  background: var(--screen);
  color: var(--ink);
  border-radius: 14px;
  overflow: hidden;
  scroll-margin-top: 16px;
}
.pane[hidden] {
  display: none;
}
.tile {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--night);
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.badge {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--night);
  color: #fff;
  font: 500 11.5px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lamp);
  box-shadow: 0 0 6px var(--lamp);
}
.body {
  padding: 20px clamp(16px, 2.6vw, 28px) 24px;
  display: grid;
  gap: 14px;
}
.body h2 {
  font: 800 clamp(1.5rem, 3vw, 2.1rem)/1.05 var(--display);
  margin: 0;
  text-wrap: balance;
}
.one {
  margin: 0;
  font-size: 1.1rem;
  max-width: 52ch;
}
.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0;
}
.facts dt {
  font: 500 11.5px/1.9 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--soft);
}
.facts dd {
  margin: 0;
}
.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips li {
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--chip-line);
  background: var(--chip);
  font: 500 12.5px/1.7 var(--mono);
}
.note {
  margin: 0;
  font: 500 12.5px/1.6 var(--mono);
  letter-spacing: 0.04em;
  color: var(--soft);
}

/* 6. Buttons: the CV's glossy buttons with the darker bottom lip ---------- */

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 10px;
  padding: 4px 0 4px;
}
.cbtn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 11px;
  border-radius: 14px;
  font: 800 1rem/1.1 var(--display);
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, #fff), var(--c) 55%);
  box-shadow:
    0 4px 0 color-mix(in srgb, var(--c) 65%, #000),
    0 6px 12px rgb(16 35 58 / 18%);
  transition: transform 0.12s, box-shadow 0.12s;
}
.cbtn::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgb(16 35 58 / 15%);
}
.cbtn:hover {
  transform: translateY(-1px);
}
.cbtn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 65%, #000);
}
.cbtn.lime { --c: #a6e22a; }
.cbtn.sky { --c: #8fd0ff; }
.cbtn.cream { --c: #efe7d3; }
.cbtn:focus-visible {
  outline-color: var(--ink);
}

.panel-foot {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid rgb(255 255 255 / 8%);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 20px;
  font-size: 0.95rem;
  color: var(--engrave-soft);
}
.panel-foot a {
  color: var(--engrave);
}

/* 7. Responsive, without JavaScript, print, motion ------------------------ */

@media (max-width: 820px) {
  .mast,
  .board {
    grid-template-columns: 1fr;
  }
  /* the lines sit above the console, so the arrow points down */
  .line[aria-selected="true"] .arrow {
    transform: rotate(135deg);
  }
}

@media (max-width: 480px) {
  /* the label goes above its value, so the chips get the full width */
  .facts {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .facts dd + dt {
    margin-top: 8px;
  }
}

/* Without JavaScript every card shows. With it, only the connected card
   shows ([hidden] above); in the moment before the script picks one, only
   the first (Mission Control), so nothing flashes. */
.js:not(.js-ready) .pane:not(:first-of-type) {
  display: none;
}

@media print {
  body {
    background: #fff;
    color: #000;
  }
  .top,
  .skip,
  .plate,
  .lines-col,
  .console-top,
  .tile,
  .screw,
  .panel-foot {
    display: none !important;
  }
  .panel,
  .console {
    background: none;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
  .board {
    display: block;
  }
  h1,
  .intro {
    color: #000;
  }
  .pane,
  .js .pane,
  .pane[hidden] {
    display: block !important;
    border: 1px solid #999;
    break-inside: avoid;
  }
  .cbtn {
    box-shadow: none;
    background: none;
    border: 1px solid #999;
  }
  .cbtn[href^="http"]::after {
    content: " " attr(href);
    font: 400 0.8rem var(--mono);
  }
  .foot {
    color: #000;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
