/* ============================================================
   MUIRWAVE DESIGN SYSTEM — DOCUMENTATION CHROME
   Wrapper styles for the style-guide site itself. Not part of
   the shipping system (that lives in system.css). Kept separate
   so the canonical file stays copy-paste clean.
   ============================================================ */

body {
  background-image: var(--grad-storm);
  background-attachment: fixed;
  min-height: 100vh;
}

/* film grain overlay */
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.7'/></svg>");
  mix-blend-mode: overlay;
}

/* ---- Shell: sticky rail + content ---- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(11,19,33,0.85), rgba(5,10,18,0.7));
  backdrop-filter: blur(10px);
  display: flex; flex-direction: column;
  padding: 28px 0 20px; z-index: 50;
}
.rail-brand { padding: 0 26px 24px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.rail-brand .mark {
  font-family: var(--font-display); font-weight: 700;
  font-size: 21px; color: var(--brass-hi); letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.rail-brand .mark .rune { color: var(--brass); font-size: 27px; }
.rail-brand .sub { font-size: 9px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--fog); margin-top: 10px; }
.rail-section { font-size: 9px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--brass); padding: 18px 26px 6px; }
.rail a.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 26px; font-size: 12px; letter-spacing: 0.06em;
  color: var(--foam); text-decoration: none;
  border-left: 2px solid transparent; transition: all 0.2s;
}
.rail a.nav-link:hover { color: var(--ice); background: rgba(79,209,224,0.06); border-left-color: var(--squall); }
.rail a.nav-link.active { color: var(--ice); border-left-color: var(--brass-hi); background: rgba(208,168,80,0.08); }
.rail a.nav-link .glyph { font-family: var(--font-display); font-size: 11px; color: var(--brass); width: 20px; }
.rail-foot { margin-top: auto; padding: 16px 26px 0; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 9px; color: var(--fog); letter-spacing: 0.1em; line-height: 1.8; }
.rail-foot .ok { color: var(--ok); }

@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; gap: 4px 8px; align-items: center; }
  .rail-brand { padding: 0 14px 0 0; border-bottom: none; border-right: 1px solid var(--line); margin: 0 8px 0 0; }
  .rail-section, .rail-foot { display: none; }
  .rail a.nav-link { padding: 6px 12px; border-left: none; border-bottom: 2px solid transparent; }
  .rail a.nav-link.active { border-bottom-color: var(--brass-hi); border-left-color: transparent; }
}

/* ---- Content ---- */
.content { padding: 0 0 80px; max-width: 1080px; }
.page-head { padding: 72px 48px 40px; border-bottom: 1px dashed var(--line); }
.page-head .eyebrow { font-family: var(--font-body); font-weight: 500; font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--brass); display: inline-flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.page-head .eyebrow::before { content: ""; height: 1px; width: 38px; background: linear-gradient(90deg, transparent, var(--brass), transparent); }
.page-head h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 6vw, 72px); line-height: 1.02; color: var(--brass-hi); margin: 0 0 22px; letter-spacing: 0.015em; text-shadow: var(--glow-brass); }
.page-head .lede { font-size: 18px; line-height: 1.7; color: var(--ice); max-width: 720px; margin: 0; text-wrap: pretty; }
.page-head .lede em { color: var(--brass-hi); font-style: italic; }
@media (max-width: 700px) { .page-head { padding: 56px 22px 32px; } }

.sect { padding: 56px 48px; border-bottom: 1px solid rgba(176,141,87,0.1); }
@media (max-width: 700px) { .sect { padding: 44px 22px; } }
.sect-head { display: flex; align-items: baseline; gap: 18px; margin-bottom: 14px; }
.sect-num { font-family: var(--font-display); font-size: 14px; color: var(--brass); letter-spacing: 0.22em; }
.sect-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 3vw, 34px); color: var(--ice); margin: 0; letter-spacing: 0.015em; }
.sect-lede { font-size: 16px; line-height: 1.75; color: var(--foam); max-width: 720px; margin: 0 0 32px; text-wrap: pretty; }
.sect-lede strong { color: var(--ice); font-weight: 500; }
.sub-title { font-family: var(--font-body); font-weight: 600; font-size: 16px; color: var(--ice); letter-spacing: 0.04em; margin: 40px 0 16px; text-transform: uppercase; }
.sub-title:first-child { margin-top: 0; }

