/* =============================================================================
   SchemaDesk · theme-modern.css
   Complete drop-in vanilla CSS theme (2026 developer-tool aesthetic)
   Replaces or overrides css/site.css — same HTML class names preserved.
   Accent: electric indigo · Canvas: cool slate · Type: Inter + JetBrains Mono
   Source Serif demoted (optional long-form only; product UI is sans-only).
   Breakpoints: 640 / 768 / 1024 / 1280
   ============================================================================= */

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/source-serif-4-400.woff2") format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/source-serif-4-600.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
}

/* ---------------------------------------------------------------------------
   1. Design tokens — light
   --------------------------------------------------------------------------- */
:root {
  /* Canvas & surfaces */
  --paper: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #EEF1F7;
  --surface-elevated: #FFFFFF;

  /* Ink */
  --ink: #0B1220;
  --muted: #5B657A;

  /* Borders & inputs */
  --line: #D8DEE9;
  --input-border: #C5CDD9;
  --input-bg: #FFFFFF;

  /* Accent — electric indigo (primary CTA, links, focus) */
  --accent: #5B5FFF;
  --accent-ink: #4338CA;
  --accent-bright: #6366F1;
  --accent-soft: #EEF0FF;
  --accent-soft-border: #C7CBFF;

  /* Copper aliases → accent (compat with any leftover copper refs) */
  --copper: var(--accent);
  --copper-ink: var(--accent-ink);
  --copper-bright: var(--accent-bright);
  --copper-soft: #A5B4FC;

  /* Code panel */
  --panel: #0F172A;
  --panel-ink: #E2E8F0;
  --panel-muted: #94A3B8;

  /* Primary button */
  --primary-bg: #5B5FFF;
  --primary-ink: #FFFFFF;
  --primary-hover: #4F46E5;

  /* Semantic */
  --ok: #059669;
  --warn: #D97706;
  --bad: #DC2626;
  --ok-bg: #ECFDF5;
  --warn-bg: #FFFBEB;
  --bad-bg: #FEF2F2;

  /* Syntax tokens on dark panel */
  --tok-key: #C4B5FD;
  --tok-str: #6EE7B7;
  --tok-num: #FCD34D;
  --tok-bool: #67E8F9;

  /* Chrome */
  --header: rgba(244, 246, 250, 0.88);
  --drawer-scrim: rgba(11, 18, 32, 0.48);

  /* Elevation */
  --elev-1: 0 1px 2px rgba(11, 18, 32, 0.05), 0 0 0 1px rgba(11, 18, 32, 0.02);
  --elev-2: 0 8px 24px rgba(11, 18, 32, 0.08), 0 2px 6px rgba(11, 18, 32, 0.04);
  --elev-3: 0 20px 48px rgba(11, 18, 32, 0.14);

  /* Type */
  --sans: Inter, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --serif: Inter, "Avenir Next", "Segoe UI", system-ui, sans-serif; /* demoted: sans-only product feel */
  --serif-opt: "Source Serif 4", Iowan, Palatino, Georgia, serif; /* optional long-form only */
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Spacing scale 4–64 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Radii — 8 / 12 / 16 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --header-h: 60px;
  --focus-ring: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent);

  color-scheme: light;
}

/* ---------------------------------------------------------------------------
   2. Design tokens — dark ([data-theme="dark"])
   --------------------------------------------------------------------------- */
