/*
 * pclshm.dev · hub.pclshm.dev — the pclshm family's EDITORIAL DARK register, the one
 * playground.pclshm.dev and pclshm.io already wear: warm near-black ground, the ember accent,
 * Newsreader for display, Geist for prose, JetBrains Mono for every piece of metadata.
 *
 * The tokens are the family's website values (the design-system spec's dark theme and the
 * pclshm.io kit), spelled once here as the Playground site does. Hub's own tokens in src/styles/
 * are the paper-and-ember installer register at medium density; a website is the editorial
 * register at comfortable density. They share the hue and the faces, not the values.
 *
 * Rules this file keeps: hairline rules over cards, one bordered container deep; metadata always
 * mono and tabular, prose never mono; status never drawn in the accent; the gradient only on the
 * single primary call-to-action; nothing claims a state the page cannot observe.
 */

/* Self-hosted, so the page makes no third-party request. Licences sit beside the files. */
@font-face {
  font-family: "Geist";
  src: url("fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* surfaces */
  --surface-window: #0e0d0c;
  --surface-raised: #151413;
  --surface-code: #0a0a09;
  --line-subtle: #262421;
  --line-default: #393934;
  --line-strong: #4f4d47;

  /* text — every pair here is at least 5.2:1 on every surface above */
  --text-primary: #f4f1ea;
  --text-secondary: #ada99f;
  --text-muted: #8c887e;
  --text-on-action: #1c1c1a;

  /* the brand hue: ember, the dark-theme value of the family token */
  --ember: #f18a62;
  --action-gradient: linear-gradient(100deg, #f2b45c, #e8813f);

  /* faces */
  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, "SF Mono", Consolas, monospace;

  /* scale — the family's, verbatim */
  --type-xs: 11px;
  --type-sm: 12px;
  --type-base: 13.5px;
  --type-md: 15px;
  --type-lg: 18px;
  --type-xl: 22px;
  --type-2xl: 28px;
  --type-3xl: 40px;
  --type-4xl: 56px;

  /* spacing — the 4px scale; a website is the comfortable density */
  --space-2: 2px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-28: 28px;
  --space-36: 36px;
  --space-48: 48px;
  --space-72: 72px;
  --row: 48px;
  --target: 44px;
  --radius: 2px;

  /* layout — the family frame: a 72px header, a 1280px frame, one gutter */
  --header-height: 72px;
  --frame-max: 1280px;
  --gutter: clamp(20px, 3vw, 48px);
  --frame: min(var(--frame-max), calc(100% - 2 * var(--gutter)));
  --section-space: clamp(48px, 5vw, 72px);

  /* motion */
  --motion-fast: 120ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-reduced-motion: reduce) {
  :root { --motion-fast: 0ms; }
  html { scroll-behavior: auto !important; }
}

/* ---- ground ------------------------------------------------------------------------ */

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-16));
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--surface-window);
  color: var(--text-primary);
  font: 400 var(--type-md) / 1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3 { margin: 0; font-weight: 400; line-height: 1.1; text-wrap: balance; }
h1, h2 { font-family: var(--font-display); letter-spacing: -0.005em; }
a { color: var(--ember); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
/* A link inside running text carries an underline, not only a colour (WCAG 1.4.1). */
p a:not(.addr), dd a {
  text-decoration: underline; text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--ember) 45%, transparent);
}
p a:not(.addr):hover, dd a:hover { text-decoration-color: currentColor; }
strong, b { font-weight: 500; color: var(--text-primary); }
ul, ol { margin: 0; padding: 0; }
::selection { background: var(--ember); color: var(--text-on-action); }

/* Focus: one ring, everywhere — 2px of the accent at a 2px offset. */
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 20;
  padding: var(--space-8) var(--space-12);
  background: var(--surface-raised); border: 1px solid var(--line-default); color: var(--text-primary);
  font: 500 var(--type-sm) / 1 var(--font-mono);
}
.skip:focus { top: var(--space-12); }

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

/* Metadata is always mono, always tabular, and the smallest thing on screen. */
code, .mono, .eyebrow, .marker, .btn, .map, .kind, .facts, .tool .n,
.stage-n, .passes thead, .verb, figcaption, .code, .fine-print {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
code {
  font-size: 0.92em; color: var(--text-primary);
  background: var(--surface-raised); border: 1px solid var(--line-subtle);
  padding: 1px 5px; border-radius: var(--radius);
}

.eyebrow {
  font-size: var(--type-xs); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-secondary);
}
.eyebrow b { color: var(--ember); font-weight: 500; }

/* Arrows are drawn rather than typed: none of the three faces carries the glyphs. */
.icon { display: inline-block; width: 0.8em; height: 0.8em; vertical-align: -0.05em; flex: none; }

