/* The landing's story (d165, the owner's request of 14 November 2026): under the landing's first screen, kept as it
   is, « Défiler pour en savoir plus », then one chapter per thing the product does, each snapping into place with a
   drawn scene that plays when it arrives (js/story.js). The same file on jaunt.one and daffin.one: nebul.'s common
   look, each site's colours given by its own --accent / --accent-2 (index.html's .story style attribute), and on
   :root its face (--face, Satoshi when unset: daffin.one sets Plus Jakarta Sans), the scroll hint's light (--hint) and
   the rail's (--rail), both RGB triplets, jaunt's amber when unset.
   Under prefers-reduced-motion every scene is shown as its last frame, still. */

/* the page scrolls (the landing alone does not: style.css), snapping to the chapters on a screen tall enough to hold
   one; on a short one (a phone held sideways) the snap only helps */
html:has(.story) { height: auto; overflow-x: hidden; overflow-y: auto; scroll-snap-type: y mandatory; }
html:has(.story) body { height: auto; overflow: visible; }
@media (max-height: 540px) { html:has(.story) { scroll-snap-type: y proximity; } }
/* a sheet open over the landing: the page under it stays where it is */
html.sheet-on:has(.story) { overflow: hidden; }

.story {
  --accent: 231 162 70;
  --accent-2: 143 211 214;
  --ink: 238 240 246;
  --frame: rgb(var(--ink) / .3);
  --wire: rgb(var(--ink) / .16);
  --glass: #0c0e0f;
  --body: #060707;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --snap: cubic-bezier(.65, 0, .35, 1);
  position: relative;
  z-index: 6;
  /* (over the landing's first screen the story lets everything through: the scroll hint, the nebul. mark's link and
     the footer's links stay live under its transparent lead; the chapters take the pointer) */
  pointer-events: none;
  user-select: text;
  -webkit-user-select: text;
}
/* the landing's grain and scanlines over the chapters too: one surface */
#grain { z-index: 7; }
body::after { z-index: 7; }

/* the first screen: the landing itself, seen through */
.story .lead { height: 100vh; height: 100svh; scroll-snap-align: start; pointer-events: none; }
.story > :not(.lead) { pointer-events: auto; }

/* ------------------------------------------------ « Défiler pour en savoir plus » */
.scroll-hint {
  position: fixed;
  left: 50%;
  bottom: calc(var(--foot-room, 64px) + 9svh);
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  background: none;
  color: rgb(238 240 246);
  font: 400 11px/1 var(--face, "Satoshi", "Helvetica Neue", Arial, sans-serif);
  letter-spacing: .22em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
  animation: hint-in 1.2s ease 2.2s forwards;
  transition: opacity .4s ease, visibility 0s linear .4s;
}
.scroll-hint span { opacity: .55; transition: opacity .3s ease; }
.scroll-hint:hover span, .scroll-hint:focus-visible span { opacity: 1; }
.scroll-hint:focus-visible { outline: 1px solid rgb(238 240 246 / .55); outline-offset: 2px; border-radius: 6px; }
/* a thin line and a light running down it */
.scroll-hint i { position: relative; display: block; width: 1px; height: 34px; background: rgb(238 240 246 / .18); overflow: hidden; }
.scroll-hint i::after {
  content: "";
  position: absolute;
  left: -1px;
  top: -12px;
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: rgb(var(--hint, 231 162 70));
  box-shadow: 0 0 8px rgb(var(--hint, 231 162 70) / .8);
  animation: hint-run 2.2s var(--snap, ease) 3s infinite;
}
@keyframes hint-in { to { opacity: 1; } }
@keyframes hint-run { 0% { transform: translateY(0); } 70%, 100% { transform: translateY(48px); } }
html.past-lead .scroll-hint { opacity: 0 !important; visibility: hidden; animation: none; }
html.sheet-on .scroll-hint { visibility: hidden; }

/* ------------------------------------------------ the rail: where one is, every chapter one step away */
.story-rail {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  top: 50%;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translate(8px, -50%);
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s ease, transform .5s var(--ease), visibility 0s linear .5s;
}
html.past-lead .story-rail { opacity: 1; visibility: visible; transform: translate(0, -50%); transition: opacity .5s ease, transform .5s var(--ease), visibility 0s; }
.story-rail a { display: block; padding: 4px; border-radius: 4px; }
.story-rail a::before { content: ""; display: block; width: 4px; height: 4px; border-radius: 2px; background: rgb(238 240 246 / .3); transition: height .45s var(--ease), background .3s ease; }
.story-rail a:hover::before { background: rgb(238 240 246 / .7); }
.story-rail a[aria-current]::before { height: 18px; background: rgb(var(--rail, 231 162 70)); }
.story-rail a:focus-visible { outline: 1px solid rgb(238 240 246 / .55); }
@media (max-width: 720px) { .story-rail { display: none; } }

