/* Grounding Lab shared shell — Shared layout system, GL dark-orange palette.
   Preview branch only. One content frame, clamp() type, light/dark tokens. */
:root {
  color-scheme: light dark;
  --bg: #f7f5f2;
  --surface: #ffffff;
  --ink: #1a1512;
  --muted: #6b635c;
  --line: #e8e2db;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fceee6;
  --radius: 14px;
  --maxw: 1080px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --leading-body: 1.65;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1112;
    --surface: #16191b;
    --ink: #eceee9;
    --muted: #a3a9ae;
    --line: #262b2e;
    --accent: #f0753a;
    --accent-ink: #1a0f08;
    --accent-soft: #2a1810;
  }
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f5f2;
  --surface: #ffffff;
  --ink: #1a1512;
  --muted: #6b635c;
  --line: #e8e2db;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fceee6;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1112;
  --surface: #16191b;
  --ink: #eceee9;
  --muted: #a3a9ae;
  --line: #262b2e;
  --accent: #f0753a;
  --accent-ink: #1a0f08;
  --accent-soft: #2a1810;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h, 104px) + 12px);
}
@media (max-width: 900px) {
  html { scroll-padding-top: calc(var(--header-h, 72px) + 12px); }
}
[id] { scroll-margin-top: calc(var(--header-h, 104px) + 12px); }
@media (max-width: 900px) {
  [id] { scroll-margin-top: calc(var(--header-h, 72px) + 12px); }
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:hover { color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
img, svg, video { max-width: 100%; height: auto; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* —— Header / nav (keeps existing class names for theme.js) —— */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  transition: transform .22s ease;
}
.site-header.is-hidden {
  transform: translateY(-100%);
}
@media (prefers-reduced-motion: reduce) {
  .site-header { transition: none; }
}
.site-header-bar {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; gap: 12px;
}
.home-mark {
  display: inline-flex; align-items: center; color: var(--ink);
  text-decoration: none; flex: none;
}
.home-mark .gl-icon { width: 28px; height: 28px; display: block; }
.nav-signin {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 6px 10px; border-radius: 8px;
}
.nav-signin:hover { color: var(--ink); background: var(--accent-soft); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; margin: 0;
  background: transparent; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--muted); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
html[data-theme="light"] .theme-toggle .icon-sun,
html:not([data-theme]) .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-toggle .icon-moon { display: none; }
  html:not([data-theme]) .theme-toggle .icon-sun { display: block; }
}
@media (prefers-color-scheme: light) {
  html:not([data-theme]) .theme-toggle .icon-sun { display: none; }
  html:not([data-theme]) .theme-toggle .icon-moon { display: block; }
}

.site-nav { border-top: 1px solid var(--line); }
.site-nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center;
  min-height: 44px;
}
.site-nav a {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 10px 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] {
  color: var(--ink); border-bottom-color: var(--accent); font-weight: 600;
}

/* —— Buttons —— */
.btn, a.btn, .ff-actions a, a.cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 15px;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  font-family: inherit; transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.btn-primary, .ff-actions a:first-child, a.cta {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.btn-primary:hover, .ff-actions a:first-child:hover, a.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -10px var(--accent);
  color: var(--accent-ink);
}
.btn-ghost, .ff-actions a:not(:first-child) {
  border-color: var(--line); color: var(--ink); background: var(--surface);
}
.btn-ghost:hover, .ff-actions a:not(:first-child):hover { border-color: var(--muted); color: var(--ink); }
.cta-row, .ff-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 0; }

/* —— Page content frame —— */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 48px 24px 80px;
}
main.home, main.works, main.shell-wide { max-width: none; padding: 0; }
main.home > .wrap,
main.works > .wrap,
main.shell-wide > .wrap { /* sections provide their own */ }

.hero { position: relative; overflow: hidden; padding: 88px 0 72px; }
.hero h1 {
  font-size: clamp(36px, 5.6vw, 58px);
  line-height: 1.08; letter-spacing: -.03em; margin: 0 0 20px; max-width: 16ch;
  font-weight: 700;
}
.hero .lede, .hero p.lede, p.lede, p.subhead {
  font-size: clamp(18px, 2.1vw, 21px); color: var(--muted); max-width: 56ch; margin: 0 0 18px;
}
.eyebrow {
  display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  padding: 6px 12px; border-radius: 999px; margin-bottom: 20px;
}
.grid-bg {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 75% 30%, #000 10%, transparent 70%);
  opacity: .65;
}
.orb {
  position: absolute; z-index: -1; width: 480px; height: 480px; right: -100px; top: -60px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--accent) 32%, transparent), transparent 65%);
  filter: blur(10px);
}

