/* ==========================================================================
   HAZON TECH — mobile-first cinematic Earth
   Brand: Bleu #0B4173 · Orange #F38D2C · Blanc · Brume #F1F4F8 · Gris #5B6B7A · Encre #0A1F33
   ========================================================================== */

:root {
  --blue: #0b4173;
  --orange: #f38d2c;
  --mist: #f1f4f8;
  --grey: #5b6b7a;
  --ink: #0a1f33;
  --space: #02040a;
  --text: #f1f4f8;
  --text-dim: rgba(241, 244, 248, 0.62);
  --line: rgba(241, 244, 248, 0.18);

  --gutter: 20px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --earth-r: 100px; /* set by JS: on-screen radius of the Earth at rest */

  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-body: "Inter", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  background: var(--space);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  scrollbar-width: none;
}
html::-webkit-scrollbar { display: none; }

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  background: var(--space);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 2px; }

/* ---------- Stage ---------- */

#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh; /* large viewport: no resize jump when mobile toolbars move */
  display: block;
  z-index: 0;
  touch-action: pan-y;
}

.track { position: relative; width: 1px; pointer-events: none; }

.fallback {
  position: fixed; inset: 0; z-index: 0; opacity: 0;
  background: var(--space) url("../assets/earth-poster.jpg") center / cover no-repeat;
}
.fallback video { display: none; width: 100%; height: 100%; object-fit: cover; }
.no-webgl .fallback { opacity: 1; }
.no-webgl .fallback video { display: block; }
.no-webgl #gl { display: none; }

.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(to bottom, rgba(2, 4, 10, 0.45), transparent 18%, transparent 70%, rgba(2, 4, 10, 0.55));
}

.grain {
  position: fixed; inset: -50%; z-index: 2; pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.9s steps(6) infinite;
  will-change: transform;
}
.q-nograin .grain { display: none; }
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-6%, 4%); }
  40% { transform: translate(5%, -7%); }
  60% { transform: translate(-3%, 8%); }
  80% { transform: translate(7%, 2%); }
  100% { transform: translate(0, 0); }
}

/* ---------- Loader ---------- */

.loader {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  background: var(--space);
  transition: opacity 1.2s var(--ease-out), visibility 1.2s;
}
.loader img { width: 40px; height: auto; opacity: 0.9; animation: pulse 2.4s ease-in-out infinite; }
.loader__bar { width: 120px; height: 1px; background: var(--line); overflow: hidden; }
.loader__bar i { display: block; height: 100%; width: 100%; background: var(--orange); transform-origin: left; transform: scaleX(0); transition: transform 0.4s var(--ease-out); }
.loader__label { font: 500 11px/1 var(--f-body); letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-dim); }
.is-ready .loader { opacity: 0; visibility: hidden; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---------- Top bar ---------- */

.bar {
  position: fixed; z-index: 30;
  top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + var(--safe-top)) var(--gutter) 14px;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 26px; height: auto; }
.brand__name {
  font: 700 15px/1 var(--f-display); letter-spacing: 0.14em;
  display: inline-flex; align-items: baseline; gap: 6px;
}
.brand__name small { font: 500 9px/1 var(--f-body); letter-spacing: 0.28em; color: var(--text-dim); }

.menu-btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 2px 0 12px;
  font: 500 11px/1 var(--f-body); letter-spacing: 0.24em; text-transform: uppercase;
}
.menu-btn__icon { position: relative; width: 22px; height: 10px; }
.menu-btn__icon i { position: absolute; left: 0; right: 0; height: 1px; background: currentColor; transition: transform 0.5s var(--ease-out), top 0.5s var(--ease-out); }
.menu-btn__icon i:first-child { top: 1px; }
.menu-btn__icon i:last-child { top: 8px; left: 8px; }
.menu-open .menu-btn__icon i:first-child { top: 5px; transform: rotate(45deg); }
.menu-open .menu-btn__icon i:last-child { top: 5px; left: 0; transform: rotate(-45deg); }

/* ---------- Menu overlay ---------- */

.menu {
  position: fixed; inset: 0; z-index: 25;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: calc(84px + var(--safe-top)) var(--gutter) calc(28px + var(--safe-bottom));
  background: rgba(2, 4, 10, 0.72);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  opacity: 0; transition: opacity 0.5s var(--ease-out);
}
.menu[hidden] { display: none; }
.menu.is-visible { opacity: 1; }
.menu__list { list-style: none; margin: 0; padding: 0; }
.menu__list li { border-top: 1px solid var(--line); }
.menu__list li:last-child { border-bottom: 1px solid var(--line); }
.menu__list button {
  display: flex; align-items: baseline; gap: 16px; width: 100%;
  padding: 13px 0; min-height: 48px; text-align: left;
  font: 600 clamp(20px, 6vw, 30px)/1.1 var(--f-display); letter-spacing: -0.01em;
  transition: color 0.3s, padding 0.4s var(--ease-out);
}
.menu__list button span { font: 500 11px/1 var(--f-body); letter-spacing: 0.2em; color: var(--text-dim); width: 22px; }
.menu__list button:hover, .menu__list button.is-current { color: var(--orange); }
.menu__list button:hover { padding-left: 6px; }
.menu__foot { margin: 22px 0 0; font-size: 13px; color: var(--text-dim); }

