/* Playzilla / playzillain.com — Sunlit League editorial theme
   Color tokens, type system, layout primitives, components. */

:root {
  --primary: #176A9E;
  --primary-700: #12547D;
  --primary-300: #5C8FB6;
  --accent: #D17A00;
  --accent-700: #A85F00;
  --accent-100: #FBE7C8;
  --background: #FFFBEF;
  --surface: #FFFFFF;
  --surface-2: #FFF0C8;
  --text: #1D2A36;
  --muted: #5E6871;
  --border: #ECD9A7;
  --border-strong: #D9C079;
  --shadow-card: 0 1px 2px rgba(29, 42, 54, 0.04), 0 4px 14px rgba(29, 42, 54, 0.06);
  --shadow-hover: 0 4px 10px rgba(29, 42, 54, 0.08), 0 14px 28px rgba(29, 42, 54, 0.10);
  --radius-card: 14px;
  --radius-button: 999px;
  --radius-input: 8px;
  --max-width: 1280px;
  --header-height: 72px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
html { overflow-x: clip; }

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 160ms ease;
}

a:hover { color: var(--primary-700); }

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.018em;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -0.028em; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 1.8vw, 1.45rem); }
h4 { font-size: 1.1rem; }

p { margin: 0 0 1rem; max-width: 68ch; }

/* Skip-link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 16px;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 999;
  text-decoration: none;
}
.skip-link:focus { top: 16px; color: #fff; }

/* === HEADER (persistent nav) === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 260;
  background: rgba(255, 251, 239, 0.96);
  backdrop-filter: saturate(120%) blur(8px);
  -webkit-backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
}
.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
  min-width: 0;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.04em;
}
.brand-name {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-tag {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.primary-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.primary-nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease;
}
.primary-nav a:hover { background: rgba(23, 106, 158, 0.08); color: var(--primary); }
.primary-nav a[aria-current="page"] { color: var(--primary); background: rgba(23, 106, 158, 0.10); }
.header-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-button);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 180ms ease, color 180ms ease, transform 120ms ease, box-shadow 180ms ease;
  text-align: center;
  font-family: inherit;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(168, 95, 0, 0.2);
}
.btn-primary:hover {
  background: var(--accent-700);
  color: #fff;
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--primary);
  color: #fff;
}
.btn-secondary:hover {
  background: var(--primary-700);
  color: #fff;
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-lg { padding: 16px 28px; font-size: 1.05rem; }

/* === HAMBURGER / MOBILE MENU === */
.hamburger {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  z-index: 300;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 200ms ease, opacity 200ms ease;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(360px, 88vw);
  max-width: 100vw;
  height: 100dvh;
  background: var(--surface);
  z-index: 250;
  box-shadow: -10px 0 30px rgba(29, 42, 54, 0.12);
  padding: 80px 24px 32px;
  overflow-y: auto;
  transform: translateX(110%);
  visibility: hidden;
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 280ms;
}
.mobile-drawer[data-open="true"] {
  visibility: visible;
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
}
.mobile-drawer[data-open="true"] { transform: translateX(0); }
.mobile-drawer nav { display: flex; flex-direction: column; gap: 4px; }
.mobile-drawer nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 14px 12px;
  border-radius: 10px;
  border-bottom: 1px solid var(--border);
}
.mobile-drawer nav a:hover { background: var(--surface-2); }
.mobile-drawer-cta { margin-top: 16px; display: block; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 42, 54, 0.4);
  z-index: 240;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
}
.backdrop[data-open="true"] { opacity: 1; pointer-events: auto; }

/* === MAIN / FOOTER === */
main { display: block; }
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
.section { padding: clamp(40px, 6vw, 80px) 0; }
.section-tight { padding: clamp(28px, 4vw, 48px) 0; }
.section-band {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

footer.site-footer {
  background: #1D2A36;
  color: #CFD8E0;
  padding: 56px 0 28px;
  margin-top: 48px;
}
footer.site-footer h3 {
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
footer.site-footer a {
  color: #CFD8E0;
  text-decoration: none;
  display: block;
  padding: 6px 0;
  font-size: 0.95rem;
}
footer.site-footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
}
.footer-bottom {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  color: #97A1AB;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
}

/* === HERO === */
.hero {
  background: var(--background);
  padding: clamp(36px, 5vw, 64px) 0 clamp(48px, 6vw, 72px);
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}
.hero-eyebrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-700);
  background: var(--accent-100);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2.1rem, 4.2vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -0.028em;
  font-weight: 800;
  margin-bottom: 18px;
}
.hero-lede {
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 28px;
  max-width: 56ch;
}
.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  font-size: 0.85rem;
  color: var(--muted);
}
.hero-trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-trust-item::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* typographic-data-poster panel */
.rule-poster {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow-card);
  position: relative;
}
.rule-poster-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 18px;
}
.rule-poster-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.rule-poster-cell {
  border-right: 1px solid var(--border);
  padding-right: 12px;
}
.rule-poster-cell:last-child { border-right: 0; padding-right: 0; }
.rule-poster-num {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  margin-bottom: 6px;
}
.rule-poster-key {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.rule-poster-foot {
  font-size: 0.85rem;
  color: var(--muted);
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* hero image (optional, sits inside hero-grid) */
.hero-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-top: 24px;
}

/* === CHAPTER NAVIGATOR === */
.chapter-nav {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: var(--header-height);
  z-index: 90;
  max-width: 100vw;
  overflow: hidden;
}
.chapter-nav-inner {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}
.chapter-nav-inner::-webkit-scrollbar { display: none; }
.chapter-nav a {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--radius-button);
  background: var(--background);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border);
  transition: background 140ms ease, color 140ms ease;
}
.chapter-nav a:hover { background: var(--surface-2); color: var(--text); }

