/* ============================================================
   WERKBANK — design system for Complex Perspective · How-to
   ------------------------------------------------------------
   The pragmatic panel of the triptych. The 2016 book built the
   lens; this site is the bench where it becomes a tool. Warm
   workshop paper, pegboard dot-grid, mono part-labels, and one
   signal-orange accent that always means "a move you can make".
   Accent semantics are content rules, not decoration:
   - orange  = A MOVE  (move chips, toolbox IDs, actions)
   - oxide   = A TRAP  (trap cards, stop-list marks)
   - navy    = INTO THE SERIES (links to the sibling sites)
   Dark mode is the night shift: same bench, lamp on.
   House rules: tokens on :root, dark re-declares under .dark;
   paper never pure white, ink never pure black.
   ============================================================ */

:root {
  /* surfaces & ink */
  --c-bg: #F2EEE3;          /* workshop paper — warm, never white */
  --c-surface: #FAF7EF;     /* raised cards / worksheets */
  --c-ink: #232019;         /* warm ink — never pure black */
  --c-muted: #6E675A;
  --c-rule: #D9D2C0;
  /* accents — each carries meaning */
  --c-accent: #C1531A;      /* signal orange — A MOVE: action you can take */
  --c-accent-soft: #9E4315;
  --c-trap: #8C3B32;        /* oxide red — A TRAP: where systems rust */
  --c-series: #223284;      /* triptych navy — links INTO the sibling sites */
  /* texture */
  --dot: rgba(35, 32, 25, 0.13);   /* pegboard dots */
  --shadow: 0 1px 2px rgba(35,32,25,.06), 0 8px 24px rgba(35,32,25,.07);
  /* type */
  --font-display: "Bricolage Grotesque", sans-serif;
  --font-body: "Spectral", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-ui: "IBM Plex Mono", ui-monospace, monospace;
  /* layout */
  --measure: 34rem;
  --rail: 16.5rem;
  --page: 72rem;
}

html.dark {
  --c-bg: #17150F;          /* night shift — bench under the lamp */
  --c-surface: #201D14;
  --c-ink: #E9E3D3;
  --c-muted: #9A917C;
  --c-rule: #37321F;
  --c-accent: #E17C42;      /* orange brightens under the lamp */
  --c-accent-soft: #EC9A6B;
  --c-trap: #CE7263;
  --c-series: #8FA1EC;
  --dot: rgba(233, 227, 211, 0.10);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  /* pegboard wash — the workbench texture */
  background-image: radial-gradient(var(--dot) 1px, transparent 1.4px);
  background-size: 26px 26px;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.62;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  text-wrap: balance;
}

a { color: var(--c-accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--c-accent-soft); }

code, pre, .data { font-family: var(--font-mono); font-size: 0.9em; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--c-accent); color: var(--c-bg); padding: 0.5rem 1rem;
}
.skip-link:focus { left: 0; z-index: 10; }

/* ---------- masthead ---------- */

.masthead { border-bottom: 1px solid var(--c-rule); }

.masthead__inner {
  max-width: var(--page); margin: 0 auto; padding: 0.9rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}

.brand { text-decoration: none; color: var(--c-ink); }
.brand__title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }

.masthead__links { display: flex; align-items: center; gap: 1.1rem; }

.navlink {
  font-family: var(--font-ui); font-size: 0.95rem;
  color: var(--c-ink); text-decoration: none;
}
.navlink:hover { color: var(--c-accent); }

.masthead__burger { display: none; }

.theme-toggle {
  background: none; border: 1px solid var(--c-rule); border-radius: 999px;
  width: 2.1rem; height: 2.1rem; padding: 0.35rem; cursor: pointer; color: var(--c-ink);
}
.theme-toggle svg { width: 100%; height: 100%; }
.theme-toggle__moon { display: none; }
html.dark .theme-toggle__sun { display: none; }
html.dark .theme-toggle__moon { display: block; }

@media (max-width: 40rem) {
  .masthead__burger {
    display: flex; flex-direction: column; gap: 4px;
    background: none; border: none; padding: 0.4rem; cursor: pointer;
  }
  .masthead__burger span { width: 20px; height: 2px; background: var(--c-ink); }
  .masthead__links {
    display: none; position: absolute; right: 1rem; top: 3.4rem;
    flex-direction: column; align-items: flex-end; gap: 0.8rem;
    background: var(--c-surface); border: 1px solid var(--c-rule);
    border-radius: 6px; padding: 1rem 1.25rem; z-index: 20;
  }
  .masthead__links.is-open { display: flex; }
}