[data-theme="dark"] {
  --paper: #0B1220;
  --surface: #121A2B;
  --surface-2: #1A2438;
  --surface-elevated: #1A2438;

  --ink: #F1F5F9;
  --muted: #94A3B8;

  --line: #2A3548;
  --input-border: #3A465C;
  --input-bg: #0B1220;

  --accent: #818CF8;
  --accent-ink: #A5B4FC;
  --accent-bright: #A5B4FC;
  --accent-soft: #1E1B4B;
  --accent-soft-border: #3730A3;

  --copper: var(--accent);
  --copper-ink: var(--accent-ink);
  --copper-bright: var(--accent-bright);
  --copper-soft: #A5B4FC;

  --panel: #020617;
  --panel-ink: #E2E8F0;
  --panel-muted: #64748B;

  --primary-bg: #818CF8;
  --primary-ink: #0B1220;
  --primary-hover: #A5B4FC;

  --ok: #34D399;
  --warn: #FBBF24;
  --bad: #F87171;
  --ok-bg: #064E3B;
  --warn-bg: #78350F;
  --bad-bg: #7F1D1D;

  --header: rgba(11, 18, 32, 0.88);
  --drawer-scrim: rgba(0, 0, 0, 0.6);

  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --elev-2: 0 8px 28px rgba(0, 0, 0, 0.4);
  --elev-3: 0 24px 56px rgba(0, 0, 0, 0.5);

  --focus-ring: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent);

  color-scheme: dark;
}

/* ---------------------------------------------------------------------------
   3. Reset & base
   --------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 380px at 12% -8%, rgba(91, 95, 255, 0.12), transparent 55%),
    radial-gradient(700px 320px at 92% 0%, rgba(99, 102, 241, 0.08), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.625;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="dark"] body,
html[data-theme="dark"] body {
  background:
    radial-gradient(900px 380px at 12% -8%, rgba(129, 140, 248, 0.14), transparent 55%),
    radial-gradient(700px 320px at 92% 0%, rgba(99, 102, 241, 0.08), transparent 50%),
    var(--paper);
}

img { max-width: 100%; height: auto; }

a {
  color: var(--accent-ink);
  text-underline-offset: 2px;
}
a:hover { color: var(--accent-bright); }

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

/* ---------------------------------------------------------------------------
   4. Skip link & layout wrap
   --------------------------------------------------------------------------- */
.skip {
  position: absolute;
  left: 16px;
  top: -4rem;
  background: var(--primary-bg);
  color: var(--primary-ink);
  padding: 8px 14px;
  z-index: 80;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 8px; }

.wrap {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}
@media (min-width: 1280px) {
  .wrap { width: min(1200px, calc(100% - 48px)); }
}

/* ---------------------------------------------------------------------------
   5. Header / nav / drawer
   --------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--header-h);
  background: var(--header);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.logo:hover { color: var(--ink); }
.logo .mark {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  top: -2px;
}

.local-badge {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px 16px;
  margin-left: auto;
}
.nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  padding: 0 4px;
}
.nav a:hover { color: var(--accent-ink); }
.nav a[aria-current="page"] {
  color: var(--accent-ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.nav a.btn-primary,
.drawer a.btn-primary {
  color: var(--primary-ink);
  background: var(--primary-bg);
  box-shadow: none;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 600;
}
.nav a.btn-primary:hover,
.drawer a.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--primary-ink);
  box-shadow: none;
}
.drawer a.btn-primary {
  justify-content: center;
  margin: 0 0 8px;
}

.bar-end { display: flex; align-items: center; gap: 4px; }
.open-gen { margin-left: 4px; }

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.nav-toggle { display: none; flex-direction: column; gap: 5px; }
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.theme-mark {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--drawer-scrim);
  z-index: 30;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 88vw);
  z-index: 40;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--elev-3);
  padding: 72px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.drawer a {
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 0 8px;
}
.drawer a:hover { background: var(--surface-2); }
.drawer a[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--accent-soft);
}
.drawer .local-badge {
  align-self: flex-start;
  margin: 12px 8px 0;
  white-space: normal;
}

/* ---------------------------------------------------------------------------
   6. Buttons
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  background: transparent;
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary {
  background: var(--primary-bg);
  color: var(--primary-ink);
  border-color: var(--primary-bg);
  box-shadow: 0 1px 2px rgba(91, 95, 255, 0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--primary-ink);
  border-color: var(--primary-hover);
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--input-border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: transparent;
}
.btn-code {
  min-height: 36px;
  background: transparent;
  color: var(--panel-ink);
  border-color: #334155;
  font-weight: 500;
  font-size: 14px;
}
.btn-code:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.btn-code-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-code-primary:hover {
  background: var(--accent-bright);
  color: #fff;
  border-color: var(--accent-bright);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------------------------------------------------------------------
   7. Hero & type scale (fluid clamp, min body 16px)
   --------------------------------------------------------------------------- */
