/* ==========================================================================
   Orchestra — base.css (shared by every skin)
   Reset, layout primitives, accessibility affordances, motion gating.
   No external assets: system fonts only, everything drawn in CSS.
   Skins define the actual tokens (--panel, --text, …) and components.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif);
  font-size: var(--body-size, 17px);
  line-height: var(--body-lh, 1.55);
  color: var(--text, #1a1b1e);
  background: var(--panel, #e6e7e3);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, canvas, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link, inherit); text-underline-offset: .14em; }
a:hover { color: var(--link-hover, var(--link, inherit)); }
h1, h2, h3, h4 { margin: 0; font-weight: inherit; line-height: 1.1; }
p, ul, ol, dl, figure, blockquote { margin: 0; }
ul, ol { padding-left: 1.2em; }

[hidden] { display: none !important; }

/* Layout primitives ------------------------------------------------------ */
.wrap {
  width: 100%;
  max-width: var(--wrap, 1180px);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 40px);
}
.wrap--narrow { max-width: var(--wrap-narrow, 820px); }
.measure { max-width: var(--measure, 62ch); }
.site-main { display: block; }
.site-main:focus { outline: none; }

/* Accessibility ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: .55em .9em;
  background: var(--focus, #ffb020);
  color: #111;
  font: 700 .85rem/1 var(--mono, ui-monospace, Menlo, monospace);
  letter-spacing: .1em;
  text-transform: uppercase;
  border-radius: 3px;
}
.skip-link:focus { top: 12px; outline: 3px solid #111; outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--focus, #ffb020);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* Prose (structure only; skins colour it) ------------------------------- */
.prose { max-width: var(--measure, 62ch); }
.prose > * + * { margin-top: 1em; }
.prose h2, .prose h3 { margin-top: 1.8em; line-height: 1.15; }
.prose li + li { margin-top: .35em; }
.prose blockquote { padding-left: 1em; border-left: 3px solid var(--line, currentColor); opacity: .9; }
.prose code {
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: .88em;
  padding: .1em .35em;
  border-radius: 3px;
  background: var(--code-bg, rgba(127, 127, 127, .15));
}

/* Widgets (packkit configurator, Retroix launcher) ------------------------
   Structure + a neutral finish here; each skin aliases the --widget-* tokens
   to its own palette (see the "Widgets" block in desk/arcade/score.css) and
   adds a scoped rule or two for its signature details. Every token has a
   literal fallback so the widgets are never unstyled. No external assets:
   the select chevron and the idle starfield are drawn in CSS. */
