/* Mica Unire, 1859 — archival ink on laid paper, wax-seal red. */
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-normal-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-normal-latin-ext.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap; unicode-range: U+0100-02AF;
}
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-italic-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-italic-latin-ext.woff2") format("woff2");
  font-weight: 400 700; font-style: italic; font-display: swap; unicode-range: U+0100-02AF;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-normal-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-normal-latin-ext.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap; unicode-range: U+0100-02AF;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-italic-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-italic-latin-ext.woff2") format("woff2");
  font-weight: 400 700; font-style: italic; font-display: swap; unicode-range: U+0100-02AF;
}

:root {
  color-scheme: light;
  --paper: #f4edde;
  --paper-deep: #e8dcc4;
  --surface: #faf5e9;
  --ink: #241f16;
  --ink-soft: #453b2c;
  --ink-muted: #6d6046;
  --rule: #d3c5a5;
  --rule-strong: #a8976f;
  --accent: #9c221a;
  --accent-deep: #7c1a13;
  --on-accent: #fdf6e8;
  --gold: #6d4d0c;
  --seal: #9c221a;
  --map-land: #ece0c6;
  --map-hatch: #d9c9a4;
  --map-water: #cfd9d4;
  --map-hi: #9c221a;
  --map-lo: #8a7c5c;
  --shadow: 0 1px 2px #241f1614, 0 10px 28px #241f1612;
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --bar: 2.75rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #161310;
    --paper-deep: #1e1a15;
    --surface: #211c16;
    --ink: #efe5d2;
    --ink-soft: #d9cdb4;
    --ink-muted: #b3a586;
    --rule: #3b332a;
    --rule-strong: #5c5040;
    --accent: #e2604a;
    --accent-deep: #f0836c;
    --on-accent: #22100b;
    --gold: #d9a94f;
    --seal: #d6533d;
    --map-land: #262019;
    --map-hatch: #332a1f;
    --map-water: #131b1d;
    --map-hi: #f0836c;
    --map-lo: #8d7f64;
    --shadow: 0 1px 2px #0007, 0 10px 28px #0006;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #161310;
  --paper-deep: #1e1a15;
  --surface: #211c16;
  --ink: #efe5d2;
  --ink-soft: #d9cdb4;
  --ink-muted: #b3a586;
  --rule: #3b332a;
  --rule-strong: #5c5040;
  --accent: #e2604a;
  --accent-deep: #f0836c;
  --on-accent: #22100b;
  --gold: #d9a94f;
  --seal: #d6533d;
  --map-land: #262019;
  --map-hatch: #332a1f;
  --map-water: #131b1d;
  --map-hi: #f0836c;
  --map-lo: #8d7f64;
  --shadow: 0 1px 2px #0007, 0 10px 28px #0006;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.075rem; line-height: 1.65;
}
main { display: block; }
.wrap { max-width: 44rem; margin-inline: auto; padding-inline: var(--gutter); }
.wide { max-width: 64rem; margin-inline: auto; padding-inline: var(--gutter); }
section { scroll-margin-top: calc(var(--bar) + 1rem); padding-block: clamp(1.5rem, 4vw, 3rem); }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; text-wrap: balance; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: 0 0 0.5rem; }
h3 { font-size: 1.2rem; margin: 0 0 0.4rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-deep); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 0.5rem; top: -4rem; z-index: 60; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; border-radius: 0.4rem; transition: top 0.15s; }
.skip:focus { top: 0.5rem; color: var(--paper); }

