/* galley — site surface.
 *
 * The page this replaces was a cream document: an 880px column of monospace
 * prose with the one thing worth seeing — an actual rendered release video —
 * pushed a screenful and a half below the fold, behind three paragraphs
 * describing it. For a tool whose entire output is a moving picture, that is
 * the wrong order.
 *
 * This is a darkroom. The video is the first object on the page, lit against
 * a dark ground the way a screen actually is, with the numbers it renders
 * repeated beside it as an instrument readout. Everything else is a band
 * under it.
 *
 * Colour rule: every colour is declared once, in :root, and composed with
 * var() everywhere else.
 */

/* ============================================================ 1. FACES ==== */
/* Three roles in three faces. The video itself is set in JetBrains Mono, so
   the site keeps mono for every number, path and command — the things the
   product renders. Display and prose get faces of their own so the page has
   a voice distinct from its own output. All three are OFL 1.1, self-hosted
   beside their licences; this page makes no third-party requests. */

@font-face {
  font-family: "JetBrains Mono";
  src: url("./vendor/public/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./vendor/public/fonts/jetbrains-mono/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./vendor/public/fonts/jetbrains-mono/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("./vendor/public/fonts/space-grotesk/SpaceGrotesk[wght].woff2") format("woff2-variations");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("./vendor/public/fonts/manrope/Manrope[wght].woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
}

/* ======================================================= 2. SUBSTRATE ===== */

:root {
  color-scheme: dark;

  /* galley's brand accent (#B45309) expressed as a hue, so the wash, the
     record dot and every focus ring are the same amber the renders use. */
  --sig-h: 58;
  --sub-h: 42; /* a warm dark, not a blue one — this is a darkroom, not a lab */

  --s-0: oklch(0.148 0.010 var(--sub-h));
  --s-1: oklch(0.192 0.011 var(--sub-h));
  --s-2: oklch(0.235 0.012 var(--sub-h));
  --s-3: oklch(0.285 0.012 var(--sub-h));
  --edge-lo: oklch(0.325 0.012 var(--sub-h));
  --edge-hi: oklch(0.44 0.014 var(--sub-h));

  --ink-1: oklch(0.965 0.005 var(--sub-h));
  --ink-2: oklch(0.805 0.010 var(--sub-h));
  --ink-3: oklch(0.665 0.013 var(--sub-h));

  --shadow-ink: oklch(0.07 0.03 40);

  --sig: oklch(0.78 0.155 var(--sig-h));
  --sig-ink: oklch(0.85 0.13 var(--sig-h));
  --sig-glow: oklch(0.86 0.18 var(--sig-h));

  --ok: oklch(0.76 0.15 152);
  --no: oklch(0.72 0.16 27);
  --cool: oklch(0.72 0.13 232);

  --lit: inset 0 1px 0 var(--edge-hi);
  --elev-1: 0 1px 2px -1px oklch(from var(--shadow-ink) l c h / 32%),
            0 4px 12px -4px oklch(from var(--shadow-ink) l c h / 36%);
  --elev-2: 0 2px 4px -2px oklch(from var(--shadow-ink) l c h / 38%),
            0 14px 34px -10px oklch(from var(--shadow-ink) l c h / 46%);
  --elev-3: 0 6px 12px -6px oklch(from var(--shadow-ink) l c h / 44%),
            0 34px 80px -18px oklch(from var(--shadow-ink) l c h / 58%);

  --r-panel: 12px;
  --r-control: 8px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 140ms;
  --slow: 420ms;

  --f-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --f-data: "JetBrains Mono", ui-monospace, monospace;
  --f-text: "Manrope", ui-sans-serif, system-ui, "Segoe UI", sans-serif;

  --shell: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--s-0);
  color: var(--ink-1);
  font-family: var(--f-text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

.shell { max-width: var(--shell); margin-inline: auto; padding-inline: 24px; }
@media (max-width: 640px) { .shell { padding-inline: 18px; } }

/* ============================================================ 3. TYPE ===== */

h1, h2, h3 { font-family: var(--f-display); font-weight: 700; margin: 0; }

.display {
  font-size: clamp(2.25rem, 1.3rem + 4.1vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.042em;
  text-wrap: balance;
}

.display em { font-style: normal; color: var(--sig-ink); }

h2.section-title {
  font-size: clamp(1.55rem, 1.2rem + 1.6vw, 2.3rem);
  letter-spacing: -0.035em;
  line-height: 1.12;
  text-wrap: balance;
}

.eyebrow {
  font-family: var(--f-data);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.lede {
  font-size: clamp(1.02rem, 0.97rem + 0.24vw, 1.17rem);
  color: var(--ink-2);
  max-width: 52ch;
  margin: 14px 0 0;
}

.note { font-size: 0.82rem; color: var(--ink-3); line-height: 1.55; max-width: 78ch; }

code, .data { font-family: var(--f-data); font-variant-numeric: tabular-nums; }

code.inline {
  background: var(--s-2);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.86em;
  color: var(--ink-1);
}

a, a.textlink { color: var(--sig-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink-1); }

:focus-visible { outline: 2px solid var(--sig); outline-offset: 3px; border-radius: var(--r-control); }

/* ========================================================== 4. HEADER ===== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--s-0) 92%, transparent);
  border-bottom: 1px solid var(--edge-lo);
}

.site-header__in { display: flex; align-items: center; gap: 12px; height: 58px; }
.site-header img.lockup { height: 26px; width: auto; display: block; }

.site-header nav {
  margin-left: auto;
  display: flex;
  gap: 4px;
  font-family: var(--f-data);
  font-size: 0.8rem;
}

.site-header nav a {
  color: var(--ink-3);
  text-decoration: none;
  padding: 8px 12px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-control);
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.site-header nav a:hover { color: var(--ink-1); background: var(--s-2); }

@media (max-width: 700px) {
  .site-header nav a[data-optional] { display: none; }
  .site-header nav a { padding: 8px 10px; font-size: 0.76rem; }
}

/* ============================================================ 5. BANDS ==== */

.band {
  padding-block: clamp(52px, 4vw, 92px);
  border-top: 1px solid var(--edge-lo);
}

.band--tone { background: var(--s-1); }
.band__head { margin-bottom: 28px; }
.band__head .eyebrow { display: block; margin-bottom: 10px; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(32px, 2.6vw, 46px) clamp(48px, 4.4vw, 84px);
}

/* One ambient wash, warm, offset behind the screen. Two flat radial
   gradients — no blur filter and no blend mode, both of which measured a
   double-digit frame-rate cost on a sibling project. */
.hero::before {
  content: "";
  position: absolute;
  inset: -25% -12% auto -12%;
  height: 150%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(46% 44% at 72% 8%, oklch(from var(--sig-glow) l c h / 17%), transparent 68%),
    radial-gradient(40% 38% at 10% 2%, oklch(0.72 0.12 28 / 10%), transparent 70%);
}

.hero--page { padding-block: clamp(28px, 2.4vw, 40px) clamp(28px, 2.4vw, 42px); }

/* =========================================================== 6. SCREEN ==== */

.stage {
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr;
  margin-top: 26px;
  align-items: start;
}

@media (min-width: 960px) {
  .stage { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 30px; }
}

.screen {
  border-radius: var(--r-panel);
  background: var(--s-1);
  box-shadow: var(--lit), var(--elev-3);
  overflow: hidden;
}

.screen__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--s-2);
  border-bottom: 1px solid var(--edge-lo);
  font-family: var(--f-data);
  font-size: 0.72rem;
  color: var(--ink-3);
}

.rec {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-left: auto;
  color: var(--ink-3);
}

.rec::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--sig);
  box-shadow: 0 0 0 3px oklch(from var(--sig) l c h / 22%);
}

