/* scolile-moldovei — "Schoolhouse Notebook & Slate Chalkboard" editorial stylesheet
 * Light: Warm exercise-book cream paper (#f8f5ec) + hairline catalog ruling
 * Dark:  Deep slate-blackboard green (#0e1714) + crisp chalk typography
 * Verified WCAG AAA (>= 7:1 normal text) across every foreground/background token pair.
 */

/* --- Local WOFF2 fonts (zero external CDN) --- */
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-normal-latin-ext.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces-normal-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibmplexsans-normal-500-latin-ext.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibmplexsans-normal-500-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibmplexsans-normal-600-latin-ext.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibmplexsans-normal-600-latin.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-normal-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-normal-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-italic-latin-ext.woff2") format("woff2");
  font-weight: 400 600;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-italic-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Semantic Tokens (Light default = Schoolhouse Exercise Book; honors OS dark before JS) --- */
:root {
  color-scheme: light dark;
  --bg: #f8f5ec;
  --bg-2: #efeade;
  --bg-3: #e5dfd0;
  --fg: #151a17;
  --mut: #434d47;
  --line: #c7bea9;
  --line-soft: #dcd5c5;
  --acc: #753900;        /* Brass-bell ochre text/links (AAA on bg & bg-2) */
  --acc-mark: #b85d00;   /* Map dot / graphic brass */
  --empty: #19456b;      /* Chalkboard slate-blue (<50% empty desks) */
  --empty-mark: #266091;
  --ok: #1a5239;         /* Schoolhouse spruce (50-100% healthy) */
  --ok-mark: #266e4e;
  --closed: #8c281d;     /* Brick-umber (closed schools) */
  --closed-mark: #a83326;
  --river: #6f94ae;
  --mid-bar: #6b726c;
  --map-land: #f3efe3;
  --map-land-hover: #e8e1ce;
  --map-border: #9f9682;
  --map-hatch: #b7ae9a;
  /* Chalkboard Atlas Frame tokens (always luminous slate-green schoolboard, verified AAA) */
  --chalk-bg: #0f1b17;
  --chalk-bg2: #15231e;
  --chalk-fg: #f2f0e6;
  --chalk-mut: #c1d0c6;
  --chalk-line: #31483f;
  --chalk-land: #162620;
  --chalk-border: #3d5b4f;
  --chalk-hatch: #385348;
  --chalk-river: #517d96;
  --chalk-over: #f7ba4a;
  --chalk-ok: #7bd4a8;
  --chalk-empty: #7cc0ef;
  --chalk-closed: #f49589;
  --on-solid: #f8f5ec;
  --rule-margin: #b56c58;
  --col: 68rem;
  --prose: 44rem;
  --gut: 1.5rem;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-ui: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1714;
    --bg-2: #15221d;
    --bg-3: #1c2d27;
    --fg: #f2f0e6;
    --mut: #b8c4bc;
    --line: #324940;
    --line-soft: #22352e;
    --acc: #f7ba4a;
    --acc-mark: #f7ba4a;
    --empty: #7cc0ef;
    --empty-mark: #7cc0ef;
    --ok: #7bd4a8;
    --ok-mark: #7bd4a8;
    --closed: #f49589;
    --closed-mark: #f49589;
    --river: #4b748a;
    --mid-bar: #9fb8ac;
    --map-land: #13201b;
    --map-land-hover: #1d3129;
    --map-border: #3d594e;
    --map-hatch: #385046;
    --on-solid: #0e1714;
    --rule-margin: #6c463d;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1714;
  --bg-2: #15221d;
  --bg-3: #1c2d27;
  --fg: #f2f0e6;
  --mut: #b8c4bc;
  --line: #324940;
  --line-soft: #22352e;
  --acc: #f7ba4a;
  --acc-mark: #f7ba4a;
  --empty: #7cc0ef;
  --empty-mark: #7cc0ef;
  --ok: #7bd4a8;
  --ok-mark: #7bd4a8;
  --closed: #f49589;
  --closed-mark: #f49589;
  --river: #4b748a;
  --mid-bar: #9fb8ac;
  --map-land: #13201b;
  --map-land-hover: #1d3129;
  --map-border: #3d594e;
  --map-hatch: #385046;
  --on-solid: #0e1714;
  --rule-margin: #6c463d;
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* --- Base Reset & Notebook Texture --- */
*, *::before, *::after { box-sizing: border-box; }
html {
  font-size: 16px;
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: clip;
}
a {
  color: var(--acc);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex="0"]:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.num, td[data-type="number"], .stat-val, .ledger-num {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--fg);
  color: var(--bg);
  padding: 0.6rem 1rem;
  font-family: var(--font-ui);
  font-weight: 600;
  z-index: 200;
}
.skip-link:focus { left: 0.75rem; top: 0.75rem; }

