/* samuel - visual system. Knots-derived tokens, own identity:
   warm sand paper, ink, one coral accent. */

:root {
  --ink: #241f19;
  --muted: #6b6357;
  --paper: #f7f2e7;
  --stage: #ece4d2;
  --panel: #fffdf6e0;
  --line: #241f1922;
  --accent: #c4502e;
  --accent-soft: #c4502e26;
  --radius: 14px;
  --shadow: 0 14px 34px -18px #2e241759;
  --shadow-soft: 0 1px 2px #2e241714, 0 6px 18px -8px #2e241738;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: ui-serif, "Iowan Old Style", Georgia, serif;
}
:root[data-theme="dark"] {
  --ink: #ece7db;
  --muted: #a39a8a;
  --paper: #17140f;
  --stage: #221e16;
  --panel: #26221ad9;
  --line: #ece7db24;
  --accent: #e07a52;
  --accent-soft: #e07a5229;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px));
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }

.icon { fill: none; stroke: currentColor; stroke-width: 1.8px; stroke-linecap: round; stroke-linejoin: round; width: 20px; height: 20px; }

/* Header: wordmark and theme toggle only. */
.site-head { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding-block: 20px; font-size: 14px; }
.mark { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 18px; letter-spacing: 0; }
.theme-toggle { position: relative; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: none; overflow: hidden; transition: border-color .15s; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .sun, .theme-toggle .moon { position: absolute; inset: 0; margin: auto; transition: transform 1.1s cubic-bezier(.34,1.2,.64,1), opacity .7s; }
.theme-toggle .sun { color: #e0a21b; }
.theme-toggle .moon { opacity: 0; transform: translateY(150%) rotate(-60deg); }
html[data-theme="dark"] .theme-toggle .sun { opacity: 0; transform: translateY(150%) rotate(90deg); }
html[data-theme="dark"] .theme-toggle .moon { opacity: 1; transform: none; }

.page { max-width: 1200px; margin: 0 auto; }

/* Promise block: one sentence, one sub, one honest line. */
.hero { display: grid; gap: 14px; margin: 6px 0 clamp(24px, 4vw, 44px); max-width: 46em; }
.hero h1 { margin: 0; font-family: var(--serif); font-size: clamp(1.9rem, 4.2vw, 3.2rem); font-weight: 600; line-height: 1.06; letter-spacing: -0.02em; text-wrap: balance; }
.hero .sub { margin: 0; font-size: clamp(1rem, 1.6vw, 1.15rem); color: var(--muted); max-width: 42em; text-wrap: pretty; }
.hero .how { margin: 0; font-size: 13.5px; color: var(--muted); }

/* Stage: the map is the hero. */
.stage { position: relative; background: var(--stage); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.map-wrap { position: relative; height: clamp(380px, 58vh, 620px); }
#map { position: absolute; inset: 0; background: var(--stage); }
.leaflet-tile-pane { filter: sepia(.26) saturate(.88) hue-rotate(-8deg) brightness(.99); }
html[data-theme="dark"] .leaflet-tile-pane { filter: sepia(.3) saturate(.7) hue-rotate(-10deg) brightness(.82) contrast(1.02); }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { background: var(--panel) !important; color: var(--muted); font-size: 10px; border-radius: 8px 0 0 0; padding: 1px 6px; }
.leaflet-control-attribution a { color: var(--muted); }

/* Gesture hint inside the stage. */
.hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500; background: var(--panel); color: var(--muted); font-size: 12.5px; padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow-soft); pointer-events: none; transition: opacity .5s; white-space: nowrap; max-width: calc(100% - 24px); }
@media (max-width: 560px) { .hint { white-space: normal; text-align: center; border-radius: 12px; } }
.hint.gone { opacity: 0; }

/* Caption card inside the stage: one sentence at a time. */
.caption { position: absolute; left: 14px; bottom: 14px; z-index: 500; max-width: min(460px, calc(100% - 28px)); background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-soft); padding: 10px 14px; pointer-events: none; }
.caption .step-sentence { margin: 0; font-size: 14.5px; line-height: 1.45; text-wrap: pretty; }
.caption .micro { margin: 4px 0 0; font-size: 11.5px; color: var(--muted); }

/* Poster cover until the first frame draws. */
.poster { position: absolute; inset: 0; z-index: 600; background: var(--stage); display: grid; place-content: center; gap: 8px; text-align: center; transition: opacity .45s; }
.poster.gone { opacity: 0; pointer-events: none; }
.poster .p-mark { font-family: var(--serif); font-style: italic; font-size: 30px; }
.poster .p-sub { font-size: 13px; color: var(--muted); }