/* ------------------------------------------------ a chapter */
.chapter {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, .82fr) 1.25fr;
  align-items: center;
  gap: clamp(24px, 5vw, 96px);
  height: 100vh;
  height: 100svh;
  padding: clamp(84px, 11vh, 120px) clamp(24px, 7vw, 140px) clamp(40px, 7vh, 80px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: var(--body);
  overflow: hidden;
}
/* each chapter's own light, low and warm, from the side of its scene */
.chapter::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(60% 70% at 72% 55%, rgb(var(--accent) / .07), transparent 70%);
  opacity: 0;
  transition: opacity 1.6s ease;
}
.chapter.on::before { opacity: 1; }
.chapter:nth-of-type(even) .copy { order: 2; }
/* (the columns swap with it: the scene keeps its wide one on either side) */
.chapter:nth-of-type(even) { grid-template-columns: 1.25fr minmax(280px, .82fr); }
.chapter:nth-of-type(even)::before { background: radial-gradient(60% 70% at 28% 55%, rgb(var(--accent-2) / .06), transparent 70%); }
/* the first one comes over the landing with a soft edge */
.chapter.first { background: linear-gradient(to bottom, transparent, var(--body) 90px); }

.copy { position: relative; max-width: 34rem; }
.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  font: 400 11px/1 var(--face, "Satoshi", "Helvetica Neue", Arial, sans-serif);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: rgb(var(--accent));
}
.kicker b { font-weight: 400; color: rgb(var(--ink) / .45); letter-spacing: .12em; }
.kicker::after { content: ""; width: 36px; height: 1px; background: currentColor; opacity: .5; }
.chapter h2 {
  margin: 0;
  font: 400 clamp(28px, 3.5vw, 56px)/1.06 var(--face, "Satoshi", "Helvetica Neue", Arial, sans-serif);
  letter-spacing: -.018em;
  color: rgb(var(--ink));
  text-wrap: balance;
}
.chapter p {
  margin: 20px 0 0;
  max-width: 33ch;
  font: 300 clamp(15px, 1.2vw, 19px)/1.55 var(--face, "Satoshi", "Helvetica Neue", Arial, sans-serif);
  letter-spacing: .01em;
  color: rgb(var(--ink) / .7);
  text-wrap: pretty;
}
.chapter p em { font-style: normal; color: rgb(var(--ink) / .92); }
.chapter p a.more { color: rgb(var(--ink) / .92); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgb(var(--accent) / .7); }
.soon {
  display: inline-block;
  margin-left: 6px;
  padding: 3px 7px 2px;
  border: 1px solid rgb(var(--accent) / .5);
  border-radius: 999px;
  font: 400 11px/1.2 var(--face, "Satoshi", "Helvetica Neue", Arial, sans-serif);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgb(var(--accent));
  vertical-align: middle;
}
/* (the prototype only: a sentence still to be confirmed by the product's session and read by Légal) */
.tbc { outline: 1px dashed rgb(255 120 120 / .45); outline-offset: 4px; border-radius: 2px; }
.chapter p.tbc-note { margin: 0; max-width: none; font: 400 11px/1.3 ui-monospace, Menlo, Consolas, monospace; color: rgb(255 140 140 / .75); letter-spacing: .04em; }

/* the scene: an SVG drawn for the page, scaled to its room */
.stage { position: relative; width: 100%; height: min(74vh, 640px); min-height: 0; }
.stage svg { display: block; width: 100%; height: 100%; overflow: visible; }
.stage text { font-family: var(--face, "Satoshi", "Helvetica Neue", Arial, sans-serif); fill: rgb(var(--ink) / .62); }
.stage .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.stage .lbl { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; fill: rgb(var(--ink) / .42); }
.story .frame { fill: var(--body); stroke: var(--frame); stroke-width: 1.2; }
.story .glass { fill: var(--glass); }
.story .wire { fill: none; stroke: var(--wire); stroke-width: 1.2; }
.story .ln { fill: rgb(var(--ink) / .14); }
.story .hot { fill: rgb(var(--accent)); }
.story .cool { fill: rgb(var(--accent-2)); }
.story .hot-s { fill: none; stroke: rgb(var(--accent)); }
.story .cool-s { fill: none; stroke: rgb(var(--accent-2)); }
.stage .pulse { fill: none; stroke: rgb(var(--accent)); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 4 96; stroke-dashoffset: 60; filter: drop-shadow(0 0 4px rgb(var(--accent) / .9)); }
.stage .pulse.c2 { stroke: rgb(var(--accent-2)); filter: drop-shadow(0 0 4px rgb(var(--accent-2) / .9)); }
.stage * { transform-box: fill-box; transform-origin: center; }