/* ---- the frame ----------------------------------------------------------------------- */

.frame { width: var(--frame); margin-inline: auto; }
main > section { padding-block: var(--section-space); }
main > section + section { border-top: 1px solid var(--line-subtle); }

.section-head { display: grid; gap: var(--space-12); max-width: 48rem; margin-bottom: var(--space-36); }
.section-head h2 { font-size: clamp(var(--type-2xl), 1.4rem + 1.8vw, var(--type-3xl)); }
.section-head p { color: var(--text-secondary); max-width: 44rem; }

/* The numbered marker: mono, with a hairline running to the margin. */
.marker {
  display: flex; align-items: center; gap: var(--space-12);
  font-size: var(--type-xs); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-secondary);
}
.marker b { color: var(--ember); font-weight: 500; }
.marker::after { content: ""; flex: 1; height: 1px; background: var(--line-subtle); }

/* ---- header and footer: the family shell, assets/family/shell.css ---------------------- */

/* ---- buttons ------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8);
  min-height: var(--target); padding: 0 var(--space-20);
  font-size: var(--type-sm); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-primary); background: transparent;
  border: 1px solid var(--line-default); border-radius: var(--radius);
  transition: border-color var(--motion-fast) var(--ease), background-color var(--motion-fast) var(--ease);
}
.btn:hover { text-decoration: none; border-color: var(--line-strong); background-color: var(--surface-raised); }
/* The gradient: the one primary call-to-action on the page, with ink on it, and nowhere else. */
.btn-primary { background: var(--action-gradient); border-color: transparent; color: var(--text-on-action); }
.btn-primary:hover { background: var(--action-gradient); filter: brightness(1.05); }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---- hero ---------------------------------------------------------------------------- */

main > section.hero { padding-block: clamp(48px, 7vw, 96px) var(--section-space); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--space-48) clamp(var(--space-36), 5vw, var(--space-72)); align-items: start;
}
.hero-copy { display: grid; gap: var(--space-20); }
.hero h1 { font-size: clamp(2.5rem, 1.5rem + 4vw, var(--type-4xl)); }
.hero h1 .turn { display: block; font-style: italic; color: var(--ember); }
.lede { font-size: var(--type-lg); line-height: 1.5; color: var(--text-secondary); max-width: 38rem; }
.cta { display: flex; flex-wrap: wrap; gap: var(--space-12); align-items: center; margin-top: var(--space-8); }
.fine-print { font-size: var(--type-sm); line-height: 1.6; color: var(--text-secondary); max-width: 38rem; }

/* ---- the map: every pclshm address, as a tree ------------------------------------------ */

.map {
  container-type: inline-size;
  border: 1px solid var(--line-default); border-radius: var(--radius);
  background: var(--surface-raised);
}
.map-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-12);
  min-height: 40px; padding: var(--space-8) var(--space-16);
  border-bottom: 1px solid var(--line-subtle);
  font-size: var(--type-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary);
}
.map-bar span { white-space: nowrap; }
.map-bar span:last-child { color: var(--text-muted); }
.tree { list-style: none; padding: var(--space-12) var(--space-16) var(--space-16); }
.tree ul { list-style: none; margin-left: 5px; }
.tree li { position: relative; }
/* The branches: an L from the parent's rule to each child, and the rule runs on past all but the last. */
.tree ul > li { padding-left: var(--space-20); }
.tree ul > li::before {
  content: ""; position: absolute; left: 0; top: 0;
  width: 12px; height: 22px;
  border-left: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong);
}
.tree ul > li:not(:last-child)::after {
  content: ""; position: absolute; left: 0; top: 22px; bottom: 0;
  border-left: 1px solid var(--line-strong);
}
.site {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-12);
  padding-block: 9px; min-height: 44px;
}
.addr { font-size: var(--type-base); color: var(--text-primary); white-space: nowrap; }
a.addr { color: var(--ember); }
.leader { flex: 1; min-width: var(--space-16); border-bottom: 1px dotted var(--line-strong); transform: translateY(-4px); }
.role { font-size: var(--type-xs); color: var(--text-secondary); text-align: right; }
.reserved .addr { color: var(--text-muted); }
.map-note {
  padding: var(--space-12) var(--space-16);
  border-top: 1px solid var(--line-subtle);
  font-size: var(--type-xs); line-height: 1.6; color: var(--text-secondary);
}
/* In a narrow map, the role sits under its address instead of across a leader. */
@container (max-width: 440px) {
  .leader { display: none; }
  .site { flex-direction: column; gap: var(--space-2); }
  .role { text-align: left; }
}

