/* Second Exposure — a visualization of a personal deja vu log.
   Identity: double-exposure photography. Type and key marks carry a faint
   offset ghost twin. Periwinkle = presence (an episode happened).
   Amber = repetition ONLY (calendar echoes, the Interalpen pair, the
   18.7-hour double). Never elsewhere. */

:root {
  color-scheme: dark;
  --bg: #0f0e14;
  --surface: #17161f;
  --line: #26242f;
  --text: #eae7f2;
  --muted: #9a94ac;

  /* validated data-mark pair (CVD dE 26.5, contrast >= 3:1 on --bg) */
  --presence: #8b7de8;
  --echo: #b5862f;
  /* lighter tints for accent TYPE and chips only, never for marks */
  --presence-text: #a99df2;
  --echo-text: #e4b863;

  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 40rem;
  --wide: 64rem;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 340;
}

a { color: var(--presence-text); text-underline-offset: 3px; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; }
.prose { max-width: var(--measure); }

/* ---------- ghost device ---------- */
.ghosted { position: relative; display: inline-block; }
.ghosted::before {
  content: attr(data-ghost);
  position: absolute;
  left: 0.045em;
  top: 0.05em;
  width: 100%;
  color: var(--presence-text);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}
.ghosted > span { position: relative; z-index: 1; }
.hero .ghosted::before { animation: drift 20s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate(0, 0); }
  to   { transform: translate(0.05em, -0.04em); }
}
@media (prefers-reduced-motion: reduce) {
  .hero .ghosted::before { animation: none; }
  .chord { animation: none !important; }
  .flash { animation: none !important; }
}

/* ---------- type ---------- */
h1 {
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 1.02;
  font-weight: 560;
  margin: 0 0 1rem;
  letter-spacing: -0.015em;
}
h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 520;
  line-height: 1.15;
  margin: 0 0 0.75rem;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.lede { color: var(--muted); font-size: 1.15rem; max-width: var(--measure); }
.note {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  max-width: var(--measure);
}
.caption {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.75rem;
}
.caption strong { color: var(--text); font-weight: 500; }

/* ---------- hero ---------- */
.hero { padding: 5rem 0 2.5rem; }
.hero .premise {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 2.25rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem 0.8rem;
}
.stat .n {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 560;
  line-height: 1.1;
  display: block;
}
.stat .l {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- sections ---------- */
section { padding: 3.25rem 0 1rem; }
.viz { margin: 1.5rem 0 0.5rem; }
.viz svg { display: block; width: 100%; height: auto; }
.centered { display: flex; justify-content: center; }

/* svg shared text styles are set via classes used by main.js */
.svg-label { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }
.svg-label.strong { fill: var(--text); }
.svg-annot { font-family: var(--font-mono); font-size: 11px; fill: var(--echo-text); }

/* ---------- echo pairs ---------- */
.echoes { margin-top: 2.5rem; display: grid; gap: 1.75rem; }
.echo-pair { position: relative; }
.echo-pair .date-mono {
  text-align: center;
  font-family: var(--font-mono);
  color: var(--echo-text);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  margin-bottom: 0.6rem;
}
.echo-pair .halves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 2rem;
  position: relative;
}
.echo-pair .halves::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--echo);
  opacity: 0.6;
}
.echo-half { padding: 0.25rem 0; }
.echo-half:first-child { text-align: right; }
.echo-half .when { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); display: block; margin-bottom: 0.25rem; }
.echo-half .what { font-size: 0.98rem; }
.echo-foot {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--echo-text);
  margin-top: 0.6rem;
}
@media (max-width: 600px) {
  .echo-pair .halves { grid-template-columns: 1fr; gap: 0.75rem; }
  .echo-pair .halves::before { display: none; }
  .echo-half:first-child { text-align: left; border-bottom: 1px solid var(--line); padding-bottom: 0.75rem; }
}

/* ---------- weekday strip ---------- */
.weekdays {
  display: flex;
  gap: 1.4rem;
  align-items: flex-end;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.wd { text-align: center; }
.wd .dots { display: flex; flex-direction: column-reverse; gap: 4px; align-items: center; min-height: 132px; justify-content: flex-start; }
.wd .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--presence); }
.wd.hot .dot { background: var(--presence-text); }
.wd .lbl { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); margin-top: 0.5rem; }
.wd.hot .lbl { color: var(--text); }

/* ---------- away list (mobile fallback) ---------- */
.away-list { list-style: none; margin: 1rem 0 0; padding: 0; display: none; }
.away-list li {
  display: flex;
  gap: 0.8rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.away-list .arc-glyph { flex: none; width: 18px; height: 14px; }
.away-list .place { font-weight: 520; white-space: nowrap; }
.away-list .meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
@media (max-width: 640px) {
  #arcs { display: none; }
  .away-list { display: block; }
}

/* ---------- ledger ---------- */
.year-marker {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 520;
  margin: 2.25rem 0 0.75rem;
}
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li {
  display: grid;
  grid-template-columns: 15ch 1fr;
  gap: 1rem;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--line);
  border-radius: 6px;
}
.ledger .stamp {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.9;
}
.ledger .ctx { font-size: 0.98rem; }
.ledger .meta { margin-top: 0.15rem; }
.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  margin-right: 0.35rem;
}
.echo-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--echo-text);
  background: none;
  border: 1px solid var(--echo);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  cursor: pointer;
}
.flash { animation: flashghost 1.6s ease-out 2; }
@keyframes flashghost {
  0% { background: none; }
  30% { background: rgba(181, 134, 47, 0.18); }
  100% { background: none; }
}
@media (max-width: 600px) {
  .ledger li { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* ---------- tooltip ---------- */
.tip {
  position: absolute;
  z-index: 10;
  max-width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  pointer-events: none;
  box-shadow: none;
}
.tip .when { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); display: block; }

/* ---------- footer / colophon ---------- */
/* the rule line sits above the ledger instead of above the footer */
.ledger-section {
  border-top: 1px solid var(--line);
  margin-top: 4.5rem;
}

footer {
  margin-top: 3.5rem;
  padding: 1.5rem 0 3rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}
footer p { margin: 0 0 0.4rem; }
footer a { color: var(--muted); }

/* ---------- the people (reuses the weekday dot-stack) ---------- */
.people .dots { min-height: 0; }
.people { row-gap: 2rem; margin-top: 2.5rem; justify-content: center; }
.people .dot { cursor: pointer; }
.weekdays.people + .caption { margin-top: 1.5rem; }

/* ---------- the hours: dial and weekday strip side by side ---------- */
.hours-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.hours-row .viz { flex: 0 1 440px; min-width: 300px; margin: 0; }
.hours-row .weekdays { margin-top: 0; flex: 0 0 auto; }
.hours-days {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hours-days .caption { margin-top: 1.25rem; text-align: center; }