/* Disable floating dot rail on wide atlas layout (zero content collision) */
.rail { display: none !important; }

/* --- Page Frame & Masthead --- */
.wrap {
  width: min(var(--col), calc(100% - 2rem));
  margin-inline: auto;
}
.prose-col {
  max-width: var(--prose);
}
.atlas-prose {
  margin-top: 1.5rem;
}
.atlas-prose p {
  margin: 0 0 0.85rem;
}
.atlas-prose p:last-child {
  margin-bottom: 0;
}

.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.95rem;
  padding-block: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}
.brand-crumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.brand-home {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-home:hover { color: var(--acc); }
.crumb-sep { color: var(--mut); }
.crumb-here {
  color: var(--mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 520px) {
  .brand-crumb .crumb-hide-sm { display: none; }
}
.masthead-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  font-size: 0.8125rem;
  font-weight: 600;
}
.lang-switch a, .lang-switch span {
  padding: 0.35rem 0.65rem;
  text-decoration: none;
  line-height: 1;
}
.lang-switch .lang-active {
  background: var(--fg);
  color: var(--bg);
}
.lang-switch a {
  color: var(--fg);
}
.lang-switch a:hover {
  background: var(--bg-2);
  color: var(--acc);
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
}
.theme-btn:hover {
  border-color: var(--acc);
  color: var(--acc);
}
.theme-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}
@media (pointer: coarse) {
  .theme-btn { width: 2.75rem; height: 2.75rem; }
}

/* --- Hero: Compact School Register Header (Atlas rises directly above the fold) --- */
.hero {
  padding-block: 1.05rem 0.9rem;
  border-bottom: 2px solid var(--fg);
  position: relative;
}
.hero-kicker {
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--acc);
  margin: 0 0 0.3rem;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "opsz" 72, "SOFT" 30;
  font-size: clamp(1.55rem, 2.75vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.45rem;
  max-width: 36ch;
}
.hero-lead {
  font-size: clamp(0.96rem, 1.25vw, 1.0625rem);
  line-height: 1.48;
  color: var(--mut);
  max-width: 78ch;
  margin: 0 0 0.8rem;
}

/* Compact Inline Register Strip (hairline ruled, zero tall boxiness) */
.ledger-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.ledger-cell {
  padding: 0.5rem 0.75rem;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.ledger-cell:last-child { border-right: 0; }
.ledger-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--mut);
  line-height: 1.25;
}
.ledger-num {
  font-size: clamp(1.2rem, 1.9vw, 1.5rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.ledger-num.tone-empty { color: var(--empty); }
.ledger-num.tone-closed { color: var(--closed); }
.ledger-num.tone-acc { color: var(--acc); }
.ledger-sub {
  font-family: var(--font-ui);
  font-size: 0.74rem;
  color: var(--mut);
  line-height: 1.28;
}
@media (max-width: 820px) {
  .ledger-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger-cell:nth-child(2) { border-right: 0; }
  .ledger-cell:nth-child(1), .ledger-cell:nth-child(2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .hero { padding-block: 0.85rem 0.75rem; }
  .ledger-cell { padding: 0.45rem 0.55rem; }
  .ledger-sub { display: none; }
}

/* --- Section Headings (Ruled Notebook Dividers) --- */
.ed-section {
  padding-block: 2.5rem;
  border-bottom: 1px solid var(--line);
}
.ed-section:last-of-type { border-bottom: 0; }
.sec-head {
  margin-bottom: 1.35rem;
  max-width: 56ch;
}
.sec-eyebrow {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--acc);
  margin: 0 0 0.35rem;
}
.sec-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.015em;
  margin: 0 0 0.5rem;
}
.sec-head p {
  margin: 0;
  color: var(--mut);
}

/* --- Interactive Atlas Stage (Signature Chalkboard Map Frame + Notebook Dossier) --- */
.atlas-section {
  padding-block: 1.1rem 2.25rem;
  border-bottom: 1px solid var(--line);
}
.atlas-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 1.35rem;
  align-items: start;
}
@media (max-width: 960px) {
  .atlas-grid { grid-template-columns: 1fr; }
}

