/* ═══════════════════════════════════════════════
   CEPA — Mezcal de linaje
   Paleta: humo / hueso / oro mezcal / agave / cobre
   Zodiak (display) + Satoshi (body) + Fragment Mono
   ═══════════════════════════════════════════════ */

:root {
  --humo: #0c0b09;
  --humo-2: #14120e;
  --hueso: #efe7d6;
  --hueso-60: rgba(239, 231, 214, 0.6);
  --hueso-35: rgba(239, 231, 214, 0.35);
  --oro: #d19a3c;
  --agave: #8a9b74;
  --cobre: #b06a3b;
  --brasa: #ff7a2f;
  --pad: clamp(1.4rem, 5vw, 4.5rem);
  --display: 'Zodiak', Georgia, serif;
  --body: 'Satoshi', system-ui, sans-serif;
  --mono: 'Fragment Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  background: var(--humo);
  color: var(--hueso);
  font-family: var(--body);
  font-weight: 300;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
.mono {
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
em { font-style: italic; color: var(--oro); }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.06; }

/* grain */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none; z-index: 60; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); } 20% { transform: translate(-3%,2%); }
  40% { transform: translate(2%,-3%); } 60% { transform: translate(-2%,-2%); }
  80% { transform: translate(3%,3%); }
}

/* ═══════════ LOADER ═══════════ */
.loader {
  position: fixed; inset: 0; z-index: 100;
  /* No abrir en negro: el loader ya muestra el campo aéreo (atenuado para que
     el título siga legible); al desvanecerse revela el hero scrubbeado nítido. */
  background:
    linear-gradient(rgba(10,12,8,0.60), rgba(10,12,8,0.72)),
    url(../img/aereo-campos.webp) center / cover no-repeat,
    var(--humo);
  display: grid; place-content: center; gap: 1.1rem;
  text-align: center;
}
.loader-word {
  font-family: var(--display);
  font-size: clamp(3rem, 9vw, 5.5rem);
  letter-spacing: 0.34em; margin-right: -0.34em;
}
.loader-note { color: var(--hueso-35); }
.loader-bar {
  width: min(220px, 50vw); height: 1px; margin: 0 auto;
  background: rgba(239,231,214,0.14); overflow: hidden;
}
.loader-bar i {
  display: block; height: 100%; width: 0%;
  background: var(--oro); transition: width 0.3s ease;
}

/* ═══════════ HEADER ═══════════ */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem var(--pad);
  transition: background 0.5s ease, backdrop-filter 0.5s ease;
}
.site-header.is-scrolled {
  background: rgba(12, 11, 9, 0.72);
  backdrop-filter: blur(10px);
}
.wordmark {
  font-family: var(--display);
  font-size: 1.15rem; letter-spacing: 0.34em; margin-right: -0.34em;
  color: var(--hueso); text-decoration: none;
}
.header-nav { display: flex; gap: 1.8rem; }
.header-nav a {
  color: var(--hueso-60); text-decoration: none;
  font-size: 0.78rem; letter-spacing: 0.06em;
  transition: color 0.3s ease;
}
.header-nav a:hover { color: var(--oro); }
.header-note { color: var(--oro); min-width: 9ch; text-align: right; }

/* etiqueta de calor que sigue al cursor */
.heat-tag {
  position: fixed; z-index: 55; top: 0; left: 0;
  color: var(--brasa);
  padding: 0.3rem 0.55rem;
  background: rgba(12,11,9,0.7);
  border: 1px solid rgba(255,122,47,0.35);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -160%);
  transition: opacity 0.25s ease;
}
.heat-tag.is-on { opacity: 1; }

/* ═══════════ GENÉRICOS DE CAPÍTULO ═══════════ */
.pin {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
}
.scrub-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.pin-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(12,11,9,0.55) 0%, transparent 26%, transparent 62%, rgba(12,11,9,0.72) 100%);
}
/* cortina de disolvencia entre capítulos: cada pin entra y sale
   fundiendo a humo, en vez de cortar en seco */
