/* =========================================================
   Hamo Drivers — capa de animación y mapa de rutas
   Se carga después de styles.css. Si algo falla, la web sigue
   funcionando igual: todo lo que se oculta antes de animarse
   solo se oculta cuando motion.js ya está en marcha.
   Para quitar las animaciones, borra el <link> a este archivo
   y el <script> de motion.js en index.html.
   ========================================================= */

:root { --ease-out: cubic-bezier(.16, .84, .24, 1); --glow: #c8ac7b; }

/* ---------- Entrada de la portada (solo CSS, una secuencia) ---------- */
@keyframes heroZoom { from { transform: scale(1.14); } to { transform: scale(1); } }
@keyframes heroRise {
  from { opacity: 0; transform: translateY(28px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes heroBar {
  from { opacity: 0; transform: translateY(44px); }
  to   { opacity: 1; transform: none; }
}
@keyframes heroShade { from { opacity: 0; } to { opacity: 1; } }

.js-motion .hero-media img { animation: heroZoom 9s var(--ease-out) both; transform-origin: 70% 40%; }
.js-motion .hero::after { animation: heroShade 1.4s ease-out both; }
.js-motion .hero-title { animation: heroRise 1s var(--ease-out) .15s both; }
.js-motion .hero-lead { animation: heroRise 1s var(--ease-out) .38s both; }
.js-motion .booking { animation: heroBar 1s var(--ease-out) .6s both; }

/* ---------- Barra de progreso de lectura ---------- */
.scroll-progress {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--ink);
  transform: scaleX(0); transform-origin: 0 50%; pointer-events: none;
}

/* ---------- Imágenes: se destapan y se mueven un poco al hacer scroll ---------- */
.motion-ready .wipe { clip-path: inset(0 0 100% 0); transition: clip-path 1.1s var(--ease-out); }
.motion-ready .wipe.is-in { clip-path: inset(0 0 0 0); }
.motion-ready .wipe > img, .motion-ready .wipe img.wipe-img { scale: 1.18; transition: scale 1.6s var(--ease-out); }
.motion-ready .wipe.is-in > img, .motion-ready .wipe.is-in img.wipe-img { scale: 1; }

/* Paralaje: la imagen es algo más alta que su marco y se desplaza con el scroll */
[data-px] { translate: 0 var(--py, 0px); will-change: translate; }
.split-media img[data-px], .standard-media img[data-px], .biz-media img[data-px] { height: 116%; margin-top: -8%; }
.hero-media img[data-px] { inset: -8% 0 auto 0; height: 116%; }
.cta-band-media[data-px] { inset: -8% 0 auto 0; height: 116%; }

/* ---------- Iconos que se dibujan ---------- */
@keyframes draw { to { stroke-dashoffset: 0; } }
.motion-ready .usp svg * { stroke-dasharray: 1; stroke-dashoffset: 1; }
.motion-ready .usp.is-visible svg * { animation: draw 1.3s var(--ease-out) .25s forwards; }
.motion-ready .usp.is-visible:nth-child(2) svg * { animation-delay: .4s; }
.motion-ready .usp.is-visible:nth-child(3) svg * { animation-delay: .55s; }
.motion-ready .usp.is-visible:nth-child(4) svg * { animation-delay: .7s; }

/* ---------- Cómo funciona: la línea une los pasos ---------- */
.steps { position: relative; }
.step-num { position: relative; z-index: 1; transition: transform .5s var(--ease-out), background-color .3s; }
.motion-ready .steps .step-num { transform: scale(.4); opacity: 0; }
.motion-ready .steps.is-run .step-num { transform: none; opacity: 1; transition: transform .6s var(--ease-out), opacity .4s; }
.motion-ready .steps.is-run .step:nth-child(2) .step-num { transition-delay: .5s; }
.motion-ready .steps.is-run .step:nth-child(3) .step-num { transition-delay: 1s; }
.steps::before {
  content: ""; position: absolute; top: 20px; left: 20px; width: calc(66.666% + 26.67px); height: 1.5px;
  background: var(--ink); transform-origin: 0 50%;
}
.motion-ready .steps::before { transform: scaleX(0); }
.motion-ready .steps.is-run::before { transform: scaleX(1); transition: transform 1.2s var(--ease-out) .2s; }
@media (max-width: 720px) { .steps::before { display: none; } }

/* ---------- Respuestas a lo que hace el cliente ---------- */
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.quote-preview:not([hidden]) { animation: pop .45s var(--ease-out); }
.quote-preview strong { font-variant-numeric: tabular-nums; }

@keyframes panelIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes photoIn { from { scale: 1.08; opacity: .4; } to { scale: 1; opacity: 1; } }
.class-panel:not([hidden]) { animation: panelIn .6s var(--ease-out); }
.class-panel:not([hidden]) .class-photo { animation: photoIn 1s var(--ease-out); }

@keyframes faqIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.faq details[open] > p { animation: faqIn .4s var(--ease-out); }

.field input, .field select { transition: border-color .2s, box-shadow .25s var(--ease-out); }
.booking-submit, .cta-actions .btn { will-change: transform; transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .25s var(--ease-out); }
.btn:active { transform: scale(.97); }

.city-body { transition: transform .5s var(--ease-out); }
.city:hover .city-body, .city:focus-visible .city-body { transform: translateY(-6px); }
.city-name::after { content: " →"; display: inline-block; opacity: 0; transform: translateX(-8px); transition: opacity .3s, transform .4s var(--ease-out); }
.city:hover .city-name::after, .city:focus-visible .city-name::after { opacity: 1; transform: none; }
.route { transition: padding .35s var(--ease-out); }
.route:hover { padding-left: 10px; }

/* =========================================================
   Mapa de rutas
   ========================================================= */
.map { background: var(--ink); color: var(--paper); position: relative; overflow: hidden; }
.map .title { color: var(--paper); }
.map .section-lead { color: rgba(255, 255, 255, .7); }
.map-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 40px; align-items: stretch; }
.map-stage { position: relative; border: 1px solid var(--line-light); border-radius: var(--radius-lg); background: #0c0f12; overflow: hidden; }
#route-map { width: 100%; height: auto; display: block; touch-action: manipulation; }
.map-note { position: absolute; left: 16px; bottom: 12px; font-size: 12px; color: rgba(255, 255, 255, .45); }

#route-map .sea { fill: #0c0f12; }
#route-map .land { fill: #1b1a18; }
#route-map .coast { fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: 1.4; }
#route-map .grid line { stroke: rgba(255, 255, 255, .07); stroke-width: 1; }
#route-map .tick { fill: rgba(255, 255, 255, .4); font-size: 14px; font-variant-numeric: tabular-nums; }
#route-map .rt { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 1.2; stroke-dasharray: 3 6; transition: stroke .3s, opacity .3s; }
#route-map .rt-live { fill: none; stroke: var(--glow); stroke-width: 2.4; stroke-linecap: round; }
#route-map .node { cursor: pointer; outline: none; }
#route-map .node circle.dot { fill: #0b0b0b; stroke: rgba(255, 255, 255, .85); stroke-width: 1.6; transition: r .25s var(--ease-out), fill .25s, stroke .25s; }
#route-map .node text { fill: rgba(255, 255, 255, .7); font-size: 18px; font-weight: 500; paint-order: stroke; stroke: #1b1a18; stroke-width: 4px; stroke-linejoin: round; transition: fill .25s; }
#route-map .node:hover text, #route-map .node:focus-visible text, #route-map .node.is-on text { fill: #fff; }
#route-map .node:hover circle.dot { fill: var(--glow); }
#route-map .node:focus-visible circle.focus { opacity: 1; }
#route-map .node circle.focus { fill: none; stroke: var(--glow); stroke-width: 2; opacity: 0; }
#route-map .node.is-on circle.dot { fill: var(--glow); stroke: var(--glow); }
#route-map .agp rect { fill: #fff; }
#route-map .agp text { fill: #fff; font-weight: 700; font-size: 20px; paint-order: stroke; stroke: #1b1a18; stroke-width: 4px; }
#route-map .pulse { fill: none; stroke: #fff; stroke-width: 1.5; transform-box: fill-box; transform-origin: center; }
#route-map .car { fill: var(--glow); stroke: #0b0b0b; stroke-width: 2; }
#route-map .car-halo { fill: rgba(233, 163, 94, .28); }
@keyframes ping { from { transform: scale(.5); opacity: .9; } to { transform: scale(3.4); opacity: 0; } }
.motion-ready #route-map .pulse { animation: ping 2.6s ease-out infinite; }
.motion-ready #route-map .pulse + .pulse { animation-delay: 1.3s; }

.map-panel { display: flex; flex-direction: column; gap: 22px; padding: 28px; border: 1px solid var(--line-light); border-radius: var(--radius-lg); background: var(--ink-2); }
.map-from .coords { display: block; margin-top: 2px; }
.map-from { font-size: 13px; color: rgba(255, 255, 255, .55); font-variant-numeric: tabular-nums; }
.map-panel h3 { font-size: 34px; line-height: 1.1; letter-spacing: -.025em; margin-top: 6px; }
.telemetry { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--line-light); border-bottom: 1px solid var(--line-light); }
.telemetry > div { padding: 16px 0; }
.telemetry > div + div { padding-left: 20px; border-left: 1px solid var(--line-light); }
.telemetry dt { font-size: 13px; color: rgba(255, 255, 255, .55); }
.telemetry dd { margin: 4px 0 0; font-size: 30px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.telemetry dd small { font-size: 15px; font-weight: 500; margin-left: 4px; color: rgba(255, 255, 255, .6); }
.map-prices { display: grid; gap: 0; }
.map-prices li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-light); }
.map-prices .cls { font-weight: 600; }
.map-prices .mdl { display: block; font-size: 13px; font-weight: 400; color: rgba(255, 255, 255, .5); }
.map-prices .pr { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.map-panel .btn { margin-top: auto; }
.map-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.map-chip { background: none; border: 1px solid var(--line-light); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500; color: rgba(255, 255, 255, .75); cursor: pointer; transition: all .2s var(--ease); }
.map-chip:hover { border-color: #fff; color: #fff; }
.map-chip[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--ink); }
.map :focus-visible { outline-color: var(--glow); }

@media (max-width: 1080px) { .map-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .map-panel { padding: 20px; }
  .map-panel h3 { font-size: 28px; }
  #route-map .node text { font-size: 17px; }
  .map-note { position: static; padding: 0 16px 12px; }
}

/* Entrada del mapa */
.motion-ready #route-map:not(.is-in) .rt, .motion-ready #route-map:not(.is-in) .node, .motion-ready #route-map:not(.is-in) .agp { opacity: 0; }
.motion-ready #route-map .rt, .motion-ready #route-map .node, .motion-ready #route-map .agp { transition: opacity .8s ease; }
.motion-ready #route-map .node.is-on, .motion-ready #route-map .node { transition-property: opacity; }

@media (max-width: 720px) {
  #route-map .tick { display: none; }
  #route-map .node text { display: none; }
  #route-map .node.is-on text { display: block; font-size: 34px; stroke-width: 9px; }
  #route-map .node circle.dot { r: 12px; }
  #route-map .agp text { font-size: 32px; stroke-width: 9px; }
  #route-map .agp rect { transform: scale(1.8); }
  #route-map .rt-live { stroke-width: 5px; }
  #route-map .rt { stroke-width: 2.4px; }
  #route-map .coast { stroke-width: 2.6px; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  .js-motion .hero-media img, .js-motion .hero::after, .js-motion .hero-title, .js-motion .hero-lead, .js-motion .booking { animation: none !important; }
  .motion-ready .wipe { clip-path: none; }
  .motion-ready .wipe > img { scale: 1; }
  .motion-ready .usp svg * { stroke-dasharray: none; stroke-dashoffset: 0; }
  .motion-ready .steps::before { transform: none; }
  .motion-ready .steps .step-num { transform: none; opacity: 1; }
  .scroll-progress { display: none; }
}

html { overflow-x: clip; }