/* ---- Live demo frame ---- */
.demo {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.012) 0 10px, transparent 10px 20px),
    rgba(5,10,18,0.4);
  padding: 36px 32px;
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  position: relative;
}
.demo.col { flex-direction: column; align-items: stretch; }
.demo.center { justify-content: center; }
.demo-label {
  position: absolute; top: 10px; right: 14px;
  font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.2em;
  color: var(--fog); text-transform: uppercase;
}

/* ---- Code block ---- */
.code {
  margin: 0; border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
  background: rgba(5,10,18,0.75);
  padding: 18px 20px;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.65;
  color: var(--foam); letter-spacing: 0.02em;
  overflow-x: auto; white-space: pre;
}
.demo + .code { border-radius: 0 0 var(--r-md) var(--r-md); margin-top: -1px; }
.demo:has(+ .code) { border-radius: var(--r-md) var(--r-md) 0 0; }
.code .c { color: var(--brass); }       /* comment */
.code .k { color: var(--squall); }       /* tag / keyword */
.code .a { color: var(--brass-hi); }     /* attr */
.code .s { color: var(--ok); }           /* string */

/* code-only block (no demo above) */
.code.solo { border-radius: var(--r-md); border-top: 1px solid var(--line); }

/* ---- Spec table ---- */
.spec { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 0; }
.spec th, .spec td { text-align: left; padding: 11px 14px; border-bottom: 1px solid rgba(176,141,87,0.12); vertical-align: top; }
.spec th { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--brass); }
.spec td { color: var(--foam); }
.spec td.tok { font-family: var(--font-mono); font-size: 12px; color: var(--brass-hi); white-space: nowrap; }
/* .val cells often carry prose/long tokens — wrap (break anywhere as a last
   resort) instead of forcing table overflow on narrow screens. */
.spec td.val { font-family: var(--font-mono); font-size: 12px; color: var(--ice); overflow-wrap: anywhere; }
.spec tr:hover td { background: rgba(11,19,33,0.35); }
/* Narrow screens: the table scrolls horizontally rather than squeezing
   columns until text wraps a-letter-at-a-time. */
@media (max-width: 700px) {
  .spec { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .spec td, .spec th { min-width: 110px; }
  .spec td.tok { white-space: normal; overflow-wrap: anywhere; }
}

/* ---- Swatch grid ---- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.swatch { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: rgba(11,19,33,0.4); }
.swatch .chip-fill { height: 76px; border-bottom: 1px solid var(--line); }
.swatch .meta { padding: 11px 13px; }
.swatch .nm { font-family: var(--font-body); font-weight: 600; font-size: 13px; color: var(--ice); }
.swatch .vr { font-family: var(--font-mono); font-size: 10px; color: var(--brass-hi); margin-top: 3px; }
.swatch .hx { font-family: var(--font-mono); font-size: 10px; color: var(--fog); letter-spacing: 0.05em; }
.swatch .use { font-size: 11px; color: var(--foam); margin-top: 7px; line-height: 1.45; }

/* ---- Do / Don't ---- */
.dodont { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
@media (max-width: 700px) { .dodont { grid-template-columns: 1fr; } }
.dd { border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 20px; background: rgba(11,19,33,0.4); }
.dd.do  { border-left: 3px solid var(--ok); }
.dd.dont{ border-left: 3px solid var(--danger); }
.dd .lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dd.do .lbl { color: var(--ok); }
.dd.dont .lbl { color: var(--danger); }
.dd ul { margin: 0; padding-left: 18px; }
.dd li { font-size: 13.5px; color: var(--foam); line-height: 1.7; margin-bottom: 6px; }
.dd li:last-child { margin-bottom: 0; }

/* ---- Type specimen rows ---- */
.spec-row { display: grid; grid-template-columns: 130px 1fr; gap: 20px; padding: 22px 0; border-bottom: 1px dashed var(--line); align-items: baseline; }
.spec-row .lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; color: var(--fog); text-transform: uppercase; line-height: 1.7; }
.spec-row .lbl b { color: var(--brass-hi); font-weight: 500; display: block; }
@media (max-width: 600px) { .spec-row { grid-template-columns: 1fr; gap: 8px; } }

/* ---- Callout ---- */
.note {
  border-left: 3px solid var(--brass); padding: 4px 0 4px 20px; margin: 24px 0;
  font-size: 14px; color: var(--foam); line-height: 1.7;
}
.note b { color: var(--brass-hi); font-weight: 500; }
.note.audit { border-left-color: var(--squall); }
.note.audit b { color: var(--squall); }

/* ---- Pillar cards (home) ---- */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .pillars { grid-template-columns: 1fr; } }
.pillar {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 30px 28px; background: var(--grad-surface);
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.pillar:hover { transform: translateY(-4px); border-color: var(--brass); box-shadow: var(--shadow-card); }
.pillar .n { font-family: var(--font-mono); font-size: 11px; color: var(--brass); letter-spacing: 0.22em; }
.pillar h3 { font-family: var(--font-display); font-weight: 600; font-size: 24px; color: var(--brass-hi); margin: 14px 0 12px; letter-spacing: 0.02em; }
.pillar p { font-size: 14px; color: var(--foam); line-height: 1.65; margin: 0 0 18px; }
.pillar .go { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--squall); text-transform: uppercase; }

