/* Landing story. Static: the engravings and their captions on native scroll. Filming: one screen held at the top of the page while wheel, touch and keys move the 3D story */
.land-story { --paper: #f3ecdf; position: relative; background: var(--paper); color: var(--color-tinta); }
.story-intro { display: grid; gap: var(--space-s); justify-items: start; padding: var(--space-xl) max(20px, 6vw); }
.story-intro h1 { font-size: clamp(48px, 7vw, 112px); line-height: 0.92; max-width: 12ch; }
.story-intro p { margin: 0; padding: 10px 14px; background: var(--color-white); box-shadow: 0 0 0 2px var(--color-tinta); font-weight: 600; }
.story-stage { display: grid; gap: var(--space-xl); padding: var(--space-xl) max(20px, 5vw); }
.story-frame { position: relative; margin: 0; display: grid; place-items: center; background: var(--paper); }
.story-frame img { width: 100%; height: 100%; max-height: 100svh; object-fit: cover; mix-blend-mode: multiply; filter: contrast(1.08); }
.story-frame[data-frame="2"] img { object-fit: contain; }
.story-caption { position: absolute; z-index: 1; max-width: min(34ch, 80vw); margin: 0; padding: 12px 16px; background: var(--color-white); box-shadow: 0 0 0 2px var(--color-tinta); font: 600 clamp(15px, 1.3vw, 19px)/1.4 var(--font-body); }
.story-caption.c0 { top: 14%; left: max(20px, 6vw); }
.story-caption.c1 { bottom: 14%; right: max(20px, 6vw); }
.story-caption.c2 { top: 46%; left: max(20px, 6vw); }
.story-label { position: absolute; left: max(20px, 6vw); bottom: 5%; padding: 4px 10px; background: var(--paper); box-shadow: 0 0 0 1px var(--color-tinta); font-size: 13px; color: var(--color-tinta); }
.story-credit { margin: 0; padding: var(--space-s) max(20px, 5vw) var(--space-m); font-size: 13px; color: var(--color-text-weak); background: var(--paper); }

.column:has(.landing) { position: relative; }
.column:has(.landing) > .bar { position: absolute; top: 0; left: 0; right: 0; z-index: 6; background: transparent; transition: translate var(--duration-base) var(--ease-standard), opacity var(--duration-base) var(--ease-standard); }
.column:has(.land-story[data-captured] .story-intro.gone) > .bar { translate: 0 -100%; opacity: 0; }
html:has(.land-story[data-captured]) { overscroll-behavior: none; }

.story-canvas, .film-captions, .film-grain, .film-roll, .film-tear, .story-rail, .story-chapters { display: none; }
.land-story.filming { height: 100svh; overflow: hidden; }
.land-story.filming .story-stage { position: absolute; inset: 0; display: block; padding: 0; }
.land-story.filming .story-frame, .land-story.filming .story-credit { display: none; }
.land-story.filming .story-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.land-story.filming .story-intro { background: linear-gradient(90deg, color-mix(in srgb, var(--paper) 88%, transparent) 0, color-mix(in srgb, var(--paper) 70%, transparent) 38%, transparent 68%); }
.land-story.filming .story-intro { position: absolute; z-index: 2; inset: 0; align-content: center; pointer-events: none; transition: opacity var(--duration-slow) var(--ease-standard), translate var(--duration-slow) var(--ease-emphasized); }
.land-story.filming .story-intro a { pointer-events: auto; }
.land-story.filming .story-intro.gone { opacity: 0; translate: 0 calc(var(--rise) * -1.5); }
.land-story.filming .story-intro.gone a { pointer-events: none; }
.land-story.filming .story-intro > * { opacity: 0; translate: 0 var(--rise); transition: opacity var(--duration-slow) var(--ease-standard), translate var(--duration-slow) var(--ease-emphasized); }
:root[data-ready] .land-story.filming .story-intro > * { opacity: 1; translate: 0 0; }
:root[data-ready] .land-story.filming .story-intro > :nth-child(2) { transition-delay: calc(var(--stagger) * 2); }
:root[data-ready] .land-story.filming .story-intro > :nth-child(3) { transition-delay: calc(var(--stagger) * 4); }

/* Old footage over the 1876 chapters: a brown vignette, scanlines and grain, all at the strength the story sets in --film; the tuning
   band rolls down with --roll while the picture changes era */
.land-story.filming .film-grain { display: block; position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: var(--film, 0); clip-path: inset(0 calc((1 - var(--seam, 1)) * 100%) 0 0); }
.film-grain::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 75% 70% at 50% 50%, transparent 55%, rgb(70 44 18 / 0.5) 100%), repeating-linear-gradient(to bottom, rgb(50 32 14 / 0.07) 0 1px, transparent 1px 3px); }
.film-grain::after { content: ""; position: absolute; inset: -60px; opacity: 0.32; translate: var(--grain, 0 0); background-image: 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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.2 0 0 0 0 0.13 0 0 0 0 0.05 0 0 0 1.6 -0.55'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); }
.land-story.filming .film-roll { display: block; position: absolute; pointer-events: none; inset-inline: 0; top: 0; height: 22%; translate: 0 calc(var(--roll, -1) * 560% - 120%); background: linear-gradient(to bottom, transparent, rgb(255 246 222 / 0.55) 45%, rgb(40 26 12 / 0.35) 52%, transparent); opacity: calc(var(--roll, -1) * (1 - var(--roll, -1)) * 4); }
/* At the table the two times meet along a torn strip of paper that crosses the screen with --seam */
.land-story.filming .film-tear { display: block; position: absolute; inset-block: 0; left: calc(var(--seam, 1) * 100%); width: 28px; translate: -50% 0; pointer-events: none; opacity: var(--tear, 0); background: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2728%27 height=%27400%27 viewBox=%270 0 28 400%27%3E%3Cpolygon points=%274.3,0.0 2.5,10.2 2.4,18.1 5.0,23.4 5.0,29.2 3.6,35.1 6.0,47.7 2.3,60.5 3.0,67.9 7.7,75.3 6.5,85.0 2.4,94.4 6.8,101.0 6.1,108.5 7.6,115.9 6.0,122.9 7.1,134.9 2.8,147.7 3.1,158.8 6.7,164.1 8.1,173.7 6.2,184.2 7.9,192.9 6.6,201.7 6.5,212.3 4.0,223.9 2.2,234.2 2.8,240.6 2.9,251.7 8.1,259.8 5.8,268.4 8.0,280.0 4.5,288.3 3.1,301.0 3.6,307.8 3.8,317.5 4.6,325.9 6.8,338.5 6.7,348.4 7.5,360.6 4.7,372.0 6.4,377.9 3.5,383.4 2.4,391.1 4.3,400.0 20.1,400.0 19.0,391.1 20.1,383.4 19.4,377.9 21.8,372.0 25.1,360.6 19.4,348.4 22.6,338.5 23.0,325.9 19.0,317.5 22.4,307.8 20.2,301.0 25.2,288.3 20.9,280.0 25.2,268.4 19.6,259.8 20.7,251.7 19.4,240.6 22.2,234.2 21.7,223.9 26.0,212.3 19.4,201.7 25.6,192.9 23.1,184.2 21.2,173.7 24.4,164.1 22.4,158.8 21.9,147.7 21.0,134.9 22.7,122.9 23.9,115.9 22.2,108.5 22.0,101.0 19.4,94.4 21.6,85.0 20.3,75.3 19.8,67.9 25.0,60.5 21.8,47.7 23.4,35.1 24.8,29.2 19.5,23.4 22.6,18.1 22.8,10.2 20.1,0.0%27 fill=%27%23f3ecdf%27/%3E%3Cpolyline points=%2721.6,400.0 20.5,391.1 21.6,383.4 20.9,377.9 23.3,372.0 26.6,360.6 20.9,348.4 24.1,338.5 24.5,325.9 20.5,317.5 23.9,307.8 21.7,301.0 26.7,288.3 22.4,280.0 26.7,268.4 21.1,259.8 22.2,251.7 20.9,240.6 23.7,234.2 23.2,223.9 27.5,212.3 20.9,201.7 27.1,192.9 24.6,184.2 22.7,173.7 25.9,164.1 23.9,158.8 23.4,147.7 22.5,134.9 24.2,122.9 25.4,115.9 23.7,108.5 23.5,101.0 20.9,94.4 23.1,85.0 21.8,75.3 21.3,67.9 26.5,60.5 23.3,47.7 24.9,35.1 26.3,29.2 21.0,23.4 24.1,18.1 24.3,10.2 21.6,0.0%27 fill=%27none%27 stroke=%27%23cdbf9f%27 stroke-width=%271.2%27/%3E%3C/svg%3E") 0 0 / 28px 400px repeat-y; filter: drop-shadow(2px 0 2px rgb(40 26 12 / 0.35)) drop-shadow(-2px 0 2px rgb(40 26 12 / 0.35)); }
.land-story.filming .film-captions { display: block; position: absolute; inset: 0; pointer-events: none; }
/* The news pans in: a caption slides in from ahead with a slight turn, settles, and slides on out the other way when its moment passes */
.film-captions .story-caption { opacity: 0; translate: 9% 0; rotate: 2.5deg; transition: opacity var(--duration-base) var(--ease-standard), translate var(--duration-caption) var(--ease-spring), rotate var(--duration-caption) var(--ease-spring); }
.film-captions .story-caption.gone { translate: -9% 0; rotate: -2.5deg; }
.film-captions .story-caption.on { opacity: 1; translate: 0 0; rotate: var(--tilt, 0deg); }

/* 1876: a clipping from the Sunday paper, torn from the page */
.film-captions .era-press { --tilt: -0.8deg; padding: 34px 20px 18px; background: #eee3c6; color: #2a2118; box-shadow: none; filter: drop-shadow(3px 4px 0 rgba(28, 23, 18, 0.28)); font: 400 clamp(17px, 1.35vw, 21px)/1.5 "Old Standard TT", Georgia, serif; text-wrap: pretty; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 3 L4 1 L9 3 L13 0.5 L19 2.5 L24 1 L30 3 L35 0.8 L41 2.4 L47 0.6 L52 2.8 L58 1 L63 3 L69 0.7 L74 2.2 L80 0.9 L86 2.9 L91 1.1 L96 2.6 L100 1 L100 98 L95 99.6 L90 97.4 L84 99.2 L79 97.1 L73 99.4 L67 97.6 L62 99.5 L56 97.2 L51 99.1 L45 97.5 L40 99.6 L34 97.3 L29 99.2 L23 97.6 L18 99.5 L12 97.2 L7 99.3 L2 97.6 L0 99 Z'/%3E%3C/svg%3E") 0 0 / 100% 100%; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 3 L4 1 L9 3 L13 0.5 L19 2.5 L24 1 L30 3 L35 0.8 L41 2.4 L47 0.6 L52 2.8 L58 1 L63 3 L69 0.7 L74 2.2 L80 0.9 L86 2.9 L91 1.1 L96 2.6 L100 1 L100 98 L95 99.6 L90 97.4 L84 99.2 L79 97.1 L73 99.4 L67 97.6 L62 99.5 L56 97.2 L51 99.1 L45 97.5 L40 99.6 L34 97.3 L29 99.2 L23 97.6 L18 99.5 L12 97.2 L7 99.3 L2 97.6 L0 99 Z'/%3E%3C/svg%3E") 0 0 / 100% 100%; }
.film-captions .era-press::before { content: attr(data-year); position: absolute; top: 9px; left: 20px; right: 20px; padding: 2px 0 1px; border-block: 3px double rgba(42, 33, 24, 0.75); font: 700 11px/1.2 "Old Standard TT", Georgia, serif; letter-spacing: 0.32em; text-align: center; }
.film-captions .era-press .caption-words > span:first-child { font-variant: small-caps; font-weight: 700; letter-spacing: 0.03em; }

/* Today: a printed receipt from the kitchen, perforated along its foot */
.film-captions .era-note { --tilt: 0.6deg; padding: 30px 18px 22px; background: #fffdf6; color: #1c1712; box-shadow: 0 10px 24px rgba(28, 23, 18, 0.14); font: 500 clamp(15px, 1.25vw, 18px)/1.45 var(--font-body); -webkit-mask: radial-gradient(circle at 6px 100%, transparent 4px, #000 4.5px) 0 0 / 12px 100% repeat-x; mask: radial-gradient(circle at 6px 100%, transparent 4px, #000 4.5px) 0 0 / 12px 100% repeat-x; }
.film-captions .era-note::before { content: attr(data-year); position: absolute; top: 10px; left: 18px; right: 18px; padding-bottom: 4px; border-bottom: 1.5px dashed rgba(28, 23, 18, 0.35); font: 600 11px/1 var(--font-body); letter-spacing: 0.08em; color: #6b5f52; }

/* Once the fridge knows: a notification from the app */
.film-captions .era-app { padding: 14px 32px 14px 58px; border-radius: 18px; background: #fffdf8; color: #1c1712; box-shadow: 0 0 0 1px rgba(28, 23, 18, 0.08), 0 16px 34px rgba(28, 23, 18, 0.2); font: 600 clamp(15px, 1.2vw, 18px)/1.4 var(--font-body); }
.film-captions .era-app::before { content: ""; position: absolute; left: 14px; top: 14px; width: 30px; height: 30px; border-radius: 9px; background: #f3ecdf url("/brand/logo-mark.svg") center / 72% no-repeat; box-shadow: inset 0 0 0 1.5px rgba(28, 23, 18, 0.15); }
.film-captions .era-app::after { content: ""; position: absolute; right: 14px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: #2f6b4a; }

.caption-words > span { display: inline-block; opacity: 0; translate: 0 0.35em; transition: opacity var(--duration-fast) var(--ease-standard), translate var(--duration-fast) var(--ease-standard); }
.story-caption.on .caption-words > span { opacity: 1; translate: 0 0; transition-duration: var(--duration-slow); transition-timing-function: var(--ease-emphasized); transition-delay: calc(var(--duration-caption) * 0.4 + var(--i) * 110ms); }

.land-story.filming .story-rail { display: block; position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 4px; background: color-mix(in srgb, var(--color-tinta) 14%, transparent); }
.story-rail span { display: block; height: 100%; background: var(--color-tinta); transform: scaleX(0); transform-origin: left center; }

.land-story.filming .story-chapters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; position: absolute; z-index: 3; right: max(16px, 4vw); bottom: 20px; left: max(16px, 4vw); pointer-events: none; }
.story-chapters button { pointer-events: auto; min-height: 36px; padding: 6px 12px; border: 0; border-radius: 999px; background: var(--paper); color: var(--color-tinta); box-shadow: 0 0 0 1.5px var(--color-tinta); font: 600 13px/1 var(--font-body); cursor: pointer; }
.story-chapters button[aria-current] { background: var(--color-tinta); color: var(--paper); }

/* The note under the fridge: the door is dragged on the canvas itself; this only says how, and takes the keyboard */
.story-hold { position: absolute; z-index: 3; left: 50%; bottom: 14%; translate: -50% 0; display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px; background: var(--color-white); box-shadow: 0 0 0 2px var(--color-tinta); color: var(--color-tinta); font: 600 15px/1.2 var(--font-body); pointer-events: none; user-select: none; -webkit-user-select: none; }
.story-hold[hidden] { display: none; }
.story-hold:focus-visible { outline: 3px solid var(--color-focus, var(--color-primary)); outline-offset: 3px; }
.land-story.pulling .story-hold { opacity: 0; transition: opacity var(--duration-base) var(--ease-standard); }
.land-story.pulling .story-canvas { cursor: grabbing; }
.land-story.filming .story-canvas { touch-action: pan-y; }
.drag-hand { width: 26px; height: 16px; flex: none; background: linear-gradient(var(--color-tinta), var(--color-tinta)) 6px 50% / 20px 2px no-repeat; position: relative; }
.drag-hand::before { content: ""; position: absolute; left: 1px; top: 50%; width: 8px; height: 8px; border-left: 2px solid var(--color-tinta); border-bottom: 2px solid var(--color-tinta); translate: 0 -50%; rotate: 45deg; }
@media (prefers-reduced-motion: no-preference) {
  .story-hold:not([hidden]) .drag-hand { animation: pull-left 1.4s var(--ease-standard, ease) 3; }
}
@keyframes pull-left { 50% { translate: -6px 0; } }

@media (max-width: 700px) {
  .story-caption.c0 { top: 8%; }
  .story-caption.c1 { bottom: 10%; }
  .story-frame:has(.story-label) .story-caption.c1 { bottom: 20%; }
  .land-story.filming .story-caption.c0 { top: 12%; }
  .land-story.filming .story-caption.c1 { bottom: 96px; }
  .land-story.filming .story-chapters { justify-content: center; }
  .story-hold { bottom: 22%; font-size: 14px; max-width: calc(100vw - 32px); }
}

.story-frame.still img { object-fit: contain; max-height: 80svh; mix-blend-mode: normal; }

/* Paper lens: a raking light that lifts the paper and shows its fibres under the pointer; nothing is drawn onto the page */
.ink-trail { position: fixed; inset: 0; z-index: 40; width: 100%; height: 100%; pointer-events: none; }
