@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Manrope:wght@400;500;600;700;800&display=swap");

/* Overlay font: only Cyrillic codepoints we have hand-tuned to match the
   1851 facsimile. unicode-range keeps the browser from downloading this
   file for unrelated text. Built by assets/fonts/build_stamati_font.py. */
@font-face {
  font-family: "Stamati Tranzitie";
  src: url("../fonts/stamati-tranzitie-Regular.woff2?v=9") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0049, U+0069, U+0306, U+0406, U+0431, U+0456, U+A64B;
}
@font-face {
  font-family: "Stamati Tranzitie";
  src: url("../fonts/stamati-tranzitie-Bold.woff2?v=9") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0049, U+0069, U+0306, U+0406, U+0431, U+0456, U+A64B;
}
@font-face {
  font-family: "Stamati Tranzitie";
  src: url("../fonts/stamati-tranzitie-Italic.woff2?v=9") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0049, U+0069, U+0306, U+0406, U+0431, U+0456, U+A64B;
}
@font-face {
  font-family: "Stamati Tranzitie";
  src: url("../fonts/stamati-tranzitie-BoldItalic.woff2?v=9") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0049, U+0069, U+0306, U+0406, U+0431, U+0456, U+A64B;
}

:root {
  --bg-0: #f4efe6;
  --bg-1: #e8dfcf;
  --bg-2: #d5cbc1;
  --ink-0: #23201b;
  --ink-1: #4a443b;
  --ink-2: #6c655a;
  --line: #d0c5b5;
  --card: rgba(255, 252, 246, 0.84);
  --card-strong: #fffaf1;
  --accent: #0d6d6c;
  --accent-soft: #bddfd7;
  --accent-ink: #073d3d;
  --warning: #9b4a2f;
  --radius-m: 14px;
  --radius-l: 22px;
  --shadow: 0 18px 40px rgba(56, 43, 24, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink-0);
  background:
    radial-gradient(1200px 500px at 10% -20%, #f9f2e4 0%, rgba(249, 242, 228, 0) 72%),
    radial-gradient(900px 500px at 95% -40%, #d6e7df 0%, rgba(214, 231, 223, 0) 65%),
    linear-gradient(165deg, var(--bg-0), var(--bg-1) 55%, var(--bg-2));
}

a {
  color: inherit;
}

.site-shell {
  width: min(1600px, calc(100vw - 3rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(92, 80, 60, 0.2);
  background: rgba(250, 245, 235, 0.82);
  backdrop-filter: blur(8px);
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 76px;
  gap: 1rem;
  padding-block: 0.6rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.brand {
  font-family: "Fraunces", serif;
  font-size: 1.45rem;
  text-decoration: none;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.nav-link {
  text-decoration: none;
  font-weight: 700;
  font-size: 0.93rem;
  padding: 0.55rem 0.78rem;
  border-radius: 999px;
  color: var(--ink-1);
  transition: background-color 180ms ease, color 180ms ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.6);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.dictionary-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  padding-block: 0.65rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.dictionary-nav a {
  text-decoration: none;
  color: var(--accent-ink);
  padding-block: 0.25rem;
}

.dictionary-nav a:hover,
.dictionary-nav a[aria-current] {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

#prefata,
#abrevieri {
  scroll-margin-top: 15rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.2rem;
  padding: 2.2rem 0 1.3rem;
}

.hero-copy {
  background: linear-gradient(140deg, rgba(255, 250, 240, 0.9), rgba(246, 236, 220, 0.86));
  border: 1px solid rgba(118, 95, 60, 0.18);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  padding: clamp(1.3rem, 2.4vw, 2rem);
}

.hero-kicker {
  margin: 0;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 0.76rem;
  color: var(--accent);
}

.hero-title {
  margin: 0.6rem 0;
  font-family: "Fraunces", serif;
  line-height: 1.08;
  font-size: clamp(1.7rem, 3.5vw, 3rem);
}

.hero-description {
  margin: 0;
  line-height: 1.65;
  color: var(--ink-1);
  max-width: 62ch;
}

.hero-actions {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.button {
  text-decoration: none;
  border-radius: 999px;
  padding: 0.72rem 1.15rem;
  font-weight: 800;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.button.solid {
  background: linear-gradient(180deg, #0f7f7f, #0a6666);
  color: #f8fffd;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink-0);
  border-color: rgba(85, 77, 64, 0.22);
}

.surface {
  border: 1px solid rgba(80, 62, 40, 0.18);
  border-radius: var(--radius-l);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 2vw, 1.6rem);
}

.surface-title,
.section-title,
.panel-title {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(1.0rem, 1.4vw, 1.25rem);
}

.surface-subtitle {
  margin: 1.4rem 0 0.7rem;
  font-family: "Fraunces", serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.hero-aside {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 0.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.stat-card {
  border-radius: var(--radius-m);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.94), rgba(234, 243, 240, 0.84));
  border: 1px solid rgba(115, 139, 131, 0.28);
  padding: 0.55rem 0.6rem;
  text-align: center;
}

.stat-card .label {
  display: block;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.25;
}

.stat-card .value {
  display: block;
  margin-top: 0.2rem;
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  font-weight: 800;
  color: var(--accent-ink);
}

.muted {
  color: var(--ink-2);
  font-size: 0.88rem;
  margin: 0;
}

.quick-search {
  margin: 0.6rem auto 1.7rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 0.8rem;
}

.script-toggle {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(244, 241, 235, 0.95);
  border: 1px solid rgba(83, 73, 58, 0.18);
  padding: 0.2rem;
}

.toggle-button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-1);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.45rem 0.78rem;
  cursor: pointer;
}

.toggle-button.active {
  background: var(--accent);
  color: #f5fffd;
}

.input-label {
  display: block;
  font-size: 0.84rem;
  color: var(--ink-1);
  margin-bottom: 0.45rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.input,
.select {
  width: 100%;
  border: 1px solid rgba(84, 74, 62, 0.28);
  border-radius: 10px;
  padding: 0.68rem 0.74rem;
  font: inherit;
  background: rgba(255, 255, 255, 0.88);
}

.input:focus,
.select:focus {
  outline: 3px solid rgba(13, 109, 108, 0.28);
  border-color: var(--accent);
}

.result-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.56rem;
}

.result-item {
  border: 1px solid rgba(84, 73, 57, 0.22);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 241, 232, 0.84));
}

.result-item button,
.result-item a {
  display: block;
  width: 100%;
  text-decoration: none;
  color: inherit;
  text-align: left;
  border: 0;
  background: none;
  padding: 0.74rem 0.82rem;
  cursor: pointer;
}

.result-item .lemma {
  font-weight: 800;
  font-size: 0.95rem;
  font-family: "Stamati Tranzitie", "Manrope", "Segoe UI", sans-serif;
}

.result-item .meta {
  margin-top: 0.22rem;
  font-size: 0.8rem;
  color: var(--ink-2);
}

.result-item .snippet {
  margin-top: 0.25rem;
  font-size: 0.83rem;
  color: var(--ink-1);
  font-family: "Stamati Tranzitie", "Manrope", "Segoe UI", sans-serif;
}

.result-item.active {
  outline: 2px solid rgba(13, 109, 108, 0.5);
  border-color: rgba(13, 109, 108, 0.5);
}

.result-list-compact .result-item button {
  padding: 0.68rem 0.72rem;
}

.site-footer {
  border-top: 1px solid rgba(80, 62, 40, 0.2);
  margin-top: 0.4rem;
  padding: 0.5rem 0;
  color: var(--ink-2);
  font-size: 0.85rem;
}

.dictionary-main {
  padding: 1.1rem 0 1.8rem;
}

.filters-surface {
  margin-bottom: 0.9rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.72rem;
  align-items: end;
}

.field-group {
  display: grid;
  gap: 0.34rem;
}

.field-group.field-query {
  position: relative;
}

.query-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.query-wrap .input {
  flex: 1 1 auto;
  padding-right: 2.4rem;
}

.vk-toggle {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--ink-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.vk-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
}

.vk-toggle[aria-expanded="true"] {
  background: rgba(0, 0, 0, 0.08);
  color: var(--ink);
}

.vk {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  margin-top: 4px;
  background: #fff;
  border: 1px solid rgba(84, 74, 62, 0.25);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
}

.vk[hidden] {
  display: none;
}

.vk-select {
  flex: 0 0 auto;
  font-size: 0.8rem;
  padding: 0.25rem 0.35rem;
  border: 1px solid rgba(84, 74, 62, 0.3);
  border-radius: 4px;
  background: #fafaf6;
  font-family: system-ui, sans-serif;
}

.vk-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  flex: 1 1 auto;
}

.vk-key {
  min-width: 1.6rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid rgba(84, 74, 62, 0.3);
  border-radius: 4px;
  background: #fafaf6;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  cursor: pointer;
  line-height: 1;
  color: var(--ink);
}

.vk-key:hover {
  background: #efe8d6;
}

.field-group span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-1);
}

.field-group.field-checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.5rem;
}

