/* Kaiken · Uvas y fuegos cosecha 2027 por Francis Mallmann
   Save the Date. Desktop: tira de video 9:16 a la izquierda y formulario a la derecha.
   Mobile: video a pantalla completa con botón que baja al formulario.
   Tokens de DESIGN.md; layout de Figma (LANDING-KAIKEN, Propuesta 2 y opción 3 mobile). */

/* ---------- Fuentes ---------- */
/* Cardo (OFL) como sustituto de Bembo Std hasta confirmar la licencia web: solo se usa en el mensaje de confirmación. */
@font-face { font-family: "Cardo"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../assets/fonts/cardo-normal-400.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../assets/fonts/Lato-Regular.ttf") format("truetype"); }

/* ---------- Tokens ---------- */
:root {
  --terracota-oscuro: #AF5626;
  --taupe: #6E6259;
  --taupe-oscuro: #5D5148;
  --taupe-claro: #8E8075;
  --texto: #776B61;
  --carbon: #262425;
  --blanco: #FFFFFF;
  --cobre: linear-gradient(to right, #5E2F28, #CF7244, #A0553B);
  --error: #A8321A;

  --font-cuerpo: "Lato", Helvetica, Arial, sans-serif;

  --radio: 0;
  --transicion: all .3s ease-in-out;
  --gutter: 24px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light; -webkit-tap-highlight-color: transparent; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--blanco);
  color: var(--texto);
  font: 400 1rem/1.6 var(--font-cuerpo);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, svg { display: block; max-width: 100%; }
h1, h2, h3, p, address { margin: 0; font-style: normal; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--terracota-oscuro); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: 16px; top: -80px; z-index: 100;
  padding: 12px 16px; background: var(--blanco); color: var(--carbon);
  text-decoration: none; transition: top .2s;
}
.skip:focus { top: 16px; }

/* ---------- Pantalla ---------- */
/* El video ocupa el alto completo y su ancho sale de la proporción 9:16. */
.stage {
  display: grid;
  grid-template-columns: calc(100vh * 9 / 16) 1fr;
  grid-template-columns: calc(100svh * 9 / 16) 1fr;
  min-height: 100vh;
  min-height: 100svh;
}

/* ---------- Video ---------- */
.hero { position: relative; overflow: hidden; background: var(--carbon); color: var(--blanco); height: 100vh; height: 100svh; }
.hero__poster, .hero__video { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.hero__video { opacity: 0; transition: opacity .6s ease-out; }
.hero__video.is-playing { opacity: 1; }
/* Overlay del 50 % como mínimo: texto blanco sobre video en movimiento (ver DESIGN.md) */
/* Más un degradado arriba y abajo: asegura el contraste del logo y del botón sobre planos claros (cielo). */
.hero::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none;
  background:
    linear-gradient(rgba(0, 0, 0, .22), transparent 30%),
    linear-gradient(transparent 62%, rgba(0, 0, 0, .28)),
    rgba(0, 0, 0, .5);
}

.hero__stack {
  position: absolute; z-index: 2; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 64px var(--gutter) 56px; text-align: center;
}
.hero__brand:focus-visible { outline-color: var(--blanco); }
.hero__mid { margin-block: auto; display: flex; flex-direction: column; align-items: center; }
.hero__logo { width: 312px; height: auto; }
.hero__bottom { display: none; }
.hero__info { display: none; }
.hero__date { width: 213px; height: auto; }
.hero__rule { display: block; width: 43px; height: 1px; margin: 16px 0 11px; background: var(--blanco); }
.hero__place-m { font-size: .75rem; line-height: 1.6; letter-spacing: .1em; text-transform: uppercase; }
.hero__place {
  font-size: .75rem; line-height: 1.7; letter-spacing: .2em; text-transform: uppercase;
}

/* Entrada suave del hero: solo opacidad y 12 px de desplazamiento */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .hero__brand, .hero__mid, .hero__info, .hero__place, .hero__cta { animation: rise .9s cubic-bezier(.22, .61, .36, 1) both; }
  .hero__mid { animation-delay: .15s; }
  .hero__info, .hero__place, .hero__cta { animation-delay: .3s; }
}
.btn.hero__cta { display: none; }
/* Sobre el video, el anillo de foco es blanco */
.btn.hero__cta:focus-visible { outline-color: var(--blanco); }