.hero { padding: 40px 0 20px; }
.page-home .hero { padding: 1.5rem 0 0.75rem; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--ink);
}
h1 {
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem);
  line-height: 1.15;
  margin: 0 0 12px;
}
.page-home h1 {
  font-size: clamp(1.85rem, 1.5rem + 1.4vw, 2.6rem);
  line-height: 1.12;
  margin-bottom: 10px;
}
h2 {
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  line-height: 1.25;
}
h3 {
  font-size: clamp(1.05rem, 1rem + 0.25vw, 1.15rem);
  line-height: 1.35;
}

.lede {
  max-width: 42rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  line-height: 1.6;
}
.byline {
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 14px;
}

/* ---------------------------------------------------------------------------
   8. Generator tool — dominant, segmented type-switch, sticky preview
   --------------------------------------------------------------------------- */
.tool {
  margin: 12px 0 32px;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-2);
}
.page-home .tool {
  margin-top: 8px;
}

.tool-heading {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  font-weight: 600;
}

/* Segmented control look */
.type-switch {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.type-switch button {
  border: 1px solid transparent;
  background: transparent;
  border-radius: calc(var(--radius-md) - 2px);
  min-height: 44px;
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 7rem;
  text-align: left;
  color: var(--ink);
  flex: 1 0 auto;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.type-switch button:hover:not(.is-on) {
  background: rgba(91, 95, 255, 0.06);
}
.type-switch button small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  font-weight: 500;
}
.type-switch button.is-on {
  background: var(--primary-bg);
  color: var(--primary-ink);
  border-color: var(--primary-bg);
  box-shadow: 0 1px 3px rgba(91, 95, 255, 0.3);
}
.type-switch button.is-on small {
  color: rgba(255, 255, 255, 0.78);
}
[data-theme="dark"] .type-switch button.is-on small {
  color: rgba(11, 18, 32, 0.7);
}

.tab-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}
.retired-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  display: inline-block;
}
.type-switch button.is-on .retired-dot { background: #FCD34D; }
[data-theme="dark"] .type-switch button.is-on .retired-dot { background: var(--warn); }

.type-blurb {
  color: var(--muted);
  margin: 12px 0 16px;
  max-width: 46rem;
  font-size: 15px;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  gap: 20px;
  align-items: start;
}
@media (min-width: 1280px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr) 440px; }
}

.schema-form, .preview { min-width: 0; }

.preview {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

/* ---------------------------------------------------------------------------
   9. Cards / blocks / form fields
   --------------------------------------------------------------------------- */
.block,
.channel-card,
.does-card,
.side-card,
.status-card,
.mock-card,
.code-panel,
.card,
.guide-collapse,
.how-to {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-1);
}

.block { padding: 16px; margin: 0 0 12px; }
.block legend,
.duration legend { font-weight: 600; padding: 0 4px; }

.section-lead,
.field small,
.duration small {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  margin: 4px 0 8px;
}