.map-panel {
  border: 2px solid var(--fg);
  border-top: 4px solid var(--chalk-over);
  background: var(--chalk-bg);
  color: var(--chalk-fg);
}
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--chalk-line);
  background: var(--chalk-bg2);
}
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.filter-btn {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.38rem 0.62rem;
  min-height: 2.15rem;
  border: 1px solid var(--chalk-line);
  background: var(--chalk-bg);
  color: var(--chalk-fg);
  cursor: pointer;
  line-height: 1.2;
}
.filter-btn:hover { border-color: var(--chalk-over); color: var(--chalk-over); }
.filter-btn[aria-pressed="true"] {
  background: var(--chalk-over);
  color: var(--chalk-bg);
  border-color: var(--chalk-over);
}
.zoom-group {
  display: inline-flex;
  gap: 0.25rem;
}
.zoom-btn {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 2.15rem;
  min-height: 2.15rem;
  padding: 0 0.5rem;
  border: 1px solid var(--chalk-line);
  background: var(--chalk-bg);
  color: var(--chalk-fg);
  cursor: pointer;
}
.zoom-btn:hover { border-color: var(--chalk-over); color: var(--chalk-over); }

.map-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3.9;
  max-height: 500px;
  overflow: hidden;
  background: var(--chalk-bg);
  touch-action: pan-y;
}
@media (max-width: 640px) {
  .map-viewport { aspect-ratio: 4 / 3.8; max-height: 360px; }
}
.map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
.map-canvas.is-dragging { cursor: grabbing; }
.map-canvas.is-pointer { cursor: pointer; }

.map-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  background: var(--chalk-bg);
  color: var(--chalk-fg);
  border: 1px solid var(--chalk-over);
  padding: 0.45rem 0.65rem;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  line-height: 1.35;
  max-width: 15.5rem;
}
.map-tooltip strong { display: block; font-weight: 700; }
.map-tooltip .tt-sub { color: var(--chalk-mut); display: block; font-size: 0.76rem; }
.map-tooltip .tt-stat { margin-top: 0.2rem; display: block; font-weight: 600; }

.map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--chalk-line);
  background: var(--chalk-bg2);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--chalk-mut);
}
.leg-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.leg-dot {
  width: 0.66rem;
  height: 0.66rem;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}
.leg-dot-over { background: var(--chalk-over); box-shadow: 0 0 0 2px var(--chalk-bg2), 0 0 0 3.2px var(--chalk-over); }
.leg-dot-ok { background: var(--chalk-ok); }
.leg-dot-empty { background: var(--chalk-empty); }
.leg-dot-closed { background: transparent; border: 2px solid var(--chalk-closed); }
.leg-hatch {
  width: 0.9rem;
  height: 0.66rem;
  border: 1px solid var(--chalk-border);
  background: repeating-linear-gradient(
    -45deg,
    var(--chalk-bg),
    var(--chalk-bg) 2px,
    var(--chalk-hatch) 2px,
    var(--chalk-hatch) 3.5px
  );
  display: inline-block;
}
.map-note {
  padding: 0.48rem 0.75rem;
  border-top: 1px solid var(--chalk-line);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  color: var(--chalk-mut);
  background: var(--chalk-bg);
}

/* --- Right Column: Locality Finder & School Dossier (Catalog Sheet) --- */
.dossier-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.finder-box {
  border: 1px solid var(--line);
  border-top: 3px solid var(--fg);
  background: var(--bg);
  padding: 0.95rem 1rem;
}
.finder-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}
.finder-row {
  position: relative;
}
.finder-input {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 0.6rem 2.3rem 0.6rem 0.75rem;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  border-radius: 0;
}
.finder-clear {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: 0;
  background: transparent;
  color: var(--mut);
  font-size: 1.15rem;
  cursor: pointer;
}
.finder-clear:hover { color: var(--fg); }

