/* ============================================================
   AtelierBID — site layer.
   Extends assets/style.css (the guide's design language) with
   the multi-page chrome: landing, docs shell, playbook.
   Self-contained: no external fonts, scripts, or assets.
   ============================================================ */

/* ---------- brand mark ---------- */
.brand { text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 3px;
  background: var(--ink); color: var(--paper);
  font-family: var(--serif); font-size: 19px; font-weight: 700;
  line-height: 1; transform: translateY(1px);
  transition: background var(--transition), transform var(--transition);
}
.brand:hover .brand-mark { background: var(--accent); transform: translateY(1px) rotate(-4deg); }
.nav-links a.is-active { color: var(--ink); }
.nav-links a.is-active::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 2px;
  height: 2px; background: var(--gold);
}

/* ---------- shared section rhythm ---------- */
.band { padding: 86px 0; border-top: 1px solid var(--rule); }
.band.alt { background: color-mix(in srgb, var(--paper-2) 70%, transparent); }
.lede { max-width: 66ch; font-size: 19px; color: var(--ink-soft); }

/* ---------- landing hero ---------- */
.hero-xl { position: relative; padding: 104px 0 88px; overflow: hidden; }
.hero-xl::before {
  content: ""; position: absolute; top: -180px; right: -140px;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 68%);
  pointer-events: none;
}
.hero-xl::after {
  content: ""; position: absolute; bottom: -200px; left: -160px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--gold-bright) 15%, transparent), transparent 70%);
  pointer-events: none;
}
.hero-xl .wrap { position: relative; z-index: 1; }
.hero-title {
  font-size: clamp(42px, 6.4vw, 78px);
  margin: 20px 0 0; max-width: 17ch; letter-spacing: -.022em;
}
.hero-title .accent { color: var(--accent); font-style: italic; }
.hero-title .rule-under {
  background-image: linear-gradient(var(--gold), var(--gold));
  background-repeat: no-repeat;
  background-position: 0 92%;
  background-size: 100% 3px;
}
.hero-sub { font-size: 20px; color: var(--ink-soft); max-width: 60ch; margin: 26px 0 0; }

/* staggered entrance */
.stagger > * { opacity: 0; transform: translateY(14px); animation: rise .7s cubic-bezier(.2,.7,.2,1) forwards; }
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .14s; }
.stagger > *:nth-child(3) { animation-delay: .23s; }
.stagger > *:nth-child(4) { animation-delay: .32s; }
.stagger > *:nth-child(5) { animation-delay: .41s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius);
  margin-top: 54px; overflow: hidden; }
