/* ═══════════════════════════════════════════════════════
   TABLITELE-TARTARIA — Fired clay, bone, ink
   ═══════════════════════════════════════════════════════ */

/* ── Fonts ──────────────────────────────────────────── */
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/tablitele-tartaria/assets/fonts/CG-400-normal-latin-ext.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/tablitele-tartaria/assets/fonts/CG-400-normal-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/tablitele-tartaria/assets/fonts/CG-400-italic-latin-ext.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/tablitele-tartaria/assets/fonts/CG-400-italic-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Tokens: light ──────────────────────────────────── */
:root {
  --paper:    #f5eee1;
  --surface:  #ece1cd;
  --surface-2:#e0d2b8;
  --stone:    #c9b795;

  --ink:      #221a12;
  --ink-2:    #41362a;
  --ink-3:    #615647;
  --ink-4:    #837668;

  --accent:   #963f16;
  --accent-bg:#f3ddc8;

  --yes:      #1e5e3c;
  --yes-bg:   #d9e8dc;
  --no:       #93302b;
  --no-bg:    #f2d8d4;
  --unknown:  #7a5a14;
  --unknown-bg:#eee3c4;

  --clay:     #b06a2e;
  --clay-bg:  #f0e3d2;

  --focus:    #2e6e8c;
  --border:   rgba(34,26,18,.14);

  --bar-h:    2.75rem;
  --measure:  38rem;
  --gap:      clamp(1.5rem, 3vw, 3rem);

  --font-display: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
  --font-body:    'Georgia', 'Times New Roman', serif;
  --font-mono:    'SFMono-Regular', 'Consolas', monospace;
}

/* ── Tokens: dark ───────────────────────────────────── */
[data-theme="dark"] {
  --paper:    #14100b;
  --surface:  #1f1811;
  --surface-2:#2b2115;
  --stone:    #453823;

  --ink:      #f0e7d6;
  --ink-2:    #d4c9b2;
  --ink-3:    #b3a78e;
  --ink-4:    #8d836e;

  --accent:   #e08a4e;
  --accent-bg:#2c1d10;

  --yes:      #86cba1;
  --yes-bg:   #152b1f;
  --no:       #e89a94;
  --no-bg:    #2d1614;
  --unknown:  #d9bd6a;
  --unknown-bg:#2b2410;

  --clay:     #d99a5b;
  --clay-bg:  #241a0f;

  --focus:    #6fb3d4;
  --border:   rgba(240,231,214,.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:    #14100b;
    --surface:  #1f1811;
    --surface-2:#2b2115;
    --stone:    #453823;
    --ink:      #f0e7d6;
    --ink-2:    #d4c9b2;
    --ink-3:    #b3a78e;
    --ink-4:    #8d836e;
    --accent:   #e08a4e;
    --accent-bg:#2c1d10;
    --yes:      #86cba1;
    --yes-bg:   #152b1f;
    --no:       #e89a94;
    --no-bg:    #2d1614;
    --unknown:  #d9bd6a;
    --unknown-bg:#2b2410;
    --clay:     #d99a5b;
    --clay-bg:  #241a0f;
    --focus:    #6fb3d4;
    --border:   rgba(240,231,214,.12);
  }
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 1rem + .22vw, 1.17rem);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; display: block; }

/* ── Focus ──────────────────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Layout ─────────────────────────────────────────── */
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }
.wide { max-width: 56rem; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: .5rem;
  height: var(--bar-h);
  padding: 0 clamp(.75rem, 2vw, 1.25rem);
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: .85rem;
  letter-spacing: .02em;
}
.topbar .home { color: var(--ink-3); text-decoration: none; white-space: nowrap; }
.topbar .home:hover { color: var(--ink); }
.topnav { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  color: var(--ink-3); text-decoration: none; white-space: nowrap;
  padding: .25rem .5rem; border-radius: 4px;
}
.topnav a:hover { color: var(--ink); background: var(--surface); }
.topnav a[aria-current="true"] { color: var(--ink); font-weight: 600; }
.spacer { flex: 1; }
.chip {
  color: var(--ink-3); text-decoration: none; white-space: nowrap;
  padding: .2rem .6rem; border-radius: 4px;
  font-size: .8rem;
}
.chip:hover { color: var(--ink); background: var(--surface); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 50%;
  border: none; background: none; color: var(--ink-3);
  cursor: pointer; padding: 0;
}
.icon-btn:hover { color: var(--ink); background: var(--surface); }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }

/* ── Sections ───────────────────────────────────────── */
section { scroll-margin-top: calc(var(--bar-h) + 1rem); }
.block { padding: var(--gap) 0; }
.block + .block { border-top: 1px solid var(--border); }

/* ── Typography ─────────────────────────────────────── */
h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 1.4rem + 3.5vw, 4.2rem);
  line-height: 1.06;
  font-weight: 400;
  letter-spacing: -.01em;
  color: var(--ink);
}
h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.2rem);
  line-height: 1.15;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 1rem;
}
h2 .anchor { color: inherit; text-decoration: none; }
h2 .anchor:hover { text-decoration: underline; text-decoration-thickness: 1px; }
h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--ink);
  margin: 1.5rem 0 .5rem;
}
.kicker {
  font-family: var(--font-display);
  font-size: .95rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .5rem;
}
.deck {
  font-size: clamp(1.08rem, 1rem + .35vw, 1.28rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 34rem;
}
.lede {
  font-size: 1.08rem;
  color: var(--ink-2);
  margin-bottom: 1.5rem;
}
.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1em; }
.prose blockquote {
  margin: 1.25em 0;
  padding: .9em 1.2em;
  border-left: 3px solid var(--clay);
  background: var(--clay-bg);
  border-radius: 0 6px 6px 0;
  color: var(--ink-2);
  font-style: italic;
}
.prose blockquote footer {
  margin-top: .5em;
  font-style: normal;
  font-size: .88rem;
  color: var(--ink-3);
}

