/* MediRalli 2026 — story page (own look, separate from the main site) */
:root {
  --paper: #f3efe8;
  --ink: #141414;
  --muted: rgba(20, 20, 20, 0.55);
  --night: #2a1c15;
  --night-ink: #f3efe8;
  --red: #e63323;
  --yellow: #fdfd03;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-muted: var(--muted);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.8s ease, color 0.8s ease;
}
body[data-theme="dark"] { --bg: var(--night); --fg: var(--night-ink); --fg-muted: rgba(243, 239, 232, 0.55); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, p, figure { margin: 0; }

/* ---------- Header ---------- */
.top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.5rem;
  mix-blend-mode: difference;
  color: #fff;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.top__brand img { height: 3.25rem; margin: -0.9rem 0; }
.top__title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 0.85rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Horizontal track (desktop) ---------- */
.story { position: relative; overflow: hidden; }
.track { position: relative; display: flex; width: max-content; height: 100vh; height: 100svh; }
.panel { position: relative; flex: none; height: 100%; }
.p-intro { width: 130vw; }
.p-chapter { width: auto; min-width: 60vw; display: flex; flex-direction: column; justify-content: center; padding: 0 10vw 0 6vw; }
.p-photo { width: 125vw; display: flex; }
.p-stages { width: 190vw; }
.p-strip { width: 100vw; }
.p-strip--dark { width: 105vw; }
.p-final { width: 125vw; }

/* ---------- Type ---------- */
.type-title {
  position: absolute;
  left: 8vw;
  top: 13vh;
  z-index: 3;
  font-family: var(--sans);
  font-size: clamp(3rem, 6.4vw, 7.5rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1;
}
.type-title--sm { font-size: clamp(2.5rem, 5vw, 5.5rem); }
.type-line { display: block; white-space: nowrap; }
.type-line.indent { padding-left: 0.95em; }
.arrow { font-weight: 400; margin-right: 0.15em; }
.type-line.is-pending .arrow { visibility: hidden; } /* arrows appear with their line */
.type-line.is-typing::after { content: ""; display: inline-block; width: 0.06em; height: 0.9em; margin-left: 0.05em; vertical-align: -0.08em; background: currentColor; animation: caret 0.8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.serif-title { font-family: var(--serif); font-size: clamp(3rem, 5vw, 6rem); font-weight: 400; line-height: 0.95; letter-spacing: -0.01em; }
.prose { display: flex; flex-direction: column; gap: 1rem; font-size: 1.05rem; line-height: 1.5; }
.prose p { text-indent: 3.5rem; }

/* ---------- Intro ---------- */
.intro__text { position: absolute; left: 8vw; top: 56vh; width: min(34rem, 34vw); z-index: 3; }
.sticker { position: absolute; left: 50vw; top: 9vh; z-index: 8; width: clamp(6rem, 9vw, 10rem); animation: wobble 4s ease-in-out infinite; transform-origin: 50% 60%; }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(7deg) scale(1.04); } }

/* ---------- Cards (caption with left rule) ---------- */
.card { position: absolute; left: var(--x); top: var(--y); z-index: 2; width: var(--w); }
.card img { width: 100%; height: auto; }
.card figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 24rem;
  padding: 0.9rem 0 0.2rem 0.85rem;
  border-left: 1px solid var(--fg);
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--fg-muted);
  transition: border-color 0.8s;
}
.card figcaption strong { font-family: var(--serif); font-size: clamp(1.35rem, 1.6vw, 1.75rem); font-weight: 400; line-height: 1.05; color: var(--fg); }

/* ---------- Chapter covers ---------- */
.chapter__no { font-size: 0.9rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-muted); }
.chapter__title { font-family: var(--serif); font-size: clamp(6rem, 15vw, 17rem); font-weight: 400; line-height: 0.85; letter-spacing: -0.02em; margin: 0.15em 0 0.25em; }
.chapter__years { font-family: var(--serif); font-size: clamp(1.5rem, 2.2vw, 2.4rem); font-style: italic; }

/* ---------- Full photo + text panel ---------- */
.photo__img { position: relative; width: 95vw; height: 100%; overflow: hidden; }
.photo__img img { width: 116%; max-width: none; height: 100%; object-fit: cover; }
.photo__text { width: 30vw; padding: 7rem 3vw 3rem 3.5vw; display: flex; flex-direction: column; gap: 3rem; background: var(--bg); transition: background-color 0.8s; }
.p-final .photo__text { justify-content: center; }
.final__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.btn { display: inline-block; padding: 0.8rem 1.4rem 0.75rem; border: 1px solid var(--fg); border-radius: 3rem; font-weight: 500; transition: background 0.2s, color 0.2s; }
.btn:hover, .btn--dark { background: var(--fg); color: var(--bg); }
.btn--dark:hover { background: transparent; color: var(--fg); }