/* the call at the end */
.chapter.call { grid-template-columns: 1fr; justify-items: center; text-align: center; }
.chapter.call .copy { max-width: 40rem; display: flex; flex-direction: column; align-items: center; }
.chapter.call p { max-width: 40ch; }
.chapter.call .kicker::before { content: ""; width: 36px; height: 1px; background: currentColor; opacity: .5; }
.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 34px;
  padding: 15px 26px;
  border-radius: 999px;
  background: rgb(var(--accent));
  color: #120c04;
  font: 400 15px/1 var(--face, "Satoshi", "Helvetica Neue", Arial, sans-serif);
  letter-spacing: .06em;
  text-decoration: none;
  box-shadow: 0 0 0 0 rgb(var(--accent) / .5), 0 18px 60px rgb(var(--accent) / .22);
  transition: transform .4s var(--ease), box-shadow .4s ease;
}
.cta:hover, .cta:focus-visible { transform: translateY(-2px); box-shadow: 0 0 0 6px rgb(var(--accent) / .14), 0 24px 70px rgb(var(--accent) / .3); outline: none; }
.cta svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; transition: transform .4s var(--ease); }
.cta:hover svg { transform: translateX(3px); }
.ea-note { margin-top: 14px !important; font-size: 12px !important; letter-spacing: .14em; text-transform: uppercase; color: rgb(var(--ink) / .45) !important; }
/* (clear of what may sit fixed at the bottom of the window: the sandbox's own line, 30 px) */
.story-foot { position: absolute; left: 0; right: 0; bottom: max(44px, calc(env(safe-area-inset-bottom) + 36px)); display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 16px; }
.story-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; }
.story-foot a { font: 400 12px/1 var(--face, "Satoshi", "Helvetica Neue", Arial, sans-serif); letter-spacing: .08em; color: rgb(var(--ink)); opacity: .5; text-decoration: none; }
.story-foot a:hover, .story-foot a:focus-visible { opacity: 1; outline: none; }
.story-foot small { max-width: 70ch; font: 300 11px/1.5 var(--face, "Satoshi", "Helvetica Neue", Arial, sans-serif); letter-spacing: .02em; color: rgb(var(--ink) / .36); text-align: center; }

/* ------------------------------------------------ a phone, a narrow window: the words above, the scene under them */
@media (max-width: 900px) {
  .chapter {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: max(74px, calc(env(safe-area-inset-top) + 64px)) 22px max(26px, env(safe-area-inset-bottom));
  }
  .chapter:nth-of-type(even) .copy { order: 0; }
  .chapter .stage { flex: 1; height: auto; }
  .kicker { margin-bottom: 14px; }
  .chapter h2 { font-size: clamp(26px, 7.4vw, 38px); }
  .chapter p { margin-top: 12px; font-size: 15px; line-height: 1.5; max-width: 40ch; }
  .chapter.call { justify-content: center; }
}
@media (max-width: 900px) and (max-height: 700px) {
  .chapter p { font-size: 14px; }
  .chapter h2 { font-size: clamp(24px, 6.6vw, 32px); }
}

/* ------------------------------------------------ motion: what arrives, when its chapter does (js/story.js: .live, .on) */
.live .chapter:not(.on) :is(.r-up, .r-fade, .r-pop, .r-draw, .r-left, .r-right) { opacity: 0; }
.on .r-up { animation: r-up .9s var(--ease) var(--d, 0s) both; }
.on .r-fade { animation: r-fade .9s ease var(--d, 0s) both; }
.on .r-pop { animation: r-pop .7s cubic-bezier(.3, 1.4, .5, 1) var(--d, 0s) both; }
.on .r-left { animation: r-left .9s var(--ease) var(--d, 0s) both; }
.on .r-right { animation: r-right .9s var(--ease) var(--d, 0s) both; }
.on .r-draw { stroke-dasharray: 1; animation: r-draw 1.2s var(--snap) var(--d, 0s) both; }
@keyframes r-up { from { opacity: 0; transform: translateY(18px); } }
@keyframes r-fade { from { opacity: 0; } }
@keyframes r-pop { from { opacity: 0; transform: scale(.6); } }
@keyframes r-left { from { opacity: 0; transform: translateX(-26px); } }
@keyframes r-right { from { opacity: 0; transform: translateX(26px); } }
@keyframes r-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
/* a light running along a wire, again and again */
.on .pulse { animation: run var(--t, 2.4s) linear var(--d, 0s) infinite; }
.on .pulse.back { animation-name: run-back; }
@keyframes run { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes run-back { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 100; } }
/* the words of the copy, in turn */
.on .copy > * { animation: r-up 1s var(--ease) both; }
.on .copy > :nth-child(2) { animation-delay: .08s; }
.on .copy > :nth-child(3) { animation-delay: .16s; }
.on .copy > :nth-child(4) { animation-delay: .24s; }
.on .copy > :nth-child(5) { animation-delay: .32s; }
.live .chapter:not(.on) .copy > * { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .story *, .story *::before, .story *::after { animation: none !important; transition: none !important; }
  .scroll-hint { animation: none; opacity: 1; }
  .scroll-hint i::after { display: none; }
  .story-rail { transition: none; }
}