/* ---------- top bar (house pattern) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; min-height: var(--bar);
  display: flex; align-items: center; gap: 0.75rem; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule);
  font-family: var(--sans); font-size: 0.85rem; white-space: nowrap;
}
.topbar .home { color: var(--ink); text-decoration: none; font-weight: 650; }
.topbar .home:hover { color: var(--accent); }
.topnav { display: flex; gap: 0.9rem; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color: var(--ink-soft); text-decoration: none; padding-block: 0.2rem; }
.topnav a:hover { color: var(--accent); }
.topnav a[aria-current="true"] { color: var(--accent); font-weight: 700; }
.topbar .spacer { flex: 0 0 auto; margin-inline-start: auto; }
.langmenu { position: relative; flex: 0 0 auto; }
.langmenu summary { cursor: pointer; list-style: none; color: var(--ink-soft); border: 1px solid var(--rule); border-radius: 999px; padding: 0.15rem 0.6rem; display: flex; align-items: center; gap: 0.3rem; }
.langmenu summary::-webkit-details-marker { display: none; }
.langmenu summary:hover { border-color: var(--accent); color: var(--accent); }
.langmenu ul { position: absolute; right: 0; top: calc(100% + 0.4rem); margin: 0; padding: 0.3rem; list-style: none; background: var(--surface); border: 1px solid var(--rule); border-radius: 0.6rem; box-shadow: var(--shadow); min-width: 8rem; }
.langmenu ul a { display: block; padding: 0.45rem 0.7rem; border-radius: 0.4rem; color: var(--ink); text-decoration: none; }
.langmenu ul a[aria-current="true"] { font-weight: 700; }
.icon-btn {
  flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 50%;
  border: 1px solid var(--rule); background: transparent; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }

/* ---------- hero ---------- */
.hero { padding-block: clamp(2rem, 6vw, 4rem) clamp(1rem, 3vw, 2rem); border-bottom: 3px double var(--rule-strong); }
.kicker { font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 0.8rem; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); font-weight: 600; margin: 0 0 1rem; }
.hero h1 .seal-word { color: var(--accent); font-style: italic; }
.deck { font-size: clamp(1.1rem, 2.4vw, 1.3rem); line-height: 1.6; color: var(--ink-soft); max-width: 36rem; }
.deck strong { color: var(--ink); }
.question {
  margin: 1.2rem 0 0; padding: 0.7rem 1rem 0.7rem 2.6rem; position: relative;
  border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 0.6rem 0.6rem 0;
  font-family: var(--display); font-style: italic; font-size: 1.1rem; max-width: 36rem;
}
.question::before { content: "?"; position: absolute; left: 0.8rem; top: 0.45rem; font-style: normal; font-weight: 700; color: var(--accent); font-size: 1.3rem; }
.hero-grid { display: grid; gap: 1.5rem; align-items: start; }
@media (min-width: 56rem) { .hero-grid { grid-template-columns: 1fr 19rem; } }
.numbers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 0.8rem; overflow: hidden; margin: 1.6rem 0 0; max-width: 40rem; }
@media (min-width: 44rem) { .numbers { grid-template-columns: repeat(4, 1fr); } }
.numbers div { background: var(--surface); padding: 0.8rem 0.9rem; }
.numbers b { display: block; font-family: var(--display); font-size: 1.7rem; color: var(--accent); line-height: 1.1; }
.numbers span { font-family: var(--sans); font-size: 0.78rem; color: var(--ink-muted); line-height: 1.35; display: block; margin-top: 0.25rem; }
.seal-frame { justify-self: center; text-align: center; }
.seal-frame svg { width: min(15rem, 70vw); height: auto; filter: drop-shadow(0 6px 14px #9c221a33); }
.seal-cap { font-family: var(--sans); font-size: 0.75rem; color: var(--ink-muted); margin-top: 0.5rem; }

/* ---------- figures ---------- */
figure { margin: 1.5rem 0; }
figure img { width: 100%; height: auto; display: block; border: 1px solid var(--rule-strong); border-radius: 0.4rem; box-shadow: var(--shadow); background: var(--surface); }
figcaption { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-muted); margin-top: 0.5rem; line-height: 1.5; }
figcaption .credit { display: block; }
.portrait { max-width: 22rem; }

/* ---------- timeline ---------- */
.timeline-shell { background: var(--surface); border: 1px solid var(--rule); border-radius: 1rem; box-shadow: var(--shadow); overflow: hidden; }
.thread { display: grid; grid-template-columns: 1fr; }
@media (min-width: 56rem) { .thread { grid-template-columns: 17rem 1fr; } }
.stops { list-style: none; margin: 0; padding: 0.8rem; display: flex; gap: 0.5rem; overflow-x: auto; border-bottom: 1px solid var(--rule); }
@media (min-width: 56rem) { .stops { flex-direction: column; overflow: visible; border-bottom: 0; border-right: 1px solid var(--rule); } }
.stops li { flex: 0 0 auto; }
@media (min-width: 56rem) { .stops li { flex: none; } }
.stop-btn {
  display: flex; gap: 0.6rem; align-items: baseline; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 0.6rem; padding: 0.55rem 0.7rem; color: var(--ink);
  font-family: var(--serif); font-size: 0.92rem; line-height: 1.4;
}
.stop-btn .tick {
  flex: 0 0 auto; width: 1.7rem; height: 1.7rem; border-radius: 50%; align-self: center;
  border: 2px solid var(--rule-strong); display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: 0.72rem; font-weight: 700; color: var(--ink-muted); background: var(--paper);
}
.stop-btn small { display: block; font-family: var(--sans); font-size: 0.72rem; color: var(--ink-muted); }
.stop-btn:hover { border-color: var(--rule-strong); }
.stop-btn[aria-current="true"] { background: var(--paper); border-color: var(--accent); }
.stop-btn[aria-current="true"] .tick { background: var(--seal); border-color: var(--seal); color: var(--on-accent); }
.stop-btn.done .tick { border-color: var(--seal); color: var(--seal); }
.detail { padding: clamp(1.1rem, 3vw, 1.8rem); min-height: 16rem; }
.detail .when { font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 0 0 0.3rem; }
.detail h3 { font-size: clamp(1.3rem, 3vw, 1.7rem); margin: 0 0 0.6rem; }
.detail p { margin: 0 0 0.8rem; }
.detail .src { font-family: var(--sans); font-size: 0.78rem; color: var(--ink-muted); margin: 0.8rem 0 0; }
.controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.8rem; border-top: 1px solid var(--rule); background: var(--paper); }
.btn {
  font-family: var(--sans); font-size: 0.85rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 0.5rem 1rem; min-height: 2.75rem; min-width: 2.75rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--seal); border-color: var(--seal); color: var(--on-accent); }
