/* =============================================================================
   Éclosion - Arian Yassin
   Feuille de style principale. Une seule vue plein écran, canvas WebGL en fond,
   texte HTML par-dessus. Palette : noir #050506, blanc cassé #F2EFE6,
   gris argent #8A8A8F, bleu glacier #9FC4D6 (accent, reflets seulement).
   ========================================================================== */

/* ---------- Polices (auto-hébergées) ---------- */
/* Centauri (police du client, 91 glyphes, sans accents ni @) : Michroma, géométrique et large elle aussi,
   fournit les caractères manquants (é, ü, ß, @, ponctuation). */
@font-face {
  font-family: "Centauri";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/Centauri.woff") format("woff");
}
@font-face {
  font-family: "Michroma";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/michroma-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
}
/* Arabe : téléchargée seulement quand des caractères arabes sont affichés (unicode-range). */
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/amiri-arabic-400.woff2") format("woff2");
  unicode-range:
    U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

/* ---------- Jetons ---------- */
:root {
  color-scheme: dark;
  --bg: #050506;
  --white: #ffffff;
  --silver: #8a8a8f;
  --ice: #9fc4d6;
  --gold: #d8b46a;

  --display: "Centauri", "Michroma", "Amiri", "Trebuchet MS", "Helvetica Neue", sans-serif;
  --arabic: "Amiri", "Noto Naskh Arabic", "Geeza Pro", "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --gutter: clamp(18px, 2.6vw, 40px);
  --pad-top: max(var(--gutter), env(safe-area-inset-top, 0px));
  --pad-bottom: max(var(--gutter), env(safe-area-inset-bottom, 0px));
  --pad-x: max(
    var(--gutter),
    env(safe-area-inset-left, 0px),
    env(safe-area-inset-right, 0px)
  );

  --label-size: 0.66rem;
  --label-tracking: 0.22em;
  --reveal-duration: 1.6s;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--white);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection {
  background: var(--ice);
  color: var(--bg);
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
}
:focus-visible {
  outline: 1px solid var(--ice);
  outline-offset: 6px;
  border-radius: 2px;
}

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

/* ---------- Fond : canvas, repli, grain ---------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
}
html.no-js .stage,
html.no-webgl .stage {
  display: none;
}

.fallback {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  background: var(--bg);
}
.fallback img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center 42%;
  display: block;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 1;
  width: 200%;
  height: 200%;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-3%, 2%);
  }
  40% {
    transform: translate(2%, -4%);
  }
  60% {
    transform: translate(-4%, -1%);
  }
  80% {
    transform: translate(3%, 3%);
  }
  100% {
    transform: translate(-1%, 4%);
  }
}

/* ---------- Couche interface ---------- */
.ui {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.ui a,
.ui button,
.ui input {
  pointer-events: auto;
}

.corner {
  position: absolute;
  margin: 0;
}
/* Propriétés logiques : les coins se miroitent en arabe (droite à gauche). */
.corner--tl {
  top: var(--pad-top);
  inset-inline-start: var(--pad-x);
}
.corner--tr {
  top: var(--pad-top);
  inset-inline-end: var(--pad-x);
  text-align: end;
}
.corner--bl {
  bottom: var(--pad-bottom);
  inset-inline-start: var(--pad-x);
}
.corner--br {
  bottom: var(--pad-bottom);
  inset-inline-end: var(--pad-x);
  text-align: end;
}

/* Étiquettes d'entomologiste : mono, capitales espacées */
.label {
  margin: 0;
  font-family: var(--mono);
  font-size: var(--label-size);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  color: var(--silver);
  line-height: 1.9;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.label__key {
  color: var(--silver);
}
.label__value {
  color: var(--white);
}
.label--meta {
  margin-top: 0.1rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.9em;
}

.contact {
  display: inline-flex;
  align-items: baseline;
  gap: 0.7em;
  letter-spacing: 0.12em;
  color: var(--silver);
  border-bottom: 1px solid transparent;
  transition:
    color 0.4s,
    border-color 0.4s;
}
.contact__mail {
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--cream);
  opacity: 0.85;
}
.contact:hover,
.contact:focus-visible {
  color: var(--white);
  border-color: var(--white);
}

/* Logo (h1) : le fichier assets/img/logo-arianyassin.svg sert de masque, rempli de la couleur du texte
   (il suit la couleur crème et le mode doré). Le nom reste dans le h1 pour les lecteurs d'écran et Google. */
.name {
  margin: 0;
  line-height: 0;
  color: var(--white);
}
.name__logo {
  display: block;
  width: 7.4rem;
  aspect-ratio: 1385 / 267.4;
  background-color: currentColor;
  -webkit-mask: url("../img/logo-arianyassin.svg") no-repeat center / contain;
  mask: url("../img/logo-arianyassin.svg") no-repeat center / contain;
}

/* Sélecteur de langue */
.lang {
  margin-top: 0.1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.55em;
}
.lang__btn {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--silver);
  border-bottom: 1px solid transparent;
  cursor: pointer;
  transition:
    color 0.4s,
    border-color 0.4s;
}
.lang__btn:hover,
.lang__btn:focus-visible {
  color: var(--white);
}
.lang__btn[aria-pressed="true"] {
  color: var(--white);
  border-color: var(--white);
}

