/* Formulario público: «acero y papel».
   A la izquierda (arriba en el móvil) la placa de tinta con la brasa; a la
   derecha el formulario sobre papel de plano técnico. Tema claro a propósito:
   en una nave de feria muy iluminada se lee mejor y refleja menos. */

body.publico { background: var(--tinta); color: var(--tinta); }

.escena { min-height: 100dvh; display: grid; grid-template-columns: minmax(380px, 41%) 1fr; }

/* ------------------------------------------------------------- portada */

.portada {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(24px, 3.4vw, 52px);
  color: var(--papel); background: var(--tinta);
  overflow: hidden; isolation: isolate;
}
/* Acero cepillado + grano: casi no se ve, pero quita lo plano. */
.portada::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px),
    var(--grano);
  opacity: .9; mix-blend-mode: screen;
}
.portada__marca-agua {
  position: absolute; z-index: -2; width: 128%; aspect-ratio: 1; right: -46%; bottom: -30%;
  fill: none; stroke: rgba(243, 240, 234, .07); stroke-width: 1.4;
}
.portada__brasa {
  position: absolute; z-index: -3; left: -30%; right: -10%; bottom: -42%; height: 78%;
  background: radial-gradient(closest-side, rgba(255, 122, 47, .62), rgba(217, 84, 30, .32) 42%, rgba(217, 84, 30, 0) 74%);
  filter: blur(18px);
  animation: respirar 7s ease-in-out infinite;
}
@keyframes respirar {
  0%, 100% { opacity: .62; transform: scale(1) translateY(0); }
  50% { opacity: .95; transform: scale(1.07) translateY(-2%); }
}

.portada__arriba { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.marca {
  display: inline-flex; align-items: center; gap: 12px; color: var(--papel); text-decoration: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.marca .mono { width: 42px; height: 42px; }
.marca__palabra { font-family: var(--f-display); font-weight: 800; font-size: 21px; letter-spacing: .24em; }

.idiomas { display: flex; gap: 2px; }
.idiomas button {
  min-width: 42px; min-height: 42px; padding: 0 8px; border: 0; background: none; cursor: pointer;
  font-family: var(--f-display); font-weight: 700; font-size: 16px; letter-spacing: .1em;
  color: rgba(243, 240, 234, .5); position: relative; transition: color .2s;
}
.idiomas button::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: 6px; height: 2px;
  background: var(--brasa-viva); transform: scaleX(0); transition: transform .25s;
}
.idiomas button:hover { color: var(--papel); }
.idiomas button[aria-pressed="true"] { color: var(--papel); }
.idiomas button[aria-pressed="true"]::after { transform: scaleX(1); }
.idiomas button:focus-visible { outline: 2px solid var(--brasa-viva); outline-offset: -2px; }

.portada__texto { padding-bottom: clamp(8px, 4vh, 48px); }
.kicker {
  margin: 0 0 18px; font-size: 12.5px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
  color: var(--brasa-viva);
}
.titulo {
  margin: 0 0 22px; font-family: var(--f-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(56px, 6.6vw, 118px); line-height: .86; letter-spacing: -.005em;
  text-wrap: balance;
}
.titulo__punto { color: var(--brasa-viva); }
.intro { margin: 0; max-width: 34ch; font-size: clamp(16px, 1.35vw, 19px); line-height: 1.5; color: rgba(243, 240, 234, .78); text-wrap: pretty; }

/* Entrada escalonada al cargar. */
.portada__texto > * { animation: aparecer .8s cubic-bezier(.2, .7, .2, 1) both; }
.portada__texto > :nth-child(2) { animation-delay: .08s; }
.portada__texto > :nth-child(3) { animation-delay: .16s; }
@keyframes aparecer { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- hoja */

.hoja { position: relative; background: var(--papel); isolation: isolate; }
.hoja::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(21, 26, 33, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 26, 33, .05) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000, rgba(0, 0, 0, .35));
}
.hoja::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--grano); opacity: .18; mix-blend-mode: multiply;
}

.formulario {
  max-width: 780px; margin: 0 auto;
  padding: clamp(28px, 5vw, 72px) clamp(20px, 4.5vw, 64px) calc(64px + env(safe-area-inset-bottom));
}

.bloque { border: 0; margin: 0 0 clamp(40px, 5vw, 60px); padding: 0; min-width: 0; animation: aparecer .8s .2s cubic-bezier(.2, .7, .2, 1) both; }
.bloque:nth-of-type(2) { animation-delay: .28s; }
.bloque:nth-of-type(3) { animation-delay: .36s; }

