/* Somnacam : le site reprend la DA de l'app (docs/DA.md), « Ciel de nuit ». */
:root {
  --nuit: #14163A;
  --nuit-profonde: #0D0F2B;
  --nuit-claire: #23265A;
  --nuit-trait: #3A3D7A;
  --lune: #F6EFD3;
  --brume: #A3A5CC;
  --rec: #FF4D3D;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--nuit);
  color: var(--lune);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.landing { background: var(--nuit-profonde); }
img { display: block; max-width: 100%; }
a { color: var(--lune); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--lune); outline-offset: 4px; border-radius: 8px; }

.page { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

h1, h2, .serif {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}
h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.06; }
h3 { font-size: 1.0625rem; font-weight: 600; margin: 0 0 6px; }
p { margin: 14px 0 0; }
.muted { color: var(--brume); }

/* ——— Bouton App Store (badge) ——— */
.badge {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 11px 22px 11px 18px;
  border-radius: 14px;
  background: var(--lune); color: var(--nuit);
  text-decoration: none; line-height: 1.1;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  box-shadow: 0 10px 30px -12px rgba(246, 239, 211, .45);
}
.badge:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -12px rgba(246, 239, 211, .55); }
.badge svg { width: 26px; height: 26px; flex: none; }
.badge small { display: block; font-size: .75rem; font-weight: 500; opacity: .75; }
.badge strong { display: block; font-size: 1.1875rem; font-weight: 600; letter-spacing: -.01em; }
.badge.small { padding: 7px 14px 7px 12px; border-radius: 10px; gap: 8px; box-shadow: none; }
.badge.small svg { width: 18px; height: 18px; }
.badge.small strong { font-size: .875rem; }

/* ——— Barre du haut : invisible sur le hero, apparaît ensuite ——— */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 20;
  transform: translateY(-100%); opacity: 0;
  transition: transform .45s var(--ease), opacity .45s var(--ease);
  background: rgba(13, 15, 43, .72);
  backdrop-filter: saturate(140%) blur(16px);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  border-bottom: 1px solid rgba(58, 61, 122, .6);
}
.nav.shown { transform: none; opacity: 1; }
.nav .page { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a:not(.badge) { color: var(--brume); text-decoration: none; font-size: .9375rem; }
.nav-links a:not(.badge):hover { color: var(--lune); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }

/* Petite barre des pages de texte (toujours visible) */
.bar { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.bar nav a { color: var(--brume); text-decoration: none; font-size: .9375rem; margin-left: 22px; }
.bar nav a:hover { color: var(--lune); }

/* ——— Hero : l'icône, le nom, le bouton. Rien d'autre. ——— */
.hero {
  position: relative; min-height: 100svh; overflow: hidden;
  display: grid; place-items: center; text-align: center;
  background:
    radial-gradient(60% 50% at 50% 42%, rgba(43, 46, 107, .9), transparent 70%),
    var(--nuit-profonde);
  padding: 80px 24px 120px;
}
.stars { position: absolute; inset: 0; pointer-events: none; }
.stars i {
  position: absolute; width: var(--s, 2px); height: var(--s, 2px); border-radius: 50%;
  background: var(--lune); opacity: 0;
  animation: star-in 1.6s var(--ease) var(--d, 0s) forwards, twinkle 5s ease-in-out calc(var(--d, 0s) + 1.6s) infinite;
}
@keyframes star-in { to { opacity: var(--o, .6); } }
@keyframes twinkle { 50% { opacity: calc(var(--o, .6) * .35); } }

.hero-inner { position: relative; z-index: 1; display: grid; justify-items: center; }
.hero-icon {
  width: clamp(104px, 14vw, 148px); aspect-ratio: 1; border-radius: 23%;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(246, 239, 211, .08);
}
.hero-icon-wrap { position: relative; }
.hero-icon-wrap::after {
  /* le halo rouge du point d'enregistrement, qui « respire » une fois */
  content: ""; position: absolute; left: 66%; top: 41%; width: 70%; aspect-ratio: 1;
  translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 77, 61, .45), transparent 65%);
  filter: blur(14px); opacity: 0; pointer-events: none;
}
.hero-title { font-size: clamp(3.4rem, 11vw, 8.5rem); line-height: .95; margin-top: 34px; letter-spacing: -0.03em; }
.hero-tagline { color: var(--brume); font-size: clamp(1.125rem, 2.2vw, 1.4rem); margin: 18px 0 0; }
.hero .badge { margin-top: 38px; }
.hero-note { color: var(--brume); font-size: .875rem; margin-top: 14px; }

