/* ===========================================================================
   core.css — sistema base compartido por index / blog / artículo
   Ángel Tezanos · versión cinematográfica
   =========================================================================== */

/* ---------------------------------------------------------------- tokens -- */
:root {
  --bg:          #08080A;
  --bg-2:        #0E0E10;
  --bg-3:        #131317;
  --text:        #F5F5F7;
  --muted:       rgba(245, 245, 247, 0.82);
  --muted-2:     rgba(245, 245, 247, 0.54);
  --dim:         #9EA0A8;
  --dim-2:       #6E7078;
  --para:        #D5D6DA;

  --brand:       #FF4347;
  --brand-d:     #E03338;
  --brand-soft:  rgba(255, 67, 71, 0.14);
  --brand-line:  rgba(255, 67, 71, 0.55);

  --line:        rgba(255, 255, 255, 0.10);
  --line-2:      rgba(255, 255, 255, 0.055);
  --line-3:      rgba(255, 255, 255, 0.22);
  --surface:     rgba(15, 15, 19, 0.60);
  --surface-2:   rgba(16, 16, 20, 0.72);
  /* separa del fondo fotográfico el texto que no va sobre tarjeta */
  --on-photo:    0 2px 18px rgba(8, 8, 10, 0.6);

  --max:         1340px;
  --pad-x:       clamp(18px, 4vw, 48px);
  --pad-y:       clamp(76px, 11vw, 152px);

  --ease:        cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io:     cubic-bezier(0.65, 0, 0.35, 1);
  --ease-back:   cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'Raleway', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --head-h:      68px;
  /* alto de la franja de logos: el hero le reserva este hueco para que la
     marquesina entre en la primera pantalla */
  --band-h:      130px;
}

/* ----------------------------------------------------------------- reset -- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-locked { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  line-height: 0.95;
  letter-spacing: -0.035em;
}

p { margin: 0; }

::selection { background: var(--brand); color: #fff; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 3px;
}

/* barra de scroll */
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: #050506; }
::-webkit-scrollbar-thumb { background: #24242a; border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-d); }

.shell {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =========================================================== fondo cine == */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.stage-photo {
  position: absolute;
  inset: -9%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  will-change: opacity, transform, filter;
  transform: scale(1.06);
}

.stage-tint {
  position: absolute;
  inset: 0;
  /* tinte suave hacia verde-azulado: deja respirar el color natural de las
     fotos (vegetación, cielo) y conserva el rojo de marca en el arranque */
  background: linear-gradient(135deg, #FF4347 0%, #1E7F6B 52%, #123F63 100%);
  mix-blend-mode: color;
  opacity: 0.16;
  will-change: opacity, filter;
}

.stage-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(126% 96% at 72% 4%, rgba(8, 8, 10, 0.26), rgba(8, 8, 10, 0.88) 72%);
}

.stage-diagonal {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(8, 8, 10, 0.62) 0%, rgba(8, 8, 10, 0.06) 56%, rgba(8, 8, 10, 0.28) 100%);
}

.stage-grid {
  position: absolute;
  inset: -140px;
  background:
    repeating-linear-gradient(to right, rgba(255,255,255,0.055) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.055) 0 1px, transparent 1px 96px);
  opacity: 0.55;
  will-change: transform, opacity;
}

/* chispas / partículas */
.stage-sparks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.85;
  mix-blend-mode: screen;
}

.stage-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(8,8,10,0.72), transparent 20%, transparent 72%, rgba(8,8,10,0.66)),
    radial-gradient(145% 115% at 50% 50%, transparent 48%, rgba(0,0,0,0.42) 100%);
}

/* grano de película + scanlines: capa superior, siempre visible */
.filmic {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.5;
}

.filmic::before {
  content: '';
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.42'/%3E%3C/svg%3E");
  animation: grain 0.7s steps(4) infinite;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 41;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.035) 0 1px, transparent 1px 3px);
  opacity: 0.35;
}

@keyframes grain {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(-6%, 4%, 0); }
  50%  { transform: translate3d(4%, -5%, 0); }
  75%  { transform: translate3d(-3%, -3%, 0); }
  100% { transform: translate3d(5%, 3%, 0); }
}