section.shell-sec { padding: 72px 0; border-top: 1px solid var(--line); }
main.home > section, main.works > section {
  max-width: var(--maxw); margin: 0 auto; padding: 72px 24px; border-top: 1px solid var(--line);
}
main.home > .hero, main.works > .hero { max-width: none; border-top: 0; padding: 88px 0 72px; }
main.home > .hero .wrap, main.works > .hero .wrap { max-width: var(--maxw); }

h1 {
  font-size: clamp(32px, 4.5vw, 48px); letter-spacing: -.025em; line-height: 1.12;
  margin: 0 0 16px; font-weight: 700;
}
h2 {
  font-size: clamp(26px, 3.2vw, 36px); letter-spacing: -.02em; line-height: 1.18;
  margin: 0 0 16px; font-weight: 700;
}
h3 { font-size: 20px; letter-spacing: -.01em; margin: 28px 0 10px; font-weight: 650; }
h4 { font-size: 17px; margin: 20px 0 8px; font-weight: 650; }
p { margin: 0 0 1.05em; max-width: 68ch; }
.section-lede { color: var(--muted); max-width: 62ch; margin: 0 0 36px; }
ul, ol { margin: 0 0 1.2em; padding-left: 1.25em; max-width: 68ch; }
li { margin: 0 0 .45em; }
blockquote {
  margin: 0; font-size: clamp(22px, 2.8vw, 30px); line-height: 1.3;
  letter-spacing: -.01em; font-weight: 600; max-width: 28ch;
}
blockquote .hl { background: linear-gradient(transparent 62%, var(--accent-soft) 62%); }
cite { display: block; margin-top: 14px; font-style: normal; font-size: 14px; color: var(--muted); font-weight: 400; }

/* Fact / production strip */
.fact-strip, .prod-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 28px 0;
}
.fact-cell, .prod-strip .cell {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 20px;
}
.fact-head, .prod-strip .num {
  font-size: clamp(22px, 2.5vw, 28px); font-weight: 700; letter-spacing: -.02em;
  margin: 0 0 6px; color: var(--ink);
}
.fact-cell p, .prod-strip .label { margin: 0; color: var(--muted); font-size: 15px; }
.prod-note { color: var(--muted); font-size: 14px; margin: 8px 0 0; max-width: 62ch; }

.cards, .ways { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card, .way {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  min-width: 0;
}
.card:hover, .way:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: 0 18px 40px -28px rgba(0,0,0,.35);
}
.card h3, .way h4 { margin: 0 0 8px; }
.card p, .way p { margin: 0 0 .7em; color: var(--muted); font-size: 16px; max-width: none; }
.way-link a { font-weight: 600; text-decoration: none; }
/* Homepage how-steps only — never collide with install div.steps > div.step */
main.home .how-steps,
main.home .steps {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; counter-reset: s;
}
main.home .how-steps > *,
main.home .steps > .step {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; min-width: 0;
}
main.home .how-steps > *::before,
main.home .steps > .step::before {
  counter-increment: s; content: counter(s);
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px;
  margin-bottom: 12px;
}
.stat { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: start; }
.gl { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: start; }

.mech { list-style: none; padding: 0; counter-reset: m; max-width: none; }
.mech > li {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 22px 22px 64px; margin: 0 0 14px; max-width: none;
}
.mech > li::before {
  counter-increment: m; content: counter(m);
  position: absolute; left: 18px; top: 22px;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px;
}
.principles { list-style: none; padding: 0; display: grid; gap: 12px; max-width: none; }
.principles li {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin: 0; display: grid; gap: 4px;
}
.principles strong { font-size: 16px; }
.principles span { color: var(--muted); font-size: 15px; }

.distinction {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0;
}
.distinction .box {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px;
}
.distinction .box h3 { margin-top: 0; font-size: 16px; color: var(--accent); }
.distinction .box p { margin: 0; color: var(--muted); font-size: 15px; max-width: none; }

