/* ============================================================
   Cinci limbi, trei tipare, zero strămoș comun
   Design tokens derived from a random seed string:
   ddb5ce44ea7c401800576a3a753ce06cf68e1c13cbd1e921f171abc0993e7fc6
   split into 5 chunks (one per language); each chunk's magnitude
   ranks the language into a golden-angle hue sequence seeded by
   the string's first byte (221 -> blue-violet). The five resulting
   hues are used nowhere but to *identify* a language, never as a
   full-bleed background — the argument is carried by ink, not color.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,340..500;0,9..144,600..700;1,9..144,400..560&family=Inter:wght@400;500;600;700&family=Noto+Serif:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
  color-scheme: light;

  --bg-page: #f7f3ee;
  --bg-raised: #fffdfa;
  --bg-sunken: #ede6db;
  --fg: #1c1620;
  --fg-soft: #5c5460;
  --fg-faint: #8a8290;
  --line: rgba(28, 22, 32, 0.14);
  --line-strong: rgba(28, 22, 32, 0.30);
  --shadow: rgba(40, 26, 16, 0.14);

  --lang-ro: #9545d3;
  --lang-ro-solid: #782fb1;
  --lang-ro-tint: #f3ebfa;
  --lang-rup: #cf3034;
  --lang-rup-solid: #b12f32;
  --lang-rup-tint: #faebeb;
  --lang-bg: #1e8038;
  --lang-bg-solid: #2fb152;
  --lang-bg-tint: #ebfaef;
  --lang-sq: #3969d0;
  --lang-sq-solid: #2f58b1;
  --lang-sq-tint: #ebeffa;
  --lang-el: #7c6e1d;
  --lang-el-solid: #b19e2f;
  --lang-el-tint: #faf8eb;

  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --specimen: "Noto Serif", "Fraunces", Georgia, serif;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --container: 920px;
  --wide: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-page: #171018;
    --bg-raised: #1f1620;
    --bg-sunken: #0f0a10;
    --fg: #f3ecf5;
    --fg-soft: #c3b9c6;
    --fg-faint: #8f8590;
    --line: rgba(243, 236, 245, 0.14);
    --line-strong: rgba(243, 236, 245, 0.28);
    --shadow: rgba(0, 0, 0, 0.45);

    --lang-ro: #a061d1;
    --lang-ro-solid: #9a5ec9;
    --lang-ro-tint: #301e3e;
    --lang-rup: #ce5558;
    --lang-rup-solid: #c95e61;
    --lang-rup-tint: #3e1e1f;
    --lang-bg: #39c65f;
    --lang-bg-solid: #5ec97b;
    --lang-bg-tint: #1e3e26;
    --lang-sq: #557bce;
    --lang-sq-solid: #5e80c9;
    --lang-sq-tint: #1e283e;
    --lang-el: #c6b139;
    --lang-el-solid: #c9b95e;
    --lang-el-tint: #3e391e;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #171018;
  --bg-raised: #1f1620;
  --bg-sunken: #0f0a10;
  --fg: #f3ecf5;
  --fg-soft: #c3b9c6;
  --fg-faint: #8f8590;
  --line: rgba(243, 236, 245, 0.14);
  --line-strong: rgba(243, 236, 245, 0.28);
  --shadow: rgba(0, 0, 0, 0.45);

  --lang-ro: #a061d1;
  --lang-ro-solid: #9a5ec9;
  --lang-ro-tint: #301e3e;
  --lang-rup: #ce5558;
  --lang-rup-solid: #c95e61;
  --lang-rup-tint: #3e1e1f;
  --lang-bg: #39c65f;
  --lang-bg-solid: #5ec97b;
  --lang-bg-tint: #1e3e26;
  --lang-sq: #557bce;
  --lang-sq-solid: #5e80c9;
  --lang-sq-tint: #1e283e;
  --lang-el: #c6b139;
  --lang-el-solid: #c9b95e;
  --lang-el-tint: #3e391e;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--fg);
  color: var(--bg-page);
  padding: 0.75em 1.2em;
  border-radius: 0 0 var(--radius-s) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--lang-ro);
  outline-offset: 3px;
}

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}
.wrap-wide {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  max-width: var(--wide);
  margin: 0 auto;
  font-family: var(--sans);
  font-size: 14px;
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.langswitch {
  display: flex;
  gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px;
}
.langswitch a {
  padding: 5px 13px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  color: var(--fg-soft);
}
.langswitch a[aria-current="true"] {
  background: var(--fg);
  color: var(--bg-page);
}

/* ---------- hero ---------- */

