/* La ce altitudine trăiesc românii — dual theme, semantic tokens only. */
:root {
  --bg: #f3efe6; --bg2: #eae4d6; --panel: rgba(243, 239, 230, .93);
  --text: #24211b; --text2: #57524a; --line: #d6cebc; --line2: #c2b8a2;
  --accent: #9a5b2d; --accent-ink: #ffffff; --mark: #6e4a2f;
  --chart-ax: #7a7365; --chart-grid: #d9d2c0;
  color-scheme: light;
}
.dark {
  --bg: #17140f; --bg2: #201c15; --panel: rgba(23, 20, 15, .93);
  --text: #ece7db; --text2: #b3ac9c; --line: #3a3428; --line2: #4a4333;
  --accent: #d99a5e; --accent-ink: #1d1408; --mark: #e5c493;
  --chart-ax: #97907e; --chart-grid: #37311f;
  color-scheme: dark;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
svg[hidden] { display: none !important }
html { -webkit-text-size-adjust: 100% }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1.06rem/1.65 "Source Serif 4", Georgia, serif;
  font-variant-numeric: oldstyle-nums;
}
h1, h2, h3, .kicker, .slab, .btn, .chip, .seg button, .bin, .medlab { font-family: "Fraunces", Georgia, serif }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.4rem); font-weight: 350; line-height: 1.08; margin: .4rem 0 1.2rem; letter-spacing: -.01em }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 350; line-height: 1.15; margin: 0 0 1.1rem; letter-spacing: -.008em }
h3 { font-size: 1.18rem; font-weight: 500; margin: 1.5rem 0 .3rem }
p { margin: 0 0 1rem; max-width: 46rem }
a { color: var(--accent) }
.nw { white-space: nowrap }
.wrap { max-width: 70rem; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.4rem) }
.wide { max-width: 78rem; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem) }
.tinted { background: var(--bg2) }
section.block { padding: 3.2rem 0 2.6rem }
section.block.tinted { background: var(--bg2) }

.skip { position: absolute; left: -999px; top: 0; background: var(--bg); color: var(--text); padding: .5rem 1rem; z-index: 60 }
.skip:focus { left: .5rem }
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: .5rem clamp(.8rem, 3vw, 1.6rem) .5rem;
  padding-top: calc(.5rem + var(--browser-safe-top,env(safe-area-inset-top)));
}
.home { display: flex; align-items: center; gap: .45rem; color: var(--text); text-decoration: none; font-family: "Fraunces", serif; font-size: .98rem }
.motif { width: 22px; height: 22px; color: var(--accent) }
.topnav { display: flex; gap: .9rem; font-size: .92rem; overflow-x: auto; scrollbar-width: none }
.topnav a { color: var(--text2); text-decoration: none; white-space: nowrap }
.topnav a:hover { color: var(--text) }
.spacer { flex: 1 }
.chip, .icon-btn {
  border: 1px solid var(--line2); background: var(--bg); color: var(--text);
  border-radius: 999px; padding: .3rem .8rem; font: 500 .88rem "Fraunces", serif; cursor: pointer;
}
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0 }
.icon-btn:hover, .chip:hover { border-color: var(--accent) }
.progress { position: absolute; left: 0; bottom: -1px; width: 100%; height: 2px; pointer-events: none }
.progress i { display: block; height: 100%; width: 0; background: var(--accent) }

.hero { padding: 0 0 2.2rem }
.hero-relief { position: relative; max-height: 76vh; overflow: hidden; background: var(--bg2) }
.hero-relief picture, .hero-relief img { display: block; width: 100%; height: auto; max-height: 76vh; object-fit: cover }
.hero-claim {
  position: absolute; left: 50%; bottom: clamp(1rem, 4vw, 2.6rem); transform: translateX(-50%);
  width: min(42rem, calc(100% - 2rem));
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: .9rem 1.2rem; text-align: center;
}
.hero-claim .claim { font: 400 clamp(1.02rem, 2.1vw, 1.3rem)/1.4 "Fraunces", serif; margin: 0 }
.hero-claim .hero-sub { font-size: .82rem; color: var(--text2); margin: .45rem 0 0 }
.intro { padding-top: 2.4rem }
.kicker { font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text2); margin: 0 }
.deck { font-size: clamp(1.05rem, 2vw, 1.24rem); line-height: 1.55; max-width: 44rem }
.srcline { font-size: .86rem; color: var(--text2) }