.fields { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
.field span,
.duration label span {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}

.req {
  color: var(--accent);
  text-decoration: none;
}

input, textarea, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:hover, textarea:hover, select:hover {
  border-color: var(--accent-soft-border);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 6.5rem; resize: vertical; }
input.is-invalid,
textarea.is-invalid,
select.is-invalid {
  border-color: var(--bad);
  background: var(--bad-bg);
}

.duration {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  margin: 0;
  background: var(--surface-2);
}
.duration legend,
.duration small { grid-column: 1 / -1; }

.repeater { display: grid; gap: 12px; }
.repeater-row {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.row-top,
.form-actions,
.code-bar,
.consent,
.consent-actions,
.validator-links,
.channel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row-top {
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.row-moves { display: flex; gap: 4px; }
.row-moves .btn { min-width: 44px; padding: 0 10px; }
.add-row { margin-top: 12px; }
.form-actions { margin: 8px 0 16px; flex-wrap: wrap; }

.opt-tag {
  margin-left: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

details.block summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
}
details.block summary .opt-tag { margin-left: auto; }

.example-flag {
  background: var(--warn-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 0 0 12px;
}

.noscript {
  background: var(--bad-bg);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent);
}

/* ---------------------------------------------------------------------------
   10. Status / mock / code panel
   --------------------------------------------------------------------------- */
.status-card {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  z-index: 3;
  padding: 14px 16px;
  border-left-width: 4px;
}
.tone-ok { border-left-color: var(--ok); background: var(--ok-bg); }
.tone-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.tone-bad { border-left-color: var(--bad); background: var(--bad-bg); }

.status-title { margin: 0 0 4px; font-size: 17px; line-height: 24px; }
.status-detail,
.mock-empty,
.clean { margin: 0; color: var(--muted); }

.mock-card {
  padding: 16px;
  box-shadow: var(--elev-2);
}
.mock-card h3 {
  margin: 4px 0 8px;
  font-size: 22px;
  line-height: 28px;
}
.mock-kicker,
.mock-note {
  margin: 0;
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mock-meta, .mock-price { margin: 4px 0; }
.mock-price { font-size: 22px; font-weight: 600; }
.mock-faq, .mock-card ol, .mock-card ul { margin: 8px 0 0; padding-left: 1.2rem; }
.mock-faq p { margin: 4px 0 8px; }

.crumbs { margin: 8px 0 0; }
.sep { color: var(--accent); }

.issue-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.issue-list li {
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.is-error {
  background: var(--bad-bg);
  box-shadow: inset 3px 0 0 var(--bad);
}
.is-warn {
  background: var(--warn-bg);
  box-shadow: inset 3px 0 0 var(--warn);
}

.code-panel {
  background: var(--panel);
  color: var(--panel-ink);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--elev-2);
  border-color: #1E293B;
}
.code-bar {
  padding: 10px 12px;
  color: var(--panel-muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  justify-content: space-between;
  flex-wrap: wrap;
  border-bottom: 1px solid #1E293B;
  background: rgba(15, 23, 42, 0.6);
}
.code-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  text-transform: none;
  letter-spacing: 0;
}
.json-out {
  margin: 0;
  padding: 16px;
  max-height: none;
  overflow: visible;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--panel-ink);
}
.tok-key { color: var(--tok-key); }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-bool { color: var(--tok-bool); }

.validator-links {
  font-size: 14px;
  flex-wrap: wrap;
  padding: 0 4px;
}

/* ---------------------------------------------------------------------------
   11. Status bar / how-to / guide links
   --------------------------------------------------------------------------- */
.status-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--elev-2);
}
.status-bar p { margin: 0; font-weight: 600; font-size: 14px; }
.status-bar a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-weight: 600;
}

.how-to {
  padding: 16px 18px 8px;
  margin: 8px 0 16px;
}
.how-to ol { margin: 8px 0 12px; padding-left: 1.2rem; }
.how-to li { margin: 6px 0; }

