/* Syrene AI. Les couleurs, espacements et rayons viennent de tokens.css, recopié du dépôt syrene-brand :
   aucune valeur de la charte n'est écrite ici. Sans JavaScript, tout ce qui suit laisse l'image, le menu et le contenu visibles :
   seuls les états posés par site.js sur <html> (data-phase, data-visit, data-mode) cachent quelque chose. */

@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-400-latin1.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-500-latin1.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --texte: var(--encre);
  --texte-2: var(--encre-2);
  --hud-texte: var(--encre-2);
  --hud-libelle: var(--encre-3);
  --courbe: cubic-bezier(.645, .045, .355, 1);
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --marge: clamp(20px, 4vw, 56px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--fond);
}

body {
  color: var(--texte);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* Scène : image ou vidéo plein cadre, sans défilement. */
#scene {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
  transition: filter .25s ease;
  filter: saturate(.55) contrast(1.15) brightness(.55);
}
#scene picture { display: contents; }
#still, #intro, #loop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
}
#loop { opacity: 0; }
/* Au-dessus de l'intro dès qu'elle est rendue : si le navigateur n'a pas encore peint son image, on garde
   l'intro dessous, jamais le noir. L'intro n'est retirée qu'ensuite. */
#loop[data-on] { opacity: 1; z-index: 1; }
#intro[data-off] { display: none; }

html[data-phase="film"] #scene { filter: none; }
html[data-phase="freeze"] #scene { filter: saturate(.55) contrast(1.15); }
html[data-phase="content"] #scene {
  filter: saturate(.55) contrast(1.15) brightness(.55);
  transition: filter 1s var(--courbe);
}
html[data-visit="return"] #scene,
html[data-visit="reduced"] #scene {
  filter: saturate(.55) contrast(1.15) brightness(.55);
  transition: none;
}

/* Première visite : fondu depuis le noir sur l'image. */
html[data-visit="first"] #still { transition: opacity .5s ease; }
html[data-visit="first"]:not([data-still]) #still { opacity: 0; }
/* Une fois une vidéo à l'écran, l'image d'attente ne doit plus jamais se voir. */
html[data-video] #still { visibility: hidden; }

/* Grain et vignettage. */
#grain {
  position: fixed;
  inset: -128px;
  z-index: 1;
  pointer-events: none;
  background: url("../img/grain.png") repeat;
  background-size: 128px 128px;
  opacity: .09;
  will-change: transform;
  animation: grain .72s steps(1) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  12.5% { transform: translate(-37px, 22px); }
  25% { transform: translate(51px, -41px); }
  37.5% { transform: translate(-13px, -59px); }
  50% { transform: translate(29px, 47px); }
  62.5% { transform: translate(-61px, -7px); }
  75% { transform: translate(17px, 63px); }
  87.5% { transform: translate(43px, -19px); }
}
#vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 52%, transparent 35%, color-mix(in srgb, var(--fond) 90%, transparent) 100%);
}

#flash {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: var(--encre);
  opacity: 0;
}
#flash[data-on] { opacity: .18; }

/* Surimpression : toujours en coordonnées d'écran, posée par site.js. */
#hold {
  position: fixed;
  left: var(--marge);
  top: 30px;
  z-index: 3;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--marque-ciel);
  opacity: 0;
  transition: opacity 1s var(--courbe);
}
html[data-phase="freeze"] #hold { opacity: 1; transition: none; }

#hud {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
}
html[data-phase="freeze"] #hud { opacity: 1; }
html[data-phase="content"] #hud { opacity: .4; transition: opacity 1s var(--courbe); }
html[data-visit="return"] #hud,
html[data-visit="reduced"] #hud { opacity: .4; transition: none; }

#hud-frame {
  position: absolute;
  left: calc(var(--ax, 0px) - 46px);
  top: calc(var(--ay, 0px) - 46px);
  width: 92px;
  height: 92px;
  opacity: 0;
  transition: opacity .18s linear;
}
#hud[data-frame] #hud-frame { opacity: 1; }
.corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 0 solid var(--marque-ciel);
  transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}
.corner.tl { left: 0; top: 0; border-left-width: 2px; border-top-width: 2px; transform: translate(-12px, -12px); }
.corner.tr { right: 0; top: 0; border-right-width: 2px; border-top-width: 2px; transform: translate(12px, -12px); }
.corner.bl { left: 0; bottom: 0; border-left-width: 2px; border-bottom-width: 2px; transform: translate(-12px, 12px); }
.corner.br { right: 0; bottom: 0; border-right-width: 2px; border-bottom-width: 2px; transform: translate(12px, 12px); }
#hud[data-frame] .corner { transform: none; }