.bloque__titulo {
  display: flex; align-items: baseline; gap: 16px; width: 100%; padding: 0 0 12px; margin-bottom: 26px;
  border-bottom: 2px solid var(--tinta);
  font-family: var(--f-display); font-weight: 800; font-size: clamp(28px, 3vw, 36px);
  letter-spacing: .03em; text-transform: uppercase;
}
.bloque__num { color: transparent; -webkit-text-stroke: 1.5px var(--brasa); font-size: 1.05em; letter-spacing: .02em; }

.fila--2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }

.campo { display: block; position: relative; margin-bottom: 20px; }
.campo__etiqueta, .grupo__etiqueta {
  display: block; margin-bottom: 4px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--acero);
}
.campo__etiqueta small, .grupo__etiqueta small { font-weight: 500; letter-spacing: .04em; text-transform: none; font-size: 13px; }

.campo input {
  width: 100%; min-height: var(--radio-toque); padding: 8px 0; border: 0; border-radius: 0;
  border-bottom: 2px solid var(--linea); background: transparent no-repeat left bottom / 0 2px;
  background-image: linear-gradient(var(--brasa), var(--brasa));
  font-size: 21px; font-weight: 500; outline: none; transition: border-color .2s, background-size .35s cubic-bezier(.2, .7, .2, 1);
}
.campo input::placeholder, .campo textarea::placeholder { color: #aaa397; font-weight: 400; }
.campo input:focus { background-size: 100% 2px; }
.campo textarea {
  width: 100%; padding: 14px 16px; border: 2px solid var(--linea); border-radius: 0; background: rgba(255, 255, 255, .55);
  font-size: 18px; line-height: 1.45; resize: vertical; outline: none; transition: border-color .2s;
}
.campo textarea:focus { border-color: var(--tinta); }
.campo__error { display: block; min-height: 0; margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--error); }
.campo__error:empty { margin: 0; }
.campo.con-error input, .campo.con-error textarea { border-color: var(--error); }

.ayuda { margin: -6px 0 26px; font-size: 14.5px; color: var(--acero); }
.ayuda.con-error { color: var(--error); font-weight: 600; }

.grupo { margin-bottom: 26px; }
.grupo__etiqueta { margin-bottom: 12px; }

/* Fichas octogonales: capa exterior = borde, capa interior = cara. */
.fichas { display: flex; flex-wrap: wrap; gap: 10px; }
.ficha { position: relative; display: inline-flex; padding: 2px; background: var(--linea); transition: background .2s, transform .12s; }
.ficha input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.ficha__cara {
  display: inline-flex; align-items: center; gap: 10px; min-height: calc(var(--radio-toque) - 4px); padding: 0 20px;
  background: var(--papel); font-size: 17px; font-weight: 600; line-height: 1.15; transition: background .2s, color .2s;
  --corte: 8px;
}
.ficha__cara::before {
  content: ''; width: 9px; height: 9px; flex: none; background: var(--linea);
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  transition: background .2s, transform .25s;
}
.ficha:hover { background: var(--acero-claro); }
.ficha:active { transform: scale(.97); }
.ficha:has(input:checked) { background: var(--tinta); }
.ficha:has(input:checked) .ficha__cara { background: var(--tinta); color: var(--papel); }
.ficha:has(input:checked) .ficha__cara::before { background: var(--brasa-viva); transform: rotate(22.5deg) scale(1.15); }
.ficha:has(input:focus-visible) { background: var(--brasa); }

/* Casillas */
.casilla { display: grid; grid-template-columns: 30px 1fr; gap: 16px; align-items: start; position: relative; padding: 10px 0; cursor: pointer; }
.casilla input { position: absolute; left: 0; top: 10px; width: 30px; height: 30px; margin: 0; opacity: 0; cursor: pointer; }
.casilla__marca { width: 30px; height: 30px; background: var(--acero); position: relative; --corte: 7px; transition: background .2s; }
.casilla__marca::before {
  content: ''; position: absolute; inset: 2px; background: var(--papel);
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
  transition: background .2s;
}
.casilla__marca::after {
  content: ''; position: absolute; left: 10px; top: 5px; width: 8px; height: 15px;
  border: solid var(--papel); border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); transition: transform .2s cubic-bezier(.2, .7, .2, 1.4);
}
.casilla input:checked + .casilla__marca { background: var(--tinta); }
.casilla input:checked + .casilla__marca::before { background: var(--tinta); }
.casilla input:checked + .casilla__marca::after { transform: rotate(45deg) scale(1); }
.casilla input:focus-visible + .casilla__marca { background: var(--brasa); }
.casilla__texto { font-size: 16.5px; line-height: 1.45; padding-top: 3px; }
.casilla.con-error .casilla__marca { background: var(--error); }
.campo__error--casilla { margin: -4px 0 8px 46px; }