table.who-runs, table.shell-table {
  width: 100%; max-width: 100%; border-collapse: collapse; font-size: 15px; margin: 20px 0;
}
table.who-runs th, table.who-runs td,
table.shell-table th, table.shell-table td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top;
}
table.who-runs th, table.shell-table th { color: var(--muted); font-weight: 600; font-size: 13px; }

.next-cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; max-width: none; }
.next-cards a {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink);
}
.next-cards a:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.next-cards strong { display: block; margin-bottom: 4px; }
.next-cards span { color: var(--muted); font-size: 14px; }

.beats { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 24px; max-width: none; color: var(--muted); font-size: 15px; }
.beats li::before { content: "· "; color: var(--accent); font-weight: 700; }
.gloss { color: var(--muted); font-size: 16px; max-width: 62ch; }
.diagram-note, .prod-note, .fine, .scope, .status { color: var(--muted); font-size: 14px; }
figure { margin: 28px 0; }
figcaption { color: var(--muted); font-size: 14px; margin-top: 10px; max-width: 62ch; }
.door-film video { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #000; }
.anchor-alias { display: none; }
hr.fold-rule { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* Cost chart (homepage) — theme-aware strokes */
.cost-chart { max-width: 560px; }
.cost-chart .chart-title { font-weight: 650; margin: 0 0 10px; }
.chart-key { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; color: var(--muted); max-width: none; }
.key-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.key-doors { background: var(--muted); }
.key-pcoc { background: var(--accent); }

/* Footer restyle (footer.js still injects markup; we override its dark-hardcoded look) */
.site-footer {
  background: var(--surface) !important;
  border-top: 1px solid var(--line) !important;
  color: var(--muted) !important;
  padding: 28px 24px 48px !important;
}
.site-footer-inner {
  max-width: var(--maxw) !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 12px 24px !important;
  align-items: center !important;
  font: 600 14px/1.4 var(--font) !important;
}
.site-footer a, .site-footer .site-footer-item {
  color: var(--muted) !important;
}
.site-footer a:hover { color: var(--ink) !important; }
.site-footer .footer-divider { background: var(--line) !important; }
.site-footer .footer-id { border-top-color: var(--line) !important; }
.site-footer button.copy { border-color: var(--line) !important; color: var(--muted) !important; }
.footer-wordmark img { height: 22px; width: auto; }
html[data-theme="light"] .footer-wordmark .wm-dark,
html:not([data-theme]) .footer-wordmark .wm-dark { display: none; }
html[data-theme="dark"] .footer-wordmark .wm-light { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .footer-wordmark .wm-light { display: none; }
  html:not([data-theme]) .footer-wordmark .wm-dark { display: inline; }
}
@media (prefers-color-scheme: light) {
  html:not([data-theme]) .footer-wordmark .wm-dark { display: none; }
  html:not([data-theme]) .footer-wordmark .wm-light { display: inline; }
}

/* Generic page content polish when old pages.css/verify.css dropped */
main p a, main li a, .foot a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  font-weight: 600;
}
code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .92em;
}
pre {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto;
}
.panel, .card-like {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
}