#hud-panel {
  position: absolute;
  left: var(--px, 0px);
  top: var(--py, 0px);
  width: min(300px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: .08em;
  color: var(--hud-texte);
}
/* Le contenu arrivé, le bloc passe à droite du formulaire et le cadre qui serait dessous s'efface. */
html[data-phase="content"] #hud-panel { left: var(--px-contenu, var(--px, 0px)); transition: left 1s var(--courbe); }
html[data-phase="content"] #hud[data-cadre-couvert] #hud-frame { opacity: 0; transition: opacity 1s var(--courbe); }
html[data-visit="return"] #hud-panel,
html[data-visit="reduced"] #hud-panel { left: var(--px-contenu, var(--px, 0px)); transition: none; }
html[data-visit="return"] #hud[data-cadre-couvert] #hud-frame,
html[data-visit="reduced"] #hud[data-cadre-couvert] #hud-frame { opacity: 0; transition: none; }
/* Au retour, la place du formulaire n'est sûre qu'à l'arrivée du contenu : le cadre l'attend. */
html[data-visit="return"]:not([data-phase="content"]) #hud[data-frame] #hud-frame { opacity: 0; }
#hud-sensor {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity .25s linear;
}
#hud-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  opacity: 0;
  transition: opacity .25s linear;
}
#hud[data-data] #hud-sensor,
#hud[data-data] #hud-metrics { opacity: 1; }
.led {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--marque-ciel);
  box-shadow: 0 0 10px var(--marque-ciel);
  animation: led 1.1s ease-in-out infinite;
}
@keyframes led {
  0%, 100% { opacity: 1; }
  50% { opacity: .2; }
}
html[data-visit="return"] .led,
html[data-visit="reduced"] .led { animation: none; }

.metric {
  border-top: 1px solid color-mix(in srgb, var(--marque-ciel) 50%, transparent);
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.metric-k { color: var(--hud-libelle); }
.metric-v {
  font-size: 15px;
  letter-spacing: .02em;
  color: var(--encre);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.metric-v[data-hot] { color: var(--signal-panne); }

#hud-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transition: opacity .45s linear;
}
#hud[data-chart] #hud-chart { opacity: 1; }
#hud-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-seuil { stroke: var(--signal-panne); stroke-opacity: .45; stroke-dasharray: 4 4; }
.chart-trace { fill: none; stroke: var(--texte); stroke-width: 1.6; stroke-linejoin: round; }
.chart-chaud { fill: none; stroke: var(--signal-panne); stroke-width: 2.2; stroke-linejoin: round; }
.chart-point { fill: var(--signal-panne); }

#hud-verdict {
  color: var(--signal-panne);
  opacity: 0;
  transition: opacity .2s linear;
}
#hud[data-verdict] #hud-verdict { opacity: 1; }

html[data-visit="return"] #hud *,
html[data-visit="reduced"] #hud * { transition: none; }

/* Interface : menu, bloc central, pied de page. */
#ui {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 4;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

#nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: calc(28px + env(safe-area-inset-top)) calc(var(--marge) + env(safe-area-inset-right)) 28px calc(var(--marge) + env(safe-area-inset-left));
  transition: opacity 1s var(--courbe);
}
html[data-phase]:not([data-nav]) #nav { opacity: 0; visibility: hidden; }
html[data-visit="return"] #nav { transition-duration: .4s; }

.brand {
  display: block;
  height: 36px;
  width: auto;
}

#content {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  /* Le surplus en bas ramène le bloc au centre de l'écran, au-dessus de la surimpression. */
  padding: 8px 24px 64px;
  scrollbar-width: none;
  transition: opacity 1s var(--courbe), transform 1s var(--courbe);
}
#content::-webkit-scrollbar { display: none; }
/* Centré quand tout tient, jamais coupé en haut quand ça déborde. */
#content > :first-child { margin-top: auto; }
#content > :last-child { margin-bottom: auto; }

html[data-phase="film"] #content,
html[data-phase="freeze"] #content {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
}
html[data-visit="return"] #content { transition-duration: .6s; }

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--accent);
  text-align: center;
}

h1 {
  margin: 0;
  max-width: 1100px;
  font-family: "Outfit", "Avenir Next", system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1.02;
  letter-spacing: -.02em;
  text-align: center;
  text-wrap: balance;
}
/* Au-dessus de la lueur de « nervous system », qui sinon teinte le mot d'avant. */
h1 .avant { position: relative; z-index: 1; }
.neon {
  color: var(--encre);
  text-shadow: 0 0 8px var(--encre), 0 0 8px color-mix(in srgb, var(--marque-ciel) 60%, transparent), 0 0 48px color-mix(in srgb, var(--marque-ciel) 55%, transparent), 0 0 120px var(--marque-electrique);
}

/* Le triptyque : trois blocs qui s'affichent l'un après l'autre à l'arrivée du contenu (design.md). */
#triptych {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 792px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 240px));
  justify-content: center;
  gap: 24px;
  counter-reset: bloc;
}
#triptych li {
  counter-increment: bloc;
  padding-top: 10px;
  border-top: 2px solid var(--marque-electrique);
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.35;
  color: var(--texte);
  text-align: left;
  text-wrap: balance;
}
#triptych li::before {
  content: "0" counter(bloc);
  display: block;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--accent);
}
html[data-visit="first"][data-phase]:not([data-phase="content"]) #triptych li { opacity: 0; }
html[data-visit="first"][data-phase="content"] #triptych li { transition: opacity .6s var(--courbe) .4s; }
html[data-visit="first"][data-phase="content"] #triptych li:nth-child(2) { transition-delay: 1s; }
html[data-visit="first"][data-phase="content"] #triptych li:nth-child(3) { transition-delay: 1.6s; }

