/* ============================================================
   KOALA DIGITAL — Thème "Nuit d'eucalyptus"
   Noir profond · clair de lune · accent vert eucalyptus
   Space Grotesk (display) + Space Mono (labels)
   ============================================================ */

:root {
  --bg:           #04070b;
  --bg-soft:      #080d13;

  --text:         #eef2f6;
  --text-dim:     #93a1ad;
  --text-faint:   #4d5a64;

  --accent:       #7fd1ae;   /* vert eucalyptus lunaire */
  --accent-soft:  rgba(127, 209, 174, 0.14);
  --moon:         #cfe2ff;

  --line:         rgba(238, 242, 246, 0.10);
  --line-strong:  rgba(238, 242, 246, 0.22);

  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-mono:    'Space Mono', monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--bg); }

/* ============ HERO ============ */
.hero {
  position: relative;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
  background: var(--bg);
}

/* Fond : image puis vidéo, rendue en WebGL (parallax profondeur) */
.hero__bg {
  position: absolute;
  inset: 0;
  transform: scale(1.06); /* marge pour le parallax fallback */
  will-change: transform;
  animation: bgIn 2s var(--ease-out) both;
}
.hero__bg img,
.hero__bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% center; /* garde le koala visible au recadrage */
  display: block;
}
@keyframes bgIn {
  from { opacity: 0; filter: brightness(0.4); }
  to   { opacity: 1; filter: brightness(1); }
}

.hero__vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4,7,11,0.5) 0%, transparent 16%),
    linear-gradient(0deg, rgba(4,7,11,0.62) 0%, transparent 24%),
    linear-gradient(90deg, rgba(4,7,11,0.55) 0%, transparent 42%),
    radial-gradient(ellipse 130% 110% at 50% 50%, transparent 60%, rgba(4,7,11,0.42) 100%);
}

/* ── Éléments UI posés sur la scène ── */
.ui { position: absolute; z-index: 5; }

/* Top bar */
.ui--top {
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(18px, 3vw, 32px) clamp(20px, 4vw, 48px);
}

.ui__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.12em;
}
.ui__logo span { color: var(--accent); }
.ui__logo-img {
  height: 34px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(4, 7, 11, 0.6));
}

.ui__nav { display: flex; gap: clamp(18px, 3vw, 40px); }
.ui__nav a {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.25s;
}
.ui__nav a:hover { color: var(--text); }
.ui__nav a i {
  font-style: normal;
  color: var(--accent);
  margin-right: 7px;
  font-size: 10px;
}

/* Titre principal — gauche */
.ui--title {
  left: clamp(20px, 4.5vw, 56px);
  top: 50%;
  transform: translateY(-52%);
  max-width: min(560px, 52vw);
}

.hero__title {
  font-size: clamp(2.5rem, 6.2vw, 5.2rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  text-shadow: 0 4px 40px rgba(4, 7, 11, 0.8);
}
.hero__slash { color: var(--accent); margin-left: 0.08em; }

/* Deux étoiles scintillantes (remplacent les slashs) */
.hero__stars {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.08em;
  margin-left: 0.14em;
  vertical-align: baseline;
}
.hero__stars svg {
  width: 0.56em;
  height: 0.56em;
  fill: var(--accent);
  filter: drop-shadow(0 0 10px rgba(127, 209, 174, 0.5));
  animation: starTwinkle 2.6s ease-in-out infinite;
}
.hero__stars svg:nth-child(2) {
  width: 0.36em;
  height: 0.36em;
  margin-top: 0.04em;
  animation-delay: 1.3s;
}
@keyframes starTwinkle {
  0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
  50%      { opacity: 0.5; transform: scale(0.82) rotate(12deg); }
}

.hero__desc {
  margin-top: 22px;
  max-width: 380px;
  font-size: 14px;
  color: var(--text-dim);
  text-shadow: 0 2px 16px rgba(4, 7, 11, 0.9);
}

.hero__actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 4px;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s, background 0.25s, border-color 0.25s, color 0.25s;
}
.btn--solid {
  background: var(--accent);
  color: var(--bg);
}
.btn--solid:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(127, 209, 174, 0.35);
}
.btn--line {
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  backdrop-filter: blur(6px);
}
.btn--line:hover { border-color: var(--accent); color: var(--accent); }