@media (max-width: 900px) {
  .cards, .ways, main.home .how-steps, main.home .steps { grid-template-columns: 1fr; }
  .fact-strip, .prod-strip { grid-template-columns: 1fr; }
  .distinction { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .stat, .gl { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 760px) {
  .hero { padding: 64px 0 48px; }
  main.home > section, main.works > section { padding: 48px 24px; }
  .site-nav-inner { gap: 2px 12px; }
  .site-nav a { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .way, .btn, .ff-actions a { transition: none; }
}


/* ===== Fix pass: tokens aliases, menu, overflow, apps, tap targets ===== */
:root {
  --text: var(--ink);
  --text-strong: var(--ink);
  --text-soft: var(--muted);
  --border: var(--line);
  --panel: var(--surface);
  --panel-2: color-mix(in srgb, var(--surface) 85%, var(--ink));
  --btn-bg: var(--surface);
  --btn-border: var(--line);
  --btn-border-hover: var(--muted);
  --code-bg: color-mix(in srgb, var(--surface) 92%, var(--ink));
  --cta-bg: var(--accent);
  --cta-bg-hover: color-mix(in srgb, var(--accent) 85%, var(--ink));
  --cta-text: var(--accent-ink);
  --focus: var(--accent);
  --link-border: color-mix(in srgb, var(--accent) 40%, transparent);
  --amber: #c2410c;
}

/* Header bar: logo left, controls right; larger tap targets */
.site-header-bar { position: relative; }
.home-mark {
  min-width: 44px; min-height: 44px;
  justify-content: center;
}
.home-mark .gl-icon { width: 32px; height: 32px; }
.nav-signin {
  margin-left: auto;
  min-height: 44px; display: inline-flex; align-items: center;
  padding: 10px 12px; font-size: 15px;
}
.theme-toggle {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border-radius: 10px; flex: none;
}
.menu-toggle {
  display: none;
  align-items: center; justify-content: center; gap: 0.4rem;
  min-width: 44px; min-height: 44px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: 600 14px/1 var(--font);
  cursor: pointer;
  flex: none;
}
.menu-toggle svg { width: 20px; height: 20px; display: block; }
.menu-toggle:hover { border-color: var(--muted); }
.menu-toggle:focus-visible, .theme-toggle:focus-visible, .nav-signin:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}

.site-nav a {
  min-height: 44px; display: inline-flex; align-items: center;
  padding: 12px 2px; font-size: 15px;
}

/* Mobile menu: hide nav until opened; hide button on desktop */
@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    border-top: 1px solid var(--line);
  }
  .site-nav.is-open {
    display: block;
  }
  .site-nav-inner {
    flex-direction: column; align-items: stretch;
    padding: 8px 24px 16px; gap: 0;
  }
  .site-nav a {
    width: 100%;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
  }
  .site-nav a[aria-current="page"] {
    border-bottom-color: var(--line);
    box-shadow: inset 3px 0 0 var(--accent);
    padding-left: 10px;
  }
}
@media (min-width: 901px) {
  .menu-toggle { display: none !important; }
  .site-nav { display: block !important; }
  .site-nav.is-open { /* no-op on desktop */ }
}

/* Legacy nav-compact from theme.js: keep compatible but prefer CSS breakpoint */
html.nav-compact .site-nav { display: none; }
html.nav-compact .site-nav.is-open { display: block; }
html.nav-compact .menu-toggle { display: inline-flex; }
@media (min-width: 901px) {
  html.nav-compact .site-nav { display: block; }
  html.nav-compact .menu-toggle { display: none !important; }
}

/* Page frame: restore padding for works/see pages that put content directly in main */
main.works:not(:has(> .hero)),
main.see,
main.util,
main.services,
main.doc,
main.guide,
main.visitors {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px 80px;
  min-width: 0;
}
main.works:has(> .hero) {
  max-width: none;
  padding: 0;
}
main.see, main.util, main.services, main.doc { width: 100%; box-sizing: border-box; }

