/* Shared across every page: film tokens, grain, interference, nav, footer */
:root {
  --black: #0c0c0b;
  --ink: #141413;
  --char: #1f1e1c;
  --gray-1: #2c2b28;
  --gray-2: #6d6a64;
  --gray-3: #a8a49c;
  --paper: #e8e4dc;
  --white: #f5f2ec;
  --safelight: #b3352a; /* darkroom red, the only colour */
  --line-dark: rgba(245, 242, 236, 0.14);
  --line-light: rgba(20, 20, 19, 0.16);

  --display: "Archivo", "Arial Narrow", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --hand: "Reenie Beanie", cursive;
  --gutter: clamp(16px, 5vw, 64px);
  --max: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
/* Any decoration poking past the edge widens the mobile layout viewport, which then
   pans vertically and slices the fixed header; clip horizontal overflow at the root. */
html, body { overflow-x: clip; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, video, iframe, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 0.95; font-weight: 800; }
::selection { background: var(--safelight); color: var(--white); }

/* Photos and video are always developed in black & white */
.bw { filter: grayscale(1) contrast(1.12) brightness(0.95); }

/* ---------- Film overlays ---------- */
.grain {
  position: fixed; inset: -50%;
  pointer-events: none; z-index: 90;
  opacity: 0.11;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(5) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-4%, 3%); }
  40% { transform: translate(3%, -2%); }
  60% { transform: translate(-2%, -4%); }
  80% { transform: translate(4%, 2%); }
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 89;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}
/* Vertical scratches that jump around like a worn print */
.scratches { position: fixed; inset: 0; pointer-events: none; z-index: 91; }
.scratches i {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(transparent, rgba(245, 242, 236, 0.5) 20%, rgba(245, 242, 236, 0.15) 70%, transparent);
  opacity: 0;
}
.scratches i:nth-child(1) { animation: scratch 7s steps(1) infinite; }
.scratches i:nth-child(2) { animation: scratch 11s steps(1) 3s infinite; width: 2px; }
@keyframes scratch {
  0% { left: 18%; opacity: 0.6; } 3% { left: 19%; opacity: 0; }
  40% { left: 72%; opacity: 0.5; } 43% { opacity: 0; }
  70% { left: 41%; opacity: 0.4; } 72% { opacity: 0; }
}
/* Interference band (VHS tracking) triggered from JS */
.tracking {
  position: fixed; left: 0; right: 0; top: -20vh; height: 14vh;
  pointer-events: none; z-index: 92;
  background:
    repeating-linear-gradient(180deg, rgba(245, 242, 236, 0.12) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, transparent, rgba(245, 242, 236, 0.1) 45%, rgba(0, 0, 0, 0.25) 55%, transparent);
  backdrop-filter: blur(1.5px) contrast(1.4);
  opacity: 0;
}
.tracking.run { animation: track 0.9s cubic-bezier(.3, .1, .6, 1) forwards; }
@keyframes track {
  0% { top: -20vh; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; }
  100% { top: 110vh; opacity: 0; }
}
body.jolt main { animation: jolt 0.25s steps(3); }
@keyframes jolt {
  0% { transform: translate(0, 0); } 33% { transform: translate(-6px, 2px) skewX(-1deg); }
  66% { transform: translate(4px, -1px); } 100% { transform: none; }
}

/* Glitch: text duplicated in red and gray with sliced offsets */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  opacity: 0; pointer-events: none;
}
.glitch.is-glitching::before { opacity: 0.85; color: var(--safelight); animation: slice-a 0.4s steps(2) both; }
.glitch.is-glitching::after { opacity: 0.6; color: var(--gray-3); animation: slice-b 0.4s steps(2) both; }
.glitch.is-glitching { animation: shake 0.4s steps(2); }
@keyframes slice-a {
  0% { clip-path: inset(10% 0 70% 0); transform: translate(-6px, 0); }
  50% { clip-path: inset(55% 0 20% 0); transform: translate(5px, 0); }
  100% { clip-path: inset(30% 0 50% 0); transform: translate(-3px, 0); }
}
@keyframes slice-b {
  0% { clip-path: inset(65% 0 5% 0); transform: translate(6px, 0); }
  50% { clip-path: inset(5% 0 80% 0); transform: translate(-4px, 0); }
  100% { clip-path: inset(40% 0 35% 0); transform: translate(3px, 0); }
}
@keyframes shake { 50% { transform: translateX(2px); } }