/* ---------- content ---------- */

.hero { max-width: var(--measure); margin: 3.5rem auto 1rem; padding: 0 1.25rem; }
.hero__title { font-size: clamp(2rem, 6vw, 3.2rem); margin: 0 0 0.5rem; }
.hero__dek { color: var(--c-muted); font-size: 1.15rem; margin: 0; }

.prose { max-width: var(--measure); margin: 2rem auto 4rem; padding: 0 1.25rem; }
.prose h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
.prose img { max-width: 100%; height: auto; }
.prose blockquote {
  margin: 1.5rem 0; padding: 0.25rem 0 0.25rem 1.1rem;
  border-left: 3px solid var(--c-accent); color: var(--c-muted); font-style: italic;
}
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border-bottom: 1px solid var(--c-rule); padding: 0.4rem 0.6rem; text-align: left; }
.prose th { font-family: var(--font-ui); font-size: 0.85rem; }

/* ---------- colophon ---------- */

.colophon { border-top: 1px solid var(--c-rule); margin-top: 2rem; }
.colophon__inner {
  max-width: var(--page); margin: 0 auto; padding: 2rem 1.25rem 2.5rem;
  font-family: var(--font-ui); font-size: 0.9rem; color: var(--c-muted);
}
.colophon__title { font-family: var(--font-display); color: var(--c-ink); margin: 0 0 0.5rem; }
.colophon__links { display: flex; flex-wrap: wrap; gap: 1rem; }
.colophon__links a { color: var(--c-muted); }
.colophon__foot { margin-top: 1.25rem; }

/* ---------- motion & print floor (non-negotiable) ---------- */

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

@media print {
  .masthead, .colophon, .theme-toggle, .skip-link { display: none; }
  body { background: #fff; color: #000; }
}

/* ============================================================
   Werkbank components (from the approved design.html mock)
   ============================================================ */

/* ---- labels & kickers ---- */

.kicker {
  font-family: var(--font-mono); font-size: 0.74rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--c-accent);
}

.standfirst {
  font-size: 1.08rem; font-weight: 300; color: var(--c-muted);
  margin: 0.3rem 0 1.6rem; max-width: var(--measure);
}

/* ---- home: hero, series line, arena cards, toolbox strip ---- */

.wb-hero { max-width: 56rem; margin: 0 auto; padding: 3.5rem 1.25rem 2.5rem; }
.wb-hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 750; margin: 0.7rem 0 1.1rem; }
.wb-hero .lede { font-size: 1.18rem; font-weight: 300; max-width: 38rem; margin: 0; }

.seriesline {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  margin: 2.2rem 0 0; font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.04em;
}
.seriesline a {
  display: inline-flex; gap: 0.5rem; align-items: baseline; text-decoration: none;
  border: 1px solid var(--c-rule); border-radius: 6px; padding: 0.45rem 0.8rem;
  color: var(--c-series); background: var(--c-surface);
}
.seriesline a b { color: var(--c-muted); font-weight: 500; }
.seriesline a:hover { border-color: var(--c-series); color: var(--c-series); }
.seriesline .arrow { color: var(--c-muted); }
.seriesline .here {
  font-family: var(--font-mono); border: 1px solid var(--c-accent); border-radius: 6px;
  padding: 0.45rem 0.8rem; color: var(--c-accent);
}

.arenas {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: 1rem; padding: 0 1.25rem 2rem; max-width: var(--page); margin: 0 auto;
}
.arena {
  border: 1px solid var(--c-rule); border-radius: 8px; background: var(--c-surface);
  padding: 1.1rem 1.2rem 1.2rem; text-decoration: none; color: var(--c-ink);
  display: block; position: relative; transition: transform 0.15s, border-color 0.15s;
}
.arena:hover { transform: translateY(-2px); border-color: var(--c-accent); color: var(--c-ink); }
.arena .no { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; color: var(--c-muted); }
.arena h2 { font-size: 1.25rem; font-weight: 700; margin: 0.35rem 0 0.4rem; }
.arena p { font-size: 0.92rem; color: var(--c-muted); line-height: 1.5; margin: 0; }
.arena::after { content: "→"; position: absolute; right: 1rem; top: 1rem; color: var(--c-accent); opacity: 0; transition: opacity 0.15s; }
.arena:hover::after { opacity: 1; }

