:root {
  color-scheme: light;
  --bg: #eceeef;
  --bg-accent: #f5f6f6;
  --surface: #f7f8f8;
  --surface-strong: #e4e6e7;
  --surface-contrast: #1b1c1d;
  --text: #1a1b1c;
  --muted: #63666a;
  --border: #313436;
  --accent: #797d80;
  --accent-strong: #4b4e50;
  --shadow: 0 20px 45px rgba(20, 21, 22, 0.08);
  --transition-in: 1000ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-out: 1500ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition: 420ms ease;

  /* Reveal timing: the year always finishes fading out before the
     photo starts fading in (sequential, never simultaneous). Leaving
     always reverses in the opposite order and takes exactly 1.5x as
     long as revealing. */
  --year-in-dur: 480ms;
  --year-in-delay: 0ms;
  --media-in-dur: 680ms;
  --media-in-delay: 520ms;
  --media-out-dur: 1020ms;
  /* 680 * 1.5 */
  --media-out-delay: 0ms;
  --year-out-dur: 720ms;
  /* 480 * 1.5 */
  --year-out-delay: 1020ms;
  /* starts once the photo has fully faded out */
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f10;
  --bg-accent: #161718;
  --surface: #18191a;
  --surface-strong: #232425;
  --surface-contrast: #f1f2f2;
  --text: #f2f3f3;
  --muted: #a4a7aa;
  --border: #dcdedf;
  --accent: #9a9d9f;
  --accent-strong: #cfd1d2;
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, var(--bg-accent) 0, transparent 28%),
    var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
}

img {
  max-width: 100%;
  display: block;
}

button,
a {
  font: inherit;
}

.site-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 36px) 56px;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: inherit;
  text-decoration: none;
}

.brand__name {
  font-size: clamp(0.95rem, 1.8vw, 1.22rem);
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.topbar__actions {
  position: relative;
}

.menu-button {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition);
  opacity: 0.95;
}

.menu-button:hover,
.menu-button.is-open {
  transform: translateY(-1px);
  opacity: 1;
}

.menu-button span {
  display: block;
  width: 16px;
  height: 1px;
  margin: 0 auto;
  background: var(--text);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.menu-panel {
  /* position relative to .topbar__actions so it appears under the hamburger */
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 144px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.12);
  display: none;
  z-index: 1000;
  transform-origin: top right;
}

.menu-panel.is-open {
  display: block;
}

.theme-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 4px 0;
  font-size: 0.92rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.theme-toggle__icon {
  font-size: 1rem;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(10px, 1.3vw, 18px);
  align-items: start;
}

.timeline-card {
  /* Enforce landscape aspect ratio so content remains 16:9-like */
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-strong) 100%);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: transform var(--transition-out), background var(--transition-out), box-shadow var(--transition-out), border-color var(--transition-out);
  box-shadow: var(--shadow);
  isolation: isolate;
  transform-origin: center center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.timeline-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0%, color-mix(in srgb, var(--surface-contrast) 6%, transparent) 48%, transparent 100%);
  transform: translateX(-120%);
  transition: transform 900ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 0;
}

.timeline-card:hover,
.timeline-card.is-hovered {
  /* Grow from center only -- no translateY */
  transform: scale(1.28);
  background: linear-gradient(135deg, var(--surface-strong) 0%, var(--surface) 100%);
  border-color: var(--accent-strong);
  box-shadow: 0 30px 78px rgba(18, 15, 12, 0.12);
  z-index: 2;
  transition: transform var(--transition-in), background var(--transition-in), box-shadow var(--transition-in), border-color var(--transition-in);
}

.timeline-card:hover::before,
.timeline-card.is-hovered::before {
  transform: translateX(120%);
}

/* Revealed state: year hidden, photo visible. Shared by real hover
   (desktop) and the touch/no-hover click reveal stage, so both use
   the exact same slow, sequential timing. */
.timeline-card:hover .timeline-card__year,
.timeline-card.is-hovered .timeline-card__year,
.timeline-card.is-click-reveal .timeline-card__year {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--year-in-dur) ease var(--year-in-delay),
    transform var(--year-in-dur) ease var(--year-in-delay);
}

.timeline-card:hover .timeline-card__media,
.timeline-card.is-hovered .timeline-card__media,
.timeline-card.is-click-reveal .timeline-card__media {
  opacity: 1;
  transform: scale(1.03);
  transition: opacity var(--media-in-dur) ease var(--media-in-delay),
    transform var(--media-in-dur) ease var(--media-in-delay);
}

.timeline-card.is-transitioning {
  pointer-events: none;
}

/* Click sequence
   1) is-click-reveal -- only used when the card was not already
      hovered (touch, or no hover support): a slow grow while the
      year fades away and the photo gradually appears, identical
      timing to a real hover.
   2) is-click-grow -- a quick acceleration to a much bigger size.
      If the card was already hovered, the sequence starts here
      directly (no reset, no re-reveal) so it feels continuous.
   3) is-click-warp -- the epic final stage: the box warps to an
      almost full-screen size centered in the viewport and freezes
      there (photo fully visible, never fading) until the redirect. */
.timeline-card.is-click-reveal {
  transform: scale(1.3);
  z-index: 10;
  transition: transform 1200ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 1200ms ease, border-color 1200ms ease;
}

.timeline-card.is-click-grow {
  transform: scale(3.4);
  z-index: 12;
  transition: transform 340ms cubic-bezier(0.3, 0.7, 0.2, 1),
    box-shadow 340ms ease, border-color 340ms ease;
}

.timeline-card.is-click-warp {
  transform: translate(var(--warp-x, 0px), var(--warp-y, 0px)) scale(var(--warp-scale, 8));
  z-index: 20;
  border-width: 2px;
  box-shadow: 0 90px 220px rgba(0, 0, 0, 0.55);
  transition: transform 680ms cubic-bezier(0.16, 0.84, 0.14, 1),
    box-shadow 680ms ease, border-color 680ms ease;
}

.timeline-card__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.94);
  transition: opacity var(--media-out-dur) ease var(--media-out-delay),
    transform var(--media-out-dur) ease var(--media-out-delay);
  overflow: hidden;
  pointer-events: none;
}

.timeline-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.9) contrast(1.02);
}

.timeline-card__year {
  position: relative;
  z-index: 1;
  font-size: clamp(1.35rem, 2.4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text);
  transition: opacity var(--year-out-dur) ease var(--year-out-delay),
    transform var(--year-out-dur) ease var(--year-out-delay);
}

.timeline-card--wide {
  grid-column: span 2;
}

.timeline-card--tall {
  /* Changed to keep landscape: make "tall" act as a wider card instead */
  grid-column: span 2;
}

.timeline-card--coming {
  border-style: dashed;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-strong) 100%);
}

.detail-page {
  display: grid;
  gap: 24px;
}

.detail-intro {
  max-width: 760px;
  padding-top: 8px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-intro h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.detail-summary {
  margin: 0;
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  line-height: 1.75;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.detail-card {
  min-height: 180px;
  padding: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.detail-card p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}



@media (max-width: 1100px) {
  .timeline {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .timeline-card--wide {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .site-shell {
    padding-inline: 14px;
  }

  .topbar {
    padding-bottom: 14px;
    margin-bottom: 18px;
  }

  .timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-card,
  .timeline-card--wide,
  .timeline-card--tall {
    aspect-ratio: 16 / 9;
    grid-column: span 1;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
