/* ==========================================================================
   UNYX — styles.css · V10 «EL PLANO TÉCNICO»
   Dirección: software a medida = plano de ingeniería. Papel técnico frío,
   tinta densa, cobalto eléctrico, cotas, retículas y cajetín.
   Tipografía: Bricolage Grotesque (display) · Instrument Sans (texto)
               · Fragment Mono (anotaciones).
   ========================================================================== */

:root {
  /* la hoja */
  --paper:   #ECECE6;
  --sheet:   #F7F7F2;
  --ink:     #16181C;
  --ink-2:   #50545C;
  --ink-3:   #63676F;   /* AA: 5,3:1 en hoja, 4,8:1 en papel */
  --line:    rgba(22, 24, 28, 0.16);
  --line-2:  rgba(22, 24, 28, 0.38);

  /* el trazo */
  --cobalt:      #2240F2;
  --cobalt-deep: #1830C0;
  --signal:      #B83A1C;   /* solo para marcar lo que está mal · AA en papel y hoja */

  /* compatibilidad con trazos antiguos (svg del portfolio, etc.) */
  --acc:      var(--cobalt);
  --acc-deep: var(--cobalt-deep);
  --gold-hi:  var(--cobalt);
  --gold-low: var(--ink-3);
  --grad: linear-gradient(100deg, var(--cobalt-deep), var(--cobalt));

  --font-display: "Bricolage Grotesque", sans-serif;
  --font-logo:    "Bricolage Grotesque", sans-serif;
  --font-body:    "Instrument Sans", sans-serif;
  --font-mono:    "Fragment Mono", monospace;

  --ease-cinema: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-snap:   cubic-bezier(0.4, 0, 0.2, 1);

  --hue: 264; /* legado; el plano no lo usa */
}

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

html { background: var(--paper); scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* marco de plano: la página entera es una lámina */
body::after {
  content: "";
  position: fixed; inset: 10px;
  border: 1px solid var(--line);
  pointer-events: none;
  z-index: 80;
}

::selection { background: var(--cobalt); color: #fff; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 3px;
}

/* enlace de salto: invisible hasta que recibe foco con teclado */
.skip-link {
  position: fixed;
  top: 16px; left: 16px;
  z-index: 100;
  transform: translateY(-200%);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 12px 18px;
  transition: transform 0.2s var(--ease-snap);
}

.skip-link:focus { transform: none; }

/* ===================== capas de fondo ===================== */

/* el plano es luz: las capas oscuras se retiran */
#aurora, .dots, #cursor-glow { display: none; }

.grain {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxODAnIGhlaWdodD0nMTgwJz48ZmlsdGVyIGlkPSduJz48ZmVUdXJidWxlbmNlIHR5cGU9J2ZyYWN0YWxOb2lzZScgYmFzZUZyZXF1ZW5jeT0nMC44MicgbnVtT2N0YXZlcz0nMicvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPScxODAnIGhlaWdodD0nMTgwJyBmaWx0ZXI9J3VybCgjbiknLz48L3N2Zz4=");
}

/* retícula de papel milimetrado, muy tenue, fija */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: 0.34;
}

/* ===================== el mecanismo (objeto héroe 3D persistente) =====================
   Capa FIJA a pantalla completa: los engranajes acompañan toda la página.
   La coreografía (posición, escala, opacidad por sección) vive en js/mechanism.js. */

.mech {
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease 0.2s;
}

body.has-mech .mech { opacity: 1; }
/* con la máquina en escena, la palabra gigante sobra: ruido bajo los engranajes */
body.has-mech .bigword { display: none; }

.mech canvas { width: 100% !important; height: 100% !important; display: block; }

.hero .eyebrow, .hero .claim, .hero .hero-foot { position: relative; z-index: 2; }