/* === EDITORIAL PHOTO GRID === */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.photo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.photo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.photo-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.photo-card-body { padding: 18px 20px 22px; }
.photo-card-body h3 { font-size: 1.05rem; margin-bottom: 6px; }
.photo-card-body p { font-size: 0.9rem; color: var(--muted); margin: 0; line-height: 1.55; }
.photo-card-link { display: block; text-decoration: none; color: inherit; }
.photo-card-link:hover { color: inherit; }
.photo-card-caption {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

/* === RANKED INSIGHTS / LEDGER === */
.ledger {
  display: grid;
  gap: 12px;
  counter-reset: ledger;
}
.ledger-row {
  counter-increment: ledger;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 22px;
  transition: background 160ms ease, transform 160ms ease;
}
.ledger-row:nth-child(even) { background: var(--surface-2); border-color: var(--border-strong); }
.ledger-row:hover { transform: translateX(2px); }
.ledger-num {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.04em;
}
.ledger-num::before { content: counter(ledger, decimal-leading-zero); }
.ledger-title { font-weight: 700; color: var(--text); }
.ledger-meta { font-size: 0.9rem; color: var(--muted); }
.ledger-cta {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
}
.ledger-cta:hover { text-decoration: underline; }

/* === SPLIT-AXIS STORIES === */
.split-axis {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

/* === REFERENCE LEDGER (grouped) === */
.reference-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--surface);
}
.reference-table-group { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.reference-table-group:last-child { border-bottom: 0; }
.reference-table-group h4 {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-700);
  margin-bottom: 8px;
}
.reference-table-group dl { display: grid; gap: 8px; }
.reference-table-group .row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr);
  gap: 16px;
  font-size: 0.95rem;
}
.reference-table-group .row dt { color: var(--muted); font-weight: 600; }
.reference-table-group .row dd { color: var(--text); }

/* === FAQ ACCORDION === */
.faq-group {
  margin-bottom: 28px;
}
.faq-group h3 {
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 700;
}
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-item:first-child { border-top: 1px solid var(--border); }
.faq-q {
  display: flex;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 16px 0;
  text-align: left;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.faq-q::after {
  content: "+";
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  font-weight: 800;
  color: var(--accent-700);
  font-size: 1.1rem;
}
.faq-q[aria-expanded="true"]::after { content: "−"; background: var(--accent); color: #fff; }
.faq-a {
  display: none;
  padding: 0 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}
.faq-item[data-open="true"] .faq-a { display: block; }

/* === PULL-QUOTE === */
.pull-quote {
  background: var(--surface-2);
  border-left: 4px solid var(--accent);
  padding: 24px 28px;
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
}
.pull-quote blockquote {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
  margin: 0 0 12px;
}
.pull-quote cite {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
}

/* === STAT TILES === */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
  text-align: left;
}
.stat-tile .stat-num {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}
.stat-tile .stat-label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}
.stat-tile p { font-size: 0.9rem; color: var(--muted); margin: 0; line-height: 1.5; }

/* === CTA PANEL === */
.cta-panel {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
  color: #fff;
  border-radius: var(--radius-card);
  padding: clamp(32px, 5vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 32px;
  align-items: center;
}
.cta-panel h2 { color: #fff; margin-bottom: 12px; }
.cta-panel p { color: rgba(255, 255, 255, 0.85); margin: 0; font-size: 1rem; }
.cta-panel .btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.cta-panel .btn-primary:hover { background: var(--accent-700); color: #fff; }
.cta-panel-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.cta-panel-meta { font-size: 0.85rem; color: rgba(255, 255, 255, 0.7); margin-top: 12px; }

/* === STICKY MOBILE CTA === */
.mobile-cta-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  z-index: 220;
  box-shadow: 0 -4px 14px rgba(29, 42, 54, 0.08);
}
.mobile-cta-bar .btn { width: 100%; }

/* === COMPLIANCE STRIP === */
.compliance-strip {
  background: #fff;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
  padding: 10px 0;
}
.compliance-strip-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

/* === TWO-COL CONTENT (with sidebar) === */
.with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}
.sidebar-rail > * + * { margin-top: 20px; }
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
}
.sidebar-card h3 { font-size: 1rem; margin-bottom: 10px; }
.sidebar-card p { font-size: 0.9rem; color: var(--muted); margin-bottom: 12px; }
.sidebar-card ul { list-style: none; padding: 0; margin: 0; }
.sidebar-card li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.sidebar-card li:last-child { border-bottom: 0; }
.sidebar-card li a { color: var(--text); text-decoration: none; font-weight: 600; }
.sidebar-card li a:hover { color: var(--primary); }

