/* =====================================================================
   Promoción 87 · San Juan de la Libertad — sistema visual
   Concho de vino + oro: los colores de las Bodas de Rubí.
   ===================================================================== */

@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces.woff2') format('woff2-variations');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-italic.woff2') format('woff2-variations');
  font-weight: 100 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('../fonts/instrument-sans.woff2') format('woff2-variations');
  font-weight: 400 700; font-style: normal; font-display: swap;
}

:root {
  --vino-950: #170308;
  --vino-900: #24060d;
  --vino-800: #360914;
  --vino-700: #4d0e1d;
  --vino-600: #6a1428;
  --rubi: #9b1b30;
  --rubi-vivo: #c8324a;
  --oro: #c9a24b;
  --oro-claro: #ecd494;
  --oro-palido: #f5e6bd;
  --oro-oscuro: #8a6a25;
  --crema: #f8f0e0;
  --crema-2: #dccbb2;
  --papel: #f7f1e5;
  --papel-2: #efe6d4;
  --tinta: #2b1216;
  --tinta-2: #6b5257;
  --verde: #2f7d57;
  --ambar: #b9770e;
  --rojo: #b3261e;

  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --radio: 14px;
  --radio-s: 9px;
  --suave: cubic-bezier(.22, .8, .24, 1);
  --rebote: cubic-bezier(.34, 1.56, .64, 1);
  --sombra: 0 1px 2px rgba(43, 18, 22, .06), 0 8px 28px -12px rgba(43, 18, 22, .22);
  --sombra-alta: 0 30px 80px -30px rgba(10, 2, 4, .7);
  --borde-oro: linear-gradient(135deg, #8a6a25, #ecd494 30%, #b88f3c 55%, #f5e6bd 78%, #8a6a25);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--sans); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg, video, canvas { display: block; max-width: 100%; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--oro); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--oro); color: var(--vino-900); }

.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Temas ---------- */
.tema-vino {
  background: var(--vino-900); color: var(--crema);
  --fondo: var(--vino-900); --superficie: rgba(255, 244, 224, .045); --linea: rgba(236, 212, 148, .22);
  --texto: var(--crema); --texto-2: var(--crema-2); --campo: rgba(10, 2, 4, .35); --acento: var(--oro-claro);
}
.tema-papel {
  background: var(--papel); color: var(--tinta);
  --fondo: var(--papel); --superficie: #fffaf0; --linea: rgba(77, 14, 29, .14);
  --texto: var(--tinta); --texto-2: var(--tinta-2); --campo: #fffdf8; --acento: var(--rubi);
}

/* Textura de fondo: damasco apenas insinuado + grano */
.tema-vino::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(200, 50, 74, .28), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(201, 162, 75, .12), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23ecd494' stroke-opacity='.045' stroke-width='1'%3E%3Cpath d='M48 6c10 12 10 24 0 36-10-12-10-24 0-36zM48 54c10 12 10 24 0 36-10-12-10-24 0-36zM6 48c12-10 24-10 36 0-12 10-24 10-36 0zM54 48c12-10 24-10 36 0-12 10-24 10-36 0z'/%3E%3Ccircle cx='48' cy='48' r='3'/%3E%3Ccircle cx='0' cy='0' r='5'/%3E%3Ccircle cx='96' cy='0' r='5'/%3E%3Ccircle cx='0' cy='96' r='5'/%3E%3Ccircle cx='96' cy='96' r='5'/%3E%3C/g%3E%3C/svg%3E");
}
.tema-vino > * { position: relative; z-index: 1; }

/* ---------- Tipografía ---------- */
.rotulo {
  font-family: var(--sans); font-size: .74rem; font-weight: 600; letter-spacing: .26em; text-transform: uppercase;
  color: var(--acento);
}
.titulo { font-family: var(--serif); font-weight: 380; line-height: 1.04; letter-spacing: -.02em; font-variation-settings: 'opsz' 144; }
.titulo em { font-style: italic; font-weight: 320; color: var(--oro-claro); }
.tema-papel .titulo em { color: var(--rubi); }
.dorado {
  background: linear-gradient(100deg, #b88f3c, #f5e6bd 28%, #c9a24b 52%, #f8eecb 74%, #a57f31);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cifra { font-variant-numeric: tabular-nums lining-nums; font-feature-settings: 'tnum', 'lnum'; }

/* ---------- Botones ---------- */
.btn {
  --alto: 52px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: var(--alto); padding: 0 1.5em; border: 0; border-radius: 999px;
  font-weight: 600; font-size: 1rem; letter-spacing: .01em; text-decoration: none; white-space: nowrap;
  transition: transform .25s var(--suave), box-shadow .25s var(--suave), background-color .2s, color .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-busy='true'] { opacity: .55; pointer-events: none; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.btn-oro {
  color: var(--vino-900);
  background: linear-gradient(180deg, #f5e6bd, #d8b560 55%, #b88f3c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -2px 0 rgba(90, 60, 10, .35), 0 10px 30px -12px rgba(201, 162, 75, .7);
}
.btn-oro:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(90, 60, 10, .35), 0 16px 36px -12px rgba(201, 162, 75, .85); }
.btn-vino { color: var(--crema); background: linear-gradient(180deg, var(--rubi), var(--vino-600)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 10px 24px -12px rgba(106, 20, 40, .8); }
.btn-vino:hover { transform: translateY(-2px); }
.btn-linea { color: var(--texto); background: transparent; box-shadow: inset 0 0 0 1.5px var(--linea); }
.btn-linea:hover { box-shadow: inset 0 0 0 1.5px var(--acento); color: var(--acento); }
.btn-texto { min-height: 44px; padding: 0 .4em; background: none; color: var(--acento); border-radius: 8px; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: .25em; }
.btn-texto:hover { text-decoration-color: currentColor; }
.btn-peligro { color: #fff; background: var(--rojo); }
.btn-chico { --alto: 40px; font-size: .92rem; padding: 0 1.1em; }
.btn-bloque { width: 100%; }
.btn .giro, .giro {
  width: 1.1em; height: 1.1em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: giro .7s linear infinite; display: none;
}
.btn[aria-busy='true'] .giro { display: inline-block; }
@keyframes giro { to { transform: rotate(360deg); } }

/* ---------- Campos ---------- */
.campo { display: grid; gap: .4rem; }
.campo > label, .campo > .etiqueta { font-size: .9rem; font-weight: 600; color: var(--texto-2); }
.campo .ayuda { font-size: .84rem; color: var(--texto-2); }
.entrada, .campo input:not([type='checkbox']):not([type='radio']):not([type='file']), .campo select, .campo textarea {
  width: 100%; min-height: 52px; padding: .7rem 1rem; border-radius: var(--radio-s);
  border: 1.5px solid var(--linea); background: var(--campo); color: var(--texto);
  transition: border-color .2s, box-shadow .2s, background-color .2s; appearance: none; -webkit-appearance: none;
}
.campo textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.campo select {
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' fill='none' stroke='%23b88f3c' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m1 1 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center;
}
.tema-vino .campo select option { background: var(--vino-800); color: var(--crema); }
.campo input::placeholder, .campo textarea::placeholder { color: var(--texto-2); opacity: .6; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .entrada:focus {
  outline: none; border-color: var(--oro); box-shadow: 0 0 0 4px rgba(201, 162, 75, .22);
}
.campo.invalido input, .campo.invalido select, .campo.invalido textarea { border-color: var(--rubi-vivo); }
.campo .error { font-size: .86rem; color: #ff9aa8; font-weight: 500; }
.tema-papel .campo .error { color: var(--rojo); }
.tema-vino input[type='date'] { color-scheme: dark; }
.fila-campos { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.con-icono { position: relative; }
.con-icono input { padding-right: 3.2rem !important; }
.con-icono .ojo {
  position: absolute; right: 4px; bottom: 4px; width: 44px; height: 44px; border: 0; background: none; border-radius: 8px;
  display: grid; place-items: center; color: var(--texto-2);
}
.con-icono .ojo svg { width: 22px; height: 22px; }

/* Opciones tipo pastilla (radio) */
.pastillas { display: flex; flex-wrap: wrap; gap: .5rem; }
.pastillas label { position: relative; cursor: pointer; }
.pastillas input { position: absolute; opacity: 0; inset: 0; }
.pastillas span {
  display: inline-flex; align-items: center; gap: .5em; min-height: 46px; padding: 0 1.1em; border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--linea); font-weight: 600; font-size: .95rem; transition: all .2s var(--suave);
}
.pastillas input:checked + span { background: var(--acento); color: var(--fondo); box-shadow: none; }
.tema-papel .pastillas input:checked + span { color: #fff; }
.pastillas input:focus-visible + span { outline: 2px solid var(--oro); outline-offset: 3px; }
.pastillas input:disabled + span { opacity: .4; cursor: not-allowed; }

/* ---------- Avisos ---------- */
.aviso {
  display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1.1rem; border-radius: var(--radio-s);
  font-size: .95rem; border: 1px solid var(--linea); background: var(--superficie);
}
.aviso svg { flex: none; width: 22px; height: 22px; margin-top: 1px; }
.aviso.error { border-color: rgba(200, 50, 74, .6); background: rgba(200, 50, 74, .14); }
.aviso.bien { border-color: rgba(47, 125, 87, .5); background: rgba(47, 125, 87, .12); }
.aviso.alerta { border-color: rgba(185, 119, 14, .5); background: rgba(185, 119, 14, .12); }

.brindis {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 300; transform: translate(-50%, 30px);
  max-width: min(92vw, 520px); padding: .9rem 1.3rem; border-radius: 14px; font-weight: 500; font-size: .97rem;
  background: var(--vino-800); color: var(--crema); box-shadow: 0 0 0 1px rgba(236, 212, 148, .35), var(--sombra-alta);
  opacity: 0; transition: transform .45s var(--rebote), opacity .3s; pointer-events: none; display: flex; gap: .7rem; align-items: center;
}
.brindis.visible { opacity: 1; transform: translate(-50%, 0); }
.brindis.error { background: #5b0f14; box-shadow: 0 0 0 1px rgba(255, 150, 160, .5), var(--sombra-alta); }
.brindis::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--oro-claro); flex: none; }
.brindis.error::before { background: #ff9aa8; }

/* ---------- Diálogo ---------- */
dialog.modal {
  width: min(94vw, 560px); max-height: min(90dvh, 860px); padding: 0; border: 0; border-radius: 20px; overflow: hidden;
  background: var(--papel); color: var(--tinta); box-shadow: var(--sombra-alta);
}
dialog.modal.ancho { width: min(96vw, 860px); }
dialog.modal::backdrop { background: rgba(23, 3, 8, .72); backdrop-filter: blur(6px); }
dialog.modal[open] { animation: modal-entra .4s var(--suave); display: flex; flex-direction: column; }
dialog.modal[open]::backdrop { animation: aparecer .3s; }
@keyframes modal-entra { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes aparecer { from { opacity: 0; } }
.modal-cabeza { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.4rem .9rem; border-bottom: 1px solid var(--linea); }
.modal-cabeza h2 { font-family: var(--serif); font-weight: 420; font-size: 1.45rem; line-height: 1.15; }
.modal-cuerpo { padding: 1.3rem 1.4rem; overflow: auto; display: grid; gap: 1.1rem; overscroll-behavior: contain; }
.modal-pie { display: flex; gap: .7rem; justify-content: flex-end; flex-wrap: wrap; padding: 1rem 1.4rem calc(1rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--linea); background: var(--papel-2); }
.cerrar {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: inherit;
  transition: background-color .2s, transform .3s var(--suave);
}
.cerrar:hover { background: rgba(77, 14, 29, .09); transform: rotate(90deg); }
.cerrar svg { width: 20px; height: 20px; }
@media (max-width: 600px) {
  dialog.modal, dialog.modal.ancho { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  dialog.modal[open] { animation: hoja-sube .45s var(--suave); }
  @keyframes hoja-sube { from { transform: translateY(100%); } }
  .modal-pie .btn { flex: 1; }
}

/* ---------- Varios ---------- */
.avatar {
  --t: 44px; width: var(--t); height: var(--t); flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  font-family: var(--serif); font-size: calc(var(--t) * .4); font-weight: 500; color: var(--oro-palido);
  background: linear-gradient(140deg, var(--rubi), var(--vino-700)); box-shadow: 0 0 0 1.5px var(--oro);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.filete { height: 1px; border: 0; background: linear-gradient(90deg, transparent, var(--oro) 20%, var(--oro-claro) 50%, var(--oro) 80%, transparent); opacity: .7; }

.aparece { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--suave), transform .9s var(--suave); transition-delay: var(--d, 0s); }
.aparece.visto { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .aparece { opacity: 1; transform: none; }
}

.pastillas svg { width: 1.25em; height: 1.25em; flex: none; }
.pastillas span { white-space: nowrap; }
