/* ============================================================
   LUIS GALLEGO — Sistema de diseño
   HTML/CSS/JS puro (sin frameworks)
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Colores */
  --ink:          #0e0e0e;   /* fondo base */
  --surface:      #1e1e1e;   /* secciones alternas */
  --surface-2:    #2b2b2b;   /* footer / tarjetas */
  --accent:       #0a63ff;   /* Azul eléctrico */
  --accent-soft:  #3d8bff;   /* azul claro (hover / detalles) */
  --accent-ink:   #ffffff;   /* texto sobre acento */
  --text:         #e2e2e2;   /* texto principal */
  --text-muted:   #adadad;   /* texto secundario */
  --line:         rgba(255, 255, 255, .12);

  /* Tipografía */
  --font-display: "Gemunu Libre", "Arial Narrow", sans-serif;
  --font-body:    "Noto Sans", system-ui, sans-serif;

  /* Espaciado / layout */
  --container-max: 1200px;
  --gutter: 24px;
  --section-gap: 112px;

  /* Efectos */
  --glow: 0 0 24px rgba(10, 99, 255, .45);

  /* Encuadre de las fotos del collage de portada. Al ser columnas altas y estrechas,
     lo que manda es el 1er número (recorte lateral): 50% deja al sujeto centrado;
     bájalo o súbelo si en alguna foto queda descuadrado. */
  --hero-focus: 50% 25%;
}

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

/* scroll-padding-top: por si se abre la web con un enlace directo (index.html#contacto).
   La navegación con clic la ajusta js/script.js con la altura real de la cabecera. */
html { scroll-behavior: smooth; scroll-padding-top: 104px; }

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

img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

::selection { background: var(--accent); color: var(--accent-ink); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.material-symbols-outlined { font-size: 24px; line-height: 1; vertical-align: middle; }

/* ---------- Utilidades ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.05;
  letter-spacing: .04em;
  font-size: clamp(34px, 5.2vw, 60px);
  color: var(--text);
}

.accent-bar { height: 4px; width: 88px; background: var(--accent); margin-top: 20px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 13px 28px;
  border: 2px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: background .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.btn:active { transform: scale(.97); }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-accent:hover { background: var(--accent-soft); border-color: var(--accent-soft); box-shadow: var(--glow); }

.btn-ghost {
  background: transparent;
  border-color: var(--accent);
  color: var(--text);
}
.btn-ghost:hover { background: var(--accent); color: var(--accent-ink); }

.btn-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--text);
}
.btn-dark:hover { background: #000; border-color: #000; }

.btn-lg { font-size: 17px; padding: 17px 40px; }
.btn-xl { font-size: 19px; padding: 20px 56px; }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  background: rgba(14, 14, 14, .25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: rgba(14, 14, 14, .95);
  border-bottom-color: var(--line);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text);
  transition: color .3s ease;
}
a.brand:hover { color: var(--accent-soft); }

/* Sin placa de color: el logo "flota" directamente sobre la cabecera. Ya lleva
   un halo blanco incorporado (generado en images/logo.png) que separa el
   trazo del fondo oscuro y conecta con el --glow que usan los botones. */
.brand-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
  flex: none;
}

.nav-links { display: flex; align-items: center; gap: 8px; }

.nav-link {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text);
  padding: 13px 20px;
  transition: color .3s ease;
}
.nav-link:hover { color: var(--accent-soft); }

.nav-cta { margin-left: 12px; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}
.nav-toggle .material-symbols-outlined { font-size: 32px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 160px 0 96px;
  overflow: hidden;
  background: var(--ink);
}

/* Collage de portada: 3 columnas iguales separadas por una fina línea de fondo */
.hero-collage {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  background: var(--ink);
}
.hero-collage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--hero-focus);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(14, 14, 14, .55) 0%, rgba(14, 14, 14, .15) 35%, var(--ink) 100%);
}

/* Si no hay foto de hero, se usa un fondo con destello azul */
.hero.no-photo {
  background:
    radial-gradient(ellipse at 50% 35%, rgba(10, 99, 255, .18), transparent 60%),
    var(--ink);
}

.hero-inner { position: relative; text-align: center; }

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  font-size: clamp(52px, 11vw, 128px);
  line-height: .95;
  letter-spacing: .16em;
  text-indent: .16em; /* compensa el espaciado de la última letra */
  margin-bottom: 12px;
}