.btn.primary:hover { color: var(--on-accent); filter: brightness(1.1); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.scrub { flex: 1 1 10rem; display: flex; align-items: center; gap: 0.6rem; font-family: var(--sans); font-size: 0.8rem; color: var(--ink-muted); }
input[type="range"] { flex: 1 1 auto; accent-color: var(--seal); min-height: 2.75rem; }
.countline { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-soft); padding: 0.7rem 1rem; border-top: 1px dashed var(--rule-strong); background: var(--paper); margin: 0; }
.countline b { color: var(--accent); font-size: 1.05em; }

/* ---------- map ---------- */
.map-frame { margin-top: 1.5rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 1rem; box-shadow: var(--shadow); overflow: hidden; }
.map-frame svg { display: block; width: 100%; height: auto; }
.map-frame .sea { fill: var(--map-water); }
.map-frame .land { fill: var(--map-land); stroke: var(--rule-strong); stroke-width: 1.5; }
.map-frame .hatch { fill: var(--map-hatch); }
.map-frame .river { fill: none; stroke: #5b7a80; stroke-width: 2; stroke-linecap: round; opacity: 0.8; }
.map-frame .inkbox { stroke: var(--map-lo); }
.map-frame .coroana path { stroke: var(--map-hi); }
.map-frame .coroana rect { fill: var(--map-hi); }
.map-frame .coroana { opacity: 0.35; }
.map-frame g.sealed .coroana { opacity: 1; }
.map-frame .crest { fill: none; stroke: var(--rule-strong); stroke-width: 1.2; stroke-dasharray: 3 3; }
.map-frame .placename { font-family: var(--display); font-size: 19px; fill: var(--ink); }
.map-frame .placename.sm { font-size: 16px; }
.map-frame .subname { font-family: var(--sans); font-size: 11.5px; fill: var(--ink-muted); }
.map-frame .city { fill: var(--map-lo); stroke: var(--surface); stroke-width: 2; }
.map-frame .city-ring { fill: none; stroke: var(--map-lo); stroke-width: 1.5; opacity: 0.6; }
.map-frame g.sealed .city { fill: var(--map-hi); }
.map-frame g.sealed .city-ring { stroke: var(--map-hi); opacity: 1; }
.map-frame .bond { stroke: var(--map-hi); stroke-width: 3; stroke-dasharray: 7 5; fill: none; opacity: 0; }
.map-frame .bond.on { opacity: 1; }
.map-frame .throne { font-size: 15px; }
.map-note { font-family: var(--sans); font-size: 0.78rem; color: var(--ink-muted); padding: 0.6rem 1rem 0.8rem; margin: 0; }
.map-cap { display: flex; gap: 0.6rem; align-items: center; padding: 0.7rem 1rem 0; font-family: var(--sans); font-size: 0.82rem; color: var(--ink-soft); }
.swatch { width: 0.9rem; height: 0.9rem; border-radius: 50%; background: var(--map-hi); flex: 0 0 auto; }
.swatch.hollow { background: transparent; border: 2px solid var(--map-lo); }

/* ---------- dossier ---------- */
.dossier { display: grid; gap: 1rem; }
@media (min-width: 56rem) { .dossier { grid-template-columns: repeat(3, 1fr); } }
.sheet {
  background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--seal);
  border-radius: 0.2rem 0.8rem 0.8rem 0.8rem; box-shadow: var(--shadow); padding: 1.1rem 1.1rem 1rem;
}
.sheet .fileno { font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 0.4rem; }
.sheet h3 { font-size: 1.15rem; }
.sheet p, .sheet li { font-size: 0.95rem; }
.sheet ul { margin: 0 0 0.8rem; padding-left: 1.1rem; }
.sheet .src { font-family: var(--sans); font-size: 0.76rem; color: var(--ink-muted); }
blockquote.period { margin: 0.8rem 0; padding: 0.8rem 1rem; border-left: 3px solid var(--seal); background: var(--paper); border-radius: 0 0.5rem 0.5rem 0; font-style: italic; }
blockquote.period footer { font-style: normal; font-family: var(--sans); font-size: 0.75rem; color: var(--ink-muted); margin-top: 0.5rem; }
.variant-switch { display: flex; gap: 0.4rem; margin: 0.7rem 0 0; }
.variant-switch .btn { min-height: 2.5rem; padding: 0.35rem 0.8rem; font-size: 0.78rem; }
.variant-switch .btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- takeaways / summary ---------- */
.takeaways { display: grid; gap: 1rem; counter-reset: take; }
@media (min-width: 56rem) { .takeaways { grid-template-columns: repeat(3, 1fr); } }
.take { background: var(--surface); border: 1px solid var(--rule); border-radius: 0.8rem; padding: 1.1rem; box-shadow: var(--shadow); }
.take::before { counter-increment: take; content: counter(take, upper-roman); font-family: var(--display); font-weight: 700; color: var(--accent); font-size: 1.4rem; display: block; margin-bottom: 0.3rem; }
.summary-box { background: var(--paper-deep); border: 1px dashed var(--rule-strong); border-radius: 0.8rem; padding: 1.2rem 1.3rem; margin-top: 1.5rem; }
.summary-box h3 { font-size: 1.1rem; }