.field-group.field-checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.field-group.field-checkbox span {
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.field-group.field-checkboxes {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  align-self: center;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.checkbox-pill input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.checkbox-pill span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-1);
}

.advanced-zone {
  margin-top: 0.85rem;
  border: 1px dashed rgba(84, 74, 62, 0.35);
  border-radius: 12px;
  padding: 0.55rem 0.72rem;
  background: rgba(255, 255, 255, 0.56);
}

.advanced-zone summary {
  cursor: pointer;
  font-weight: 700;
}

.advanced-zone p {
  margin: 0.55rem 0 0;
  color: var(--ink-2);
}

.results-meta {
  margin-top: 0.62rem;
  font-size: 0.86rem;
  color: var(--ink-1);
}

.results-row {
  margin-top: 0.62rem;
  min-height: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
}
.results-row .results-meta {
  margin-top: 0;
  white-space: nowrap;
  min-width: 8rem;
  text-align: right;
}
.results-row .letter-bar {
  margin-top: 0;
  padding: 0;
  justify-content: center;
}

/* ── Letter bar ─────────────────────────────────────────── */
.letter-bar {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.4rem 0;
}
.letter-bar button {
  font: inherit;
  font-size: 0.88rem;
  min-width: 2rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink-1);
  cursor: pointer;
  transition: all 0.12s;
}
.letter-bar button:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.letter-bar button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.letter-bar button .letter-count {
  display: inline-block;
  font-size: 0.6rem;
  margin-left: 0.15rem;
  vertical-align: super;
  line-height: 1;
  opacity: 0.75;
}

