/* ==========================================================================
   TEKNEI — THE BRAND UNIVERSE
   Design system · tokens, base, tipografía, HUD global
   ========================================================================== */

:root {
  /* Color — Teknei */
  --void: #020812;
  --abyss: #030b18;
  --navy: #071b37;
  --navy-2: #0b2447;
  --blue: #1955c8;
  --blue-core: #006ecd;
  --electric: #2f7bff;
  --cyan: #15b6d5;
  --cyan-hi: #5fe0f5;
  --paper: #f3f6fa;
  --paper-2: #e8eef6;
  --ink: #071b37;
  --ink-2: #172b4d;
  --muted: #61718b;
  --mist: #a7c0dc;
  --frost: #c9daec;
  --line-l: rgba(7, 27, 55, .12);
  --line-d: rgba(167, 192, 220, .16);

  /* Type */
  --f-display: 'Sora', 'Helvetica Neue', Arial, sans-serif;
  --f-text: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.76, 0, .24, 1);

  /* Layout */
  --pad-x: clamp(20px, 5.2vw, 112px);
  --pad-y: clamp(72px, 9vh, 112px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--void); -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  font-family: var(--f-text);
  color: var(--frost);
  background: var(--void);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; }
::selection { background: var(--cyan); color: var(--void); }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; border-radius: 2px; }

/* ---------- Capas globales ---------- */
.universe {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: 0; pointer-events: none;
  transition: opacity .9s var(--ease-out);
}
body.universe-off .universe { opacity: 0; }

.grain {
  position: fixed; inset: -50%; z-index: 90; pointer-events: none;
  opacity: .055; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); } 60% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

.curtain {
  position: fixed; inset: 0; z-index: 200; pointer-events: none;
  background: var(--abyss);
  transform-origin: top;
  animation: curtainOut 1.2s .25s cubic-bezier(.77, 0, .175, 1) forwards;
}
@keyframes curtainOut { to { transform: scaleY(0); visibility: hidden; } }

/* ---------- Cursor ---------- */
.cursor { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; border-radius: 50%;
  transform: translate3d(-100px, -100px, 0); will-change: transform;
}
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--cyan-hi); }
.cursor-ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 1px solid rgba(95, 224, 245, .55);
  transition: width .35s var(--ease-out), height .35s var(--ease-out), margin .35s var(--ease-out), background .35s, border-color .35s;
}
body.cursor-hover .cursor-ring { width: 70px; height: 70px; margin: -35px 0 0 -35px; background: rgba(21, 182, 213, .12); border-color: var(--cyan); }
body[data-theme="light"] .cursor-dot { background: var(--blue); }
body[data-theme="light"] .cursor-ring { border-color: rgba(25, 85, 200, .5); }
body.laser .cursor-dot { width: 18px; height: 18px; margin: -9px 0 0 -9px; background: #ff3b30; box-shadow: 0 0 18px 6px rgba(255, 59, 48, .65); }
body.laser .cursor-ring { opacity: 0; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }
@media (hover: hover) and (pointer: fine) { body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; } }

/* ---------- HUD superior ---------- */
.hud-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: clamp(64px, 8vh, 88px);
  display: flex; align-items: center;
  padding: 0 var(--pad-x);
  pointer-events: none;
}
.hud-logo { pointer-events: auto; position: relative; display: block; height: clamp(26px, 3vw, 40px); aspect-ratio: 900 / 486; }
.hud-logo img { position: absolute; inset: 0; height: 100%; width: auto; transition: opacity .5s var(--ease-out); }
.logo-on-light { opacity: 0; }
body[data-theme="light"] .logo-on-dark { opacity: 0; }
body[data-theme="light"] .logo-on-light { opacity: 1; }

.hud-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: transparent;
}
.hud-progress span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transform-origin: left; transform: scaleX(0);
}

/* ---------- Índice lateral ---------- */
.hud-index {
  position: fixed; right: clamp(14px, 2vw, 36px); top: 50%; z-index: 100;
  transform: translateY(-50%);
}
.hud-index ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.hud-index a {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  text-decoration: none; padding: 2px 0;
  font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em;
  color: var(--mist);
}
.hud-index em { font-style: normal; opacity: 0; transform: translateX(6px); transition: opacity .4s, transform .4s var(--ease-out); }
.hud-index .tick { display: block; width: 14px; height: 1px; background: currentColor; opacity: .45; transition: width .5s var(--ease-out), opacity .4s, background .4s; }
.hud-index a:hover em, .hud-index a.is-active em { opacity: 1; transform: none; }
.hud-index a.is-active .tick { width: 34px; opacity: 1; background: var(--cyan); }
.hud-index a:hover .tick { opacity: 1; }
body[data-theme="light"] .hud-index a { color: var(--muted); }
body[data-theme="light"] .hud-index a.is-active .tick { background: var(--blue); }

/* ---------- Controles inferiores (originales) ---------- */
.controls {
  position: fixed; bottom: 18px; left: 50%; z-index: 100;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
  padding: 5px;
  border-radius: 99px;
  background: rgba(3, 11, 24, .62);
  border: 1px solid rgba(167, 192, 220, .18);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  color: #fff;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em;
  transition: background .5s, border-color .5s, color .5s, opacity .4s;
}
.controls button {
  width: 34px; height: 30px; border: 0; border-radius: 99px;
  background: transparent; color: inherit; cursor: pointer;
  display: grid; place-items: center; font-size: 14px;
  transition: background .25s, color .25s;
}
.controls button:hover { background: var(--blue); color: #fff; }
.controls #counter { min-width: 54px; text-align: center; opacity: .85; }
body[data-theme="light"] .controls { background: rgba(255, 255, 255, .7); border-color: var(--line-l); color: var(--ink); }

/* ---------- Tipografía editorial común ---------- */
.eyebrow {
  font-family: var(--f-mono);
  font-size: clamp(9px, .72vw, 12px);
  letter-spacing: .22em;
  font-weight: 500;
  text-align: right;
}
.sub {
  font-family: var(--f-text);
  font-weight: 300;
  font-size: clamp(15px, 1.2vw, 21px);
  line-height: 1.55;
  margin: 0;
}
.note {
  font-family: var(--f-text);
  font-size: clamp(12px, .85vw, 14px);
  line-height: 1.5;
  margin: 0;
  opacity: .8;
}

/* Palabras divididas para animación (el texto permanece íntegro) */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.wi { display: inline-block; will-change: transform; }

/* ---------- Accesibilidad / movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .grain { animation: none; }
  .curtain { display: none; }
}

@media print {
  .universe, .grain, .cursor, .curtain, .hud-top, .hud-index, .controls { display: none !important; }
}