.finder-results {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  border: 1px solid var(--fg);
  background: var(--bg);
  max-height: 15.5rem;
  overflow-y: auto;
}
.finder-results li {
  border-bottom: 1px solid var(--line-soft);
}
.finder-results li:last-child { border-bottom: 0; }
.finder-opt {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--fg);
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}
.finder-opt:hover, .finder-opt[aria-selected="true"] {
  background: var(--bg-2);
}
.finder-opt-name { font-weight: 600; }
.finder-opt-raion { font-size: 0.78rem; color: var(--mut); margin-left: 0.35rem; font-weight: 400; }
.finder-opt-stat { font-size: 0.8rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.finder-opt-stat.is-over { color: var(--acc); }
.finder-opt-stat.is-closed { color: var(--closed); }
.finder-opt-stat.is-empty { color: var(--empty); }
.finder-opt-stat.is-ok { color: var(--ok); }

.quick-picks {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
}
.quick-picks-label { color: var(--mut); margin-right: 0.15rem; }
.pick-btn {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--fg);
  cursor: pointer;
}
.pick-btn:hover { border-color: var(--acc); color: var(--acc); }

/* Live School Dossier Sheet */
.dossier-sheet {
  border: 1px solid var(--line);
  border-left: 3px solid var(--rule-margin);
  background: var(--bg);
  padding: 1.05rem 1.1rem;
}
.dossier-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}
.dossier-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}
.dossier-raion {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--mut);
  margin: 0.2rem 0 0;
}
.dossier-tag {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.dossier-tag.tag-over { color: var(--acc); }
.dossier-tag.tag-closed { color: var(--closed); }
.dossier-tag.tag-empty { color: var(--empty); }
.dossier-tag.tag-ok { color: var(--ok); }

/* Occupancy Meter Bar */
.occ-block {
  margin-top: 0.9rem;
}
.occ-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.occ-pct {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.occ-track {
  position: relative;
  height: 0.72rem;
  background: var(--bg-3);
  border: 1px solid var(--line);
  overflow: hidden;
}
.occ-fill {
  height: 100%;
  background: var(--empty-mark);
  transition: width 0.25s ease;
}
.occ-fill.is-over { background: var(--acc-mark); }
.occ-fill.is-ok { background: var(--ok-mark); }
.occ-fill.is-closed { background: var(--closed-mark); }
.occ-cap-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 55.55%;
  width: 2px;
  background: var(--fg);
}
.occ-scale-note {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--mut);
  margin-top: 0.25rem;
}

.dossier-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  margin-top: 0.85rem;
}
.d-metric {
  padding: 0.55rem 0.5rem 0.55rem 0;
  border-right: 1px solid var(--line-soft);
}
.d-metric:not(:first-child) { padding-left: 0.6rem; }
.d-metric:last-child { border-right: 0; padding-right: 0; }
.d-m-k {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.74rem;
  color: var(--mut);
}
.d-m-v {
  display: block;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.spark-wrap {
  margin-top: 0.85rem;
}
.spark-title {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--mut);
  margin: 0 0 0.35rem;
  display: flex;
  justify-content: space-between;
}
.spark-svg {
  display: block;
  width: 100%;
  height: 5.4rem;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
}

.grade-split {
  margin-top: 0.85rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
}
.grade-bars {
  display: flex;
  height: 0.62rem;
  gap: 2px;
  margin: 0.3rem 0 0.35rem;
}
.gb-seg { height: 100%; }
.gb-14 { background: var(--empty-mark); }
.gb-59 { background: var(--ok-mark); }
.gb-hs { background: var(--acc-mark); }
.grade-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  color: var(--mut);
  font-size: 0.76rem;
}
.kg-row {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line-soft);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--fg);
}
.dossier-actions {
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

/* --- Section 2: 23-Year Timeline Chart --- */
.timeline-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}
.ctrl-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  max-width: 100%;
}
.ctrl-select {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  border-radius: 0;
  max-width: 100%;
  min-width: 0;
}
.chart-frame {
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: 1rem;
}
.timeline-svg {
  display: block;
  width: 100%;
  height: auto;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  margin-bottom: 0.65rem;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
}
.cl-swatch {
  display: inline-block;
  width: 1.1rem;
  height: 3px;
  vertical-align: middle;
  margin-right: 0.35rem;
}
.cl-nat { background: var(--fg); }
.cl-sel { background: var(--closed-mark); }
.cl-chi { background: var(--acc-mark); }

