@import "/assets/fonts/faces.css";

/* Paleta a trecut prin validatorul din skill-ul dataviz. Accentul și al doilea
   accent sunt singura pereche categorială de pe pagină (vorbit față de scris) și
   trec toate probele în ambele moduri. Straturile nu sunt colorate pe identitate:
   grosimea benzii duce cifra, iar eticheta duce numele. */
:root {
  color-scheme: light;
  --paper: #f7f4ee;
  --raised: #fffdf8;
  --sunk: #efeae0;
  --ink: #1a1712;
  --ink-2: #574f43;
  --ink-3: #6d6555;
  --rule: #ddd6c8;
  --rule-2: #cbc2b0;
  --accent: #2a5ea8;
  --accent-soft: #dbe6f5;
  --accent-2: #b4531f;
  --accent-2-soft: #f4e2d5;
  --sed-1: #c9b18a;
  --sed-2: #bda87f;
  --sed-3: #b19d75;
  --sed-4: #a5926c;
  --serif: "Straturi Serif", Charter, "Iowan Old Style", Georgia, serif;
  --sans: "Straturi Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 34rem;
  --wide: 60rem;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --paper: #191713;
    --raised: #221f19;
    --sunk: #12100d;
    --ink: #f4f0e6;
    --ink-2: #b7ae9d;
    --ink-3: #8f8676;
    --rule: #35302a;
    --rule-2: #443d34;
    --accent: #4f8ede;
    --accent-soft: #1e2a3b;
    --accent-2: #d66c34;
    --accent-2-soft: #33231a;
    --sed-1: #7d6c52;
    --sed-2: #726249;
    --sed-3: #675841;
    --sed-4: #5c4e3a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #191713;
  --raised: #221f19;
  --sunk: #12100d;
  --ink: #f4f0e6;
  --ink-2: #b7ae9d;
  --ink-3: #8f8676;
  --rule: #35302a;
  --rule-2: #443d34;
  --accent: #4f8ede;
  --accent-soft: #1e2a3b;
  --accent-2: #d66c34;
  --accent-2-soft: #33231a;
  --sed-1: #7d6c52;
  --sed-2: #726249;
  --sed-3: #675841;
  --sed-4: #5c4e3a;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--serif);
  font-feature-settings: "kern" 1, "liga" 1;
  overflow-x: hidden;
}
h1, h2, h3, h4 { line-height: 1.2; font-weight: 600; margin: 0; text-wrap: balance; }
p { margin: 0 0 1.05em; }
a { color: inherit; text-decoration-color: var(--rule-2); text-underline-offset: .18em; }
a:hover { text-decoration-color: var(--accent); }
button { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--raised);
  padding: .6rem 1rem; z-index: 40; border: 1px solid var(--rule);
}
.skip:focus { left: .5rem; top: .5rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.top-target { position: absolute; inset: 0 auto auto 0; width: 1px; height: 1px; }

/* ——— cadru ——— */
.masthead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem 1.5rem; flex-wrap: wrap;
  padding: 1.1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
}
.wordmark {
  font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em;
  text-decoration: none;
}
.masthead nav { display: flex; gap: 1.15rem; font: 400 .875rem/1 var(--sans); }
.masthead nav a { text-decoration: none; color: var(--ink-2); }
.masthead nav a:hover { color: var(--ink); }
.masthead nav .lang { color: var(--accent); }

main { display: block; }
section { padding: 0 clamp(1rem, 4vw, 2.5rem); }
.prose { max-width: var(--measure); margin: 0 auto; padding-top: 3.4rem; }
.prose.wide { max-width: var(--wide); }
.prose.narrow { max-width: 33rem; padding-bottom: 3rem; }
.prose h2 {
  font-size: 1.45rem; margin: 0 0 .85rem; letter-spacing: -.012em;
}
.prose.wide h2, .prose.wide > p { max-width: var(--measure); }
.prose h2 + p { margin-top: 0; }

