/* Index Casanova: el frente del ómnibus es el menú.
   Paleta, tipografías y recursos tomados del demo de flota:
   azul marino de marca, rojo Casanova, Bebas Neue + Poppins, mascaras con fade y mezcla "lighten". */

@property --x { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

:root {
  --bg: #070a14;
  --card: #0d142a;
  --fg: #f0f4ff;
  --fg-2: #a8b8d8;
  --line: rgba(255,255,255,.12);
  --accent: #e0001b;
  --accent-hi: #ff3347;
  --bus: #2a9df4;
  --font-title: 'Bebas Neue', Impact, 'Arial Narrow', sans-serif;
  --font-body: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Ancho del ómnibus: crece con la altura. Bajo 800px de alto suma un extra, porque el resto de la página se compacta */
  --bw: min(94vw, max(320px, min(760px, calc((100vh - 385px) * 1.25 + max(0px, 800px - 100vh) * .8))));
  color-scheme: dark;
}
@supports (height: 100svh) {
  :root { --bw: min(94vw, max(320px, min(760px, calc((100svh - 385px) * 1.25 + max(0px, 800px - 100svh) * .8)))); }
}

* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  background: radial-gradient(120% 70% at 50% 0%, #0c1226 0, var(--bg) 62%);
  color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.6;
}
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.page { min-height: 100vh; display: flex; flex-direction: column; }
@supports (height: 100svh) { body, .page { min-height: 100svh; } }

/* ---------- Encabezado ---------- */
.top { display: flex; justify-content: center; padding: 14px max(16px, env(safe-area-inset-left, 0px)) 0; }
.logo {
  height: 56px; width: auto; max-width: 70vw; padding: 6px 16px; object-fit: contain;
  background: rgba(255,255,255,.96); border-radius: 12px; box-shadow: 0 6px 24px -8px rgba(0,0,0,.7);
}

/* ---------- Titulo ---------- */
.menu-section { display: flex; flex-direction: column; align-items: center; padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
.hero { text-align: center; padding-top: 10px; animation: rise .9s .15s cubic-bezier(.2,.7,.2,1) backwards; }
.heading {
  font-family: var(--font-title); font-weight: 400; font-size: clamp(48px, min(9vw, 14vh), 112px);
  line-height: .92; letter-spacing: .02em; margin: 0; text-wrap: balance;
}
.heading span { color: var(--fg); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .heading span {
    background: linear-gradient(100deg, #fff 0 38%, #8fd0ff 50%, #fff 62% 100%) 100% 0 / 250% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: shine 6s ease-in-out 2.4s infinite;
  }
}
.subheading-italic {
  font-family: var(--font-title); font-style: italic; font-weight: 400;
  font-size: clamp(22px, min(3.4vw, 5vh), 40px); letter-spacing: .14em; line-height: 1.1;
  color: var(--accent-hi); margin: 8px 0 0;
}

/* ---------- Escenario: el ómnibus ---------- */
.stage { position: relative; width: var(--bw); margin: 4px auto 0; perspective: 1100px; }
.bus {
  position: relative; width: 100%; aspect-ratio: 1402 / 1122; container-type: inline-size; isolation: isolate;
  background: var(--bg);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .3s ease-out;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent), linear-gradient(180deg, transparent, #000 5%, #000 100%);
  -webkit-mask-composite: source-in; -webkit-mask-repeat: no-repeat; -webkit-mask-size: 100% 100%;
          mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent), linear-gradient(180deg, transparent, #000 5%, #000 100%);
          mask-composite: intersect; mask-repeat: no-repeat; mask-size: 100% 100%;
}
.bus__img {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover;
  mix-blend-mode: lighten; filter: brightness(.92); animation: wake 1.8s ease-out .1s backwards;
}
/* Degradado inferior: funde el piso con el fondo y da lectura al saludo */
.bus::after {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(180deg, transparent 72%, rgba(7,10,20,.78) 88%, var(--bg) 100%);
}

/* Cartel de destino: matriz de puntos dibujada en canvas sobre el cartel apagado de la foto */
.sign {
  position: absolute; left: 32.5%; top: 15.2%; width: 34.7%; height: 6.6%; z-index: 2;
  background: #050507; border-radius: .5cqw;
  box-shadow: 0 0 0 .25cqw #0a0a0d; transition: box-shadow .8s;
}
.sign canvas { display: block; width: 100%; height: 100%; filter: drop-shadow(0 0 .5cqw rgba(255,45,45,.9)); }
.is-lit .sign { box-shadow: 0 0 0 .25cqw #0a0a0d, 0 0 4cqw .6cqw rgba(255,30,30,.28); }

/* Faros y haces de luz: se encienden segun el botón señalado */
.lamp {
  position: absolute; top: 64.7%; width: 12%; height: 9%; z-index: 1; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(ellipse at 50% 50%, rgba(255,255,255,.95) 0, rgba(170,215,255,.7) 28%, rgba(60,150,255,.25) 55%, transparent 72%);
  filter: blur(.4cqw); opacity: var(--lamp, .3); transition: opacity .35s;
  animation: ignite 1.6s .4s backwards;
}
.lamp::before {
  content: ""; position: absolute; inset: -70% -45%;
  background: radial-gradient(circle, rgba(120,190,255,.32), transparent 66%);
}
.lamp--l { left: 25.9%; }
.lamp--r { left: 62.1%; }
.beam {
  position: absolute; top: 69.2%; width: 60%; height: 31%; z-index: 1; pointer-events: none; mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 100%); mask-image: linear-gradient(180deg, #000, transparent 100%);
  filter: blur(.5cqw); opacity: 0; transition: opacity .35s;
  animation: ignite-beam 1.6s .4s backwards;
}
.beam--l { left: 1.9%; background: conic-gradient(from 168deg at 50% 0, transparent 0deg, rgba(205,232,255,.55) 10deg, rgba(205,232,255,.55) 34deg, transparent 44deg, transparent 360deg); }
.beam--r { left: 38.1%; background: conic-gradient(from 148deg at 50% 0, transparent 0deg, rgba(205,232,255,.55) 10deg, rgba(205,232,255,.55) 34deg, transparent 44deg, transparent 360deg); }
#escena[data-aim="web"] .lamp--l, #escena[data-aim="wa"] .lamp--r { --lamp: 1; }
#escena[data-aim="web"] .beam--l, #escena[data-aim="wa"] .beam--r { opacity: 1; }
#escena[data-aim="web"] .lamp--r, #escena[data-aim="wa"] .lamp--l { --lamp: .12; }

/* ---------- Bocina: salto y destello de faros al tocar el ómnibus ---------- */
.bus { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.bus:focus-visible { outline: none; }
.stage:has(.bus:focus-visible) { outline: 3px solid var(--accent-hi); outline-offset: 4px; border-radius: 8px; }
.bus.is-hop { animation: bus-hop .45s ease-out; }
.bus.is-flash .lamp { animation: bus-flash 1.6s; }
@keyframes bus-hop { 30% { translate: 0 -5px; } 60% { translate: 0 1px; } }
@keyframes bus-flash { 0% { opacity: 0; } 8% { opacity: 1; } 14% { opacity: .1; } 22% { opacity: 1; } 32% { opacity: .2; } 46% { opacity: .9; } 100% { opacity: var(--lamp, .3); } }

/* ---------- Saludo y botones ---------- */
.actions {
  position: relative; z-index: 5; width: min(100%, 760px);
  margin: calc(var(--bw) * -.15) auto 0; padding-bottom: clamp(8px, 2.5vh, 20px); text-align: center;
  animation: rise .9s 1.3s cubic-bezier(.2,.7,.2,1) backwards;
}
.subheading {
  font-size: clamp(17px, min(2.3vw, 2.75vh), 22px); font-weight: 500; line-height: 1.3; margin: 0 0 clamp(8px, 1.75vh, 14px);
  text-shadow: 0 2px 14px rgba(0,0,0,.85);
}
.subheading #greeting-word { color: var(--bus); font-weight: 600; }
.buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.buttons a {
  --x: 0deg; position: relative; isolation: isolate; display: flex; align-items: center; gap: 14px;
  min-height: clamp(60px, 9.5vh, 76px); padding: clamp(8px, 1.5vh, 12px) 18px; border-radius: 16px; text-align: left; text-decoration: none; color: var(--fg);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.85), 0 0 30px -12px rgba(42,157,244,.6);
  transition: transform .25s, box-shadow .25s;
}
.buttons a::before {
  content: ""; position: absolute; inset: -2px; z-index: -2; border-radius: 18px;
  background: conic-gradient(from var(--x), var(--bus), #fff 10%, var(--accent-hi) 28%, var(--bus) 50%, rgba(42,157,244,.2) 72%, var(--bus));
  animation: spin 6s linear infinite;
}
.buttons a::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 16px; background: var(--card); }
.buttons a.is-aim::before { animation: none; }
.buttons a:hover, .buttons a:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -12px rgba(0,0,0,.9), 0 0 42px -6px rgba(42,157,244,.8);
}
.btn__icon {
  flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bus); color: #04101c; font-size: 21px;
}
.btn__icon--wa { background: var(--accent-hi); }
.btn__txt { min-width: 0; line-height: 1.1; }
.btn__txt b { display: block; font-family: var(--font-title); font-weight: 400; font-size: clamp(24px, 3.75vh, 30px); letter-spacing: .04em; }
.btn__txt small { display: block; margin-top: 4px; font-size: 13px; line-height: 1.3; color: var(--fg-2); }
.btn__go { margin-left: auto; color: var(--fg-2); transition: transform .25s, color .25s; }
.buttons a:hover .btn__go, .buttons a:focus-visible .btn__go { transform: translateX(4px); color: var(--fg); }

/* ---------- Pie: ruta ---------- */
.road { position: relative; margin-top: auto; height: clamp(48px, 8vh, 64px); overflow: hidden; border-top: 1px solid var(--line); background: linear-gradient(180deg, #0a0f20, var(--bg)); }
.road__lane { position: absolute; inset: 0 0 18px 0; display: flex; align-items: center; }
.moving-text {
  display: inline-flex; align-items: center; gap: 12px; white-space: nowrap;
  color: var(--fg-2); font-size: 14px; animation: drive 18s linear infinite; will-change: transform;
}
.moving-text i { color: var(--bus); font-size: 20px; }
.road__dash {
  position: absolute; left: 0; right: 0; bottom: 14px; height: 3px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.4) 0 26px, transparent 26px 52px);
  animation: dash 1.1s linear infinite;
}

/* ---------- Animaciones ---------- */
@keyframes spin { to { --x: 360deg; } }
@keyframes shine { 0%, 55% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes wake { from { filter: brightness(.3); } to { filter: brightness(.92); } }
@keyframes ignite { 0% { opacity: 0; } 8% { opacity: 1; } 14% { opacity: .1; } 22% { opacity: 1; } 32% { opacity: .2; } 46% { opacity: .9; } 100% { opacity: .3; } }
@keyframes ignite-beam { 0% { opacity: 0; } 8% { opacity: .9; } 14% { opacity: 0; } 22% { opacity: .9; } 38% { opacity: 0; } 100% { opacity: 0; } }
@keyframes drive { from { transform: translateX(100vw); } to { transform: translateX(-100%); } }
@keyframes dash { to { background-position-x: -52px; } }

@media (max-width: 640px) {
  .buttons { grid-template-columns: 1fr; gap: 12px; }
  .btn__txt b { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero, .actions, .bus__img, .lamp, .beam, .heading span, .buttons a::before, .road__dash { animation: none; }
  .bus { transition: none; transform: none; }
  .moving-text { animation: none; margin-inline: auto; }
}