/* fan of photos that opens up as it scrolls in */
.fan { position: absolute; left: var(--x); bottom: 5vh; z-index: 4; width: 34vw; height: 30vh; }
.fan img {
  position: absolute;
  bottom: 0;
  width: 15vw;
  height: 22vh;
  object-fit: cover;
  border: 0.45rem solid #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transform: rotate(var(--r));
}
.fan img:nth-child(1) { left: 0; }
.fan img:nth-child(2) { left: 7vw; }
.fan img:nth-child(3) { left: 14vw; }
.fan img:nth-child(4) { left: 21vw; }

/* ---------- Strip panels (big text + bottom photo row) ---------- */
.strip__text { position: absolute; left: 6vw; top: 14vh; z-index: 3; width: 46vw; font-family: var(--serif); font-size: clamp(2.2rem, 3.6vw, 4.2rem); line-height: 1.02; }
.strip__text--big { width: 52vw; font-size: clamp(2.6rem, 4.4vw, 5.2rem); }
.strip { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: flex-end; }
.strip img { flex: 1; min-width: 0; height: 24vh; object-fit: cover; }
.strip img:nth-child(odd) { height: 30vh; }
.p-strip--dark .card figcaption strong { font-size: clamp(1.2rem, 1.4vw, 1.5rem); }

/* ---------- Bubble ---------- */
.bubble { position: fixed; left: 50%; bottom: 1.25rem; z-index: 30; width: min(40rem, calc(100% - 2rem)); transform: translateX(-50%); color: #f3efe8; }
.bubble__bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.9rem 0.75rem 1rem; background: #232323; border-radius: 1.4rem; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); }
.bubble__icon { flex: none; width: 1.6rem; height: 1.6rem; }
.bubble__text { flex: 1; font-size: 1.05rem; font-weight: 500; transition: opacity 0.25s; }
.bubble__text.is-swapping { opacity: 0; }
.bubble__home { flex: none; padding: 0.55rem 0.95rem; border-radius: 999px; background: #3a3a3a; font-size: 0.92rem; font-weight: 500; line-height: 1; color: inherit; text-decoration: none; white-space: nowrap; transition: background 0.2s, color 0.2s; }
.bubble__home:hover { background: #f3efe8; color: #141414; }
.bubble__btn { position: relative; flex: none; width: 2rem; height: 2rem; padding: 0; border: 0; background: none; cursor: pointer; color: inherit; }
.bubble__btn::before, .bubble__btn::after { content: ""; position: absolute; left: 50%; top: 50%; width: 1.2rem; height: 2px; margin: -1px 0 0 -0.6rem; background: currentColor; transition: transform 0.25s; }
.bubble__btn::after { transform: rotate(90deg); }
.bubble__btn[aria-expanded="true"]::after { transform: rotate(0deg); }
.bubble__note { margin-bottom: 0.5rem; padding: 1rem 1.2rem; background: #232323; border-radius: 1.2rem; font-size: 0.95rem; line-height: 1.45; color: rgba(243, 239, 232, 0.85); }

/* ---------- Phone: vertical, simplified ---------- */
@media (max-width: 767px) {
  .top__title { display: none; }
  .track { display: block; width: auto; height: auto; padding-bottom: 6rem; }
  .sticker { display: none; }
  .panel { width: auto !important; height: auto; padding: 0 1.25rem; }
  .panel + .panel { margin-top: 4.5rem; }
  .p-intro { padding-top: 6.5rem; }
  .type-title, .intro__text, .card, .strip__text, .fan { position: static; width: auto; }
  .type-title { font-size: clamp(2.5rem, 12vw, 3.5rem); margin-bottom: 1.75rem; }
  .type-line { white-space: normal; }
  .intro__text { margin-bottom: 2.5rem; }
  .card { margin-bottom: 2.25rem; }
  .card figcaption { max-width: none; }
  .p-chapter { padding-top: 3rem; padding-bottom: 3rem; }
  .chapter__title { font-size: 19vw; }
  .p-photo { flex-direction: column; padding: 0; }
  .photo__img { width: 100%; height: 70svh; }
  .photo__img img { width: 100%; }
  .photo__text { width: auto; padding: 2rem 1.25rem; gap: 1.75rem; }
  .serif-title { font-size: 3rem; }
  .fan { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; height: auto; padding: 0 1.25rem; }
  .fan img { position: static; width: 100%; height: 11rem; transform: rotate(var(--r)) scale(0.96); }
  .strip__text { margin-bottom: 2rem; font-size: 2.2rem; }
  .strip { position: static; flex-wrap: wrap; gap: 0.4rem; margin: 0 -1.25rem; }
  .strip img { flex: 1 1 45%; height: 9rem !important; }
  .bubble { bottom: 0.75rem; }
  .bubble__text { font-size: 0.95rem; }
}

/* Breather panels (scattered cards around a typed title) */
.p-scatter { width: var(--pw, 150vw); }
.p-scatter .intro__text { top: 58vh; }
@media (max-width: 767px) {
  .p-scatter .type-title, .p-scatter .intro__text, .p-scatter .card { position: static; width: auto; }
}
