/* El Taco Real — página de bienvenida con selector de idioma (raíz /). Diseño aprobado el 25-oct-2026
   a partir del prototipo «El-Taco-Real-Propuesta-Bienvenida». Hoja propia: la raíz NO carga style.css.
   Paleta del sitio (crema / verde / verde profundo) + rojo y dorado tomados del logotipo.
   Regla de oro: el estado BASE siempre es visible; las animaciones solo existen con html.play
   y con prefers-reduced-motion: no-preference. Sin JavaScript, la página se ve completa y funciona. */

:root {
  --cream: #fff6cd;
  --green: #246b2f;
  --green-deep: #163f1c;
  --night: #0b220f;
  --gold: #e3c77e;
  --red: #c8302c;
  --font-brand: 'Rakkas', Georgia, 'Times New Roman', serif;
  --font-body: 'Chau Philomene One', 'Avenir Next', 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --garland: 0px;                       /* altura del papel picado (la fija welcome.js) */
  --e: clamp(210px, min(80vw, calc((100svh - 268px - var(--garland)) / 1.14)), 580px); /* tamaño del emblema */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; min-height: 100svh;
  background: var(--night);
  color: var(--cream);
  font-family: var(--font-body);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; height: auto; }

/* ---------- Fondo: verde profundo con luz central y un patrón de azulejo muy tenue ---------- */
.bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 42%, rgba(255, 246, 205, .10), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23e3c77e' stroke-opacity='.075' stroke-width='1'%3E%3Cpath d='M28 18 L32 28 L28 38 L24 28 Z'/%3E%3Cpath d='M18 28 L28 24 L38 28 L28 32 Z'/%3E%3Ccircle cx='0' cy='0' r='5'/%3E%3Ccircle cx='56' cy='0' r='5'/%3E%3Ccircle cx='0' cy='56' r='5'/%3E%3Ccircle cx='56' cy='56' r='5'/%3E%3C/g%3E%3C/svg%3E") center / 56px 56px,
    radial-gradient(ellipse 120% 100% at 50% 40%, #22582a 0%, var(--green-deep) 45%, var(--night) 100%);
}
.bg::after { /* el patrón casi invisible y viñeta suave en los bordes */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 90% 80% at 50% 45%, transparent 55%, rgba(5, 18, 8, .55) 100%);
}
.bg { opacity: 1; }

/* ---------- Papel picado (lo dibuja welcome.js) ---------- */
.papel {
  position: fixed; top: 0; left: 0; z-index: 1;
  width: 100%; height: var(--garland);
  overflow: visible; pointer-events: none;
}
.papel .flag { transform-box: fill-box; transform-origin: 50% 0; }
.papel .string { fill: none; stroke: rgba(227, 199, 126, .55); stroke-width: 1.2; }

/* ---------- Escena ---------- */
.stage {
  position: relative; z-index: 2;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(14px, 2.4vh, 26px);
  padding: calc(var(--garland) + 12px) 16px calc(64px + env(safe-area-inset-bottom));
  text-align: center;
}

/* 26-oct-2026: Leah pidió retirar el anillo tipo brújula y sus «alas»; el emblema conserva medidas y márgenes
   para que el logotipo mantenga el mismo tamaño y posición. */
.emblem { position: relative; width: var(--e); height: var(--e); flex: none; margin-block: calc(var(--e) * .07); display: grid; place-items: center; }
.halo {
  position: absolute; inset: 14%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 246, 205, .20) 0%, rgba(227, 199, 126, .08) 45%, transparent 70%);
  filter: blur(6px);
}
.logo-wrap { position: relative; width: 78%; margin: 0; font-size: 0; }
.logo { width: 100%; filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .45)); }

.greeting {
  font-family: var(--font-brand);
  font-size: clamp(1.05rem, 1.2rem + .6vw, 1.65rem);
  letter-spacing: .06em;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  column-gap: .7em; row-gap: .1em;
  max-width: none;
}
.greeting .sep { color: var(--gold); font-size: .45em; opacity: .9; }
.greeting span:not(.sep) { display: inline-block; }

