/* slanic-moldova: enamel plaques, bottle glass, valley stone */
:root {
  --paper: #f2efe6; --ink: #21302b; --teal: #0f6f6a; --oxide: #9a4a1a;
  --moss: #6b7a5e; --line: #d8d2c0; --card: #faf8f1; --plaque: #fdfdf9;
  --focus: #0f6f6a; --muted: #4c5a53;
}
[data-theme="dark"] {
  --paper: #101815; --ink: #e8e4d5; --teal: #35b3a8; --oxide: #d98a4b;
  --moss: #93a184; --line: #2b3a33; --card: #16211c; --plaque: #1b2823;
  --focus: #35b3a8; --muted: #b3bcab;
}
* { 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;
}
h1, h2, h3, h4, .kicker, .figure-line, .pnum {
  font-family: "Fraunces", Georgia, serif;
}
h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); line-height: 1.15; font-weight: 700; }
h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); line-height: 1.25; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
a { color: var(--teal); }
a.anchor { color: inherit; text-decoration: none; }
a.anchor:hover, a.anchor:focus-visible { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1.25rem; }
.block { padding: 2.5rem 0; }
.kicker { font-size: 0.95rem; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 0.5rem; }
.deck { font-size: 1.25rem; line-height: 1.5; }
.figure-line { font-size: 1.05rem; color: var(--teal); font-weight: 600; }
.lede { font-size: 1.2rem; }
/* topbar + rail */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1rem;
  padding: 0.5rem 1rem; background: var(--paper); border-bottom: 1px solid var(--line);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 0.95rem;
}
.topbar .home { font-weight: 700; text-decoration: none; color: var(--ink); }
.topnav { display: flex; gap: 0.9rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { text-decoration: none; color: var(--muted); white-space: nowrap; }
.topnav a:hover { color: var(--ink); }
.mobile-nav { display: none; position: relative; }
.mobile-nav summary { color: var(--ink); cursor: pointer; list-style: none; padding: .6rem .4rem; white-space: nowrap; }
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav summary::after { content: " ▾"; }
.mobile-nav[open] summary::after { content: " ▴"; }
.mobile-nav summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mobile-nav nav { position: absolute; top: calc(100% + .25rem); left: 0; width: max-content; max-width: calc(100vw - 1.2rem); padding: .35rem; display: grid; background: var(--card); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,.25); z-index: 60; }
.mobile-nav nav a { display: block; padding: .7rem .85rem; color: var(--ink); text-decoration: none; line-height: 1.25; white-space: nowrap; }
.mobile-nav nav a:hover { color: var(--teal); }
@media (max-width: 59.99rem) { .topnav { display: none; } .mobile-nav { display: block; } }
.spacer { flex: 1; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.7rem;
  text-decoration: none; color: var(--ink); font-weight: 600; min-height: 44px;
  display: inline-flex; align-items: center;
}
.icon-btn {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  width: 44px; height: 44px; cursor: pointer; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg circle { fill: none; stroke: currentColor; stroke-width: 2; }
[data-theme="dark"] .icon-btn svg circle { fill: currentColor; }
.rail {
  position: fixed; left: 0; top: 0; bottom: 0; width: 3.2rem; z-index: 40;
  display: none; flex-direction: column; justify-content: center; gap: 0.4rem;
  padding-left: 0.6rem; font-family: system-ui, sans-serif; font-size: 0.72rem;
}
@media (min-width: 70rem) { .rail { display: flex; } }
.rail a { color: var(--muted); text-decoration: none; writing-mode: vertical-rl; transform: rotate(180deg); }
.rail a.on { color: var(--teal); font-weight: 700; }
.rail .drop { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
/* hero */
.hero-fig { margin: 1.5rem 0 0; }
.hero-fig img, .fig img { width: 100%; height: auto; display: block; border-radius: 6px; }
figcaption { font-size: 0.95rem; color: var(--muted); margin-top: 0.5rem; font-family: system-ui, sans-serif; }
.fig { margin: 2rem 0; }
/* story: valley walk */
.story-grid { max-width: 76rem; margin: 0 auto; padding: 0 1.25rem; }
@media (min-width: 60rem) {
  .story-grid { display: grid; grid-template-columns: minmax(20rem, 27rem) 1fr; gap: 2rem; align-items: start; }
  .steps { order: 1; } .stage { order: 2; position: sticky; top: 4rem; }
}
.stage {
  position: sticky; top: 3.2rem; z-index: 10; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem;
}
@media (max-width: 59.99rem) { .stage { max-height: 44vh; } .stage svg.valley { max-height: 36vh; } }
svg.valley { width: 100%; height: auto; display: block; }
.step { padding: 1.5rem 1rem; border-left: 3px solid var(--line); margin: 0 0 1rem; }
.step.on { border-left-color: var(--teal); }
.step h3 { margin: 0 0 0.5rem; }
.step p { margin: 0; }
.skip {
  display: inline-block; margin: 0.4rem 0.2rem; font-family: system-ui, sans-serif;
  font-size: 0.95rem; min-height: 44px; line-height: 44px;
}
.readout {
  font-family: system-ui, sans-serif; font-size: 0.9rem; color: var(--muted);
  min-height: 1.4em; padding: 0 0.2rem 0.3rem;
}
/* valley svg */
.valley .ground { fill: var(--paper); }
.valley .surface { fill: none; stroke: var(--moss); stroke-width: 2.5; }
.valley .stream { fill: none; stroke: var(--teal); stroke-width: 1.4; transform: translateY(3px); }
.valley .st-kliva { fill: #c9b98f; opacity: 0.55; }
.valley .st-disod { fill: #8a7a5c; opacity: 0.5; }
.valley .st-olig { fill: #5c6e5a; opacity: 0.45; }
[data-theme="dark"] .valley .st-kliva { fill: #6e6244; }
[data-theme="dark"] .valley .st-disod { fill: #57503e; }
[data-theme="dark"] .valley .st-olig { fill: #3d4a3c; }
.valley .plaque { fill: var(--plaque); stroke: var(--ink); stroke-width: 1.2; }
.valley .pnum { font-size: 13px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.valley .riser { stroke: var(--teal); stroke-width: 1.4; stroke-dasharray: 3 2; }
.valley .spring { cursor: pointer; }
.valley .spring.static { cursor: default; }
.skip[hidden], button[hidden], div[hidden] { display: none; }
.valley .spring.analysed .plaque { stroke: var(--teal); stroke-width: 2; }
.valley .spring:focus-visible { outline: none; }
.valley .spring:focus-visible .plaque { stroke: var(--focus); stroke-width: 3; }
.valley .shaft { stroke: var(--oxide); stroke-width: 3; }
.valley .slab { font-family: system-ui, sans-serif; font-size: 11px; fill: var(--muted); }
.valley .slab.schema { font-style: italic; }
.valley .tick { stroke: var(--muted); stroke-width: 1; }
.valley .rlab { font-family: system-ui, sans-serif; font-size: 10px; fill: var(--muted); text-anchor: middle; }
.valley .rlab.ex { text-anchor: end; }
.valley .walker { fill: var(--oxide); stroke: var(--paper); stroke-width: 1.5; }
/* audit */
.picker { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin: 1.5rem 0; }
.picker legend { font-family: "Fraunces", serif; font-weight: 600; padding: 0 0.5rem; }
.picks { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.pick {
  min-width: 64px; min-height: 64px; border-radius: 8px; cursor: pointer;
  background: var(--plaque); border: 2px solid var(--ink); color: var(--ink);
  font-size: 1.15rem;
}
.pick .pnum { font-weight: 700; }
.pick[aria-pressed="true"] { border-color: var(--teal); background: var(--teal); color: #fff; }
.pick:disabled { opacity: 0.4; cursor: not-allowed; }
.pick-count { font-family: system-ui, sans-serif; color: var(--muted); margin: 0.6rem 0 0; min-height: 1.4em; }
.glasses { display: grid; gap: 1.5rem; margin: 1.5rem 0; }
@media (min-width: 50rem) { .glasses { grid-template-columns: repeat(3, 1fr); } }
.glass { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; background: var(--card); }
.glass h4 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.tumbler { width: 84px; height: auto; display: block; margin: 0.2rem 0 0.6rem; }
.tumbler .glass-line { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.tumbler .glass-fill { fill: var(--teal); opacity: 0.75; }
.load { font-family: system-ui, sans-serif; font-size: 0.95rem; margin: 0.2rem 0 0.6rem; }
.years { display: flex; gap: 0.5rem; margin-bottom: 0.6rem; }
.years button {
  min-height: 44px; padding: 0 0.9rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-family: system-ui, sans-serif; font-size: 0.95rem;
}
.years button[aria-pressed="true"] { border-color: var(--teal); font-weight: 700; color: var(--teal); }
.years button:disabled { opacity: 0.35; cursor: not-allowed; }
table.ions, table.audit-tab { width: 100%; border-collapse: collapse; font-family: system-ui, sans-serif; font-size: 0.88rem; }
table.ions th, table.ions td, table.audit-tab th, table.audit-tab td {
  border-bottom: 1px solid var(--line); padding: 0.3rem 0.4rem; text-align: right;
}
table.ions th:first-child, table.audit-tab th:first-child { text-align: left; }
table.ions td.na { color: var(--muted); font-style: italic; text-align: center; }
.x { color: var(--oxide); font-weight: 700; white-space: nowrap; }
.verdict {
  font-family: "Fraunces", serif; font-weight: 700; font-size: 1.05rem;
  color: var(--oxide); margin: 0.7rem 0 0;
}
.verdict.water { color: var(--teal); }
.tally { border: 2px solid var(--teal); border-radius: 8px; padding: 1rem 1.2rem; margin: 1.5rem 0; }
.tally h3 { margin: 0 0 0.5rem; }
.crossed { font-size: 0.95rem; color: var(--muted); font-family: system-ui, sans-serif; }
.audit-btns { display: flex; gap: 0.8rem; margin: 1rem 0; flex-wrap: wrap; }
.hist-note { font-size: 0.85rem; opacity: 0.85; margin: 0.2rem 0 1rem; }
.play, .reset {
  min-height: 44px; padding: 0 1.1rem; border-radius: 6px; cursor: pointer;
  font-family: system-ui, sans-serif; font-size: 1rem;
  border: 2px solid var(--teal); background: var(--teal); color: #fff;
}
.reset { background: none; color: var(--teal); }
/* defs, sources, ending, footer */
ul.defs { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: 0.6rem; }
ul.defs li { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 0.6rem 0.9rem; }
ul.defs .dt { font-family: "Fraunces", serif; font-weight: 700; color: var(--teal); }
ul.sources { padding-left: 1.3rem; }
ul.sources li { margin-bottom: 0.7rem; font-size: 1rem; }
.ending { font-size: 1.25rem; border-top: 2px solid var(--teal); padding-top: 1.2rem; margin-top: 2rem; }
details.what { margin-top: 1.5rem; border: 1px solid var(--line); border-radius: 6px; padding: 0.7rem 1rem; }
details.what summary { cursor: pointer; font-weight: 600; min-height: 44px; }
footer.site { border-top: 1px solid var(--line); margin-top: 2rem; padding: 1.5rem 1.25rem 3rem; text-align: center; }
.share-block { padding-bottom: 0; }
@media (max-height: 740px) and (max-width: 59.99rem) {
  .stage { max-height: 38vh; } .stage svg.valley { max-height: 30vh; }
}


/* share row (standards/v2/tools/share_row.py) */
.share-row{display:flex;flex-wrap:wrap;gap:.35rem;align-items:center}
.share-row .lab{font-size:.95rem;margin-inline-end:.3rem}
.share-row a,.share-row button{display:inline-grid;place-items:center;flex:none;width:2.5rem;height:2.5rem;padding:0;border-radius:50%;border:1px solid var(--sr-line,color-mix(in srgb,currentColor 28%,transparent));background:transparent;color:var(--sr-ink,inherit);text-decoration:none;cursor:pointer;font:inherit;transition:color .15s,border-color .15s}
.share-row a:hover,.share-row button:hover,.share-row a:focus-visible,.share-row button:focus-visible{color:var(--sr-acc,inherit);border-color:var(--sr-acc,currentColor)}
.share-row [hidden]{display:none}
@media (pointer:coarse){.share-row a,.share-row button{width:2.75rem;height:2.75rem}}
@media (max-width:30rem){.share-row .lab{flex-basis:100%;margin:0 0 .15rem}}
.share-status{font-size:.92rem;color:var(--sr-ok,inherit);min-height:1.2em;margin:.4rem 0 0}
.share-status:empty{display:none}
.share-field{display:block;width:100%;max-width:36rem;margin-top:.4rem;font:inherit;font-size:.9rem}
