/* ---------- Colors, fonts and spacing used everywhere ---------- */
:root {
  --bg: #0b0b0a;      /* background */
  --fg: #ecebe4;      /* main text */
  --dim: #8b8a83;     /* dates, labels */
  --faint: #2b2b28;   /* the timeline line */
  --rec: #ff3b30;     /* the REC dot */
  --osd: "VT323", ui-monospace, "Cascadia Mono", monospace; /* camcorder font */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --rail-x: 64px;     /* how far the timeline line sits from the left */
  --ease: cubic-bezier(0.65, 0, 0.2, 1);
}

* { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 var(--sans); }
body.locked { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
.osd-text { font-family: var(--osd); font-size: 20px; line-height: 1; letter-spacing: 0.04em; }

/* ---------- Top bar ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 16px 28px;
  background: linear-gradient(var(--bg) 60%, transparent);
}
.site-title { font-family: var(--osd); font-size: 26px; line-height: 1; letter-spacing: 0.06em; }
.osd { font-family: var(--osd); font-size: 18px; line-height: 1.05; text-align: right; }

/* ---------- The timeline (shared by both zoom levels) ---------- */
.overview, .capsule { padding: 0 16px 96px; }
.timeline { position: relative; max-width: 640px; margin: 0 auto; }
.rail { position: absolute; left: var(--rail-x); top: 0; bottom: 0; width: 1px; background: var(--faint); }

/* A capsule's span on the line, with a tick for every tape */
.strip { position: absolute; left: calc(var(--rail-x) - 6px); top: 0; bottom: 0; width: 13px; }
.segment { position: absolute; left: 6px; top: 0; bottom: 0; width: 1px; background: var(--fg); }
.segment::before, .segment::after {
  content: ""; position: absolute; left: -4px; width: 9px; height: 1px; background: var(--fg);
}
.segment::before { top: 0; }
.segment::after { bottom: 0; }
.mark { position: absolute; transform: translateY(-50%); }
.mark.video { left: 0; width: 13px; height: 1px; background: var(--fg); }
.mark.photo { left: 10px; width: 5px; height: 5px; border: 1px solid var(--dim); }
.mark.hot.video { background: var(--rec); }
.mark.audio { left: 10px; width: 5px; height: 5px; border: 1px solid var(--dim); border-radius: 50%; }
.mark.hot.photo, .mark.hot.audio { border-color: var(--rec); }

/* Unsure (circa) dates: a fainter marker, and a soft band over the month or year it could be in */
.mark.circa { opacity: 0.45; }
.mark.circa.hot { opacity: 1; }
.range { position: absolute; left: 3px; width: 7px; background: rgba(236, 235, 228, 0.16); }

.side-label {
  position: absolute; left: 0; width: calc(var(--rail-x) - 14px);
  transform: translateY(-50%);
  font-family: var(--osd); font-size: 18px; line-height: 1; text-align: right; color: var(--dim);
}
.side-label .year { display: block; color: var(--fg); }

/* ---------- Zoomed out ---------- */
.ov-capsule { position: absolute; left: 0; right: 0; display: block; }
.ov-info { padding-left: calc(var(--rail-x) + 22px); }
.ov-title { margin: -3px 0 0; font-size: 17px; font-weight: 500; line-height: 1.25; }
.ov-capsule:hover .ov-title,
.ov-capsule:focus-visible .ov-title { text-decoration: underline; text-underline-offset: 4px; }

/* Zooming back out: the line grows back from the capsule you left, everything else fades in */
.overview .rail { transition: transform 0.9s var(--ease); }
.overview .ov-capsule, .overview .ov-info, .overview .side-label { transition: opacity 0.6s ease; }
.overview.returning .rail { transition: none; }
.overview.returning .ov-capsule:not(.anchor), .overview.returning .anchor .ov-info,
.overview.returning .side-label { opacity: 0; transition: none; }

.meta { margin: 4px 0 0; font-family: var(--osd); font-size: 18px; line-height: 1.15; color: var(--dim); }
.rec { color: var(--rec); }
.rec::before { content: "● "; animation: blink 1.6s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Zoomed in ---------- */
.cap-head, .reflection { max-width: 640px; margin: 0 auto; padding-left: calc(var(--rail-x) + 22px); }
.cap-head { margin-bottom: 40px; }
.back { display: inline-block; margin-bottom: 20px; color: var(--dim); }
.back:hover { color: var(--fg); }
.cap-title { margin: 0; font-size: 28px; font-weight: 500; line-height: 1.15; }
.playlist {
  display: inline-block; margin-top: 12px;
  font-family: var(--osd); font-size: 18px; border-bottom: 1px solid var(--faint);
}
.playlist:hover { border-color: var(--fg); }

.cap-track { transition: height 0.8s var(--ease), transform 0.8s var(--ease); }

.item {
  position: absolute; left: calc(var(--rail-x) + 22px); right: 0;
  transform: translateY(-50%);
  display: flex; align-items: baseline; gap: 10px; padding: 6px 0;
}
.item .no { flex: none; width: 22px; font-family: var(--osd); font-size: 18px; color: var(--dim); }
.item .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .date { flex: none; font-family: var(--osd); font-size: 18px; color: var(--dim); }
.item.photo .title, .item.audio .title { color: var(--dim); }
.item:hover .title, .item:focus-visible .title { text-decoration: underline; text-underline-offset: 4px; }

.reflection { margin-top: 56px; }
.reflection h2 { margin: 0 0 14px; font-weight: normal; color: var(--dim); }
.reflection p { max-width: 34em; margin: 0 0 1em; }

/* While zooming, only the line and its ticks are visible; the words fade in after */
.capsule .cap-head, .capsule .item, .capsule .side-label, .capsule .reflection { transition: opacity 0.5s ease; }
.capsule.zooming .cap-head, .capsule.zooming .item,
.capsule.zooming .side-label, .capsule.zooming .reflection { opacity: 0; transition: none; }
/* Zooming out is the reverse: the words fade first, quickly */
.capsule.unzooming .cap-head, .capsule.unzooming .item,
.capsule.unzooming .side-label, .capsule.unzooming .reflection { opacity: 0; transition: opacity 0.25s ease; }

/* ---------- One tape (video or photo) ---------- */
.tape {
  position: fixed; inset: 0; z-index: 10;
  overflow-y: auto; padding: 76px 16px 48px; background: var(--bg);
}
.tape-inner { max-width: 520px; margin: 0 auto; }

.media { position: relative; width: 100%; margin: 0 auto; background: #000; }
.media.vertical { aspect-ratio: 9 / 16; width: min(100%, calc(68vh * 9 / 16)); }
.media.classic { aspect-ratio: 4 / 3; }
.media.wide { aspect-ratio: 16 / 9; }
.media.photo { background: none; }
.media iframe, .media video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media video { object-fit: contain; background: #000; }
.media:fullscreen { width: 100%; height: 100%; aspect-ratio: auto; background: #000; }
.media img { display: block; width: 100%; max-height: 70vh; object-fit: contain; }
.placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center;
  border: 1px solid var(--faint); font-family: var(--osd); font-size: 20px; color: var(--dim);
}
.media.photo .placeholder { position: relative; aspect-ratio: 4 / 3; }

/* A recording: a quiet panel with the audio player underneath */
.media.audio { background: none; }
.audio-screen {
  display: grid; place-items: center; aspect-ratio: 16 / 9; padding: 16px;
  border: 1px solid var(--faint); text-align: center; color: var(--dim);
}
.media audio { display: block; width: 100%; margin-top: 12px; color-scheme: dark; }

.tape-info { margin-top: 22px; }
.tape-kicker, .tape-date { color: var(--dim); }
.tape-title { margin: 8px 0 6px; font-size: 22px; font-weight: 500; line-height: 1.25; }
.tape-note { margin-top: 20px; }
.tape-note p { margin: 0 0 1em; }
.tape-nav { display: grid; grid-template-columns: 1fr auto 1fr; margin-top: 36px; }
.tape-nav button:first-child { justify-self: start; }
.tape-nav button:last-child { justify-self: end; }
.tape-nav button:hover:not(:disabled) { color: var(--dim); }
.tape-nav button:disabled { opacity: 0.25; cursor: default; }

/* Shown instead of the site when capsules.js has a typo */
.oops { max-width: 34em; margin: 64px auto; padding: 0 16px; font-family: var(--osd); font-size: 22px; line-height: 1.3; color: var(--rec); }

@media (prefers-reduced-motion: reduce) {
  .cap-track, .overview .rail { transition: none; }
  .rec::before { animation: none; }
}