.dictionary-layout {
  display: grid;
  grid-template-columns: 0.8fr 3.2fr;
  gap: 0.8rem;
  align-items: start;
}

.entry-right {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.entry-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.panel {
  border: 1px solid rgba(80, 62, 40, 0.2);
  border-radius: var(--radius-l);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
  overflow-y: auto;
}

.panel-results {
  max-height: 85vh;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(84, 73, 57, 0.14);
  padding: 0.95rem 1rem;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.95), rgba(246, 239, 229, 0.85));
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-action {
  padding: 0.44rem 0.78rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.panel > *:not(.panel-header) {
  padding-left: 1rem;
  padding-right: 1rem;
}

.placeholder {
  margin: 0.8rem 0;
  border: 1px dashed rgba(105, 95, 82, 0.42);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink-2);
  padding: 1rem;
  font-size: 0.88rem;
}

.entry-article {
  padding-top: 0.95rem;
  padding-bottom: 1rem;
}

.entry-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.entry-title {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.45rem;
}

.entry-id {
  font-size: 0.8rem;
  color: var(--ink-2);
  border: 1px solid rgba(111, 100, 84, 0.25);
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
}

.entry-meta {
  margin: 0.52rem 0;
  color: var(--ink-2);
  font-size: 0.84rem;
}