/* barras cinematográficas (letterbox) */
.letterbox {
  position: fixed;
  left: 0;
  right: 0;
  height: 0;
  background: #000;
  z-index: 60;
  pointer-events: none;
  transition: height 0.9s var(--ease);
}
.letterbox.is-top { top: 0; }
.letterbox.is-bottom { bottom: 0; }
body.is-cinema .letterbox { height: clamp(26px, 5vh, 58px); }

main { position: relative; z-index: 1; }

/* ============================================================ preloader == */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #050506;
  display: grid;
  place-items: center;
  transition: opacity 0.5s ease;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.pre-mark {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  height: 46px;
}

.pre-mark i {
  display: block;
  width: 6px;
  background: var(--brand);
  height: 12px;
  animation: preBar 1.1s var(--ease-io) infinite;
  box-shadow: 0 0 18px var(--brand);
}
.pre-mark i:nth-child(2) { animation-delay: 0.12s; }
.pre-mark i:nth-child(3) { animation-delay: 0.24s; }

@keyframes preBar {
  0%, 100% { height: 12px; opacity: 0.45; }
  50%      { height: 46px; opacity: 1; }
}

.pre-count {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.34em;
  color: var(--muted-2);
}

.pre-track {
  width: min(240px, 52vw);
  height: 2px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
}

.pre-fill {
  height: 100%;
  width: 0%;
  background: var(--brand);
  box-shadow: 0 0 14px var(--brand);
}

/* cortina de apertura / transición entre páginas */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 190;
  pointer-events: none;
  display: grid;
  grid-template-rows: 1fr 1fr;
}

.curtain span {
  display: block;
  background: #050506;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.62s var(--ease-io);
}
.curtain span:last-child { transform-origin: bottom; }

.curtain.is-closing span { transform: scaleY(1); }
.curtain.is-opening span { transform: scaleY(0); }

/* ================================================================ cursor == */
.cursor, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 300;
  pointer-events: none;
  border-radius: 999px;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cursor {
  width: 6px; height: 6px;
  background: #fff;
  margin: -3px 0 0 -3px;
}

.cursor-ring {
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border: 1px solid rgba(255,255,255,0.6);
  transition: opacity 0.3s ease, width 0.3s var(--ease), height 0.3s var(--ease),
              margin 0.3s var(--ease), background 0.3s ease, border-color 0.3s ease;
}

body.has-cursor .cursor,
body.has-cursor .cursor-ring { opacity: 1; }

body.cursor-hot .cursor-ring {
  width: 62px; height: 62px;
  margin: -31px 0 0 -31px;
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.9);
}

body.has-cursor a, body.has-cursor button { cursor: none; }
@media (hover: hover) and (pointer: fine) {
  body.has-cursor { cursor: none; }
}

/* ============================================================== cabecera == */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--head-h);
  background: rgba(8, 8, 10, 0.55);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: background 0.4s ease, border-color 0.4s ease, transform 0.45s var(--ease);
}

.topbar.is-stuck {
  background: rgba(8, 8, 10, 0.82);
  border-bottom-color: var(--line);
}

.topbar.is-hidden { transform: translateY(-102%); }

.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: inline-flex;
  gap: 3px;
  align-items: flex-end;
  height: 17px;
}

.brand-mark i {
  display: block;
  width: 3px;
  height: 17px;
  background: var(--brand);
  transition: height 0.35s var(--ease-back), box-shadow 0.35s ease;
}

.brand:hover .brand-mark i { box-shadow: 0 0 12px var(--brand); }
.brand:hover .brand-mark i:nth-child(1) { height: 10px; }
.brand:hover .brand-mark i:nth-child(3) { height: 12px; }

.brand-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 30px);
}

.nav a {
  position: relative;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(245, 245, 247, 0.58);
  transition: color 0.3s ease;
  padding-block: 4px;
}

.nav a::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}

.nav a:hover { color: var(--text); }
.nav a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav a.is-current { color: var(--text); }

.nav a.cta {
  background: var(--brand);
  color: #fff;
  padding: 9px 17px;
  border-radius: 8px;
  transition: background 0.3s ease, box-shadow 0.35s ease, transform 0.35s var(--ease);
}
.nav a.cta::after { display: none; }
.nav a.cta:hover {
  background: var(--brand-d);
  box-shadow: 0 0 26px rgba(255, 67, 71, 0.45);
  transform: translateY(-1px);
}