.waitlist {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.sr {
  position: absolute;
  left: -9999px;
}
.trap {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
#waitlist-email {
  flex: 1 1 240px;
  min-width: 0;
  height: 54px;
  padding: 0 18px;
  border: 1px solid color-mix(in srgb, var(--encre-2) 38%, transparent);
  border-radius: var(--rayon-pilule);
  background: color-mix(in srgb, var(--fond) 70%, transparent);
  color: var(--texte);
  font-family: inherit;
  font-size: 16px;
  transition: border-color .15s linear;
}
#waitlist-email::placeholder { color: color-mix(in srgb, var(--encre-2) 75%, transparent); opacity: 1; }
#waitlist-email:hover:not(:disabled) { border-color: color-mix(in srgb, var(--encre-2) 60%, transparent); }
#waitlist-email:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
#waitlist-email[aria-invalid="true"] { border-color: var(--signal-panne); }
#waitlist-email:-webkit-autofill {
  -webkit-text-fill-color: var(--texte);
  box-shadow: inset 0 0 0 100px var(--surface);
  caret-color: var(--texte);
}
#waitlist-email:disabled { opacity: .75; }

#waitlist-submit {
  flex: none;
  height: 54px;
  padding: 0 26px;
  border: 0;
  border-radius: var(--rayon-pilule);
  background: linear-gradient(to top right, var(--marque-indigo), var(--marque-electrique));
  box-shadow: var(--lueur-marque);
  color: var(--sur-marque);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter .15s linear, opacity .15s linear;
}
#waitlist-submit:hover:not(:disabled) { filter: brightness(1.14); }
#waitlist-submit:focus-visible { outline: 2px solid var(--encre); outline-offset: 2px; }
#waitlist-submit:disabled { cursor: not-allowed; opacity: .75; }
#waitlist-submit[aria-busy="true"] { cursor: progress; opacity: .6; }

#waitlist-status {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .04em;
  line-height: 1.4;
  text-align: center;
  color: var(--accent);
}
#waitlist-status:not(:empty) {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--rayon-s);
  background: color-mix(in srgb, var(--fond) 78%, transparent);
}
#waitlist-status[data-state="success"] {
  margin-top: 0;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
#waitlist-form[data-done] .fields { display: none; }

/* Entre 768 et 1439 px le triptyque se resserre : à droite du formulaire, le bloc de mesures ne doit pas
   mordre sur le troisième bloc. */
@media (min-width: 768px) and (max-width: 1439px) {
  #triptych { max-width: 640px; grid-template-columns: repeat(3, minmax(0, 200px)); gap: 20px; }
}

@media (max-width: 767px) {
  #nav { padding-top: calc(20px + env(safe-area-inset-top)); padding-bottom: 12px; }
  #content { gap: 16px; padding: 8px 24px 12px; }
  .fields #waitlist-submit { flex: 1 1 100%; }
  #triptych { grid-template-columns: 1fr; gap: 14px; max-width: 420px; }
}

/* Quand le bloc central occupe la largeur, la surimpression s'efface tout à fait à son arrivée :
   sous du texte, les mesures ne se liraient pas et les coins du cadre couperaient les mots. */
@media (max-width: 1319px) {
  html[data-phase="content"] #hud-panel { opacity: 0; transition: opacity 1s var(--courbe); }
  html[data-visit="return"] #hud-panel,
  html[data-visit="reduced"] #hud-panel { opacity: 0; }
  html[data-phase="content"] #hud[data-frame] #hud-frame { opacity: 0; transition: opacity 1s var(--courbe); }
  html[data-visit="return"] #hud[data-frame] #hud-frame,
  html[data-visit="reduced"] #hud[data-frame] #hud-frame { opacity: 0; transition: none; }
}

/* La zone de défilement coupe tout ce qui en sort, lueur du titre comprise : elle remonte sous le menu
   de quoi laisser passer la lueur, sans que le contenu bouge. Pas sur téléphone, où le contenu défile. */
@media (min-width: 768px) and (min-height: 481px) {
  #content { margin-top: -120px; padding-top: 128px; }
}

/* Sur ordinateur, le titre passe au-dessus du panneau de mesures, le bouton sous le cadre. */
@media (min-width: 1200px) {
  #content { padding-bottom: 84px; }
}

/* Écran réduit par le clavier : le menu laisse la place au bloc central. */
@media (max-height: 480px) {
  #nav { padding-top: 10px; padding-bottom: 6px; }
  .brand { height: 28px; }
  #content { padding-top: 4px; padding-bottom: 8px; gap: 12px; }
  h1 { font-size: clamp(30px, 6vw, 56px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  #grain { will-change: auto; }
}