/* ---------- Bloc central : phrase + appel à l'action ---------- */
.center {
  position: absolute;
  left: 50%;
  top: 68.5%;
  width: min(92vw, 760px);
  transform: translateX(-50%);
  text-align: center;
}

.phrase {
  margin: 0 0 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.phrase__main {
  font-family: var(--display);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(0.95rem, 0.75vw + 0.65rem, 1.3rem);
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: var(--white);
  transition:
    opacity 0.9s var(--ease-in-out),
    filter 0.9s var(--ease-in-out);
  text-transform: uppercase;
}
.phrase__alt {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--silver);
  transition: opacity 0.9s var(--ease-in-out);
}
.phrase.is-switching .phrase__main,
.phrase.is-switching .phrase__alt {
  opacity: 0;
  filter: blur(4px);
}

.cta {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0.6rem;
  color: var(--white);
}
.cta__label {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--silver);
  transition: color 0.5s;
}
.cta__handle {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.05rem, 1.1vw + 0.7rem, 1.75rem);
  letter-spacing: 0.06em;
  line-height: 1.2;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate; /* le handle reste de gauche à droite, même en arabe */
  text-transform: uppercase;
}
.cta__handle .l {
  display: inline-block;
}
.cta__arrow {
  position: absolute;
  top: 0.8rem;
  inset-inline-end: -0.9rem;
  color: var(--silver);
  transition:
    transform 0.5s var(--ease-out),
    color 0.5s;
}
/* Soulignement qui se dessine au survol */
.cta::after {
  content: "";
  position: absolute;
  inset-inline: 0.6rem;
  bottom: 0.15rem;
  height: 1px;
  background: var(--white);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.7s var(--ease-out);
}
html[dir="rtl"] .cta::after {
  transform-origin: right center;
}
.cta:hover::after,
.cta:focus-visible::after {
  transform: scaleX(1);
}
.cta:hover .cta__arrow,
.cta:focus-visible .cta__arrow {
  transform: translate(3px, -3px);
  color: var(--white);
}
.cta:hover .cta__label {
  color: var(--white);
}

/* Apparition lettre par lettre (fin de l'acte III) */
html.js .cta.is-forming .cta__handle .l {
  animation: letter 1.3s calc(var(--i, 0) * 70ms) var(--ease-out) both;
}
@keyframes letter {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(8px) scale(1.04);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

/* ---------- Liste d'attente (optionnelle) ---------- */
.waitlist {
  margin: 1.6rem auto 0;
  max-width: 320px;
}
.waitlist__label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--silver);
}
.waitlist__row {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(242, 239, 230, 0.35);
}
.waitlist__input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0;
  background: none;
  border: 0;
  color: var(--white);
  font-family: var(--display);
  font-size: 0.9rem;
  text-align: center;
}
.waitlist__input::placeholder {
  color: var(--silver);
  font-style: italic;
}
.waitlist__input:focus {
  outline: none;
}
.waitlist__submit {
  padding: 0 0.5rem;
  color: var(--silver);
  transition: color 0.4s;
}
.waitlist__submit:hover {
  color: var(--white);
}
.waitlist__status {
  margin: 0.5rem 0 0;
  min-height: 1em;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--silver);
}

