/* ──────────────────────────────────────────────────────────────
   The Bigger Picture · base
   Warm paper, near-black ink, one blue-to-violet gradient used
   sparingly. Barlow throughout. A paper grain sits over everything.
   ────────────────────────────────────────────────────────────── */

:root {
  --paper: #f7f6f3;
  --white: #fff;
  --ink: #131313;
  --ink-2: #3a3a3a;
  --muted: #666460;
  --faint: #8f8d88;
  --line: #d8d5cf;
  --wash: #efede8;

  --blue: #1549b8;
  --violet: #7a5ce0;
  --orchid: #c276e6;
  --grad: linear-gradient(90deg, var(--blue), var(--violet) 55%, var(--orchid));

  /* Greys kept for the video stage, which stays dark around the picture. */
  --g-950: #0b0b0b; --g-700: #3d3d3d; --g-600: #5a5a5a; --g-500: #7a7a7a; --g-400: #9c9c9c; --g-300: #c4c4c4; --g-200: #e2e2e2; --g-100: #f1f1f1;

  --f-text: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-loud: 'Barlow', system-ui, sans-serif;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-in: cubic-bezier(.6, 0, .9, .4);
  --radius: 18px;

  --stage-h: min(calc(100svh - 56px), 860px);
  --stage-w: calc(var(--stage-h) * 9 / 16);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-text);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* The grain: one texture, a quarter strength, over the whole site. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url('../assets/texture.jpg') 0 0 / 420px 420px;
  opacity: .25; mix-blend-mode: multiply;
}
main, dialog { position: relative; z-index: 1; }

body[data-screen='intro'], body[data-screen='stories'] { overflow: hidden; height: 100svh; }

h1, h2, h3, h4, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img, svg, canvas { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 4px; }

.screen { position: relative; }

.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ───────────── buttons ───────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 46px; padding: 0 30px;
  font-weight: 600; font-size: 18px;
  background: var(--white); color: var(--ink);
  border: 1px solid #9b9892; border-radius: 10px;
  transition: transform .25s var(--ease), box-shadow .25s, border-color .2s, background-color .2s, color .2s;
}
.btn:active { transform: scale(.97); }
.btn--dark { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn--light, .btn--line { background: var(--white); }
@media (hover: hover) {
  .btn:hover { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); transform: translateY(-2px); }
  .btn--dark:hover { box-shadow: 0 3px 0 var(--violet); }
}
.link { font: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
@media (hover: hover) { .link:hover { text-decoration-thickness: 2px; } }

/* ───────────── homepage ───────────── */

.intro { height: 100svh; display: grid; grid-template-rows: auto 1fr auto; padding: clamp(18px, 4vw, 44px) clamp(20px, 6vw, 80px) max(22px, env(safe-area-inset-bottom)); overflow: hidden; }
.intro__top { display: flex; justify-content: flex-end; font-weight: 700; font-size: clamp(16px, 1.7vw, 21px); letter-spacing: -.01em; position: relative; z-index: 3; }

.intro__main { align-self: center; justify-self: center; text-align: center; display: grid; justify-items: center; position: relative; z-index: 3; max-width: 100%; }
.intro h1 { font-weight: 700; font-size: clamp(42px, 8.2vw, 76px); line-height: 1.02; letter-spacing: -.015em; text-wrap: balance; }
.intro__sub { margin-top: clamp(12px, 1.8vw, 20px); max-width: 21em; font-size: clamp(18px, 2.2vw, 25px); line-height: 1.4; text-wrap: balance; }
.intro__actions { margin-top: clamp(20px, 2.6vw, 30px); display: grid; justify-items: center; gap: 12px; }
#start { min-width: 140px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 34px; height: 20px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--faint); position: relative; transition: background-color .2s, box-shadow .2s; }
.switch__dot { position: absolute; top: 4px; left: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--faint); transition: transform .25s var(--ease), background-color .2s; }
.switch input:checked + .switch__track { background: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.switch input:checked + .switch__track .switch__dot { transform: translateX(14px); background: var(--white); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--violet); outline-offset: 3px; }
.switch__label { font-size: 14.5px; font-weight: 500; color: var(--muted); }

.intro__foot { justify-self: center; text-align: center; display: grid; justify-items: center; gap: 10px; position: relative; z-index: 3; }
.fine { max-width: 46ch; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.fine .link { white-space: nowrap; color: var(--ink); }
.intro__back { padding: 10px 16px; max-width: 46ch; font-size: 14.5px; line-height: 1.45; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.intro__back .link { margin-left: 8px; font-weight: 600; white-space: nowrap; }

@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
  .intro__main > *, .intro__top, .intro__foot { animation: rise-in .8s var(--ease) both; }
  .intro__main > :nth-child(2) { animation-delay: .08s; } .intro__main > :nth-child(3) { animation-delay: .16s; } .intro__foot { animation-delay: .4s; }
  .intro.is-leaving .intro__main, .intro.is-leaving .intro__foot, .intro.is-leaving .intro__top, .intro.is-leaving .trail { transition: opacity .35s ease, transform .5s var(--ease-in); opacity: 0; transform: translateY(-14px); }
}
@media (max-height: 560px) { .fine { display: none; } }

/* ───────────── the images that follow the cursor ───────────── */

.trail { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; contain: strict; }
.trail__img {
  position: absolute; left: 0; top: 0; pointer-events: none; user-select: none;
  object-fit: cover; border-radius: 6px; opacity: 0;
  box-shadow: 0 10px 28px rgba(20, 20, 30, .16);
  transform-origin: 50% 50%; will-change: transform, opacity; backface-visibility: hidden;
}

/* ───────────── about dialog ───────────── */

.about { width: min(92vw, 540px); max-height: 86svh; padding: 30px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.55; }
.about::backdrop { background: rgba(19, 19, 19, .45); backdrop-filter: blur(3px); }
.about h2 { font-weight: 700; font-size: 26px; line-height: 1.1; margin-bottom: 14px; }
.about p + p { margin-top: 10px; }
.about__btns { margin-top: 22px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.noscript { position: fixed; inset: auto 0 0 0; padding: 16px; background: var(--ink); color: var(--white); text-align: center; z-index: 9; }

/* ───────────── the turn: stories end, the page opens out ───────────── */

.turn { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--paper); padding: 28px; transition: opacity .6s ease; }
.turn::before { content: ''; position: absolute; inset: 0; background: url('../assets/texture.jpg') 0 0 / 420px 420px; opacity: .25; mix-blend-mode: multiply; }
.turn__frame { position: relative; max-width: 16em; font-size: clamp(30px, 6vw, 52px); }
.turn__text { font-weight: 700; font-size: 1em; line-height: 1.08; letter-spacing: -.015em; text-align: center; text-wrap: balance; transition: opacity .35s ease, transform .5s var(--ease); }
.turn__text.is-out { opacity: 0; transform: translateY(10px); }
.turn__text small { display: block; margin-top: 16px; font-weight: 400; font-size: .42em; line-height: 1.4; letter-spacing: 0; color: var(--muted); }
.turn.is-gone { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