.bigword {
  position: absolute;
  right: -3vw; bottom: -6vw;
  z-index: 0;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 23vw;
  line-height: 1;
  letter-spacing: -0.02em;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(22, 24, 28, 0.13);
  pointer-events: none;
  user-select: none;
  will-change: transform;
}

/* ===================== intro · sello del plano ===================== */

#intro { display: none; }

.js #intro {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px;
  background: var(--paper);
  cursor: pointer;
  transition: opacity 0.7s ease, filter 0.7s ease;
}

.js #intro::after {
  content: "";
  position: absolute; inset: 10px;
  border: 1px solid var(--line-2);
}

#intro.out { opacity: 0; filter: blur(8px); pointer-events: none; }

.intro-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(64px, 14vw, 200px);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--ink);
  animation: introMark 1s var(--ease-cinema) both;
}

@keyframes introMark {
  from { opacity: 0; transform: translateY(28px) scale(0.97); filter: blur(7px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

.intro-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cobalt);
  animation: introTag 0.7s ease 0.45s both;
}

@keyframes introTag { from { opacity: 0; } to { opacity: 1; } }

#intro.lock .intro-mark { transform: scale(1.02); }
.intro-readout, .intro-skip { display: none; }

/* ===================== nav ===================== */

.nav {
  position: fixed; top: 10px; left: 10px; right: 10px; z-index: 40;
  display: flex; align-items: center; gap: 34px;
  padding: 18px clamp(18px, 3.4vw, 46px);
  border-bottom: 1px solid transparent;
  transition: background 0.3s, padding 0.3s, border-color 0.3s, opacity 0.8s ease, transform 1s var(--ease-cinema);
}

.nav.scrolled {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
  padding-top: 12px;
  padding-bottom: 12px;
}

.logo {
  font-family: var(--font-logo);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}

.logo .spark {
  width: 9px; height: 9px;
  background: var(--cobalt);
  animation: none;
}

.nav-links { display: flex; gap: 26px; margin-left: auto; }

.nav-links a {
  font-size: 13.5px; font-weight: 500;
  color: var(--ink-2);
  transition: color 0.2s;
  position: relative;
}

.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -5px;
  height: 2px; background: var(--cobalt);
  transition: right 0.3s var(--ease-snap);
}

.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { right: 0; }
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after { right: 0; }

.nav-cta {
  font-size: 13px; font-weight: 600;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}

.nav-cta:hover {
  background: var(--cobalt);
  border-color: var(--cobalt);
  transform: translateY(-1px);
}

.nav-burger {
  display: none;
  margin-left: auto;
  width: 42px; height: 42px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: var(--sheet);
  cursor: pointer;
  position: relative;
}

.nav-burger i, .nav-burger i::before {
  content: ""; position: absolute; left: 11px; right: 11px;
  height: 2px; background: var(--ink);
}
.nav-burger i { top: 17px; }
.nav-burger i::before { top: 6px; left: 0; right: 0; }

/* ===================== hero ===================== */

.hero {
  position: relative; z-index: 2;
  min-height: 100svh;
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 110px clamp(22px, 4vw, 58px) 0;
}

.eyebrow {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cobalt);
  margin-bottom: clamp(16px, 2.4vh, 28px);
}

.eyebrow::before { content: "+"; font-size: 14px; color: var(--ink-3); }

.claim {
  margin: 0;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 800;
  font-size: clamp(38px, 5.6vw, 92px);
  line-height: 0.99;
  letter-spacing: -0.025em;
  text-wrap: balance;
  text-transform: none;
  max-width: 14ch;
}

.claim .line { display: block; overflow: hidden; padding-bottom: 0.07em; margin-bottom: -0.07em; }

/* halo de papel: el titular respira aunque la máquina pase por detrás */
.claim .line > span {
  text-shadow:
    0 1px 0 var(--paper),
    0 0 12px var(--paper),
    0 0 26px var(--paper),
    0 0 40px var(--paper);
}
.claim .line > span { display: inline-block; will-change: transform; }
.claim .l2, .claim .l4 { margin-left: 0; }