/* ---------- Révélation progressive des textes selon l'acte ---------- */
html.js [data-reveal] {
  opacity: 0;
  transition: opacity var(--reveal-duration) var(--ease-in-out);
  transition-delay: calc(var(--i, 0) * 180ms);
}
html.js[data-act="alive"] [data-reveal],
html.js.no-webgl [data-reveal] {
  opacity: 1;
}

/* Acte I : seules les coordonnées apparaissent */
html.js #coordinates {
  opacity: 0;
  animation: fade-in 2.2s 0.5s var(--ease-in-out) forwards;
}
@keyframes fade-in {
  to {
    opacity: 1;
  }
}

/* ---------- Chargement ---------- */
.loader {
  position: fixed;
  left: 50%;
  top: 68.5%;
  z-index: 3;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s var(--ease-in-out);
}
html.js[data-act="void"] .loader.is-visible {
  opacity: 1;
}
.loader__text {
  font-family: var(--mono);
  font-size: var(--label-size);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  color: var(--silver);
  font-variant-numeric: tabular-nums;
}
.loader__bar {
  position: relative;
  width: 140px;
  height: 1px;
  background: rgba(242, 239, 230, 0.14);
  overflow: hidden;
}
.loader__fill {
  position: absolute;
  inset: 0;
  background: var(--white);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s var(--ease-out);
}
html.no-js .loader {
  display: none;
}

/* ---------- Phrase cryptique (appui long) ---------- */
.secret {
  position: fixed;
  left: 50%;
  top: 46%;
  z-index: 4;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0 var(--gutter);
  width: 100%;
  text-align: center;
  font-family: var(--display);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(0.95rem, 0.75vw + 0.65rem, 1.3rem);
  color: var(--white);
  opacity: 0;
  filter: blur(6px);
  pointer-events: none;
  transition:
    opacity 0.6s var(--ease-in-out),
    filter 0.6s var(--ease-in-out);
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-transform: uppercase;
}
html.is-revealing .secret {
  opacity: 1;
  filter: blur(0);
}

/* ---------- Mode doré (code secret) ---------- */
html.is-gold {
  --white: #f4e3b5;
  --silver: #b59a5b;
  --ice: #e8c77a;
}
html.is-gold .grain {
  opacity: 0.08;
}
html.is-gold .name,
html.is-gold .label,
html.is-gold .phrase__main,
html.is-gold .cta {
  transition: color 1.2s;
}

/* ---------- Bouton son ---------- */
.sound {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 1em;
  padding: 0.3em 0.25em;
  margin: -0.3em -0.25em;
  box-sizing: content-box;
  transform: translateY(0.04em);
  color: var(--silver);
  cursor: pointer;
  transition: color 0.4s;
}
.sound:hover,
.sound[aria-pressed="true"] {
  color: var(--cream);
}
.sound__bar {
  width: 1.5px;
  height: 0.5em;
  background: currentColor;
  transform-origin: center;
}
.sound[aria-pressed="true"] .sound__bar {
  animation: sound-bar 1.6s ease-in-out infinite;
}
.sound[aria-pressed="true"] .sound__bar:nth-child(2) {
  animation-delay: 0.3s;
}
.sound[aria-pressed="true"] .sound__bar:nth-child(3) {
  animation-delay: 0.65s;
}
@keyframes sound-bar {
  0%,
  100% {
    transform: scaleY(0.6);
  }
  50% {
    transform: scaleY(1.6);
  }
}

/* ---------- Curseur personnalisé ---------- */
.cursor {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  html.js.has-cursor,
  html.js.has-cursor a,
  html.js.has-cursor button {
    cursor: none;
  }
  html.js.has-cursor .cursor {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 1px solid var(--white);
    border-radius: 50%;
    mix-blend-mode: difference;
    pointer-events: none;
    opacity: 0;
    transition:
      width 0.35s var(--ease-out),
      height 0.35s var(--ease-out),
      margin 0.35s var(--ease-out),
      opacity 0.4s,
      border-color 0.3s;
    will-change: transform;
  }
  html.js.has-cursor .cursor.is-visible {
    opacity: 1;
  }
  html.js.has-cursor .cursor.is-hover {
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
  }
  html.js.has-cursor .cursor.is-butterfly {
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border-color: var(--ice);
  }
  html.js.has-cursor .cursor.is-pressing {
    width: 90px;
    height: 90px;
    margin: -45px 0 0 -45px;
    transition-duration: 2s, 2s, 2s, 0.4s, 0.3s;
  }
}

