/* sloppydisq — structural stylesheet.
   Tokens follow the Claude Design pass (notes/production/design/canvas/sloppydisq.dc.html):
   paper #f4f2ec · ink #0d0d0c · hazard #ff4d00 (cerise #f0006e as preset) · Plex Mono + Atkinson.
   The accent is visitor-selectable: accent.js sets --accent / --on-accent / --accent-text-* on :root
   and persists the choice in localStorage. Keep token names; swap values. */

:root {
  --paper: #f4f2ec;
  --ink: #0d0d0c;
  --surface: #e4e0d6;
  --rule: #d8d3c6;

  --accent: #ff4d00;              /* default: hazard orange (switcher overrides) */
  --on-accent: #0d0d0c;           /* text placed ON the accent */
  --accent-text-light: #c73a00;   /* accent used as text on paper */
  --accent-text-dark:  #ff6a26;   /* accent used as text on ink */
  --accent-text: var(--accent-text-light);

  /* fonts: self-host woff2 into assets/fonts later (no third-party requests); these stacks
     pick the faces up when installed locally and degrade honestly otherwise */
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;

  --cell: 8px;

  /* compat shim for pages ported from qry.zone */
  --space-xs: 4px; --space-sm: 8px; --space-md: 16px; --space-lg: 24px; --space-xl: 40px; --space-xxl: 64px;
  --color-accent: var(--accent-text);
  --color-text-primary: var(--ink);
  --color-text-secondary: rgba(13,13,12,.62);
  --color-border: var(--rule);
  --color-surface: var(--surface);
  --color-background: var(--paper);
  --border-radius: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d0d0c;
    --ink: #f4f2ec;
    --surface: #1b1b19;
    --rule: #2a2a27;
    --accent-text: var(--accent-text-dark);
    --color-text-secondary: rgba(244,242,236,.62);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── the bar: inverts with the scheme, as in the design (1a vs 1d) ── */
.bar {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: calc(var(--cell) * 3);
  min-height: 40px;
  padding: calc(var(--cell) * 1) calc(var(--cell) * 2);
}
.bar a { color: inherit; text-decoration: none; }
.bar nav a { opacity: .72; font-size: .8rem; font-weight: 500; }
.bar a:hover, .bar a:focus-visible { color: var(--accent); opacity: 1; }
.bar nav { display: flex; gap: calc(var(--cell) * 2); flex-wrap: wrap; align-items: center; }
.wordmark { font-size: .95rem; font-weight: 700; letter-spacing: .02em; }
.q-mark { margin-left: auto; line-height: 0; }
.q-mark svg { display: block; width: 24px; height: 24px; }

/* the hazard tape — the design's signature stripe under the bar */
.tape {
  height: var(--cell);
  background: repeating-linear-gradient(135deg, var(--accent) 0 var(--cell), var(--ink) var(--cell) calc(var(--cell) * 2));
}

.foot-bar {
  margin-top: auto;
  font-size: .8rem;
  font-weight: 400;
  justify-content: space-between;
  flex-wrap: wrap;
}

main {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: calc(var(--cell) * 4) calc(var(--cell) * 2) calc(var(--cell) * 8);
}

/* ── content basics ── */
h1, h2, h3 { font-family: var(--font-mono); line-height: 1.15; letter-spacing: -.01em; }
h1 .dot { color: var(--accent); }
a { color: var(--accent-text); }
img, video { max-width: 100%; height: auto; }

.btn {
  display: inline-block;
  font: 700 .75rem/1 var(--font-mono);
  padding: 10px 14px;
  text-decoration: none;
  border: 2px solid var(--ink);
  color: var(--ink);
}
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

pre {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: var(--space-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .85rem;
}
code { font-family: var(--font-mono); }

blockquote {
  border-left: calc(var(--cell) / 2) solid var(--accent);
  margin: var(--space-lg) 0;
  padding: 0 var(--space-md);
  color: var(--color-text-secondary);
}

.dim { color: var(--color-text-secondary); }
.accent { color: var(--accent-text); }
.article-footer { margin-top: var(--space-xl); padding-top: var(--space-md); border-top: 1px solid var(--rule); }
.status-badge { font-family: var(--font-mono); font-size: .75rem; border: 1px solid var(--rule); padding: 2px var(--space-sm); }

.listing { list-style: none; padding: 0; }
.listing li { margin-bottom: var(--space-lg); }
.listing a { font-family: var(--font-mono); font-weight: 600; }

.provenance { margin-top: calc(var(--cell) * 6); padding-top: var(--space-md); border-top: 1px solid var(--rule); font-size: .85rem; }

.verse {
  font-family: var(--font-mono);
  white-space: pre-line;
  border-left: calc(var(--cell) / 2) solid var(--accent);
  padding-left: var(--space-md);
  margin: var(--space-xl) 0;
}

/* ── accent switcher: a swatch in the nav, a native dialog with a color input ── */
.accent-btn {
  background: none; border: 0; padding: 4px; cursor: pointer; line-height: 0;
  display: inline-flex; align-items: center; gap: 6px; color: inherit; font: inherit;
}
.accent-btn .swatch {
  width: 14px; height: 14px; background: var(--accent);
  outline: 2px solid var(--paper); outline-offset: 1px; display: inline-block;
}
.accent-dialog {
  border: 2px solid var(--ink); padding: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-mono); max-width: 22rem; width: calc(100% - 2rem);
}
.accent-dialog::backdrop { background: rgba(13,13,12,.45); }
.accent-dialog form { margin: 0; padding: calc(var(--cell) * 2); display: grid; gap: calc(var(--cell) * 2); }
.accent-dialog h2 { margin: 0; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; }
.accent-dialog p { margin: 0; font-family: var(--font-body); font-size: .85rem; color: var(--color-text-secondary); }
.accent-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.accent-presets button {
  font: 600 .7rem/1 var(--font-mono); padding: 6px 8px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px;
}
.accent-presets button i { width: 10px; height: 10px; display: inline-block; background: var(--pc, var(--ink)); }
.accent-custom { display: flex; align-items: center; gap: 10px; font-size: .8rem; }
.accent-custom input[type=color] { width: 44px; height: 28px; padding: 0; border: 2px solid var(--ink); background: none; cursor: pointer; }
.accent-actions { display: flex; justify-content: space-between; gap: 8px; }
.accent-actions button { font: 700 .7rem/1 var(--font-mono); padding: 8px 10px; cursor: pointer; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); }
.accent-actions button[value=close] { background: var(--ink); color: var(--paper); }