/* Stage overlays driven by the timeline. */
.fx { position: absolute; z-index: 500; pointer-events: none; opacity: 0; transition: opacity .2s linear; }
.counter-card { top: 14px; right: 14px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-soft); padding: 12px 16px; text-align: right; }
.counter-card .big { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.counter-card .lbl { font-size: 11.5px; color: var(--muted); margin-top: 4px; max-width: 180px; }
.dots { display: grid; grid-template-columns: repeat(8, 9px); gap: 4px; margin-top: 8px; justify-content: end; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }
.readout { top: 14px; left: 14px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-soft); padding: 10px 14px; font-variant-numeric: tabular-nums; }
.readout .row { display: flex; justify-content: space-between; gap: 14px; font-size: 13px; }
.readout .row b { font-weight: 650; }
.readout .row .k { color: var(--muted); }
.epilogue-card { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100% - 32px)); background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.epilogue-card p { margin: 0 0 8px; font-size: 14.5px; }
.epilogue-card p:last-child { margin-bottom: 0; }
.epilogue-card .quiet { color: var(--muted); font-size: 13px; }

/* Map markers. */
.storm-dot { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
.storm-dot .swirl { width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(from 0deg, var(--accent) 0 40deg, transparent 40deg 120deg, var(--accent) 120deg 170deg, transparent 170deg 260deg, var(--accent) 260deg 320deg, transparent 320deg); opacity: .92; }
.storm-dot .eye { position: absolute; inset: 11px; border-radius: 50%; background: var(--panel); box-shadow: 0 0 0 1.5px var(--accent); }
.name-tag { background: var(--panel); color: var(--ink); border-radius: 8px; box-shadow: var(--shadow-soft); padding: 3px 9px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.name-tag .alt { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.date-chip { background: var(--panel); border-radius: 7px; padding: 1px 7px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.place-tag { font-size: 11.5px; color: var(--muted); background: var(--panel); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }

/* Dock: the timeline controls. */
.dock { display: grid; gap: 10px; padding: 14px 16px 16px; }
.rail-row { display: flex; align-items: center; gap: 12px; }
.play-btn { flex: none; width: 46px; height: 46px; border: none; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-content: center; box-shadow: var(--shadow-soft); transition: transform .12s; }
.play-btn:hover { transform: scale(1.06); }
.play-btn svg { fill: currentColor; stroke: none; width: 22px; height: 22px; }
.rail { position: relative; flex: 1; height: 44px; display: flex; align-items: center; }
.rail-track { position: absolute; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--line); }
.played { position: absolute; left: 0; height: 4px; border-radius: 2px; background: var(--accent); }
.ticks { position: absolute; left: 0; right: 0; top: 0; bottom: 0; margin: 0; padding: 0; list-style: none; z-index: 3; pointer-events: none; }
.ticks li { position: absolute; top: 0; bottom: 0; width: 0; }
.ticks button { pointer-events: auto; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 44px; height: 44px; border: none; border-radius: 50%; background: transparent; display: grid; place-content: center; }
.ticks button::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.ticks button:hover::after, .ticks button:focus-visible::after { transform: scale(1.4); background: var(--accent); }
.ticks button[aria-current="step"]::after { background: var(--accent); transform: scale(1.5); }
.scrub { position: absolute; left: 0; right: 0; top: 0; bottom: 0; width: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 2; }
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.meta-left, .meta-right { display: flex; align-items: center; gap: 10px; }
.clock, .step-num { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.speeds { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.speeds label { padding: 4px 10px; min-height: 44px; display: inline-flex; align-items: center; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.speeds input { position: absolute; opacity: 0; pointer-events: none; }
.speeds label:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.pill-btn { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 4px 12px; min-height: 44px; font-size: 12.5px; color: var(--muted); }
.pill-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 650; }
.pill-btn:hover, .speeds label:hover { color: var(--accent); }
.step-sentence-dock { margin: 0; font-size: 14px; color: var(--ink); min-height: 1.5em; }

@media (max-width: 560px) {
  .clock, .speeds { display: none; }
  .map-wrap { height: 66vh; }
  .counter-card .big { font-size: 30px; }
}

/* Sections after the experience. */
.sections { max-width: 1200px; margin: clamp(28px, 5vw, 52px) auto 0; display: grid; gap: clamp(22px, 3.4vw, 36px); }
.sections section { max-width: 46em; }
.sections h2 { margin: 0 0 8px; font-family: var(--serif); font-weight: 600; font-size: 1.25rem; }
.sections p { margin: 0 0 8px; font-size: 15px; }
.sections ul { margin: 0; padding-left: 1.1em; font-size: 15px; }
.sections li { margin-bottom: 6px; }
.quiet { color: var(--muted); }
.step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-width: none; }
.step-list button { display: flex; gap: 12px; width: 100%; text-align: left; background: none; border: none; border-radius: 10px; padding: 8px 10px; font-size: 14.5px; color: var(--muted); transition: background .15s, color .15s; }
.step-list button:hover { background: var(--accent-soft); }
.step-list button.current { color: var(--ink); background: var(--accent-soft); }
.step-list .n { flex: none; width: 22px; font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 650; }
details.refs { max-width: 46em; }
details.refs summary { cursor: pointer; font-family: var(--serif); font-weight: 600; font-size: 1.1rem; padding: 6px 0; }
details.refs ul { font-size: 14px; }
details.refs a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
details.refs a:hover { color: var(--accent); }
.site-foot { max-width: 1200px; margin: 40px auto 0; font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
