/*!
 * base.css — Reset, tokens, componentes compartidos (botones, modales,
 * avisos, iconos) y utilidades comunes a la landing, la invitación y el editor.
 */

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--cuerpo, 'Jost', 'Segoe UI', system-ui, sans-serif);
  background: var(--fondo, #faf7f2);
  color: var(--texto, #1f1b16);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 400; line-height: 1.15; }
p { margin: 0; }
figure, blockquote { margin: 0; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--acento, #d9b76b); color: var(--acento-texto, #161104); }

:focus-visible {
  outline: 2px solid var(--acento, #d9b76b);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Tokens por defecto ---------- */
:root {
  --fondo: #faf7f2;
  --fondo-alt: #f2ece1;
  --superficie: #ffffff;
  --texto: #211c16;
  --texto-sutil: #6b5f52;
  --acento: #b06a45;
  --acento-texto: #fffaf4;
  --borde: rgba(33, 28, 22, 0.14);
  --sombra: 0 24px 60px -32px rgba(28, 20, 12, 0.4);
  --radio: 14px;
  --titulo: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --cuerpo: 'Jost', 'Segoe UI', Tahoma, sans-serif;
  --script: 'Great Vibes', 'Segoe Script', cursive;
  --ancho: 1120px;
  --transicion: 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Iconos ---------- */
.iv-icono {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  stroke-width: 1.7;
}

/* ---------- Botones ---------- */
.boton {
  --boton-fondo: transparent;
  --boton-texto: var(--texto);
  --boton-borde: var(--borde);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.92rem 1.6rem;
  border: 1px solid var(--boton-borde);
  border-radius: 999px;
  background: var(--boton-fondo);
  color: var(--boton-texto);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--transicion), background var(--transicion), border-color var(--transicion), box-shadow var(--transicion), opacity var(--transicion);
}

.boton:hover { transform: translateY(-1px); }
.boton:active { transform: translateY(0); }

.boton--acento {
  --boton-fondo: var(--acento);
  --boton-texto: var(--acento-texto);
  --boton-borde: var(--acento);
  box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--acento) 75%, transparent);
}

.boton--fantasma {
  --boton-borde: color-mix(in srgb, var(--texto) 26%, transparent);
  backdrop-filter: blur(6px);
}

.boton--claro {
  --boton-fondo: rgba(255, 255, 255, 0.1);
  --boton-texto: #fff;
  --boton-borde: rgba(255, 255, 255, 0.4);
}

.boton--chico { padding: 0.62rem 1.05rem; font-size: 0.72rem; }
.boton--bloque { width: 100%; }
.boton[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.boton-icono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  border: 1px solid var(--borde);
  color: var(--texto);
  transition: background var(--transicion), border-color var(--transicion), transform var(--transicion);
  flex: none;
}
.boton-icono:hover { background: color-mix(in srgb, var(--texto) 8%, transparent); transform: translateY(-1px); }
.boton-icono .iv-icono { width: 1.15rem; height: 1.15rem; }

/* ---------- Utilidades ---------- */
.contenedor {
  width: 100%;
  max-width: var(--ancho);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}

.solo-lectores {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.iv-sin-scroll { overflow: hidden; }

.revelar {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 700ms ease, transform 700ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}
.revelar.visible { opacity: 1; transform: none; }

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

/* ---------- Avisos (toasts) ---------- */
.iv-toasts {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2600;
  pointer-events: none;
  width: max-content;
  max-width: min(92vw, 30rem);
}

.iv-toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.15rem;
  border-radius: 999px;
  background: #16130f;
  color: #f7f2e8;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 240ms ease, transform 240ms ease;
}

.iv-toast--visible { opacity: 1; transform: none; }
.iv-toast--error { background: #7a1f1f; }
.iv-toast .iv-icono { width: 1rem; height: 1rem; color: var(--acento, #d9b76b); }
.iv-toast--error .iv-icono { color: #fbd3d3; }

/* ---------- Modales ---------- */
.iv-modal {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(10, 8, 6, 0.62);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 220ms ease;
  overflow-y: auto;
}

.iv-modal--visible { opacity: 1; }

.iv-modal__caja {
  position: relative;
  width: min(100%, 34rem);
  max-height: min(88vh, 46rem);
  overflow-y: auto;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  border-radius: calc(var(--radio) + 6px);
  background: var(--superficie, #fff);
  color: var(--texto, #211c16);
  border: 1px solid var(--borde);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.55);
  transform: translateY(14px) scale(0.99);
  transition: transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.iv-modal--visible .iv-modal__caja { transform: none; }

.iv-modal__cerrar {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--texto-sutil);
  transition: background var(--transicion), color var(--transicion);
}
.iv-modal__cerrar:hover { background: color-mix(in srgb, var(--texto) 8%, transparent); color: var(--texto); }

.iv-modal__titulo {
  font-family: var(--titulo);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1.2;
  margin-bottom: 0.35rem;
  padding-right: 2rem;
}

.iv-modal__cuerpo { font-size: 0.95rem; }
.iv-modal__cuerpo p + p { margin-top: 0.8rem; }

/* ---------- Formularios compartidos ---------- */
.campo { display: flex; flex-direction: column; gap: 0.4rem; }
.campo > label,
.campo__etiqueta {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--texto-sutil);
}
.campo__ayuda { font-size: 0.78rem; color: var(--texto-sutil); line-height: 1.45; }

.entrada,
.area,
.seleccion {
  width: 100%;
  padding: 0.78rem 0.95rem;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: color-mix(in srgb, var(--texto) 3%, transparent);
  font-size: 0.95rem;
  transition: border-color var(--transicion), background var(--transicion);
}
.entrada:focus, .area:focus, .seleccion:focus {
  outline: none;
  border-color: var(--acento);
  background: color-mix(in srgb, var(--texto) 1%, transparent);
}
.area { resize: vertical; min-height: 5.5rem; }
.seleccion { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 1.1rem) 55%, calc(100% - 0.75rem) 55%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 2.2rem; }

.etiqueta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--borde);
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transicion), border-color var(--transicion), color var(--transicion);
}
.etiqueta-chip input { position: absolute; opacity: 0; pointer-events: none; }
.etiqueta-chip:has(input:checked) {
  background: var(--acento);
  border-color: var(--acento);
  color: var(--acento-texto);
}