.privacidad { margin: 18px 0 30px; font-size: 14px; line-height: 1.55; color: #5d6168; }
.privacidad summary {
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 12.5px; color: var(--acero); list-style: none;
}
.privacidad summary::-webkit-details-marker { display: none; }
.privacidad summary::before { content: '+'; font-family: var(--f-display); font-size: 20px; color: var(--brasa); transition: transform .2s; }
.privacidad[open] summary::before { transform: rotate(45deg); }
.privacidad p { margin: 6px 0 0; max-width: 62ch; }
.privacidad a { color: var(--tinta); }

.trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Botón de envío: se «calienta» de izquierda a derecha. */
.enviar {
  position: relative; overflow: hidden; width: 100%; min-height: 68px; padding: 0 30px; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--tinta); color: var(--papel);
  font-family: var(--f-display); font-weight: 800; font-size: 28px; letter-spacing: .14em; text-transform: uppercase;
  --corte: 12px; isolation: isolate;
}
.enviar::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--brasa) 0%, var(--brasa-viva) 100%);
  transform: scaleX(0); transform-origin: left; transition: transform .45s cubic-bezier(.2, .7, .2, 1);
}
.enviar:hover::before, .enviar:focus-visible::before { transform: scaleX(1); }
.enviar:focus-visible { outline: none; }
.enviar__flecha { width: 30px; height: 30px; transition: transform .3s; }
.enviar:hover .enviar__flecha { transform: translateX(6px); }
.enviar[aria-busy="true"] { cursor: progress; }
.enviar[aria-busy="true"]::before {
  transform: scaleX(1);
  background: repeating-linear-gradient(-45deg, var(--brasa) 0 14px, var(--brasa-viva) 14px 28px);
  background-size: 40px 40px; animation: avanzar .8s linear infinite;
}
@keyframes avanzar { to { background-position: 40px 0; } }

/* ----------------------------------------------------------- gracias */

.gracias {
  position: fixed; inset: 0; z-index: 50; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 32px; background: var(--tinta); color: var(--papel);
  animation: fundido .35s ease both;
}
.gracias::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .02) 0 1px, transparent 1px 3px), var(--grano);
  mix-blend-mode: screen;
}
.gracias__brasa {
  position: absolute; z-index: -2; left: 50%; bottom: -55%; width: 140vmax; height: 100vmax; margin-left: -70vmax;
  background: radial-gradient(closest-side, rgba(255, 122, 47, .7), rgba(217, 84, 30, .35) 40%, rgba(217, 84, 30, 0) 72%);
  filter: blur(14px); transform-origin: 50% 100%;
  animation: encender 1.8s cubic-bezier(.2, .7, .2, 1) both, respirar 7s 1.8s ease-in-out infinite;
}
@keyframes encender { from { opacity: 0; transform: scale(.25); } to { opacity: .8; transform: scale(1); } }
@keyframes fundido { from { opacity: 0; } to { opacity: 1; } }

/* El monograma se recorta como en la mesa de corte por láser y luego se rellena. */
.gracias__mono {
  width: clamp(110px, 17vmin, 190px); height: auto; margin-bottom: 34px; overflow: visible;
  fill: rgba(243, 240, 234, 0); stroke: var(--brasa-viva); stroke-width: 4;
  stroke-dasharray: 1700; stroke-dashoffset: 1700;
  filter: drop-shadow(0 0 10px rgba(255, 122, 47, .55));
  animation: cortar 1.5s .15s cubic-bezier(.6, .1, .3, 1) forwards, templar .7s 1.45s ease forwards;
}
@keyframes cortar { to { stroke-dashoffset: 0; } }
@keyframes templar { to { fill: var(--papel); stroke: rgba(255, 122, 47, 0); filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0)); } }

