/* story.css: "My school story" (story.html, js/story.js). Class prefix st-.
   Colors are the tokens in css/pages.css (light and dark follow html[data-theme]) plus the few below.
   Layout: map stage + story card side by side from 821px, stacked on phones. */

.st-page {
  --st-tint: #EEF4FB; --st-line: var(--accent); --st-pin: #1F4A72; --st-pin-ink: #fff; --st-home: #F2B33D; --st-home-ink: #14324F;
}
:root[data-theme="dark"] .st-page { --st-tint: #1B2F43; --st-pin: #2F6DAA; }

.st-intro { padding-top: 26px; }
.st-intro h1 { margin: 6px 0 8px; font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.15; text-wrap: balance; }
.st-lead { margin: 0 0 10px; color: var(--muted); max-width: 70ch; font-size: 1.02rem; line-height: 1.55; }
.st-privacy { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 16px; font-size: .86rem; color: var(--muted); max-width: 72ch; }
.st-privacy svg { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.st-start { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.st-form { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.st-label { font-weight: 700; font-size: .9rem; color: var(--text); }
.st-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.st-row input, .st-row select { flex: 1 1 240px; min-width: 0; min-height: 44px; }
.st-row .btn { min-height: 44px; }
.btn svg { flex: none; }
.btn-accent svg path { fill: currentColor; stroke: none; }
.st-status { margin: 0; min-height: 1.2em; font-size: .9rem; color: var(--muted); }
.st-status.is-err { color: var(--bad); font-weight: 600; }

/* ---------------------------------------------------------------- the story */
.st-story { margin-top: 22px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-sm); scroll-margin-top: 12px; }
.st-story[hidden] { display: none; }
.st-stage { position: relative; min-height: 520px; background: var(--surface-2); }
.st-map { position: absolute; inset: 0; background: var(--surface-2); }
.st-hud { position: absolute; left: 12px; top: 12px; z-index: 800; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; max-width: calc(100% - 70px); }
.st-hud span { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px; font-size: .78rem; font-weight: 700;
  padding: 3px 10px; box-shadow: var(--shadow-sm); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-hud span:empty { display: none; }

.st-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.st-dots { display: flex; gap: 2px; flex-wrap: wrap; margin: -6px 0 0 -4px; }
.st-dot { width: 32px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; border-radius: 6px; }
.st-dot span { width: 26px; height: 6px; border-radius: 3px; background: var(--track); transition: background .3s; }
.st-dot.is-done span { background: color-mix(in srgb, var(--gold) 55%, var(--track)); }
.st-dot[aria-current="step"] span { background: var(--gold); height: 8px; }
.st-dot:hover span { background: var(--gold); }

.st-live { display: flex; flex-direction: column; gap: 4px; }
.st-eyebrow { margin: 0; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.st-title { margin: 0; font-size: 1.35rem; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.st-say { margin: 0; color: var(--text); line-height: 1.5; }
.st-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.st-body p { margin: 0; }
.st-sub { font-weight: 700; color: var(--muted); font-size: .86rem; }
.st-small { font-size: .8rem; color: var(--muted); line-height: 1.45; }
.st-small a, .st-links a, .st-list a { color: var(--accent); font-weight: 600; }
.st-links { font-size: .9rem; line-height: 2; }
.st-links a { display: inline-block; min-height: 24px; }
.st-note { font-size: .86rem; }

.st-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.st-fact { background: var(--st-tint); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.st-fact b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; }
.st-fact small { display: block; color: var(--muted); font-size: .76rem; line-height: 1.35; }

.st-strip { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.st-strip-say { font-size: .88rem; }
.st-strip .mc-strip { padding: 0 6px; box-sizing: border-box; }
.st-strip .mc-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; font-size: .74rem; color: var(--muted); }
.st-strip .mc-legend > span { display: inline-flex; align-items: center; gap: 4px; }

.st-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 2px 12px; font-size: .9rem; }
.st-list li { min-height: 28px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.st-list a { overflow-wrap: anywhere; padding: 2px 0; }
.st-g { color: var(--muted); font-size: .76rem; white-space: nowrap; }

.st-dates { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: .92rem; }
.st-dates li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 10px; }
.st-dates b { font-variant-numeric: tabular-nums; color: var(--ink); }
.st-tent { color: var(--muted); font-size: .8rem; }
.st-row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.st-row-btns .btn { min-height: 44px; padding: 8px 14px; font-size: .9rem; }

.st-share { display: flex; flex-direction: column; gap: 6px; background: var(--st-tint); border-radius: 12px; padding: 12px; }
.st-share input[type=text] { font-size: .82rem; }
.st-check { display: flex; gap: 8px; align-items: center; font-size: .9rem; min-height: 32px; cursor: pointer; }
.st-check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }

.st-agent { display: flex; gap: 12px; align-items: center; border: 1px solid var(--border); border-left: 4px solid var(--gold); border-radius: 12px; padding: 10px 12px; }
.st-agent img { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.st-agent > div { display: flex; flex-direction: column; min-width: 0; }
.st-agent-k { font-size: .74rem; color: var(--muted); }
.st-agent b { color: var(--ink); overflow-wrap: anywhere; }
.st-agent a { color: var(--accent); font-weight: 600; }
.st-agent small { color: var(--muted); font-size: .74rem; }

.st-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.st-controls .btn { min-height: 44px; padding: 8px 16px; flex: 1 1 auto; }
.st-controls .btn[disabled] { opacity: .45; }
.st-controls svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.st-keys { margin: 0; font-size: .74rem; color: var(--muted); }

/* ---------------------------------------------------------------- map marks */
.st-map .leaflet-overlay-pane path.st-bound { stroke: var(--accent); fill: var(--accent); }
.st-map .leaflet-overlay-pane path.st-line { stroke: var(--st-line); opacity: 0; transition: opacity .6s; }
.st-map .leaflet-overlay-pane path.st-line.is-on { opacity: .95; animation: st-dash 1.6s linear infinite; }
@keyframes st-dash { to { stroke-dashoffset: -28; } }
.st-pin { background: none; border: 0; }
.st-pin-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--st-pin); color: var(--st-pin-ink);
  font: 800 13px var(--font); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform .3s, background .3s; box-sizing: border-box; }
.st-pin.st-mini .st-pin-dot { transform: scale(.75); }
.st-pin.is-on .st-pin-dot { background: var(--gold); color: #14324F; transform: scale(1.18); }
.st-pin.st-mini.is-on .st-pin-dot { transform: scale(.95); }
.st-pin-lab { position: absolute; left: 36px; top: 4px; white-space: nowrap; font: 700 12.5px var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; box-shadow: var(--shadow-sm); display: none; }
.st-pin.is-on .st-pin-lab { display: block; }
.st-pin.st-mini .st-pin-lab, .st-map.st-many .st-pin.st-school .st-pin-lab { display: none; }
.st-pin.st-home .st-pin-dot { background: var(--st-home); color: var(--st-home-ink); border-color: #14324F; }
.st-pin.st-home .st-pin-dot svg { width: 17px; height: 17px; fill: currentColor; }
.st-pin.st-home .st-pin-lab { display: block; }
.st-map .leaflet-control-attribution { font-size: 10px; }
:root[data-theme="dark"] .st-map .leaflet-control-attribution { background: rgba(18,31,45,.85); color: var(--muted); }
:root[data-theme="dark"] .st-map .leaflet-control-attribution a { color: var(--accent); }
:root[data-theme="dark"] .st-map .leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--border); }

/* ---------------------------------------------------------------- about */
.st-about { margin-top: 28px; }
.st-about h2 { font-size: 1.1rem; margin: 0 0 8px; }
.st-about ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--text); font-size: .9rem; }
.st-about b { color: var(--ink); }

@media (max-width: 820px) {
  .st-story { grid-template-columns: minmax(0, 1fr); }
  .st-stage { min-height: 320px; }
}
@media (max-width: 420px) {
  .st-card { padding: 14px; }
  .st-start { padding: 14px; }
  .st-row .btn { flex: 1 1 100%; }
  .st-dates li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .st-controls .btn { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .st-map .leaflet-overlay-pane path.st-line.is-on { animation: none; }
  .st-pin-dot, .st-dot span, .st-map .leaflet-overlay-pane path.st-line { transition: none; }
}
@media print {
  .st-controls, .st-keys, .st-dots, .st-start { display: none !important; }
}
