:root {
  --paper: #eee8dd;
  --paper-deep: #e4dccd;
  --ink: #1f1b16;
  --muted: #6f665a;
  --accent: #c8502e;
  --frame: #fbf9f4;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --hand: "Caveat", "Bradley Hand", cursive;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* paper grain over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  opacity: .22;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 50;
}

a { color: inherit; }

/* ---------- Chrome ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  z-index: 40;
  pointer-events: none;
}
.topbar a {
  pointer-events: auto;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .01em;
  padding: 7px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px rgb(31 27 22 / .08);
  transition: background .2s;
}
.topbar a:hover { background: var(--frame); }

.chapters {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 40;
}
.chapters button {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 5px 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.chapters button span {
  opacity: 0;
  transform: translateX(6px);
  transition: opacity .25s, transform .25s;
  padding: 3px 7px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
}
.chapters button::after {
  content: "";
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: .35;
  transition: width .35s cubic-bezier(.2,.8,.2,1), opacity .25s, background .25s;
}
.chapters button:hover span,
.chapters button:focus-visible span { opacity: 1; transform: none; }
.chapters button.is-active { color: var(--ink); }
.chapters button.is-active::after { width: 28px; opacity: 1; background: var(--accent); }
.chapters button:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Scroll track + stage ---------- */

.track {
  position: relative;
  /* height set in JS: chapters × 100vh */
}
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.table {
  position: absolute;
  inset: 0;
  z-index: 1; /* own stacking context so panels always sit above photos */
}

/* invisible markers, one per chapter, for gentle scroll snapping */
html { scroll-snap-type: y proximity; }
.snap {
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
  scroll-snap-align: start;
}

/* ---------- Polaroids ---------- */

.polaroid {
  --w: 180px;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--w);
  margin: 0;
  padding: calc(var(--w) * .06) calc(var(--w) * .06) 0;
  background: var(--frame);
  border-radius: 2px;
  box-shadow:
    0 1px 1px rgb(40 30 20 / .08),
    0 3px 6px -2px rgb(40 30 20 / .12),
    0 14px 24px -12px rgb(40 30 20 / .28);
  will-change: transform;
  transform-origin: 50% 50%;
  user-select: none;
  -webkit-user-select: none;
  transition: box-shadow .35s ease;
}
.polaroid.is-lifted {
  box-shadow:
    0 2px 2px rgb(40 30 20 / .06),
    0 12px 18px -6px rgb(40 30 20 / .16),
    0 34px 50px -18px rgb(40 30 20 / .38);
}
@media (hover: hover) and (pointer: fine) {
  .polaroid { cursor: none; touch-action: none; }
}

.polaroid__img {
  position: relative;
  aspect-ratio: 1;
  background: var(--g, #333);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  filter: brightness(.22) saturate(0) contrast(.8) blur(1.5px);
  transition: filter 2.6s cubic-bezier(.3,.1,.3,1);
}
.polaroid.is-developed .polaroid__img { filter: none; }
.polaroid__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%; /* favour faces in portrait shots */
  display: block;
  pointer-events: none;
}
/* film grain + soft vignette on every photo */
.polaroid__img::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grain), radial-gradient(120% 120% at 50% 40%, transparent 55%, rgb(0 0 0 / .28));
  mix-blend-mode: multiply;
  opacity: .55;
}

.polaroid figcaption {
  height: calc(var(--w) * .24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--hand);
  font-weight: 500;
  font-size: calc(var(--w) * .105);
  color: #3a332b;
  white-space: nowrap;
  overflow: hidden;
}

/* ---------- Panels ---------- */

.panel {
  position: absolute;
  left: 0;
  top: 0;
  width: 460px;
  z-index: 20;
  pointer-events: none;
  will-change: transform, opacity;
}
.panel a { pointer-events: auto; }

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.meta { letter-spacing: .06em; text-transform: none; font-size: 12px; }
.meta::before { content: "·"; margin-right: 10px; }
.num {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0;
  color: var(--accent);
}
.num::after {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: 22px;
  height: 1px;
  margin-left: 10px;
  background: currentColor;
  opacity: .5;
}

.title {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 4.2vw, 56px);
  line-height: 1.02;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.title em, .hello-title em { font-style: italic; }
.title--xl { font-size: clamp(56px, 8vw, 112px); }

.body {
  margin: 0;
  max-width: 38ch;
  font-size: 16px;
  line-height: 1.6;
  color: #463e35;
  text-wrap: pretty;
}

.stat {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(56px, 7vw, 96px);
  line-height: .9;
  color: var(--accent);
  letter-spacing: -.02em;
}

/* hello */
.panel--hello { text-align: center; }
.panel--hello .eyebrow {
  justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  text-transform: none;
  letter-spacing: -.02em;
  font-size: clamp(72px, 11vw, 168px);
  line-height: .9;
  color: var(--ink);
  margin: 0;
  gap: 0;
}
.greeting {
  display: inline-block;
  transition: opacity .45s ease, transform .45s cubic-bezier(.2,.8,.2,1), filter .45s;
}
.greeting.is-out { opacity: 0; transform: translateY(-.15em); filter: blur(6px); }
.greeting.is-in { opacity: 0; transform: translateY(.15em); filter: blur(6px); transition: none; }
.greeting-comma { color: var(--accent); }