.skip { position: absolute; left: -9999px; background: var(--accent); color: var(--on-accent); padding: var(--space-sm) var(--space-md); }
.skip:focus { left: var(--space-sm); top: var(--space-sm); z-index: 10; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── video + episodes (infra for the content) ── */
.video { aspect-ratio: 16 / 9; background: var(--surface); border: 2px solid var(--ink); }
.video iframe, .video video { width: 100%; height: 100%; display: block; border: 0; background: #000; }

.latest {
  margin-top: calc(var(--cell) * 5);
  border-top: 2px solid var(--ink);
  padding-top: var(--space-md);
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-md); flex-wrap: wrap;
  font: 600 .75rem/1.4 var(--font-mono);
}
.latest .dur { color: var(--accent-text); }
.latest a { text-decoration: none; color: inherit; }
.latest a:hover { color: var(--accent-text); }

.ep-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-md);
  padding-bottom: var(--space-sm); border-bottom: 2px solid var(--ink);
  font: 700 .7rem/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
}
.ep-list { list-style: none; padding: 0; margin: 0; }
.ep-row { display: flex; gap: var(--space-md); padding: var(--space-md) 0; border-bottom: 1px solid var(--rule); }
.ep-thumb {
  flex: none; width: 160px; aspect-ratio: 16 / 9; overflow: hidden;
  background: repeating-linear-gradient(135deg, var(--surface) 0 6px, var(--rule) 6px 12px);
}
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ep-meta { display: flex; gap: 8px; align-items: baseline; font: 600 .7rem/1 var(--font-mono); color: var(--color-text-secondary); }
.ep-badge { background: var(--ink); color: var(--paper); padding: 4px 6px; font-weight: 700; }
.ep-row:first-child .ep-badge { background: var(--accent); color: var(--on-accent); }
.ep-row h3 { margin: 0; font-size: 1.05rem; }
.ep-row h3 a { color: inherit; text-decoration: none; }
.ep-row h3 a:hover { color: var(--accent-text); }
.ep-row p { margin: 0; font-size: .9rem; color: var(--color-text-secondary); }
@media (max-width: 560px) { .ep-row { flex-direction: column; } .ep-thumb { width: 100%; } }

.episode .ep-meta { margin-bottom: var(--space-sm); }
.episode h1 { margin: var(--space-md) 0 var(--space-sm); }
.chapters { list-style: none; padding: 0; margin: var(--space-lg) 0; border-top: 1px solid var(--rule); font: 500 .8rem/1 var(--font-mono); }
.chapters li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.chapters .dim { opacity: .6; }

/* nav icons (the elephant) — same treatment as links, pixel-crisp */
.bar nav .nav-icon { line-height: 0; display: inline-flex; align-items: center; opacity: .85; }
.bar nav .nav-icon:hover, .bar nav .nav-icon:focus-visible { opacity: 1; color: var(--accent); }

/* ── index hero (design 1a), inside the reading measure ── */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: calc(var(--cell) * 4);
  align-items: start; padding-top: calc(var(--cell) * 3);
}
.hero-text { display: flex; flex-direction: column; gap: var(--space-md); min-width: 0; }
.hero h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.06; letter-spacing: -.02em; }
.hero .lede { margin: 0; max-width: 36rem; font-size: 1.05rem; color: var(--color-text-secondary); text-wrap: pretty; }
.hero-actions, .hero-links { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-links { margin-top: calc(var(--cell) / 2); }
.btn-sm { font-size: .65rem; padding: 7px 10px; opacity: .85; }
.btn-sm:hover, .btn-sm:focus-visible { opacity: 1; }
.hero-logo { width: clamp(128px, 18vw, 176px); aspect-ratio: 1; justify-self: end; }
.ascii-q { display: block; width: 100%; height: 100%; color: var(--ink); cursor: pointer; }
.ascii-q:hover { color: var(--accent); }
@media (max-width: 600px) {
  .hero { grid-template-columns: 1fr; }
  .hero-logo { justify-self: start; width: min(50vw, 160px); }
}