.entry-text {
  margin: 0.5rem 0 0.8rem;
  font-family: "Stamati Tranzitie", TimesNewRoman, "Times New Roman", Times, Baskerville, Georgia, serif;
  font-size: 2.0rem;
  line-height: 1.2;
  overflow-wrap: break-word;
  word-break: normal;
}

.entry-text .tei-letter-spacing {
  letter-spacing: 0.08em;
}

.entry-text .tei-bold {
  font-weight: 800;
}

.entry-text .tei-italic {
  font-style: italic;
}

.entry-sections {
  display: grid;
  gap: 0.64rem;
}

.entry-section {
  border: 1px solid rgba(84, 73, 57, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  padding: 0.62rem 0.7rem;
}

.entry-section h3 {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-1);
}

.entry-section ul {
  margin: 0.43rem 0 0;
  padding: 0 0 0 1.05rem;
  display: grid;
  gap: 0.31rem;
}

.entry-section li {
  font-size: 0.88rem;
}

.facs-stage {
  position: relative;
  margin: 0.8rem 0 0;
  border: 1px solid rgba(84, 73, 57, 0.2);
  border-radius: 12px;
  overflow: hidden;
  overflow-y: auto;
  background: #fff;
  max-height: 60vh;
  min-height: 18rem;
}

.facs-inner {
  position: relative;
  min-height: 18rem;
}

.facs-stage img {
  display: block;
  width: 100%;
  height: auto;
}

.zone-overlay {
  position: absolute;
  border: 3px solid var(--warning);
  background: rgba(255, 140, 76, 0.2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65) inset;
}

.zone-overlay.ai-estimate {
  border-style: dashed;
  border-color: #2a7a78;
  background: rgba(42, 122, 120, 0.18);
}

.zone-overlay .resize-handle {
  position: absolute;
  background: rgba(255, 140, 76, 0.85);
  border: 1px solid rgba(120, 60, 20, 0.85);
  z-index: 5;
  pointer-events: auto;
  touch-action: none;
}
.zone-overlay .resize-handle.top {
  left: 0;
  right: 0;
  top: -6px;
  height: 10px;
  cursor: ns-resize;
}
.zone-overlay .resize-handle.bottom {
  left: 0;
  right: 0;
  bottom: -6px;
  height: 10px;
  cursor: ns-resize;
}
.zone-overlay .resize-handle.left {
  top: 0;
  bottom: 0;
  left: -6px;
  width: 10px;
  cursor: ew-resize;
}
.zone-overlay .resize-handle.right {
  top: 0;
  bottom: 0;
  right: -6px;
  width: 10px;
  cursor: ew-resize;
}
.zone-overlay.ai-estimate .resize-handle {
  background: rgba(42, 122, 120, 0.85);
  border-color: rgba(15, 60, 60, 0.85);
}

.facs-caption {
  margin: 0.55rem 0 0.95rem;
  color: var(--ink-2);
  font-size: 0.84rem;
}