/* Projector flicker for hero areas */
.flicker { animation: flicker 5s infinite; }
@keyframes flicker {
  0%, 100% { opacity: 1; } 4% { opacity: 0.86; } 5% { opacity: 1; }
  41% { opacity: 0.93; } 42% { opacity: 1; } 77% { opacity: 0.9; } 78% { opacity: 1; }
}


/* ---------- Drone + landing pad (home takeoff and roll landing) ---------- */
.drone__svg { display: block; width: 100%; height: auto; }
.prop__blades ellipse { fill: rgba(245, 242, 236, 0.9); opacity: calc(1 - var(--p, 0) * 0.75); }
.prop__disc { fill: rgba(245, 242, 236, calc(var(--p, 0) * 0.16)); stroke: rgba(245, 242, 236, calc(var(--p, 0) * 0.35)); stroke-width: 1; }
.drone__led { animation: led 1.2s steps(2) infinite; }
@keyframes led { 50% { opacity: 0.2; } }
.pad {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: 150px; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  border: 3px solid rgba(245, 242, 236, 0.8);
  background: rgba(12, 12, 11, 0.6);
  box-shadow: 0 0 0 8px rgba(12, 12, 11, 0.35);
}
.pad span { font-family: var(--display); font-weight: 900; font-size: 64px; line-height: 1; color: rgba(245, 242, 236, 0.8); font-variation-settings: "wdth" 80; }

/* ---------- Roll opening: the drone descends and lands on the roll ---------- */
/* Set from <head> so the page never paints before the intro covers it.
   The 2.5s fallback unhides the page if the script never runs. */