.stat { background: var(--paper-2); padding: 22px 20px; }
.stat b { display: block; font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--ink); }
.stat span { display: block; margin-top: 7px; font-size: 12.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--label); font-weight: 600; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- generic card grid ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 38px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 38px; }
@media (max-width: 900px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.tile {
  position: relative; background: var(--paper-2); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 24px 22px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.tile:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.tile h3 { margin: 0 0 8px; font-size: 20px; }
.tile p { margin: 0; font-size: 14.6px; color: var(--ink-soft); line-height: 1.6; }
.tile .cmd { font-family: var(--mono); font-size: 13px; color: var(--accent); font-weight: 600;
  display: block; margin-bottom: 10px; }
.tile .out { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--rule);
  font-family: var(--mono); font-size: 12.2px; color: var(--label); }

/* phase ladder */
.ladder { margin-top: 38px; border-top: 1px solid var(--rule); }
.rung { display: grid; grid-template-columns: 116px 1fr; gap: 26px;
  padding: 20px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.rung .ph { font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: .1em; color: var(--gold); padding-top: 4px; }
.rung h4 { margin: 0 0 5px; font-size: 18px; }
.rung p { margin: 0; font-size: 14.6px; color: var(--ink-soft); }
@media (max-width: 700px) { .rung { grid-template-columns: 1fr; gap: 6px; } }

/* ---------- docs shell (guide.html) ---------- */
.doc-shell { max-width: 1240px; margin: 0 auto; padding: 0 28px;
  display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 52px; align-items: start; }
.doc-rail { position: sticky; top: 76px; max-height: calc(100vh - 96px);
  overflow-y: auto; padding: 30px 0 40px; }
.rail-head { margin-bottom: 14px; }
.rail-list { list-style: none; margin: 0; padding: 0; }
.rail-ch { margin-bottom: 4px; }
.rail-top { display: block; padding: 6px 10px; border-left: 2px solid var(--rule);
  font-family: var(--sans); font-size: 14px; font-weight: 700; color: var(--ink); }
.rail-top:hover { text-decoration: none; border-left-color: var(--accent); color: var(--accent); }
.rail-sub { list-style: none; margin: 2px 0 10px; padding: 0; }
.rail-sub a { display: block; padding: 4px 10px 4px 18px; border-left: 2px solid var(--rule-soft);
  font-size: 13.2px; color: var(--label); }
.rail-sub a:hover { text-decoration: none; color: var(--accent); border-left-color: var(--accent); }
.rail-sub a.active, .rail-top.active { color: var(--accent); border-left-color: var(--gold); }
.doc-main { padding: 30px 0 80px; min-width: 0; }
.doc-lede { padding-bottom: 30px; border-bottom: 2px solid var(--ink); margin-bottom: 12px; }
.doc-lede h1 { font-size: clamp(32px, 4.4vw, 46px); margin: 16px 0 0; }
.doc-lede .sub { color: var(--ink-soft); max-width: 62ch; }
@media (max-width: 980px) {
  .doc-shell { grid-template-columns: 1fr; gap: 0; }
  .doc-rail { position: static; max-height: none; border-bottom: 1px solid var(--rule); }
}

/* ---------- long-form prose ---------- */
.chapter { padding: 42px 0; border-bottom: 1px solid var(--rule); }
.chapter:last-of-type { border-bottom: 0; }
.ch-title { font-size: clamp(27px, 3.4vw, 36px); margin: 0 0 18px;
  padding-top: 10px; scroll-margin-top: 84px; }
.chapter h3 { font-size: 23px; margin: 34px 0 12px; scroll-margin-top: 84px; }
.chapter h4 { font-size: 18.5px; margin: 26px 0 10px; scroll-margin-top: 84px; }
.chapter h5 { font-size: 16px; margin: 22px 0 8px; scroll-margin-top: 84px; }
.chapter p { margin: 0 0 15px; max-width: 78ch; }
.chapter ul, .chapter ol { max-width: 78ch; padding-left: 22px; margin: 0 0 16px; }
.chapter li { margin-bottom: 7px; }
.chapter hr { border: 0; border-top: 1px solid var(--rule); margin: 30px 0; }
.chapter blockquote {
  margin: 0 0 18px; padding: 12px 18px; max-width: 78ch;
  border-left: 3px solid var(--gold); background: var(--paper-3);
  border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink-soft);
}
.chapter code { font-family: var(--mono); font-size: .88em;
  background: var(--paper-3); border: 1px solid var(--rule-soft);
  padding: 1px 5px; border-radius: 3px; color: var(--accent-2); }
.anchored .anchor { margin-left: .5em; color: var(--rule); font-weight: 400;
  opacity: 0; transition: opacity var(--transition); text-decoration: none; }
.anchored:hover .anchor { opacity: 1; }
.anchored .anchor:hover { color: var(--gold); text-decoration: none; }

/* code blocks */
.code-block { position: relative; margin: 0 0 20px; }
.code-block pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  background: var(--paper-3); border: 1px solid var(--rule);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
}
.code-block pre code { background: none; border: 0; padding: 0; color: var(--ink);
  font-size: 13.4px; line-height: 1.62; }
.code-block .copy-btn { position: absolute; top: 8px; right: 8px; opacity: 0; }
.code-block:hover .copy-btn, .code-block .copy-btn:focus-visible { opacity: 1; }

/* tables scroll rather than pushing the page sideways */
.table-scroll { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--rule);
  border-radius: var(--radius); }
.table-scroll table { border-collapse: collapse; width: 100%; font-size: 14.2px; }
.table-scroll th, .table-scroll td { padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.table-scroll thead th { background: var(--paper-3); font-family: var(--sans);
  font-size: 12px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--label); font-weight: 700; white-space: nowrap; }
.table-scroll tbody tr:last-child td { border-bottom: 0; }
.table-scroll tbody tr:hover { background: color-mix(in srgb, var(--gold-bright) 7%, transparent); }

/* diagrams */
.diagram { margin: 0 0 22px; padding: 18px; background: var(--paper-2);
  border: 1px solid var(--rule); border-radius: var(--radius); overflow-x: auto; }
