:root {
  --bg: #010205;
  --ink: #f4f6fb;
  --ink-dim: rgba(236, 240, 248, 0.62);
  --ink-faint: rgba(236, 240, 248, 0.34);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.28);
  --glass: rgba(8, 10, 16, 0.62);
  --star-warm: #ffd9a8;
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mark: "Cormorant Garamond", "Cormorant", "Didot", "Bodoni 72", "Iowan Old Style", Georgia, serif;
  --ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --star-x: 50vw;
  --star-y: 48vh;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--ui); font-weight: 400; font-size: 15px;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow: hidden; overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.7); outline-offset: 4px; border-radius: 6px; }

#space { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.55) 100%);
}

.eyebrow {
  margin: 0 0 0.45rem; font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--ink-faint);
}

/* ---------- Wordmark (shared by scene + timeline) ---------- */
.wordmark {
  position: fixed; left: 50%; top: clamp(1.5rem, 4vh, 2.6rem); z-index: 5; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.7rem;
  pointer-events: none; animation: fade-in 1.6s ease both 0.3s;
}
.wordmark-text {
  margin: 0 -0.42em 0 0;          /* cancel trailing tracking so it centres optically */
  font-family: var(--mark); font-weight: 500; font-size: clamp(0.98rem, 1.25vw, 1.2rem);
  letter-spacing: 0.42em; text-transform: uppercase; white-space: nowrap;
  color: rgba(246, 244, 238, 0.92);
  font-kerning: normal; text-rendering: geometricPrecision;
}
.wordmark-text .wm-the { font-size: 0.72em; letter-spacing: 0.5em; color: rgba(246, 244, 238, 0.6); margin-right: 0.1em; }
.wordmark-rule { width: 28px; height: 1px; background: linear-gradient(90deg, transparent, rgba(246, 244, 238, 0.45), transparent); }

/* ---------- Scene ---------- */
.scene { position: fixed; inset: 0; transition: opacity 0.5s ease; }
.scene.is-away { opacity: 0; pointer-events: none; }

.star {
  position: absolute; left: var(--star-x); top: var(--star-y);
  width: 120px; height: 120px; margin: -60px 0 0 -60px; padding: 0;
  border: 0; background: transparent; border-radius: 50%; cursor: pointer;
  transition: transform 0.6s var(--ease-out), opacity 0.4s ease;
  animation: arrive 2.2s var(--ease-out) backwards 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.star > span { position: absolute; border-radius: 50%; pointer-events: none; }
.star-core {
  inset: 49px;
  background: radial-gradient(circle, #fff 0%, #fffdf8 45%, var(--star-warm) 80%, rgba(255, 217, 168, 0) 100%);
  box-shadow: 0 0 10px 3px rgba(255, 250, 240, 0.95), 0 0 34px 10px rgba(255, 226, 190, 0.32), 0 0 90px 30px rgba(255, 226, 190, 0.08);
  animation: pulse 5.5s ease-in-out infinite;
}
.star-halo {
  inset: -60px;
  background: radial-gradient(circle, rgba(255, 240, 220, 0.16) 0%, rgba(255, 240, 220, 0.05) 30%, transparent 62%);
}
.star-rays {
  inset: -34px; border-radius: 0;
  background:
    linear-gradient(90deg, transparent 8%, rgba(255, 250, 242, 0.55) 50%, transparent 92%) center / 100% 1px no-repeat,
    linear-gradient(0deg, transparent 18%, rgba(255, 250, 242, 0.38) 50%, transparent 82%) center / 1px 76% no-repeat;
  opacity: 0.9;
}
.star-ring { display: none; }
.star:hover { transform: scale(1.06); }
.star:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.35); outline-offset: -26px; border-radius: 50%; }
/* precise flare on open */
.star.is-igniting { transition: transform 0.42s var(--ease-io), opacity 0.32s ease 0.2s; transform: scale(1.5); opacity: 0; }
.star.is-igniting .star-core { animation: none; box-shadow: 0 0 14px 5px #fff, 0 0 60px 22px rgba(255, 240, 220, 0.5); }
.star.is-igniting .star-rays { transform: scaleX(2.6) scaleY(0.4); transition: transform 0.42s var(--ease-io); }

.star-hint {
  position: absolute; left: var(--star-x); top: calc(var(--star-y) + 74px);
  transform: translateX(-50%); margin: 0; white-space: nowrap;
  font-size: 0.72rem; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint);
  animation: fade-in 1.4s ease both 1.8s; pointer-events: none;
}