/* ---------- Story beats ---------- */

.story {
  position: fixed; inset: 0; z-index: 10;
  height: 100vh; height: 100lvh;
  pointer-events: none;
}

.beat {
  position: absolute;
  left: 0; right: 0;
  padding: 0 var(--gutter);
  opacity: 0;
  visibility: hidden;
  will-change: transform, opacity;
}
.beat.is-live { visibility: visible; }

.beat--top { top: calc(96px + var(--safe-top)); }
.beat--bottom { bottom: calc(92px + var(--safe-bottom)); }
.beat--center { top: 50%; translate: 0 -50%; }

.beat h1, .beat h2 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(34px, 10.2vw, 44px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  text-wrap: balance;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.35);
}

/* line-by-line reveal (one-shot, time based) on top of the scroll-synced drift */
.ln { display: block; overflow: hidden; padding-bottom: 0.06em; }
.ln::before { content: none; }
.beat .ln > *, .beat .ln { --d: 0s; }
.beat h2 .ln, .beat h1 .ln {
  clip-path: inset(0 0 100% 0);
  transform: translateY(0.5em);
  transition: clip-path 1.1s var(--ease-out), transform 1.1s var(--ease-out);
}
.beat.is-in h2 .ln, .beat.is-in h1 .ln { clip-path: inset(0 0 -10% 0); transform: none; }
.beat h2 .ln:nth-child(2) { transition-delay: 0.07s; }
.beat h2 .ln:nth-child(3) { transition-delay: 0.14s; }
.beat h2 .ln:nth-child(4) { transition-delay: 0.21s; }

.beat__num {
  margin: 0 0 14px;
  font: 500 11px/1 var(--f-body);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--orange);
}
.beat__sub {
  max-width: 30ch;
  margin: 16px 0 0;
  font: 400 15px/1.5 var(--f-body);
  color: var(--text-dim);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1s 0.25s var(--ease-out), transform 1s 0.25s var(--ease-out);
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.6);
}
.beat.is-in .beat__sub { opacity: 1; transform: none; }

/* Hero : text framed around the small Earth */
.beat--hero { inset: 0; padding: 0; text-align: center; }
.hero__kicker {
  position: absolute; left: 0; right: 0;
  top: calc(50% - var(--earth-r) - 132px);
  margin: 0;
  font: 500 10px/1 var(--f-body); letter-spacing: 0.3em; text-transform: uppercase; color: var(--text-dim);
}
.hero__title { font-size: clamp(30px, 9vw, 44px) !important; }
.hero__top, .hero__bottom { position: absolute; left: 0; right: 0; display: block; }
.hero__top { top: calc(50% - var(--earth-r) - 92px); }
.hero__bottom { top: calc(50% + var(--earth-r) + 40px); }
.hero__top .ln, .hero__bottom .ln { display: inline-block; }
.hero__bottom .ln { transition-delay: 0.15s !important; }
.hero__sub {
  position: absolute; left: 0; right: 0;
  top: calc(50% + var(--earth-r) + 96px);
  margin: 0 auto; max-width: 26ch; padding: 0 var(--gutter);
  font-size: 14px; color: var(--text-dim);
}
.hero__cue {
  position: absolute; left: 0; right: 0;
  bottom: calc(96px + var(--safe-bottom));
  margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font: 500 10px/1 var(--f-body); letter-spacing: 0.26em; text-transform: uppercase; color: var(--text-dim);
}
.hero__cue i { width: 1px; height: 36px; background: linear-gradient(var(--orange), transparent); animation: cue 2.2s var(--ease-out) infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* Method steps */
.beat--method { text-align: left; }
.steps { list-style: none; margin: 22px 0 0; padding: 0; max-width: 340px; }
.steps li {
  display: flex; gap: 14px; align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font: 500 16px/1.2 var(--f-display);
  color: var(--text-dim);
  transition: color 0.5s, transform 0.6s var(--ease-out);
}
.steps li span { font: 500 11px/1 var(--f-body); letter-spacing: 0.18em; color: var(--text-dim); }
.steps li.is-on { color: var(--text); transform: translateX(6px); }
.steps li.is-on span { color: var(--orange); }

/* Values */
.beat--values h2 { font-size: clamp(30px, 9vw, 44px); }

/* Final */
.beat--final { inset: 0; padding: 0; }
.final__top { position: absolute; left: 0; right: 0; top: calc(96px + var(--safe-top)); padding: 0 var(--gutter); }
.final__bottom {
  position: absolute; left: 0; right: 0;
  top: calc(50% + var(--earth-r) + 28px);
  padding: 0 var(--gutter) var(--safe-bottom);
  opacity: 0; transform: translateY(10px);
  transition: opacity 1s 0.3s var(--ease-out), transform 1s 0.3s var(--ease-out);
}
.beat--final.is-in .final__bottom { opacity: 1; transform: none; }
.beat--final.is-in .final__bottom a,
.beat--final.is-in .final__bottom button { pointer-events: auto; }
.final__ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px;
  border: 1px solid var(--line); border-radius: 999px;
  font: 500 14px/1 var(--f-body); text-decoration: none;
  background: rgba(2, 4, 10, 0.35);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}