.screen video {
  width: 100%;
  display: block;
  background: #000;
  aspect-ratio: 16 / 9;
}

.screen__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--edge-lo);
  background: var(--s-1);
  font-family: var(--f-data);
  font-size: 0.72rem;
  color: var(--ink-3);
}

/* --- the readout beside the screen -------------------------------------- */

.readout-card {
  border-radius: var(--r-panel);
  background: var(--s-1);
  box-shadow: var(--lit), var(--elev-1);
  padding: 18px 20px;
}

.readout-card + .readout-card { margin-top: 14px; }

.rlabel {
  font-family: var(--f-data);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 14px; }

.fig__n {
  font-family: var(--f-display);
  font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.fig__l { font-family: var(--f-data); font-size: 0.68rem; color: var(--ink-3); margin-top: 7px; line-height: 1.45; }

/* A source tag — where a number came from. Not a coloured left border on a
   card; a small leading dot and a tinted wash, so the tag reads as a label
   rather than as decoration bolted to a box. */
.src {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-data);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  min-height: 22px;
  margin-top: 8px;
  color: var(--ink-2);
  background: var(--s-2);
}

.src::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex: none; }
.src--git { color: var(--sig-ink); }
.src--ci { color: var(--ok); }
.src--gh { color: var(--cool); }
.src--none { color: var(--no); }

