/* Bautizo de Julio */
@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-wght-normal.woff2") format("woff2"); font-style: normal; font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/instrument-sans-latin-wght-normal.woff2") format("woff2"); font-style: normal; font-weight: 400 700; font-display: swap; }

:root {
  --agua-honda: #12355B;
  --agua: #2C6A99;
  --cielo: #DCEBF3;
  --niebla: #EEF5F9;
  --oro: #B8923F;
  --oro-claro: #EBD9A8;
  --tinta: #1B2B3C;
  --tinta-suave: #54687C;
  --blanco: #FFFFFF;
  --rojo: #B3261E;
  --titular: "Playfair Display", "Bodoni 72", Georgia, serif;
  --texto: "Instrument Sans", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--tinta); background: var(--niebla);
  font-family: var(--texto); font-size: 1.0625rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, p, ul, dl, dd, figure { margin: 0; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
.visualmente-oculto, .trampa { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; padding: 0; }
:focus-visible { outline: 3px solid var(--agua); outline-offset: 3px; border-radius: 6px; }

/* Fondo general: la finca, lavada en azul claro para que nunca compita con el contenido */
.fondo { position: fixed; inset: 0; z-index: -2; background: var(--cielo) url("../assets/finca.jpg") center 38% / cover no-repeat; }
.fondo::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120% 70% at 50% 42%, rgba(238,245,249,.80) 0%, rgba(238,245,249,.52) 55%, rgba(220,235,243,.30) 100%),
    linear-gradient(180deg, rgba(238,245,249,.30) 0%, rgba(238,245,249,.72) 62%, rgba(238,245,249,.96) 100%);
}
@media (max-width: 700px) { .fondo { background-image: url("../assets/finca-m.jpg"); } }

/* ---------- Página única: todo en una pantalla, sin scroll ---------- */
body.una { height: 100vh; height: 100dvh; overflow: hidden; }
.pagina {
  position: relative; height: 100%; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); align-items: center;
  gap: clamp(1.5rem, 4vw, 4.5rem); max-width: 86rem; margin: 0 auto;
  padding: clamp(5.4rem, 15vh, 8rem) clamp(1.25rem, 4vw, 3.5rem) clamp(2.2rem, 5vh, 3rem);
}
.ondas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.titulo { text-align: center; min-width: 0; }