.btn:hover { border-color: var(--text); }
.btn--primary { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.btn--primary:hover { background: #ff9d40; border-color: #ff9d40; }
address { margin: 16px 0 0; font-style: normal; font-size: 13px; color: var(--text-dim); }
.restart { margin-top: 14px; min-height: 44px; font: 500 11px/1 var(--f-body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--text); }
.restart:hover { color: var(--orange); }
.legal { margin: 6px 0 0; font-size: 10.5px; line-height: 1.5; color: rgba(241, 244, 248, 0.4); }

/* ---------- HUD : 01 / 09 ---------- */

.hud {
  position: fixed; z-index: 20;
  left: var(--gutter); right: var(--gutter);
  bottom: calc(22px + var(--safe-bottom));
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; row-gap: 10px;
  font: 500 10px/1 var(--f-body); letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--text-dim);
  pointer-events: none;
}
.hud__count b { font-weight: 500; color: var(--text); }
.hud__label { justify-self: end; }
.hud__track { grid-column: 1 / -1; height: 1px; background: var(--line); overflow: hidden; }
.hud__fill { display: block; height: 100%; background: var(--orange); transform-origin: left; transform: scaleX(0); }

.credit {
  position: fixed; z-index: 20; right: var(--gutter); bottom: calc(52px + var(--safe-bottom));
  margin: 0; font-size: 9px; letter-spacing: 0.04em; color: rgba(241, 244, 248, 0.45);
  opacity: 0; transition: opacity 0.8s; pointer-events: none;
}
.credit.is-on { opacity: 1; }

/* ---------- Larger screens ---------- */

@media (min-width: 400px) {
  :root { --gutter: 24px; }
}

@media (min-width: 768px) {
  :root { --gutter: 40px; }
  .beat { max-width: 640px; }
  .beat--top { top: calc(120px + var(--safe-top)); }
  .beat--bottom { bottom: 110px; }
  .beat h1, .beat h2 { font-size: clamp(44px, 5.4vw, 72px); }
  .beat__sub { font-size: 16px; }
  .hero__title { font-size: clamp(40px, 4.6vw, 64px) !important; }
  .hero__top { top: calc(50% - var(--earth-r) - 110px); }
  .hero__kicker { top: calc(50% - var(--earth-r) - 160px); }
  .hud { right: auto; width: 280px; left: var(--gutter); }
  .hero__sub { max-width: 60ch; top: calc(50% + var(--earth-r) + 100px); }
  .hero__cue { bottom: 48px; }
  .beat--hero, .beat--final { max-width: none; }
  .final__top { max-width: 640px; }
}

@media (min-width: 1100px) {
  /* Desktop: text lives in a left column, the Earth keeps the centre */
  .beat--top, .beat--bottom, .beat--center { max-width: 560px; }
  .beat--top { top: 22vh; }
  .beat--bottom { bottom: 16vh; }
  .final__bottom { left: 50%; transform: translate(-50%, 10px); width: 520px; text-align: center; }
  .beat--final.is-in .final__bottom { transform: translate(-50%, 0); }
  .final__ctas { justify-content: center; }
  .final__top { max-width: none; text-align: center; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .beat h1, .beat h2 { font-size: 30px; }
  .beat--top { top: 64px; }
  .beat--bottom { bottom: 64px; }
  .hero__sub, .hero__kicker { display: none; }
  .steps li { padding: 5px 0; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .beat h2 .ln, .beat h1 .ln, .beat__sub, .final__bottom { transition-duration: 0.01s !important; transition-delay: 0s !important; }
  .hero__cue i { animation: none; }
}

/* Short viewports (small laptop windows, split panes): keep the hero clear of the scroll cue */
@media (max-height: 760px) {
  .hero__sub { display: none; }
  .hero__cue { bottom: calc(52px + var(--safe-bottom)); }
  .hero__cue i { height: 22px; }
}

/* Menu entries that are page links (e.g. "Nos projets") share the chapter button look */

.menu__list a {
  display: flex; align-items: baseline; gap: 16px; width: 100%;
  padding: 13px 0; min-height: 48px; text-decoration: none;
  font: 600 clamp(20px, 6vw, 30px)/1.1 var(--f-display); letter-spacing: -.01em;
  transition: color .3s, padding .4s var(--ease-out);
}
.menu__list a span { font: 500 11px/1 var(--f-body); letter-spacing: .2em; color: var(--text-dim); width: 22px; }
.menu__list a:hover, .menu__list a.is-current { color: var(--orange); }
.menu__list a:hover { padding-left: 6px; }