/* ---------- Arabe : pas d'interlettrage (il casse les ligatures), police naskh, corps un peu plus grand ---------- */
html[lang="ar"] .label,
html[lang="ar"] .cta__label,
html[lang="ar"] .phrase__alt,
html[lang="ar"] .loader__text,
html[lang="ar"] .waitlist__label,
html[lang="ar"] .waitlist__status,
html[lang="ar"] .contact {
  font-family: var(--arabic);
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.82rem;
}
html[lang="ar"] .lang__btn,
html[lang="ar"] .label__value {
  font-family: var(--mono);
  letter-spacing: var(--label-tracking);
  font-size: var(--label-size);
}
html[lang="ar"] .phrase__main,
html[lang="ar"] .secret {
  font-family: var(--arabic);
  line-height: 1.6;
}
html[lang="ar"] .phrase__main {
  font-size: clamp(1.5rem, 2.3vw + 0.7rem, 2.3rem);
}
html[lang="ar"] .contact__mail {
  font-family: var(--mono);
  letter-spacing: 0.06em;
  font-size: var(--label-size);
}
html[lang="ar"] .waitlist__input {
  font-family: var(--arabic);
}

/* ---------- Modes de rendu (captures OG / repli, générées par tools/render-images.mjs) ---------- */
html.mode-og .grain,
html.mode-still .grain,
html.mode-og .cursor,
html.mode-still .cursor,
html.mode-og .loader,
html.mode-still .loader {
  display: none !important;
}
html.mode-still .ui,
html.mode-icon .ui,
html.mode-icon .grain,
html.mode-icon .cursor,
html.mode-icon .loader {
  display: none !important;
}
html.mode-og .center {
  top: 73%;
}
html.mode-og .phrase {
  display: none;
}
html.mode-og .name__logo {
  width: 9rem;
}
html.mode-og .label {
  font-size: 0.72rem;
}
html.mode-og .contact,
html.mode-og .sound,
html.mode-og .lang {
  display: none;
}

/* ---------- Petits écrans ---------- */
@media (max-width: 640px) {
  :root {
    --label-size: 0.58rem;
    --label-tracking: 0.18em;
  }
  .name__logo {
    width: 6rem;
  }
  .center {
    top: 70%;
    width: calc(100vw - 2 * var(--gutter));
  }
  .phrase {
    margin-bottom: 0.8rem;
  }
  .cta__arrow {
    top: 0.7rem;
    width: 11px;
    height: 11px;
  inset-inline-end: -0.7rem;
}
  .label--meta {
    gap: 0.7em;
  }
  .secret {
    top: 44%;
  }
}
@media (max-height: 560px) {
  .center,
  .loader {
    top: 66%;
  }
  .phrase__main {
    font-size: 0.95rem;
  }
  .cta__handle {
    font-size: 1.1rem;
  }
}

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  .grain {
    animation: none;
  }
  html.js [data-reveal] {
    transition-duration: 0.6s;
    transition-delay: 0s;
  }
  html.js .cta.is-forming .cta__handle .l {
    animation-duration: 0.4s;
    animation-delay: 0s;
  }
  .cursor,
  .cta::after,
  .cta__arrow,
  .contact {
    transition-duration: 0.01s !important;
  }
  .sound[aria-pressed="true"] .sound__bar {
    animation: none;
    transform: scaleY(1.2);
  }
}

/* ---------- Tactile : pas de sélection ni de menu contextuel pendant l'appui long ---------- */
@media (pointer: coarse) {
  .ui,
  .secret {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}

/* ---------- Captures : textes visibles sans transition ---------- */
html.mode-og [data-reveal],
html.mode-still [data-reveal] {
  opacity: 1 !important;
  transition: none !important;
}
html.mode-og .cta.is-forming .cta__handle .l {
  animation: none !important;
}