.antetitulo {
  font-family: var(--titular); font-weight: 700;
  font-size: clamp(1.6rem, min(3vw, 5.2vh), 2.4rem); letter-spacing: .01em; color: var(--agua);
}
.nombre { position: relative; line-height: 1; margin: -.04em 0 0; padding-bottom: .05em; }
.nombre-letras, .nombre-reflejo {
  display: block; font-family: var(--titular); font-weight: 900;
  font-size: clamp(5.2rem, min(15.5vw, 27vh), 14.5rem); letter-spacing: -.015em; white-space: nowrap;
}
.nombre-letras {
  color: var(--agua-honda); padding: .08em .08em .26em; margin: -.08em -.08em -.26em;
  background: linear-gradient(105deg, var(--agua-honda) 0%, var(--agua-honda) 44%, #3F7FB5 48%, #F1DFA8 50%, #3F7FB5 52%, var(--agua-honda) 56%, var(--agua-honda) 100%) 100% 0 / 320% 100% no-repeat, var(--agua-honda);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: barrido 9s ease-in-out 3.2s infinite;
}
@keyframes barrido { 0% { background-position: 100% 0, 0 0; } 32%, 100% { background-position: 0% 0, 0 0; } }
/* Reflejo del nombre en el agua */
.nombre-reflejo {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: -.03em;
  transform: translateY(52%) scaleY(-.52); transform-origin: top center; color: var(--agua);
  opacity: .13; filter: blur(2px); user-select: none; pointer-events: none;
  -webkit-mask-image: linear-gradient(0deg, #000 10%, transparent 70%); mask-image: linear-gradient(0deg, #000 10%, transparent 70%);
}
.fecha {
  position: relative; margin-top: clamp(1rem, 3.4vh, 2.2rem);
  font-family: var(--texto); font-weight: 700; font-size: clamp(1.7rem, min(3.4vw, 5.8vh), 2.7rem);
  letter-spacing: .03em; color: var(--agua-honda); font-variant-numeric: lining-nums;
}
.fecha time { display: inline-block; padding: 0 .6em; position: relative; }
.fecha time::before, .fecha time::after { content: ""; position: absolute; top: 50%; width: clamp(1.5rem, 5vw, 4.5rem); height: 1px; background: var(--oro); }
.fecha time::before { right: 100%; }
.fecha time::after { left: 100%; }
.detalle { position: relative; margin-top: .5rem; font-size: clamp(1rem, 1.5vw, 1.12rem); color: var(--tinta); font-weight: 600; }
.programa { position: relative; margin: clamp(.6rem, 1.8vh, 1rem) auto 0; display: inline-grid; grid-template-columns: 1fr 1fr; text-align: center; }
.programa div { display: grid; align-content: start; gap: .05rem; padding: .1rem clamp(1rem, 2.4vw, 1.9rem); min-width: 0; }
.programa div + div { border-left: 1px solid var(--oro); }
.programa b { font-family: var(--texto); font-weight: 700; letter-spacing: -.01em; font-size: clamp(1.45rem, min(2.4vw, 4.4vh), 2rem); line-height: 1.05; color: var(--agua-honda); font-variant-numeric: lining-nums; }
.programa span { font-weight: 700; color: var(--agua-honda); font-size: 1rem; }
.programa small { font-size: .9rem; color: var(--tinta); font-weight: 500; }
.nota { position: relative; margin: .5rem auto 0; max-width: 30rem; color: var(--tinta-suave); font-size: .98rem; }
.titulo-pie { position: relative; margin-top: clamp(1rem, 3vh, 1.8rem); display: grid; justify-items: center; gap: .9rem; }
.boton.abrir { display: none; }

/* Cuenta atrás */
.cuenta { display: inline-grid; grid-auto-flow: column; gap: 1.1rem; padding: .55rem 1.2rem; border-radius: 999px; background: rgba(255,255,255,.66); border: 1px solid rgba(255,255,255,.9); }
.cuenta div { display: flex; align-items: baseline; gap: .3rem; }
.cuenta b { font-family: var(--texto); font-weight: 700; font-size: 1.25rem; line-height: 1; color: var(--agua-honda); font-variant-numeric: tabular-nums lining-nums; min-width: 1.5ch; text-align: right; }
.cuenta span { font-size: .82rem; font-weight: 600; color: var(--tinta-suave); }
.enlace-mapa { font-weight: 600; font-size: .95rem; color: var(--agua-honda); text-underline-offset: .25em; text-decoration-color: var(--oro); text-decoration-thickness: 2px; }
.enlace-mapa:hover { color: var(--agua); }
.acceso-org { position: absolute; right: clamp(1.25rem, 4vw, 3.5rem); bottom: .7rem; font-size: .82rem; color: var(--tinta-suave); text-underline-offset: .2em; }
.acceso-org:hover { color: var(--agua-honda); }

/* Guirnalda de luces, como la de la finca */
.guirnalda { position: absolute; left: -2%; right: -2%; top: 0; height: clamp(64px, 12vh, 118px); z-index: 0; pointer-events: none; }
.cable { position: absolute; inset: 0; }
.cable-1 { left: 22%; right: -8%; }
.cable svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* cada bombilla cuelga de su casquillo y se mece un poco */
.cable i { position: absolute; width: 22px; height: 36px; margin-left: -11px; transform-origin: 50% 0; animation: mece calc(5.5s + var(--r) * .28s) ease-in-out calc(var(--r) * -.9s) infinite; }
.cable i::before { content: ""; position: absolute; left: 6px; top: 0; width: 10px; height: 9px; border-radius: 2px 2px 3px 3px; background: linear-gradient(90deg, #2E3B49, #6A7A8A 45%, #2E3B49); z-index: 1; }
.cable i::after { content: ""; position: absolute; left: 50%; top: 22px; width: 150px; height: 150px; margin: -75px 0 0 -75px; border-radius: 50%; background: radial-gradient(circle, rgba(255,222,140,.50) 0%, rgba(255,210,110,.20) 34%, rgba(255,205,100,0) 68%); animation: halo calc(4.2s + var(--r) * .22s) ease-in-out calc(var(--r) * -.53s) infinite; }
.cable i b {
  position: absolute; left: 0; top: 7px; width: 22px; height: 28px; border-radius: 50% 50% 50% 50% / 38% 38% 62% 62%;
  background: radial-gradient(circle at 50% 58%, #FFFFFF 0%, #FFF6D2 22%, #FFDD86 55%, #EEB23C 100%);
  box-shadow: 0 0 14px 4px rgba(255,216,120,.85), inset 0 -3px 6px rgba(214,150,30,.35), inset 3px 3px 5px rgba(255,255,255,.7);
  z-index: 1;
}
.cable-1 i { transform: scale(.72); animation-name: mece-p; }
@keyframes mece { 0%, 100% { transform: rotate(-3.5deg); } 50% { transform: rotate(3.5deg); } }
@keyframes mece-p { 0%, 100% { transform: scale(.72) rotate(-3.5deg); } 50% { transform: scale(.72) rotate(3.5deg); } }
@keyframes halo { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.86); } }

/* Gota que cae al abrir la página */
.gota {
  position: absolute; left: 50%; top: 0; width: 12px; height: 18px; margin-left: -6px; z-index: 1; opacity: 0;
  background: linear-gradient(180deg, var(--oro-claro), var(--oro));
  clip-path: polygon(50% 0, 100% 62%, 86% 90%, 50% 100%, 14% 90%, 0 62%);
}

/* Botones */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; cursor: pointer;
  font: 600 1rem/1 var(--texto); text-decoration: none; border: 0; border-radius: 999px;
  padding: 1rem 1.6rem; min-height: 3rem; transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease;
}
.boton-principal { color: #fff; background: var(--agua-honda); box-shadow: 0 10px 24px -10px rgba(18,53,91,.7), inset 0 1px 0 rgba(255,255,255,.18); }
.boton-principal:hover { background: #0E2A49; transform: translateY(-1px); }
.boton-principal:active { transform: translateY(0); }
.boton-principal[disabled] { opacity: .6; cursor: progress; transform: none; }
.boton-suave { color: var(--agua-honda); background: rgba(44,106,153,.10); padding: .8rem 1.2rem; min-height: 2.75rem; font-size: .95rem; }
.boton-suave:hover { background: rgba(44,106,153,.18); }

/* ---------- Tarjeta de asistencia ---------- */
h2 { font-family: var(--texto); font-weight: 700; font-size: clamp(1.6rem, 2.6vw, 2.15rem); line-height: 1.08; letter-spacing: -.02em; color: var(--agua-honda); }
.asistencia { min-width: 0; min-height: 0; max-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.tarjeta {
  position: relative; background: rgba(255,255,255,.90); border: 1px solid #fff; border-radius: 26px;
  padding: clamp(1.3rem, 2.6vw, 2.2rem);
  box-shadow: 0 40px 80px -40px rgba(18,53,91,.45), 0 2px 6px rgba(18,53,91,.06);
}
@supports ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .tarjeta { background: rgba(255,255,255,.80); -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1); }
}
.una .tarjeta { display: flex; flex-direction: column; min-height: 0; max-height: 100%; }
.una .vista, .una #form { display: flex; flex-direction: column; min-height: 0; }
.una .filas { overflow-y: auto; min-height: 5.4rem; flex: 0 1 auto; margin-right: -.5rem; padding-right: .5rem; overscroll-behavior: contain; scrollbar-width: thin; }
.una #mas { align-self: flex-start; flex: none; }
.cerrar { display: none; position: absolute; right: .7rem; top: .7rem; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: rgba(18,53,91,.07); color: var(--agua-honda); cursor: pointer; place-items: center; z-index: 2; }
.ayuda { margin-top: .5rem; color: var(--tinta-suave); max-width: 34rem; }
.filas { margin-top: 1.1rem; display: grid; gap: .7rem; align-content: start; }
.fila {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) auto auto; gap: .6rem; align-items: end;
  padding: .7rem; border-radius: 16px; background: rgba(220,235,243,.45); border: 1px solid rgba(18,53,91,.08);
}
.fila.entra { animation: entra .35s ease both; }
@keyframes entra { from { opacity: 0; transform: translateY(-6px); } }
.campo { display: grid; gap: .3rem; min-width: 0; }
.campo label { font-size: .82rem; font-weight: 600; color: var(--tinta-suave); padding-left: .2rem; }
.campo input {
  width: 100%; font: 500 1rem/1.2 var(--texto); color: var(--tinta); background: #fff;
  border: 1.5px solid rgba(18,53,91,.16); border-radius: 12px; padding: .8rem .85rem; min-height: 3rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.campo input::placeholder { color: #9AA9B8; }
.campo input:focus { outline: 0; border-color: var(--agua); box-shadow: 0 0 0 4px rgba(44,106,153,.18); }
.campo input[aria-invalid="true"] { border-color: var(--rojo); box-shadow: 0 0 0 4px rgba(179,38,30,.12); }

/* Casilla «Niño» */
.nino { position: relative; display: inline-flex; align-items: center; gap: .5rem; min-height: 3rem; padding: 0 .95rem 0 .75rem; border-radius: 12px; cursor: pointer; font-weight: 600; font-size: .95rem; color: var(--agua-honda); background: #fff; border: 1.5px solid rgba(18,53,91,.16); user-select: none; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.nino input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.nino .marca { width: 1.3rem; height: 1.3rem; border-radius: 7px; border: 1.5px solid rgba(18,53,91,.35); display: grid; place-items: center; background: #fff; transition: inherit; flex: none; }
.nino .marca svg { opacity: 0; transform: scale(.6); transition: opacity .15s ease, transform .15s ease; }
.nino:has(input:checked) { background: var(--oro-claro); border-color: var(--oro); color: #5B4513; }
.nino:has(input:checked) .marca { background: var(--oro); border-color: var(--oro); }
.nino input:checked + .marca svg { opacity: 1; transform: none; }
.nino:has(input:focus-visible) { outline: 3px solid var(--agua); outline-offset: 2px; }

.quitar { width: 3rem; height: 3rem; border: 0; border-radius: 12px; background: transparent; color: var(--tinta-suave); cursor: pointer; display: grid; place-items: center; transition: background-color .15s ease, color .15s ease; }
.quitar:hover { background: rgba(179,38,30,.10); color: var(--rojo); }
.quitar[disabled] { visibility: hidden; }

#mas { margin-top: .9rem; }
.error { margin-top: 1rem; padding: .8rem 1rem; border-radius: 12px; background: rgba(179,38,30,.08); color: var(--rojo); font-weight: 600; }
.pie-form { margin-top: 1.1rem; padding-top: 1.1rem; flex: none; border-top: 1px solid rgba(18,53,91,.12); display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.recuento { font-weight: 600; color: var(--agua-honda); }
.previos { margin-top: .8rem; flex: none; font-size: .92rem; color: var(--tinta-suave); }

/* Confirmación */
.vista-hecho, .vista-cerrada { text-align: center; padding: 1rem 0; }
.vista-hecho:focus { outline: 0; }
.vista-hecho .ayuda, .vista-cerrada .ayuda { margin-left: auto; margin-right: auto; }
.sello { color: var(--oro); display: grid; place-items: center; margin-bottom: .6rem; }
.vista-hecho:not([hidden]) .sello svg { animation: sello .9s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes sello { from { opacity: 0; transform: translateY(-40px) scale(.7); } }
.confirmados { list-style: none; margin: 1.2rem auto .6rem; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; max-width: 34rem; }
.confirmados li { padding: .5rem .95rem; border-radius: 999px; background: var(--cielo); color: var(--agua-honda); font-weight: 600; }
.confirmados li.es-nino { background: var(--oro-claro); color: #5B4513; }
.vista-hecho .boton { margin-top: 1.2rem; }

/* ---------- Entrada (una sola secuencia al cargar) ---------- */
.anima .antetitulo, .anima .nombre-letras, .anima .nombre-reflejo, .anima .fecha, .anima .detalle, .anima .nota, .anima .titulo-pie, .anima .guirnalda, .anima .una .tarjeta { opacity: 0; }
.anima.listo .guirnalda { animation: aparece .8s .1s ease both; }
.anima.listo .cable i b { animation: enciende .5s calc(.35s + var(--n) * .11s) ease-out both; }
.anima.listo .cable i::after { animation: enciende-halo .7s calc(.35s + var(--n) * .11s) ease-out both, halo calc(4.2s + var(--r) * .22s) ease-in-out calc(2.4s + var(--r) * .2s) infinite; }
@keyframes enciende { from { filter: grayscale(1) brightness(.62); box-shadow: none; } 60% { filter: brightness(1.25); } to { filter: none; } }
@keyframes enciende-halo { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
.anima.listo .gota { animation: cae .62s cubic-bezier(.55,0,.9,.4) both; }
.anima.listo .antetitulo { animation: sube .9s .55s ease both; }
.anima.listo .nombre-letras { animation: emerge 1.4s .62s cubic-bezier(.2,.8,.2,1) both, barrido 9s ease-in-out 3.2s infinite; }
.anima.listo .nombre-reflejo { animation: reflejo 1.6s 1.3s ease both; }
.anima.listo .fecha { animation: sube .9s 1.25s ease both; }
.anima.listo .detalle, .anima.listo .nota { animation: sube .9s 1.4s ease both; }
.anima.listo .titulo-pie { animation: sube .9s 1.55s ease both; }
.anima.listo .una .tarjeta { animation: sube 1s 1.1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes cae { 0% { opacity: 0; transform: translateY(-30px) scaleY(1.3); } 15% { opacity: 1; } 100% { opacity: 1; transform: translateY(var(--caida, 45vh)) scaleY(1.6); } }
@keyframes sube { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes emerge { from { opacity: 0; transform: translateY(.1em) scale(.97); filter: blur(12px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes reflejo { from { opacity: 0; } to { opacity: .13; } }

/* ---------- Móvil: portada a pantalla completa y la inscripción se abre encima ---------- */
@media (max-width: 900px) {
  .pagina { grid-template-columns: minmax(0, 1fr); padding-bottom: 3rem; }
  .boton.abrir { display: inline-flex; padding: 1.1rem 2rem; font-size: 1.05rem; }
  .nombre-letras, .nombre-reflejo { font-size: clamp(5.2rem, min(29vw, 24vh), 12rem); }
  .acceso-org { left: 0; right: 0; text-align: center; }
  .cable i:nth-of-type(even) { display: none; }
  .asistencia { position: fixed; inset: 0; z-index: 30; padding: 0; justify-content: flex-end; background: rgba(18,53,91,.38); visibility: hidden; opacity: 0; transition: opacity .3s ease, visibility 0s .3s; }
  .asistencia.abierta { visibility: visible; opacity: 1; transition: opacity .3s ease; }
  .una .tarjeta { opacity: 1 !important; animation: none !important; border-radius: 26px 26px 0 0; max-height: 92dvh; padding: 1.5rem 1.15rem calc(1.2rem + env(safe-area-inset-bottom)); background: #fff; transform: translateY(100%); transition: transform .38s cubic-bezier(.2,.9,.2,1); }
  .asistencia.abierta .tarjeta { transform: none; }
  .cerrar { display: grid; }
  .tarjeta h2 { padding-right: 3rem; }
}
@media (max-width: 620px) {
  .fila { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fila .campo { grid-column: auto; }
  .fila .nino { justify-self: start; }
  .fila .quitar { justify-self: end; }
  .pie-form { flex-direction: column; align-items: stretch; text-align: center; }
  .pie-form .boton { width: 100%; }
  .cuenta { gap: .8rem; padding: .5rem 1rem; }
}
@media (max-height: 640px) and (min-width: 901px) {
  .pagina { padding-top: 5rem; }
  .ayuda { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .anima .antetitulo, .anima .nombre-letras, .anima .fecha, .anima .detalle, .anima .nota, .anima .titulo-pie, .anima .guirnalda, .anima .una .tarjeta { opacity: 1; }
  .anima .nombre-reflejo { opacity: .13; }
}
