/* ani-de-pensie: paper ledger, ink, gold leaf. */
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/fraunces-normal-latin.woff2?v=175f6e93d5") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-2019, U+201C-201D, U+20AC, U+2190-2193;
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/fraunces-normal-latin-ext.woff2?v=ffbbcc8844") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF;
}
@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/source-serif-4-normal-latin.woff2?v=0d04bb72e5") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-2019, U+201C-201D, U+20AC;
}
@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/source-serif-4-normal-latin-ext.woff2?v=30cc49f716") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF;
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/source-serif-4-italic-latin.woff2?v=3a6e3f6daa") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-2019, U+201C-201D;
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/source-serif-4-italic-latin-ext.woff2?v=6bee6520ad") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF;
}

:root {
  --paper: #f6f1e3;
  --paper-soft: #efe7d3;
  --ink: #1d1710;
  --ink-soft: #4a4232;
  --muted: #6d6350;
  --line: #d9cdb2;
  --line-soft: #e5dcc6;
  --gold: #8a5f00;
  --gold-deep: #6e4a00;
  --gold-wash: #f0dfae;
  --brick-lived: #2c2517;
  --brick-ghost: transparent;
  --focus: #8a5f00;
  --topbar-h: 3rem;
  color-scheme: light dark;
}
html[data-theme="dark"] {
  --paper: #14110a;
  --paper-soft: #1e1912;
  --ink: #f0e6cf;
  --ink-soft: #cfc2a4;
  --muted: #a2987e;
  --line: #3d3524;
  --line-soft: #2b2517;
  --gold: #d9a92e;
  --gold-deep: #e8bc4a;
  --gold-wash: #3a2f14;
  --brick-lived: #e4d6b4;
  --focus: #e8bc4a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.65;
}
::selection { background: var(--gold-wash); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 0.75rem;
  min-height: var(--topbar-h);
  padding: 0 1rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar .home {
  font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 1rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.topnav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  color: var(--ink-soft); text-decoration: none; white-space: nowrap;
  padding: 0.35rem 0.6rem; border-radius: 999px; font-size: 0.95rem;
}
.topnav a[aria-current="true"] { background: var(--gold-wash); color: var(--ink); }
.topbar .spacer { flex: 1 1 auto; }
.topbar .lang {
  color: var(--ink-soft); text-decoration: none; font-size: 0.95rem;
  padding: 0.35rem 0.5rem; border-radius: 0.4rem; white-space: nowrap;
}
.icon-btn {
  display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer;
}
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }

/* ---------- layout ---------- */
main { display: block; }
.hero, section, footer.foot {
  max-width: 42rem; margin: 0 auto; padding: 0 1.25rem;
}
.hero { padding-top: 2.5rem; }
section { padding-top: 2.75rem; scroll-margin-top: calc(var(--topbar-h) + 1rem); }
section.evidence { max-width: 52rem; }
footer.foot {
  margin-top: 3rem; padding-top: 1.5rem; padding-bottom: 4rem;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 0.95rem;
}
footer.foot a { color: inherit; }

.kicker {
  font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 0.75rem;
}
h1 {
  font-family: Fraunces, Georgia, serif; font-weight: 600;
  font-size: clamp(2.1rem, 6vw, 3.2rem); line-height: 1.08;
  margin: 0 0 1rem; text-wrap: balance;
}
.deck { font-size: 1.2rem; color: var(--ink-soft); margin: 0 0 1.75rem; max-width: 36rem; }
h2 {
  font-family: Fraunces, Georgia, serif; font-weight: 600;
  font-size: clamp(1.45rem, 4vw, 1.9rem); line-height: 1.2;
  margin: 0 0 1rem; text-wrap: balance;
}
h2 .self {
  font-size: 0.7em; color: var(--muted); text-decoration: none;
  padding: 0.6em; margin: -0.6em; border-radius: 0.4rem;
}
h2 .self:hover, h2 .self:focus-visible { color: var(--gold); }
p { margin: 0 0 1.1rem; }
.caption { font-size: 0.92rem; color: var(--muted); }
a { color: var(--gold-deep); }
html[data-theme="dark"] a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.skip {
  position: absolute; left: 0.75rem; top: -4rem; z-index: 30;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem;
  border-radius: 0.5rem; text-decoration: none; transition: top 0.15s;
}
.skip:focus { top: 0.5rem; }

