/* ====== Tokens ====== */
:root {
  --bg: #0F0E0C;
  --surface: #171512;
  --texto: #EFE9DF;
  --apagado: #8A8272;
  --acento: #D9C7A0;
  --gap: 6px;
  --radio: 4px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}

/* ====== Pantalla de bloqueo ====== */
body.bloqueado .cabecera,
body.bloqueado main { display: none; }

.candado {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}
body.bloqueado .candado { display: flex; }

.candado-titulo {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 340;
  font-size: clamp(1.4rem, 6vw, 2rem);
}

.candado-pin {
  width: 180px;
  padding: 12px 0;
  text-align: center;
  font-size: 28px;
  letter-spacing: 0.5em;
  color: var(--texto);
  background: var(--surface);
  border: 1px solid #2a2620;
  border-radius: var(--radio);
  caret-color: var(--acento);
}
.candado-pin::placeholder { color: #3a352c; letter-spacing: 0.4em; }
.candado-pin:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

.candado-error {
  color: #c96f5e;
  font-size: 14px;
  min-height: 1.2em;
}

.candado-pin.error {
  animation: sacudir 0.35s ease;
  border-color: #c96f5e;
}

@keyframes sacudir {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-5px); }
}

@media (prefers-reduced-motion: reduce) {
  .candado-pin.error { animation: none; }
}

/* ====== Cabecera ====== */
.cabecera {
  padding: clamp(28px, 8vw, 72px) 16px clamp(20px, 5vw, 48px);
  text-align: center;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--apagado);
  margin-bottom: 10px;
}

.titulo {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 340;
  font-size: clamp(2rem, 9vw, 4.2rem);
  line-height: 1.1;
  color: var(--texto);
  letter-spacing: 0.01em;
}

/* Puntos suspensivos que respiran */
.puntos span {
  color: var(--acento);
  animation: respirar 2.4s ease-in-out infinite;
}
.puntos span:nth-child(2) { animation-delay: 0.3s; }
.puntos span:nth-child(3) { animation-delay: 0.6s; }

@keyframes respirar {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

/* ====== Galería: 3 columnas siempre ====== */
.galeria {
  display: flex;
  gap: var(--gap);
  padding: 0 var(--gap) var(--gap);
  max-width: 1200px;
  margin: 0 auto;
  align-items: flex-start;
}

.columna {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.miniatura {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--surface);
  border-radius: var(--radio);
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  animation: aparecer 0.55s ease forwards;
  animation-delay: var(--retraso, 0s);
  -webkit-tap-highlight-color: transparent;
}

.miniatura img {
  display: block;
  width: 100%;
  height: auto;   /* alto libre, nunca se deforma */
}

.miniatura:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

@keyframes aparecer {
  to { opacity: 1; transform: translateY(0); }
}

/* ====== Mensaje carpeta vacía ====== */
.vacio {
  text-align: center;
  padding: 48px 24px;
  color: var(--apagado);
  font-size: 15px;
  line-height: 1.7;
}
.vacio strong { color: var(--acento); font-weight: 600; }

/* ====== Lightbox ====== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 9, 8, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }

.lb-imagen {
  max-width: 100vw;
  max-height: 100dvh;
  width: auto;
  height: auto;
  object-fit: contain;  /* tamaño completo sin deformar */
  user-select: none;
  -webkit-user-drag: none;
}

.lb-cerrar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: 14px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(23, 21, 18, 0.75);
  color: var(--texto);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.lb-flecha {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 64px;
  border: 0;
  background: rgba(23, 21, 18, 0.55);
  color: var(--texto);
  font-size: 30px;
  cursor: pointer;
  border-radius: var(--radio);
}
.lb-prev { left: 8px; }
.lb-next { right: 8px; }

/* En móvil se navega con swipe: flechas fuera */
@media (pointer: coarse) {
  .lb-flecha { display: none; }
}

.lb-cerrar:focus-visible,
.lb-flecha:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

.lb-contador {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--apagado);
}

/* Sin escroll de fondo con lightbox abierto */
body.lb-abierto { overflow: hidden; }

/* ====== Pantallas grandes: más aire ====== */
@media (min-width: 700px) {
  :root { --gap: 10px; }
}

/* ====== Movimiento reducido ====== */
@media (prefers-reduced-motion: reduce) {
  .miniatura { animation: none; opacity: 1; transform: none; }
  .puntos span { animation: none; opacity: 1; }
}