.divider { width: min(240px, 60vw); height: 1px; position: relative; }
.divider span { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.divider::after { /* rombo central */
  content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px;
  background: var(--gold); transform: translate(-50%, -50%) rotate(45deg);
}

/* ---------- Idiomas ---------- */
.langs ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 14px; }
.lang {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .7em;
  min-width: 11.5rem; min-height: 54px; padding: 12px 22px;
  border: 1px solid rgba(255, 246, 205, .45); border-radius: 999px;
  color: var(--cream); text-decoration: none;
  font-size: 1.08rem; letter-spacing: .02em;
  background: rgba(11, 34, 15, .35);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  transition: color .35s var(--ease), border-color .35s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease);
}
.lang::before { /* relleno crema que entra desde la izquierda al pasar el cursor */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--cream), #fffbe6);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .45s var(--ease);
}
.lang .code {
  font-family: var(--font-brand); font-size: .78rem; letter-spacing: .12em;
  color: var(--gold); transition: color .35s var(--ease);
}
.lang .arrow { width: 0; opacity: 0; transform: translateX(-6px); transition: opacity .3s var(--ease), transform .35s var(--ease), width .35s var(--ease); }
.lang:hover, .lang:focus-visible {
  color: var(--green-deep); border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35), 0 0 0 1px rgba(227, 199, 126, .35);
}
.lang:hover::before, .lang:focus-visible::before { transform: scaleX(1); }
.lang:hover .code, .lang:focus-visible .code { color: var(--red); }
.lang:hover .arrow, .lang:focus-visible .arrow { width: 1em; opacity: 1; transform: none; }
.lang:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.lang:active { transform: translateY(0) scale(.98); }

/* ---------- Salida al elegir idioma (círculo crema desde el botón) ---------- */
.wipe {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  background: var(--cream);
  clip-path: circle(0 at var(--x, 50%) var(--y, 50%));
  visibility: hidden;
}
html.leaving .wipe { visibility: visible; clip-path: circle(150vmax at var(--x, 50%) var(--y, 50%)); }
html.leaving .stage { transition: opacity .35s ease, transform .6s var(--ease); opacity: 0; transform: scale(1.04); }
html.leaving .lang.chosen { opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  :root { --e: clamp(180px, min(78vw, calc((100svh - 292px - var(--garland)) / 1.1)), 580px); }
  .emblem { margin-block: calc(var(--e) * .05); }
  .stage { gap: 12px; padding-bottom: calc(52px + env(safe-area-inset-bottom)); }
  .greeting { display: grid; grid-template-columns: auto auto; column-gap: 1.4em; justify-content: center; }
  .greeting .sep { display: none; }
  .langs ul { display: grid; grid-template-columns: 1fr 1fr; width: min(100%, 420px); }
  .langs { width: 100%; display: flex; justify-content: center; }
  .lang { min-width: 0; width: 100%; padding: 12px 14px; font-size: 1rem; }
  .lang .arrow { display: none; }
}
/* Móvil en horizontal / pantallas muy bajas: emblema a la izquierda, idiomas a la derecha */
@media (orientation: landscape) and (max-height: 540px) {
  :root { --e: clamp(180px, min(44vw, calc(100svh - 40px - var(--garland))), 420px); }
  .stage {
    display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto auto;
    align-content: center; justify-content: center; column-gap: 32px; row-gap: 14px;
    padding: calc(var(--garland) + 8px) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  }
  .emblem { grid-row: 1 / span 3; margin: 0 calc(var(--e) * .08); }
  .greeting, .divider, .langs { justify-self: center; }
  .greeting { display: grid; grid-template-columns: auto auto; column-gap: 1.4em; }
  .greeting .sep { display: none; }
  .langs ul { display: grid; grid-template-columns: 1fr 1fr; }
  .lang { min-width: 0; width: 100%; }
}

/* =====================================================================
   ANIMACIONES — solo si el usuario no pidió reducir el movimiento
   ===================================================================== */
