/* ============================================================
   NIKOLOZ KHACHIDZE — portfolio cinématique
   encre / émeraude / crème — Anton · Inter · IBM Plex Mono
   Règle d'or : AUCUN état de reveal caché en CSS statique.
   Tout état initial d'animation est posé par gsap.set (fail-open).
   ============================================================ */

/* ---------- Fonts (locales, zéro CDN) ---------- */
@font-face {
  font-family: 'Anton';
  src: url('../fonts/anton-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin-500-normal.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin-600-normal.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/ibm-plex-mono-latin-400-normal.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-latin-500-normal.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --ink: #060807;
  --ink-2: #0B100D;
  --emerald: #2BE4A0;
  --emerald-deep: #0E4D38;
  --cream: #F2EDDF;
  --cream-dim: rgba(242, 237, 223, 0.55);
  --cream-faint: rgba(242, 237, 223, 0.28);
  --line: rgba(242, 237, 223, 0.12);
  --caps: 'Anton', 'Arial Narrow', sans-serif;
  --sans: 'Inter', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --pad: clamp(20px, 5vw, 72px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--ink); scrollbar-color: var(--emerald-deep) var(--ink); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.mono { font-family: var(--mono); font-weight: 400; letter-spacing: 0.08em; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--emerald); color: var(--ink); }

/* ---------- Loader (failsafe : disparaît seul à 3,5 s) ---------- */
#loader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  animation: loader-failsafe 0.5s ease 3.5s forwards;
}
@keyframes loader-failsafe {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.loader-num { font-size: 13px; color: var(--emerald); letter-spacing: 0.2em; }
.loader-bar { width: 180px; height: 1px; background: var(--line); overflow: hidden; }
.loader-fill { display: block; width: 0%; height: 100%; background: var(--emerald); }
.loader-label { font-size: 10px; color: var(--cream-faint); letter-spacing: 0.3em; }

/* ---------- Couches fixes ---------- */
#stage {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 50% 42%, rgba(14, 77, 56, 0.34), transparent 70%),
    radial-gradient(ellipse 40% 30% at 78% 80%, rgba(14, 77, 56, 0.16), transparent 70%);
}
#orbit {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.grain {
  position: fixed; inset: -50px; z-index: 60; pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Topbar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px var(--pad);
  font-size: 11px;
  mix-blend-mode: difference;
}
.topbar-id { color: var(--cream); letter-spacing: 0.2em; }
.topbar-nav { display: flex; gap: 28px; }
.topbar-nav a { letter-spacing: 0.18em; position: relative; }
.topbar-nav a::after {
  content: ''; position: absolute; left: 0; bottom: -4px;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1);
}
.topbar-nav a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Sections communes ---------- */
main { position: relative; z-index: 1; }
section { position: relative; }
.eyebrow {
  font-size: 11px;
  color: var(--emerald);
  letter-spacing: 0.3em;
}

/* ---------- Vidéos de section (Seedance) — décoratives, sous le contenu ---------- */
.section-media {
  position: absolute; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
}
.section-video {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.34;
  filter: saturate(0.92);
}
.work .section-video { opacity: 0.24; }
.section-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6, 8, 7, 0.92), rgba(6, 8, 7, 0.55) 42%, rgba(6, 8, 7, 0.94));
}
.pillars-inner, .work > .eyebrow, .work-list { position: relative; z-index: 1; }