.diagram pre { margin: 0; font-family: var(--mono); font-size: 12.6px;
  color: var(--ink-soft); white-space: pre; }
.diagram[data-rendered="1"] figcaption { display: none; }
.diagram svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.diagram figcaption { margin-top: 10px; font-size: 12.4px; color: var(--label); font-style: italic; }

/* ---------- playbook (demo.html) ---------- */
.recipe { border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-2); overflow: hidden; }
.recipe + .recipe { margin-top: 16px; }
.recipe > summary {
  cursor: pointer; list-style: none; padding: 17px 20px;
  display: flex; align-items: center; gap: 14px;
  font-family: var(--sans); font-weight: 700; font-size: 15.5px;
  transition: background var(--transition);
}
.recipe > summary::-webkit-details-marker { display: none; }
.recipe > summary:hover { background: var(--paper-3); }
.recipe > summary::after { content: "+"; margin-left: auto; font-family: var(--mono);
  font-size: 19px; color: var(--gold); transition: transform var(--transition); }
.recipe[open] > summary::after { transform: rotate(45deg); }
.recipe .goal { font-family: var(--mono); font-size: 11px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; color: var(--paper);
  background: var(--ink); padding: 3px 8px; border-radius: 3px; flex-shrink: 0; }
.recipe .body { padding: 4px 20px 22px; border-top: 1px solid var(--rule); }
.recipe .body > p:first-child { margin-top: 16px; }
.recipe ol { padding-left: 20px; }
.recipe li { margin-bottom: 10px; }
.recipe code { font-family: var(--mono); font-size: .88em; background: var(--paper-3);
  border: 1px solid var(--rule-soft); padding: 1px 5px; border-radius: 3px; color: var(--accent-2); }

/* troubleshooting */
.trouble { border-left: 3px solid var(--red); background: var(--paper-2);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 16px 20px; margin-bottom: 14px; }
.trouble h4 { margin: 0 0 6px; font-size: 16px; font-family: var(--sans); font-weight: 700; }
.trouble p { margin: 0; font-size: 14.4px; color: var(--ink-soft); }
.trouble .sym { font-family: var(--mono); font-size: 13px; color: var(--red); }

/* glossary */
.glossary { display: grid; grid-template-columns: 190px 1fr; gap: 0;
  border-top: 1px solid var(--rule); margin-top: 30px; }
.glossary dt { font-family: var(--mono); font-weight: 700; font-size: 13.6px;
  color: var(--accent-2); padding: 14px 16px 14px 0; border-bottom: 1px solid var(--rule); }
.glossary dd { margin: 0; padding: 14px 0; font-size: 14.6px; color: var(--ink-soft);
  border-bottom: 1px solid var(--rule); }
@media (max-width: 700px) {
  .glossary { grid-template-columns: 1fr; }
  .glossary dt { padding-bottom: 2px; border-bottom: 0; }
}

/* ---------- footer ---------- */
.foot { margin-top: 60px; padding: 30px 0 46px; border-top: 1px solid var(--rule);
  font-size: 14px; color: var(--label); }
.foot p { margin: 0 0 6px; }
.foot .gen-note { font-size: 12.6px; opacity: .8; }

