/* gallery.vabelstudio.com — cara al cliente (hilo galerias). Nació de la maqueta aprobada el 2026-11-13.
   Paleta de Vabel (pedido del usuario). Tipografía de interfaz distinta al sitio (Manrope);
   Cormorant sólo en el nombre de la galería y en los títulos de sección.
   Formas: fotos y paneles rectos; controles y botones en píldora; diálogo con 18 px. */
:root {
  --paper: #faf7f1; --surface: #f2ebdd; --line: #e4dccb;
  --ink: #1a1612; --ink-soft: #4a4337; --ink-mute: #6f675b;
  --gold: #b48a3e; --gold-deep: #8c651f;
  --noir: #18130e; --cream: #f3ead4;
  --bg: var(--paper); --fg: var(--ink); --fg-soft: var(--ink-soft); --fg-mute: var(--ink-mute);
  --bar: rgba(250, 247, 241, .88); --panel: #fffdf8;
  --btn-bg: var(--ink); --btn-fg: var(--paper);
  --shadow: 0 24px 60px -24px rgba(60, 42, 18, .35);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Manrope", -apple-system, "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --pad: clamp(16px, 4vw, 56px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--noir); --fg: var(--cream); --fg-soft: #d8ccb2; --fg-mute: #a99c84; --line: #2f281f;
    --surface: #211b14; --bar: rgba(24, 19, 14, .86); --panel: #211b14;
    --btn-bg: var(--cream); --btn-fg: var(--noir);
    --shadow: 0 24px 60px -24px rgba(0, 0, 0, .7);
  }
}
* { box-sizing: border-box; }
/* `hidden` siempre gana: si no, .btn (display:inline-flex) lo ignora. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-light { display: none; } .logo-dark { display: block; } }

/* ── Botones ─────────────────────────────────────── */
.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 22px; border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-fg); font-weight: 600; font-size: 14px; letter-spacing: .01em; white-space: nowrap;
  transition: transform .2s var(--ease), opacity .2s; }
.btn:active { transform: scale(.98); }
.btn .ph { font-size: 18px; }
.btn-quiet { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.icon-btn { width: 42px; height: 42px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 20px; color: var(--fg); transition: background .2s; }
.icon-btn:hover { background: var(--surface); }

/* ── Portada ─────────────────────────────────────── */
.cover { min-height: 100dvh; display: grid; grid-template-columns: minmax(300px, 5fr) 7fr; align-items: center; gap: clamp(24px, 5vw, 80px);
  padding: clamp(20px, 4vw, 48px) var(--pad); }
.cover-text { display: flex; flex-direction: column; gap: 28px; max-width: 460px; }
.cover-logo { height: 54px; width: auto; }
.cover h1 { font: italic 500 clamp(64px, 9vw, 128px)/1.05 var(--serif); margin: 0; padding-bottom: 6px; letter-spacing: -.01em; }
.cover-sub { margin: -12px 0 0; color: var(--fg-soft); font-size: 16px; }
.cover-note { font-size: 13px; color: var(--fg-mute); margin: 0; }
.cover-photo { justify-self: end; display: flex; justify-content: flex-end; }
/* La foto conserva su proporción: el alto manda y el ancho sale solo. */
.cover-photo img { height: min(86dvh, 980px); width: auto; max-width: 100%; object-fit: contain; }
@media (max-width: 767px) {
  .cover { grid-template-columns: 1fr; min-height: auto; padding: 0 0 40px; gap: 28px; }
  .cover-photo { order: -1; justify-self: stretch; }
  .cover-photo img { width: 100%; height: auto; max-height: none; }
  .cover-text { padding: 0 var(--pad); gap: 22px; max-width: none; }
  .cover-logo { height: 44px; }
}

/* ── Barra fija ──────────────────────────────────── */
.bar { position: sticky; top: 0; z-index: 20; background: var(--bar); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line); }
.bar-in { height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 0 var(--pad); }
.bar-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bar-brand img { height: 30px; width: auto; }
.bar-brand span { font: italic 500 24px/1 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 4px; }
.tab { height: 36px; padding: 0 14px; border-radius: 999px; font-size: 14px; color: var(--fg-soft); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: background .2s, color .2s; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--fg); font-weight: 600; }
.tab small { font-size: 12px; color: var(--fg-mute); font-weight: 500; }
.tab .ph-fill { color: var(--gold); }
.fav-btn { position: relative; display: none; }
.fav-btn em { position: absolute; top: 4px; right: 2px; min-width: 17px; height: 17px; border-radius: 999px; background: var(--gold-deep); color: #fff; font: 600 10.5px/17px var(--sans); text-align: center; padding: 0 4px; font-style: normal; }
.fav-btn em:empty { display: none; }
.fav-btn .ph-fill { color: var(--gold); }
.bar-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
@media (max-width: 899px) {
  .bar-in { grid-template-columns: 1fr auto; height: 60px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad) 10px; }
  .tabs::-webkit-scrollbar { display: none; }
  .bar-in { height: auto; padding-top: 10px; row-gap: 6px; }
  .btn-label { display: none; }
  .fav-btn { display: inline-grid; }
  .tab[data-k="fav"] { display: none; }
  .bar-actions .btn { width: 42px; padding: 0; justify-content: center; }
}