/* ---------- Hero ---------- */
.hero { height: 100vh; overflow: hidden; }
.hero-inner {
  height: 100%;
  padding: 0 var(--pad);
  display: flex; flex-direction: column; justify-content: center;
}
.hero-eyebrow {
  font-size: 11px; color: var(--emerald);
  letter-spacing: 0.32em;
  margin-bottom: clamp(10px, 2vh, 26px);
}
.hero-name {
  font-family: var(--caps);
  font-weight: 400;
  font-size: clamp(52px, 13.5vw, 200px);
  line-height: 0.92;
  letter-spacing: 0.01em;
  color: var(--cream);
  text-transform: uppercase;
  display: flex; flex-direction: column;
}
.hero-name .line { display: block; overflow: hidden; }
.hero-name .line-2 { align-self: flex-end; color: var(--emerald); }
.hero-name .split { display: inline-block; }
.hero-name .char { display: inline-block; will-change: transform; }
.hero-sub {
  margin-top: clamp(14px, 3vh, 34px);
  max-width: 520px;
  font-size: clamp(15px, 1.4vw, 19px);
  font-weight: 500;
  color: var(--cream-dim);
  text-shadow: 0 1px 14px rgba(6, 8, 7, 0.85);
}
.hero-cue {
  position: absolute; bottom: 28px; left: var(--pad);
  display: flex; align-items: center; gap: 12px;
  font-size: 10px; color: var(--cream-faint); letter-spacing: 0.3em;
}
.cue-line { width: 56px; height: 1px; background: var(--emerald); transform-origin: left; animation: cue 2.2s ease-in-out infinite; }
@keyframes cue { 0%, 100% { transform: scaleX(0.3); opacity: 0.5; } 50% { transform: scaleX(1); opacity: 1; } }
.telemetry {
  position: absolute; right: var(--pad); bottom: 28px;
  list-style: none;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 10px; color: var(--cream-faint); letter-spacing: 0.16em;
  text-align: right;
}
.telemetry b { color: var(--emerald); font-weight: 500; margin-left: 10px; }

/* ---------- Stats ---------- */
.stats { padding: clamp(80px, 14vh, 150px) var(--pad); }
.stats-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}
.stats-grid li {
  padding: clamp(24px, 3.5vw, 48px) clamp(12px, 2vw, 32px);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
.stats-grid li:last-child { border-right: none; }
.stat {
  font-size: clamp(26px, 3.6vw, 52px);
  font-weight: 500;
  color: var(--cream);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.stats-grid span { font-size: 13px; color: var(--cream-dim); }

/* ---------- Piliers ----------
   Layout par défaut = flux normal (lisible sans JS, fail-open).
   Le mode épinglé n'existe que via .is-pinned, posé par le JS. */
.pillars { padding: clamp(90px, 16vh, 170px) 0; }
.pillars-inner {
  position: relative;
  padding: 0 var(--pad);
  display: flex; flex-direction: column; justify-content: center;
}
.pillars .eyebrow { margin-bottom: clamp(20px, 4vh, 48px); }
.pillars-rail {
  position: absolute; left: var(--pad); top: 50%;
  transform: translateY(-50%);
  width: 2px; height: min(46vh, 380px);
  background: var(--line);
  display: none;
}
.rail-fill { display: block; width: 100%; height: 0%; background: var(--emerald); }
.pillars-track { position: relative; margin-left: clamp(28px, 4vw, 64px); }
.pillar { max-width: 780px; }
.pillar + .pillar { margin-top: clamp(48px, 8vh, 96px); }

.pillars.is-pinned { height: 100vh; padding: 0; overflow: hidden; }
.pillars.is-pinned .pillars-inner { height: 100%; }
.pillars.is-pinned .eyebrow { margin-left: clamp(28px, 4vw, 64px); }
.pillars.is-pinned .pillars-rail { display: block; }
.pillars.is-pinned .pillars-track { display: grid; }
.pillars.is-pinned .pillar { grid-area: 1 / 1; align-self: center; }
.pillars.is-pinned .pillar + .pillar { margin-top: 0; }
.pillar-tag { font-size: 11px; color: var(--emerald); letter-spacing: 0.3em; margin-bottom: 14px; }
.pillar-title {
  font-family: var(--caps);
  font-weight: 400;
  font-size: clamp(38px, 6.4vw, 96px);
  line-height: 0.95;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.pillar-desc { max-width: 520px; font-size: clamp(14px, 1.3vw, 17px); color: var(--cream-dim); }

/* ---------- Travaux ---------- */
.work { padding: clamp(90px, 16vh, 170px) var(--pad); }
.work .eyebrow { margin-bottom: clamp(28px, 5vh, 56px); }
.work-list { border-top: 1px solid var(--line); }
.row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(16px, 3vw, 48px);
  align-items: center;
  padding: clamp(26px, 4vh, 44px) clamp(8px, 1.5vw, 24px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  cursor: default;
}
.row::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(14, 77, 56, 0.35), rgba(14, 77, 56, 0.05));
  transform: scaleY(0); transform-origin: bottom;
  transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: -1;
}
.row:hover::before { transform: scaleY(1); }
.row-index { font-size: 12px; color: var(--cream-faint); letter-spacing: 0.2em; }
.row-title {
  font-family: var(--caps);
  font-weight: 400;
  font-size: clamp(30px, 4.6vw, 68px);
  line-height: 1;
  text-transform: uppercase;
  transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1), color 0.3s ease;
}
.row:hover .row-title { transform: translateX(14px); color: var(--emerald); }
.row-pitch { margin-top: 10px; max-width: 560px; font-size: 14px; color: var(--cream-dim); }
.row-meta {
  list-style: none;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 10px; color: var(--cream-faint); letter-spacing: 0.2em;
  text-align: right;
}
.row-meta li:first-child { color: var(--emerald); }

