/* ==========================================================================
   El Presagio — Estilos base compartidos por todas las páginas
   Extraídos verbatim del bloque <style> del diseño original (helmet).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tipografías self-hosted (variables, subset latin).
   Sin peticiones a Google: más rápido, RGPD limpio y CSP sin terceros.
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Bodoni Moda';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/bodoni-moda-var.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Bodoni Moda';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/bodoni-moda-italic-var.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-var.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Easing de la casa: expo-out largo. La coherencia del easing es la firma. */
  --ease-presagio: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
}

/* --------------------------------------------------------------------------
   Transición entre páginas (View Transitions API).
   Cross-fade sereno al navegar entre index/nosotros/agendar.
   Enhancement progresivo: donde no hay soporte, navegación normal.
   -------------------------------------------------------------------------- */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
  animation-timing-function: ease;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

body {
  margin: 0;
  background-color: #FBFAF5;
  background-image: var(--ep-travertine);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: #1F1A14;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: #1F1A14;
}

a:hover {
  color: #D8541F;
}

img {
  max-width: 100%;
}

::selection {
  background: #F4ECCE;
}

/* ==========================================================================
   Grano de papel / arena — textura cálida y sutil sobre todo el sitio.
   SVG procedural (feTurbulence) incrustado como data-URI: cero peticiones
   extra, nítido en pantallas retina. Se aplica con "multiply" a muy baja
   opacidad, así solo oscurece levísimamente la crema —como el grano de un
   papel de alta gramaje— sin ensuciar las fotos. Inspiración: casas de lujo.
   ========================================================================== */
:root {
  --ep-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='ep-grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23ep-grain)'/%3E%3C/svg%3E");
  /* Travertino cálido y sutil para las zonas claras (solo las vetas, sin base:
     el color crema del body se ve por detrás). Warm stone whisper. */
  --ep-travertine: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='600'%3E%3Cfilter id='ept'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.018 0.026' numOctaves='5' seed='4' result='t'/%3E%3CfeColorMatrix in='t' type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.6 0' result='a'/%3E%3CfeComponentTransfer in='a' result='v'%3E%3CfeFuncA type='table' tableValues='0 0 0.12 0.3 0.1 0'/%3E%3C/feComponentTransfer%3E%3CfeFlood flood-color='%23bda98a' result='c'/%3E%3CfeComposite in='c' in2='v' operator='in'/%3E%3C/filter%3E%3Crect width='800' height='600' filter='url(%23ept)'/%3E%3C/svg%3E");
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background-image: var(--ep-grain);
  background-size: 150px 150px;
}

/* Capa 1 · el grano que "revienta" sobre lo oscuro (secciones negras, footer,
   sección firma) — como las zonas oscuras de Alakrana. soft-light conserva el
   color de marca y solo añade textura de lija fina. */
body::before {
  mix-blend-mode: soft-light;
  opacity: 0.82;
}

/* Capa 2 · tacto sutil de papel sobre la crema y las fotos. multiply apenas
   toca lo oscuro, así que no ensucia; solo da grano en las zonas claras. */
body::after {
  mix-blend-mode: multiply;
  opacity: 0.10;
}

@media print {
  body::before,
  body::after { display: none; }
}

/* ==========================================================================
   Marquee continuo — banda en movimiento perpetuo (estilo Orbea / Enea).
   El track lleva la secuencia DUPLICADA; con translateX(-50%) el bucle es
   perfecto. Se pausa al pasar el ratón y se detiene con reduce-motion.
   ========================================================================== */
.ep-marquee {
  overflow: hidden;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}
.ep-marquee__track {
  display: inline-flex;
  align-items: center;
  will-change: transform;
  animation: ep-marquee-scroll 44s linear infinite;
}
.ep-marquee__track > * { flex: none; }
.ep-marquee:hover .ep-marquee__track { animation-play-state: paused; }

@keyframes ep-marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ep-marquee__track { animation: none; transform: none; }
}

/* ==========================================================================
   CTA fijo en móvil — barra inferior siempre accesible (thumb zone). Es la
   táctica de conversión con más impacto en scroll largo en pantallas táctiles.
   Solo aparece en móvil; en escritorio la nav fija ya lleva el CTA visible.
   ========================================================================== */
.ep-sticky-cta { display: none; }

@media (max-width: 700px) {
  .ep-sticky-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 95;
    height: 54px;
    border-radius: 3px;
    font-family: Inter, sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .01em;
    color: #1F1A14;
    text-decoration: none;
    background: #E8B939;
    box-shadow: 0 12px 30px -8px rgba(31, 26, 20, .55);
  }
  body { padding-bottom: 82px; }
}