/* ——— deschidere ——— */
.hero {
  max-width: var(--measure); margin: 0 auto;
  padding-top: clamp(2.6rem, 8vw, 5rem);
}
.kicker {
  font: 500 .7rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 1.1rem;
}
.hero h1 {
  font-size: clamp(2.3rem, 7.5vw, 3.6rem); letter-spacing: -.028em; margin: 0 0 .5rem;
}
.tagline {
  font-size: 1.2rem; color: var(--ink-2); font-style: italic; margin: 0 0 1.5rem;
}
.lede { font-size: 1.115rem; }

/* ——— căutarea ——— */
.lookup {
  max-width: var(--wide); margin: 2.2rem auto 0; scroll-margin-top: 5rem;
}
.searchbox { position: relative; max-width: var(--measure); margin: 0 auto; }
.searchbox label {
  display: block; font: 500 .72rem/1 var(--sans); letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: .5rem;
}
.field { display: flex; gap: .5rem; align-items: stretch; }
.field input {
  flex: 1; min-width: 0;
  font: 400 1.3rem/1.3 var(--serif); color: var(--ink);
  background: var(--raised); border: 1px solid var(--rule-2); border-radius: 3px;
  padding: .72rem .85rem; -webkit-appearance: none; appearance: none;
}
.field input::placeholder { color: var(--ink-3); font-style: italic; }
.field input:focus { border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft); }
.dice {
  flex: 0 0 auto; width: 3rem; border: 1px solid var(--rule-2); border-radius: 3px;
  background: var(--raised); cursor: pointer; font-size: 1.15rem; color: var(--ink-2);
  line-height: 1;
}
.dice:hover { color: var(--accent); border-color: var(--accent); }
.hint { font: 400 .82rem/1.5 var(--sans); color: var(--ink-3); margin: .55rem 0 0; }

.ac {
  position: absolute; z-index: 15; left: 0; right: 3.5rem; top: 100%;
  margin: .3rem 0 0; padding: .25rem; list-style: none;
  background: var(--raised); border: 1px solid var(--rule-2); border-radius: 3px;
  box-shadow: 0 10px 30px -12px rgb(0 0 0 / .28); max-height: 17rem; overflow-y: auto;
}
.ac li {
  padding: .4rem .6rem; cursor: pointer; border-radius: 2px;
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
}
.ac li[aria-selected="true"], .ac li:hover { background: var(--accent-soft); }
.ac .w { font-size: 1.02rem; }
.ac .s { font: 400 .74rem/1 var(--sans); color: var(--ink-3); }

/* ——— fișa cuvântului ——— */
.result:empty { min-height: 0; }
.card {
  margin: 1.9rem auto 0; max-width: var(--wide);
  background: var(--raised); border: 1px solid var(--rule);
  border-radius: 4px; overflow: hidden;
}
.card-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem;
  padding: 1.35rem clamp(1rem, 3vw, 1.75rem) 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.card-head h2 {
  font-size: clamp(1.9rem, 5.5vw, 2.6rem); letter-spacing: -.026em; margin: 0;
}
.card-head .pos {
  font: 400 .82rem/1 var(--sans); color: var(--ink-3); font-style: normal;
}
.card-head .gloss { color: var(--ink-2); font-style: italic; flex: 1 1 100%; margin: 0; }
.card-body {
  display: grid; gap: 0; grid-template-columns: 1fr;
}
@media (min-width: 46rem) {
  .card-body { grid-template-columns: 1.05fr 1fr; }
  .card-body > .cell:nth-child(odd) { border-right: 1px solid var(--rule); }
}
.cell { padding: 1.15rem clamp(1rem, 3vw, 1.75rem); border-bottom: 1px solid var(--rule); }
.cell:last-child, .cell:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
.cell h3 {
  font: 500 .7rem/1 var(--sans); letter-spacing: .11em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 .7rem;
}
.stratum-name { font-size: 1.32rem; margin: 0 0 .1rem; }
.stratum-when { font: 400 .84rem/1.5 var(--sans); color: var(--ink-2); margin: 0 0 .55rem; }
.stratum-note { font-size: .95rem; color: var(--ink-2); margin: 0; }
.flag {
  display: inline-block; font: 400 .74rem/1.35 var(--sans);
  background: var(--sunk); border: 1px solid var(--rule); border-radius: 2px;
  padding: .18rem .45rem; margin: .45rem .3rem 0 0; color: var(--ink-2);
}