.ri-pending body { background: var(--ri-bg, var(--char)); }
.ri-pending body > :not(.ri):not(script) { visibility: hidden; animation: ri-unhide 0s 2.5s forwards; }
@keyframes ri-unhide { to { visibility: visible; } }
.ri {
  --p: 1; /* props at full speed while flying */
  position: fixed; inset: 0; z-index: 300;
  overflow: hidden; cursor: pointer;
  background: var(--ri-bg, var(--char));
  color: var(--white);
  transition: opacity 0.55s, transform 0.55s;
}
.ri--out { opacity: 0; transform: scale(1.06); pointer-events: none; }
/* Topographic map: JS moves it so the drone's position stays centred (transform-origin 0 0) */
.ri__map {
  --ink: var(--ri-tint, rgba(245, 242, 236, 0.35));
  position: absolute; left: 0; top: 0;
  width: max(1500px, 150vmax); aspect-ratio: 1;
  transform-origin: 0 0;
  will-change: transform;
}
.ri__svg { display: block; width: 100%; height: 100%; font-family: var(--mono); }
.ri__grid { stroke: rgba(245, 242, 236, 0.06); stroke-width: 1; }
.ri__contours { fill: none; stroke: var(--ink); stroke-width: 1.2; opacity: 0.55; }
.ri__river { fill: none; stroke: rgba(245, 242, 236, 0.18); stroke-width: 6; stroke-linecap: round; }
/* Planned route as faint dots, flown route drawn solid behind the drone */
.ri__route-plan { fill: none; stroke: rgba(245, 242, 236, 0.35); stroke-width: 2; stroke-dasharray: 2 9; stroke-linecap: round; }
.ri__route { fill: none; stroke: var(--white); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(245, 242, 236, 0.6)); }
.ri__origin circle { fill: var(--white); }
.ri__origin text, .ri__dest text, .ri__north { fill: var(--white); font-size: 13px; letter-spacing: 2px; }
.ri__dest circle { fill: rgba(12, 12, 11, 0.6); stroke: var(--white); stroke-width: 2.5; }
.ri__dest .ri__ping { fill: none; stroke: var(--ink); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ri-ping 1.2s ease-out infinite; }
@keyframes ri-ping { from { transform: scale(1); opacity: 1; } to { transform: scale(2.4); opacity: 0; } }
.ri__dest .ri__h { font-family: var(--display); font-weight: 900; font-size: 30px; letter-spacing: 0; }
.ri__dest .ri__coords { fill: var(--gray-3); font-size: 11px; }
.ri__shadow {
  position: absolute; left: 50%; top: 48%; width: 120px; height: 120px;
  translate: calc(-50% + 8px) calc(-50% + 10px); border-radius: 50%;
  background: radial-gradient(rgba(0, 0, 0, 0.7), transparent 70%);
  animation: ri-shadow 0.5s 1.3s ease-in both;
}
@keyframes ri-shadow { from { opacity: 0; scale: 1.8; } to { opacity: 1; scale: 1; } }
/* Clouds start covering the view and part as the drone drops through them */
.ri__clouds { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.ri__clouds i {
  position: absolute; width: 75vmax; height: 50vmax; border-radius: 50%;
  background: radial-gradient(rgba(245, 242, 236, 0.95), rgba(245, 242, 236, 0) 65%);
  filter: blur(16px);
  animation: ri-cloud 0.8s cubic-bezier(.4, 0, .6, 1) both;
}
.ri__clouds i:nth-child(1) { left: -25vmax; top: -15vmax; --x: -40vmax; --y: -25vmax; }
.ri__clouds i:nth-child(2) { right: -25vmax; top: -10vmax; --x: 40vmax; --y: -25vmax; }
.ri__clouds i:nth-child(3) { left: -20vmax; bottom: -20vmax; --x: -40vmax; --y: 25vmax; }
.ri__clouds i:nth-child(4) { right: -20vmax; bottom: -15vmax; --x: 40vmax; --y: 25vmax; }
@keyframes ri-cloud { 0% { opacity: 0.95; transform: none; } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1.6); } }
.ri__drone {
  position: absolute; left: 50%; top: 48%; z-index: 1;
  width: min(44vmin, 270px); translate: -50% -50%;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.6));
  /* Small while cruising over the map, grows as it descends onto the pad */
  animation: ri-hover 0.5s ease-in-out infinite alternate, ri-approach 0.5s 1.3s ease-in both;
}
@keyframes ri-approach { from { scale: 0.55; } to { scale: 1; } }
.ri__drone .prop__blades { transform-box: fill-box; transform-origin: center; animation: ri-spin 0.09s linear infinite; }
@keyframes ri-spin { to { rotate: 360deg; } }
@keyframes ri-hover { to { translate: -50% calc(-50% + 4px); } }
.ri--landed { --p: 0.3; }
.ri--landed .ri__drone { animation: ri-touch 0.35s ease-out; scale: 1; }
.ri--landed .ri__drone .prop__blades { animation-duration: 0.35s; }
@keyframes ri-touch { 40% { transform: scale(0.95); } }
/* Dust ring kicked up at touchdown */
.ri__dust {
  position: absolute; left: 50%; top: 48%; z-index: 1;
  width: min(60vmin, 380px); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  border: 2px solid rgba(245, 242, 236, 0.45);
  box-shadow: 0 0 40px rgba(245, 242, 236, 0.25) inset;
  opacity: 0; pointer-events: none;
}
.ri--landed .ri__dust { animation: ri-dust 0.6s ease-out forwards; }
@keyframes ri-dust { from { opacity: 0.9; transform: scale(0.5); } to { opacity: 0; transform: scale(1.4); } }
/* HUD */
.ri__hud {
  position: absolute; inset: 20px var(--gutter); z-index: 3; pointer-events: none;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gray-3);
}
.ri__hud > * { position: absolute; margin: 0; }
.ri__c { width: 30px; height: 30px; border: 0 solid var(--gray-3); opacity: 0.7; }
.ri__c--tl { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.ri__c--tr { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.ri__c--bl { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.ri__c--br { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }
.ri__top { top: 10px; left: 44px; right: 44px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; }
.ri__top span:first-child { color: var(--ri-text, var(--white)); }
.ri__alt { left: 10px; top: 50%; translate: 0 -50%; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ri__alt b { font-family: var(--display); font-weight: 900; font-size: clamp(30px, 4vw, 46px); line-height: 1; color: var(--white); font-variation-settings: "wdth" 62; }
.ri__status { left: 0; right: 0; bottom: 26px; text-align: center; letter-spacing: 0.3em; color: var(--white); }


/* Leaving the home page into a roll */
.page-out main, .page-out .footer { transition: opacity 0.3s, filter 0.3s; opacity: 0; filter: brightness(2.5) blur(3px); }

/* ---------- UI ---------- */
.eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gray-3); margin: 0 0 14px;
}
.eyebrow b { color: var(--safelight); font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase;
  text-decoration: none;
  padding: 14px 22px;
  border: 1px solid currentColor;
  background: transparent; color: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn:hover { background: var(--white); color: var(--black); border-color: var(--white); }
.btn--solid { background: var(--white); color: var(--black); border-color: var(--white); }
.btn--solid:hover { background: var(--safelight); color: var(--white); border-color: var(--safelight); }

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  background: rgba(12, 12, 11, 0.78);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-dark);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
}
.nav { transition: background 0.25s, box-shadow 0.25s; }
.nav.is-scrolled { background: var(--black); backdrop-filter: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }
.nav__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 600; }
.nav__brand i {
  font-style: normal; font-size: 10px; padding: 2px 6px;
  border: 1px solid var(--gray-2); color: var(--gray-3);
}
.nav__frame { color: var(--gray-3); margin-left: auto; margin-right: 24px; }
.nav__frame b { color: var(--safelight); font-weight: 500; }
.nav__links { display: flex; gap: 28px; }
.nav__links a { text-decoration: none; color: var(--gray-3); transition: color 0.2s; }
.nav__links a:hover, .nav__links a[aria-current] { color: var(--white); }
.nav__toggle { display: none; }

