/* ===================================================================
   E-KİZ · Dijital İkiz — Cinematic Landing
   Palette: deep navy #060611–#0a1622 · cyan energy #22d3ee · anomaly #ef4444
   =================================================================== */

:root {
  /* "Standing Wave" — Ryoji-Ikeda-on-black-glass register */
  --bg-0: #05060a;
  --bg-1: #0a1a2e;
  --cyan: #1fb6c9;
  --cyan-soft: #7cf5e6;   /* the one accent colour */
  --warm: #f4b740;
  --ink: #eaf1f2;
  --ink-dim: #9fb2bd;
  --ink-faint: #4a5d6e;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* ===================== STAGE / PINNED CANVAS ===================== */
.stage { position: relative; }

.canvas-wrap {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 50%, #070b14 0%, #05070c 46%, #04050a 100%);
  z-index: 1;
}

#scene { display: block; width: 100%; height: 100%; }

/* The tall element that drives scroll length.
   10 scenes — the master timeline (≈40 units) is scrubbed across this. */
.scroll-track {
  position: relative;
  /* tall on purpose: each beat gets a wide, spacious stretch of scroll so the
     phase-lock and the fault-catch breathe and land, rather than flying past. */
  height: 2200vh;
  z-index: 0;
  pointer-events: none;
}

/* ===================== ATMOSPHERE OVERLAYS ===================== */
.vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(110% 90% at 50% 45%, transparent 55%, rgba(2,4,10,.55) 100%);
  mix-blend-mode: multiply;
}
.grain {
  position: absolute; inset: -50%; pointer-events: none; z-index: 3;
  opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 6s steps(6) infinite;
}
@keyframes grain {
  0%{transform:translate(0,0)} 20%{transform:translate(-4%,3%)}
  40%{transform:translate(3%,-2%)} 60%{transform:translate(-2%,4%)}
  80%{transform:translate(4%,-3%)} 100%{transform:translate(0,0)}
}

/* ===================== HUD LABELS (anchored to 3D) ===================== */
.hud { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.hud__label {
  position: absolute; top: 0; left: 0;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 10px;
  font-size: 12px; letter-spacing: .02em;
  color: var(--ink);
  background: rgba(8, 18, 30, .55);
  border: 1px solid rgba(103, 232, 249, .25);
  border-radius: 100px;
  backdrop-filter: blur(8px);
  white-space: nowrap;
  opacity: 0;
  box-shadow: 0 6px 24px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.02);
}
.hud__label b { font-weight: 600; color: var(--ink-dim); }
.hud__label i { font-style: normal; font-weight: 600; color: var(--cyan-soft); }
.hud__label .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #34d399; box-shadow: 0 0 10px #34d399;
}
.hud__label::before {
  content: ""; position: absolute; left: -1px; top: 50%;
  width: 28px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(103,232,249,.5));
  transform: translate(-100%, -50%);
}