/* ================================================ reels (the owner's second round, 14 November 2026): a stage pinned
   while the page scrolls over --len screens' heights, its scene driven by the scroll (js/story.js writes the reel's
   progress, 0 to 1, as --p). Every element that moves plays its own keyframes on it: give it `--k: <name>` and the
   class .k; its keyframes run from 0 % (p = 0) to 100 % (p = 1), transform and opacity only. */
.reel { position: relative; height: calc(var(--len, 300) * 1svh); --p: 0; }
/* (from the landing to the reel, no edge: the reel's first colour fades in over the screen before it) */
.reel::before { content: ""; position: absolute; left: 0; right: 0; top: -45svh; height: 45svh; pointer-events: none; background: linear-gradient(to bottom, transparent, var(--seam, var(--body))); }
/* (and no edge where the stage itself begins: its top is the seam's colour while it comes in, then its own) */
.reel > .stage-pin::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 35svh; z-index: 1; pointer-events: none; background: linear-gradient(to bottom, var(--seam, var(--body)), transparent); animation: seam-out 1s linear both paused; animation-delay: calc(var(--p) * -1s); }
@keyframes seam-out { 0% { opacity: 1; } 6%, 100% { opacity: 0; } }
/* (a reel marked .ends: its words leave first, then its scene dissolves while the call that follows comes up over it (no
   screen left empty), all before anything could pass under the top bar. The end begins at --end, a share of the reel's
   run (.8 unless the reel says otherwise): a long reel keeps a short end) */
.reel.ends > .stage-pin > .says { animation: stage-exit-says 1s linear both paused; animation-delay: calc(clamp(0, (var(--p) - var(--end, .8)) / (1 - var(--end, .8)), 1) * -1s); }
.reel.ends > .stage-pin > :is(.scene, .sky) { animation: stage-exit 1s linear both paused; animation-delay: calc(clamp(0, (var(--p) - var(--end, .8)) / (1 - var(--end, .8)), 1) * -1s); }
@keyframes stage-exit-says { 0% { opacity: 1; } 25%, 100% { opacity: 0; } }
@keyframes stage-exit { 0%, 15% { opacity: 1; } 50%, 100% { opacity: 0; } }
.reel.ends + .chapter.call { margin-top: calc(var(--overlap, 100) * -1svh); position: relative; z-index: 2; background: transparent; align-content: start; justify-content: flex-start; padding-top: 24svh; }
.reel > .stage-pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--body); }
.reel .k { animation: var(--k) 1s linear both paused; animation-delay: calc(var(--p) * -1s); will-change: transform, opacity; }
/* the reel's chapters: the rail's steps, and where the scroll comes to rest (proximity: it helps, it never jumps) */
.reel .mark { position: absolute; left: 0; width: 1px; height: 1px; scroll-snap-align: start; pointer-events: none; }
html:has(.reel) { scroll-snap-type: y proximity; }
/* (no reel moves by itself: under reduced motion it still follows the finger, nothing else runs) */
@media (prefers-reduced-motion: reduce) {
  .reel .k { animation: var(--k) 1s linear both paused !important; animation-delay: calc(var(--p) * -1s) !important; }
}

/* ================================================ the sky (track B): stars at three depths (js/story.js lays them),
   drifting with the reel's progress, deeper ones less; a light per machine, its halo breathing (the only thing that
   moves by itself, and not under reduced motion) */
.sky { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(120% 90% at 50% 40%, #0b0f14, #030405 70%); }
.sky .stars { position: absolute; inset: -10%; will-change: transform; transform: translate3d(0, calc(var(--p) * var(--drift, -6%)), 0) scale(calc(1 + var(--p) * var(--zoom, .08))); }
.sky .stars.d1 { --drift: -12%; --zoom: .18; }
.sky .stars.d2 { --drift: -22%; --zoom: .32; }
.sky .stars i { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: rgb(238 240 246 / var(--a)); }
.light { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: rgb(var(--accent)); box-shadow: 0 0 18px 6px rgb(var(--accent) / .45), 0 0 60px 20px rgb(var(--accent) / .18); }
.live .light::after { content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 1px solid rgb(var(--accent) / .5); animation: light-breathe 3.2s ease-in-out infinite; }
@keyframes light-breathe { 0%, 100% { transform: scale(.7); opacity: 0; } 40% { opacity: .9; } 100% { transform: scale(1.8); } }