/* ── Galería ─────────────────────────────────────── */
main { padding: 8px var(--pad) 96px; }
.group h2 { font: italic 500 clamp(30px, 3.4vw, 44px)/1.15 var(--serif); margin: 56px 0 18px; padding-bottom: 4px; }
.group:first-child h2 { margin-top: 36px; }
.grid { position: relative; }
.tile { position: absolute; margin: 0; overflow: hidden; background: var(--surface); cursor: zoom-in; }
.tile img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .6s var(--ease), transform .8s var(--ease); }
.tile img.ok { opacity: 1; }
.tile:hover img { transform: scale(1.015); }
.tile-actions { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s var(--ease); }
.tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; transform: none; }
.chip { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; font-size: 19px; background: rgba(250, 247, 241, .92); color: var(--ink); box-shadow: 0 6px 18px -8px rgba(0,0,0,.4); }
.chip:active { transform: scale(.94); }
.chip.on { color: var(--gold-deep); }
.fav-mark { position: absolute; top: 10px; right: 10px; font-size: 20px; color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,.45)); display: none; }
.tile.is-fav .fav-mark { display: block; }
.tile.is-fav:hover .fav-mark { display: none; }
@media (hover: none) { .tile-actions { display: none; } }
.empty { max-width: 420px; margin: 72px auto; text-align: center; color: var(--fg-soft); }
.empty .ph { font-size: 34px; color: var(--gold); }
.empty h3 { font: italic 500 30px/1.2 var(--serif); color: var(--fg); margin: 12px 0 8px; }