/* =========================================================== 7. BEATS ===== */

/* Two across, not four. At four columns each frame was 273px wide and the
   render's own type — the whole point of showing a frame — came out around
   10px tall and unreadable. Two columns doubles it. */
.beats { display: grid; gap: 16px; grid-template-columns: 1fr; }

@media (min-width: 760px) { .beats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.beat {
  border-radius: var(--r-panel);
  overflow: hidden;
  background: var(--s-1);
  box-shadow: var(--lit), var(--elev-1);
  transition: transform var(--slow) var(--ease), box-shadow var(--slow) var(--ease);
}

.beat:hover { transform: translateY(-3px); box-shadow: var(--lit), var(--elev-2); }
/* height:auto is load-bearing: the <img> carries width/height attributes so
   the box is reserved before the frame decodes (no layout shift), and without
   this the attribute height wins over aspect-ratio and the frame renders
   273x630 — a portrait crop through the middle of the render's own text. */
.beat img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--s-2);
}

.beat__cap {
  padding: 11px 14px 14px;
  font-family: var(--f-data);
  font-size: 0.68rem;
  color: var(--ink-3);
  line-height: 1.45;
}

.beat__cap b { display: block; color: var(--ink-1); font-weight: 500; font-size: 0.74rem; margin-bottom: 4px; letter-spacing: 0.02em; }

/* ========================================================= 8. PROVENANCE == */
/* A numbered spec table, not three feature cards. Every row is a real source
   with its real command and its real availability, and the rows differ in
   length because the sources differ — which is the point. */

.chain { list-style: none; margin: 0; padding: 0; counter-reset: none; }

.chain__row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  padding: 20px 0;
  border-top: 1px solid var(--edge-lo);
  align-items: start;
}

.chain__row:last-child { border-bottom: 1px solid var(--edge-lo); }

@media (min-width: 900px) {
  .chain__row {
    grid-template-columns: 2.6rem 15rem minmax(0, 1fr) 15rem;
    gap: 24px;
    align-items: baseline;
  }
}

.chain__n {
  font-family: var(--f-data);
  font-size: 0.72rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.chain__id { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.chain__id code { font-size: 0.7rem; color: var(--ink-3); overflow-wrap: anywhere; }

.chain__what { margin: 0; color: var(--ink-2); font-size: 0.9rem; line-height: 1.55; }

.chain__meta { display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
  font-family: var(--f-data);
  font-size: 0.64rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 9px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--s-2);
  color: var(--ink-3);
}

.pill--ok { color: var(--ok); }
.pill--net { color: var(--cool); }

/* ============================================================ 9. CLI ====== */

pre.cli {
  margin: 0;
  padding: 20px 22px;
  border-radius: var(--r-panel);
  background: var(--s-1);
  box-shadow: var(--lit), var(--elev-1);
  overflow-x: auto;
  font-family: var(--f-data);
  font-size: 0.82rem;
  line-height: 1.85;
  color: var(--ink-2);
}

@media (max-width: 560px) { pre.cli { font-size: 0.72rem; padding: 15px 16px; } }

pre.cli .p { color: var(--sig-ink); user-select: none; }
pre.cli .comment { color: var(--ink-3); }
pre.cli b { color: var(--ink-1); font-weight: 500; }

/* ======================================================== 10. DETAILS ===== */

details.more {
  margin-top: 18px;
  border-radius: var(--r-control);
  background: var(--s-1);
  box-shadow: var(--lit);
  overflow: hidden;
}

details.more > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--f-data);
  font-size: 0.78rem;
  color: var(--ink-2);
  transition: background-color var(--fast) var(--ease);
}

