/* Piezas reutilizables: telón, cursor, cabecera, botones, revelados, formulario. */

/* Telón de entrada */
.telon {
  position: fixed; inset: 0; z-index: 100;
  background: var(--tinta);
  display: grid; place-items: center; align-content: center; gap: 18px;
  transition: clip-path 1.1s var(--curva) .15s;
  clip-path: inset(0 0 0 0);
}
.telon-brillo { width: 46px; fill: var(--oro-claro); animation: telon-gira 1.4s var(--curva) both; }
.telon-texto { font-family: var(--display); font-size: 1.1rem; letter-spacing: .6em; text-transform: uppercase; color: var(--crema); opacity: 0; animation: aparece .8s .35s var(--curva) forwards; padding-left: .6em; }
@keyframes telon-gira { from { transform: scale(0) rotate(-180deg); } to { transform: scale(1) rotate(0); } }
@keyframes aparece { to { opacity: 1; } }
body:not(.cargando) .telon { clip-path: inset(0 0 100% 0); pointer-events: none; }

/* Cursor (solo con ratón) */
.cursor { position: fixed; top: 0; left: 0; z-index: 90; pointer-events: none; display: none; }
.cursor span {
  display: block; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 1px solid var(--oro); border-radius: 50%;
  transition: width .35s var(--curva), height .35s var(--curva), margin .35s var(--curva), background .35s;
}
.cursor.sobre span { width: 70px; height: 70px; margin: -35px 0 0 -35px; background: rgb(176 138 69 / .12); }
@media (hover: hover) and (pointer: fine) { .cursor { display: block; } }

/* Cabecera */
.cabecera {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 32px;
  padding: 18px var(--margen);
  transition: background .5s, padding .5s var(--curva), transform .6s var(--curva), box-shadow .5s;
}
.cabecera.compacta { background: rgb(245 239 228 / .82); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px); padding-block: 10px; box-shadow: 0 1px 0 rgb(27 25 22 / .06); }
.cabecera.oculta { transform: translateY(-100%); }
.marca { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.marca img { width: auto; height: 68px; transition: height .5s var(--curva); }
.cabecera.compacta .marca img { height: 50px; }
.menu { display: flex; gap: 34px; list-style: none; }
.menu a { position: relative; text-decoration: none; font-size: .88rem; letter-spacing: .04em; color: var(--tinta); }
.menu a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: var(--oro); transform: scaleX(0); transform-origin: right; transition: transform .5s var(--curva); }
.menu a:hover::after { transform: scaleX(1); transform-origin: left; }
.hamburguesa { display: none; width: 44px; height: 44px; border: 0; background: none; cursor: pointer; position: relative; }
.hamburguesa span { position: absolute; left: 11px; right: 11px; height: 1.5px; background: var(--tinta); transition: transform .5s var(--curva); }
.hamburguesa span:first-child { top: 17px; }
.hamburguesa span:last-child { top: 26px; }
.hamburguesa[aria-expanded="true"] span:first-child { transform: translateY(4.5px) rotate(45deg); }
.hamburguesa[aria-expanded="true"] span:last-child { transform: translateY(-4.5px) rotate(-45deg); }

/* Botones */
.boton {
  --fondo: var(--tinta);
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 18px 34px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--fondo); color: var(--crema);
  font-size: .82rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; text-decoration: none;
  transition: transform .5s var(--curva);
}
.boton::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--oro-brillo); background-size: 200% 100%;
  transform: translateY(101%); border-radius: inherit;
  transition: transform .6s var(--curva);
}
.boton:hover::before { transform: translateY(0); }
.boton:hover { color: var(--tinta); }
.boton svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform .5s var(--curva); }
.boton:hover svg { transform: translateX(4px); }
.boton-pequeno { padding: 12px 22px; font-size: .72rem; }
.boton-ancho { width: 100%; }
.boton[disabled] { opacity: .6; pointer-events: none; }
.enlace-linea { font-size: .82rem; letter-spacing: .16em; text-transform: uppercase; text-decoration: none; color: var(--tinta); border-bottom: 1px solid var(--oro); padding-bottom: 4px; transition: color .3s; }
.enlace-linea:hover { color: var(--oro); }
.etiqueta { display: inline-block; margin-top: 18px; font-size: .66rem; letter-spacing: .24em; text-transform: uppercase; color: var(--oro); border: 1px solid currentColor; border-radius: 999px; padding: 5px 12px; }