/* Overflow containment */
main, .wrap, .app-layout, .app-stage, .app-panel, .setup, .steps, .step,
.cmd, .table-wrap, .formats, section, .card-box, #drop, .ff-compare, .ff-card {
  min-width: 0;
  max-width: 100%;
}
pre, pre.expect, .cmd pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre;
}
code.hash, .npub-line, .mono {
  overflow-wrap: anywhere;
  word-break: break-all;
}
.table-wrap, .components {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
body { overflow-x: hidden; }

/* Apps / Make: platform tabs + copy buttons */
.platforms {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin: 1.5rem 0 1.25rem;
}
.platforms button {
  min-height: 44px; min-width: 44px;
  padding: 0 1.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 600 0.95rem/1 var(--font);
  cursor: pointer;
}
.platforms button:hover { border-color: var(--accent); }
.platforms button[aria-selected="true"] {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.platforms button.tab-lead:not([aria-selected="true"]) {
  border-color: var(--accent);
}
main.works .app-layout > .platforms:not(.lang-tabs) button {
  min-width: 5.5rem; text-align: center;
}
.formats { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0 0 0.9rem; }
.fmt {
  display: flex; flex-direction: column; justify-content: center;
  min-width: min(12rem, 100%); min-height: 64px;
  padding: 0.7rem 1.2rem; border-radius: 12px;
  text-decoration: none; border: 1px solid var(--line); color: var(--ink);
  background: var(--surface);
}
.fmt.main { border-color: var(--accent); }
.fmt.soon { opacity: 0.65; }
.fmt strong { font-size: 1rem; }
.fmt small { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.cmd {
  display: flex; align-items: flex-start; gap: 0.5rem;
  margin: 0 0 0.5rem; min-width: 0;
}
.cmd pre { flex: 1 1 auto; min-width: 0; margin: 0; }
.cmd .copy-btn {
  flex: none;
  min-width: 4.6rem; min-height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font: 600 0.85rem/1 var(--font); cursor: pointer;
}
.cmd .copy-btn:hover { border-color: var(--accent); }
.cmd .copy-btn.done { border-color: var(--accent); color: var(--accent); }
.setup-meta {
  display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.3rem 0.9rem;
  margin: 0 0 0.5rem; padding: 0.9rem 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  font-size: 0.95rem; max-width: 100%;
}
@media (max-width: 520px) {
  .setup-meta { grid-template-columns: 1fr; }
}
/* Install / copy-paste steps (apps, make, verify, admission-gate) */
.setup { max-width: 100%; margin: 1.25rem 0 2rem; min-width: 0; }
.setup .steps,
div.steps:has(> .step > .cmd),
div.steps:has(> .step > .step-h) {
  display: block !important;
  grid-template-columns: none !important;
  counter-reset: none !important;
  gap: 0;
  max-width: 100%;
  min-width: 0;
}
.setup .step,
div.steps > .step {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  margin: 0 0 1.5rem;
  min-width: 0;
  max-width: 100%;
}
.setup .step::before,
div.steps > .step::before {
  content: none !important;
  display: none !important;
}
h3.step-h, .step-h {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.tested-line { margin: 0 0 1.25rem; font-size: 0.88rem; color: var(--muted); }

.expect-label { color: var(--muted); font-size: 0.85rem; margin: 1rem 0 0.35rem; font-weight: 600; }
pre.expect {
  background: transparent; border-style: dashed; margin: 0 0 0.5rem;
}
.release-line { color: var(--muted); font-size: 0.92rem; }
.poster {
  display: flex; flex-direction: column; gap: 0.5rem;
  margin: 1rem 0; text-decoration: none; color: var(--ink); font-weight: 600;
  max-width: 320px;
}
.poster img { border-radius: 10px; border: 1px solid var(--line); }
details.more { margin: 1rem 0; }
details.more summary {
  cursor: pointer; font-weight: 600; min-height: 44px;
  display: inline-flex; align-items: center;
}
.facts { display: grid; grid-template-columns: 7rem 1fr; gap: 0.35rem 0.9rem; font-size: 0.92rem; }
.facts dt { color: var(--muted); margin: 0; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Footer / nav tap targets */
.site-footer a, .site-footer .site-footer-item {
  min-height: 44px !important;
}
.site-footer button.copy {
  width: 44px !important; height: 44px !important;
  min-width: 44px !important; min-height: 44px !important;
}
.site-footer .footer-wordmark {
  min-height: 44px; display: inline-flex; align-items: center;
}

/* HIW hero: less left-heavy on desktop */
@media (min-width: 901px) {
  main.works > .hero .wrap {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 32px 48px;
    align-items: start;
  }
  main.works > .hero .wrap > h1 { grid-column: 1; max-width: none; }
  main.works > .hero .wrap > .lede { grid-column: 1; }
  main.works > .hero .wrap > .beats {
    grid-column: 2; grid-row: 1 / span 3;
    flex-direction: column; align-items: flex-start;
    margin: 0; padding: 18px 20px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); gap: 10px;
  }
  main.works > .hero .wrap > .beats li::before { content: none; }
  main.works > .hero .wrap > .beats li {
    padding-left: 0.85rem;
    border-left: 3px solid var(--accent);
    color: var(--ink); font-size: 15px; line-height: 1.4;
  }
  main.works > .hero .wrap > .gloss,
  main.works > .hero .wrap > p,
  main.works > .hero .wrap > .cta-row { grid-column: 1; }
}

/* Sign-in: left-align the action frame with prose */
main.util .sign-in-action {
  align-items: stretch;
  max-width: 26rem;
  margin-left: 0;
}
main.util .sign-in-action .pcoc-button { align-self: flex-start; }
main.util .sign-in-action .qr-caption,
main.util .sign-in-action .visitor-status { text-align: left; }
main.util .sign-in-action .copy-code-row { justify-content: flex-start; }

/* Arch diagrams: keep SVG readable in both themes */
figure.arch svg.narrow { display: none; }
@media (max-width: 720px) {
  figure.arch svg.wide { display: none; }
  figure.arch svg.narrow { display: block; }
}

/* Page intros on works pages that sit outside <section> (S1).
   Only frame direct intro siblings; do not rewrite section padding. */
main.works > h1,
main.works > .subhead,
main.works > p,
main.works > .lede,
main.works > .app-layout,
main.works > .ff-compare,
main.works > .platforms {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}
main.works > h1 { margin-top: 0; padding-top: 40px; }
main.works > .app-layout { min-width: 0; }
/* When main.works already carries the 24px frame (no hero), avoid double gutters */
main.works:not(:has(> .hero)) > h1,
main.works:not(:has(> .hero)) > .subhead,
main.works:not(:has(> .hero)) > p,
main.works:not(:has(> .hero)) > .lede,
main.works:not(:has(> .hero)) > .app-layout,
main.works:not(:has(> .hero)) > .ff-compare,
main.works:not(:has(> .hero)) > .platforms {
  padding-left: 0;
  padding-right: 0;
  max-width: none;
}
main.works:not(:has(> .hero)) > h1 { padding-top: 0; }

/* HIW principles: readable measure, not full-bleed 120ch lines (S8) */
main.works .principles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: var(--maxw);
}
main.works .principles li {
  max-width: none;
}
main.works .principles li span,
main.works .principles li p {
  max-width: 68ch;
}
@media (max-width: 820px) {
  main.works .principles { grid-template-columns: 1fr; }
}

/* Visitors (S4) */
main.visitors {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px 80px;
  min-width: 0;
}
main.visitors .summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}
main.visitors .summary div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}
main.visitors .summary dt { margin: 0; color: var(--muted); font-size: 0.82rem; }
main.visitors .summary dd {
  margin: 0.2rem 0 0; font-size: 1.05rem; font-weight: 700; color: var(--ink);
  overflow-wrap: anywhere;
}
main.visitors .map-key {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.85rem;
  margin: 0 0 0.75rem; color: var(--muted); font-size: 0.88rem;
}
main.visitors .swatch {
  display: inline-block; width: 1.1rem; height: 0.7rem; border-radius: 3px;
  border: 1px solid var(--line); vertical-align: middle; margin-right: 0.25rem;
}
main.visitors .swatch.zero { background: color-mix(in srgb, var(--muted) 25%, var(--surface)); }
main.visitors .swatch.high { background: var(--accent); }
main.visitors .map-wrap {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.9fr);
  gap: 1rem; align-items: start; min-width: 0;
}
main.visitors svg.world {
  width: 100%; height: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
}
main.visitors .country-table { max-height: 28rem; overflow: auto; min-width: 0; }
main.visitors .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; min-width: 0; }
main.visitors table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
main.visitors th, main.visitors td {
  text-align: left; padding: 0.4rem 0.45rem; border-bottom: 1px solid var(--line); vertical-align: middle;
}
main.visitors th { color: var(--muted); font-weight: 600; }
main.visitors .bar { display: block; height: 0.55rem; border-radius: 999px; background: var(--accent); }
main.visitors .bar.empty { width: 0; }
@media (max-width: 800px) { main.visitors .map-wrap { grid-template-columns: 1fr; } }