.hero {
  padding: 30px 0 56px;
}
.hero .kicker {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--lang-ro);
  margin: 0 0 18px;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.1rem, 5.6vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
}
.hero .deck {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  color: var(--fg-soft);
  max-width: 46em;
  margin: 0 0 28px;
}
.hero .lede {
  max-width: 42em;
  font-size: 1.06rem;
}
.hero .lede p { margin: 0 0 1em; }
.hero .lede strong { font-weight: 700; }

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-raised);
  border: 1px solid var(--line);
}
.badge .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

/* ---------- hero proof strip ---------- */

.proof-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}
.proof-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 16px 10px;
  border-radius: var(--radius-m);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-top: 3px solid var(--card-accent, var(--lang-ro-solid));
}
.proof-item .p-form {
  font-family: var(--specimen);
  font-size: 1.05rem;
  color: var(--fg);
}
.proof-item .p-lang {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* ---------- section scaffolding ---------- */

section { padding: 56px 0; }
section + section { border-top: 1px solid var(--line); }

.section-head { max-width: 42em; margin: 0 0 32px; }
.section-head .eyebrow {
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 0 0 10px;
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  line-height: 1.18;
  margin: 0 0 14px;
}
.section-head p { color: var(--fg-soft); margin: 0; }

.prose { max-width: 42em; }
.prose p { margin: 0 0 1.1em; }
.prose h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 1.6em 0 0.6em;
}
.prose blockquote {
  margin: 1.4em 0;
  padding: 0 0 0 1.1em;
  border-left: 3px solid var(--lang-ro);
  font-style: italic;
  color: var(--fg-soft);
}
.cap {
  font-size: 0.86rem;
  color: var(--fg-faint);
  margin-top: 0.4em;
}

/* ---------- language legend ---------- */

.lang-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 30px;
  font-size: 13.5px;
}
.lang-legend .item { display: flex; align-items: center; gap: 7px; }
.lang-legend .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* ============================================================
   Network diagram: contact map vs. family tree
   ============================================================ */

.duo {
  display: grid;
  grid-template-columns: 1fr;
  gap: 34px;
}
@media (min-width: 880px) {
  .duo { grid-template-columns: 1.3fr 1fr; align-items: start; }
}

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 22px 20px 26px;
}
.panel h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0 0 4px;
}
.panel .sub { font-size: 13.5px; color: var(--fg-soft); margin: 0 0 14px; }

.mech-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.mech-tab {
  font: inherit;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg-soft);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mech-tab:hover { border-color: var(--lang-ro); }
.mech-tab[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg-page);
  border-color: var(--fg);
}

#network-svg { width: 100%; height: auto; display: block; }
.net-node circle.core {
  stroke: var(--bg-raised);
  stroke-width: 3;
  transition: fill 0.25s, opacity 0.25s;
}
.net-node.no circle.core {
  fill: transparent !important;
  stroke: var(--line-strong);
  stroke-width: 2;
}
.net-node.partial circle.core { opacity: 0.55; }
.net-node text.label {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12.5px;
  fill: var(--fg);
}
.net-node text.sub {
  font-family: var(--sans);
  font-size: 10.5px;
  fill: var(--fg-faint);
}
.net-edge {
  stroke-width: 1.6;
  fill: none;
  opacity: 0.55;
  transition: opacity 0.25s, stroke 0.25s;
}
.net-node { cursor: pointer; }
.net-node:hover circle.core { stroke: var(--lang-ro); }

.net-caption {
  margin-top: 14px;
  font-size: 13px;
  color: var(--fg-soft);
  min-height: 2.6em;
}

.tree-svg { width: 100%; height: auto; display: block; }
.tree-svg text { font-family: var(--sans); }
.tree-svg .fam-label { font-size: 11px; font-weight: 700; fill: var(--fg-faint); letter-spacing: 0.04em; }
.tree-svg .lang-label { font-size: 12.5px; font-weight: 700; }
.tree-svg .branch { fill: none; stroke: var(--line-strong); stroke-width: 1.6; }
.tree-svg .trunk { fill: none; stroke: var(--line-strong); stroke-width: 1.6; stroke-dasharray: 3 4; }