.hello-title {
  margin: 4px 0 18px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 3.6vw, 48px);
  line-height: 1.05;
}
.lede {
  margin: 0 auto;
  max-width: 34ch;
  font-size: 15px;
  line-height: 1.6;
  color: #463e35;
}
.hint {
  margin: 28px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.hint__line {
  position: relative;
  width: 1px;
  height: 26px;
  background: rgb(31 27 22 / .15);
  overflow: hidden;
}
.hint__line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -40%;
  width: 1px;
  height: 40%;
  background: var(--ink);
  animation: drip 1.8s cubic-bezier(.6,0,.3,1) infinite;
}
@keyframes drip { to { top: 100%; } }

.building {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.2;
}
.building a {
  font-style: italic;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-underline-offset .25s;
}
.building a:hover { text-underline-offset: 7px; }
.panel--hello .lede { max-width: 44ch; }

/* flags: stamped in one by one when the chapter arrives */
.panel--flags { text-align: center; }
.panel--flags .eyebrow { justify-content: center; margin-bottom: 22px; }
.flags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 12px;
}
.flags li {
  opacity: 0;
  transform: translateY(10px) scale(.6) rotate(-8deg);
  transition: opacity .3s ease, transform .5s cubic-bezier(.3,1.6,.5,1);
  transition-delay: calc(var(--i) * 35ms);
}
.panel--flags.is-active .flags li { opacity: 1; transform: none; }
.flags .fi {
  display: block;
  width: 44px;
  line-height: 33px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgb(31 27 22 / .1), 0 4px 10px -4px rgb(40 30 20 / .35);
  pointer-events: auto;
}
.flags .fi.fi-va, .flags .fi.fi-ch { width: 33px; } /* square flags */

/* outro */
.panel--outro { text-align: center; }
.panel--outro .eyebrow { justify-content: center; }
.panel--outro .body { margin: 0 auto; }
.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--frame);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), background .25s;
}
.cta:hover { background: var(--accent); transform: translateY(-2px); }

/* ---------- Custom cursor ---------- */

.cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--ink);
  pointer-events: none;
  z-index: 60;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: width .3s cubic-bezier(.2,.8,.2,1), height .3s cubic-bezier(.2,.8,.2,1), margin .3s cubic-bezier(.2,.8,.2,1), background .3s, opacity .3s;
}
.cursor.is-visible { opacity: 1; }
.cursor__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--frame);
  opacity: 0;
  transition: opacity .2s;
}
.cursor.is-photo {
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  background: rgb(31 27 22 / .82);
}
.cursor.is-photo .cursor__label { opacity: 1; }
.cursor.is-down { width: 44px; height: 44px; margin: -22px 0 0 -22px; background: var(--accent); }
.cursor.is-link { width: 34px; height: 34px; margin: -17px 0 0 -17px; background: rgb(200 80 46 / .25); }
@media (hover: none), (pointer: coarse) {
  .cursor { display: none; }
}
@media (hover: hover) and (pointer: fine) {
  body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; }
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .chapters { right: 10px; }
  .chapters button span { display: none; }
  .body { font-size: 15px; }
  .panel--hello .eyebrow { font-size: 76px; }
  .flags { gap: 10px 9px; }
  .flags .fi { width: 36px; line-height: 27px; }
  .flags .fi.fi-va, .flags .fi.fi-ch { width: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  .polaroid__img { transition: none; }
  .hint__line::after { animation: none; }
  .greeting { transition: none; }
  .flags li { transition: none; }
}

/* stat suffix ("invested", "batch") */
.stat small {
  font-family: var(--sans);
  font-style: normal;
  font-size: clamp(14px, 1.4vw, 18px);
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 4px;
}
.badge {
  display: inline-block;
  margin: 16px 0 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  box-shadow: 0 0 0 1px rgb(200 80 46 / .35);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
}

/* hobbies */
.panel--hobbies { text-align: left; }
.hobby__title {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 2.8vw, 36px);
  line-height: 1.05;
}
.hobby__text { margin: 0; font-size: 15px; line-height: 1.5; color: #463e35; max-width: 36ch; }
.hobby--travel { margin-bottom: 18px; }
.hobby--travel .hobby__text { max-width: none; }
.hobby-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.hobby__note {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--accent);
}
.passport { margin-top: 12px; }
.passport__label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel--hobbies .flags { justify-content: flex-start; gap: 8px 7px; }
.panel--hobbies .flags .fi { width: 28px; line-height: 21px; border-radius: 3px; }
.panel--hobbies .flags .fi.fi-va, .panel--hobbies .flags .fi.fi-ch { width: 21px; }
.panel--hobbies.is-active .flags li { opacity: 1; transform: none; }

/* socials */
.socials {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 22px 0 0;
  padding: 0;
}
.socials a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(31 27 22 / .18);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  transition: background .25s, color .25s, transform .25s cubic-bezier(.2,.8,.2,1);
}
.socials a:hover { background: var(--ink); color: var(--frame); transform: translateY(-2px); }
.socials svg { width: 18px; height: 18px; }

@media (max-width: 720px) {
  .hobby-row { grid-template-columns: 1fr; gap: 10px; }
  .hobby__title { font-size: 24px; }
  .hobby__text { font-size: 14px; }
  .hobby--travel { margin-bottom: 12px; }
  .meta { flex-basis: 100%; font-size: 12px; }
  .meta::before { content: none; }
  .title { font-size: 34px; }
  .panel--hobbies .flags .fi { width: 22px; line-height: 16px; }
  .hobby__note { font-size: 17px; margin-top: 12px; }
}