/* ---- 01 the tools: rows, not cards ----------------------------------------------------- */

.tools { list-style: none; border-top: 1px solid var(--line-subtle); }
.tool {
  display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
  gap: var(--space-16) var(--space-48);
  padding-block: var(--space-36);
  border-bottom: 1px solid var(--line-subtle);
}
.tool-head { display: grid; gap: var(--space-8); align-content: start; }
.tool .n { font-size: var(--type-xs); letter-spacing: 0.1em; color: var(--ember); }
.tool .name { font: 500 var(--type-lg) / 1.25 var(--font-mono); letter-spacing: -0.01em; color: var(--text-secondary); }
.tool .name .slash { color: var(--text-muted); }
.tool .name .product { color: var(--ember); }
.tool .name .own { color: var(--text-primary); }
.tool .name .by { margin-left: var(--space-8); font-size: var(--type-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); font-weight: 400; }
.kind { font-size: var(--type-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); }
.tool-body { display: grid; gap: var(--space-12); max-width: 48rem; }
.tagline { font-family: var(--font-display); font-size: clamp(var(--type-xl), 1.1rem + 0.8vw, var(--type-2xl)); line-height: 1.2; color: var(--text-primary); }
.desc { color: var(--text-secondary); }

.facts { margin: var(--space-8) 0 0; border-top: 1px solid var(--line-subtle); }
.facts div {
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: var(--space-12);
  padding-block: var(--space-8); border-bottom: 1px solid var(--line-subtle);
}
.facts dt { font-size: var(--type-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); padding-top: 2px; }
.facts dd { margin: 0; font-size: var(--type-sm); line-height: 1.6; color: var(--text-primary); overflow-wrap: anywhere; }
.facts dd .muted { color: var(--text-secondary); }

/* ---- 02 how they fit ------------------------------------------------------------------- */

.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line-subtle); }
.stage { display: grid; gap: var(--space-12); align-content: start; padding: var(--space-28) var(--space-28) var(--space-28) 0; }
.stage + .stage { padding-left: var(--space-28); border-left: 1px solid var(--line-subtle); }
.stage-n {
  display: flex; align-items: center; gap: var(--space-12);
  font-size: var(--type-xs); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-secondary);
}
.stage-n b { color: var(--ember); font-weight: 500; }
.stage h3 { font-family: var(--font-display); font-size: var(--type-xl); line-height: 1.2; }
.stage ul { list-style: none; display: grid; gap: var(--space-12); }
.stage li { font-size: var(--type-base); line-height: 1.6; color: var(--text-secondary); }
.stage li b { display: block; font-family: var(--font-mono); font-size: var(--type-sm); }

/* Hub is drawn around the work, not inside it: the one dashed boundary on the page. */
.around {
  display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: var(--space-8) var(--space-28); align-items: baseline;
  margin-top: var(--space-20); padding: var(--space-20) var(--space-20);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.around p { font-size: var(--type-base); line-height: 1.6; color: var(--text-secondary); }
.around p b { font-family: var(--font-mono); font-size: var(--type-sm); }
.loop { margin-top: var(--space-20); max-width: 48rem; font-family: var(--font-display); font-style: italic; font-size: var(--type-lg); line-height: 1.45; color: var(--text-primary); }

.passes-head { margin: var(--space-48) 0 var(--space-16); font-family: var(--font-display); font-size: var(--type-xl); }
.passes { width: 100%; border-collapse: collapse; }
.passes th, .passes td { text-align: left; vertical-align: baseline; padding: var(--space-12) var(--space-20) var(--space-12) 0; border-bottom: 1px solid var(--line-subtle); }
.passes th:last-child, .passes td:last-child { padding-right: 0; }
.passes thead th {
  padding-block: var(--space-8); border-bottom-color: var(--line-default);
  font-size: var(--type-xs); font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary);
}
.passes tbody th { font: 500 var(--type-sm) / 1.6 var(--font-mono); color: var(--text-primary); white-space: nowrap; }
.passes tbody th .icon { width: 0.9em; height: 0.9em; margin: 0 0.25em; color: var(--text-muted); }
.passes td { font-size: var(--type-base); line-height: 1.6; color: var(--text-secondary); }
.passes td.what { color: var(--text-primary); }

/* ---- 03 hub ---------------------------------------------------------------------------- */