.hero-subtitle {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 400;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.hero-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 36px;
  font-size: 14px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hero-social a { display: inline-flex; align-items: center; gap: 8px; transition: color .3s ease; }
.hero-social a:hover { color: var(--accent-soft); }
.hero-social .material-symbols-outlined { font-size: 20px; }
.hero-social .sep { opacity: .5; }

/* ---------- Cinta en movimiento ---------- */
.ticker {
  background: var(--accent);
  color: var(--accent-ink);
  overflow: hidden;
  padding: 14px 0;
  white-space: nowrap;
}
.ticker-track {
  display: inline-flex;
  align-items: center;
  /* La cinta lleva 4 repeticiones de los textos (2 por mitad), así que necesita
     el doble de tiempo para moverse a la misma velocidad de siempre. */
  animation: ticker-scroll 56s linear infinite;
}
/* margen uniforme en cada elemento: así el bucle al -50% es exacto */
.ticker-track > * { margin-right: 28px; }
.ticker-track span {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ticker .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Credenciales ---------- */
.creds { padding-block: var(--section-gap); background: var(--ink); }

.creds-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 56px;
  align-items: center;
}

.creds-list { display: flex; flex-direction: column; gap: 28px; }
.creds-list li {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.2vw, 27px);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  padding-left: 20px;
  border-left: 3px solid var(--accent);
}
.creds-list strong { color: var(--accent-soft); font-weight: 700; }
.creds-grid > .creds-list:last-child li { text-align: right; padding-left: 0; padding-right: 20px; border-left: none; border-right: 3px solid var(--accent); }

.creds-brand { text-align: center; display: flex; flex-direction: column; align-items: center; }
.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 5.5vw, 66px);
  line-height: .95;
  letter-spacing: .1em;
  text-indent: .1em;
  text-transform: uppercase;
  color: var(--text);
}
.creds-brand .accent-bar { margin: 24px auto 32px; }

/* ---------- Sobre mí ---------- */
.about { background: var(--surface); padding-block: var(--section-gap); }

.about-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 72px;
  align-items: center;
}
.about-text .eyebrow { margin-bottom: 16px; }
.about-text .section-title { margin-bottom: 32px; }

.prose { display: flex; flex-direction: column; gap: 20px; font-size: 17px; color: var(--text-muted); }
.prose strong { color: var(--text); font-weight: 700; }

.stats { margin-top: 44px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px; }
.stat { border-left: 4px solid var(--accent); padding: 6px 0 6px 22px; }
.stat-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 52px;
  line-height: 1;
  color: var(--text);
}
.stat-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--text-muted);
  margin-top: 6px;
}

.about-media img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 20px;
}

/* ---------- Casos de éxito ---------- */
.cases { background: var(--ink); padding-block: var(--section-gap); }
.section-head { margin-bottom: 64px; }
.section-head .eyebrow { margin-bottom: 14px; }

.casos-lista { display: flex; flex-direction: column; gap: 88px; }

.caso {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}
/* Los casos pares invierten los lados, para dar ritmo a la lista.
   Hay que invertir también los anchos de las columnas: con `order` solo se
   mueven los elementos, las columnas conservan su tamaño donde estaban. */
.caso:nth-child(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); }
.caso:nth-child(even) .caso-vistas { order: 2; }
.caso:nth-child(even) .caso-datos  { order: 1; }

/* Solo se ve una vista cada vez; el resto espera oculta */
.caso-vista { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.caso-vista:not(.is-active) { display: none; }

.caso-foto { position: relative; margin: 0; }
.caso-foto img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 6px;
}
/* El vídeo ocupa el mismo hueco 4:5 que las fotos, pero es más vertical (9:16).
   Con `contain` se ve entero, sin recortar: las franjas laterales van del color
   del fondo, así que no se notan. */
.caso-foto video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  background: var(--ink);
  border-radius: 6px;
}

.caso-foto figcaption {
  position: absolute;
  top: 12px; left: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  padding: 5px 10px;
  border-radius: 4px;
  background: rgba(14, 14, 14, .78);
  color: var(--text);
}
.caso-foto.es-despues figcaption { background: var(--accent); color: var(--accent-ink); }