.chain { list-style: none; margin: 0; padding: 0; }
.chain li { position: relative; padding: 0 0 .62rem 1.15rem; }
.chain li::before {
  content: ""; position: absolute; left: .27rem; top: .52rem;
  width: 5px; height: 5px; border-radius: 50%; background: var(--rule-2);
}
.chain li:not(:last-child)::after {
  content: ""; position: absolute; left: calc(.27rem + 2px); top: 1.05rem; bottom: 0;
  border-left: 1px solid var(--rule);
}
.chain .k { font: 400 .78rem/1 var(--sans); color: var(--ink-3); }
.chain .l { font-weight: 600; }
.chain .e { font-style: italic; }
.chain .tr { color: var(--ink-2); font-size: .92rem; }

.freqs { display: flex; flex-wrap: wrap; gap: .35rem 1.6rem; margin: 0 0 .3rem; }
.freqs div { min-width: 5rem; }
.freqs dt { font: 400 .74rem/1.4 var(--sans); color: var(--ink-3); }
.freqs dd { margin: 0; font-size: 1.16rem; font-variant-numeric: tabular-nums; }
.freqs dd small { font-size: .68rem; color: var(--ink-3); font-family: var(--sans); }
.reg-verdict { font-size: .95rem; color: var(--ink-2); margin: .5rem 0 0; }
.reg-verdict b { color: var(--ink); font-weight: 600; }