.claim .serif {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 500;
  color: var(--ink-3);
}

.claim .grad, .grad-text {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--cobalt);
  animation: none;
}

/* cota bajo el titular: la marca de "a medida" */
.hero .claim::after {
  content: "";
  display: block;
  margin-top: clamp(18px, 2.6vh, 28px);
  height: 9px;
  max-width: 520px;
  border-left: 1px solid var(--line-2);
  border-right: 1px solid var(--line-2);
  background: linear-gradient(var(--line-2), var(--line-2)) center / 100% 1px no-repeat;
}

.hero-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-top: clamp(24px, 4vh, 46px);
  padding-bottom: clamp(26px, 4.5vh, 50px);
}

.hero-pitch { max-width: 540px; }

.sub {
  margin: 0 0 24px;
  font-size: clamp(14.5px, 1.2vw, 16.5px);
  line-height: 1.65;
  color: var(--ink-2);
  text-wrap: pretty;
}

.sub strong { color: var(--ink); font-weight: 600; }

.ctas { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.btn-primary {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-body);
  font-size: 14.5px; font-weight: 600;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 15px 26px;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.25s, border-color 0.25s, transform 0.3s var(--ease-snap), box-shadow 0.25s;
  will-change: transform;
}

.btn-primary::after {
  content: "";
  display: block;
  position: absolute; top: 0; bottom: 0; left: -70%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  transform: skewX(-18deg);
  transition: left 0.55s var(--ease-snap);
}

.btn-primary:hover { background: var(--cobalt); border-color: var(--cobalt); box-shadow: 4px 4px 0 rgba(34, 64, 242, 0.22); }
.btn-primary:hover::after { left: 125%; }
.btn-primary:active { transform: scale(0.985); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 14px 24px;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--sheet);
  box-shadow: 3px 3px 0 var(--line);
}

.micro {
  margin-top: 16px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--ink-3);
}

.micro b { color: var(--cobalt); font-weight: 400; }

/* scrollbar de marca: carril de papel, pulgar de tinta */
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--paper); border-left: 1px solid var(--line); }
::-webkit-scrollbar-thumb { background: var(--ink-3); border: 3px solid var(--paper); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--cobalt); }

/* especificaciones del hero (los tres compromisos) */
.hero-points {
  list-style: none;
  margin: 0; padding: 0;
  width: min(340px, 100%);
  flex-shrink: 0;
  background: var(--sheet);
  border: 1px solid var(--line-2);
  counter-reset: spec;
}

.hero-points li {
  display: flex; gap: 12px; align-items: baseline;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
  counter-increment: spec;
}

/* cabecera de la hoja de especificaciones */
.hero-points::before {
  content: "Especificaciones · UNYX";
  display: block;
  padding: 9px 16px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--paper);
  border-bottom: 1px solid var(--line-2);
}

.hero-points li:first-child { border-top: none; }

.hero-points li::before {
  content: "0" counter(spec);
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--cobalt);
  transform: translateY(-1px);
}

.hero-points li strong { color: var(--ink); font-weight: 600; }

/* ===================== entradas ===================== */

.js .claim .line > span {
  transform: translateY(116%);
  transition: transform 1.05s var(--ease-cinema);
  transition-delay: var(--d, 0s);
}

body.in .claim .line > span { transform: none; }
.js body.in .claim .line > span { transform: none; }

.js .rise {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 1s var(--ease-cinema);
  transition-delay: var(--d, 0s);
}

body.in .rise { opacity: 1; transform: none; }

.js .sr {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.85s ease, transform 1.05s var(--ease-cinema);
  transition-delay: var(--d, 0s);
}

.js .sr.in { opacity: 1; transform: none; }

/* cabeceras que entran enfocándose */
.js .sec-head.sr {
  filter: blur(9px);
  transition: opacity 0.95s ease, transform 1.15s var(--ease-cinema), filter 1s ease;
  transition-delay: var(--d, 0s);
}