/* ---------- feature deep-dive cards ---------- */

.feature-block { padding: 40px 0; }
.feature-block + .feature-block { border-top: 1px dashed var(--line); }
.feature-num {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-faint);
}
.feature-block h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  margin: 4px 0 14px;
}
.feature-explain { max-width: 42em; color: var(--fg-soft); margin: 0 0 26px; }

.spec-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 700px) {
  .spec-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1080px) {
  .spec-grid { grid-template-columns: repeat(3, 1fr); }
}

.spec-card {
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
  background: var(--bg-raised);
  padding: 18px 18px 20px;
  border-top: 4px solid var(--card-accent, var(--lang-ro));
}
.spec-card.is-absent { opacity: 0.86; }
.spec-card .who {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.spec-card .who h4 {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}
.spec-card .status {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.spec-card .status.yes { color: var(--card-accent, var(--lang-ro)); }
.spec-card .status.near { color: var(--card-accent, var(--lang-ro)); opacity: 0.7; }

.specimen {
  font-family: var(--specimen);
  font-size: 1.28rem;
  line-height: 1.3;
  margin: 0 0 8px;
  word-break: normal;
  overflow-wrap: anywhere;
}
.gloss {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  margin: 0 0 10px;
}
.gloss .g-word {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.gloss .g-form {
  font-family: var(--specimen);
  font-size: 13.5px;
  color: var(--fg-soft);
  font-style: normal;
}
.gloss .g-tag {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.translation {
  font-size: 14px;
  color: var(--fg-soft);
  margin: 0 0 10px;
}
.etym {
  font-size: 12.5px;
  color: var(--fg-faint);
  border-top: 1px dotted var(--line);
  padding-top: 9px;
  margin: 0;
}

/* ---------- history / narrative ---------- */

.timeline {
  border-left: 2px solid var(--line-strong);
  margin: 0;
  padding: 0 0 0 22px;
  list-style: none;
}
.timeline li { position: relative; padding-bottom: 26px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--lang-ro);
}
.timeline .when {
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.timeline p { margin: 4px 0 0; max-width: 40em; }

.history-figure {
  margin: 34px 0 0;
  max-width: 46em;
}
.history-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
}
.history-figure figcaption {
  font-size: 12.5px;
  color: var(--fg-faint);
  margin-top: 9px;
  max-width: 42em;
}

.source-figure {
  margin-top: 22px;
  width: 140px;
}
.source-figure img {
  width: 140px;
  height: auto;
  display: block;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
}
.source-figure figcaption {
  font-size: 12px;
  color: var(--fg-faint);
  margin-top: 8px;
}

/* ---------- beyond-the-three matrix ---------- */

.matrix-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.matrix {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 14px;
}
table.matrix th, table.matrix td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.matrix thead th {
  font-family: var(--sans);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-faint);
  border-bottom: 2px solid var(--line-strong);
}
table.matrix tbody th {
  font-family: var(--serif);
  font-weight: 600;
  white-space: nowrap;
}
.mval { font-weight: 700; }
.mval.y { color: var(--lang-bg); }
.mval.n { color: var(--fg-faint); font-weight: 400; }
.mval.p { color: var(--lang-el); }

.matrix-note {
  margin: 22px 0 0;
  max-width: 42em;
  font-size: 14px;
  color: var(--fg-soft);
}

/* ---------- method / sources ---------- */

.method-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}
.method-list li {
  padding-left: 22px;
  position: relative;
  font-size: 14.5px;
  color: var(--fg-soft);
}
.method-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--fg-faint);
}
.method-list strong { color: var(--fg); }

/* ---------- footer ---------- */

footer {
  padding: 40px 0 60px;
  font-size: 13.5px;
  color: var(--fg-faint);
}
footer a { color: var(--fg-soft); }
.back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  font-weight: 600;
  color: var(--fg-soft);
  text-decoration: none;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.js-hidden { display: none; }
noscript .noscript-note {
  display: block;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 24px;
}
