/* Home scroll story. Static by default (no JS / reduced motion): title, then each illustration with its caption.
   .is-live pins one stage and home-film.js drives everything from scroll. */

.hf { --paper: #f4efe2; --navy: #192d54; --ink: #243c66; --blue: #2f6aa8; position: relative; background: var(--paper); color: var(--navy); }
.hf-title { padding: clamp(2rem, 6vw, 5rem) clamp(1.25rem, 5vw, 4rem) 1.5rem; }
.hf-kicker { margin: 0 0 .75rem; font: 600 0.875rem/1.4 var(--body); letter-spacing: .08em; color: var(--blue); }
.hf-title h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(2.5rem, 6.4vw, 6rem); line-height: 1.02; letter-spacing: 0; color: var(--navy); }
.hf-scene { position: relative; margin: 0 0 2rem; }
.hf-stage { position: relative; width: 100%; overflow: hidden; }
.hf-plate { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.hf-surface, .hf-traveler { display: none; }
.hf-caption { max-width: 40rem; margin: 1rem clamp(1.25rem, 5vw, 4rem) 0; font: 400 1.125rem/1.6 var(--body); color: var(--ink); }
.hf-end { padding: 2rem clamp(1.25rem, 5vw, 4rem) 4rem; }
.hf-end-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(2.25rem, 5vw, 4.5rem); line-height: 1.05; }
.hf-end p { max-width: 36rem; font: 400 1.125rem/1.6 var(--body); color: var(--ink); }
.hf-end nav { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }
.hf-skip, .hf-progress { display: none; }
.hf .face-word, .hf-word { font-family: var(--face); font-weight: var(--weight); }

