:root {
  --fondo: #faf6f0;
  --papel: #ffffff;
  --tinta: #2f2a26;
  --suave: #7b716a;
  --linea: #e8e0d5;
  --salvia: #6f8065;
  --salvia-osc: #57664f;
  --oro: #b08d57;
  --peligro: #b3473a;
  --sombra: 0 10px 30px rgba(60, 45, 30, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #1d1a17; --papel: #27231f; --tinta: #f1ebe3; --suave: #b1a79d; --linea: #3a342e;
    --salvia: #8fa384; --salvia-osc: #a6b99b; --oro: #cfae78; --sombra: 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fondo: #1d1a17; --papel: #27231f; --tinta: #f1ebe3; --suave: #b1a79d; --linea: #3a342e;
  --salvia: #8fa384; --salvia-osc: #a6b99b; --oro: #cfae78; --sombra: 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta);
  font: 16px/1.5 'Jost', system-ui, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px 40px; flex: 1; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }

.hero { text-align: center; padding: 56px 20px 28px; max-width: 640px; margin: 0 auto; }
.antetitulo { margin: 0; letter-spacing: .28em; text-transform: uppercase; font-size: 12px; color: var(--oro); font-weight: 500; }
.hero h1 { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: clamp(40px, 9vw, 68px); line-height: 1.05; margin: 10px 0 6px; }
.adorno { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--oro); font-size: 14px; }
.adorno span { width: 56px; height: 1px; background: var(--oro); opacity: .6; }
.fecha { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 21px; margin: 8px 0 0; color: var(--suave); }
.fecha:empty, .mensaje:empty { display: none; }
.mensaje { color: var(--suave); margin: 14px auto 0; max-width: 480px; }

.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: 18px; box-shadow: var(--sombra); max-width: 420px; margin: 8px auto 0; padding: 8px 22px 24px; }
.pestanas { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--linea); margin: 0 -22px 18px; }
.pestanas button { background: none; border: 0; padding: 14px 8px; cursor: pointer; color: var(--suave); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pestanas button.activa { color: var(--tinta); border-color: var(--oro); }
.formulario { display: grid; gap: 14px; }
.formulario label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
.formulario input { width: 100%; padding: 13px 14px; border: 1px solid var(--linea); border-radius: 12px; background: var(--fondo); font-size: 16px; }
.formulario input:focus { outline: 2px solid var(--salvia); outline-offset: 1px; border-color: transparent; }
.aviso-error { color: var(--peligro); margin: 0; font-size: 14px; }
.aviso-error:empty { display: none; }
.nota { color: var(--suave); font-size: 14px; margin: 0; }
.centro { text-align: center; margin: 24px 0; }

.boton { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 600; cursor: pointer; transition: transform .15s, background .15s; }
.boton:active { transform: scale(.98); }
.boton.principal { background: var(--salvia); color: #fff; width: 100%; }
.boton.principal:hover { background: var(--salvia-osc); }
.boton:disabled { opacity: .6; cursor: wait; }
.enlace { background: none; border: 0; color: var(--suave); text-decoration: underline; cursor: pointer; padding: 6px; }

.barra { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 14px; }
.hola { margin: 0; color: var(--suave); }
.hola strong { color: var(--tinta); font-weight: 600; }
.subir { position: relative; width: 100%; max-width: 420px; margin: 0 auto; display: flex; background: var(--tinta); color: var(--fondo); font-size: 17px; padding: 17px 22px; box-shadow: var(--sombra); }
.subir input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.subir svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.subir.desactivado { opacity: .5; pointer-events: none; }

.progreso { max-width: 420px; margin: 14px auto 0; }
.progreso-texto { font-size: 14px; color: var(--suave); margin-bottom: 6px; text-align: center; }
.progreso-barra { height: 6px; border-radius: 6px; background: var(--linea); overflow: hidden; }
#progreso-relleno { height: 100%; width: 0; background: var(--salvia); transition: width .3s; }

.filtros { display: flex; gap: 8px; justify-content: center; margin: 26px 0 14px; }
.chip { border: 1px solid var(--linea); background: var(--papel); border-radius: 999px; padding: 8px 16px; cursor: pointer; font-size: 14px; }
.chip.activa { background: var(--tinta); color: var(--fondo); border-color: var(--tinta); }
.chip span { opacity: .7; }

.grilla { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
@media (min-width: 640px) { .grilla { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
@media (min-width: 960px) { .grilla { grid-template-columns: repeat(5, 1fr); } }
.grilla button { position: relative; aspect-ratio: 1; padding: 0; border: 0; background: var(--linea); cursor: pointer; overflow: hidden; border-radius: 4px; }
.grilla img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s, transform .3s; }
.grilla img.lista { opacity: 1; }
.grilla button:hover img { transform: scale(1.03); }
.cargando { text-align: center; color: var(--suave); padding: 22px; }

.visor { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
.visor[open] { display: flex; flex-direction: column; }
.visor::backdrop { background: #000; }
.visor-arriba { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px calc(10px) 16px; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; }
.visor-arriba p { margin: 0; font-size: 14px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visor-acciones { display: flex; gap: 4px; flex-shrink: 0; }
.icono { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.1); border: 0; color: #fff; cursor: pointer; }
.icono svg, .flecha svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.visor-foto { flex: 1; position: relative; display: grid; place-items: center; min-height: 0; touch-action: pan-y; }
.visor-foto img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.flecha { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.flecha.izq { left: 10px; } .flecha.der { right: 10px; }
@media (hover: none) { .flecha { display: none; } }

.pie { text-align: center; color: var(--suave); font-size: 13px; padding: 24px 16px 32px; }
.pie a { color: var(--suave); }