/* ---------- calculator ---------- */
.calc {
  display: flex; flex-wrap: wrap; gap: 0.9rem 1.25rem; align-items: end;
  background: var(--paper-soft); border: 1px solid var(--line);
  border-radius: 0.9rem; padding: 1.1rem 1.25rem; margin: 0 0 1.25rem;
}
.field { display: grid; gap: 0.3rem; margin: 0; border: 0; padding: 0; }
.field label, .field legend {
  font-size: 0.9rem; color: var(--ink-soft); padding: 0;
}
.field select, .field input[type="radio"] { accent-color: var(--gold-deep); }
.field select {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 0.5rem;
  padding: 0.55rem 0.7rem; min-height: 2.75rem; max-width: 12rem;
}
.sex { display: flex; gap: 1rem; align-items: end; }
.sex legend { margin-bottom: 0.3rem; }
.sex label {
  display: inline-flex; gap: 0.45rem; align-items: center;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.55rem 1rem; cursor: pointer; background: var(--paper);
  min-height: 2.75rem;
}
.sex input { width: 1.1rem; height: 1.1rem; margin: 0; }
.cta {
  font: inherit; font-weight: 600; color: #fff8e7;
  background: var(--gold-deep); border: 1px solid var(--gold-deep);
  border-radius: 999px; padding: 0.7rem 1.6rem; min-height: 2.75rem;
  cursor: pointer;
}
html[data-theme="dark"] .cta { color: #171204; background: var(--gold); border-color: var(--gold); }
.cta:hover { filter: brightness(1.07); }

.result {
  border-left: 4px solid var(--gold);
  padding: 0.4rem 0 0.4rem 1.1rem; margin: 0 0 1rem;
  font-size: 1.25rem; line-height: 1.55;
}
.result strong { font-weight: 700; }
.result .sub { display: block; font-size: 1rem; color: var(--ink-soft); margin-top: 0.5rem; }
.result .go { display: inline-block; margin-top: 0.6rem; font-size: 1rem; }
.result .copybtn {
  font: inherit; font-size: 0.92rem; color: var(--ink-soft);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.45rem 1rem; margin-top: 0.6rem; margin-left: 0.6rem; cursor: pointer;
  min-height: 2.75rem;
}

/* ---------- share ---------- */
.share { padding-top: 1.5rem; }
.share-label { font-size: 0.9rem; color: var(--muted); margin: 0 0 0.5rem; }
.share-row { display: flex; flex-wrap: wrap; gap: 0.5rem; scroll-margin: 4.75rem; }
.share-row a, .share-row button {
  display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem; border-radius: 999px;
  border: 1px solid var(--line-soft); background: transparent; color: var(--ink);
  text-decoration: none; cursor: pointer;
}
@media (pointer: coarse) {
  .share-row a, .share-row button { width: 2.75rem; height: 2.75rem; }
}
.share-row a:hover, .share-row button:hover,
.share-row a:focus-visible, .share-row button:focus-visible {
  border-color: var(--gold); color: var(--gold-deep);
}
html[data-theme="dark"] .share-row a:hover, html[data-theme="dark"] .share-row button:hover,
html[data-theme="dark"] .share-row a:focus-visible, html[data-theme="dark"] .share-row button:focus-visible {
  color: var(--gold);
}
.share-status { font-size: 0.92rem; color: var(--muted); min-height: 1.2em; }

/* ---------- wall ---------- */
.legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem;
  margin: 0 0 1rem; padding: 0; font-size: 0.92rem; color: var(--ink-soft);
}
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.sw { display: inline-block; width: 1.1rem; height: 1.1rem; border-radius: 3px; }
.sw.lived { background: var(--brick-lived); }
.sw.work { border: 1.5px solid var(--muted); }
.sw.gate { border: 2px solid var(--gold-deep); }
html[data-theme="dark"] .sw.gate { border-color: var(--gold); }
.sw.healthy { background: var(--gold); }
.sw.limited {
  background: repeating-linear-gradient(45deg, var(--gold-wash) 0 3px, transparent 3px 6px);
  border: 1px solid var(--gold);
}
.sw.beyond { background: var(--line); }
.wallbox { margin: 0 0 1rem; }
.wall {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px;
}
.brick {
  aspect-ratio: 1.55; border-radius: 3px; position: relative;
  opacity: var(--fade, 1);
}
.brick.lived { background: var(--brick-lived); }
.brick.work { border: 1.5px solid var(--muted); }
.brick.gate { border: 2.5px solid var(--gold-deep); background: var(--gold-wash); }
html[data-theme="dark"] .brick.gate { border-color: var(--gold); }
.brick.healthy { background: linear-gradient(160deg, var(--gold), var(--gold-deep)); }
html[data-theme="dark"] .brick.healthy { background: linear-gradient(160deg, var(--gold-deep), var(--gold)); }
.brick.limited {
  background: repeating-linear-gradient(45deg, var(--gold-wash) 0 4px, transparent 4px 8px);
  border: 1px solid var(--gold);
}
.brick.beyond { background: var(--line); }
@media (hover: hover) {
  .brick[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
    background: var(--ink); color: var(--paper); font-size: 0.8rem; white-space: nowrap;
    padding: 0.25rem 0.6rem; border-radius: 0.4rem; z-index: 5; pointer-events: none;
  }
}