/* ============================================================
   USER-GUIDE ADDITIONS (extends the design-system docs chrome)
   ============================================================ */

/* ---- Numbered step list ---- */
.steps { counter-reset: step; margin: 8px 0 0; padding: 0; list-style: none; }
.steps > li {
  counter-increment: step; position: relative;
  padding: 0 0 26px 52px; margin: 0;
  border-left: 1px solid var(--line); margin-left: 15px;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 4px; }
.steps > li::before {
  content: counter(step); position: absolute; left: -15px; top: -2px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad-surface); border: 1px solid var(--brass);
  color: var(--brass-hi); font-family: var(--font-display); font-weight: 600;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.steps .step-title { font-family: var(--font-body); font-weight: 600; font-size: 16px; color: var(--ice); margin: 2px 0 6px; }
.steps .step-body { font-size: 14.5px; color: var(--foam); line-height: 1.7; }
.steps .step-body b { color: var(--ice); font-weight: 500; }

/* ---- Figure frame (screenshots / diagrams) ---- */
.figure { margin: 26px 0; }
.figure .frame {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: rgba(5,10,18,0.5); overflow: hidden;
}
.figure img, .figure svg { display: block; width: 100%; height: auto; }
.figure .placeholder {
  aspect-ratio: 16 / 10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-align: center;
  padding: 30px;
  background:
    repeating-linear-gradient(45deg, rgba(208,168,80,0.03) 0 12px, transparent 12px 24px),
    rgba(11,19,33,0.4);
}
.figure .placeholder .ic { font-family: var(--font-display); font-size: 30px; color: var(--brass); opacity: 0.7; }
.figure .placeholder .lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--fog); }
.figure .placeholder .desc { font-size: 13px; color: var(--foam); max-width: 380px; line-height: 1.5; }
.figure figcaption { font-size: 12.5px; color: var(--fog); margin-top: 10px; line-height: 1.55; padding-left: 2px; }
.figure figcaption b { color: var(--brass-hi); font-weight: 500; }

/* ---- Inline UI-control reference ---- */
.uiref {
  font-family: var(--font-body); font-weight: 500; font-size: 0.92em;
  color: var(--brass-hi); border: 1px solid rgba(208,168,80,0.35);
  border-radius: 5px; padding: 1px 7px; white-space: nowrap;
  background: rgba(208,168,80,0.06);
}

/* ---- FAQ / concept Q blocks ---- */
.qa { border-top: 1px solid var(--line); padding: 22px 0; }
.qa:first-of-type { border-top: none; }
.qa .q { font-family: var(--font-body); font-weight: 600; font-size: 16.5px; color: var(--ice); margin: 0 0 8px; }
.qa .a { font-size: 14.5px; color: var(--foam); line-height: 1.75; margin: 0; }
.qa .a b { color: var(--ice); font-weight: 500; }