@keyframes bg-in      { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes halo-in    { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes fade       { from { opacity: 0; } to { opacity: 1; } }
@keyframes logo-in {
  0%   { opacity: 0; transform: translateY(22px) scale(.82); filter: blur(12px); }
  60%  { opacity: 1; filter: blur(0); }
  80%  { transform: translateY(-3px) scale(1.015); }
  100% { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes word-in    { from { opacity: 0; transform: translateY(10px); letter-spacing: .3em; } to { opacity: 1; transform: none; letter-spacing: .06em; } }
@keyframes line-in    { from { transform: scaleX(0); } to { transform: none; } }
@keyframes pop-in     { from { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(45deg); } to { opacity: 1; transform: translate(-50%, -50%) rotate(45deg); } }
@keyframes btn-in     { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes drop       { from { transform: translateY(-110%); } to { transform: none; } }
@keyframes sway       { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(3.5deg); } 70% { transform: rotate(-3deg); } }
@keyframes shine      { from { opacity: 0; transform: scale(.6); } 40% { opacity: 1; } to { opacity: 0; transform: scale(1.35); } }

@media (prefers-reduced-motion: no-preference) {
  html.play:not(.skip) .bg { animation: bg-in 1.4s var(--ease) both; }
  html.play:not(.skip) .papel { animation: drop 1s var(--ease) .3s both; }
  /* un solo balanceo: todo el movimiento termina antes de 5 s (WCAG 2.2.2, sin necesidad de botón de pausa) */
  html.play:not(.skip) .papel .flag { animation: sway 2.6s ease-in-out calc(1.1s + var(--d, 0s)) 1 both; }
  html.play:not(.skip) .halo { animation: halo-in 1.2s var(--ease) .2s both; }
  html.play:not(.skip) .halo::after { /* destello único detrás del logotipo cuando termina de asentarse */
    content: ""; position: absolute; inset: -10%; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 246, 205, .35), transparent 60%);
    animation: shine 1.1s ease-out 1.15s both;
  }
  html.play:not(.skip) .logo-wrap { animation: logo-in 1.15s var(--ease) .35s both; }
  html.play:not(.skip) .greeting span:not(.sep) { animation: word-in .7s var(--ease) both; }
  html.play:not(.skip) .greeting span:nth-of-type(1) { animation-delay: 1.00s; }
  html.play:not(.skip) .greeting span:nth-of-type(3) { animation-delay: 1.09s; }
  html.play:not(.skip) .greeting span:nth-of-type(5) { animation-delay: 1.18s; }
  html.play:not(.skip) .greeting span:nth-of-type(7) { animation-delay: 1.27s; }
  html.play:not(.skip) .greeting .sep { animation: fade .5s ease 1.3s both; }
  html.play:not(.skip) .divider span { animation: line-in .6s var(--ease) 1.3s both; }
  html.play:not(.skip) .divider::after { animation: pop-in .4s var(--ease) 1.55s both; }
  html.play:not(.skip) .lang { animation: btn-in .6s var(--ease) calc(1.4s + var(--i) * 90ms) both; }

  html.leaving .wipe { transition: clip-path .7s cubic-bezier(.65, 0, .35, 1) .1s; }
}

/* «Reducir movimiento»: sin desplazamientos ni transiciones */
@media (prefers-reduced-motion: reduce) {
  .lang, .lang::before, .lang .arrow, .lang .code { transition: none; }
  .lang:hover, .lang:focus-visible, .lang:active { transform: none; }
  html.leaving .stage { transition: none; transform: none; }
}

/* ---------- Botón flotante de WhatsApp (fase 16, 2026-11-05) ----------
   Mismo botón que en las 32 páginas de idioma, con el aro dorado de la bienvenida. Queda por debajo de la cortina (.wipe). */
.wa-fab {
  position: fixed; z-index: 10;
  right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-deep); color: var(--cream); text-decoration: none;
  border: 2px solid var(--gold);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  transition: background-color .2s var(--ease), transform .2s var(--ease);
}
.wa-fab svg { width: 28px; height: 28px; fill: var(--cream); }
.wa-fab:hover { background: var(--green); transform: translateY(-2px); }
.wa-fab:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
@media (min-width: 861px) { .wa-fab { width: 60px; height: 60px; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); } .wa-fab svg { width: 30px; height: 30px; } }
@media (prefers-reduced-motion: reduce) { .wa-fab, .wa-fab:hover { transition: none; transform: none; } }
@media print { .wa-fab { display: none; } }
/* Pantallas verticales bajas (≤ 640 px de ancho y ≤ 760 px de alto): se reservan 24 px más abajo para que el botón no tape
   los idiomas; el emblema cede esos 24 px sin bajar de su mínimo aprobado (180 px → logotipo ≥ 140 px). En móviles altos
   (p. ej. 390×844) nada cambia. En las muy bajas (≤ 600 px) el espacio sale de los márgenes, no del logotipo. */
@media (max-width: 640px) and (max-height: 760px) and (orientation: portrait) {
  :root { --e: clamp(180px, min(78vw, calc((100svh - 316px - var(--garland)) / 1.1)), 580px); }
  .stage { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) and (max-height: 600px) and (orientation: portrait) {
  .stage { gap: 6px; }
  .emblem { margin-block: 0; }
}
/* Móvil en horizontal: la columna de idiomas llega al borde derecho, así que solo aquí el botón pasa a la esquina
   inferior IZQUIERDA (bajo el emblema, zona libre). Excepción documentada en el informe de la fase 16. */
@media (orientation: landscape) and (max-height: 540px) {
  .wa-fab { right: auto; left: calc(16px + env(safe-area-inset-left, 0px)); width: 52px; height: 52px; }
  .wa-fab svg { width: 26px; height: 26px; }
}