.js .sec-head.sr.in { filter: blur(0); }

/* reveals direccionales */
.js .sr.sr-left  { transform: translateX(-48px); }
.js .sr.sr-right { transform: translateX(48px); }
.js .sr.sr-left.in, .js .sr.sr-right.in { transform: none; }

/* ===================== anillo del cursor ===================== */

#cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 49;
  width: 26px; height: 26px;
  border: 1px solid var(--ink-2);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.5;
  transition: width 0.28s var(--ease-snap), height 0.28s var(--ease-snap),
              opacity 0.3s ease, border-color 0.28s ease;
  will-change: transform;
}

#cursor-ring::after {
  content: "+";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-2);
  transition: color 0.28s;
}

#cursor-ring.on {
  width: 50px; height: 50px;
  opacity: 1;
  border-color: var(--cobalt);
}

#cursor-ring.on::after { color: var(--cobalt); }

/* ===================== HUD de sección ===================== */

#screen-hud {
  position: fixed;
  left: clamp(22px, 3vw, 46px);
  bottom: 24px;
  z-index: 30;
  display: flex; align-items: center; gap: 11px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
}

#screen-hud i { width: 22px; height: 1px; background: var(--cobalt); }
#screen-hud span { color: var(--ink-2); transition: opacity 0.16s ease; }
#screen-hud b { font-weight: 400; color: var(--cobalt); transition: opacity 0.16s ease; }
#screen-hud.swap span, #screen-hud.swap b { opacity: 0; }

/* ===================== menú móvil ===================== */

.menu-overlay {
  position: fixed; inset: 0; z-index: 55;
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  backdrop-filter: blur(16px);
  display: flex; flex-direction: column; justify-content: center;
  gap: 4px;
  padding: 0 clamp(24px, 8vw, 80px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
  counter-reset: menu;
}

.menu-overlay.open { opacity: 1; visibility: visible; }

.menu-overlay a {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 8vw, 52px);
  line-height: 1.3;
  color: var(--ink);
  transition: color 0.2s;
  counter-increment: menu;
  display: flex; align-items: baseline; gap: 14px;
}

.menu-overlay a::before {
  content: "0" counter(menu);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cobalt);
}

.menu-overlay a:hover { color: var(--cobalt); }

.menu-overlay .menu-mail {
  margin-top: 30px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--cobalt);
}

.menu-close {
  position: absolute; top: 22px; right: 22px;
  width: 46px; height: 46px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  background: var(--sheet);
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
}

/* ===================== responsive ===================== */

/* Con siete entradas el menu de escritorio se queda muy justo justo por encima del
   punto en el que aparece la hamburguesa. En esa franja apretamos separaciones y
   cuerpo en vez de esconder entradas o acortar los rotulos. */
@media (min-width: 881px) and (max-width: 1100px) {
  .nav { gap: 18px; padding-left: 20px; padding-right: 20px; }
  .nav-links { gap: 15px; }
  .nav-links a { font-size: 12.5px; }
  .nav-cta { font-size: 12px; padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 880px) {
  .nav-links, .nav .nav-cta { display: none; }
  .nav-burger { display: block; }

  body::after { inset: 6px; }
  .nav { top: 6px; left: 6px; right: 6px; }

  .hero { justify-content: center; padding-top: 96px; }
  .hero-foot { flex-direction: column; align-items: flex-start; gap: 26px; }
  .hero-points { width: 100%; }
  .bigword { font-size: 42vw; bottom: 14vh; }
  .btn-primary, .btn-ghost { padding: 14px 22px; }

  #screen-hud, #cursor-ring { display: none; }
}

/* ===================== reduced motion ===================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .claim .line > span, .js .rise, .js .sr { transform: none; opacity: 1; filter: none; }
  .js .sec-head.sr { filter: none; }
  html { scroll-behavior: auto; }
}