/* ---------- lever ---------- */
.lever fieldset { border: 0; margin: 0 0 0.75rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.lever label {
  display: inline-flex; gap: 0.45rem; align-items: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.55rem 1rem;
  min-height: 2.75rem; background: var(--paper);
}
.lever input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--gold-deep); }
.lever-out { font-size: 1.2rem; border-left: 4px solid var(--gold); padding-left: 1rem; }
.lever-out .cond { color: var(--muted); font-size: 1rem; }

/* ---------- figures ---------- */
.fig { margin: 1.5rem 0; }
.fig svg { width: 100%; height: auto; display: block; }
.fig .grid { stroke: var(--line); stroke-width: 1; }
.fig .ylab, .fig .xlab { fill: var(--muted); font-size: 13px; text-anchor: end; font-family: "Source Serif 4", Georgia, serif; }
.fig .xlab { text-anchor: middle; }
.fig .ln-m { fill: none; stroke: var(--ink-soft); stroke-width: 2.5; stroke-linejoin: round; }
.fig .ln-w { fill: none; stroke: var(--gold-deep); stroke-width: 2.5; stroke-linejoin: round; }
html[data-theme="dark"] .fig .ln-w { stroke: var(--gold); }
.fig .dot-w { fill: var(--gold-deep); }
.fig .dot-m { fill: var(--ink-soft); }
html[data-theme="dark"] .fig .dot-w { fill: var(--gold); }
.fig .tag { font-size: 14px; font-style: italic; fill: var(--ink-soft); }
.fig .tag-w { fill: var(--gold-deep); }
html[data-theme="dark"] .fig .tag-w { fill: var(--gold); }
.fig .rname { fill: var(--ink-soft); font-size: 15px; text-anchor: end; }
.fig .rname.ro, .fig .rname.eu { font-weight: 600; fill: var(--ink); }
.fig .rval { fill: var(--ink-soft); font-size: 14px; }
.fig .fnote { fill: var(--muted); font-size: 13px; font-style: italic; }
.fig .bar-lim { fill: var(--line); }
.fig .bar-ok { fill: var(--gold); }
.fig .bar-m { fill: var(--ink-soft); }
.fig .bar-f { fill: var(--gold); }
.fig .bar-m.ro, .fig .bar-f.ro { stroke: var(--gold-deep); stroke-width: 1.5; }

/* ---------- tables, faq, sources, related ---------- */
.twrap { overflow-x: auto; margin: 1.5rem 0; }
.etable { border-collapse: collapse; width: 100%; font-size: 0.98rem; }
.etable caption { text-align: left; color: var(--muted); font-size: 0.9rem; padding-bottom: 0.5rem; }
.etable th, .etable td { text-align: left; padding: 0.5rem 0.75rem; border-top: 1px solid var(--line); vertical-align: top; }
.etable thead th { border-top: 0; border-bottom: 2px solid var(--line); color: var(--ink-soft); font-weight: 600; }
.tfnote { font-size: 0.9rem; color: var(--muted); }
.faq { margin: 1rem 0; }
.faq dt { font-weight: 600; margin: 1.1rem 0 0.25rem; }
.faq dd { margin: 0 0 0.5rem; color: var(--ink-soft); }
.sources { padding-left: 1.25rem; }
.sources li { margin-bottom: 0.5rem; }
.sources code { font-size: 0.9em; }
.related { padding-top: 2rem; }
.related ul { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.copied { display: block; font-size: 0.92rem; color: var(--muted); margin-top: 0.4rem; min-height: 1.2em; }

/* ---------- footer extras ---------- */
.to-top {
  position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 20;
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.8rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: inherit; font-size: 0.9rem; cursor: pointer;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.12);
}
.to-top[hidden] { display: none; }

.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

@media (max-width: 560px) {
  body { font-size: 1.05rem; }
  .hero, section, footer.foot { padding-left: 1rem; padding-right: 1rem; }
  .wall { gap: 3px; }
  .result { font-size: 1.12rem; }
}