/* === PROSE === */
.prose p { margin: 0 0 1rem; font-size: 1rem; line-height: 1.7; }
.prose h2 { margin: 32px 0 16px; }
.prose h3 { margin: 24px 0 12px; }
.prose ul, .prose ol { margin: 0 0 1rem 1.2rem; }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--text); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--muted);
  font-style: italic;
}

/* === INLINE IMAGES IN PROSE === */
.prose figure { margin: 24px 0; }
.prose figure img { border-radius: var(--radius-card); width: 100%; height: auto; }
.prose figure figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
}

/* === RESPONSIVE === */
@media (max-width: 1100px) {
  /* Collapse primary nav to hamburger earlier so 8 nav items + brand + CTA never overflow 1024px */
  .primary-nav { display: none !important; }
  .header-cta .btn:not(.header-cta-mobile) { display: none !important; }
  .hamburger { display: flex !important; }
}

@media (max-width: 1024px) {
  .hero-grid,
  .split-axis,
  .cta-panel,
  .with-sidebar {
    grid-template-columns: 1fr;
  }
  .cta-panel-cta { justify-content: flex-start; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-poster-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ledger-row { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .ledger-row .ledger-meta { grid-column: 2 / -1; color: var(--muted); font-size: 0.85rem; }
}

@media (max-width: 768px) {
  .primary-nav,
  .header-cta .btn:not(.header-cta-mobile) { display: none; }
  .hamburger { display: flex; }
  .header-cta-mobile { display: inline-flex; padding: 10px 18px; font-size: 0.9rem; }
  .mobile-cta-bar { display: block; }
  body { padding-bottom: 72px; }
  .chapter-nav { top: var(--header-height); }
  .hero { padding: 32px 0 40px; }
  .hero h1 { font-size: clamp(1.9rem, 6vw, 2.4rem); }
  .hero-lede { font-size: 1rem; }
  .hero-cta-row { flex-direction: column; align-items: stretch; }
  .hero-cta-row .btn { width: 100%; }
  .photo-grid { grid-template-columns: 1fr; }
  .stat-tiles { grid-template-columns: 1fr; }
  .rule-poster-grid { grid-template-columns: 1fr; gap: 16px; }
  .rule-poster-cell { border-right: 0; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 12px; }
  .rule-poster-cell:last-child { border-bottom: 0; padding-bottom: 0; }
  .ledger-row { grid-template-columns: 36px minmax(0, 1fr); padding: 14px 16px; gap: 12px; }
  .ledger-row .ledger-meta { display: none; }
  .ledger-row .ledger-cta { grid-column: 2; font-size: 0.85rem; }
  .reference-table-group .row { grid-template-columns: 1fr; gap: 4px; }
  .reference-table-group .row dt { color: var(--text); font-weight: 700; }
  .cta-panel-cta { flex-direction: column; align-items: stretch; }
  .cta-panel-cta .btn { width: 100%; }
  .stat-tiles { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 430px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .hero h1 { font-size: 1.75rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .site-header-inner { padding: 12px 16px; }
  .brand-tag { display: none; }
  .stat-tiles { grid-template-columns: 1fr !important; }
}

/*
 * Narrow-viewport header fit (320-430px).
 * brand + gap + CTA measured 344.7px against a 320px viewport, which pushed
 * .hamburger to right=328.7 where `overflow-x: clip` hid it — the drawer's only
 * close control became unreachable. Tighten the gap and let the CTA label shrink
 * so both controls stay inside the viewport.
 */
@media (max-width: 480px) {
  .site-header-inner { gap: 10px; }
  .header-cta { min-width: 0; gap: 6px; }
  .header-cta-mobile {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 10px 12px;
    font-size: 0.82rem;
  }
  /* The close control must never shrink or be clipped. */
  .hamburger { flex: 0 0 44px; width: 44px; }
}

@media (max-width: 360px) {
  .brand-name { font-size: 1rem; }
  .brand-mark { width: 32px; height: 32px; font-size: 16px; }
  .brand { gap: 8px; }
  .header-cta-mobile { padding: 10px 10px; font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Utility: visually-hidden for skip links / a11y */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