.facs-ai-status {
  margin: 0.7rem 0 0;
  color: var(--accent-ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.facs-ai-status.thinking::before {
  content: "● ";
  color: var(--accent);
  animation: pulse 1.2s infinite;
}

.facs-caption a {
  color: var(--accent);
  font-weight: 700;
}

.facs-zone-note {
  margin-left: 0.35rem;
  font-weight: 700;
  color: var(--accent-ink);
}

.loading-spinner {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  z-index: 40;
}

.loading-spinner.facsimile-loading {
  position: sticky;
  top: 50%;
  bottom: 50%;
  left: 0;
  right: 0;
  margin: 0;
  width: 100%;
  height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  z-index: 30;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.loading-spinner.facsimile-loading[hidden] {
  display: none;
}

.loading-spinner span {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner.facsimile-loading span {
  width: 4rem;
  height: 4rem;
  border-width: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.4rem;
  padding-bottom: 0.95rem;
}

.pager button {
  border: 1px solid rgba(84, 73, 57, 0.3);
  background: rgba(255, 255, 255, 0.84);
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  padding: 0.42rem 0.74rem;
  cursor: pointer;
}

.pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-content {
  padding-top: 1rem;
  padding-bottom: 1.4rem;
}

.prose {
  font-size: 0.98rem;
  line-height: 1.72;
}

.prose h1,
.prose h2,
.prose h3 {
  font-family: "Fraunces", serif;
}

.prose h1 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.prose h2 {
  margin-top: 1.2rem;
  margin-bottom: 0.35rem;
  font-size: 1.2rem;
}

.prose p {
  margin-top: 0;
  margin-bottom: 0.6rem;
  color: var(--ink-1);
}

.prose .lead {
  font-size: 1.05rem;
  color: var(--ink-1);
  margin-bottom: 1.1rem;
}

.prose ul,
.prose ol {
  margin-top: 0.2rem;
  margin-bottom: 0.8rem;
  padding-left: 1.4rem;
}

.prose li {
  margin-bottom: 0.25rem;
}

.prose .toc {
  background: var(--accent-soft, #f5f0e3);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 1rem 0.7rem 1rem;
  margin: 0.6rem 0 1.4rem;
  font-size: 0.95rem;
}

.prose .toc strong {
  display: block;
  margin-bottom: 0.3rem;
}

.prose .toc ol {
  margin: 0;
  padding-left: 1.2rem;
}

.prose .toc ol ol {
  margin-top: 0.15rem;
  margin-bottom: 0.25rem;
}

.prose .kbd-key {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.35em;
  font-family: "Stamati Tranzitie", "Times New Roman", Times, serif;
  font-size: 1em;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  line-height: 1.4;
}

.prose .guide-figure {
  margin: 0.6rem 0 1.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafaf6;
  padding: 0.6rem 0.6rem 0.4rem;
}

.prose .guide-figure-placeholder {
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-2);
  font-style: italic;
  font-size: 0.92rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 1.2rem 1rem;
}

.prose .guide-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
}

.prose .guide-figure figcaption {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  color: var(--ink-2);
  text-align: center;
}

.prose .facs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0.6rem 0 1.4rem;
}

.prose .facs-thumb {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.prose .facs-thumb a {
  display: block;
  width: 100%;
}

.prose .facs-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.prose .facs-thumb figcaption {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.studiu-cols {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.6rem;
  align-items: start;
}

.studiu-col-left {
  max-width: 100%;
}

.studiu-col-right {
  justify-self: center;
}

.studiu-col > h2:first-child {
  margin-top: 0;
}

@media (max-width: 900px) {
  .studiu-cols {
    grid-template-columns: 1fr;
  }
}

.prefata-preview {
  margin: 0.6rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafaf6;
  padding: 0.5rem 0.9rem;
}

.prefata-preview > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.2rem 0;
}

.prefata-preview[open] > summary {
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.prefata-preview-content {
  font-size: 0.95rem;
  line-height: 1.6;
  max-height: 60vh;
  overflow: auto;
  padding: 0.4rem 0.2rem;
}

.prefata-preview-content p {
  margin: 0 0 0.6rem;
}

.prefata-preview-content h1,
.prefata-preview-content h2,
.prefata-preview-content h3 {
  font-family: "Fraunces", serif;
  margin: 0.8rem 0 0.4rem;
}

.prefata-preview-loading,
.prefata-preview-error {
  color: var(--ink-2);
  font-style: italic;
}

.abbrev-table {
  border-collapse: collapse;
  margin: 0.4rem 0 1rem;
  font-size: 0.95rem;
}
.abbrev-table caption {
  text-align: left;
  color: var(--ink-2);
  padding-bottom: 0.75rem;
  line-height: 1.5;
}
.abbrev-table th,
.abbrev-table td {
  border: 1px solid var(--line);
  padding: 0.32rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.abbrev-table th {
  background: var(--accent-soft, #f1ede4);
  font-weight: 600;
}
.abbrev-table td:first-child {
  font-family: "Stamati Tranzitie", "Times New Roman", Times, serif;
  white-space: nowrap;
  font-style: italic;
}

@media (max-width: 1240px) {
  .filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dictionary-layout {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 0;
  }
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-shell {
    width: min(1280px, calc(100vw - 1.5rem));
  }

  .nav-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.7rem 0;
  }

  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Homepage search hero ─────────────────────────────────── */
.search-hero {
  padding: 3.5rem 0 2.5rem;
  text-align: center;
}

.search-hero-title {
  margin: 0.45rem 0 0.6rem;
  font-family: "Fraunces", serif;
  font-size: clamp(1.42rem, 2.73vw, 2.05rem);
  font-weight: 600;
  line-height: 1.2;
}

.search-hero-sub {
  margin: 0 0 1.8rem;
  color: var(--ink-1);
  font-family: "Fraunces", serif;
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-weight: 500;
  line-height: 1.25;
}

.search-box {
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
}

.search-box .script-toggle {
  margin-bottom: 0.5rem;
}

.search-box .input {
  width: 100%;
  font-size: 1rem;
  padding: 0.78rem 1rem;
  border-radius: 12px;
}

.search-box .result-list {
  margin-top: 0.5rem;
}

.search-hero-actions {
  margin-top: 1.6rem;
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ── Homepage content ─────────────────────────────────────── */
.home-content {
  padding-bottom: 0.4rem;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.home-grid .surface p {
  margin: 0 0 0.65rem;
  color: var(--ink-1);
  line-height: 1.65;
}

.method-list {
  margin: 0.5rem 0 0.7rem;
  padding-left: 1.4rem;
  color: var(--ink-1);
  line-height: 1.75;
}

.method-list li {
  margin-bottom: 0.3rem;
}

.team-surface {
  margin-bottom: 0;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.2rem;
  margin-top: 1rem;
}

.team-group {
  border-left: 3px solid var(--accent-soft);
  padding-left: 0.8rem;
}

.team-inst {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  color: var(--ink-2);
  font-weight: 600;
  line-height: 1.4;
}

.team-names {
  margin: 0;
  font-size: 0.9rem;
}

.team-inst-extra {
  margin-top: 0.7rem;
}

.stats-surface {
  margin-bottom: 0;
}

.stats-surface .stats-grid {
  margin-top: 0.8rem;
}

@media (max-width: 760px) {
  .home-grid {
    grid-template-columns: 1fr;
  }

  .search-hero {
    padding: 2.2rem 0 1.8rem;
  }
}

/* ── Corrections page ─────────────────────────────────────── */
.corrections-main {
  padding: 2rem 0 3rem;
}

.corrections-header {
  margin-bottom: 1.8rem;
}

.corrections-title {
  margin: 0 0 0.5rem;
  font-family: "Fraunces", serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.corrections-desc {
  margin: 0 0 0.4rem;
  color: var(--ink-1);
  max-width: 72ch;
  line-height: 1.65;
}

.corrections-list {
  display: grid;
  gap: 1rem;
}

.correction-entry {
  border: 1px solid rgba(80, 62, 40, 0.18);
  border-radius: var(--radius-m);
  background: var(--card);
  padding: 0.9rem 1.1rem 0.75rem;
}

.correction-entry-header {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.correction-lemma {
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--accent-ink);
}

.correction-lemma:hover {
  text-decoration: underline;
}

.correction-meta {
  font-size: 0.8rem;
  color: var(--ink-2);
}

.correction-text {
  margin: 0 0 0.65rem;
  font-size: 0.96rem;
  line-height: 1.6;
  color: var(--ink-0);
}

.correction-text sup {
  color: var(--warning);
  font-size: 0.7em;
  font-weight: 800;
}

.fnote-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(84, 73, 57, 0.14);
  padding-top: 0.45rem;
  display: grid;
  gap: 0.2rem;
}

.fnote-item {
  font-size: 0.82rem;
  color: var(--ink-1);
  line-height: 1.5;
}

.fnote-item sup {
  color: var(--warning);
  font-weight: 800;
  margin-right: 0.2em;
}

/* ── Footnote superscript button ─────────────────────────── */
.fnote-sup {
  color: var(--warning);
  font-size: 0.7em;
  font-weight: 800;
  cursor: pointer;
  border-radius: 3px;
  padding: 0 1px;
  transition: background 120ms;
  outline-offset: 1px;
}

.fnote-sup:hover,
.fnote-sup:focus-visible {
  background: rgba(155, 74, 47, 0.12);
  outline: 2px solid rgba(155, 74, 47, 0.4);
}

/* ── Inline correction marker (corr text wrapped) ───────── */
.fnote-mark {
  position: relative;
  cursor: help;
  text-decoration: none;
  outline-offset: 1px;
  border-radius: 2px;
  transition: background 120ms;
}

.fnote-mark::before,
.fnote-word::before {
  content: "";
  position: absolute;
  top: -0.8em;
  left: 50%;
  transform: translateX(-50%);
  width: 0.82em;
  height: 0.82em;
  background-color: currentColor;
  mask: url("../icons/cloud-lightning.svg") center / contain no-repeat;
  color: var(--accent-ink);
}

.fnote-mark:hover,
.fnote-mark:focus-visible {
  background: rgba(155, 74, 47, 0.08);
  outline: none;
}

.fnote-mark:hover::before,
.fnote-mark:focus-visible::before {
  color: rgba(155, 74, 47, 0.85);
}

/* Word-level correction wrapper produced at runtime from grouped marks. */
.fnote-word {
  position: relative;
  cursor: help;
  outline-offset: 1px;
  border-radius: 2px;
  transition: background 120ms;
}

.fnote-word:hover,
.fnote-word:focus-visible {
  background: rgba(155, 74, 47, 0.08);
  outline: none;
}

.fnote-word:hover::before,
.fnote-word:focus-visible::before {
  color: rgba(155, 74, 47, 0.85);
}

/* Zero-width deletion markers emitted by build_data.py — never visible. */
.fnote-del {
  display: none;
}

/* Bare <sic> deletion: tiny middle-dot marker, intentionally discreet */
.fnote-mark-del {
  display: inline-block;
  color: rgba(84, 73, 57, 0.45);
  font-size: 0.75em;
  line-height: 1;
  vertical-align: 0.15em;
  margin: 0 1px;
  text-decoration: none;
}

.fnote-mark-del:hover,
.fnote-mark-del:focus-visible {
  color: rgba(155, 74, 47, 0.85);
  background: rgba(155, 74, 47, 0.08);
  text-decoration: none;
}

/* ── Popup ───────────────────────────────────────────────── */
.fnote-popup {
  position: absolute;
  z-index: 200;
  max-width: 360px;
  background: rgba(255, 252, 246, 0.98);
  border: 1px solid rgba(80, 62, 40, 0.18);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(40, 28, 12, 0.12);
  padding: 0.5rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-family: "Stamati Tranzitie", TimesNewRoman, "Times New Roman", Times, Baskerville, Georgia, serif;
  font-size: 1.6rem;
  line-height: 1.3;
  color: var(--ink-1);
  pointer-events: none;
}

.fnote-popup[hidden] {
  display: none;
}

.fnote-popup-word {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

.fnote-popup-row {
  display: block;
}

.fnote-popup-arrow {
  display: block;
  color: var(--ink-2);
  font-size: 0.8rem;
  text-align: center;
}

.fnote-popup-sub {
  color: var(--ink-2);
  font-size: 0.82em;
}

.fnote-popup-del,
.fnote-del {
  color: var(--ink-2);
  font-style: italic;
}


.brand-lockup .logo {
  display: inline-flex;
  flex: 0 0 56px;
  align-items: center;
}
.brand-lockup .logo img {
  height: 56px;
  width: 56px;
  object-fit: contain;
  display: block;
  background: #ffffff;
  padding: 4px;
  border-radius: 3px;
}

.correction-example {
  padding-block: 0.8rem;
  font-family: "Stamati Tranzitie", "Times New Roman", serif;
  font-size: 1.5rem;
}