.menu-toggle {
  display: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--muted);
  transition: border-color 0.3s ease, color 0.3s ease;
}
.menu-toggle:hover { border-color: var(--line-3); color: var(--text); }

@media (max-width: 820px) {
  .menu-toggle { display: inline-flex; }

  .nav {
    position: absolute;
    top: var(--head-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #0B0B0E;
    border-bottom: 1px solid var(--line);
    padding: 8px var(--pad-x) 20px;
    clip-path: inset(0 0 100% 0);
    opacity: 0;
    pointer-events: none;
    transition: clip-path 0.5s var(--ease), opacity 0.35s ease;
  }

  .nav.is-open {
    clip-path: inset(0 0 0 0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav a {
    padding: 15px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--line-2);
  }
  .nav a::after { display: none; }
  .nav a.cta {
    margin-top: 16px;
    text-align: center;
    border-bottom: 0;
    padding: 14px 18px;
  }
}

/* ============================================================== scroll HUD */
.hud {
  position: fixed;
  right: clamp(10px, 1.8vw, 26px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.hud-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(245, 245, 247, 0.55);
}

.hud-track {
  width: 2px;
  height: 152px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.hud-fill {
  width: 100%;
  height: 0%;
  background: var(--brand);
  box-shadow: 0 0 12px rgba(255, 67, 71, 0.7);
}

.hud-section {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand);
  writing-mode: vertical-rl;
  max-height: 130px;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

@media (max-width: 900px) { .hud { display: none; } }

/* ========================================================== tipografía UI */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.sec-num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--brand);
}

.sec-title {
  font-size: clamp(32px, 5vw, 66px);
  font-weight: 900;
  letter-spacing: -0.035em;
  text-transform: lowercase;
  line-height: 0.92;
}

/* Texto que se apoya directamente en la fotografía de fondo: una sombra
   ancha y suave lo despega sin tener que oscurecer la imagen. */
.hero-title, .hero-lead, .hero-eyebrow, .hero-foot,
.sec-title, .sec-num, .sec-lead,
.timeline-date, .timeline-title, .timeline-text,
.notes-all, .marquee-label,
.blog-title, .blog-lead, .eyebrow,
.article-title, .article-meta {
  text-shadow: var(--on-photo);
}

.accent { color: var(--brand); }

/* ============================================================== botones == */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 15px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s var(--ease), border-color 0.3s ease, color 0.3s ease;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--brand-d);
  transform: translateY(101%);
  transition: transform 0.45s var(--ease);
}

.btn:hover::before { transform: translateY(0); }
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover { box-shadow: 0 10px 40px -12px rgba(255, 67, 71, 0.8); }

.btn-ghost {
  border: 1px solid var(--line-3);
  color: var(--text);
}
.btn-ghost::before { background: rgba(255, 255, 255, 0.09); }

.btn i {
  font-style: normal;
  transition: transform 0.4s var(--ease);
}
.btn:hover i { transform: translateX(4px); }

/* =============================================================== footer == */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 30px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim-2);
}

.footer-inner a { transition: color 0.3s ease; }
.footer-inner a:hover { color: var(--brand); }

/* ============================================================== reveals == */
[data-reveal] {
  opacity: 0;
  transform: translateY(38px);
  transition:
    opacity 0.9s var(--ease),
    transform 1s var(--ease),
    filter 0.9s var(--ease);
  filter: blur(6px);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
  filter: none;
}

[data-reveal='mask'] {
  opacity: 1;
  filter: none;
  transform: none;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.1s var(--ease);
}
[data-reveal='mask'].is-in { clip-path: inset(0 0 -12% 0); }

/* palabras del titular */
.word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  /* margen negativo para que el recorte no coma los descendentes (g, j, q) */
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}
.word > span {
  display: inline-block;
  transform: translateY(105%) rotate(4deg);
  transition: transform 1.05s var(--ease);
}
.is-typed .word > span { transform: none; }

/* ======================================================== marca EMI css == */
.emi-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, 0.5vw, 5px);
  background: var(--brand);
  border-radius: 3px;
}
.emi-mark i {
  display: block;
  background: #0E0E10;
  border-radius: 1px;
}

/* ====================================================== accesibilidad === */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; }
  .word > span { transform: none !important; }
  .filmic, .scanlines, .stage-sparks { display: none; }
}
