/* degetele-romanilor: wax tablet and ivory — terracotta on parchment. */
@font-face {
  font-family: "Cormorant";
  src: url("/degetele-romanilor/assets/fonts/Cormorant.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant";
  src: url("/degetele-romanilor/assets/fonts/Cormorant-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
}
:root {
  --paper: #f7f1e5;
  --paper-2: #efe5d3;
  --ink: #262015;
  --ink-soft: #5c5245;
  --line: #d8c9ac;
  --accent: #a03d1c;
  --accent-ink: #7c2d12;
  --gold: #8a6a1f;
  --card: #fffdf7;
  --field: #10231f;
  --field-ink: #f2e9d4;
  --ok: #1f6b3a;
  --bad: #a01c1c;
  --serif: "Cormorant", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --topbar-h: 3rem;
}
html[data-theme="dark"] {
  --paper: #171310;
  --paper-2: #211a12;
  --ink: #efe4cf;
  --ink-soft: #bfae90;
  --line: #4a3d2b;
  --accent: #e08a54;
  --accent-ink: #f0b183;
  --gold: #d3a94f;
  --card: #201912;
  --field: #0d1512;
  --field-ink: #efe4cf;
  --ok: #6fc287;
  --bad: #e87c7c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}
::selection { background: var(--accent); color: #fff; }
html[data-theme="dark"] ::selection { color: #171310; }

/* Sticky bar: one line, sideways scroll, never wraps. */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 .9rem;
  padding-top: env(safe-area-inset-top);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar .home { color: var(--ink); text-decoration: none; font-weight: 650; white-space: nowrap; font-size: .95rem; }
.topbar .home:hover { color: var(--accent); }
.topnav { display: flex; gap: 1rem; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color: var(--ink-soft); text-decoration: none; font-size: .92rem; }
.topnav a:hover { color: var(--accent); }
.topnav a[aria-current="true"] { color: var(--accent); font-weight: 650; }
.topbar .spacer { flex: 1 1 auto; }
.chip {
  border: 1px solid var(--line); border-radius: 999px;
  padding: .2rem .8rem; font-size: .88rem; white-space: nowrap;
  color: var(--ink); text-decoration: none;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer; flex: none;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Reading rail (desktop only). */
.rail {
  position: fixed; right: 1.1rem; top: 50%; transform: translateY(-50%);
  display: none; flex-direction: column; gap: .55rem; z-index: 40;
}
@media (min-width: 1100px) { .rail { display: flex; } }
.rail a {
  display: flex; align-items: center; gap: .5rem; justify-content: flex-end;
  color: var(--ink-soft); text-decoration: none; font-size: .8rem;
}
.rail a i { width: .55rem; height: .55rem; border-radius: 50%; border: 1px solid var(--ink-soft); }
.rail a[aria-current="true"] { color: var(--accent); }
.rail a[aria-current="true"] i { background: var(--accent); border-color: var(--accent); }

main { display: block; }
.wrap { max-width: 42rem; margin: 0 auto; padding: 0 1.1rem; }
.wrap.wide { max-width: 56rem; }
section { scroll-margin-top: calc(var(--topbar-h) + .8rem); }

/* Hero. */
.hero { padding: 2.6rem 0 0; }
.kicker {
  font-size: .85rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 .9rem; font-weight: 700;
}
h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(2.1rem, 5.2vw + 1rem, 3.4rem);
  line-height: 1.08; margin: 0 0 1rem; text-wrap: balance;
}
.deck { font-size: 1.16rem; line-height: 1.6; color: var(--ink-soft); margin: 0 0 1.6rem; }
.deck strong { color: var(--ink); }
html[data-theme="dark"] .deck strong { color: var(--ink); }
.byline { font-size: .9rem; color: var(--ink-soft); margin: 0 0 1.8rem; }
.byline a { color: inherit; }

/* Figures. */
figure.slab { margin: 0 auto 2.2rem; max-width: 56rem; padding: 0 1.1rem; }
figure.slab.narrow { max-width: 30rem; }
figure.slab img {
  display: block; width: 100%; height: auto; border-radius: .4rem;
  border: 1px solid var(--line); background: var(--card);
}
figcaption {
  font-size: .92rem; color: var(--ink-soft); line-height: 1.55;
  margin-top: .7rem; max-width: 42rem;
}
figcaption .credit { display: block; margin-top: .3rem; font-size: .84rem; }
figcaption a { color: var(--accent-ink); }

/* Sections. */
.block { padding: 1.2rem 0 2rem; }
h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.6rem, 3.4vw + .8rem, 2.3rem);
  line-height: 1.15; margin: 0 0 1rem; text-wrap: balance;
}
h2 .anchor { color: inherit; text-decoration: none; }
h2 .anchor:hover { color: var(--accent); }
.prose p { margin: 0 0 1.05rem; }
.prose a { color: var(--accent-ink); }
.lede { font-size: 1.13rem; color: var(--ink-soft); }
em[lang="la"], span[lang="la"], i[lang="la"] { font-style: italic; }

/* Bede counter. */
.counter {
  background: var(--field); color: var(--field-ink);
  border-radius: .7rem; padding: 1.4rem 1.3rem 1.5rem;
  margin: 1.6rem 0 2rem;
}
.counter h3 { font-family: var(--serif); font-size: 1.5rem; margin: 0 0 .4rem; font-weight: 600; }
.counter .hint { margin: 0 0 1.1rem; font-size: .95rem; opacity: .85; }
.counter .controls { display: flex; flex-wrap: wrap; gap: .9rem 1.2rem; align-items: end; margin-bottom: 1.2rem; }
.counter label { display: grid; gap: .35rem; font-size: .9rem; }
.counter input[type="number"] {
  width: 8.5rem; font-size: 1.3rem; padding: .45rem .6rem;
  border-radius: .4rem; border: 1px solid #5a6d68; background: #fffdf7; color: #262015;
}
.counter input[type="range"] { width: min(16rem, 60vw); accent-color: #e08a54; }
.counter .hands { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 480px) { .counter .hands { grid-template-columns: 1fr; } }
.hand { background: rgba(255, 253, 247, .06); border: 1px solid rgba(242, 233, 212, .22); border-radius: .55rem; padding: .8rem; }
.hand h4 { margin: 0 0 .2rem; font-size: .95rem; font-weight: 650; }
.hand .value { font-family: var(--serif); font-size: 1.9rem; line-height: 1; margin: 0 0 .5rem; color: #f0c892; }
.hand svg { display: block; width: 100%; height: auto; }
.finger { fill: none; stroke: #8fa39d; stroke-width: 5; stroke-linecap: round; opacity: .45; transition: opacity .2s, stroke .2s; }
.finger.lit { opacity: 1; stroke: #f0c892; }
.finger.dim { opacity: .25; }
.palm { fill: none; stroke: #8fa39d; stroke-width: 3; opacity: .5; }
.fields { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; font-size: .98rem; }
.fields li { display: flex; gap: .6rem; align-items: baseline; }
.fields li.off { opacity: .45; }
.fields .n {
  flex: none; min-width: 3.2rem; text-align: right;
  font-family: var(--serif); font-size: 1.25rem; color: #f0c892;
}
.fields li.off .n { color: inherit; }
.example-note { font-size: .88rem; opacity: .8; margin: 1rem 0 0; }
.static-fallback { border-top: 1px dashed rgba(242,233,212,.3); margin-top: 1.1rem; padding-top: .9rem; font-size: .93rem; }
.static-fallback p { margin: 0 0 .6rem; }
.js .needs-js { display: revert; }
.no-js-note { display: none; }

/* Romance table. */
.table-scroll { overflow-x: auto; margin: 1.4rem 0 1.8rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--card); }
table.cognates { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: .98rem; }
.cognates caption { text-align: left; padding: .9rem 1rem .6rem; color: var(--ink-soft); font-size: .9rem; }
.cognates th, .cognates td { padding: .6rem .9rem; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.cognates thead th { border-top: 0; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.cognates td[lang="la"] { font-style: italic; }
.cognates .ro { font-weight: 700; color: var(--accent); }
.cognates .tag { display: block; font-size: .8rem; font-weight: 400; color: var(--ink-soft); }

/* Finger explorer. */
.explorer {
  display: grid; grid-template-columns: 1fr; gap: 1.2rem;
  background: var(--card); border: 1px solid var(--line); border-radius: .7rem;
  padding: 1.3rem; margin: 1.4rem 0 1.8rem;
}
@media (min-width: 720px) { .explorer { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.explorer h3 { font-family: var(--serif); font-size: 1.4rem; margin: 0 0 .2rem; }
.explorer .hint { margin: 0 0 1rem; font-size: .92rem; color: var(--ink-soft); }
.fingers {
  display: flex; align-items: flex-end; gap: .45rem;
  border-bottom: 3px solid var(--line); padding-bottom: 0; margin-bottom: 1rem;
}
.finger-btn {
  flex: 1 1 0; min-width: 0; cursor: pointer;
  border: 2px solid var(--ink-soft); border-bottom: 0;
  border-radius: 1.1rem 1.1rem 0 0;
  background: var(--paper-2); color: var(--ink);
  font-size: .72rem; font-weight: 650; line-height: 1.2;
  padding: .5rem .1rem .4rem;
  min-height: 3rem;
}
.finger-btn[data-h="mid"] { height: 5.2rem; }
.finger-btn[data-h="short"] { height: 4.4rem; }
.finger-btn[data-h="tall"] { height: 6.6rem; }
.finger-btn[data-h="tallest"] { height: 7.6rem; }
.finger-btn span[aria-hidden="true"] {
  display: flex; align-items: center; justify-content: center;
  height: 100%; writing-mode: vertical-rl; font-size: .8rem; letter-spacing: .02em;
}
.finger-btn:hover { border-color: var(--accent); }
.finger-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent-ink); color: #fff; }
html[data-theme="dark"] .finger-btn[aria-pressed="true"] { color: #171310; }
.story { min-height: 12rem; }
.story h3 { font-family: var(--serif); font-size: 1.6rem; margin: 0 0 .3rem; }
.story .latin { color: var(--ink-soft); margin: 0 0 .7rem; }
.story p { margin: 0 0 .8rem; }
.story .verdict { display: inline-block; font-size: .85rem; font-weight: 700; border-radius: 999px; padding: .15rem .8rem; }
.verdict.kept { background: rgba(31, 107, 58, .14); color: var(--ok); }
.verdict.renamed { background: rgba(160, 29, 29, .12); color: var(--bad); }
html[data-theme="dark"] .verdict.renamed { background: rgba(232, 124, 124, .16); }

/* Quiz. */
.quiz { background: var(--paper-2); border: 1px solid var(--line); border-radius: .7rem; padding: 1.3rem; margin: 0 0 2rem; }
.quiz h3 { font-family: var(--serif); font-size: 1.5rem; margin: 0 0 .3rem; }
.quiz .progress { font-size: .9rem; color: var(--ink-soft); margin: 0 0 1rem; }
.quiz .word { font-family: var(--serif); font-size: 2.4rem; line-height: 1.1; margin: .4rem 0; }
.quiz .word small { display: block; font-family: var(--sans); font-size: .9rem; color: var(--ink-soft); }
.quiz .options { display: grid; gap: .55rem; margin: 1rem 0; }
.quiz .options button {
  text-align: left; font-size: 1rem; padding: .65rem .9rem; border-radius: .5rem;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
  min-height: 3rem;
}
.quiz .options button:hover:not(:disabled) { border-color: var(--accent); }
.quiz .options button:disabled { cursor: default; opacity: .85; }
.quiz .options button.right { border-color: var(--ok); background: rgba(31, 107, 58, .12); }
.quiz .options button.wrong { border-color: var(--bad); background: rgba(160, 29, 29, .1); }
.quiz .feedback { min-height: 2.6rem; margin: 0 0 .8rem; font-size: .98rem; }
.quiz .row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.btn {
  font-size: 1rem; padding: .6rem 1.2rem; border-radius: .5rem; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; min-height: 3rem;
}
html[data-theme="dark"] .btn { color: #171310; }
.btn.secondary { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn:hover { filter: brightness(1.06); }
.quiz .score { font-weight: 700; }
.answers { margin: 1rem 0 0; font-size: .95rem; }
.answers summary { cursor: pointer; color: var(--accent-ink); }

/* Sources. */
ul.srcs { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
ul.srcs li { padding-left: 1.1rem; border-left: 3px solid var(--line); font-size: .97rem; }
ul.srcs a { color: var(--accent-ink); overflow-wrap: anywhere; }

footer.foot {
  border-top: 1px solid var(--line); margin-top: 1rem;
  padding: 1.4rem 1.1rem 2.4rem; text-align: center;
  color: var(--ink-soft); font-size: .92rem;
}
footer.foot a { color: inherit; }
footer.foot p { margin: 0 0 .4rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@media (max-width: 480px) {
  body { font-size: 1rem; }
  .deck { font-size: 1.08rem; }
  .counter { padding: 1.1rem .95rem 1.2rem; }
  .explorer, .quiz { padding: 1rem .9rem; }
}