.guide-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.guide-links a {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  min-height: 44px;
  box-shadow: var(--elev-1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.guide-links a:hover {
  border-color: var(--accent);
  box-shadow: var(--elev-2);
  transform: translateY(-1px);
  color: inherit;
}
.guide-links strong { display: block; margin-bottom: 4px; }
.guide-links span { color: var(--muted); font-size: 14px; }

.guide-collapse { margin: 8px 0 48px; }
.guide-collapse > summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 600;
  min-height: 44px;
}

.guide-layout {
  display: grid;
  grid-template-columns: minmax(0, 68ch) 220px;
  gap: 32px;
  padding: 0 18px 24px;
  align-items: start;
}

.ad-slot { display: none; }
.ad-slot.is-live {
  display: block;
  min-height: 120px;
  margin: 24px 0;
  border: 0;
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--surface-2);
}
.ad-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------------------
   12. Prose / TOC / post layout (softer long-form, sans-first)
   --------------------------------------------------------------------------- */
.guide, .prose { max-width: 68ch; }

.prose h2, .prose h3 {
  font-family: var(--sans);
  letter-spacing: -0.02em;
}
.prose h2 {
  font-size: clamp(1.35rem, 1.2rem + 0.5vw, 1.65rem);
  margin: 2.25rem 0 0.75rem;
  padding-top: 0.5rem;
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.prose h3 {
  font-size: clamp(1.1rem, 1.05rem + 0.2vw, 1.25rem);
  margin: 1.75rem 0 0.5rem;
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.prose p, .prose li {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
}
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { padding-left: 1.2rem; margin: 0 0 1rem; }
.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.35em;
}
.prose pre {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  background: var(--panel);
  color: var(--panel-ink);
  padding: 16px;
  border-radius: var(--radius-md);
  overflow: auto;
  border: 1px solid #1E293B;
}
.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  margin: 0 0 1rem;
}
.prose th, .prose td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
}
.prose th { font-weight: 600; color: var(--muted); font-size: 14px; }

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 68ch) 240px;
  gap: 32px;
  align-items: start;
  padding-bottom: 48px;
}
.post-rail { display: grid; gap: 12px; }

.toc {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--elev-1);
}
.toc-label, .toc h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.toc ol, .side-card ol, .toc-fold ol {
  margin: 0;
  padding-left: 1.1rem;
}
.toc li, .side-card li, .toc-fold li {
  margin: 6px 0;
  font-size: 14px;
}
.toc a {
  color: var(--ink);
  text-decoration: none;
}
.toc a:hover { color: var(--accent-ink); }

.side-card { padding: 16px; }
.side-card h2 { font-size: 17px; margin: 0 0 8px; }
.side-card .btn { margin-top: 12px; width: 100%; }

.toc-fold {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 4px 16px;
  margin: 0 0 16px;
}
.toc-fold summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 600;
}

/* ---------------------------------------------------------------------------
   13. Blog filters & cards
   --------------------------------------------------------------------------- */
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px;
  margin: 0 0 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}
.filters button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.filters button:hover:not(.is-on) {
  background: var(--surface);
}
.filters button.is-on {
  background: var(--primary-bg);
  color: var(--primary-ink);
  border-color: var(--primary-bg);
  box-shadow: 0 1px 3px rgba(91, 95, 255, 0.25);
}