.widget {
  --_w-mono: var(--widget-mono, var(--mono, ui-monospace, Menlo, monospace));
  width: 100%;
  display: grid;
  gap: 18px;
  padding: 20px;
  color: var(--widget-text, var(--text, #1a1b1e));
  background: linear-gradient(180deg, var(--widget-surface-2, var(--widget-surface, #f7f7f5)), var(--widget-surface, #f7f7f5));
  border: 1px solid var(--widget-border, var(--line, rgba(127, 127, 127, .3)));
  border-radius: var(--widget-radius, 8px);
  box-shadow: inset 0 1px 0 var(--widget-hi, transparent), 0 6px 18px -8px var(--widget-shadow, transparent);
}
.widget__head { display: grid; gap: 6px; }
.widget__kicker {
  font-family: var(--_w-mono);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--widget-accent, #ffb020);
}
.widget__head .widget__kicker { justify-self: start; }
.widget__note { font-size: .9rem; line-height: 1.5; color: var(--widget-muted, var(--muted, #55585e)); }
.widget code {
  font-family: var(--_w-mono);
  font-size: .86em;
  padding: .1em .35em;
  border-radius: 3px;
  background: var(--code-bg, rgba(127, 127, 127, .15));
}
/* The fallback button, worn only when a skin passes no button class. */
.widget__btn {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font-family: var(--_w-mono);
  font-weight: 700;
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: .75em 1.1em;
  color: var(--widget-accent-fg, #111);
  background: var(--widget-accent, #ffb020);
  border: 1px solid var(--widget-border-strong, transparent);
  border-radius: 4px;
}
.widget__btn:hover { filter: brightness(1.08); }

/* packkit configurator ---------------------------------------------------- */
.pk__form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px 16px;
  align-items: end;
}
.pk__js { display: contents; }      /* its fields join the grid; [hidden] still wins */
.pk__field { display: grid; gap: 6px; min-width: 0; }
.pk__field--wide, .pk__toggles { grid-column: 1 / -1; }
.pk__label {
  font-family: var(--_w-mono);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--widget-muted, var(--muted, #55585e));
}
.pk__input, .pk__select {
  width: 100%;
  min-width: 0;
  margin: 0;
  font-family: var(--_w-mono);
  font-size: .9rem;
  line-height: 1.3;
  padding: .55em .7em;
  color: var(--widget-text, var(--text, #1a1b1e));
  background: var(--widget-control, var(--widget-well, #fff));
  border: 1px solid var(--widget-border-strong, var(--line-strong, rgba(127, 127, 127, .4)));
  border-radius: var(--widget-control-radius, 4px);
  box-shadow: inset 0 1px 2px var(--widget-shadow, transparent);
  transition: border-color .15s;
}
.pk__input:hover, .pk__select:hover,
.pk__input:focus, .pk__select:focus { border-color: var(--widget-accent, #ffb020); }
.pk__input:invalid { border-color: var(--widget-hot, #ff4d6d); }
.pk__select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 2.1em;
  /* a chevron drawn from two gradients — no image asset */
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 1.05em) 50%, calc(100% - .7em) 50%;
  background-size: .35em .35em, .35em .35em;
  background-repeat: no-repeat;
}
.pk__toggles { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.pk__toggle {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font-size: .9rem;
  cursor: pointer;
}
.pk__toggle input {
  width: 15px; height: 15px;
  margin: 0;
  accent-color: var(--widget-accent, #ffb020);
  cursor: pointer;
}
.pk__toggle input:disabled { opacity: .45; cursor: not-allowed; }
.pk__toggle input:disabled + span { opacity: .55; }
.pk__out { display: grid; gap: 10px; }
.pk__cmd {
  margin: 0;
  padding: 14px 16px 14px 2.1em;
  font-family: var(--_w-mono);
  font-size: .86rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--widget-well-fg, #0a7f8c);
  background: var(--widget-well, #0b0c0e);
  border: 1px solid var(--widget-border-strong, var(--line-strong, rgba(127, 127, 127, .4)));
  border-radius: var(--widget-control-radius, 4px);
  box-shadow: inset 0 2px 8px var(--widget-shadow, transparent);
  position: relative;
}
.pk__cmd::before {           /* the prompt */
  content: "$";
  position: absolute;
  left: .9em; top: 14px;
  opacity: .55;
  user-select: none;
}
.pk__cmd code { font: inherit; padding: 0; background: none; }
.pk__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pk__status {
  font-family: var(--_w-mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--widget-accent, #ffb020);
  min-height: 1.2em;
}

/* Retroix launcher -------------------------------------------------------- */
.rx__cab {
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
  display: grid;
  gap: 10px;
  padding: 12px 12px 14px;
  background: linear-gradient(180deg, var(--widget-surface-2, var(--widget-surface, #f7f7f5)), var(--widget-surface, #f7f7f5));
  border: 1px solid var(--widget-border-strong, var(--line-strong, rgba(127, 127, 127, .4)));
  border-radius: var(--widget-radius, 8px);
  box-shadow: inset 0 1px 0 var(--widget-hi, transparent), 0 14px 26px -12px var(--widget-shadow, transparent);
}
.rx__marquee {
  font-family: var(--_w-mono);
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
  padding: .7em .5em .6em;
  color: var(--widget-marquee-fg, #111);
  background: var(--widget-marquee-bg, var(--widget-accent, #ffb020));
  border: 1px solid var(--widget-border-strong, transparent);
  border-radius: calc(var(--widget-radius, 8px) / 2);
  box-shadow: 0 0 14px var(--widget-accent-glow, transparent), inset 0 -3px 0 rgba(0, 0, 0, .15);
}
.rx__bezel {
  display: grid;
  gap: 8px;
  padding: 10px 10px 8px;
  background: var(--widget-well, #0b0c0e);
  border: 1px solid var(--widget-border-strong, transparent);
  border-radius: calc(var(--widget-radius, 8px) / 2 + 2px);
  box-shadow: inset 0 2px 8px var(--widget-shadow, transparent);
}
.rx__screen {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 4px;
  image-rendering: pixelated;
  /* dark glass in every palette; the CSS starfield is what shows with JS off */
  background:
    radial-gradient(1px 1px at 12% 30%, #e9f7ef 50%, transparent 60%),
    radial-gradient(1px 1px at 31% 72%, #e9f7ef 50%, transparent 60%),
    radial-gradient(2px 2px at 48% 18%, #e9f7ef 50%, transparent 60%),
    radial-gradient(1px 1px at 63% 54%, #e9f7ef 50%, transparent 60%),
    radial-gradient(1px 1px at 79% 34%, #e9f7ef 50%, transparent 60%),
    radial-gradient(2px 2px at 88% 80%, #e9f7ef 50%, transparent 60%),
    radial-gradient(1px 1px at 22% 88%, #e9f7ef 50%, transparent 60%),
    radial-gradient(100% 80% at 50% 45%, #0e1a2e, #05070f 90%);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .7);
}
.rx__coin {
  font-family: var(--_w-mono);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  text-align: center;
  color: var(--widget-accent, #ffb020);
  animation: widget-blink 1.2s steps(2, jump-none) infinite;
}
.rx__panel {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 14px;
  background: linear-gradient(180deg, var(--widget-surface, #f7f7f5), var(--widget-border-strong, #b9bbb6));
  border: 1px solid var(--widget-border-strong, transparent);
  border-radius: 3px;
}
.rx__joy {
  position: relative;
  width: 12px; height: 12px;
  margin-right: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, .55), var(--widget-hot, #ff4d6d) 55%, rgba(0, 0, 0, .35));
  box-shadow: 0 0 0 2px var(--widget-well, #0b0c0e);
}
.rx__joy::after {
  content: "";
  position: absolute;
  left: 50%; top: 100%;
  width: 3px; height: 8px;
  margin-left: -1.5px;
  background: var(--widget-muted, #777c94);
}
.rx__btn {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--widget-well, #0b0c0e);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .3);
}
.rx__btn--a { background: var(--widget-hot, #ff4d6d); }
.rx__btn--b { background: var(--widget-accent, #ffb020); }
.rx__cab .rx__play {
  display: flex;
  justify-content: center;
  text-align: center;
  margin-top: 4px;
  font-size: .9rem;
  padding: 1em 1.2em;
}
.rx__note { text-align: center; font-size: .8rem; }

@keyframes widget-blink { 50% { opacity: .15; } }

@media (max-width: 640px) {
  .widget { padding: 16px; gap: 16px; }
  .pk__form { grid-template-columns: 1fr; }
  .pk__cmd { font-size: .8rem; }
}

/* Motion is an enhancement only ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
  }
}
/* Set by desk.js while restoring a persisted state on load: no sweep replay. */
.no-sweep, .no-sweep *, .no-sweep *::before, .no-sweep *::after {
  transition: none !important;
}

/* --------------------------------------------------------------------------
   Project plate — an AI-generated hero band (one image per project, generated
   through Dan's coin-artgen Flux Worker, served same-origin so it satisfies the
   nonce-only `img-src 'self'` CSP). Structure lives here; each skin frames it
   with its own tokens, scoped by <html data-skin>. Decorative: aria-hidden.
   -------------------------------------------------------------------------- */
/* NB: class is `plate-hero`, NOT `plate` — the Full Score footer is
   <footer class="plate"> (the publisher's plate), so `.plate` here would
   clobber it (line-height:0 collapsed every footer line). Keep them distinct. */
.plate-hero { margin: 0 0 22px; border-radius: 10px; overflow: hidden; line-height: 0; }
.plate-hero__img {
  display: block; width: 100%;
  height: clamp(170px, 30vw, 300px);
  object-fit: cover; object-position: center 42%;
}

/* Desk — a console panel: hairline edge, inset highlight, soft drop shadow. */
[data-skin="desk"] .plate-hero {
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--hi), 0 10px 26px -12px var(--shadow);
}
/* Attract Mode — a lit cabinet bezel. */
[data-skin="arcade"] .plate-hero {
  border: 4px solid var(--cab-edge); border-radius: 8px;
  box-shadow: 0 0 0 2px var(--cab-side), 0 0 22px -6px rgba(0, 0, 0, .55);
}
/* Full Score — a dark plate set into the engraved page. */
[data-skin="score"] .plate-hero {
  border: 1px solid var(--staff); border-radius: 4px;
  box-shadow: 0 6px 20px -12px rgba(0, 0, 0, .5);
}

/* --------------------------------------------------------------------------
   Stat strip — "by the numbers" on the home page (_stats.php). A <dl> of
   `number|label` pairs from the CMS `stats` field. Structure here: a responsive
   row that packs as many readouts as fit (≥ 140px each) and drops to two
   columns on a phone. The figure is the hero; each skin sets its face
   (desk: console readouts · arcade: top-score screen · score: engraved rule).
   -------------------------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  width: 100%;
  min-width: 0;
}
.stat {
  min-width: 0;
  margin: 0;
  display: grid;
  gap: 6px;
  align-content: start;
}
.stat__num {
  font-variant-numeric: tabular-nums;
  line-height: 1;
  overflow-wrap: anywhere;
}
.stat__label { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --------------------------------------------------------------------------
   Diagram zoom — a CSS-only lightbox (no JS, CSP-safe). "Enlarge" opens the
   architecture diagram full-screen via :target; the backdrop or the ✕ closes
   it. Pinch-zoom remains as a fallback (the viewport allows scaling).
   -------------------------------------------------------------------------- */
.diagram figcaption { display: flex; align-items: center; gap: 1em; }
.diagram__zoom { margin-left: auto; font-size: .82em; text-decoration: none; cursor: zoom-in; opacity: .85; white-space: nowrap; }
.diagram__zoom:hover { opacity: 1; text-decoration: underline; }
.diagram__close { display: none; }

.diagram:target {
  position: fixed; inset: 0; z-index: 200; margin: 0;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(8, 8, 10, .94);
  color: #e8e4dc;
  overflow: auto;
  display: grid; place-content: center;
  border: 0; border-radius: 0; box-shadow: none;
}
.diagram:target .diagram__svg { position: relative; z-index: 2; width: min(1500px, 94vw); }
.diagram:target .diagram__svg svg { width: 100%; height: auto; max-height: 86vh; }
.diagram:target figcaption { position: fixed; top: 14px; left: 0; right: 0; justify-content: center; z-index: 3; opacity: .75; }
.diagram:target .diagram__zoom { display: none; }
.diagram:target .diagram__close { display: block; position: fixed; inset: 0; z-index: 1; cursor: zoom-out; }
.diagram:target .diagram__close span {
  position: fixed; top: 12px; right: 18px; z-index: 3;
  font-size: 26px; line-height: 1; color: currentColor; opacity: .8;
}

/* ask my projects --------------------------------------------------------- */
.ask__title { margin: 0; font-size: 1.15rem; line-height: 1.2; }
.ask__form { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.ask__input {
  flex: 1 1 240px;
  min-width: 0;
  margin: 0;
  font: inherit;
  font-size: .95rem;
  padding: .7em .85em;
  color: var(--widget-text, var(--text, #1a1b1e));
  background: var(--widget-control, var(--widget-well, #fff));
  border: 1px solid var(--widget-border-strong, var(--line-strong, rgba(127, 127, 127, .4)));
  border-radius: var(--widget-control-radius, 4px);
  transition: border-color .15s;
}
.ask__input:hover, .ask__input:focus { border-color: var(--widget-accent, #ffb020); }
.ask__btn { flex: 0 0 auto; cursor: pointer; }
.ask__btn:disabled { opacity: .6; cursor: progress; }
.ask__out {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--widget-border, var(--line, rgba(127, 127, 127, .3)));
  border-radius: var(--widget-control-radius, 4px);
  background: rgba(127, 127, 127, .08);
}
.ask__answer { display: grid; gap: .7em; }
.ask__p { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }
.ask__sources { margin: 0; font-size: .82rem; color: var(--widget-muted, var(--muted, #55585e)); }
.ask__srclabel {
  font-family: var(--_w-mono, ui-monospace, Menlo, monospace);
  text-transform: uppercase; letter-spacing: .1em; font-size: .7rem;
}
.ask__src { color: inherit; }

/* blog -------------------------------------------------------------------- */
.blog-fig { margin: 1.5em 0; }
.blog-fig__svg svg { display: block; max-width: 100%; height: auto; margin-inline: auto; }
/* Diagram zoom in posts — same CSS-only :target lightbox as the architecture
   diagram, keyed on each figure's unique id (no JS, CSP-safe). */
.blog-fig__zoom {
  display: inline-block; margin-top: .5em;
  font-size: .82em; text-decoration: none; cursor: zoom-in; opacity: .85; white-space: nowrap;
}
.blog-fig__zoom:hover { opacity: 1; text-decoration: underline; }
.blog-fig__close { display: none; }
.blog-fig:target {
  position: fixed; inset: 0; z-index: 200; margin: 0;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(8, 8, 10, .94);
  color: #e8e4dc;
  overflow: auto;
  display: grid; place-content: center;
}
.blog-fig:target .blog-fig__svg { position: relative; z-index: 2; width: min(1500px, 94vw); }
.blog-fig:target .blog-fig__svg svg { width: 100%; height: auto; max-height: 86vh; }
.blog-fig:target .blog-fig__zoom { display: none; }
.blog-fig:target .blog-fig__close { display: block; position: fixed; inset: 0; z-index: 1; cursor: zoom-out; }
.blog-fig:target .blog-fig__close span {
  position: fixed; top: 12px; right: 18px; z-index: 3;
  font-size: 26px; line-height: 1; color: currentColor; opacity: .8;
}
/* Fenced code blocks in posts (```lang … ```). Inline `code` is styled by
   .prose code; this is the block form: a scrollable monospaced panel. */
.blog-code {
  margin: 1.3em 0;
  padding: 1em 1.1em;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: .82rem;
  line-height: 1.55;
  background: var(--code-bg, rgba(127, 127, 127, .15));
  border: 1px solid var(--line, rgba(127, 127, 127, .25));
  border-radius: 6px;
}
.blog-code code { font: inherit; padding: 0; background: none; white-space: pre; }
/* A wide code block must scroll inside itself, not stretch the page. Each skin
   lays the post body out in a grid, and a grid/flex item defaults to
   min-width:auto — so the pre's large min-content width would force the item
   (and the whole page) wider. min-width:0 lets these wrappers shrink to their
   track and the pre's overflow-x:auto takes over. */
.blogpost__body, .program__body, .readout__screen { min-width: 0; }
.blog-code { max-width: 100%; }
.blog-cover { margin: 0 0 1.3em; }
.blog-cover img { display: block; width: 100%; height: auto; border-radius: var(--widget-radius, 8px); }
.blog-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: .7em; }
.blog-tag { font-size: .8rem; text-decoration: none; opacity: .85; color: var(--widget-accent, currentColor); }
.blog-tag:hover { opacity: 1; }
.blogpost__body { max-width: var(--measure, 66ch); }
.postlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 26px; }
.postlist__empty { opacity: .7; }
.postcard { display: grid; gap: 6px; padding-bottom: 22px; border-bottom: 1px solid var(--line, rgba(127, 127, 127, .22)); }
.postcard:last-child { border-bottom: 0; padding-bottom: 0; }
.postcard__date { margin: 0; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.postcard__title { margin: 0; font-size: 1.4rem; line-height: 1.2; }
.postcard__title a { text-decoration: none; color: inherit; }
.postcard__title a:hover { color: var(--widget-accent, currentColor); }
.postcard__summary { margin: 0; opacity: .85; max-width: 64ch; }
.postcard__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: .2em 0 0; }

/* rack: project link hubs ------------------------------------------------- */
/* Top breathing room under the header. Desk overrides this with its own
   padding-block; Attract Mode and Full Score have no .rack-head rule, so they
   inherit this and the "Projects" heading no longer hugs the nav. */
.rack-head { margin-bottom: 6px; padding-top: clamp(28px, 5vw, 60px); }
.rack-title { margin: 0 0 .2em; font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.05; }
.rack-intro { margin: 0; opacity: .8; max-width: 60ch; }
.rack { display: grid; gap: 34px; }
.rack-bus { display: grid; gap: 14px; }
.rack-bus__label {
  margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--widget-accent, currentColor); opacity: .9;
}
.rack-bus__items { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; align-items: stretch; }
.rack-item, .rack-group {
  display: flex; flex-direction: column; gap: 8px; padding: 16px 18px;
  border: 1px solid var(--widget-border, var(--line, rgba(127, 127, 127, .28)));
  border-radius: var(--widget-radius, 10px);
  background: rgba(127, 127, 127, .05);
}
.rack-group { grid-column: 1 / -1; }
.rack-item__meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0; }
.rack-item__bus { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; opacity: .55; }
.rack-item__status { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; display: inline-flex; align-items: center; gap: .4em; }
.rack-item__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.rack-item__status[data-status="live"] { color: #2e9e6b; }
.rack-item__status[data-status="private"] { color: #a3432f; }
.rack-item__status[data-status="early"] { color: #a8701c; }
.rack-item__name { margin: 0; font-size: 1.15rem; line-height: 1.15; }
.rack-item__name a, .rack-group__name a { text-decoration: none; color: inherit; }
.rack-item__name a:hover, .rack-group__name a:hover { color: var(--widget-accent, currentColor); }
.rack-item__gist { margin: 0; opacity: .82; font-size: .95rem; line-height: 1.4; flex: 1 0 auto; }
.rack-item__links { margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.rack-item__open {
  align-self: flex-start; font-size: .82rem; font-weight: 700; text-decoration: none;
  padding: .5em .9em; border-radius: 6px;
  color: var(--widget-accent-fg, #111); background: var(--widget-accent, #a8701c);
  border: 1px solid var(--widget-border-strong, transparent);
}
.rack-item__open:hover { filter: brightness(1.08); }
.rack-item__secondary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: .82rem; opacity: .85; }
.rack-item__2nd { color: inherit; }
.rack-sep { opacity: .5; }
.rack-post-title { font-style: italic; opacity: .85; }
.rack-item__private { font-size: .8rem; opacity: .6; font-style: italic; }
.rack-group__name { margin: 0; font-size: 1.2rem; line-height: 1.15; }
.rack-group__children { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 8px; }
.rack-item--child { background: rgba(127, 127, 127, .07); padding: 12px 14px; }
.rack-item--child .rack-item__name { font-size: 1rem; }

/* rack: live-preview embeds (click to load, one live at a time) ------------ */
.rack-embed { margin: 4px 0 2px; display: grid; gap: 8px; }
.rack-embed__stage {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  border: 1px solid var(--widget-border, var(--line, rgba(127, 127, 127, .28)));
  border-radius: 8px; background: rgba(127, 127, 127, .06);
  display: flex; align-items: center; justify-content: center;
}
.rack-embed__frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.rack-embed__load {
  font-size: .8rem; font-weight: 700; letter-spacing: .04em; cursor: pointer;
  padding: .6em 1em; border-radius: 6px; display: inline-flex; align-items: center; gap: .5em;
  color: var(--widget-accent-fg, #111); background: var(--widget-accent, #a8701c);
  border: 1px solid var(--widget-border-strong, transparent);
}
.rack-embed__load:hover { filter: brightness(1.08); }
.rack-embed__play { font-size: .8em; }
.rack-embed__bar { display: none; gap: 12px; align-items: center; font-size: .8rem; }
.rack-embed.is-loaded .rack-embed__bar { display: flex; }
.rack-embed__expand { background: none; border: 1px solid var(--line, rgba(127, 127, 127, .4)); color: inherit; padding: .3em .7em; border-radius: 5px; cursor: pointer; font-size: .78rem; }
.rack-embed__full { color: inherit; opacity: .85; }
.rack-embed.is-expanded .rack-embed__stage { aspect-ratio: auto; height: min(72vh, 720px); }

/* project detail: "read the full write-up" CTA (Phase C) ------------------- */
.writeup-cta { margin: 1.4em 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.writeup-cta__title { font-style: italic; opacity: .8; font-size: .9rem; }