.cortina {
  position: absolute; inset: 0; z-index: 8;
  background: var(--humo);
  opacity: 0; pointer-events: none;
}
.pin-shade--suave {
  background: linear-gradient(180deg, rgba(12,11,9,0.35) 0%, transparent 30%, transparent 70%, rgba(12,11,9,0.55) 100%);
}

/* ═══════════ CAP 1 — DESCENSO ═══════════ */
.descenso { height: 560vh; position: relative; }
.desc-hero {
  position: absolute; left: var(--pad); bottom: 16vh; z-index: 3;
  width: min(760px, 86vw);
}
.eyebrow { color: var(--oro); display: block; margin-bottom: 1.1rem; }
.hero-title { font-size: clamp(2.6rem, 7vw, 5.6rem); }
.hero-sub {
  margin-top: 1.3rem; max-width: 34rem;
  color: var(--hueso-60); line-height: 1.7;
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
}
.desc-stop {
  position: absolute; left: var(--pad); bottom: 18vh; z-index: 3;
  width: min(560px, 82vw);
  opacity: 0; transform: translateY(24px);
  pointer-events: none;
}
.desc-stop h2 { font-size: clamp(1.9rem, 4.6vw, 3.4rem); margin: 0.8rem 0; }
.desc-stop p { color: var(--hueso-60); line-height: 1.7; max-width: 30rem; }
.stop-kicker { color: var(--oro); }
.desc-foot {
  position: absolute; left: var(--pad); right: var(--pad); bottom: 1.4rem; z-index: 3;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--hueso-35);
}
.scroll-tick {
  width: 1px; height: 34px; margin: 0 1rem;
  background: linear-gradient(180deg, var(--oro), transparent);
  animation: tick 1.8s ease-in-out infinite;
}
@keyframes tick { 0%,100% { transform: scaleY(0.4); opacity: 0.4; } 50% { transform: scaleY(1); opacity: 1; } }

/* ═══════════ CAP 2 — HORNO (uncover) ═══════════ */
.horno { position: relative; padding: 14vh 0; background: var(--humo-2); }
.horno-stage {
  position: relative; height: 92vh; min-height: 560px;
  margin: 0 var(--pad);
  border-radius: 6px; overflow: hidden;
  cursor: none;
}
.horno-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.horno-img--horneada {
  /* máscara radial que sigue al cursor — la pinta main.js */
  -webkit-mask-image: radial-gradient(circle var(--hr, 0px) at var(--hx, 50%) var(--hy, 50%), #000 0, #000 72%, transparent 100%);
  mask-image: radial-gradient(circle var(--hr, 0px) at var(--hx, 50%) var(--hy, 50%), #000 0, #000 72%, transparent 100%);
}
.horno-copy {
  position: absolute; left: clamp(1.2rem, 4vw, 3rem); bottom: clamp(1.2rem, 4vw, 3rem);
  width: min(480px, 78vw); z-index: 3; pointer-events: none;
}
.horno-copy .mono { color: var(--brasa); }
.horno-copy h2 { font-size: clamp(2rem, 4.8vw, 3.4rem); margin: 0.7rem 0; }
.horno-copy p { color: var(--hueso-60); line-height: 1.7; }
.horno-hint {
  position: absolute; top: 1.4rem; right: 1.6rem; z-index: 3;
  color: var(--hueso-35); pointer-events: none;
  transition: opacity 0.5s ease;
}
.horno-hint.is-off { opacity: 0; }

/* ═══════════ CAP 3 — PORTÓN ═══════════ */
.portal { height: 480vh; position: relative; background: var(--humo); }
.portal-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transform-origin: 50% 54%;
}
.portal-canvas { opacity: 0; }
.portal-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 130% 110% at 50% 50%, transparent 55%, rgba(12,11,9,0.55) 100%);
}
.portal-copy {
  position: absolute; left: var(--pad); bottom: 16vh; z-index: 3;
  width: min(640px, 84vw);
  opacity: 0; transform: translateY(24px);
  pointer-events: none;
}
.portal-copy .mono { color: var(--oro); }
.portal-copy h2 { font-size: clamp(2rem, 5.2vw, 3.8rem); margin: 0.8rem 0; }
.portal-copy p { color: var(--hueso-60); line-height: 1.7; }