/* ---------------- live ---------------- */
.hf.is-live { height: 1400svh; }
.hf.is-live .hf-pin { position: sticky; top: var(--header, 0px); height: calc(100svh - var(--header, 0px)); overflow: hidden; background: #efe6d2; }
.hf.is-live .hf-scene { position: absolute; inset: 0; margin: 0; opacity: 0; visibility: hidden; }
.hf.is-live .hf-stage { position: absolute; left: 0; top: 0; aspect-ratio: auto !important; overflow: visible; }
.hf.is-live .hf-plate {
  translate: calc(var(--pan, 0) * var(--depth) * -9vw) calc(var(--depth) * var(--local, 0) * -1.5vh);
  scale: calc(1 + var(--depth) * var(--local, 0) * .05);
  will-change: translate;
}
.hf.is-live .hf-plate[data-ambient="sway"] { animation: hf-sway 7s ease-in-out infinite; }
.hf.is-live .hf-plate[data-ambient="sway-slow"] { animation: hf-sway 9s ease-in-out infinite reverse; }
@keyframes hf-sway { 0%, 100% { rotate: 0deg; } 50% { rotate: -1.2deg; } }

/* surfaces: a box projected onto the blank paper, screen, poster, sign, bag or label */
.hf.is-live .hf-surface, .hf.is-live .hf-traveler {
  display: grid; place-items: center; position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none;
}
.hf.is-live .hf-surface { z-index: 1; }
.hf-word { display: block; white-space: nowrap; line-height: 1.05; text-align: center; color: var(--navy); }
.hf-print .hf-word {
  opacity: var(--r, 0); transform: scale(calc(1.3 - var(--r, 0) * .3)); filter: blur(calc((1 - var(--r, 0)) * 5px));
  mix-blend-mode: multiply;
}
.hf-print[data-kind="label"] .hf-word, .hf-print[data-kind="jar"] .hf-word { color: #1d3563; }

/* pencil sketch on the paper, then ink from right to left */
.hf-sketch { display: grid; }
.hf-sketch > span { grid-area: 1 / 1; }
.hf-sketch .s-line { color: transparent; -webkit-text-stroke: .018em #5b6f8f; clip-path: inset(0 0 0 calc((1 - var(--draw, 0)) * 100%)); }
.hf-sketch .s-fill { color: var(--navy); clip-path: inset(0 0 0 calc((1 - var(--ink, 0)) * 100%)); mix-blend-mode: multiply; }
.hf-traveler .hf-word { color: var(--navy); filter: drop-shadow(0 .4rem .6rem rgba(25, 45, 84, .25)); }

/* the editor on the screen */
.hf-screen .hf-word { opacity: 0; transition: opacity .3s ease; }
.hf-screen.is-landed .hf-word { opacity: 1; }
.hf-guides { position: absolute; inset: 0; opacity: calc(var(--edit, 0) * 4); }
.hf-guides i { position: absolute; inset-inline: 6%; height: 1px; background: rgba(52, 86, 132, .55); }
.hf-guides i:nth-child(1) { top: 24%; } .hf-guides i:nth-child(2) { top: 50%; background: #b8463f; } .hf-guides i:nth-child(3) { top: 74%; }
.hf-face-name { position: absolute; inset-inline-start: 6%; bottom: 6%; font: 600 14px/1 var(--body); color: var(--blue); opacity: calc(var(--edit, 0) * 4); }

/* captions: a paper card that tells the story */
.hf.is-live .hf-caption {
  position: absolute; inset-inline-end: clamp(1rem, 4vw, 3.5rem); bottom: clamp(1.25rem, 6svh, 3.5rem); z-index: 3;
  max-width: 30rem; margin: 0; padding: 1.1rem 1.35rem; background: rgba(247, 247, 242, .94); border: 1.5px solid var(--navy);
  box-shadow: .4rem .4rem 0 rgba(25, 45, 84, .9); font-size: clamp(1.0625rem, 1.4vw, 1.25rem);
  opacity: 0; translate: 0 1rem; transition: opacity .5s ease, translate .5s ease;
}
.hf.is-live .hf-scene.is-captioned .hf-caption { opacity: 1; translate: 0 0; }

.hf.is-live .hf-end {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  padding: 2rem; background: var(--paper); opacity: 0; pointer-events: none;
}
.hf.is-live.is-end .hf-end { pointer-events: auto; }
.hf.is-live .hf-end nav { justify-content: center; }

.hf.is-live .hf-skip {
  display: block; position: absolute; top: 1rem; inset-inline-start: 1rem; z-index: 6; padding: .4rem .8rem; border-radius: 999px;
  background: rgba(247, 247, 242, .9); font: 600 0.875rem/1.4 var(--body); color: var(--navy); text-decoration: none;
}
.hf.is-live .hf-progress { display: block; position: absolute; inset: auto 0 0 0; height: 3px; z-index: 6; background: rgba(25, 45, 84, .12); }
.hf.is-live .hf-progress i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); margin-inline-start: auto; background: #4a86c5; }

@media (max-width: 56rem) {
  .hf.is-live { height: 1200svh; }
  .hf.is-live .hf-caption { inset-inline: 1rem; max-width: none; font-size: 1rem; }
}

/* ---- the dive: the scroll is a camera that flies through a door in each scene into the next one ---- */
.hf-dive, .dv-caption, .hf-hint { display: none; }
.hf-headline { padding: clamp(2rem, 6vw, 5rem) clamp(1.25rem, 5vw, 4rem) 1.5rem; }
.hf-headline h1 { margin: 0; font-family: var(--hero-face, Beeri), var(--display); font-weight: 900; font-size: clamp(2.3rem, 7vw, 7.5rem); line-height: 1.14; color: var(--navy); text-wrap: balance; }
@media (max-aspect-ratio: 4/5) { .hf-headline h1 { font-size: clamp(2rem, 11vw, 3.6rem); } }
.hf.is-live .hf-dive { display: block; position: absolute; inset: 0; z-index: 4; overflow: hidden; background: #192d54; pointer-events: none; }
.dv-scene, .dv-cam { position: absolute; left: 0; top: 0; width: var(--vw); height: var(--vh); }
.dv-scene { overflow: visible; }
.dv-cam { will-change: transform; }
.dv-main, .dv-fg, .dv-desk { position: absolute; left: var(--il); top: var(--it); width: var(--iw); height: var(--ih); max-width: none; display: block; }
.dv-fg { will-change: transform, opacity; }
.dv-desk { left: var(--dl); top: var(--dt); width: var(--dw); height: var(--dh); }
.hf.is-live .dv-caption { display: block; z-index: 5; }
.hf.is-live .dv-caption.is-on { opacity: 1; translate: 0 0; }
.hf.is-live .hf-headline { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 1.5rem; text-align: center; background: var(--paper, #f4efe2); pointer-events: none; will-change: transform, opacity; }
.hf.is-live .hf-hint { display: block; margin: 0; font: 600 1rem/1 var(--body); letter-spacing: .08em; color: var(--blue); animation: hf-hint 1.6s ease-in-out infinite; }
@keyframes hf-hint { 50% { translate: 0 .5rem; opacity: .5; } }