/* ---------- Star → line transition ---------- */
.flash-line {
  position: fixed; left: 0; top: var(--star-y); width: 100%; height: 1px; margin-top: -0.5px;
  pointer-events: none; opacity: 0; transform-origin: var(--star-x) 50%; transform: scaleX(0);
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.55) 22%, #fff 50%, rgba(255,255,255,0.55) 78%, rgba(255,255,255,0) 100%);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.45);
}
.flash-line.is-on { opacity: 1; transform: scaleX(1); top: var(--wave-y, 50vh);
  transition: transform 0.62s cubic-bezier(0.16, 1, 0.3, 1), top 0.5s var(--ease-io) 0.22s, opacity 0.12s linear; }
.flash-line.is-off { opacity: 0; transform: scaleX(1); top: var(--wave-y, 50vh); transition: opacity 0.45s ease; }

/* ---------- Timeline ---------- */
.timeline {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  padding: clamp(1.2rem, 3vw, 2.2rem) 0 0;
  opacity: 0; transition: opacity 0.45s ease;
}
.timeline.is-open { opacity: 1; }
.timeline[hidden] { display: none; }

.tl-top {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0 clamp(1.2rem, 4vw, 3rem);
  opacity: 0; transition: opacity 0.6s ease 0.35s;
}
.timeline.is-open .tl-top { opacity: 1; }
.tl-title { margin: 0; font-family: var(--ui); font-weight: 500; font-size: 0.7rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-dim); }
.tl-status { margin: 0.25rem 0 0; color: var(--ink-faint); font-size: 0.76rem; letter-spacing: 0.02em; }

.tl-controls { display: flex; align-items: center; gap: 0.15rem; }
.ctl {
  min-width: 2rem; height: 2rem; padding: 0 0.55rem; border-radius: 999px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  font-size: 0.95rem; line-height: 1; color: var(--ink-dim); transition: color 0.2s, border-color 0.2s;
}
.ctl:hover { color: var(--ink); border-color: var(--line); }
.ctl-text { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.ctl-toggle[aria-pressed="true"] { color: var(--ink); border-color: var(--line-strong); }
.ctl-close { font-size: 0.85rem; margin-left: 0.4rem; }
.zoom-readout { min-width: 2.6rem; text-align: center; font-size: 0.7rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.tl-band { position: relative; flex: 0 0 auto; margin-top: clamp(0.8rem, 3vh, 2rem); }
.timeline:not(.has-year) .tl-band { margin-top: auto; margin-bottom: auto; padding-bottom: 6vh; }
.tl-viewport {
  position: relative; height: clamp(170px, 27vh, 250px); overflow: hidden;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.tl-viewport.is-dragging { cursor: grabbing; }
.tl-viewport:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.14); outline-offset: -4px; }
.tl-wave { position: absolute; left: 0; top: 52px; width: 100%; height: calc(100% - 52px); display: block; }
.tl-years { position: absolute; left: 0; right: 0; top: 0; height: 52px; }
.tl-pins { position: absolute; left: 0; right: 0; top: 52px; bottom: 0; pointer-events: none; }

.year-marker {
  position: absolute; top: 10px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0.25rem 0.5rem 0; border: 0; background: none; cursor: pointer;
  font-family: var(--ui); font-size: 0.78rem; font-weight: 400; letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums; color: var(--ink-faint); white-space: nowrap; transition: color 0.25s;
}
.year-marker::after { content: ""; width: 1px; height: 14px; background: linear-gradient(rgba(255,255,255,0.35), transparent); }
.year-marker:hover, .year-marker.is-focus { color: var(--ink-dim); }
.year-marker[aria-current="true"] { color: var(--ink); }
.year-marker.is-placeholder { font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; }
.year-marker.is-placeholder .ph-box { padding: 0.22rem 0.55rem; border: 1px dashed var(--line-strong); border-radius: 4px; }

.slot-edge { position: absolute; top: 10%; bottom: 10%; width: 0; border-left: 1px dashed rgba(255, 255, 255, 0.07); }

.pin {
  position: absolute; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
  pointer-events: auto; border: 0; padding: 0; cursor: pointer;
}
.pin::before { content: ""; position: absolute; inset: -10px; } /* larger hit area */
.pin.is-placeholder { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; background: var(--bg); border: 1px dashed rgba(255,255,255,0.7); box-shadow: none; }
.pin .pin-label {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase; white-space: nowrap; color: var(--ink-faint);
}
.pin .pin-label.is-below { bottom: auto; top: 14px; }

.tl-empty { margin: -0.6rem auto 1.2rem; text-align: center; max-width: min(90%, 30rem); }
.tl-empty .empty-title { margin: 0; font-family: var(--display); font-size: 1.15rem; font-weight: 300; }
.tl-empty .empty-sub { margin: 0.35rem 0 0; color: var(--ink-faint); font-size: 0.8rem; line-height: 1.55; }
.ph-tag {
  display: inline-block; margin-bottom: 0.55rem; padding: 0.14rem 0.45rem; border-radius: 3px;
  font-size: 0.58rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-dim); border: 1px dashed var(--line-strong);
}
.tl-hint { margin: 0.2rem 0 0; text-align: center; font-size: 0.68rem; letter-spacing: 0.1em; color: rgba(236,240,248,0.26); }