/* Animaciones de entrada / decorativas */
@keyframes presagio-fade {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

@keyframes presagio-sweep {
  from { clip-path: inset(-5% 0 100% 0); transform: translateY(12px); }
  to   { clip-path: inset(-5% 0 -12% 0); transform: none; }
}

@keyframes presagio-spin {
  to { transform: rotate(360deg); }
}

/* Cursor personalizado: ocultamos el cursor nativo solo en punteros finos
   y cuando el script ha activado data-cursor-on en el body. */
@media (pointer: fine) {
  body[data-cursor-on],
  body[data-cursor-on] a,
  body[data-cursor-on] button {
    cursor: none;
  }
}

/* ==========================================================================
   Panel editorial — imagen + tarjeta flotante alternada (inspiración Alakrana)
   Componente con clases propias para un responsive limpio (los estilos inline
   del resto del sitio mandan por especificidad; aquí controlamos el layout).
   ========================================================================== */
.ep-panel {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 64px);
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(22px, 4vw, 48px);
  align-items: center;
}

.ep-panel__media {
  overflow: hidden;
  border-radius: 2px;
  aspect-ratio: 4 / 5;
  background: #1F1A14;
}

.ep-panel__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 1.2s cubic-bezier(.25, .1, .25, 1);
}

.ep-panel__media:hover img {
  transform: scale(1.045);
}

.ep-panel__card {
  background: #FBFAF5;
  border: 1px solid rgba(31, 26, 20, .12);
  box-shadow: 0 40px 80px -46px rgba(31, 26, 20, .40);
  border-radius: 2px;
  padding: clamp(28px, 4vw, 52px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Variante para secciones de fondo oscuro (#1F1A14) */
.ep-panel__card--dark {
  background: #211C16;
  border-color: rgba(251, 250, 245, .14);
  box-shadow: 0 40px 90px -46px rgba(0, 0, 0, .6);
}

@media (min-width: 861px) {
  .ep-panel { grid-template-columns: 1.2fr 1fr; }
  .ep-panel__card {
    position: relative;
    z-index: 2;
    margin-left: clamp(-84px, -5vw, -40px);
  }
  /* Alterna el lado: foto a la derecha, tarjeta a la izquierda */
  .ep-panel--reverse { grid-template-columns: 1fr 1.2fr; }
  .ep-panel--reverse .ep-panel__media { order: 2; }
  .ep-panel--reverse .ep-panel__card {
    order: 1;
    margin-left: 0;
    margin-right: clamp(-84px, -5vw, -40px);
  }
}

/* ==========================================================================
   Pulido móvil
   ========================================================================== */
@media (max-width: 560px) {
  /* Zonas de toque cómodas en la navegación y el pie */
  nav[data-nav] a { padding-top: 6px; padding-bottom: 6px; }
}

/* Enlace "saltar al contenido" — invisible salvo al recibir foco de teclado */
.ep-skip {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 200;
  padding: 10px 18px;
  background: #1F1A14;
  color: #FBFAF5;
  font-family: Inter, sans-serif;
  font-size: 14px;
  text-decoration: none;
  border-radius: 2px;
}

.ep-skip:focus {
  left: 12px;
}

/* Foco visible elegante (accesibilidad + detalle) */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #C66B2D;
  outline-offset: 3px;
  border-radius: 2px;
}

/* ==========================================================================
   Telón de entrada — apertura cinematográfica (solo primera visita de la
   sesión; lo controla main.js con sessionStorage). Color tinta con la ✦
   respirando en el centro; sube como un telón y descubre el héroe.
   ========================================================================== */
.ep-veil {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: #1F1A14;
  will-change: transform;
  transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
}

.ep-veil__star {
  font-size: 34px;
  color: #E8B939;
  animation: ep-veil-breathe 1.4s ease-in-out infinite;
}

.ep-veil.is-lifting {
  transform: translateY(-101%);
}

@keyframes ep-veil-breathe {
  0%, 100% { opacity: 0.55; transform: scale(0.92) rotate(0deg); }
  50%      { opacity: 1;    transform: scale(1.06) rotate(12deg); }
}

/* ==========================================================================
   Reveal de titulares por líneas — el gesto firma del lujo editorial.
   main.js parte el titular en líneas; cada línea vive tras una ventana
   con overflow oculto y sube con retardo escalonado (90 ms por línea).
   ========================================================================== */
.ep-line {
  display: block;
  overflow: hidden;
  padding-block: 0.06em; /* aire para ascendentes/descendentes de Bodoni */
  margin-block: -0.06em;
}

.ep-line__inner {
  display: block;
  transform: translateY(112%);
  transition: transform 0.95s var(--ease-presagio);
  transition-delay: calc(var(--ep-i, 0) * 90ms);
  will-change: transform;
}

.is-lines-in .ep-line__inner {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .ep-line__inner { transform: none; transition: none; }
}

/* ==========================================================================
   CTA magnético — atracción física sutil (máx. ~6 px, lerp en main.js).
   El imán vive en un WRAPPER [data-magnetic] para no chocar con el efecto
   style-hover del propio botón. Solo punteros finos con hover real.
   ========================================================================== */
[data-magnetic] {
  display: inline-block;
  will-change: transform;
}

/* Cifras que cuentan (+70M): dígitos tabulares para que no baile el ancho */
[data-count] {
  font-variant-numeric: tabular-nums;
}

/* Respetar la preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Nav en móvil: el botón de agendar se oculta (lo cubre la barra fija
   inferior .ep-sticky-cta) para que la marca y los enlaces respiren. */
@media (max-width: 560px) {
  nav[data-nav] a[href="/agendar"] {
    display: none;
  }
}