details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; color: var(--sig-ink); font-weight: 700; }
details.more[open] > summary::before { content: "\2212"; }
details.more > summary:hover { background: var(--s-2); }
details.more .body { padding: 0 16px 16px; color: var(--ink-2); font-size: 0.88rem; line-height: 1.6; }
details.more .body p { margin: 0 0 10px; max-width: 74ch; }
details.more .body p:last-child { margin: 0; }

/* ======================================================== 11. DOC PAGES === */

.docs { display: grid; gap: 26px; grid-template-columns: 1fr; align-items: start; }

@media (min-width: 940px) {
  .docs { grid-template-columns: 14rem minmax(0, 1fr); gap: 54px; }
  .docs__index { position: sticky; top: 80px; }
}

.docs__index ol { list-style: none; margin: 10px 0 0; padding: 0; counter-reset: idx; }
.docs__index li { counter-increment: idx; }

.docs__index a {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  min-height: 34px;
  border-radius: var(--r-control);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.84rem;
  line-height: 1.35;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.docs__index a::before { content: counter(idx); font-family: var(--f-data); font-size: 0.7rem; color: var(--sig-ink); flex: none; }
.docs__index a:hover { background: var(--s-2); color: var(--ink-1); }

.callout {
  padding: 18px 20px;
  border-radius: var(--r-panel);
  background: var(--s-1);
  box-shadow: var(--lit), var(--elev-1);
  margin: 0 0 18px;
}

.callout h3 {
  font-family: var(--f-data);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.callout p { margin: 0 0 12px; color: var(--ink-2); font-size: 0.92rem; }
.callout p:last-child { margin-bottom: 0; }

table.plain {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.86rem;
  margin: 0;
  display: block;
  overflow-x: auto;
}

table.plain th, table.plain td {
  text-align: left;
  padding: 12px 14px 12px 0;
  border-bottom: 1px solid var(--edge-lo);
  vertical-align: top;
}

table.plain th {
  font-family: var(--f-data);
  color: var(--ink-3);
  font-weight: 500;
  white-space: nowrap;
  padding-right: 24px;
}

table.plain td { color: var(--ink-2); line-height: 1.55; }

/* ========================================================== 12. FOOTER ==== */

.site-footer { border-top: 1px solid var(--edge-lo); padding-block: 30px 44px; font-size: 0.82rem; color: var(--ink-3); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.site-footer nav a {
  color: var(--ink-3);
  text-decoration: none;
  padding: 7px 11px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-control);
  background: var(--s-1);
  font-family: var(--f-data);
  font-size: 0.76rem;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.site-footer nav a:hover { background: var(--s-2); color: var(--ink-1); }

/* attribution-kit v1 — the maker's mark inherits colour; the pin takes the amber */
.aj-attribution { margin: 0; font: inherit; line-height: 1.5; color: inherit; }
.aj-attribution__mark { display: inline-block; width: 20px; height: 20px; vertical-align: -0.3em; margin-right: 0.45em; }
.aj-attribution a { color: inherit; text-decoration: underline; text-underline-offset: 0.15em; }
.aj-attribution a:hover { text-decoration-thickness: 2px; color: var(--ink-1); }
.aj-attribution a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.aj-attribution__sep { margin: 0 0.35em; }
.aj-attribution { --aj-attribution-signal: oklch(0.78 0.155 58); }

/* ==================================================== 13. REDUCED MOTION == */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .beat, .beat:hover, .source, .source:hover { transform: none; transition: none; }
  .site-header nav a, .site-footer nav a, .docs__index a, details.more > summary { transition: none; }
}
