/* Estilos comunes a la página del invitado y al panel. */
:root {
  --fondo: #f6f2ec;
  --superficie: #fffdf9;
  --superficie-2: #efe9e0;
  --texto: #221d18;
  --texto-suave: #6b6158;
  --borde: #e2d9cc;
  --acento: #2f4a3a;
  --acento-hover: #253b2e;
  --acento-texto: #ffffff;
  --acento-suave: #e3ebe4;
  --oro: #b08a4a;
  --peligro: #a8322d;
  --peligro-suave: #f7e3e1;
  --exito: #2e7d4f;
  --sombra: 0 1px 2px rgba(34, 29, 24, .06), 0 8px 24px rgba(34, 29, 24, .08);
  --radio: 14px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #161412;
    --superficie: #1f1c19;
    --superficie-2: #2a2622;
    --texto: #f2ece4;
    --texto-suave: #a89e93;
    --borde: #37312b;
    --acento: #8fb59a;
    --acento-hover: #a3c4ac;
    --acento-texto: #10140f;
    --acento-suave: #233229;
    --oro: #d4b072;
    --peligro: #e2756e;
    --peligro-suave: #3a201e;
    --exito: #6cc290;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  background: var(--fondo);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }
a { color: var(--acento); }
img, video { max-width: 100%; display: block; }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 600 15px/1 var(--sans);
  letter-spacing: .02em;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.boton:active { transform: scale(.98); }
.boton:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.boton svg { width: 20px; height: 20px; flex: none; }
.boton.primario { background: var(--acento); color: var(--acento-texto); }
.boton.primario:hover:not(:disabled) { background: var(--acento-hover); }
.boton.secundario { background: var(--superficie); color: var(--texto); border-color: var(--borde); }
.boton.secundario:hover:not(:disabled) { border-color: var(--texto-suave); }
.boton.peligro { background: var(--peligro); color: #fff; }
.boton.fantasma { background: transparent; color: var(--texto); }
.boton.fantasma:hover:not(:disabled) { background: var(--superficie-2); }
.boton.pequeno { min-height: 36px; padding: 0 14px; font-size: 14px; }
.boton.icono { width: 44px; min-height: 44px; padding: 0; }
.boton.ancho { width: 100%; }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.campo > span, .etiqueta { font-size: 14px; font-weight: 600; }
.campo small { color: var(--texto-suave); font-size: 13px; }
input[type="text"], input[type="password"], input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--borde);
  background: var(--superficie);
  color: var(--texto);
  font: 16px var(--sans);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus, .boton:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

/* Interruptor sí/no */
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; cursor: pointer; }
.interruptor .textos { display: flex; flex-direction: column; }
.interruptor .textos small { color: var(--texto-suave); font-size: 13px; }
.interruptor input { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--borde); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.interruptor input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.interruptor input:checked { background: var(--acento); }
.interruptor input:checked::after { transform: translateX(18px); }

/* ---------- Mensajes ---------- */
.aviso { padding: 12px 14px; border-radius: 12px; background: var(--superficie-2); color: var(--texto); font-size: 14px; }
.aviso.error { background: var(--peligro-suave); color: var(--peligro); }
.aviso.exito { background: var(--acento-suave); color: var(--acento); }

#avisos { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { background: var(--texto); color: var(--fondo); padding: 12px 16px; border-radius: 12px; box-shadow: var(--sombra); font-size: 14px; animation: aparecer .2s ease-out; }
.toast.error { background: var(--peligro); color: #fff; }
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Ventanas (dialog) ---------- */
dialog { border: none; padding: 0; color: var(--texto); background: var(--superficie); }
dialog::backdrop { background: rgba(20, 16, 12, .55); backdrop-filter: blur(2px); }

.caja-dialogo { width: min(440px, calc(100vw - 32px)); border-radius: 18px; box-shadow: var(--sombra); }
.caja-dialogo .cuerpo { padding: 24px; }
.caja-dialogo h2 { font-size: 26px; margin-bottom: 8px; }
.caja-dialogo p { color: var(--texto-suave); margin: 0 0 16px; }
.caja-dialogo .botones { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Visor de fotos/vídeos ---------- */
.visor { width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #0c0b0a; color: #fff; }
.visor[open] { display: flex; flex-direction: column; }
.visor-barra { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.visor-barra .info { flex: 1; min-width: 0; font-size: 14px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visor .boton.fantasma { color: #fff; }
.visor .boton.fantasma:hover { background: rgba(255,255,255,.1); }
.visor-medio { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; touch-action: pan-y; }
.visor-medio img, .visor-medio video { max-width: 100%; max-height: 100%; object-fit: contain; }
.visor-flecha { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.4); border: none; color: #fff; width: 48px; height: 48px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.visor-flecha svg { width: 24px; height: 24px; }
.visor-flecha.izq { left: 12px; }
.visor-flecha.der { right: 12px; }
.visor-pie { display: flex; gap: 8px; justify-content: center; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
.visor-pie .boton.secundario { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }
@media (hover: none) { .visor-flecha { display: none; } }

/* ---------- Cuadrícula del álbum ---------- */
.rejilla { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
@media (min-width: 640px) { .rejilla { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
@media (min-width: 1000px) { .rejilla { grid-template-columns: repeat(6, 1fr); } }
.celda { position: relative; aspect-ratio: 1; border: none; padding: 0; margin: 0; background: var(--superficie-2); cursor: pointer; overflow: hidden; border-radius: 4px; }
.celda img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.celda:hover img { transform: scale(1.03); }
.celda .sin-mini { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--texto-suave); }
.celda .sin-mini svg { width: 32px; height: 32px; }
.celda .marca-video { position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; }
.celda .marca-video svg { width: 14px; height: 14px; }

.vacio { text-align: center; color: var(--texto-suave); padding: 40px 16px; }
.vacio svg { width: 40px; height: 40px; margin: 0 auto 8px; display: block; opacity: .6; }

.girando { width: 22px; height: 22px; border: 3px solid var(--borde); border-top-color: var(--acento); border-radius: 50%; animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