/* ---------- Year view ---------- */
.year-view {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: clamp(1rem, 2.5vh, 1.8rem) clamp(1.2rem, 4vw, 3rem) 3rem;
  opacity: 0; transform: translateY(16px); transition: opacity 0.45s ease, transform 0.6s var(--ease-out);
}
.year-view.is-open { opacity: 1; transform: none; }
.year-view[hidden] { display: none; }
.yv-head { display: flex; align-items: flex-start; gap: 1.2rem; margin-bottom: 1.2rem; }
.yv-back { flex: 0 0 auto; border-color: var(--line); margin-top: 0.15rem; }
.yv-title { margin: 0; font-family: var(--display); font-weight: 300; font-size: clamp(1.7rem, 3.4vw, 2.6rem); letter-spacing: -0.01em; outline: none; }
.yv-summary { margin: 0.3rem 0 0; color: var(--ink-dim); max-width: 46rem; line-height: 1.55; font-size: 0.9rem; }

.memories {
  list-style: none; margin: 0; padding: 0; max-width: 1280px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 1rem;
}
.memory {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--glass); border: 1px solid var(--line); border-radius: 12px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(10px); animation: card-in 0.6s var(--ease-out) forwards;
}
.memory.is-placeholder { border-style: dashed; border-color: rgba(255, 255, 255, 0.16); }
.memory.is-target { border-color: rgba(255, 255, 255, 0.6); }
.m-media { position: relative; aspect-ratio: 16 / 10; background: #05070b; overflow: hidden; }
.m-media img, .m-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-media.ph-media {
  display: grid; place-items: center; text-align: center; color: var(--ink-faint);
  font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 12px), #05070b;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}
.m-media.ph-animation::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.05) 50%, transparent 65%);
  background-size: 250% 100%; animation: shimmer 3.6s linear infinite;
}
.ph-glyph { display: block; font-size: 1.2rem; margin-bottom: 0.5rem; letter-spacing: 0; color: var(--ink-dim); }
.m-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.m-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.16rem 0.5rem; border-radius: 999px; font-size: 0.6rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid var(--line); color: var(--ink-dim);
}
.badge-ai { color: var(--ink); border-color: var(--line-strong); }
.badge-own { color: var(--ink-dim); }
.m-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.15rem; line-height: 1.25; }
.m-date { font-size: 0.7rem; color: var(--ink-faint); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.m-story { margin: 0; color: var(--ink-dim); line-height: 1.6; font-size: 0.88rem; white-space: pre-line; }
.m-provenance { margin: 0.2rem 0 0; font-size: 0.72rem; line-height: 1.5; color: var(--ink-faint); }
.memory.kind-story .m-body { padding-top: 1.2rem; }
.memory.kind-story .m-story { font-family: var(--display); font-size: 1rem; color: rgba(244, 246, 251, 0.8); }

.empty-year {
  grid-column: 1 / -1; padding: 2rem; text-align: center; border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 12px; color: var(--ink-dim); font-size: 0.88rem;
}
.empty-year strong { display: block; font-family: var(--display); font-weight: 300; font-size: 1.2rem; color: var(--ink); margin-bottom: 0.4rem; }
.howto { grid-column: 1 / -1; color: var(--ink-faint); font-size: 0.82rem; line-height: 1.6; }
.howto code { font-size: 0.78rem; color: var(--ink-dim); }

.noscript { position: fixed; inset: auto 0 2rem; text-align: center; color: var(--ink-dim); }

@keyframes pulse { 0%, 100% { opacity: 0.94; } 50% { opacity: 1; transform: scale(1.025); } }
@keyframes arrive { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes card-in { to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }

.hint-touch { display: none; }
@media (hover: none) { .hint-touch { display: inline; } .hint-mouse { display: none; } }

@media (max-width: 720px) {
  .wordmark-text { font-size: 0.92rem; letter-spacing: 0.34em; margin-right: -0.34em; }
  .timeline { padding-top: 4.6rem; }
  .tl-top { align-items: flex-start; }
  .tl-controls { width: 100%; justify-content: space-between; margin-left: -0.5rem; }
  .yv-head { flex-direction: column; gap: 0.6rem; }
  .tl-hint { padding: 0 1rem; }
  .pin-ph { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.2s !important; transition-delay: 0s !important; }
}
