:root {
  --ivory: #f5efe3;
  --gold: #c8a96b;
  --red: #b84a3e;
  --glass: rgba(17, 17, 16, .48);
  --line: rgba(255,255,255,.38);
  --ui-font: "Segoe UI Variable", "Segoe UI", Arial, "Microsoft JhengHei UI", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #c9c3b8; color: var(--ivory); font-family: var(--ui-font); }
button, input { font: inherit; }

.viewport { width: 100vw; height: 100svh; display: grid; place-items: center; padding: 1.2vh .8vw; background: radial-gradient(circle at 12% 8%, #eee9df, transparent 35%), #c9c3b8; }
.app-shell { position: relative; width: 98vw; height: 97.5svh; min-height: 640px; overflow: hidden; border: 1px solid rgba(255,255,255,.78); border-radius: 24px; background: #1b1a18; box-shadow: 0 22px 70px rgba(22,18,13,.28); isolation: isolate; }

.timeline-shell { position: absolute; z-index: 35; top: 24px; left: 5.2vw; right: 5.2vw; height: 80px; display: grid; grid-template-columns: 125px minmax(0,1fr); align-items: center; gap: 26px; border-top: 1px solid rgba(255,255,255,.32); border-bottom: 1px solid rgba(255,255,255,.19); overscroll-behavior: contain; }
.timeline-heading { align-self: center; color: white; text-shadow: 0 2px 12px rgba(0,0,0,.75); }
.eyebrow { margin: 0 0 3px; color: var(--gold); font-size: 8px; font-weight: 700; letter-spacing: .26em; }
.timeline-heading h1 { margin: 0; font-family: Georgia, "Microsoft JhengHei", serif; font-size: 18px; font-weight: 500; letter-spacing: .08em; }
.timeline { position: relative; height: 66px; }
.timeline-track { position: absolute; top: 19px; left: 7px; right: 7px; height: 1px; background: rgba(255,255,255,.38); }
.timeline-track span { display: block; width: 0; height: 2px; background: var(--gold); box-shadow: 0 0 10px rgba(200,169,107,.5); transition: width .75s cubic-bezier(.16,1,.3,1); }
#timeline-slider { position: absolute; z-index: 3; top: 5px; left: -5px; width: calc(100% + 10px); height: 30px; opacity: 0; cursor: grab; }
#timeline-slider:active { cursor: grabbing; }
.timeline-points { position: absolute; inset: 0; pointer-events: none; }
.timeline-point { position: absolute; width: 1px; padding-top: 37px; color: rgba(255,255,255,.72); font-size: 9px; text-align: center; text-shadow: 0 1px 7px #000; transition: color .35s, left .35s; }
.timeline-point::before { content: ""; position: absolute; top: 13px; left: -5px; width: 11px; height: 11px; border: 1px solid rgba(255,255,255,.72); border-radius: 50%; background: rgba(24,22,19,.52); box-shadow: 0 1px 8px rgba(0,0,0,.5); transition: .35s; }
.timeline-point span { display: block; transform: translateX(-50%); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline-point.edge-left span { transform: translateX(0); text-align: left; }
.timeline-point.edge-right span { transform: translateX(-100%); text-align: right; }
.timeline-point strong { display: block; margin-top: 3px; color: white; font-size: 10px; font-weight: 500; }
.timeline-point.active { color: var(--gold); }
.timeline-point.active::before { background: var(--gold); border-color: #f4e1b8; box-shadow: 0 0 0 5px rgba(200,169,107,.18), 0 0 14px rgba(200,169,107,.48); }
.timeline-point.current { z-index: 2; }
.timeline-point.current span { padding: 4px 7px; border-radius: 3px; background: rgba(18,16,14,.72); color: white; font-size: 10px; font-weight: 650; line-height: 1.35; text-shadow: 0 1px 5px #000; backdrop-filter: blur(5px); }
.timeline-point.current strong { font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.timeline-point.current.edge-left span { transform: translateX(0); text-align: left; }
.timeline-point.current.edge-right span { transform: translateX(-100%); text-align: right; }
.timeline.is-scrubbing .timeline-track span, .timeline.is-scrubbing .timeline-point.current { transition: none; }

.album { position: absolute; z-index: 1; inset: 0; perspective: 2200px; }
.event-card { position: absolute; inset: 0; overflow: hidden; color: white; transform-style: preserve-3d; }
.event-photo-wrap { position: absolute; z-index: 0; inset: 0; margin: 0; overflow: hidden; background: #1c1b19; }
.event-photo { width: 100%; height: 100%; object-fit: cover; filter: saturate(.68) sepia(.12) contrast(1.04) brightness(.72); transform: scale(1.015); transition: transform 1.15s cubic-bezier(.16,1,.3,1), filter .8s; }
.event-card.is-scrubbing .event-photo { transition: none; }
.photo-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,8,7,.3) 0%, rgba(8,8,7,.15) 39%, rgba(8,8,7,.5) 58%, rgba(8,8,7,.34) 100%), linear-gradient(180deg, rgba(0,0,0,.36), transparent 32%, rgba(0,0,0,.3)); }
.event-photo-wrap figcaption { position: absolute; z-index: 2; right: 5.2vw; bottom: 88px; max-width: 38vw; color: rgba(255,255,255,.68); font-size: 8px; line-height: 1.5; text-align: right; text-shadow: 0 1px 7px #000; }
.book-spine { display: none; }

.event-content { position: absolute; z-index: 6; top: 132px; left: 5.2vw; right: 5.2vw; bottom: 78px; display: grid; grid-template-columns: minmax(0,.88fr) minmax(420px,1.12fr); grid-template-rows: auto auto auto minmax(0,1fr); column-gap: 7vw; align-content: start; padding: 0; background: transparent; }
.event-meta { grid-column: 1; grid-row: 1; display: flex; justify-content: flex-start; gap: 20px; color: rgba(255,255,255,.68); font-size: 9px; font-variant-numeric: tabular-nums; letter-spacing: .15em; text-shadow: 0 2px 10px #000; }
.event-date-large { grid-column: 1; grid-row: 2; margin: 24px 0 0; color: #ead3a7; font-family: var(--ui-font); font-size: clamp(24px,2.35vw,40px); font-weight: 400; line-height: 1; letter-spacing: .02em; font-variant-numeric: tabular-nums; text-shadow: 0 3px 18px rgba(0,0,0,.8); }
.event-content h2 { grid-column: 1; grid-row: 3; max-width: 620px; margin: 12px 0 0; font-family: var(--ui-font); font-size: clamp(30px,3.2vw,54px); font-weight: 500; line-height: 1.2; letter-spacing: .03em; text-shadow: 0 4px 22px rgba(0,0,0,.88); }
.summary-scroll { grid-column: 2; grid-row: 1 / 5; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: clamp(18px,2vw,34px) 0 clamp(18px,2vw,34px) clamp(18px,2vw,34px); border: 0; background: transparent; box-shadow: none; backdrop-filter: none; scrollbar-width: thin; scrollbar-color: rgba(238,220,184,.58) transparent; outline: none; }
.summary-scroll::-webkit-scrollbar { width: 5px; }
.summary-scroll::-webkit-scrollbar-thumb { border-radius: 8px; background: rgba(238,220,184,.58); }
.summary-scroll:focus { box-shadow: inset 2px 0 rgba(238,220,184,.58); }
.event-summary { margin: 0; color: rgba(255,255,255,.92); font-family: Georgia, "Microsoft JhengHei", serif; font-size: clamp(13px,1.05vw,18px); line-height: 2.05; letter-spacing: .055em; white-space: pre-line; text-shadow: 0 2px 9px rgba(0,0,0,.7); }
.event-card.scrub-settle .event-content { animation: scrubSettle .22s ease-out both; }

.nav-button { position: absolute; z-index: 25; bottom: 20px; width: 56px; height: 38px; border: 1px solid rgba(255,255,255,.48); border-radius: 99px; background: rgba(20,18,15,.28); color: white; cursor: pointer; backdrop-filter: blur(7px); transition: .25s; }
.nav-button:hover { background: rgba(200,169,107,.85); border-color: #ead9b7; color: #211c14; transform: translateY(-2px); }
.nav-button.prev { left: auto; right: calc(5.2vw + 70px); }
.nav-button.next { left: auto; right: 5.2vw; }
.chronology-wordmark { position: absolute; z-index: 28; left: 50%; bottom: 23px; margin: 0; transform: translateX(-50%); color: white; font-family: var(--ui-font); font-size: 20px; font-style: normal; font-weight: 400; letter-spacing: .08em; white-space: nowrap; text-shadow: 0 3px 15px rgba(0,0,0,.8); }
.chronology-wordmark span { margin-left: 8px; font: inherit; letter-spacing: .08em; }

.page-turn { position: absolute; z-index: 12; top: 0; right: 0; width: 50%; height: 100%; transform-origin: left center; transform-style: preserve-3d; pointer-events: none; visibility: hidden; }
.page-turn-front, .page-turn-back { position: absolute; inset: 0; backface-visibility: hidden; }
.page-turn-front { background: linear-gradient(90deg, rgba(26,23,19,.78), rgba(200,187,160,.54)); box-shadow: -25px 0 55px rgba(0,0,0,.42); }
.page-turn-back { transform: rotateY(180deg); background: linear-gradient(90deg, rgba(224,213,191,.72), rgba(46,40,32,.72)); box-shadow: 25px 0 55px rgba(0,0,0,.36); }
.event-card.turn-next .page-turn { visibility: visible; animation: turnNext .9s cubic-bezier(.6,.02,.18,1) both; }
.event-card.turn-prev .page-turn { left: 0; right: auto; transform-origin: right center; visibility: visible; animation: turnPrev .9s cubic-bezier(.6,.02,.18,1) both; }
.event-card.turn-next .event-photo, .event-card.turn-prev .event-photo { transform: scale(1.07); filter: saturate(.42) sepia(.2) brightness(.48); }
.event-card.reveal .event-content > * { animation: contentReveal .55s cubic-bezier(.16,1,.3,1) both; }
.event-card.reveal .event-content > *:nth-child(2) { animation-delay: .07s; }
.event-card.reveal .event-content > *:nth-child(3) { animation-delay: .13s; }
.event-card.reveal .event-content > *:nth-child(4) { animation-delay: .18s; }

@keyframes turnNext { 0% { transform: rotateY(0); } 45% { box-shadow: -35px 0 55px rgba(0,0,0,.42); } 100% { transform: rotateY(-180deg); } }
@keyframes turnPrev { 0% { transform: rotateY(0); } 45% { box-shadow: 35px 0 55px rgba(0,0,0,.42); } 100% { transform: rotateY(180deg); } }
@keyframes contentReveal { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scrubSettle { from { opacity: .82; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 980px), (max-height: 720px) {
  .viewport { padding: 0; }
  .app-shell { width: 100vw; height: 100svh; min-height: 600px; border: 0; border-radius: 0; }
  .timeline-shell { left: 28px; right: 28px; }
  .timeline-shell { grid-template-columns: 120px minmax(0,1fr); gap: 16px; }
  .event-content { top: 122px; left: 38px; right: 38px; bottom: 72px; grid-template-columns: minmax(0,.8fr) minmax(360px,1.2fr); column-gap: 38px; }
  .summary-scroll { padding: 20px 0 20px 20px; }
  .chronology-wordmark { left: 50%; bottom: 21px; }
  .event-photo-wrap figcaption { right: 28px; bottom: 82px; }
}

@media (max-width: 720px) {
  html, body { overflow-x: hidden; overflow-y: auto; }
  .viewport { display: block; min-height: 100svh; }
  .app-shell { min-height: 800px; }
  .timeline-shell { top: 14px; left: 18px; right: 18px; height: 78px; display: block; }
  .timeline-heading { position: absolute; top: 9px; left: 0; }
  .timeline-heading .eyebrow { display: none; }
  .timeline-heading h1 { font-size: 14px; }
  .timeline { height: 62px; margin-left: 92px; }
  .timeline-point { font-size: 8px; }
  .timeline-point strong { max-width: 68px; overflow: hidden; text-overflow: ellipsis; font-size: 9px; }
  .event-content { top: 108px; left: 18px; right: 18px; bottom: 76px; display: grid; grid-template-columns: 1fr; grid-template-rows: auto auto auto minmax(0,1fr); row-gap: 0; }
  .event-meta { grid-column: 1; grid-row: 1; font-size: 8px; }
  .event-date-large { grid-column: 1; grid-row: 2; margin-top: 12px; font-size: 24px; }
  .event-content h2 { grid-column: 1; grid-row: 3; max-width: none; margin-top: 6px; font-size: clamp(28px,9vw,42px); }
  .summary-scroll { grid-column: 1; grid-row: 4; margin-top: 18px; padding: 16px 0 16px 16px; }
  .event-summary { font-size: 12px; line-height: 1.85; }
  .chronology-wordmark { left: 50%; bottom: 20px; font-size: 17px; }
  .nav-button { bottom: 16px; width: 48px; height: 34px; }
  .nav-button.prev { left: auto; right: 80px; }
  .nav-button.next { left: auto; right: 18px; }
  .event-photo-wrap figcaption { display: none; }
  .page-turn { width: 100%; }
}

@media (max-width: 390px) {
  .timeline { margin-left: 76px; }
  .timeline-heading h1 { font-size: 12px; }
  .event-content { left: 14px; right: 14px; }
  .summary-scroll { padding: 14px 0 14px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