.toolstrip {
  margin: 0 auto 3.5rem; max-width: calc(var(--page) - 2.5rem);
  border: 1px dashed var(--c-accent); border-radius: 8px; padding: 1rem 1.4rem;
  display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap;
}
.toolstrip .label { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; color: var(--c-accent); }
.toolstrip p { font-size: 0.98rem; margin: 0; }

/* ---- chapter page: crumb, grid, section marks ---- */

.chapter {
  display: grid; grid-template-columns: minmax(0, var(--measure)) var(--rail);
  gap: 3rem; padding: 2.5rem 1.25rem 3rem; max-width: var(--page); margin: 0 auto;
}
.chapter__head { grid-column: 1 / -1; }
.chapter h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 750; margin: 0.4rem 0 0.3rem; }

.crumb {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; color: var(--c-muted);
}
.crumb a { color: var(--c-muted); text-decoration: none; }
.crumb a:hover { color: var(--c-accent); }

.secmark {
  display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap;
  margin: 2.4rem 0 0.9rem; border-top: 2px solid var(--sec, var(--c-ink)); padding-top: 0.7rem;
}
.secmark .label { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.16em; color: var(--sec, var(--c-ink)); }
.secmark h2 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.sec-trap { --sec: var(--c-trap); }
.sec-read { --sec: var(--c-series); }
.sec-move { --sec: var(--c-accent); }

.chapter .prose, .chapter section { min-width: 0; }
.chapter p { max-width: var(--measure); }
.chapter section > p:first-of-type::first-letter { color: var(--c-accent); font-weight: 600; }

/* ---- devices: trap cards, link-outs, move chips, stop list ---- */

.trapcard {
  border-left: 3px solid var(--c-trap);
  background: color-mix(in srgb, var(--c-trap) 6%, transparent);
  border-radius: 0 6px 6px 0; padding: 0.8rem 1rem; margin: 0.8rem 0;
  max-width: var(--measure);
}
.trapcard b { font-family: var(--font-display); font-weight: 700; }
.trapcard p { font-size: 0.95rem; margin: 0.25rem 0 0; }

.prov {
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--c-muted);
  letter-spacing: 0.05em; margin-top: 0.4rem; display: block;
}

.linkout {
  display: inline-flex; gap: 0.5rem; align-items: baseline;
  border: 1px solid var(--c-rule); border-radius: 6px; padding: 0.4rem 0.75rem;
  margin: 0.3rem 0.35rem 0.3rem 0; text-decoration: none; background: var(--c-surface);
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--c-series);
}
.linkout:hover { border-color: var(--c-series); color: var(--c-series); }
.linkout b { color: var(--c-muted); font-weight: 500; }

.movechip {
  display: flex; gap: 0.9rem; align-items: baseline;
  border: 1px solid var(--c-rule); border-radius: 8px; background: var(--c-surface);
  padding: 0.85rem 1.05rem; margin: 0.7rem 0; text-decoration: none; color: var(--c-ink);
  max-width: var(--measure);
}
.movechip:hover { border-color: var(--c-accent); color: var(--c-ink); }
.movechip .id {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600;
  color: var(--c-accent); letter-spacing: 0.1em; white-space: nowrap;
}
.movechip .body b { font-family: var(--font-display); font-weight: 700; }
.movechip .body p { font-size: 0.93rem; color: var(--c-muted); margin: 0.15rem 0 0; }

.stoplist { list-style: none; margin: 0.6rem 0; padding: 0; }
.stoplist li { padding: 0.45rem 0 0.45rem 1.6rem; position: relative; max-width: var(--measure); }
.stoplist li::before {
  content: "✕"; position: absolute; left: 0; top: 0.5rem;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--c-trap);
}
.stoplist li s {
  text-decoration-color: color-mix(in srgb, var(--c-trap) 55%, transparent);
  text-decoration-thickness: 1.5px;
}
.stoplist li i { font-style: normal; color: var(--c-muted); font-size: 0.92rem; }

/* ---- rail: worksheet plate + book notes ---- */