/* Docs heading hierarchy (S6) — beat docs.css 1.25rem h2 */
main.doc h1 {
  font-size: clamp(32px, 4.5vw, 48px) !important;
  letter-spacing: -0.025em;
  line-height: 1.12;
}
main.doc h2 {
  font-size: clamp(22px, 2.8vw, 30px) !important;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 1.6rem 0 0.6rem;
}
main.doc h3 {
  font-size: clamp(18px, 2vw, 22px) !important;
}

/* Guides heading hierarchy (S6) */
main.guide h1 {
  font-size: clamp(32px, 4.5vw, 48px) !important;
  letter-spacing: -0.025em;
}
main.guide h2 {
  font-size: clamp(22px, 2.8vw, 30px) !important;
}


/* HOME HERO FOLD: keep primary CTA on first phone screen (spacing only; no copy hidden) */
@media (max-width: 520px) {
  main.home > .hero { padding: 36px 0 24px; }
  main.home > .hero .wrap > p { margin: 0 0 0.55rem; }
  main.home > .hero .cta-row { margin-top: 14px; gap: 10px; }
  main.home > .hero h1 { margin: 0 0 0.35rem; }
  main.home > .hero .lede { margin: 0 0 0.5rem; }
}

/* Visitors: every table scrolls instead of widening the page */
main.visitors table { display: block; max-width: 100%; overflow-x: auto; }
main.visitors .country-table,
main.visitors .table-scroll,
main.visitors section { max-width: 100%; min-width: 0; }