/* ---------- Formulario ---------- */
.panel { position: relative; display: grid; place-items: center; padding: 56px var(--gutter); background: var(--blanco); }
.panel__box { width: min(310px, 100%); }
.panel__title { width: 100%; height: auto; }
.panel__bar { display: block; width: 36px; height: 2px; margin-top: 28px; background: var(--cobre); }
.panel__desc { margin-top: 12px; font-size: 1rem; line-height: 1.6; text-wrap: pretty; }

.form { margin-top: 44px; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; color: var(--taupe); font-size: .875rem; line-height: 1.4; }
.field input {
  display: block; width: 100%; min-height: 48px; padding: 10px 16px;
  border: 1px solid rgba(142, 128, 117, .7); border-radius: var(--radio); background: var(--blanco);
  color: var(--taupe); font: inherit; transition: var(--transicion);
  -webkit-appearance: none; appearance: none; scroll-margin-block: 96px;
}
.field input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px var(--blanco) inset; -webkit-text-fill-color: var(--taupe); }
@media (hover: hover) { .field input:hover { background: rgba(110, 98, 89, .04); } }
.field input:focus-visible { border-color: var(--taupe); outline-offset: 2px; }
.field input[aria-invalid="true"] { border-width: 2px; border-color: var(--error); }
.field__err { margin-top: 8px; color: var(--error); font-size: .875rem; line-height: 1.4; }
.field__err::before { content: "! "; font-weight: 700; }

.check { margin: 2px 0 24px; }
/* Toda la fila es clicable: 44 px de alto mínimo aunque la casilla sea chica */
.check__row { display: flex; align-items: flex-start; min-height: 44px; padding: 8px 0; cursor: pointer; font-size: .875rem; line-height: 1.45; }
.check__row input {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 16px; height: 16px; margin: 1px 12px 0 0;
  border: 1px solid var(--taupe-claro); border-radius: var(--radio); background: var(--blanco); cursor: pointer;
}
.check__row input::before {
  content: ""; position: absolute; left: 2px; top: 2px; width: 10px; height: 5px;
  border-left: 2px solid var(--terracota-oscuro); border-bottom: 2px solid var(--terracota-oscuro);
  transform: rotate(-45deg) scale(0); margin-top: -1px; transition: transform .15s ease-out;
}
.check__row input:checked::before { transform: rotate(-45deg) scale(1); }
.check__row input[aria-invalid="true"] { border-width: 2px; border-color: var(--error); }