.rail { font-size: 0.9rem; color: var(--c-muted); }
.plateframe {
  background: var(--c-surface); border: 1px solid var(--c-rule); border-radius: 8px;
  padding: 0.8rem; box-shadow: var(--shadow);
}
/* The generated infographic is a printed sheet pinned to the bench — it stays
   white on the night shift, like paper under a lamp. */
.worksheet-img {
  display: block; width: 100%; height: auto; border-radius: 3px;
  border: 1px solid #E3E0D5; background: #FDFDFB;
}
html.dark .worksheet-img { border-color: #000; }
.plates-cap {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.08em;
  margin: 0.6rem 0 0; color: var(--c-muted);
}
.railnote { margin-top: 1.6rem; border-top: 1px solid var(--c-rule); padding-top: 0.8rem; font-size: 0.84rem; }
.railnote .sig { font-family: var(--font-mono); font-size: 0.66rem; color: var(--c-series); letter-spacing: 0.06em; display: block; }
.railnote p { margin: 0.3rem 0 0; }

@media (max-width: 56rem) {
  .chapter { grid-template-columns: 1fr; gap: 1.5rem; }
  .rail { order: -1; }
}

/* ---- chapter pagination ---- */

.chapnav {
  grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 1rem;
  border-top: 1px solid var(--c-rule); margin-top: 2.5rem; padding-top: 1rem;
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.08em;
}
.chapnav a { color: var(--c-accent); text-decoration: none; }
.chapnav a:hover { text-decoration: underline; }

/* ---- toolbox: the eight moves ---- */

.toolbox { max-width: 60rem; margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }
.toolbox h1 { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 750; margin: 0.4rem 0; }

.moves { margin-top: 1.8rem; }
.move {
  display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); gap: 1.2rem;
  padding: 1.15rem 0; border-top: 1px solid var(--c-rule);
}
.move:last-child { border-bottom: 1px solid var(--c-rule); }
.move .id { font-family: var(--font-mono); font-weight: 600; color: var(--c-accent); font-size: 0.95rem; letter-spacing: 0.06em; }
.move h2 { font-size: 1.28rem; font-weight: 700; margin: 0 0 0.25rem; }
.move p { font-size: 0.97rem; margin: 0; max-width: 36rem; }
.move .used { margin-top: 0.4rem; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--c-muted); }
.move .used a { color: var(--c-series); text-decoration: none; }
.move .used a:hover { text-decoration: underline; }
@media (max-width: 36rem) {
  .move { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* ---- about: AI note (signed, dated — content-integrity device) ---- */

.ai-note {
  border: 1px solid var(--c-series); border-left-width: 3px; border-radius: 0 6px 6px 0;
  background: color-mix(in srgb, var(--c-series) 5%, transparent);
  padding: 0.9rem 1.1rem; margin: 1.5rem 0; max-width: var(--measure);
}
.ai-note .sig { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; color: var(--c-series); display: block; margin-top: 0.6rem; }

/* mobile stacking: head first, then worksheet plate, then the text */
@media (max-width: 56rem) {
  .chapter__head { order: -2; }
}

/* toolbox page: the toolbox worksheet floats beside the intro on wide screens */
.toolbox-plate { max-width: 17rem; }
@media (min-width: 48rem) {
  .toolbox-plate { float: right; margin: 0 0 1.25rem 1.75rem; }
}

/* toolbox intro paragraphs hold the reading measure */
.toolbox > p { max-width: 44rem; }

/* ---- worksheet lightbox (enhancement; the plate link is the no-JS fallback) ---- */

.plateframe a { cursor: zoom-in; }

.lightbox {
  border: none; padding: 0.75rem 0.75rem 0.5rem; border-radius: 8px;
  background: var(--c-surface); box-shadow: var(--shadow);
  max-width: min(92vw, 56rem); cursor: zoom-out;
}
.lightbox::backdrop { background: rgba(20, 17, 10, 0.6); }
html.dark .lightbox::backdrop { background: rgba(0, 0, 0, 0.72); }
.lightbox img {
  display: block; max-width: 100%; max-height: 82vh; margin: 0 auto;
  border-radius: 3px; border: 1px solid #E3E0D5; background: #FDFDFB;
}
.lightbox__hint {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.08em;
  color: var(--c-muted); text-align: center; margin: 0.5rem 0 0.15rem;
}