.chartbox { padding-bottom: 1.6rem }
.chart { width: 100%; height: auto; display: block }
.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin-bottom: .8rem }
.slab { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text2) }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden }
.seg button {
  border: 0; background: var(--bg); color: var(--text2); padding: .38rem .8rem;
  font: 500 .92rem "Fraunces", serif; cursor: pointer; border-left: 1px solid var(--line);
}
.seg button:first-child { border-left: 0 }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink) }
.note { font-size: .85rem; color: var(--text2); max-width: 52rem }
.shelp { font-size: .84rem; color: var(--text2) }
.bandkey .k { font-variant-numeric: normal }
.bandsvg .bin { font-size: 14px; fill: #1f1c16 }
.chart .bin.out { fill: var(--text2); font-size: 12.5px }
.bandsvg .med { stroke: var(--mark); stroke-width: 3; stroke-linecap: round }
.bandsvg .medlab { font-size: 15px; font-weight: 500; fill: var(--mark) }
.chart.vn { display: none }
.bandsvg .axt, .chart .axt { stroke: var(--chart-grid) }
.chart .ax { font: 11.5px "Source Serif 4", serif; fill: var(--chart-ax) }
.chart .rowlab { font-size: 13.5px; fill: var(--text2) }
.chart .med { stroke: var(--mark); stroke-width: 3; stroke-linecap: round }
.chart .medlab { font-size: 15px; font-weight: 500; fill: var(--mark) }

.ladderbox { position: relative }
#ladder { width: 100%; height: auto; display: block; touch-action: pan-y; border: 1px solid var(--line); border-radius: 10px; background: var(--bg) }
#lyear { flex: 1; min-width: 12rem; accent-color: var(--accent) }
#lyear-out { font: 500 1.05rem "Fraunces", serif; min-width: 3.4ch; text-align: right }
.pop {
  position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line2);
  border-radius: 8px; padding: .4rem .6rem; font: 500 .86rem/1.35 "Fraunces", serif; max-width: 16rem; z-index: 5;
}
.pop .pp { color: var(--text2); font: 400 .8rem "Source Serif 4", serif }
.btn {
  border: 1px solid var(--line2); background: var(--bg); color: var(--text); border-radius: 8px;
  padding: .38rem .9rem; font: 500 .9rem "Fraunces", serif; cursor: pointer;
}
.btn[disabled] { opacity: .5; cursor: default }
.btn.ghost { background: transparent }
.btn.small { padding: .24rem .7rem; font-size: .84rem }
.btn[aria-pressed="true"], #lplay[data-on="1"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }

.search { margin: .4rem 0 1rem; max-width: 42rem }
.search input {
  width: 100%; font: 500 1.05rem/1.4 "Source Serif 4", serif; color: var(--text);
  background: var(--bg); border: 1px solid var(--line2); border-radius: 10px; padding: .65rem .9rem;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent) }
.combo { position: relative }
#sugg {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: .2rem;
  list-style: none; background: var(--bg); border: 1px solid var(--line2); border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .18); max-height: 19rem; overflow: auto;
}
#sugg li { padding: 0 }
#sugg button {
  display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--text);
  font: 400 .98rem/1.4 "Source Serif 4", serif; padding: .48rem .7rem; cursor: pointer; border-radius: 7px;
}
#sugg button[aria-selected="true"], #sugg button:hover { background: var(--bg2) }
#sugg .cc { color: var(--text2); font-size: .84rem }
.result {
  border: 1px solid var(--line2); border-radius: 14px; background: var(--bg);
  padding: 1.2rem 1.3rem; max-width: 42rem; margin-bottom: 1.4rem;
}
.result .rname { font: 400 1.5rem/1.2 "Fraunces", serif; margin: 0 }
.result .rname small { font-size: .95rem; color: var(--text2) }
.result .relev { font: 400 2.6rem/1.1 "Fraunces", serif; color: var(--accent); margin: .5rem 0 .1rem }
.result .rsub { color: var(--text2); font-size: .92rem; margin: 0 0 .7rem }
.result .relev .unit { font-size: 1.02rem; font-family: "Source Serif 4", serif; color: var(--text2) }
.result table { border-collapse: collapse; font-variant-numeric: tabular-nums; margin: .4rem 0 .9rem }
.result td { padding: .18rem .9rem .18rem 0; font-size: .96rem }
.result td.n { text-align: right; font-variant-numeric: tabular-nums }
.rthen { color: var(--text2); font-size: .88rem }

.scrollx { overflow-x: auto; padding-bottom: .4rem }
table.data { border-collapse: collapse; min-width: 40rem; font-variant-numeric: tabular-nums }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: .45rem .8rem .45rem 0; text-align: left; font-size: .95rem }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums }
table.data thead th { color: var(--text2); font-weight: 500; font-size: .84rem; letter-spacing: .04em }

.faq h3 { margin-top: 1.3rem }
.sources { list-style: none; padding: 0; margin: 0 0 1.4rem; max-width: 46rem }
.sources li { padding: .3rem 0; border-bottom: 1px solid var(--line); font-size: .95rem }
.sources a { text-decoration: none }
.sources a:hover { text-decoration: underline }
.share-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .6rem 0 }
.share-row .lbl { font-size: .9rem; color: var(--text2) }
.sh {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border: 1px solid var(--line2); border-radius: 50%; color: var(--text); background: var(--bg); cursor: pointer;
}
.sh:hover { border-color: var(--accent); color: var(--accent) }
.sh svg { width: 17px; height: 17px }
.status { min-height: 1.2em; font-size: .88rem; color: var(--accent); margin: .2rem 0 0 }

footer {
  border-top: 1px solid var(--line); padding: 1.4rem clamp(1rem, 4vw, 2.4rem) calc(1.4rem + env(safe-area-inset-bottom));
  display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: .9rem; color: var(--text2);
}
footer a { color: var(--text2) }
footer span { margin-right: auto }

@media (max-width: 760px) {
  body { font-size: 1.02rem }
  .topnav { display: none }
  .hero-claim { padding: .75rem .9rem }
  .hero-relief img { aspect-ratio: 4 / 3; max-height: none; object-fit: cover }
  .hero-claim { position: static; transform: none; width: auto; margin: .8rem .7rem 0 }
  .chart.vw { display: none }
  .chart.vn { display: block }
  .vn .bin { font-size: 15px }
  .vn .bin.out { font-size: 13.5px }
  .vn .ax { font-size: 13.5px }
  .vn .rowlab { font-size: 14.5px }
  .vn .medlab { font-size: 17px }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-relief img { transition: filter .25s }
}