/* Specs — droite */
.ui--specs {
  right: clamp(20px, 4vw, 48px);
  top: 50%;
  transform: translateY(-50%);
  width: 230px;
  font-family: var(--font-mono);
}
.specs__head {
  display: block;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.ui--specs dl div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.ui--specs dt {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}
.ui--specs dd {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
}

/* Carte projet — bas gauche */
.ui--project {
  left: clamp(20px, 4.5vw, 56px);
  bottom: clamp(20px, 4vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 250px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 7, 11, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.3s, background 0.3s, transform 0.3s var(--ease-out);
}
.ui--project:hover {
  border-color: rgba(127, 209, 174, 0.4);
  background: rgba(127, 209, 174, 0.06);
  transform: translateY(-3px);
}
.project__tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.project__text { font-size: 12.5px; color: var(--text-dim); }
.project__cta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  margin-top: 4px;
}

/* Tags — bas droite */
.ui--tags {
  right: clamp(20px, 4vw, 48px);
  bottom: clamp(20px, 4vw, 40px);
  display: flex;
  gap: 6px;
}
.ui--tags span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(4, 7, 11, 0.4);
  backdrop-filter: blur(10px);
}
.ui--tags .is-active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

/* Scroll hint — bas centre */
.ui--scroll {
  left: 50%;
  bottom: clamp(18px, 3.5vw, 34px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ui--scroll span {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ui--scroll i {
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, var(--accent), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { transform: scaleY(0.4); transform-origin: top; opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ── Entrées animées de l'UI ── */
.ui--title, .ui--specs, .ui--project, .ui--tags, .ui--top {
  opacity: 0;
  transform: translateY(16px);
  animation: uiIn 0.9s var(--ease-out) forwards;
}
.ui--title { transform: translateY(calc(-52% + 20px)); animation-name: uiInTitle; animation-delay: 0.5s; }
.ui--top { animation-delay: 0.3s; }
.ui--specs { transform: translateY(calc(-50% + 16px)); animation-name: uiInSpecs; animation-delay: 0.75s; }
.ui--project { animation-delay: 0.9s; }
.ui--tags { animation-delay: 1.05s; }

@keyframes uiIn {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes uiInTitle {
  to { opacity: 1; transform: translateY(-52%); }
}
@keyframes uiInSpecs {
  to { opacity: 1; transform: translateY(-50%); }
}

/* ============ SCÈNE DE SCROLL (zoom vers la lune) ============ */
.stage {
  height: 240vh;            /* longueur du voyage de scroll */
  position: relative;
}
.stage .hero {
  position: sticky;
  top: 0;
}

/* Halo qui engloutit l'écran à l'approche de la lune */
.hero__zoomglow {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at var(--gx, 30%) var(--gy, 20%),
    #eaf2ff 0%,
    #b9cde8 14%,
    rgba(50, 75, 110, 0.92) 42%,
    var(--bg) 78%);
}

/* Les éléments UI s'effacent pendant la plongée (piloté par --uiFade) */
.hero.anim-settled .ui,
.hero.anim-settled .ui--scroll {
  animation: none !important;
  opacity: calc(var(--uiFade, 1)) !important;
}
.hero.anim-settled .ui--title { transform: translateY(-52%) !important; }
.hero.anim-settled .ui--specs { transform: translateY(-50%) !important; }
.hero.anim-settled .ui--top,
.hero.anim-settled .ui--project,
.hero.anim-settled .ui--tags { transform: none !important; }

/* ============ SECTION SERVICES ============ */
.svc {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background: var(--bg);
}

.svc__bg {
  position: absolute;
  inset: 0;
}
.svc__bg img,
.svc__bg video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.svc__bg video { opacity: 0; transition: opacity 1s ease; }
.svc__bg video.is-on { opacity: 1; }

.svc__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4,7,11,0.65) 0%, transparent 22%),
    linear-gradient(0deg, rgba(4,7,11,0.75) 0%, transparent 30%),
    linear-gradient(90deg, rgba(4,7,11,0.5) 0%, transparent 38%),
    linear-gradient(270deg, rgba(4,7,11,0.5) 0%, transparent 38%);
}

.svc__inner {
  position: relative;
  z-index: 2;
  min-height: 100svh;
}

/* Barre haute : retour accueil */
.svc__topbar {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(18px, 3vw, 32px) clamp(20px, 4vw, 48px);
}
.svc__back {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.25s;
}
.svc__back:hover { color: var(--accent); }

/* Titre gauche — centré verticalement, chevauche la lune */
.svc__head {
  position: absolute;
  left: clamp(20px, 4.5vw, 56px);
  top: 50%;
  max-width: 520px;
}
.svc__title {
  font-size: clamp(2.6rem, 6vw, 5.2rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  text-shadow: 0 4px 40px rgba(4, 7, 11, 0.8);
}
.svc__sub {
  margin-top: 16px;
  font-size: 14.5px;
  color: var(--text-dim);
  max-width: 300px;
  text-shadow: 0 2px 16px rgba(4, 7, 11, 0.9);
}

/* Panneau description droite */
.svc__panel {
  position: absolute;
  right: clamp(20px, 4vw, 56px);
  top: 50%;
  transform: translateY(-58%);
  width: min(320px, 80vw);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.svc__panel.is-switching {
  opacity: 0;
  transform: translateY(calc(-58% + 10px));
}
/* Titre du panneau : même style que « TECHNICAL SPECS » du hero */
.svc__panel-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.svc__panel-desc {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-dim);
  margin-bottom: 6px;
}
/* Points clés : mêmes lignes que les specs du hero */
.svc__points {
  list-style: none;
  margin-bottom: 22px;
}
.svc__points li {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.svc__btn { margin-top: 26px; }

/* Rangée bas */
.svc__row {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  padding: 0 clamp(20px, 4vw, 56px) clamp(20px, 3.5vh, 36px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}
.svc__items {
  display: flex;
  gap: clamp(18px, 3.5vw, 56px);
  flex-wrap: wrap;
}
.svc__item {
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.25s;
  padding: 0;
}
.svc__item i {
  display: block;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-faint);
  margin-bottom: 6px;
  transition: color 0.25s;
}
.svc__item:hover { color: var(--text-dim); }
.svc__item.is-active { color: var(--text); }
.svc__item.is-active i { color: var(--accent); }

.svc__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.svc__meta > span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.svc__arrows { display: flex; gap: 8px; }
.svc__arrows button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(4, 7, 11, 0.4);
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 0.25s, color 0.25s, transform 0.25s var(--ease-out);
}
.svc__arrows button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* Entrée de la section au scroll */
.svc__head, .svc__panel, .svc__row, .svc__topbar {
  opacity: 0;
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.svc__head { transform: translateY(calc(-50% + 24px)); }
.svc__row { transform: translateY(18px); }
.svc.in .svc__head, .svc.in .svc__panel, .svc.in .svc__row, .svc.in .svc__topbar {
  opacity: 1;
  transform: none;
}
.svc.in .svc__head { transform: translateY(-50%); }
.svc.in .svc__panel { transform: translateY(-58%); }
.svc.in .svc__head { transition-delay: 0.1s; }
.svc.in .svc__panel { transition-delay: 0.3s; }
.svc.in .svc__row { transition-delay: 0.5s; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1060px) {
  .ui--specs { display: none; }
  .ui--title { max-width: min(560px, 70vw); }
}

@media (max-width: 860px) {
  /* Services : passage en flux vertical */
  .svc__head { position: static; padding: 90px 20px 0; max-width: none; transform: translateY(24px); }
  .svc.in .svc__head { transform: none; }
  .svc__panel {
    position: static;
    transform: none;
    width: auto;
    margin: 28px 20px 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(4, 7, 11, 0.55);
    backdrop-filter: blur(10px);
  }
  .svc.in .svc__panel { transform: none; }
  .svc__panel.is-switching { transform: translateY(8px); }
  .svc__row {
    position: static;
    flex-direction: column;
    align-items: stretch;
    margin-top: 28px;
    padding-bottom: 32px;
  }
  .svc__items { gap: 18px 24px; }
  .svc__meta { flex-direction: row; justify-content: space-between; align-items: center; }
  .stage { height: 200vh; }
}

@media (max-width: 720px) {
  /* Nav empilée en haut à droite */
  .ui--top { align-items: flex-start; }
  .ui__nav {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
  .ui__nav a {
    font-size: 11.5px;
    padding: 10px 0 10px 16px;   /* zone tactile ≥ 40px de haut */
  }

  .ui--title {
    left: 20px;
    right: 20px;
    top: auto;
    bottom: 150px;
    transform: none;
    max-width: none;
  }
  .ui--title { animation-name: uiIn; }
  /* anim-settled ne doit pas appliquer le centrage desktop en mobile */
  .hero.anim-settled .ui--title { transform: none !important; }
  .hero__title { font-size: clamp(2.2rem, 11vw, 3.4rem); }
  .hero__desc { font-size: 13px; }

  .ui--project { display: none; }
  .ui--tags { left: 20px; right: auto; bottom: 24px; flex-wrap: wrap; }
  .ui--scroll { display: none; }
}

/* ============ ACCESSIBILITÉ ============ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .ui--top, .ui--title, .ui--specs, .ui--project, .ui--tags { opacity: 1; transform: none; }
  .ui--title { transform: translateY(-52%); }
  .ui--specs { transform: translateY(-50%); }
}
