@font-face { font-family: "Playfair"; src: url(../assets/fonts/playfair-display-regular.ttf); font-display: swap; }
@font-face { font-family: "Garamond"; src: url(../assets/fonts/eb-garamond-regular.woff2); font-display: swap; }
@font-face { font-family: "Garamond"; font-style: italic; src: url(../assets/fonts/eb-garamond-italic.woff2); font-display: swap; }
@font-face { font-family: "Geist"; src: url(../assets/fonts/geist-regular.woff2); font-display: swap; }
@font-face { font-family: "Departure"; src: url(../assets/fonts/departure-mono-regular.woff2); font-display: swap; }
@font-face { font-family: "Fraunces"; font-weight: 500 700; src: url(../assets/fonts/fraunces-latin-ext.woff2) format("woff2"); font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fraunces"; font-weight: 500 700; src: url(../assets/fonts/fraunces-latin.woff2) format("woff2"); font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Nunito"; font-weight: 500 700; src: url(../assets/fonts/nunito-latin-ext.woff2) format("woff2"); font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-weight: 500 700; src: url(../assets/fonts/nunito-latin.woff2) format("woff2"); font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #2a2118;
  --paper: #f6efe1;
  --red: #c2452f;
}

* { margin: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }   /* no scroll snapping: the story stays wherever the reader stops */
body { background: #bfdcee; color: var(--ink); font-family: "Garamond", Georgia, serif; overflow-x: hidden; }

/* ---------- the fixed paper stage ---------- */
#viewport { position: fixed; inset: 0; overflow: hidden; }
#stage { position: absolute; left: 50%; bottom: 0; width: 1600px; height: 900px; transform-origin: 50% 100%; }
#stage > * { position: absolute; }
/* sky colours measured from the reference: deep blue top right, pale blue left, warm glow low on the left */
#sky { left: -1600px; right: -1600px; top: -900px; bottom: 0;
  background:
    radial-gradient(ellipse 1060px 660px at 1790px 1600px, #fff4d6 0%, rgba(255,242,213,.94) 20%, rgba(250,233,210,.62) 46%, rgba(232,228,222,0) 100%),
    linear-gradient(180deg, rgba(214,226,232,0) 0, rgba(214,226,232,0) 900px, rgba(214,226,232,.5) 1440px, rgba(222,228,228,.72) 1800px),
    linear-gradient(90deg, #8ac1e0 0, #8ac1e0 1600px, #84b8d9 2130px, #5598bf 2690px, #3f7ea9 3200px, #3f7ea9 100%); }
/* the sky itself is a sheet of paper made from the reference; the gradient above only shows on ultra-wide screens */
#sky-paper { left: 0; top: 0; width: 1600px; height: 900px; background: url(../assets/art/sky.jpg) center/100% 100% no-repeat; pointer-events: none; }
/* time of day: these sit over the paper sky and are faded in and out by the scroll position */
#sky-warm, #sky-night, #stars, #grade-warm, #grade-night { left: 0; top: 0; width: 1600px; height: 900px; pointer-events: none; opacity: 0; }
#sky-warm { mix-blend-mode: color; background: linear-gradient(0deg, #ff9a4d 0%, #ff9f6b 28%, #e58a92 55%, #8f7fb8 82%, #6f74b3 100%); }
#sky-night { mix-blend-mode: multiply; background: linear-gradient(180deg, #0c1640 0%, #18275a 55%, #2c3a72 100%); }
#stars i { position: absolute; border-radius: 50%; background: #fff8e6; box-shadow: 0 0 6px 1px rgba(255,244,214,.75); }
#grade-warm { mix-blend-mode: multiply; background: #ffc59a; }
#grade-night { mix-blend-mode: multiply; background: #3a4a8c; }
/* the warm light low on the left, matched to colours measured in the reference */
#sky-glow { left: -650px; top: 130px; width: 1800px; height: 1120px; pointer-events: none; will-change: transform, opacity; }
/* the glow is painted once on a small canvas (main.js) and stretched: as a CSS gradient on a box this size it was a
   6000 px texture that moved every frame, and it alone cost a quarter of the frame rate */
#sky-glow canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
#sun { left: 71px; top: 600px; width: 214px; height: 214px; will-change: transform; }
/* the sun's light spilling over the grass in front of it */
#sun-glow { left: -140px; top: 420px; width: 640px; height: 560px; pointer-events: none; mix-blend-mode: soft-light; will-change: transform, opacity;
  background: radial-gradient(closest-side, rgba(255,226,150,.95), rgba(255,214,130,.55) 40%, rgba(255,214,130,0)); }
#clouds { left: 0; top: 0; width: 1600px; height: 420px; }
.cloud { position: absolute; will-change: transform; }
.ring { left: 0; top: 0; width: 1600px; height: 900px; }
.ring > * { position: absolute; left: 0; top: 0; will-change: transform; }
.disc { border-radius: 50%; }
#disc-a, #disc-c { display: none; }
#cast { left: 0; top: 0; width: 1600px; height: 900px; }
.actor { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.actor svg { position: absolute; overflow: visible; }
/* drawn characters (pets, Nur, later outfits) cast the same paper shadow as the cut-out pieces */
.actor > svg { filter: drop-shadow(12px 9px 7px rgba(19,36,68,.44)); }
#grain { position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: multiply; }

/* ---------- chrome over the stage ---------- */
#brand { position: fixed; z-index: 5; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: baseline;
  padding: clamp(18px, 3.2vw, 76px) clamp(20px, 4.65vw, 110px) 0; pointer-events: none; }
#brand a { color: #fff; text-decoration: none; pointer-events: auto; text-shadow: 0 1px 10px rgba(30, 60, 100, .35); }
#brand .name { font: 400 clamp(18px, 1.5vw, 36px)/1 "Garamond", serif; letter-spacing: -.005em; transition: opacity .35s ease; }
body.at-hero #brand .name { opacity: 0; pointer-events: none; }
#brand nav { display: flex; gap: clamp(16px, 2.7vw, 64px); font: 400 clamp(14px, 1.08vw, 25px)/1 "Geist", system-ui, sans-serif; }
#brand nav a:hover, #brand nav a:focus-visible { text-decoration: underline; text-underline-offset: 5px; }

/* Story labels: one sheet of cream paper with a soft serif, and a paper ribbon for the line that matters most. */
#cards { position: fixed; z-index: 4; left: clamp(20px, 4.65vw, 110px); top: clamp(78px, 11.6vh, 140px); width: min(clamp(270px, 24vw, 560px), calc(100vw - 40px)); pointer-events: none; font-size: clamp(13px, .92vw, 22px); }
.card { position: absolute; left: 0; top: 0; width: max-content; max-width: 100%; opacity: 0; will-change: transform, opacity; padding: 1.45em 1.7em 1.6em; color: #3a3226; }
.card::after { content: ""; position: absolute; z-index: -1; inset: 0; border-radius: 1em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E"), #fbf5e8;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset, .3em .5em .75em rgba(40, 50, 90, .32); }
.card .year { font: 600 .74em/1 "Fraunces", serif; letter-spacing: .2em; color: var(--red); }
.card h2 { font: 600 2em/1.04 "Fraunces", serif; margin-top: .3em; letter-spacing: -.005em; color: #2f3d5c; text-wrap: balance; }
.card p { font: 500 .95em/1.4 "Nunito", system-ui, sans-serif; margin-top: .55em; color: #5a4e40; text-wrap: balance; }
/* The ribbon is a strip of red paper wrapped round the left edge of the sheet: it starts behind the card (the dark
   fold underneath), comes across the front and ends in a cut swallowtail. */
.card .badge { position: relative; display: inline-block; margin: 1.05em 0 -.15em -2.45em; vertical-align: top; filter: drop-shadow(.12em .22em .18em rgba(70, 30, 25, .38)); }
.card .badge::before { content: ""; position: absolute; left: 0; top: 100%; width: 0; height: 0; border-top: .5em solid #84291b; border-left: .75em solid transparent; }
.card .badge span { display: block; padding: .62em 2.3em .54em 1.45em; white-space: nowrap; font: 600 .74em/1 "Fraunces", serif; letter-spacing: .15em; text-transform: uppercase; color: #fff4e2;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0) 28%, rgba(0,0,0,.08)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E"), #c2452f;
  clip-path: polygon(0 0, 100% 0, calc(100% - .95em) 50%, 100% 100%, 0 100%);
  text-shadow: 0 1px 0 rgba(90, 25, 15, .45); }
.card.hero { top: calc(clamp(44px, 5.4vh, 120px) - clamp(78px, 11.6vh, 140px)); width: max(100%, 30vw); max-width: none; font-size: clamp(16px, 1.25vw, 29px); background: none; box-shadow: none; padding: 0; color: #fff; text-shadow: 0 1px 14px rgba(15, 40, 80, .35); }
.card.hero::after { display: none; }
.card.hero .year { display: none; }
.card.hero h2 { color: #fff; text-wrap: nowrap; text-shadow: inherit; font: 400 3.36em/1 "Garamond", serif; letter-spacing: -.01em; margin-top: 0; white-space: nowrap; }
.card.hero p { color: #fff; font: 400 1.07em/1.5 "Geist", system-ui, sans-serif; max-width: 19.6em; margin-top: 1em; opacity: .96; text-shadow: inherit; }
.card.hero .motto { font: 400 .7em/1 "Departure", monospace; letter-spacing: .2em; margin-top: 2.1em; opacity: .85; }
.card .links { display: flex; gap: 1.1em; margin-top: 1em; font: 400 .74em/1 "Departure", monospace; letter-spacing: .08em; text-transform: uppercase; }
.card .links a { color: var(--ink); pointer-events: auto; text-underline-offset: 5px; }

#dots { position: fixed; z-index: 5; right: clamp(12px, 2vw, 28px); top: 50%; transform: translateY(-50%); display: grid; gap: 4px; }
#dots a { display: grid; place-items: center; width: 24px; height: 24px; }
#dots a::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; opacity: .55; box-shadow: 0 1px 3px rgba(40, 30, 10, .4); transition: transform .25s ease, opacity .25s ease; }
#dots a.on::before { opacity: 1; transform: scale(1.6); }
#dots a:focus-visible { outline: 2px solid #fff; outline-offset: 0; border-radius: 50%; }

#hint { position: fixed; z-index: 5; left: 50%; bottom: 22px; transform: translateX(-50%); font: 400 clamp(12px, .85vw, 20px)/1 "Departure", monospace; letter-spacing: .16em; text-transform: uppercase;
  color: #fff; text-shadow: 0 1px 6px rgba(20, 50, 20, .6); transition: opacity .4s ease; }

/* ---------- the scroll track (real text for readers and search) ---------- */
#story { position: relative; z-index: 1; }
#story section { height: 100vh; height: 100svh; }
#story section > * { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 640px) {
  #brand .name { font-size: 20px; }
  #cards { font-size: 14px; }
}

/* ---------- loader: the paper tunnel ---------- */
html.loading { overflow: hidden; }
/* --u is the height of a 16:9 frame that covers the window; every size below is a fraction of it.
   Each ring picture is a square whose hole has a radius of a quarter of its side, so a ring's size is 4 x its hole. */
#loader { --u: max(100vh, 56.25vw); position: fixed; inset: 0; z-index: 100; overflow: hidden; background: #5f7d64; }
/* The centre is placed with vw/vh, not %: when the opening starts the page gets its scrollbar back and the loader
   becomes a few pixels narrower, and with % everything would shift and be drawn again (the portrait vanished for
   a moment and came back from top to bottom). It is also its own layer from the start, so beginning to animate it
   does not make the browser redraw it. */
#loader .eye { position: absolute; left: 50vw; top: 50vh; will-change: transform, opacity; width: calc(var(--u) * .84); height: calc(var(--u) * .84); margin: calc(var(--u) * -.42) 0 0 calc(var(--u) * -.42);
  border-radius: 50%; overflow: hidden;
  background: linear-gradient(to bottom, transparent 84%, #374728 84%), radial-gradient(circle at 42% 40%, #a9d3f0, #8fc1e8 70%); }   /* below the hill piece the ground simply continues */
/* the three of them sit whole inside the round window, behind a piece of the story's own grassy hill, which hides
   where the portrait is cut off */
#loader .eye .trio { position: absolute; left: 50%; top: 50%; width: calc(var(--u) * .52); height: auto; margin: calc(var(--u) * -.235) 0 0 calc(var(--u) * -.26);
  filter: drop-shadow(calc(var(--u) * .005) calc(var(--u) * .007) calc(var(--u) * .007) rgba(30,60,100,.4)); }
#loader .eye .hill { position: absolute; left: 50%; top: 50%; width: calc(var(--u) * 1); height: auto; margin: calc(var(--u) * .045) 0 0 calc(var(--u) * -.5); }
/* nothing of the tunnel is shown until all of its pictures are there (see the script in index.html) */
/* not quite 0: at 0 the browser does not draw the sheets at all and would only start preparing them when they are
   revealed; at .01 they are invisible to the eye but already drawn, so the reveal is a pure fade */
#loader .eye, #loader .ring { opacity: .01; transition: opacity .45s ease-out; }
#loader.ready .eye, #loader.ready .ring { opacity: 1; }
#loader .ring { position: absolute; left: 50vw; top: 50vh; width: calc(var(--u) * var(--s)); height: calc(var(--u) * var(--s));
  margin: calc(var(--u) * var(--s) / -2) 0 0 calc(var(--u) * var(--s) / -2); will-change: transform, opacity; }
#loader .ring > img, #loader .ring > i > img { position: absolute; inset: 0; width: 100%; height: 100%; will-change: transform;
  animation: ring-turn var(--t) linear infinite var(--dir, normal); }
/* the shadow turns with its ring but always falls the same way: the offset is on the wrapper, which does not turn */
#loader .ring > i { position: absolute; inset: 0; transform: translate(calc(var(--u) * .012), calc(var(--u) * .014)); opacity: .5; }
#loader .r1 { --s: 3.70; --t: 46s; }
#loader .r2 { --s: 2.16; --t: 34s; --dir: reverse; }
#loader .r3 { --s: 1.84; --t: 58s; }
#loader .r4 { --s: 1.52; --t: 30s; --dir: reverse; }
#loader .r5 { --s: 1.20; --t: 24s; }
/* the second sheet is continued in its own colour, so its square edge never shows between the long blades in front */
#loader .r2 > img { box-shadow: 0 0 0 calc(var(--u) * .5) #86a773; }
@keyframes ring-turn { to { transform: rotate(360deg); } }
/* opening: the sheets fly past the camera one after another, nearest first */
#loader.open { background: transparent; pointer-events: none; }
#loader.open .ring { animation: ring-open .9s cubic-bezier(.55, 0, .8, .35) forwards; animation-delay: var(--d); }
#loader.open .eye { animation: eye-open 1s cubic-bezier(.55, 0, .8, .35) .45s forwards; }
#loader.open .r1 { --d: 0s; } #loader.open .r2 { --d: .1s; } #loader.open .r3 { --d: .2s; } #loader.open .r4 { --d: .3s; } #loader.open .r5 { --d: .4s; }
@keyframes ring-open { 0% { transform: scale(1); opacity: 1; } 70% { opacity: 1; } 100% { transform: scale(3.4); opacity: 0; } }
@keyframes eye-open { 0% { transform: scale(1); opacity: 1; } 55% { opacity: 1; } 100% { transform: scale(4.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  #loader .ring > img, #loader .ring > i > img { animation: none; }
  #loader.open .ring, #loader.open .eye { animation: tunnel-fade .5s linear forwards; }
  @keyframes tunnel-fade { to { opacity: 0; } }
}