.drop-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--bg);
}
.drop-btn {
  text-align: left;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  font-family: var(--font-ui);
}
.drop-btn:last-child { border-right: 0; }
.drop-btn:hover, .drop-btn[aria-pressed="true"] {
  background: var(--bg-2);
}
.drop-btn[aria-pressed="true"] {
  box-shadow: inset 0 3px 0 var(--acc);
}
.drop-name { display: block; font-size: 0.82rem; font-weight: 700; }
.drop-val { display: block; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 0.1rem; }
.drop-val.is-bad { color: var(--closed); }
.drop-val.is-chi { color: var(--acc); }
.drop-sub { display: block; font-size: 0.74rem; color: var(--mut); }
@media (max-width: 820px) {
  .drop-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .drop-btn:nth-child(3) { border-right: 0; }
  .drop-btn:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .drop-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drop-btn { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .drop-btn:nth-child(2n) { border-right: 0; }
}

/* --- Section 3: Aging Blackboard (35-Raion Teacher Seniority Strip) --- */
.teacher-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
  font-family: var(--font-ui);
  font-size: 0.84rem;
}
.teacher-board {
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: 0.9rem 1rem;
}
.teacher-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1.75rem;
}
@media (max-width: 780px) {
  .teacher-list { grid-template-columns: 1fr; }
}
.t-row {
  display: grid;
  grid-template-columns: 8.6rem minmax(0, 1fr) 6.8rem;
  align-items: center;
  gap: 0.6rem;
  padding-block: 0.25rem;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-ui);
  font-size: 0.82rem;
}
.t-name {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t-name:hover { color: var(--acc); text-decoration: underline; }
.t-bar {
  display: flex;
  height: 0.72rem;
  background: var(--bg-3);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.t-seg-u2 { background: var(--ok-mark); }
.t-seg-mid { background: var(--line); }
.t-seg-o20 { background: var(--closed-mark); }
.t-vals {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  white-space: nowrap;
}
.t-v20 { font-weight: 700; color: var(--closed); }
.t-vu2 { color: var(--ok); font-weight: 600; }

/* --- Section 4: Kindergarten Pipeline --- */
.pipeline-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
}
@media (max-width: 820px) {
  .pipeline-grid { grid-template-columns: 1fr; }
}
.cohort-box {
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: 1rem 1.1rem;
  font-family: var(--font-ui);
}
.cohort-row {
  margin-bottom: 0.75rem;
}
.cohort-row:last-child { margin-bottom: 0; }
.cohort-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  margin-bottom: 0.22rem;
}
.cohort-track {
  height: 0.8rem;
  background: var(--bg-3);
  border: 1px solid var(--line-soft);
}
.cohort-fill {
  height: 100%;
  background: var(--empty-mark);
}
.cohort-fill.is-kg { background: var(--acc-mark); }
.cohort-fill.is-hs { background: var(--ok-mark); }
.cohort-delta { font-size: 0.76rem; color: var(--mut); }

/* --- Section 5 & Dossier Tables (modern-web-guidance sortable-table + responsive-table) --- */
.table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  font-family: var(--font-ui);
}
.table-search {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0.48rem 0.7rem;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  width: min(19rem, 100%);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-radius: 0;
}
.table-count {
  font-size: 0.82rem;
  color: var(--mut);
}
.table-wrap {
  overflow-x: auto;
  max-inline-size: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
}
.data-table {
  width: 100%;
  min-inline-size: 44rem;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}
.data-table caption {
  text-align: left;
  padding: 0.65rem 0.8rem;
  font-weight: 700;
  color: var(--mut);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}
.data-table thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: var(--bg-2);
  color: var(--fg);
  border-bottom: 2px solid var(--fg);
  text-align: left;
  font-weight: 700;
  padding: 0.65rem 0.7rem;
  white-space: nowrap;
}
.data-table thead th[data-type="number"] { text-align: right; }
.data-table thead th:has(> button) { padding: 0; }
.data-table thead th > button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.55rem 0.7rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: inherit;
}
.data-table thead th[data-type="number"] > button {
  justify-content: flex-end;
}
.data-table thead th > button:hover { color: var(--acc); }
.sort-ind {
  display: inline-block;
  width: 0.75rem;
  text-align: center;
  color: var(--mut);
}
.data-table thead th[aria-sort="ascending"] .sort-ind::after { content: "▲"; color: var(--acc); }
.data-table thead th[aria-sort="descending"] .sort-ind::after { content: "▼"; color: var(--acc); }
.data-table thead th:not([aria-sort]) .sort-ind::after { content: "⇅"; opacity: 0.45; }