/* ===== Gate monitor (ported from pages.css; shell tokens) ===== */
main.gate-log p, main.gate-log li, main.gate-log dd { overflow-wrap: anywhere; }
main.gate-log code, main.gate-log .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86rem;
}
main.gate-log .muted { color: var(--muted); }
main.gate-log .small { font-size: 0.88rem; }
main.gate-log .status { min-height: 1.4rem; margin: 0.6rem 0; color: var(--muted); }
main.gate-log .status.error { color: #c2410c; }
main.gate-log .note.card-box,
main.gate-log .card-box {
  margin: 0.8rem 0; padding: 0.9rem 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  max-width: none;
}
main.gate-log .note ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
main.gate-log .note li { margin: 0.2rem 0; }
main.gate-log #entries { list-style: none; margin: 0; padding: 0; }
main.gate-log .entry {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 0.65rem 0.9rem; margin: 0 0 0.6rem; background: var(--surface);
}
main.gate-log .entry[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
main.gate-log .entry.return { padding: 0.45rem 0.9rem; background: transparent; }
main.gate-log .outcome { font-weight: 650; margin: 0; }
main.gate-log .icon { display: inline-block; width: 1.4em; }
main.gate-log .who { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.92rem; }
main.gate-log .numbers, main.gate-log .explain { margin: 0.25rem 0 0; }
main.gate-log .explain { color: var(--muted); font-size: 0.92rem; }
main.gate-log details.entry-more { margin: 0.35rem 0 0; }
main.gate-log details.entry-more > summary { font-weight: 400; }
main.gate-log summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
main.gate-log dl.facts {
  display: grid; grid-template-columns: minmax(8rem, 11rem) minmax(0, 1fr);
  gap: 0.25rem 0.8rem; margin: 0.5rem 0 0; font-size: 0.9rem;
}
main.gate-log dl.facts dt { color: var(--muted); }
main.gate-log dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
main.gate-log .rules { padding-left: 1.2rem; }
main.gate-log .rules li { margin: 0.25rem 0; }
main.gate-log details.section { border-top: 1px solid var(--line); padding-top: 0.6rem; margin-top: 1rem; }
main.gate-log details.section > summary { font-size: 1rem; color: var(--ink); font-weight: 600; }
main.gate-log ul.plain { margin: 0.4rem 0 0; padding-left: 1.2rem; }
main.gate-log .chips { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; margin-top: 0.6rem; }
main.gate-log .log-actions, main.gate-log .ff-actions {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0 0.35rem;
}
main.gate-log .log-actions button,
main.gate-log .ff-actions button,
main.gate-log button#refresh,
main.gate-log #reset-login button,
main.gate-log .copy-row button {
  min-height: 44px; min-width: 44px;
  padding: 0 1rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  font: 600 0.95rem/1 var(--font); cursor: pointer;
}
main.gate-log .log-actions button:hover,
main.gate-log .ff-actions button:hover,
main.gate-log button#refresh:hover { border-color: var(--accent); }
main.gate-log .qr-frame {
  display: inline-block; background: #fff; padding: 0.7rem; border-radius: 12px; line-height: 0;
}
main.gate-log .copy-row { display: flex; gap: 0.6rem; align-items: center; margin: 0.2rem 0 0.4rem; flex-wrap: wrap; }
main.gate-log #reset-link { overflow-wrap: anywhere; margin: 0.7rem 0 0.35rem; }
@media (max-width: 640px) {
  main.gate-log dl.facts { grid-template-columns: minmax(0, 1fr); }
  main.gate-log dl.facts dd { margin-bottom: 0.4rem; }
}

/* Figures / diagrams restored from main */
figure.arch, figure.diagram, figure.door-film, figure.cost-chart {
  margin: 1.25rem 0 1.5rem; max-width: 100%;
}
figure.arch svg, figure.diagram svg, figure.cost-chart svg { width: 100%; height: auto; display: block; }
figure.arch figcaption, figure.diagram figcaption, figure.cost-chart figcaption {
  margin-top: 0.55rem; color: var(--muted); font-size: 0.9rem; max-width: 68ch;
}