/* ---------- method / sources ---------- */
.method-list { margin: 0 0 1rem; padding-left: 1.2rem; }
.method-list li { margin-bottom: 0.6rem; }
.source-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.source-list li { background: var(--surface); border: 1px solid var(--rule); border-radius: 0.6rem; padding: 0.7rem 0.9rem; font-size: 0.92rem; }
.source-list .sname { font-weight: 700; }
.source-list a, .detail .src a { overflow-wrap: anywhere; }
.source-list .snote { font-family: var(--sans); font-size: 0.78rem; color: var(--ink-muted); display: block; margin-top: 0.2rem; }

/* ---------- footer ---------- */
footer.site { border-top: 3px double var(--rule-strong); margin-top: 1rem; padding: 1.5rem var(--gutter) 2.5rem; font-family: var(--sans); font-size: 0.82rem; color: var(--ink-muted); }
footer.site .wrap { max-width: 44rem; }
footer.site p { margin: 0 0 0.5rem; }

.toplink { position: fixed; right: 1rem; bottom: 1rem; z-index: 40; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: var(--surface); border: 1px solid var(--rule-strong); color: var(--ink); display: none; align-items: center; justify-content: center; text-decoration: none; font-size: 1.2rem; }
.toplink.show { display: inline-flex; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 24.375rem) {
  body { font-size: 1rem; }
  .detail { min-height: 0; }
}