/* ═══════════ CAP 4 — LOS OFICIOS (travelling horizontal) ═══════════ */
.proceso { height: 460vh; position: relative; background: var(--humo); }
.oficio-track {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 300vw;
  display: flex;
  will-change: transform;
}
.oficio { position: relative; width: 100vw; height: 100%; overflow: hidden; }
.oficio > img {
  position: absolute; inset: -4% -8%;
  width: 116%; height: 108%;
  object-fit: cover;
  will-change: transform;
}
.oficio-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(12,11,9,0.4) 0%, transparent 30%, transparent 55%, rgba(12,11,9,0.78) 100%);
}
.oficio-num {
  position: absolute; right: clamp(1rem, 5vw, 5rem); top: 8vh;
  font-family: var(--display);
  font-size: clamp(6rem, 17vw, 15rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(209, 154, 60, 0.4);
}
.oficio-copy {
  position: absolute; left: var(--pad); bottom: 12vh;
  width: min(560px, 84vw);
}
.oficio-copy .mono { color: var(--oro); }
.oficio-copy h3 { font-size: clamp(2rem, 4.8vw, 3.4rem); margin: 0.8rem 0; }
.oficio-copy p { color: var(--hueso-60); line-height: 1.7; max-width: 30rem; }
.oficio-foot {
  position: absolute; left: var(--pad); right: var(--pad); bottom: 1.6rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.2rem;
  color: var(--hueso-35); z-index: 3;
}
.oficio-bar {
  flex: 1; max-width: 300px; height: 1px;
  background: rgba(239,231,214,0.15);
  overflow: hidden;
}
.oficio-bar i {
  display: block; height: 100%; width: 100%;
  background: var(--oro);
  transform: translateX(-100%);
}

/* ═══════════ CAP 5 — ALAMBIQUE ═══════════ */
.alambique { height: 420vh; position: relative; background: var(--humo); }
.alam-copy {
  position: absolute; left: var(--pad); top: 16vh; z-index: 3;
  width: min(520px, 80vw);
}
.alam-copy .mono { color: var(--cobre); }
.alam-copy h2 { font-size: clamp(2rem, 4.8vw, 3.6rem); margin: 0.8rem 0; }
.alam-copy p { color: var(--hueso-60); line-height: 1.7; }
.alam-labels { position: absolute; right: var(--pad); top: 30vh; z-index: 3; display: grid; gap: 2.2rem; text-align: right; }
.alam-label { color: var(--hueso-35); opacity: 0; transform: translateX(16px); transition: opacity 0.5s ease, transform 0.5s ease, color 0.5s ease; }
.alam-label.is-on { opacity: 1; transform: translateX(0); color: var(--oro); }
.alam-progress {
  position: absolute; left: var(--pad); bottom: 1.6rem; z-index: 3;
  color: var(--hueso-35);
}

/* ═══════════ CAP 6 — LINAJE (hélice) ═══════════ */
.linaje { height: 520vh; position: relative; background: #0a0c08; }
.helix-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.linaje-intro {
  position: absolute; left: var(--pad); top: 14vh; z-index: 3;
  width: min(560px, 82vw);
}
.linaje-intro .mono { color: var(--agave); }
.linaje-intro h2 { font-size: clamp(2rem, 4.8vw, 3.6rem); margin: 0.8rem 0; }
.linaje-intro p { color: var(--hueso-60); line-height: 1.7; }
.gen-card {
  position: absolute; z-index: 4;
  right: clamp(1.4rem, 7vw, 7rem); top: 50%;
  width: min(360px, 84vw);
  background: rgba(10, 12, 8, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(138, 155, 116, 0.25);
  border-radius: 6px; overflow: hidden;
  opacity: 0; transform: translateY(40px) scale(0.94);
  pointer-events: none;
}
.gen-card figure { aspect-ratio: 16 / 10; overflow: hidden; }
.gen-card figure img { width: 100%; height: 100%; object-fit: cover; }
.gen-body { padding: 1.3rem 1.5rem 1.6rem; }
.gen-code { color: var(--agave); display: block; margin-bottom: 0.5rem; }
.gen-body h3 { font-size: 1.7rem; margin-bottom: 0.5rem; }
.gen-body p { color: var(--hueso-60); line-height: 1.65; font-size: 0.92rem; }
.linaje-foot {
  position: absolute; left: var(--pad); bottom: 1.6rem; z-index: 3;
  color: var(--hueso-35);
}

/* ═══════════ CAP 7 — BOTELLA (morph) ═══════════ */
.botella { height: 380vh; position: relative; background: var(--humo); }
.morph-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.botella-img {
  position: absolute; left: 50%; top: 50%;
  height: 78vh; width: auto;
  transform: translate(-50%, -50%);
  opacity: 0;
  mix-blend-mode: screen; /* el negro de la foto se funde con el fondo */
}
.botella-copy {
  position: absolute; left: var(--pad); bottom: 14vh; z-index: 3;
  width: min(520px, 80vw);
}
.botella-copy .mono { color: var(--oro); }
.botella-copy h2 { font-size: clamp(2rem, 4.8vw, 3.6rem); margin: 0.8rem 0; }
.botella-copy p { color: var(--hueso-60); line-height: 1.7; }

/* ═══════════ CAP 8 — COLECCIÓN (carrusel posicional) ═══════════ */
.coleccion { padding: 16vh 0 14vh; background: var(--humo-2); overflow: hidden; }
.col-head { text-align: center; padding: 0 var(--pad) 7vh; }
.col-head .mono { color: var(--oro); }
.col-head h2 { font-size: clamp(2.2rem, 5.4vw, 4rem); margin-top: 0.9rem; }
.carrusel {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(0.6rem, 2vw, 1.6rem);
  padding: 0 var(--pad);
}
.car-stage {
  position: relative;
  width: min(920px, 86vw); height: clamp(420px, 58vh, 540px);
}
.car-card {
  position: absolute; left: 50%; top: 50%;
  width: min(340px, 74vw);
  background: var(--humo);
  border: 1px solid rgba(209, 154, 60, 0.22);
  border-radius: 6px; overflow: hidden;
  transform: translate(-50%, -50%);
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.7s ease, filter 0.7s ease;
  will-change: transform;
}
.car-card .car-media { aspect-ratio: 1 / 1; overflow: hidden; }
.car-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.car-card:hover img { transform: scale(1.06); }
.car-card h3 { font-size: 1.5rem; padding: 1.1rem 1.3rem 0.4rem; }
.car-card p { padding: 0 1.3rem 1.3rem; color: var(--hueso-60); }
.car-card.pos-center { transform: translate(-50%, -50%) scale(1); z-index: 3; opacity: 1; filter: none; }
.car-card.pos-left { transform: translate(-128%, -50%) scale(0.78); z-index: 2; opacity: 0.55; filter: saturate(0.4) brightness(0.7); }
.car-card.pos-right { transform: translate(28%, -50%) scale(0.78); z-index: 2; opacity: 0.55; filter: saturate(0.4) brightness(0.7); }
.car-nav {
  background: none; border: 1px solid rgba(239,231,214,0.25);
  color: var(--hueso); width: 46px; height: 46px; border-radius: 50%;
  font-size: 1rem; cursor: pointer; z-index: 4;
  transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}
.car-nav:hover { border-color: var(--oro); color: var(--oro); background: rgba(209,154,60,0.08); }

/* ═══════════ CAP 9 — VISITA ═══════════ */
.visita {
  min-height: 88vh;
  display: grid; place-content: center; text-align: center;
  gap: 1.4rem; padding: 14vh var(--pad);
}
.visita-title { font-size: clamp(2.4rem, 6.4vw, 5rem); }
.visita-sub { max-width: 34rem; margin: 0 auto; color: var(--hueso-60); line-height: 1.75; }
.btn {
  position: relative; margin: 0.6rem auto 0;
  background: var(--oro); color: var(--humo);
  border: 0; border-radius: 2px;
  padding: 1.1rem 2.6rem;
  font-family: var(--mono); font-size: 0.74rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  cursor: pointer; overflow: hidden;
  transition: background 0.3s ease;
}
.btn:hover { background: var(--brasa); }
.visita-note { color: var(--hueso-35); }

/* ═══════════ FOOTER ═══════════ */
.site-footer { border-top: 1px solid rgba(239,231,214,0.1); padding: 5rem var(--pad) 2rem; }
.footer-grid {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: clamp(2rem, 6vw, 6rem); align-items: start;
  padding-bottom: 4rem;
}
.wordmark--big { font-size: clamp(2rem, 5vw, 3.4rem); }
.footer-note { max-width: 44rem; color: var(--hueso-60); line-height: 1.8; font-size: 0.9rem; }
.footer-note strong { color: var(--hueso); font-weight: 500; }
.guide-link { text-decoration: none; text-align: right; display: grid; gap: 0.4rem; }
.guide-eyebrow { color: var(--hueso-35); }
.guide-big {
  font-family: var(--display); font-size: 1.6rem; color: var(--oro);
  border-bottom: 1px solid rgba(209,154,60,0.4);
  transition: border-color 0.3s ease;
}
.guide-link:hover .guide-big { border-color: var(--oro); }
.footer-bottom {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-top: 1.6rem; border-top: 1px solid rgba(239,231,214,0.08);
  color: var(--hueso-35);
}

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 900px) {
  .header-nav { display: none; }
  .alam-labels { display: none; }
  .panel, .panel--rev { grid-template-columns: 1fr; gap: 1.6rem; min-height: auto; padding: 10vh var(--pad); }
  .panel--rev .panel-media { order: 0; }
  .gen-card {
    /* GSAP pisa transform: centrar con margen, no con translate */
    right: 50%; width: min(340px, 88vw);
    margin-right: calc(min(340px, 88vw) / -2);
    top: 44%;
  }
  .car-card.pos-left { transform: translate(-138%, -50%) scale(0.7); }
  .car-card.pos-right { transform: translate(38%, -50%) scale(0.7); }
  .footer-grid { grid-template-columns: 1fr; }
  .guide-link { text-align: left; }
  .desc-foot span:last-child { display: none; }
}

/* ═══════════ REDUCED MOTION ═══════════ */
@media (prefers-reduced-motion: reduce) {
  .grain, .scroll-tick { animation: none; }
  .descenso, .portal, .alambique, .linaje, .botella, .proceso { height: auto; }
  .oficio-track { position: relative; flex-direction: column; width: 100%; }
  .oficio { width: 100%; height: 72vh; }
  .oficio-foot { display: none; }
  .cortina { display: none; }
  .pin { position: relative; height: auto; min-height: 70vh; }
  .scrub-canvas, .helix-canvas, .morph-canvas, .portal-canvas { display: none; }
  .desc-hero, .desc-stop, .portal-copy, .gen-card, .alam-label { position: relative; opacity: 1; transform: none; left: auto; right: auto; top: auto; bottom: auto; margin: 3rem var(--pad); pointer-events: auto; }
  .botella-img { position: relative; opacity: 1; transform: none; left: auto; top: auto; margin: 3rem auto; height: auto; max-height: 70vh; }
  .horno-img--horneada { -webkit-mask-image: none; mask-image: none; opacity: 0.5; }
  .portal-img { position: relative; }
}