/* ===================== CAPTIONS (cinematic copy) ===================== */
.captions { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.cap {
  position: absolute;
  left: 50%; bottom: 14vh;
  transform: translateX(-50%);
  width: min(760px, 86vw);
  text-align: center;
  opacity: 0;
  will-change: opacity, transform;
}
/* soft scrim so copy stays legible over the busy energy field (scenes 4/6/8/9);
   it's a child of .cap so it fades with the caption's animated opacity */
.cap::before {
  content: ""; position: absolute; inset: -40% -12% -55%; z-index: -1;
  background: radial-gradient(58% 120% at 50% 62%, rgba(4,8,14,0.6), rgba(4,8,14,0) 72%);
  pointer-events: none;
}
.cap h1, .cap h2 {
  font-weight: 300;                 /* editorial restraint */
  letter-spacing: 0.006em;
  line-height: 1.12;
  color: rgba(234, 241, 242, 0.92);
}
.cap h1 { font-size: clamp(30px, 5.0vw, 58px); }
.cap h2 { font-size: clamp(24px, 3.8vw, 46px); }
.cap em {                            /* the single cyan accent word per beat */
  font-style: normal;
  font-weight: 500;
  color: var(--cyan-soft);
  text-shadow: 0 0 26px rgba(124, 245, 230, 0.45);
}
.cap p {
  margin-top: 16px;
  font-size: clamp(12px, 1.15vw, 14px);
  color: var(--ink-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ===================== SCROLL HINT ===================== */
.scroll-hint {
  position: absolute; left: 50%; bottom: 28px; z-index: 6;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--ink-faint); font-size: 11px; letter-spacing: .35em; text-transform: uppercase;
  pointer-events: none;
}
.scroll-hint__line {
  width: 1px; height: 46px;
  background: linear-gradient(180deg, var(--cyan), transparent);
  position: relative; overflow: hidden;
}
.scroll-hint__line::after {
  content: ""; position: absolute; top: -50%; left: 0; width: 100%; height: 50%;
  background: var(--cyan-soft);
  animation: scrollPulse 1.8s cubic-bezier(.7,0,.3,1) infinite;
}
@keyframes scrollPulse { 0%{top:-50%} 100%{top:100%} }

/* ===================== INTRO HINT (auto fly-in only) ===================== */
.intro-hint {
  position: absolute; left: 50%; bottom: 92px; z-index: 9;
  transform: translateX(-50%);
  padding: 9px 16px; border-radius: 999px;
  background: rgba(6,12,18,0.5); border: 1px solid rgba(34,211,238,0.25);
  color: var(--ink-dim); font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  white-space: nowrap; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility .5s;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.intro-hint.is-visible { opacity: .9; visibility: visible; }

/* ===================== DIVE FLASH (lens threshold) ===================== */
.flash {
  position: absolute; inset: 0; z-index: 7; pointer-events: none;
  opacity: 0; visibility: hidden;
  background: radial-gradient(circle at 50% 48%, rgba(222,250,255,0.95), rgba(120,225,255,0.6) 36%, rgba(20,60,90,0) 76%);
  mix-blend-mode: screen;
}

/* ===================== BRAND / PATENT ===================== */
.brand {
  position: fixed; left: 32px; bottom: 28px; z-index: 8;     /* book-imprint, low-left */
  font-weight: 600; letter-spacing: .22em; font-size: 12px; text-transform: uppercase;
  color: rgba(234,241,242,0.62); pointer-events: none;
}
.brand span { font-weight: 400; color: var(--cyan-soft); margin-left: 7px; letter-spacing: .14em; opacity: .8; }

/* ===================== LIVE TELEMETRY (decorative monitoring) ===================== */
.telemetry {
  position: fixed; top: 26px; left: 32px; z-index: 8;
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(159, 178, 189, 0.7); pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.telemetry b { color: var(--cyan-soft); font-weight: 600; }
.tele__dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan-soft); margin-right: 9px; vertical-align: middle;
  box-shadow: 0 0 8px var(--cyan-soft); animation: telePulse 1.8s ease-in-out infinite;
}
@keyframes telePulse { 0%,100% { opacity: .3; } 50% { opacity: 1; } }

/* ===================== SOUND TOGGLE (opt-in) ===================== */
.sound-toggle {
  position: fixed; right: 28px; bottom: 26px; z-index: 9;
  padding: 8px 15px; border-radius: 999px;
  background: rgba(10, 20, 30, 0.5); border: 1px solid rgba(124, 245, 230, 0.25);
  color: rgba(234, 241, 242, 0.7); font-family: var(--font); font-size: 11px;
  letter-spacing: .18em; text-transform: uppercase; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: color .3s, border-color .3s, background .3s;
}
.sound-toggle:hover { color: var(--cyan-soft); border-color: rgba(124, 245, 230, 0.5); }
.sound-toggle.is-on { color: var(--cyan-soft); border-color: var(--cyan-soft); background: rgba(31, 182, 201, 0.12); }

.patent-tag {
  position: fixed; top: 30px; right: 30px; z-index: 8;
  font-size: 11px; letter-spacing: .08em; color: var(--ink-faint);
  pointer-events: none;
}

/* ===================== LOADER ===================== */
.loader {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; background: var(--bg-0);
  transition: opacity .8s ease, visibility .8s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__core {
  width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle, var(--cyan-soft), var(--cyan) 40%, transparent 70%);
  box-shadow: 0 0 40px var(--cyan);
  animation: corePulse 1.4s ease-in-out infinite;
}
@keyframes corePulse {
  0%,100% { transform: scale(.7); opacity: .5; }
  50% { transform: scale(1); opacity: 1; }
}
.loader__label {
  font-size: 13px; letter-spacing: .42em; text-transform: uppercase; color: var(--ink-dim);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.loader__label span { font-size: 10px; letter-spacing: .25em; color: var(--ink-faint); }

/* ===================== REDUCED MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  .grain, .scroll-hint__line::after, .loader__core, .tele__dot { animation: none; }
  .intro-hint { transition: none; }
}

/* ===================== SCENE 3 · SCAN RETICLE ===================== */
.reticle {
  position: absolute; top: 46%; left: 50%;
  width: min(42vw, 440px); height: min(42vw, 440px);
  transform: translate(-50%, -50%);
  z-index: 6; pointer-events: none; opacity: 0;
}
.reticle__c {
  position: absolute; width: 34px; height: 34px;
  border: 2px solid var(--cyan); opacity: .9;
  filter: drop-shadow(0 0 8px var(--cyan));
}
.reticle__c.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.reticle__c.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.reticle__c.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.reticle__c.br { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.reticle__tag {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  font-size: 11px; letter-spacing: .35em; color: var(--red);
  font-weight: 700; text-shadow: 0 0 14px var(--red); white-space: nowrap;
}

/* ===================== SCENE 5 · DIAGNOSIS ===================== */
.diagnosis {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 7; pointer-events: none; opacity: 0; text-align: center;
  padding: 34px 48px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(13,26,40,.78), rgba(7,15,24,.78));
  border: 1px solid rgba(103, 232, 249, .28);
  box-shadow: 0 30px 80px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.05), 0 0 60px rgba(34,211,238,.12);
  backdrop-filter: blur(12px);
}
.diagnosis__tag {
  font-size: 11px; letter-spacing: .4em; color: var(--cyan); font-weight: 700;
}
.diagnosis h3 {
  font-size: clamp(34px, 5vw, 56px); font-weight: 700; margin: 10px 0 6px;
  background: linear-gradient(180deg, #fff, #9fe9f6); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.diagnosis__meta {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: 16px; color: var(--ink); font-weight: 600;
}
.diagnosis__meta i { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.diagnosis p { margin-top: 12px; font-size: 13px; color: var(--ink-dim); }

/* ===================== SCENE 6 · FLOW STREAK ===================== */
.flow-streak {
  position: absolute; top: 52%; left: 0; width: 100%; height: 4px;
  z-index: 6; pointer-events: none; opacity: 0; overflow: visible;
}
.flow-streak span {
  position: absolute; top: 50%; left: 18%; transform: translateY(-50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--cyan-soft); box-shadow: 0 0 24px 6px var(--cyan);
}
.flow-streak span::before {
  content: ""; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 220px; height: 2px;
  background: linear-gradient(270deg, var(--cyan), transparent);
}

/* ===================== SCENE 7 · DASHBOARD ===================== */
.dashboard {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 7; pointer-events: none; opacity: 0;
  width: min(620px, 88vw); padding: 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(12,23,36,.9), rgba(7,14,22,.92));
  border: 1px solid rgba(120,150,170,.16);
  box-shadow: 0 40px 100px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.05);
  backdrop-filter: blur(14px);
}
.dash__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dash__id b { font-size: 17px; font-weight: 700; color: var(--ink); }
.dash__id span { display: block; font-size: 12px; color: var(--ink-dim); margin-top: 2px; }
.dash__status { font-size: 11px; letter-spacing: .15em; color: var(--cyan); font-weight: 600; }
.dash__grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }
.metric {
  grid-column: span 1; padding: 14px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(20,34,50,.7), rgba(10,18,28,.7));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 8px 20px rgba(0,0,0,.3);
}
.metric > span { font-size: 11px; color: var(--ink-dim); letter-spacing: .04em; }
.metric > b { display: block; font-size: 22px; font-weight: 700; margin-top: 4px; color: var(--ink); }
.metric--warn > b { color: var(--red); text-shadow: 0 0 16px rgba(239,68,68,.5); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 22px; margin-top: 10px; }
.spark i { flex: 1; background: var(--cyan); border-radius: 2px; opacity: .7; }
.spark i:nth-child(1){height:40%} .spark i:nth-child(2){height:60%} .spark i:nth-child(3){height:45%}
.spark i:nth-child(4){height:72%} .spark i:nth-child(5){height:55%} .spark i:nth-child(6){height:80%} .spark i:nth-child(7){height:66%}
.spark--warn i { background: var(--red); }
.spark--warn i:nth-child(5){height:90%} .spark--warn i:nth-child(6){height:100%} .spark--warn i:nth-child(7){height:84%}
.gauge { grid-column: span 1; display: flex; align-items: center; justify-content: center; }
.gauge__ring {
  width: 96px; height: 96px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at center, rgba(10,18,28,1) 56%, transparent 57%),
    conic-gradient(var(--red) 0% 92%, rgba(80,100,120,.25) 92% 100%);
  box-shadow: 0 0 24px rgba(239,68,68,.25);
}
.gauge__ring b { font-size: 22px; font-weight: 800; color: #fff; }
.gauge__ring span { font-size: 9px; color: var(--ink-dim); letter-spacing: .06em; }
.dash__alert {
  margin-top: 14px; padding: 13px 16px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(239,68,68,.16), rgba(239,68,68,.04));
  border: 1px solid rgba(239,68,68,.35);
  display: flex; flex-direction: column; gap: 3px;
}
.dash__alert b { color: #ffb4b4; font-size: 14px; font-weight: 700; }
.dash__alert span { color: var(--ink-dim); font-size: 12px; }

/* ===================== SCENE 9 · CTA + FOOTER ===================== */
.cta {
  position: absolute; inset: 0; z-index: 8; opacity: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6vh 6vw 0;
}
.cta.is-active { pointer-events: auto; }
.cta__inner { width: min(560px, 92vw); text-align: center; }
.cta__eyebrow { font-size: 11px; letter-spacing: .42em; color: var(--cyan); font-weight: 700; }
.cta h2 {
  font-size: clamp(32px, 5vw, 58px); font-weight: 700; letter-spacing: -.02em; margin: 14px 0 14px;
  background: linear-gradient(180deg, #fff, #bcd6e6); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cta > .cta__inner > p { color: var(--ink-dim); font-size: 16px; line-height: 1.55; }
.cta__form { margin-top: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cta__form input {
  padding: 14px 16px; border-radius: 12px; font-size: 14px; color: var(--ink);
  background: rgba(10,20,30,.7); border: 1px solid rgba(120,150,170,.2);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.cta__form input::placeholder { color: var(--ink-faint); }
.cta__form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,.12); }
.cta__form input[name="email"], .cta__form input[name="count"] { grid-column: 1 / -1; }
.cta__form button {
  grid-column: 1 / -1; margin-top: 4px; padding: 15px; border: 0; border-radius: 12px;
  font-size: 15px; font-weight: 700; color: #04222b; cursor: pointer;
  background: linear-gradient(180deg, var(--cyan-soft), var(--cyan));
  box-shadow: 0 12px 30px rgba(34,211,238,.3); transition: transform .15s, box-shadow .2s;
}
.cta__form button:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(34,211,238,.42); }
.cta__done { margin-top: 18px; color: var(--cyan-soft); font-size: 14px; display: none; }
.cta.is-sent .cta__form { display: none; }
.cta.is-sent .cta__done { display: block; }
.footer {
  position: absolute; bottom: 22px; left: 0; width: 100%;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 22px;
  font-size: 11px; color: var(--ink-faint); letter-spacing: .03em; padding: 0 20px;
}
.footer b { color: var(--ink-dim); }

/* ===================== MOBILE ===================== */
@media (max-width: 720px) {
  .brand { top: 18px; left: 18px; font-size: 15px; }
  .patent-tag { display: none; }
  .cap { bottom: 16vh; }
  .hud__label { font-size: 11px; padding: 6px 10px; }
  .dashboard { width: 92vw; padding: 16px; }
  .dash__grid { grid-template-columns: 1fr 1fr; }
  .gauge { grid-column: span 2; }
  .cta__form { grid-template-columns: 1fr; }
  .cta__form input[name="email"], .cta__form input[name="count"] { grid-column: auto; }
  .diagnosis { padding: 26px 30px; }
  .reticle { width: 62vw; height: 62vw; }
}