.section { position: relative; padding: clamp(80px, 12vw, 150px) var(--gutter); }
.section > * { max-width: var(--max); margin-left: auto; margin-right: auto; }

.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  padding: 28px var(--gutter);
  border-top: 1px solid var(--line-dark);
  background: var(--black); color: var(--gray-2);
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--white); }
.footer nav { display: flex; gap: 18px; }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.9s, transform 0.9s; }
.reveal.is-visible { opacity: 1; transform: none; }

/* Modal (video viewer) */
.modal {
  width: min(980px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0; border: 1px solid var(--line-dark);
  background: var(--ink); color: var(--white);
  overflow: auto;
}
.modal::backdrop { background: rgba(0, 0, 0, 0.88); }
.modal[open] { animation: develop 0.6s ease-out; }
@keyframes develop { from { opacity: 0; filter: brightness(3) blur(4px); } to { opacity: 1; filter: none; } }
.modal__player { aspect-ratio: 16 / 9; background: var(--black); display: grid; place-items: center; }
.modal__player iframe, .modal__player video { width: 100%; height: 100%; border: 0; }
.modal__empty { font-family: var(--mono); font-size: 13px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--gray-3); text-align: center; padding: 16px; }
.modal__body { padding: 28px clamp(20px, 4vw, 40px) 36px; }
.modal__close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 40px; height: 40px;
  border: 1px solid var(--line-dark); background: var(--black); color: var(--white);
  font-size: 15px; cursor: pointer;
}

/* Suggestion dialog (roll pages): inherits each page's colours */
.suggest { width: min(480px, calc(100% - 32px)); background: var(--modal-bg, var(--ink)); color: inherit; }
.suggest h3 { font-size: clamp(26px, 4vw, 34px); line-height: 1.1; margin: 0 0 10px; }
.suggest .modal__body > p:not(.eyebrow) { margin: 0 0 22px; opacity: 0.8; font-size: 16px; }
.suggest__list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line-dark); }
.suggest__list a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 4px; border-bottom: 1px solid var(--line-dark);
  text-decoration: none; font-size: 20px; font-weight: 700; text-transform: uppercase;
  transition: padding 0.2s, color 0.2s;
}
.suggest__list a span { font-family: var(--mono); font-size: 12px; font-weight: 400; text-transform: none; opacity: 0.7; }
.suggest__list a:hover { padding-left: 12px; color: var(--accent, var(--safelight)); }

@media (max-width: 820px) {
  .nav__frame { display: none; }
  .nav__toggle {
    display: flex; flex-direction: column; gap: 6px;
    width: 40px; height: 40px; align-items: center; justify-content: center;
    background: none; border: 0; cursor: pointer; margin-left: auto;
  }
  .nav__toggle span { width: 24px; height: 1.5px; background: var(--white); transition: transform 0.25s; }
  .nav.is-open .nav__toggle span:first-child { transform: translateY(3.75px) rotate(45deg); }
  .nav.is-open .nav__toggle span:last-child { transform: translateY(-3.75px) rotate(-45deg); }
  .nav__links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--black); border-bottom: 1px solid var(--line-dark);
    display: none;
  }
  .nav.is-open .nav__links { display: flex; }
  .nav__links a { padding: 16px var(--gutter); border-top: 1px solid var(--line-dark); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .tracking, .ri { display: none; }
}
