/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 5rem 1.5rem 6rem;
}

.timeline::before,
.timeline .progress {
  content: "";
  position: absolute;
  top: 0;
  /* the spine ends at the finale dot (set by js/timeline.js) so it never runs through the closing words */
  bottom: var(--spine-end, 0px);
  left: var(--spine);
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.12);
}

.timeline .progress {
  bottom: auto;
  height: 0;
  background: linear-gradient(var(--accent-soft), var(--accent));
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.6);
}

.year {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin: 5rem 0 3rem;
  scroll-margin-top: 4.5rem;
}
.year:first-child { margin-top: 0; }

.year h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.5rem, 9vw, 6.5rem);
  line-height: 1;
  padding: 0.15em 0.35em;
  background: var(--ink);
  background: linear-gradient(160deg, #031f45, #052c5e);
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  color: transparent;
  background-clip: padding-box;
  -webkit-text-stroke: 1px var(--accent);
  transition: color 0.8s ease;
}
.year.lit h2 { color: var(--accent); }

.year small {
  position: absolute;
  top: 100%;
  margin-top: 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.memory {
  position: relative;
  width: calc(50% - 3.5rem);
  margin-bottom: 3rem;
}

.memory.left  { margin-right: auto; }
.memory.right { margin-left: auto; }

/* follow-on memories in the same year overlap upward for a staggered rhythm */
.memory + .memory { margin-top: -6rem; }

.memory::before {
  content: "";
  position: absolute;
  top: 2.5rem;
  width: 3.5rem;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
}
.memory.left::before  { left: 100%; transform: scaleX(-1); }
.memory.right::before { right: 100%; }

.memory::after {
  content: "";
  position: absolute;
  top: calc(2.5rem - 6px);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.12);
}
.memory.left::after  { left: calc(100% + 3.5rem - 6.5px); }
.memory.right::after { right: calc(100% + 3.5rem - 6.5px); }

.card {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: zoom-in;
}

.frame {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: var(--paper);
  padding: 10px 10px 0;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: transform 0.5s cubic-bezier(.2,.7,.2,1), box-shadow 0.5s;
}

.frame img {
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: cover;
  border-radius: 2px;
  filter: saturate(0.92) contrast(1.02);
  transition: filter 0.5s, transform 0.8s cubic-bezier(.2,.7,.2,1);
}

.frame .tag {
  display: block;
  padding: 0.55rem 0.2rem 0.65rem;
  font-family: var(--serif);
  font-size: 1rem;
  font-style: italic;
  color: #6b5a3a;
  letter-spacing: 0.04em;
}

.card:hover .frame,
.card:focus-visible .frame {
  transform: translateY(-6px) rotate(var(--tilt, 0deg));
  box-shadow: 0 40px 70px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--accent-soft);
}
.card:hover img { filter: saturate(1.05) contrast(1.04); transform: scale(1.03); }
.card:focus-visible { outline: none; }
.card:focus-visible .frame { outline: 2px solid var(--accent); outline-offset: 4px; }

.caption {
  margin-top: 1rem;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  line-height: 1.4;
  color: var(--text);
}

/* reveal on scroll (only once JS has marked the page as ready) */
.js .memory {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(.2,.7,.2,1);
}
.js .memory.left  { transform: translate(-30px, 40px); }
.js .memory.right { transform: translate(30px, 40px); }
.js .memory.in { opacity: 1; transform: none; }

.finale {
  position: relative;
  z-index: 1;
  text-align: center;
  padding-top: 4rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  color: var(--accent);
}

.finale::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.15), 0 0 40px var(--accent);
}

@media (max-width: 760px) {
  :root { --spine: 1.5rem; }
  .timeline { padding: 3.5rem 1rem 4rem 3.25rem; }
  .timeline::before, .timeline .progress { left: 1.5rem; }
  .year { justify-content: flex-start; margin: 3.5rem 0 2rem -2.6rem; }
  .year h2 { font-size: 3rem; }
  .year small { left: 0.8rem; }
  .memory, .memory.left, .memory.right { width: 100%; margin: 0 0 2.5rem; }
  .memory + .memory { margin-top: 0; }
  .memory.left::before, .memory.right::before { left: auto; right: 100%; width: 1.75rem; transform: none; }
  .memory.left::after, .memory.right::after { left: auto; right: calc(100% + 1.75rem - 6.5px); }
  .js .memory.left, .js .memory.right { transform: translateY(30px); }
}

@media (prefers-reduced-motion: reduce) {
  .js .memory { opacity: 1; transform: none; }
}