/* Revelados al hacer scroll */
.revelar { opacity: 0; transform: translateY(40px); transition: opacity 1.1s var(--curva), transform 1.1s var(--curva); transition-delay: var(--retardo, 0s); }
.revelar.visible { opacity: 1; transform: none; }
.palabra { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.palabra > span { display: inline-block; transform: translateY(110%) rotate(6deg); transform-origin: left bottom; transition: transform 1.2s var(--curva); transition-delay: var(--retardo, 0s); }
.visible .palabra > span { transform: none; }

/* Formulario */
.formulario {
  position: relative;
  background: var(--crema-clara);
  color: var(--texto);
  border-radius: 28px;
  padding: clamp(26px, 4vw, 52px);
  display: grid; gap: 22px;
  box-shadow: 0 40px 80px -40px rgb(0 0 0 / .45);
}
.fila { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.campo { position: relative; }
.campo input, .campo select, .campo textarea {
  width: 100%; border: 0; border-bottom: 1px solid var(--arena); background: transparent;
  padding: 26px 0 10px; font-size: 1rem; font-weight: 400; color: var(--tinta); border-radius: 0;
  transition: border-color .3s;
  appearance: none;
}
.campo textarea { resize: vertical; min-height: 90px; }
.campo select { cursor: pointer; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b08a45' stroke-width='1.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 0 bottom 12px / 18px no-repeat; }
.campo label {
  position: absolute; left: 0; top: 26px; font-size: 1rem; color: var(--apagado); pointer-events: none;
  transform-origin: left top; transition: transform .4s var(--curva), color .3s;
}
.campo input:focus, .campo textarea:focus, .campo select:focus { outline: none; border-color: var(--oro); }
.campo input:focus + label, .campo input:not(:placeholder-shown) + label,
.campo textarea:focus + label, .campo textarea:not(:placeholder-shown) + label,
.campo-select label, .campo label.fija { transform: translateY(-22px) scale(.72); color: var(--oro); letter-spacing: .08em; }
.campo::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--oro); transform: scaleX(0); transition: transform .6s var(--curva); }
.campo:focus-within::after { transform: scaleX(1); }
.campo.con-error input { border-color: #b4483b; }
.campo.con-error label { color: #b4483b; }

.campo-grupo { border: 0; }
.campo-grupo legend { font-size: .72rem; letter-spacing: .24em; text-transform: uppercase; color: var(--apagado); margin-bottom: 14px; font-weight: 500; }
.opciones { display: flex; flex-wrap: wrap; gap: 10px; }
.opciones label { position: relative; cursor: pointer; }
.opciones input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.opciones span { display: inline-block; padding: 10px 18px; border: 1px solid var(--arena); border-radius: 999px; font-size: .88rem; transition: background .3s, color .3s, border-color .3s, transform .3s var(--curva); }
.opciones label:hover span { border-color: var(--oro); }
.opciones input:checked + span { background: var(--tinta); color: var(--crema); border-color: var(--tinta); }
.opciones input:focus-visible + span { outline: 2px solid var(--oro); outline-offset: 3px; }
.campo-grupo.compacto .opciones span { padding: 8px 14px; font-size: .82rem; }

.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.consentimiento { display: flex; gap: 12px; align-items: flex-start; font-size: .86rem; color: var(--apagado); cursor: pointer; }
.consentimiento input { width: 18px; height: 18px; accent-color: var(--tinta); margin-top: 3px; flex: none; }
.consentimiento a { color: var(--tinta); }
.formulario-error { color: #b4483b; font-size: .9rem; background: rgb(180 72 59 / .08); padding: 12px 16px; border-radius: 12px; }

.formulario-exito {
  position: absolute; inset: 0; border-radius: inherit; background: var(--crema-clara);
  display: grid; place-content: center; text-align: center; gap: 12px; padding: 40px;
  animation: aparece .6s var(--curva) both; opacity: 0;
}
.formulario-exito[hidden] { display: none; }
.formulario-exito svg { width: 84px; margin: 0 auto 10px; fill: none; stroke: var(--oro); stroke-width: 1.5; }
.formulario-exito circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: traza 1s .2s var(--curva) forwards; }
.formulario-exito path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: traza .6s .9s var(--curva) forwards; }
.formulario-exito h3 { font-size: 2.4rem; }
@keyframes traza { to { stroke-dashoffset: 0; } }

@media (max-width: 960px) {
  .menu {
    position: fixed; inset: 0; z-index: -1; flex-direction: column; justify-content: center; align-items: center; gap: 26px;
    background: var(--crema); clip-path: circle(0 at calc(100% - 44px) 40px); transition: clip-path .9s var(--curva);
  }
  .menu a { font-family: var(--display); font-size: 2.6rem; }
  .menu.abierto { clip-path: circle(150% at calc(100% - 44px) 40px); }
  .hamburguesa { display: block; }
  .cabecera > .boton { display: none; }
}
@media (max-width: 640px) {
  .fila { grid-template-columns: 1fr; }
  .marca img { height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  .revelar, .palabra > span { opacity: 1; transform: none; }
}