.gracias__titulo {
  margin: 0 0 18px; font-family: var(--f-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(54px, 9vw, 128px); line-height: .9; letter-spacing: .005em; text-wrap: balance;
  animation: aparecer .7s 1.15s cubic-bezier(.2, .7, .2, 1) both;
}
.gracias__titulo .titulo__punto { color: var(--brasa-viva); }
.gracias__texto { margin: 0; max-width: 32ch; font-size: clamp(18px, 2vw, 22px); line-height: 1.45; color: rgba(243, 240, 234, .85); animation: aparecer .7s 1.3s both; }
.gracias__extra { margin: 14px 0 0; font-size: 15px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--brasa-viva); animation: aparecer .7s 1.45s both; }
.gracias__red { margin: 22px 0 0; max-width: 40ch; font-size: 14.5px; color: rgba(243, 240, 234, .65); }
.gracias__kiosco { margin-top: 44px; display: flex; flex-direction: column; align-items: center; gap: 14px; animation: aparecer .7s 1.6s both; }
.otra {
  min-height: 60px; padding: 0 34px; border: 0; cursor: pointer; background: var(--papel); color: var(--tinta);
  font-family: var(--f-display); font-weight: 800; font-size: 22px; letter-spacing: .14em; text-transform: uppercase; --corte: 10px;
}
.otra:focus-visible { outline: 3px solid var(--brasa-viva); outline-offset: 3px; }
.gracias__cuenta { margin: 0; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: rgba(243, 240, 234, .5); }

/* ------------------------------------------------------------ sorteo */

.portada__sorteo {
  display: inline-block; margin: 22px 0 0; padding: 12px 18px; max-width: 40ch; --corte: 8px;
  background: var(--brasa); color: #fff; font-weight: 700; font-size: 15.5px; line-height: 1.4;
}
.portada__sorteo[hidden] { display: none; }
.premio { padding: 22px 24px 20px; margin-bottom: 14px; background: var(--tinta); color: var(--papel); --corte: 12px; position: relative; overflow: hidden; }
.premio::after {
  content: ''; position: absolute; right: -40px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 122, 47, .45), transparent 70%); pointer-events: none;
}
.premio__kicker { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--brasa-viva); }
.premio__titulo { margin: 0 0 10px; font-family: var(--f-display); font-weight: 800; font-size: clamp(26px, 3vw, 34px); line-height: 1.05; text-transform: uppercase; letter-spacing: .02em; }
.premio__texto { margin: 0; max-width: 56ch; font-size: 14.5px; line-height: 1.5; color: rgba(243, 240, 234, .78); }
.sorteo-insta { margin: 10px 0 0 46px; }
.insta {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 20px; margin-bottom: 18px; --corte: 8px;
  background: var(--tinta); color: var(--papel); font-weight: 700; font-size: 16px; text-decoration: none;
}
.insta svg { width: 22px; height: 22px; }
#grupo-edad.con-error .grupo__etiqueta { color: var(--error); }
@media (max-width: 640px) { .sorteo-insta { margin-left: 0; } }

/* ------------------------------------------------------- tablet: equipo */

.kiosco-punto {
  position: fixed; left: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 60;
  min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brasa); color: #fff; font: 700 13px/1 var(--f-texto);
  box-shadow: 0 0 0 4px rgba(217, 84, 30, .2);
}
.kiosco-panel {
  position: fixed; left: 50%; top: 50%; z-index: 70; transform: translate(-50%, -50%); width: min(92vw, 380px);
  padding: 22px; background: #fff; color: var(--tinta); box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; gap: 10px; font-size: 16px;
}
.kiosco-panel p { margin: 0; }
.kiosco-panel button { min-height: 48px; border: 2px solid var(--tinta); background: none; font-weight: 700; cursor: pointer; }

/* ------------------------------------------------------------ móvil */

@media (max-width: 959px) {
  .escena { display: block; }
  .portada { position: relative; height: auto; min-height: 0; padding: 18px 20px 34px; }
  .portada__arriba { gap: 10px; }
  .portada__texto { margin-top: 30px; padding-bottom: 0; }
  .portada__marca-agua { width: 110%; right: -52%; bottom: -60%; }
  .portada__brasa { bottom: -70%; height: 110%; }
  .titulo { font-size: clamp(46px, 13vw, 84px); margin-bottom: 16px; }
  .marca .mono { width: 34px; height: 34px; }
  .marca__palabra { font-size: 18px; }
}
@media (max-width: 640px) {
  .fila--2 { grid-template-columns: 1fr; }
  .idiomas { width: 100%; justify-content: space-between; margin: 0 -8px; width: calc(100% + 16px); }
  .idiomas button { min-width: 0; flex: 1; font-size: 15px; }
  .ficha__cara { font-size: 16px; padding: 0 16px; }
  .enviar { font-size: 24px; }
}
@media (min-width: 960px) and (max-height: 700px) {
  .titulo { font-size: clamp(48px, 5.4vw, 88px); }
}