.hub-grid { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: var(--space-48); align-items: start; }
.hub-copy { display: grid; gap: var(--space-20); }
.hub-copy h2 { font-size: clamp(var(--type-2xl), 1.4rem + 1.8vw, var(--type-3xl)); }
.verbs { list-style: none; border-top: 1px solid var(--line-subtle); }
.verbs li { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: var(--space-16); padding-block: var(--space-16); border-bottom: 1px solid var(--line-subtle); }
.verb { font-size: var(--type-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ember); padding-top: 3px; }
.verbs p { font-size: var(--type-base); line-height: 1.6; color: var(--text-secondary); }
.never { font-size: var(--type-base); line-height: 1.6; color: var(--text-secondary); border-left: 2px solid var(--line-strong); padding-left: var(--space-16); }

figure.shot { margin: 0; border: 1px solid var(--line-default); border-radius: var(--radius); background: var(--surface-raised); overflow: hidden; }
figure.shot img { width: 100%; }
figure.shot figcaption {
  display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-16); align-items: baseline;
  padding: var(--space-8) var(--space-12); border-top: 1px solid var(--line-subtle);
  font-size: var(--type-xs); line-height: 1.6; color: var(--text-secondary);
}
figure.shot figcaption b { color: var(--text-primary); font-weight: 500; }
figure.shot figcaption .from { margin-left: auto; color: var(--text-muted); }

.hub-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-48); margin-top: var(--space-48); align-items: start; }
.hub-detail h3 { font-family: var(--font-display); font-size: var(--type-xl); margin-bottom: var(--space-12); }
.hub-detail .stands { display: grid; gap: var(--space-12); }
.hub-detail .stands p { color: var(--text-secondary); }

.code { border: 1px solid var(--line-default); border-radius: var(--radius); background: var(--surface-code); overflow: hidden; }
.code + .code { margin-top: var(--space-16); }
.code .bar {
  display: flex; align-items: center; gap: var(--space-12);
  min-height: 34px; padding: 0 var(--space-12);
  border-bottom: 1px solid var(--line-subtle); background: var(--surface-raised);
  font-size: var(--type-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary);
}
.code .bar .lang { margin-left: auto; color: var(--text-muted); }
.code pre { margin: 0; padding: var(--space-16); overflow-x: auto; font: 400 var(--type-sm) / 1.7 var(--font-mono); color: var(--text-primary); tab-size: 2; }
.code .c { color: var(--text-secondary); }

/* ---- 04 house rules -------------------------------------------------------------------- */

.rules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-subtle); }
.rules > div { display: grid; gap: var(--space-12); align-content: start; padding: var(--space-28) var(--space-28) var(--space-28) 0; border-bottom: 1px solid var(--line-subtle); }
.rules > div + div { padding-left: var(--space-28); border-left: 1px solid var(--line-subtle); }
.rules h3 { font-family: var(--font-display); font-size: var(--type-xl); line-height: 1.2; }
.rules p { font-size: var(--type-base); line-height: 1.6; color: var(--text-secondary); }

/* ---- 404 ------------------------------------------------------------------------------- */

.lost { display: grid; gap: var(--space-20); max-width: 44rem; }
.lost h1 { font-size: clamp(2.25rem, 1.4rem + 3vw, var(--type-3xl)); }

/* ---- responsive ------------------------------------------------------------------------- */

@media (max-width: 1040px) {
  .hero-grid, .hub-grid { grid-template-columns: minmax(0, 1fr); }
  .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rules > div:nth-child(odd) { padding-left: 0; border-left: 0; }
}
@media (max-width: 860px) {
  .tool { grid-template-columns: minmax(0, 1fr); padding-block: var(--space-28); }
  .stages { grid-template-columns: minmax(0, 1fr); }
  .stage, .stage + .stage { padding: var(--space-20) 0; border-left: 0; }
  .stage + .stage { border-top: 1px solid var(--line-subtle); }
  .around { grid-template-columns: minmax(0, 1fr); }
  .hub-detail { grid-template-columns: minmax(0, 1fr); gap: var(--space-36); }

  /* The table becomes one block per row; the column names go to assistive technology only. */
  .passes, .passes tbody, .passes tr, .passes th, .passes td { display: block; }
  .passes thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .passes tr { padding-block: var(--space-12); border-bottom: 1px solid var(--line-subtle); }
  .passes tbody tr:first-child { border-top: 1px solid var(--line-default); }
  .passes th, .passes td { padding: 0; border: 0; }
  .passes tbody th { white-space: normal; margin-bottom: var(--space-4); }
  .passes td.what { margin-bottom: var(--space-4); }
}
@media (max-width: 600px) {
  main > section { padding-block: var(--space-48); }
  .code pre { font-size: var(--type-xs); }
  .lede { font-size: var(--type-md); }
  .rules { grid-template-columns: minmax(0, 1fr); }
  .rules > div, .rules > div + div { padding: var(--space-20) 0; border-left: 0; }
  .facts div { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .verbs li { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  figure.shot figcaption .from { margin-left: 0; }
}