/* ---------- Finale ---------- */
.finale {
  min-height: 90vh;
  padding: clamp(90px, 16vh, 170px) var(--pad) clamp(60px, 8vh, 90px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.finale .eyebrow { margin-bottom: 22px; }
.finale-title {
  font-family: var(--caps);
  font-weight: 400;
  font-size: clamp(56px, 13vw, 190px);
  line-height: 0.95;
  text-transform: uppercase;
  overflow: hidden;
}
.finale-title .split, .finale-title .char { display: inline-block; }
.finale-sub { margin-top: 22px; max-width: 460px; font-size: 16px; color: var(--cream-dim); }
.finale-ctas { display: flex; gap: 16px; margin-top: 38px; flex-wrap: wrap; justify-content: center; }
.btn {
  font-family: var(--mono);
  font-size: 12px; letter-spacing: 0.18em;
  padding: 16px 34px;
  border: 1px solid var(--emerald);
  transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}
.btn-solid { background: var(--emerald); color: var(--ink); font-weight: 500; }
.btn-solid:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(43, 228, 160, 0.25); }
.btn-ghost { color: var(--emerald); }
.btn-ghost:hover { background: rgba(43, 228, 160, 0.1); transform: translateY(-3px); }
.who {
  margin-top: 56px;
  display: flex; align-items: center; gap: 16px;
  text-align: left; font-size: 13px; color: var(--cream-dim);
}
.who img {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  filter: grayscale(0.35) contrast(1.05);
}
.who em { font-style: normal; font-size: 10px; color: var(--emerald); letter-spacing: 0.2em; }

/* ---------- Footer ---------- */
.footer {
  padding: 36px var(--pad) 44px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
}
.footer-links { list-style: none; display: flex; gap: 26px; flex-wrap: wrap; font-size: 11px; letter-spacing: 0.18em; }
.footer-links a { color: var(--cream-dim); transition: color 0.25s ease; }
.footer-links a:hover { color: var(--emerald); }
.footer-note { font-size: 10px; color: var(--cream-faint); letter-spacing: 0.14em; }

/* ---------- Écrans peu hauts (laptop 768p de Niko) ---------- */
@media (max-height: 800px) {
  .hero-name { font-size: clamp(48px, 12vw, 150px); }
  .hero-sub { margin-top: 12px; }
  .pillar-title { font-size: clamp(32px, 5.6vw, 76px); }
  .finale { min-height: 100vh; }
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  #stage { opacity: 0.72; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid li:nth-child(2n) { border-right: none; }
  .stats-grid li:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .row { grid-template-columns: auto 1fr; }
  .row-meta { display: none; }
  .telemetry { display: none; }
  .pillars-rail { display: none; }
  .pillars-track { margin-left: 0; }
  .topbar-nav { gap: 18px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cue-line { animation: none; }
  .row::before, .row-title, .btn { transition: none; }
  html { scroll-behavior: auto; }
}