/* ── Hero ───────────────────────────────────────────── */
.hero {
  padding: clamp(3rem, 8vw, 7rem) 0 clamp(2rem, 5vw, 4rem);
  text-align: center;
}
.hero-text { margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.hero h1 { margin-bottom: 1rem; }
.hero .deck { margin: 0 auto; }

/* ── Vitrine (hero figure) ──────────────────────────── */
.vitrine {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto;
  max-width: 56rem;
}
.vitrine img { width: 100%; }
.vitrine-cap {
  padding: 1rem clamp(1rem, 3vw, 2rem);
  font-size: .88rem;
  color: var(--ink-3);
  border-top: 1px solid var(--border);
  text-align: left;
  line-height: 1.5;
}

/* ── Tablet explorer ────────────────────────────────── */
.tablets { margin-top: 1.5rem; }
.tablet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.tablet-tabs button {
  font-family: var(--font-display);
  font-size: 1rem;
  padding: .55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
  min-height: 44px;
}
.tablet-tabs button:hover { border-color: var(--clay); color: var(--ink); }
.tablet-tabs button[aria-selected="true"] {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.tablet-panels { list-style: none; padding: 0; }
.tablet-panels li {
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--paper);
}
.tablet-panels li + li { margin-top: 1rem; }
.tablet-panels h3 { margin-top: 0; }
.tablet-panels p {
  font-size: .95rem;
  color: var(--ink-2);
  line-height: 1.55;
}
.tablet-panels p + p { margin-top: .75em; }
.js .tablet-panels li[hidden] { display: none; }

/* ── Figures ────────────────────────────────────────── */
.fig { margin: 1.5rem 0 0; }
.fig img { border-radius: 6px; }
.fig.tall img { max-height: 32rem; width: auto; margin: 0 auto; }
.fig figcaption {
  font-size: .85rem;
  color: var(--ink-3);
  margin-top: .5rem;
  line-height: 1.45;
}
.fig .cr { font-size: .78rem; display: block; margin-top: .25rem; }
.fig .cr a { color: var(--ink-4); }

/* ── Facts DL ───────────────────────────────────────── */
.facts {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.facts dt {
  font-family: var(--font-display);
  font-size: .85rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: .75rem;
}
.facts dt:first-child { margin-top: 0; }
.facts dd { margin-left: 0; color: var(--ink-2); }

/* ── Split layout ───────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
@media (min-width: 50rem) {
  .split { grid-template-columns: 1fr 1fr; }
}

/* ── Timeline ───────────────────────────────────────── */
.timeline {
  list-style: none;
  padding: 0;
  border-left: 2px solid var(--border);
  margin: 1.5rem 0 0 .5rem;
}
.timeline li {
  padding: .75rem 0 .75rem 1.5rem;
  position: relative;
  font-size: .95rem;
  color: var(--ink-2);
}
.timeline li::before {
  content: '';
  position: absolute;
  left: -6px; top: 1rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--stone);
  border: 2px solid var(--paper);
}
.timeline .year {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  display: block;
  font-size: 1rem;
}
.timeline .fire-event::before { background: var(--accent); }
.timeline .fire-event .year { color: var(--accent); }

/* ── Trial (verdict interaction) ────────────────────── */
.trial { list-style: none; padding: 0; display: grid; gap: 1rem; }
.trial .case {
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--paper);
}
.trial .case h3 { margin-top: 0; }
.trial .sides { display: grid; gap: .75rem; margin: .75rem 0 1rem; }
@media (min-width: 44rem) {
  .trial .sides { grid-template-columns: 1fr 1fr; }
}
.trial .side {
  font-size: .9rem;
  color: var(--ink-2);
  line-height: 1.55;
  padding: .75rem 1rem;
  border-radius: 6px;
  background: var(--surface);
}
.trial .side strong {
  display: block;
  font-family: var(--font-display);
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: .25rem;
}
.trial .side.aff strong { color: var(--yes); }
.trial .side.neg strong { color: var(--no); }
.vote { border: none; padding: 0; margin: 0; }
.vote legend {
  font-size: .88rem;
  color: var(--ink-3);
  margin-bottom: .5rem;
  padding: 0;
}
.vote .opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.vote button {
  font-family: var(--font-display);
  font-size: 1rem;
  padding: .5rem 1.1rem;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
}
.vote button:hover { border-color: var(--accent); color: var(--ink); }
.vote button[aria-pressed="true"].v-yes { background: var(--yes-bg); border-color: var(--yes); color: var(--yes); }
.vote button[aria-pressed="true"].v-no { background: var(--no-bg); border-color: var(--no); color: var(--no); }
.vote button[aria-pressed="true"].v-dk { background: var(--unknown-bg); border-color: var(--unknown); color: var(--unknown); }
.trial-result {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .95rem;
  color: var(--ink-2);
}
.trial-result strong { color: var(--ink); }
.trial-result .reset {
  margin-top: .75rem;
  background: none;
  border: none;
  padding: .5rem 0;
  min-height: 44px;
  color: var(--accent);
  font-size: .9rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .15em;
}

/* ── Sources ────────────────────────────────────────── */
.srcs { padding: 0; list-style: none; }
.srcs li {
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  color: var(--ink-2);
}
.srcs li:last-child { border-bottom: none; }
.srcs a { word-break: break-all; }

/* ── Footer ─────────────────────────────────────────── */
.foot {
  padding: 2rem 0;
  text-align: center;
  font-size: .85rem;
  color: var(--ink-4);
  border-top: 1px solid var(--border);
}
.foot a { color: var(--ink-3); }
.foot p + p { margin-top: .25rem; }

/* ── Rail (desktop reading rail) ────────────────────── */
.rail { display: none; }
@media (min-width: 90rem) {
  .rail {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 90;
    font-family: var(--font-display);
    font-size: .72rem;
    letter-spacing: .04em;
  }
  .rail a {
    display: flex; align-items: center; gap: .5rem;
    color: var(--ink-4); text-decoration: none;
    padding: .3rem .5rem;
    border-radius: 4px;
    flex-direction: row-reverse;
  }
  .rail a:hover { color: var(--ink-2); }
  .rail a[aria-current="true"] { color: var(--ink); }
  .rail a[aria-current="true"] i { background: var(--accent); }
  .rail i {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--stone);
    display: block;
    flex-shrink: 0;
  }
}

/* ── Reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
  html { scroll-behavior: auto; }
}

/* ── Print ──────────────────────────────────────────── */
@media print {
  .topbar, .rail, .icon-btn { display: none; }
  body { font-size: 11pt; }
  section { break-inside: avoid; }
}