.spark { width: 100%; height: auto; display: block; margin: .1rem 0 .35rem; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.spark .band { fill: var(--sed-2); opacity: .3; }
.spark .dot { fill: var(--accent); }
.spark .now { fill: var(--accent-2); }
.spark .axis { stroke: var(--rule-2); stroke-width: 1; }
.spark .gap { stroke: var(--rule-2); stroke-width: 1; stroke-dasharray: 2 3; }
.spark text { font: 400 8.5px/1 var(--sans); fill: var(--ink-3); }
.curve-note { font: 400 .8rem/1.5 var(--sans); color: var(--ink-3); margin: .35rem 0 0; }

.miss { max-width: var(--measure); margin: 1.9rem auto 0; }
.miss p { margin: 0 0 .5rem; }
.miss .sug { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }

.chip {
  font: 400 .88rem/1 var(--serif); background: var(--sunk); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 2px; padding: .3rem .5rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ——— coloana stratigrafică ——— */
.column-figure { margin: 1.6rem 0 0; }
.col-controls {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem;
}
.col-controls button {
  font: 400 .82rem/1 var(--sans); background: var(--raised); color: var(--ink-2);
  border: 1px solid var(--rule-2); border-radius: 2px; padding: .42rem .68rem;
  cursor: pointer;
}
.col-controls button.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.column-wrap {
  display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; align-items: start;
}
.column {
  display: flex; flex-direction: column; gap: 2px;
  height: 30rem;
  border: 1px solid var(--rule-2); border-radius: 3px; padding: 2px;
  background: var(--rule);
}
/* Banda poartă doar proporția. Numele stă în legendă, ca stratul de trei zecimi
   de procent să rămână o dungă adevărată și nu una umflată ca să încapă textul. */
.band {
  --h: 5;
  flex: var(--h) 1 0;
  min-height: 3px;
  background: var(--sed-2);
  transition: flex-grow .5s cubic-bezier(.4, 0, .2, 1);
}
.col-legend {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 2px; height: 30rem;
}
.leg {
  flex: 1 1 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 .55rem; border-left: 3px solid var(--sed-2);
  background: var(--sunk); border-radius: 0 2px 2px 0;
  overflow: hidden;
}
.leg-name { font: 500 .84rem/1 var(--sans); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.leg-val { font: 400 .78rem/1 var(--sans); font-variant-numeric: tabular-nums;
  color: var(--ink-2); white-space: nowrap; }
.leg.lit { background: var(--accent-soft); border-left-color: var(--accent); }
.leg.lit .leg-name { color: var(--ink); }
@media (max-width: 34rem) {
  .column-wrap { grid-template-columns: 3rem 1fr; gap: .6rem; }
  .leg-name { font-size: .76rem; }
}
.band:nth-child(4n+1), .leg:nth-child(4n+1) { --sed: var(--sed-1); }
.band:nth-child(4n+2), .leg:nth-child(4n+2) { --sed: var(--sed-2); }
.band:nth-child(4n+3), .leg:nth-child(4n+3) { --sed: var(--sed-3); }
.band:nth-child(4n),   .leg:nth-child(4n)   { --sed: var(--sed-4); }
.band { background: var(--sed, var(--sed-2)); }
.leg { border-left-color: var(--sed, var(--sed-2)); }
.band.lit { background: var(--accent); }
.column-figure figcaption {
  font: 400 .84rem/1.55 var(--sans); color: var(--ink-3); margin-top: .8rem;
  max-width: var(--measure);
}

/* ——— graficul vorbit/scris ——— */
.reg-figure { margin: 1.5rem 0 0; }
.reg-legend {
  display: flex; gap: 1.3rem; font: 400 .8rem/1 var(--sans); color: var(--ink-2);
  margin-bottom: .8rem; flex-wrap: wrap;
}
.reg-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.sw { width: .7rem; height: .7rem; border-radius: 2px; display: inline-block; }
.sw.sp { background: var(--accent-2); }
.sw.wr { background: var(--accent); }
.rchart { display: grid; gap: 3px; }
.rrow { display: grid; grid-template-columns: 8.6rem 1fr; align-items: center; gap: .5rem; }
.rlabel { font: 400 .82rem/1.3 var(--sans); color: var(--ink-2); text-align: right; }
.rtrack { position: relative; height: 1.15rem; background: var(--sunk); border-radius: 2px; }
.rzero { position: absolute; left: 50%; top: -1px; bottom: -1px; width: 1px;
  background: var(--rule-2); }
.rbar { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; }
.rbar.sp { background: var(--accent-2); }
.rbar.wr { background: var(--accent); }
.rnum { position: absolute; top: 50%; transform: translateY(-50%);
  font: 400 .72rem/1 var(--sans); color: var(--ink-2);
  font-variant-numeric: tabular-nums; }
.rnum.right { left: calc(50% + .35rem); }
.rnum.left { right: calc(50% + .35rem); }
@media (max-width: 34rem) {
  .rrow { grid-template-columns: 6.4rem 1fr; }
  .rlabel { font-size: .74rem; }
}

/* ——— mici multipli ——— */
.panels {
  display: grid; gap: 1.3rem 1.5rem; margin: 1.5rem 0 0;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.panel { margin: 0; }
.panel figcaption {
  font: 500 .82rem/1 var(--sans); color: var(--ink); margin-bottom: .35rem;
}
.panel svg { width: 100%; height: auto; display: block; overflow: visible; }
.panel .axis { stroke: var(--rule-2); stroke-width: 1; }
.panel .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.panel .dots circle { fill: var(--accent); stroke: var(--raised); stroke-width: 1.5; }
.panel .tick { font: 400 8.5px/1 var(--sans); fill: var(--ink-3); }
.axis-note { font: 400 .8rem/1.5 var(--sans); color: var(--ink-3); margin: .9rem 0 0; }

.tbl { margin: 1.1rem 0 0; }
.tbl summary { font: 400 .84rem/1 var(--sans); color: var(--accent); cursor: pointer; }
table { border-collapse: collapse; width: 100%; margin-top: .7rem;
  font: 400 .84rem/1.4 var(--sans); }
th, td { text-align: left; padding: .38rem .55rem; border-bottom: 1px solid var(--rule);
  font-variant-numeric: tabular-nums; }
th { color: var(--ink-3); font-weight: 500; }
.tbl, table { max-width: 100%; }
.tbl > table, .ov { display: block; overflow-x: auto; }

/* ——— inversiunea ——— */
.inv-figure { margin: 1.6rem 0 .3rem; }
.inv-head, .irow {
  display: grid; grid-template-columns: 7.4rem 1fr 1fr; gap: .55rem;
  align-items: center;
}
.inv-head { font: 400 .74rem/1.3 var(--sans); color: var(--ink-3); margin-bottom: .4rem; }
.irow { margin-bottom: 3px; }
.ilabel { font: 400 .82rem/1.3 var(--sans); color: var(--ink-2); text-align: right; }
.itrack {
  position: relative; height: 1.15rem; background: var(--sunk); border-radius: 2px;
  display: flex; align-items: center;
}
.ibar { height: calc(100% - 4px); margin: 2px 0 2px 2px; border-radius: 2px; }
.ibar.t { background: var(--accent); }
.ibar.s { background: var(--sed-3); }
.itrack b {
  position: relative; margin-left: .35rem; font: 400 .72rem/1 var(--sans);
  color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.figure-note { font: 400 .9rem/1.6 var(--sans); color: var(--ink-2); margin-top: .9rem; }
@media (max-width: 34rem) {
  .inv-head, .irow { grid-template-columns: 5.6rem 1fr 1fr; }
  .ilabel { font-size: .72rem; }
  .itrack b { font-size: .66rem; }
}

/* ——— cardurile straturilor ——— */
.strata-list { padding-bottom: 1rem; }
.stratum {
  border-top: 1px solid var(--rule); padding: 1.5rem 0 .4rem;
  scroll-margin-top: 5rem;
}
.stratum h3 { font-size: 1.28rem; letter-spacing: -.012em; }
.stratum .when {
  font: 400 .8rem/1.4 var(--sans); color: var(--ink-3); margin: .2rem 0 .8rem;
}
.figures { display: flex; flex-wrap: wrap; gap: .3rem 1.5rem; margin: 0 0 .85rem; }
.figures dt { font: 400 .72rem/1.4 var(--sans); color: var(--ink-3); }
.figures dd { margin: 0; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.examples { display: flex; flex-wrap: wrap; gap: .35rem; align-items: baseline; }
.examples > span {
  font: 400 .74rem/1.6 var(--sans); color: var(--ink-3); margin-right: .2rem;
}

/* ——— metodă, surse ——— */
.srcs { list-style: none; margin: 0 0 1.4rem; padding: 0; }
.srcs li { border-top: 1px solid var(--rule); padding: .8rem 0; }
.srcs .t { margin: 0 0 .2rem; font-weight: 600; }
.srcs .d { margin: 0; color: var(--ink-2); font-size: .97rem; }
.ov th, .ov td { vertical-align: top; }
.ov td:last-child { color: var(--ink-2); }
.steps {
  font: 400 .82rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--sunk); border: 1px solid var(--rule); border-radius: 3px;
  padding: .8rem .9rem; overflow-x: auto; color: var(--ink-2);
}
.source-download {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: .45rem .75rem; border: 1px solid var(--accent);
  border-radius: 3px; color: var(--accent); font: 500 .84rem/1.2 var(--sans);
  text-decoration: none;
}
.source-download:hover { background: var(--accent-soft); }
.checksum-link {
  margin-left: .65rem; font: 400 .78rem/1.2 var(--sans); color: var(--ink-3);
}
.repro-note { color: var(--ink-2); font-size: .97rem; }

/* ——— piciorul paginii ——— */
.foot {
  margin-top: 4rem; border-top: 1px solid var(--rule);
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 3rem;
  font: 400 .85rem/1.6 var(--sans); color: var(--ink-3);
}
.foot p { margin: 0 0 .25rem; }
.foot .thin { color: var(--ink-3); }
.back-to-top {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; margin-top: .65rem;
  font: 500 .8rem/1 var(--sans); color: var(--ink-2);
}
.back-to-top.enhanced {
  position: fixed; right: max(1rem, env(safe-area-inset-right));
  bottom: var(--btt-bottom, 1rem); z-index: 18; margin: 0;
  padding: 0 .7rem; background: var(--raised); border: 1px solid var(--rule-2);
  border-radius: 3px; box-shadow: 0 5px 18px rgb(0 0 0 / .12);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .16s ease, visibility .16s ease, bottom .16s ease;
}
.back-to-top.enhanced.shown {
  opacity: 1; visibility: visible; pointer-events: auto;
}

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