/* ---------- print ---------- */
@media print {
  header.nav, .doc-rail, .theme-toggle, .copy-btn { display: none !important; }
  .doc-shell { grid-template-columns: 1fr; }
  /* scroll-reveal must never blank a printed page */
  html.js .reveal, .reveal { opacity: 1 !important; transform: none !important; }
  html.js .stagger > *, .stagger > * { opacity: 1 !important; animation: none !important; }
  body { background: #fff; }
}

/* ---------- progressive enhancement ----------
   Content is visible by default. Only once JS confirms it is running
   (html.js, set inline in <head>) do we hide .reveal for the entrance
   animation. Without JS — or if the observer never fires — the page
   still reads completely. */
.reveal { opacity: 1; transform: none; }
html.js .reveal { opacity: 0; transform: translateY(18px); }
html.js .reveal.in { opacity: 1; transform: none; }
html.js .stagger > * { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .stagger > *, html.js .stagger > * { opacity: 1; transform: none; animation: none; }
  html.js .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   TYPE DISCIPLINE — one system, no mixing.
   Families:  serif = headings only · sans = all prose/UI · mono = code only
   Weights:   600 headings · 700 labels/UI · 400 body
   Colours:   --ink headings · --ink-soft body · --accent-2 code
              --gold reserved for the section eyebrow, nothing else
   Sizes:     one body size (15px), one lede size (19px)
   ============================================================ */

/* headings: single family, weight, colour — no per-word accents */
h1, h2, h3, h4, h5,
.hero-title, .ch-title, .doc-lede h1 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
}
.hero-title .accent,
.hero-title .rule-under {
  color: inherit;
  font-style: normal;
  background-image: none;
}

/* body copy: one size, one colour, one family */
.lede { font-size: 19px; color: var(--ink-soft); font-weight: 400; }
.tile p, .rung p, .trouble p, .glossary dd, .recipe .body p, .recipe .body li {
  font-size: 15px; line-height: 1.62; color: var(--ink-soft); font-weight: 400;
  font-family: var(--sans);
}

/* labels: one treatment everywhere */
.stat span, .kicker, .table-scroll thead th {
  font-family: var(--sans); font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; font-size: 12px;
}
.stat span, .table-scroll thead th { color: var(--label); }

/* code: mono, one size, one colour — everywhere it appears */
.tile .cmd, .glossary dt, .chapter code, .recipe code, .trouble .sym,
.tile .out, .rung .ph, .code-block pre code, .cmd-block code {
  font-family: var(--mono);
  color: var(--accent-2);
  font-weight: 600;
  font-size: 13.2px;
  letter-spacing: 0;
  text-transform: none;
}
.tile .out { color: var(--label); font-weight: 400; }
.rung .ph { color: var(--label); }
.trouble .sym { color: var(--accent-2); }
.code-block pre code { font-weight: 400; color: var(--ink); font-size: 13.4px; }

/* numerals share the heading family so the stat strip reads as one voice */
.stat b { font-family: var(--serif); font-weight: 600; color: var(--ink); }

/* card and section headings: consistent scale */
.tile h3, .trouble h4 { font-size: 19px; font-family: var(--serif); font-weight: 600; }
.rung h4 { font-size: 19px; }
.recipe > summary { font-family: var(--sans); font-weight: 700; font-size: 15px; color: var(--ink); }

/* ============================================================
   PAGED GUIDE — one page per chapter.
   The guide was a single 100 KB scroll; splitting it means the
   rail is a table of contents rather than a minimap, and each
   page is short enough to actually finish.
   ============================================================ */

.rail-num {
  display: inline-block; min-width: 2.1em;
  font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  color: var(--gold); letter-spacing: .04em;
}
.rail-top.active .rail-num { color: var(--accent); }
.rail-head .kicker { text-decoration: none; }
.rail-head .kicker:hover { text-decoration: none; color: var(--accent); }
.rail-head .kicker:hover::before { background: var(--accent); }

/* contents cards */
.ch-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 34px; }
@media (max-width: 820px) { .ch-grid { grid-template-columns: 1fr; } }
.ch-card { display: block; text-decoration: none; color: inherit; position: relative; padding-left: 60px; }
.ch-card:hover { text-decoration: none; }
.ch-card .ch-num {
  position: absolute; left: 22px; top: 24px;
  font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--gold);
}
.ch-card h3 { margin: 0 0 6px; font-size: 20px; }
.ch-card p { margin: 0; font-size: 15px; color: var(--ink-soft); line-height: 1.6; }

/* prev / next pager */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 54px; padding-top: 26px; border-top: 1px solid var(--rule);
}
.pager a {
  display: block; padding: 16px 20px; text-decoration: none;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-2);
  transition: border-color var(--transition), transform var(--transition);
}
.pager a:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.pager span {
  display: block; font-family: var(--sans); font-size: 11.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--label); margin-bottom: 5px;
}
.pager b { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); }
.pager-next { text-align: right; }
@media (max-width: 640px) { .pager { grid-template-columns: 1fr; } .pager-next { text-align: left; } }

/* a chapter page is short — let the rail breathe */
.doc-rail { padding-top: 34px; }
.rail-top { display: flex; align-items: baseline; gap: 2px; }

/* skill name on a lifecycle rung — secondary to the phase title */
.rung-skill {
  display: inline-block; margin-left: 10px;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--accent-2); letter-spacing: 0;
}