.data-table tbody th,
.data-table tbody td {
  padding: 0.58rem 0.7rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.data-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--bg);
  text-align: left;
  font-weight: 600;
}
.data-table tbody tr:hover th,
.data-table tbody tr:hover td {
  background: var(--bg-2);
}
.data-table tbody td.num { text-align: right; }
.cell-over { color: var(--acc); font-weight: 700; }
.cell-closed { color: var(--closed); font-weight: 700; }
.cell-empty { color: var(--empty); font-weight: 600; }
.cell-ok { color: var(--ok); font-weight: 600; }

/* --- Dossier Subpage Specifics --- */
.dossier-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}
@media (max-width: 820px) {
  .dossier-grid-2 { grid-template-columns: 1fr; }
}
.panel-box {
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: 1.05rem 1.1rem;
}
.panel-box h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 0.5rem;
}
.closed-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.45rem 1rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}
.closed-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.raion-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 1.25rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
}

/* --- Methodology & Editorial Notes --- */
.method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 2rem;
}
@media (max-width: 760px) {
  .method-grid { grid-template-columns: 1fr; }
}
.method-block h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.4rem;
}
.method-block p, .method-block li {
  font-size: 0.96rem;
  color: var(--mut);
}
.method-block ul {
  padding-left: 1.15rem;
  margin: 0.4rem 0 0;
}

/* --- Footer (Strictly bounded) --- */
.site-footer {
  border-top: 2px solid var(--fg);
  padding-block: 1.75rem 2.5rem;
  margin-top: 1.5rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--mut);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}
.footer-links a { color: var(--fg); font-weight: 600; }
.footer-links a:hover { color: var(--acc); }

/* --- SVG Semantic Fills & Strokes (Zero inline styles in HTML) --- */
.svg-bar {
  display: block;
  width: 100%;
  height: 0.72rem;
}
.svg-bar-lg {
  display: block;
  width: 100%;
  height: 0.85rem;
}
.svg-bar-tall {
  display: block;
  width: 100%;
  height: 1.05rem;
}
.svg-bg { fill: var(--bg-3); }
.svg-fill-over { fill: var(--acc-mark); }
.svg-fill-ok { fill: var(--ok-mark); }
.svg-fill-empty { fill: var(--empty-mark); }
.svg-fill-closed { fill: var(--closed-mark); }
.svg-fill-mid { fill: var(--mid-bar); }
.svg-fill-fg { fill: var(--fg); }
.svg-stroke-fg { stroke: var(--fg); fill: none; }
.svg-stroke-mut { stroke: var(--mut); fill: none; }
.svg-stroke-line { stroke: var(--line); fill: none; }
.svg-stroke-acc { stroke: var(--acc-mark); fill: none; }
.svg-stroke-closed { stroke: var(--closed-mark); fill: none; }
.svg-stroke-empty { stroke: var(--empty-mark); fill: none; }
.svg-stroke-ok { stroke: var(--ok-mark); fill: none; }
.svg-text-fg { fill: var(--fg); font-family: var(--font-ui); }
.svg-text-mut { fill: var(--mut); font-family: var(--font-ui); }
.svg-text-acc { fill: var(--acc); font-family: var(--font-ui); }
.svg-text-closed { fill: var(--closed); font-family: var(--font-ui); }

.dossier-spark-svg {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg);
  border: 1px solid var(--line-soft);
}
.teacher-seg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--mut);
  margin-top: 0.55rem;
}
.swatch-sq {
  display: inline-block;
  width: 0.68rem;
  height: 0.68rem;
  vertical-align: -1px;
  margin-right: 0.3rem;
}
.swatch-u2 { background: var(--ok-mark); }
.swatch-mid { background: var(--mid-bar); }
.swatch-o20 { background: var(--closed-mark); }

/* --- Accessibility & Reduced Motion --- */
.status-live {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .occ-fill { transition: none; }
}
@media (forced-colors: active) {
  .map-panel, .finder-box, .dossier-sheet, .table-wrap, .panel-box { border-color: CanvasText; }
  .occ-fill, .t-seg-o20, .t-seg-u2 { forced-color-adjust: none; }
}