.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 50px; padding: 14px 24px;
  border: 1px solid var(--terracota-oscuro); border-radius: var(--radio);
  background: var(--terracota-oscuro); color: var(--blanco);
  font: 400 .875rem/1.25 var(--font-cuerpo); letter-spacing: .08em; text-transform: uppercase; text-align: center;
  text-decoration: none; cursor: pointer; touch-action: manipulation; transition: var(--transicion);
}
@media (hover: hover) { .btn:hover { background: var(--taupe-oscuro); border-color: var(--taupe-oscuro); } }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline-color: var(--terracota-oscuro); }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; pointer-events: none; }
.btn__busy { display: none; }
.btn[aria-busy="true"] .btn__label { display: none; }
.btn[aria-busy="true"] .btn__busy { display: inline; }
.form__status { min-height: 1.4em; margin-top: 14px; color: var(--error); font-size: .8125rem; line-height: 1.4; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Leyenda legal fija al pie del panel, centrada bajo la columna */
.panel__legal {
  position: absolute; bottom: 28px; left: 50%; width: min(480px, calc(100% - 2 * var(--gutter)));
  transform: translateX(-50%); font-size: .75rem; line-height: 1.6; text-align: center;
}
#registro:focus { outline: none; }

.done { margin-top: 28px; }
.done__title { font: 400 1.5rem/1.2 "Cardo", Georgia, serif; letter-spacing: .06em; text-transform: uppercase; color: var(--taupe); }
.done p + p { margin-top: 12px; }
.done__demo { font-size: .8125rem; color: var(--error); }

/* ---------- Mobile: video a pantalla completa y formulario debajo ---------- */
/* También en pantallas verticales (tablet): la tira 9:16 dejaría un formulario demasiado angosto. */
@media (max-width: 860px), (max-aspect-ratio: 1/1) {
  /* Margen lateral generoso: ~66 px en un teléfono de 390 */
  :root { --gutter: clamp(36px, 17.4vw, 68px); --hero-gutter: clamp(28px, 14.4vw, 56px); }
  .stage { grid-template-columns: 1fr; min-height: 0; }
  .hero { height: 100vh; height: 100svh; min-height: 560px; }
  .hero__stack { padding: calc(32px + env(safe-area-inset-top)) var(--gutter) 0; }
  .hero__brand img { width: 116px; height: auto; }
  /* "Uvas y fuegos" va centrado en el alto de la pantalla; la fecha y el lugar quedan junto al botón, al pie. Todo se calcula con el alto disponible (en un iPhone con las barras de Safari son ~700 px). */
  /* El título y el botón comparten el mismo ancho (unos 278 px en un teléfono de 390) */
  .hero__mid { position: absolute; top: 0; bottom: 0; left: var(--hero-gutter); right: var(--hero-gutter); height: fit-content; margin: auto 0; }
  .hero__logo { width: 100%; }
  /* La fecha mide lo mismo que la línea más larga de la dirección */
  .hero__bottom { position: absolute; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 2 * var(--gutter)); bottom: calc(clamp(28px, 11svh, 100px) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: stretch; }
  .hero__info { display: block; margin-bottom: clamp(14px, 2.5svh, 20px); text-align: center; }
  .hero__date { width: 100%; }
  .hero__rule { display: none; }
  .hero__place-m { margin-top: 22px; line-height: 1.5; }
  .hero__place { display: none; }
  /* El botón mide lo mismo que la fecha (el grupo toma el ancho de la línea más larga de la dirección) */
  .btn.hero__cta { display: flex; width: 100%; min-height: 56px; }
  /* El formulario ocupa la pantalla completa, con el contenido centrado en el alto del dispositivo;
     la leyenda legal queda fija al pie, con un filete más ancho que la columna */
  .panel { min-height: 100vh; min-height: 100svh; display: flex; justify-content: center; align-items: center; padding: 88px var(--gutter) 132px; }
  .panel__box { width: 100%; max-width: 400px; }
  /* El lettering con la fecha queda separado unos 80 px del resto del formulario */
  .panel__bar { margin-top: 76px; }
  .panel__desc { margin-top: 16px; font-size: .9375rem; line-height: 22px; }
  .form { margin-top: 40px; }
  .field { margin-bottom: 15px; }
  .field label { margin-bottom: 4px; }
  .field input { height: 44px; min-height: 0; padding-block: 0; }
  .check { margin-bottom: 50px; }
  .btn { height: 46px; min-height: 0; padding-block: 0; }
  /* La leyenda entra en una sola línea: usa todo el ancho y su tamaño sigue al del teléfono; el filete conserva sus márgenes de 29 px */
  .panel__legal {
    position: absolute; left: 0; right: 0; bottom: calc(71px + env(safe-area-inset-bottom)); width: auto; transform: none; margin: 0;
    padding: 14px 8px 0; text-align: center; white-space: nowrap; font-size: clamp(10px, 2.95vw, 12px); line-height: 17px;
  }
  .panel__legal::before { content: ""; position: absolute; top: 0; left: 29px; right: 29px; border-top: 1px solid rgba(110, 98, 89, .3); }
  .panel__title { width: 100%; }
}

/* Teléfonos de poca altura: menos margen arriba para que el formulario entre casi completo */
@media (max-width: 860px) and (max-height: 760px), (max-aspect-ratio: 1/1) and (max-height: 760px) {
  .panel { padding-top: 40px; }
}

/* Teléfonos angostos (375 px): la línea más larga de la dirección ocupa menos para no partirse */
@media (max-width: 400px) {
  .hero__place-m { letter-spacing: .04em; }
}

/* Pantallas muy bajas (iPhone SE): el botón baja un poco y la fecha se acerca al título */
@media (max-width: 860px) and (max-height: 640px), (max-aspect-ratio: 1/1) and (max-height: 640px) {
  .hero__bottom { bottom: calc(24px + env(safe-area-inset-bottom)); }
  .hero__info { margin-bottom: 14px; }
  .hero__place-m { margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