.caso-nombre {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 4.5vw, 54px);
  line-height: 1;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.caso-etapa {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 9999px;
  padding: 6px 16px;
}
.caso-tiempo {
  margin-top: 26px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.caso-tiempo strong {
  display: block;
  font-family: var(--font-display);
  font-size: 60px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  color: var(--text);
}

/* Botones para cambiar de vista (solo si el caso tiene más de un par) */
.caso-selector { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.caso-selector button {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color .25s ease, color .25s ease, background .25s ease;
}
.caso-selector button:hover { border-color: var(--accent); color: var(--text); }
.caso-selector button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ---------- Franja de acento ---------- */
.stripe { background: var(--accent); color: var(--accent-ink); padding-block: 64px; }
.stripe-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}
.stripe-text {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.4vw, 40px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: .02em;
  max-width: 780px;
}
.stripe .btn { flex: none; }

/* ---------- Contacto ---------- */
.contact { background: var(--surface); padding-block: var(--section-gap); }
.contact-inner { max-width: 800px; margin-inline: auto; text-align: center; }
.contact-inner .eyebrow { margin-bottom: 16px; }

.contact-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(44px, 7vw, 86px);
  line-height: 1;
  letter-spacing: .06em;
  text-indent: .06em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.contact-text { color: var(--text-muted); font-size: 17px; margin-bottom: 40px; }

.social-row { display: flex; justify-content: center; gap: 24px; margin-top: 56px; }
.social-icon {
  width: 56px; height: 56px;
  border-radius: 9999px;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  transition: border-color .3s ease, background .3s ease, color .3s ease;
}
.social-icon:hover { border-color: var(--accent); color: var(--accent-soft); background: rgba(10, 99, 255, .12); }
.social-icon .material-symbols-outlined { font-size: 28px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface-2); padding-block: 56px; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
}
.footer-brand { display: flex; flex-direction: column; gap: 10px; }
.footer-copy { font-size: 12px; letter-spacing: .06em; color: var(--text-muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 28px; }
.footer-links a {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text-muted);
  transition: color .3s ease;
}
.footer-links a:hover { color: var(--accent-soft); }

/* ---------- Hueco de foto pendiente ---------- */
/* Se muestra automáticamente cuando falta el archivo de imagen */
.photo-ph {
  width: 100%;
  aspect-ratio: 4 / 5;
  border: 1px dashed rgba(255, 255, 255, .25);
  border-radius: 6px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 12px, transparent 12px 24px),
    var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-align: center;
  padding: 24px;
}
.photo-ph .material-symbols-outlined { font-size: 36px; color: var(--accent-soft); }
.photo-ph small { font-weight: 400; letter-spacing: .04em; opacity: .7; }
.about-media .photo-ph { border-radius: 20px; }

/* ---------- Aparición al hacer scroll ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  /* Con menos ancho, 4 columnas dejarían las fotos en tiras: pasamos a 2 */
  .hero-collage { grid-template-columns: repeat(2, 1fr); }
  .hero-collage img:nth-child(n+3) { display: none; }

  .creds-grid { grid-template-columns: 1fr; gap: 48px; }
  .creds-brand { order: -1; }
  .creds-grid > .creds-list:last-child li { text-align: left; padding-left: 20px; padding-right: 0; border-left: 3px solid var(--accent); border-right: none; }
  .about-grid { grid-template-columns: 1fr; gap: 48px; }
  .about-media { order: -1; max-width: 480px; }

  /* Los casos pasan a una columna: primero los datos, luego las fotos.
     Hay que repetir el selector `:nth-child(even)` porque el de arriba tiene
     más especificidad y, si no, seguiría mandando también aquí. */
  .caso,
  .caso:nth-child(even) { grid-template-columns: 1fr; gap: 28px; }
  .caso .caso-vistas,
  .caso:nth-child(even) .caso-vistas { order: 2; }
  .caso .caso-datos,
  .caso:nth-child(even) .caso-datos { order: 1; }
  .casos-lista { gap: 64px; }

  .stripe-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 768px) {
  :root { --section-gap: 72px; --gutter: 20px; }

  /* Menú móvil */
  .nav { height: 66px; }
  .brand { font-size: 24px; gap: 10px; }
  .brand-logo { width: 38px; height: 38px; padding: 4px; border-radius: 8px; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed;
    inset: 66px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(14, 14, 14, .98);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    padding: 8px 20px 24px;
    transform: translateY(-130%);
    transition: transform .35s ease;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-link { padding: 15px 4px; border-bottom: 1px solid var(--line); }
  .nav-cta { margin: 18px 0 0; align-self: flex-start; }

  .hero { padding: 120px 0 72px; min-height: 92vh; }
  /* El par antes/después sigue lado a lado: es lo que hace la comparación */
  .caso-vista { gap: 6px; }
  .caso-nombre { margin-bottom: 14px; }
  .caso-tiempo { margin-top: 20px; }
  .caso-tiempo strong { font-size: 48px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-brand { align-items: center; }
  .footer-links { justify-content: center; }
  .ticker-track span { font-size: 18px; }
}

/* Solo en móvil de verdad se deja una única foto de portada: en tablet caben
   dos y así se ven a su tamaño real en vez de estiradas. Se elige la 3ª
   (portada-3.jpg) porque es la que mejor funciona recortada en vertical. */
@media (max-width: 600px) {
  .hero-collage { grid-template-columns: 1fr; }
  .hero-collage img { display: none; }
  .hero-collage img:nth-child(3) { display: block; }
}

@media (max-width: 480px) {
  .hero-title { letter-spacing: .1em; text-indent: .1em; }
}

/* Accesibilidad: respeta reduce-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