.featured-rail { margin-bottom: 24px; }
.featured-rail h2 { margin: 0 0 12px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 32px;
}
.card {
  display: block;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  min-height: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--elev-2);
  transform: translateY(-2px);
  color: inherit;
}
.card h2 {
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 8px 0;
}
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 4px;
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
}
.card time {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
   14. About / author / does-grid / effective
   --------------------------------------------------------------------------- */
.author-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 8px 0 20px;
}
.monogram {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), #4338CA);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  flex: none;
  box-shadow: var(--elev-2);
}
.author-name { margin: 0; font-weight: 600; font-size: 18px; }
.author-facts {
  margin: 2px 0 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.author-links { margin: 0; display: flex; gap: 16px; }

.does-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.does-card { padding: 16px 18px; }
.does-card h2 { margin: 0 0 8px; font-size: 17px; }
.does-card ul { margin: 0; padding-left: 1.1rem; }
.does-card li { margin: 6px 0; }

.effective {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 0 16px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}

/* ---------------------------------------------------------------------------
   15. Footer / contact
   --------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding: 28px 0 80px;
  color: var(--muted);
  font-size: 14px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}
.site-footer strong { color: var(--ink); }
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.footer-nav a {
  color: var(--muted);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.footer-nav a:hover { color: var(--accent-ink); }

.channel-card {
  padding: 20px;
  margin: 0 0 24px;
  max-width: 40rem;
  box-shadow: var(--elev-2);
}
.channel-card h2 { margin: 0 0 8px; }
.channel-actions { flex-wrap: wrap; margin-top: 14px; }

.contact-form {
  display: grid;
  gap: 12px;
  max-width: 36rem;
  margin-top: 16px;
}
.contact-form .btn { justify-self: start; }

/* ---------------------------------------------------------------------------
   16. Consent banner & toast
   --------------------------------------------------------------------------- */
.consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: #0F172A;
  color: #E2E8F0;
  padding: 14px 18px;
  box-shadow: var(--elev-3);
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.consent p { margin: 0; max-width: 46rem; font-size: 14px; }
.consent a { color: #A5B4FC; }
.consent .btn { min-height: 44px; }
.consent button[data-consent="essential"] {
  background: transparent;
  color: #E2E8F0;
  border-color: #475569;
}
.consent button[data-consent="ads"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--elev-2);
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
[data-theme="dark"] .toast {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------------------------------------------------------------------------
   17. Responsive — consolidated 640 / 768 / 1024 / 1280
   --------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  .tool-grid,
  .post-layout,
  .guide-layout { grid-template-columns: 1fr; }
  .preview {
    position: static;
    max-height: none;
    overflow: visible;
    margin-top: 8px;
  }
  .status-card { position: static; }
  .toc { display: none; }
  .toc-fold { display: block; }
  .post-rail .side-card { margin-top: 8px; }
  .tool { padding: 16px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .card-grid,
  .guide-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .bar > .local-badge { display: none; }
}

@media (max-width: 767px) {
  .nav, .bar > .local-badge { display: none; }
  .bar-end { margin-left: auto; }
  .nav-toggle { display: inline-flex; }

  .wrap { width: min(1160px, calc(100% - 24px)); }

  .card-grid,
  .guide-links,
  .does-grid,
  .site-footer .wrap { display: block; }

  .card,
  .guide-links a,
  .does-card { margin-bottom: 12px; }

  .type-switch button {
    flex-direction: row;
    align-items: center;
    min-width: 0;
    flex: 0 0 auto;
  }
  .type-switch button small { display: none; }

  .page-home { padding-bottom: 72px; }
  .status-bar { display: flex; }

  .consent { flex-direction: column; align-items: stretch; }
  .consent-actions { display: flex; flex-direction: column; }
  .consent .btn, .consent button { width: 100%; }

  .page-home .toast { bottom: 76px; }
  .footer-nav a { min-height: 36px; }

  .hero { padding: 28px 0 16px; }
  .filters { margin-left: -4px; margin-right: -4px; }
}

@media (max-width: 639px) {
  .duration { grid-template-columns: 1fr; }
  .channel-actions { flex-direction: column; align-items: stretch; }
  .channel-actions .btn { width: 100%; }
  .code-bar { flex-direction: column; align-items: flex-start; }
  .json-out { font-size: 13px; }
}

/* Consent stacking */
body:has(.consent) { padding-bottom: 96px; }
body:has(.consent) .status-bar { bottom: 108px; }
body:has(.consent) .toast { bottom: 120px; }

/* ---------------------------------------------------------------------------
   18. Reduced motion (keep a11y strengths)
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* The preview column is the sticky layer. A sticky status card inside it
   covers the mock card, so the status stays in normal flow. */
.preview .status-card { position: static; }