.scroll-cue {
  position: absolute; left: 50%; bottom: 28px; translate: -50% 0; z-index: 1;
  display: grid; justify-items: center; gap: 8px;
  color: var(--brume); font-size: .8125rem; text-decoration: none;
}
.scroll-cue span { width: 1.5px; height: 34px; background: linear-gradient(var(--brume), transparent); transform-origin: top; }

/* Séquence d'ouverture (une seule, au chargement) */
.js .hero-in { opacity: 0; transform: translateY(18px); }
.js .loaded .hero-in { animation: rise .9s var(--ease) forwards; }
.js .loaded .hero-in.d1 { animation-delay: .15s; }
.js .loaded .hero-in.d2 { animation-delay: .35s; }
.js .loaded .hero-in.d3 { animation-delay: .5s; }
.js .loaded .hero-in.d4 { animation-delay: .65s; }
.js .loaded .hero-in.d5 { animation-delay: 1.1s; }
.js .hero-icon-wrap.hero-in { transform: scale(.86); }
.js .loaded .hero-icon-wrap::after { animation: breathe 2.6s ease-in-out .9s 1 forwards; }
.js .loaded .scroll-cue span { animation: cue 2.4s ease-in-out 1.8s infinite; }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes breathe { 0% { opacity: 0; } 45% { opacity: 1; } 100% { opacity: .55; } }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ——— Une nuit, au fil du défilement ——— */
.story { position: relative; height: 420vh; background: var(--nuit-profonde); --p: 0; }
.story-stage {
  position: sticky; top: 0; height: 100svh; overflow: hidden;
  display: grid; grid-template-rows: 1fr auto; padding: 84px 0 34px;
}
.story-stage::before {
  /* l'aube qui monte à la fin de la nuit */
  content: ""; position: absolute; inset: auto -10% -40% -10%; height: 80%;
  background: radial-gradient(50% 60% at 50% 100%, rgba(246, 239, 211, .16), transparent 70%);
  opacity: clamp(0, calc((var(--p) - .72) * 4), 1); pointer-events: none;
}
.story-grid {
  position: relative; display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center;
  max-width: 1120px; width: 100%; margin: 0 auto; padding: 0 24px; min-height: 0;
}
.clock { font-family: var(--serif); font-weight: 600; font-size: clamp(4rem, 10vw, 8rem); line-height: .9;
  font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.chapters { position: relative; margin-top: 26px; min-height: 9.5em; }
.chapter { position: absolute; inset: 0 auto auto 0; max-width: 30em;
  opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.chapter.active { opacity: 1; transform: none; }
.chapter h3 { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 600; margin: 0; }
.chapter p { color: var(--brume); font-size: 1.125rem; margin-top: 10px; }

.phone {
  position: relative; justify-self: center;
  height: min(64svh, 640px); aspect-ratio: 1206 / 2622;
  border-radius: 13% / 6%; padding: 2.6%;
  background: #05061A;
  box-shadow: 0 0 0 1.5px var(--nuit-trait), 0 50px 100px -30px rgba(0, 0, 0, .8), 0 0 120px -40px rgba(246, 239, 211, .15);
}
.screen { position: relative; width: 100%; height: 100%; border-radius: 11% / 5.2%; overflow: hidden; background: #000; container-type: inline-size; }
.screen > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Dans la séquence de la nuit, un seul écran à la fois, en fondu. */
.story .screen > * { opacity: 0; transition: opacity .6s var(--ease); }
.story .screen > .active { opacity: 1; }

/* L'écran de nuit, vivant : il suit l'heure et s'allume pendant les clips */
.nightscreen { display: grid; align-content: center; justify-items: center; gap: 4cqw; background: #000; color: var(--lune); text-align: center; }
.nightscreen .status { font-size: 6.4cqw; display: flex; align-items: center; gap: 2.4cqw; }
.nightscreen .status .rec-dot { width: 4.4cqw; height: 4.4cqw; border-radius: 50%; border: .9cqw solid var(--rec); display: none; }
.nightscreen .count { font-size: 4.6cqw; color: var(--brume); }
.nightscreen .hold { position: absolute; left: 50%; bottom: 14%; translate: -50% 0; font-size: 4.4cqw; font-weight: 600;
  padding: 3.6cqw 7cqw; border-radius: 99px; background: var(--nuit-claire); white-space: nowrap; }
.nightscreen.recording .status { color: var(--rec); }
.nightscreen.recording .status .rec-dot { display: block; }
.nightscreen.recording .status .eye { display: none; }

.frise { position: relative; max-width: 1120px; width: 100%; margin: 0 auto; padding: 0 24px; }
.frise svg { width: 100%; height: auto; overflow: visible; display: block; }
.frise .track { stroke: var(--nuit-trait); stroke-width: 2; }
.frise .done { stroke: var(--brume); stroke-width: 2; }
.frise .tick { stroke: var(--nuit-trait); }
.frise .hour { fill: var(--brume); font: 500 13px var(--sans); font-variant-numeric: tabular-nums; }
.frise .ignored { fill: var(--brume); opacity: 0; transition: opacity .4s; }
.frise .ignored.lit { opacity: .7; }
.frise .f-clip rect { fill: var(--rec); transform-box: fill-box; transform-origin: center;
  transform: scale(.2); opacity: 0; transition: transform .5s var(--ease), opacity .3s; }
.frise .f-clip .glow { opacity: 0; filter: blur(8px); }
.frise .f-clip.lit rect { transform: scale(1.4, 1.5); opacity: 1; }
.frise .f-clip.lit .glow { opacity: .5; }
.frise .now { fill: var(--lune); }

/* ——— Sections suivantes ——— */
.section { padding: 140px 0 0; }
.lede { font-size: 1.1875rem; color: var(--brume); max-width: 34em; margin-top: 20px; }

.feature { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.feature + .feature { margin-top: 140px; }
.feature.flip .feature-text { order: 2; }
.feature .phone { height: min(70svh, 620px); }

/* Illustration : les retournements ignorés, le lever filmé */
.ignore-demo { margin-top: 34px; max-width: 540px; width: 100%; justify-self: center; }
/* Quand elle apparaît : deux retournements restent gris, puis le lever s'allume. */
.js .ignore-demo .step { opacity: 0; transition: opacity .6s var(--ease); }
.js .ignore-demo .step.s2 { transition-delay: .7s; }
.js .ignore-demo .step.s3 { transition-delay: 1.4s; }
.js .ignore-demo .grow { transform-box: fill-box; transform-origin: center; transform: scaleX(.1);
  transition: transform .7s var(--ease) 1.4s; }
.js .ignore-demo.in .step { opacity: 1; }
.js .ignore-demo.in .grow { transform: none; }
.ignore-demo svg { width: 100%; overflow: visible; }
.ignore-demo .track { stroke: var(--nuit-trait); stroke-width: 2; }
.ignore-demo .dot { fill: var(--brume); }
.ignore-demo .clip { fill: var(--rec); }
.ignore-demo .lbl { fill: var(--brume); font: 500 12px var(--sans); }
.ignore-demo .lbl.rec { fill: var(--lune); font-weight: 600; }

.privacy { text-align: center; }
.privacy h2 { font-size: clamp(2.4rem, 6.4vw, 5rem); max-width: 14ch; margin: 0 auto; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); margin: 56px auto 0; max-width: 900px;
  border-top: 1px solid var(--nuit-trait); border-bottom: 1px solid var(--nuit-trait); }
.facts div { padding: 26px 18px; }
.facts div + div { border-left: 1px solid var(--nuit-trait); }
.facts strong { display: block; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; }
.facts span { color: var(--brume); font-size: .9375rem; }

.pricing { display: grid; grid-template-columns: 1.1fr .9fr; gap: 64px; align-items: center; }
.prices { margin: 36px 0 0; border-top: 1px solid var(--nuit-trait); }
.prices div { display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  padding: 18px 0; border-bottom: 1px solid var(--nuit-trait); }
.prices dt { font-weight: 600; }
.prices dt span { display: block; color: var(--brume); font-weight: 400; font-size: .9375rem; }
.prices dd { margin: 0; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fineprint { color: var(--brume); font-size: .875rem; margin-top: 18px; }

.closing { text-align: center; padding: 160px 0 40px; }
.closing img { width: 84px; height: 84px; border-radius: 20px; margin: 0 auto 28px; }
.closing h2 { font-size: clamp(2.4rem, 6vw, 4.4rem); }
.closing .badge { margin-top: 34px; }

footer.site-footer {
  margin-top: 120px; padding: 28px 0 44px; border-top: 1px solid var(--nuit-trait);
  display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; color: var(--brume); font-size: .9375rem;
}
footer.site-footer a { color: var(--brume); text-decoration: none; }
footer.site-footer a:hover { color: var(--lune); }
footer.site-footer .legal { flex-basis: 100%; font-size: .8125rem; }

/* Apparitions au défilement */
.js [data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js [data-reveal].in { opacity: 1; transform: none; }
.js [data-reveal="2"] { transition-delay: .12s; }
.js [data-reveal="3"] { transition-delay: .24s; }

/* ——— Pages de texte (confidentialité, aide) ——— */
.doc { max-width: 680px; padding-top: 32px; }
.doc h1 { font-size: clamp(2.1rem, 5vw, 3rem); }
.doc h2 { font-family: var(--sans); font-size: 1.125rem; font-weight: 600; margin-top: 36px; letter-spacing: 0; line-height: 1.3; }
.doc p, .doc li { color: var(--brume); }
.doc .updated { color: var(--brume); font-size: .9375rem; margin-top: 12px; }
.doc .mail { color: var(--lune); font-weight: 600; }
.doc + footer, .page > footer:not(.site-footer) {
  margin-top: 112px; padding: 28px 0 40px; border-top: 1px solid var(--nuit-trait);
  display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; color: var(--brume); font-size: .9375rem;
}
.page > footer:not(.site-footer) a { color: var(--brume); text-decoration: none; }
.page > footer:not(.site-footer) .legal { flex-basis: 100%; font-size: .8125rem; }

/* ——— Téléphone ——— */
@media (max-width: 820px) {
  .story { height: 380vh; }
  .story-stage { padding: 72px 0 22px; }
  .story-grid { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 18px; align-content: start; }
  .clock { font-size: clamp(3rem, 15vw, 4.4rem); }
  .chapters { margin-top: 10px; min-height: 6.6em; }
  .chapter h3 { font-size: 1.35rem; }
  .chapter p { font-size: 1rem; margin-top: 6px; }
  .story .phone { height: min(50svh, 460px); }
  /* La frise est réduite à ~36 % : traits, points et clips grossis d'autant. */
  .frise .hour { font-size: 26px; }
  .frise .track, .frise .done { stroke-width: 4; }
  .frise .tick { stroke-width: 2.5; }
  .frise .ignored { r: 7px; }
  .frise .now { r: 10px; }
  .frise .f-clip.lit rect { transform: scale(1.9, 2.6); }
  .feature, .pricing { grid-template-columns: 1fr; gap: 44px; }
  .feature.flip .feature-text { order: 0; }
  .feature .phone, .pricing .phone { height: 520px; max-height: 70svh; }
  .facts { grid-template-columns: 1fr; }
  .facts div + div { border-left: 0; border-top: 1px solid var(--nuit-trait); }
  .section { padding-top: 110px; }
  .nav-links a.hide-sm { display: none; }
}
@media (max-width: 520px) {
  .page { padding: 0 16px; }
  .story-grid, .frise { padding: 0 16px; }
  .bar nav a { margin-left: 14px; }
}

/* Mouvement réduit : tout est visible, rien ne bouge tout seul */
@media (prefers-reduced-motion: reduce) {
  .js .hero-in, .js [data-reveal] { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
  .stars i { animation: none; opacity: var(--o, .6); }
  .js .loaded .hero-icon-wrap::after { animation: none; opacity: .55; }
  .scroll-cue span, .chapter, .screen > * { animation: none !important; transition: none !important; }
  .nav { transition: none; }
}