/* ── Pie ─────────────────────────────────────────── */
footer { border-top: 1px solid var(--line); padding: 56px var(--pad) 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
footer .left { display: flex; align-items: center; gap: 18px; color: var(--fg-mute); font-size: 13px; }
footer img { height: 40px; width: auto; }

/* ── Visor ───────────────────────────────────────── */
.viewer { position: fixed; inset: 0; z-index: 40; background: var(--noir); color: var(--cream); display: grid; grid-template-rows: 64px 1fr; opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
.viewer.open { opacity: 1; pointer-events: auto; }
.v-top { display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(8px, 2vw, 20px); }
.v-count { font-size: 13px; color: #b9ad94; padding-left: 10px; font-variant-numeric: tabular-nums; }
.v-top .icon-btn { color: var(--cream); }
.v-top .icon-btn:hover { background: rgba(243, 234, 212, .1); }
.v-top .icon-btn.on { color: var(--gold); }
/* La foto ocupa el área disponible con object-fit: contain: siempre entra completa, vertical u horizontal. */
.v-stage { --sx: clamp(8px, 7vw, 96px); --sb: clamp(8px, 3vh, 32px); position: relative; min-height: 0; touch-action: pan-y; }
.v-stage img { position: absolute; top: 0; left: var(--sx); width: calc(100% - 2 * var(--sx)); height: calc(100% - var(--sb)); object-fit: contain; transition: opacity .25s; }
.v-nav { position: absolute; top: 50%; translate: 0 -50%; width: 52px; height: 52px; border-radius: 999px; display: grid; place-items: center; font-size: 24px; color: var(--cream); background: rgba(243, 234, 212, .08); transition: background .2s; }
.v-nav:hover { background: rgba(243, 234, 212, .16); }
.v-prev { left: clamp(8px, 2vw, 24px); } .v-next { right: clamp(8px, 2vw, 24px); }
@media (max-width: 767px) { .v-nav { display: none; } .v-stage { --sx: 0px; --sb: 12px; } }

/* ── Diálogo de descarga ─────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(24, 19, 14, .55); display: grid; place-items: center; padding: 16px; opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.dialog { width: min(480px, 100%); background: var(--panel); color: var(--fg); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); transform: translateY(12px); transition: transform .35s var(--ease); }
.scrim.open .dialog { transform: none; }
.dialog h3 { font: italic 500 34px/1.1 var(--serif); margin: 0 0 22px; display: flex; justify-content: space-between; align-items: center; }
.dialog h3 .icon-btn { font-size: 20px; }
fieldset { border: 0; margin: 0 0 22px; padding: 0; }
legend { font-size: 13px; font-weight: 600; color: var(--fg-soft); margin-bottom: 10px; }
.opt { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .2s, background .2s; }
.opt + .opt { margin-top: 8px; }
.opt input { accent-color: var(--gold-deep); width: 18px; height: 18px; margin: 0; }
.opt:has(input:checked) { border-color: var(--fg); background: var(--surface); }
.opt:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.opt .t { flex: 1; display: flex; flex-direction: column; }
.opt b { font-weight: 600; font-size: 15px; }
.opt span.h { font-size: 13px; color: var(--fg-mute); }
.opt .sz { font-size: 13px; color: var(--fg-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dialog .btn { width: 100%; justify-content: center; height: 50px; }
.dialog .fine { font-size: 12.5px; color: var(--fg-mute); text-align: center; margin: 12px 0 0; }
@media (max-width: 767px) {
  .scrim { place-items: end stretch; padding: 0; }
  .dialog { width: 100%; border-radius: 18px 18px 0 0; padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); transform: translateY(40px); }
}

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 80; translate: -50% 0; background: var(--btn-bg); color: var(--btn-fg); padding: 12px 20px; border-radius: 999px; font-size: 14px; font-weight: 500;
  opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s var(--ease); pointer-events: none; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
  .cover-text > *, .cover-photo { animation: up .9s var(--ease) both; }
  .cover-text > :nth-child(2) { animation-delay: .06s; } .cover-text > :nth-child(3) { animation-delay: .12s; }
  .cover-text > :nth-child(4) { animation-delay: .18s; } .cover-text > :nth-child(5) { animation-delay: .24s; }
  .cover-photo { animation-duration: 1.2s; }
  @keyframes up { from { opacity: 0; transform: translateY(16px); } }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ── Estados: cargando, no existe, vencida ───────── */
.estado { min-height: 100dvh; display: grid; place-items: center; padding: 32px var(--pad); text-align: center; }
.estado-in { max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.estado-in img { height: 64px; width: auto; }
.estado h1 { font: italic 500 clamp(34px, 6vw, 48px)/1.1 var(--serif); margin: 0; padding-bottom: 4px; }
.estado p { margin: 0; color: var(--fg-soft); }
.cargando .estado-in img { animation: latido 1.6s ease-in-out infinite; }
@keyframes latido { 50% { opacity: .35; } }

/* ── PIN en el diálogo ───────────────────────────── */
.pin-field { margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.pin-field label { font-size: 13px; font-weight: 600; color: var(--fg-soft); }
.pin-field input { height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font: 600 18px var(--sans); letter-spacing: .3em; padding: 0 14px; }
.pin-field input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.pin-err { font-size: 13px; color: #b5453a; min-height: 1em; }
.tile .pendiente { position: absolute; left: 8px; bottom: 8px; font-size: 11px; background: rgba(24,19,14,.72); color: var(--cream); padding: 2px 8px; border-radius: 999px; }
.partes { display: flex; flex-direction: column; gap: 8px; }
.partes-t { margin: 0 0 4px; font-size: 13.5px; color: var(--fg-soft); }
.partes .parte { width: 100%; justify-content: flex-start; height: auto; min-height: 50px; padding: 10px 18px; }
.partes .parte span { margin-left: auto; font-weight: 500; color: var(--fg-mute); font-size: 13px; }
