:root {
  --paper: #f5f3ef;
  --paper-2: #ebe7e0;
  --ink: #1b1a18;
  --ink-2: #5d5a54;
  --ink-3: #8f8b83;
  --line: #dcd7ce;
  --heart: #c8402b;
  --heart-soft: #f6dcd6;
  --ok: #2f6b4a;
  --radius: 10px;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ── Cabecera ── */
.masthead { text-align: center; padding: 44px 16px 26px; }
.wordmark {
  font-family: var(--serif);
  letter-spacing: .32em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--ink-2);
}
.client-name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1.05;
  margin: 18px 0 10px;
  letter-spacing: -.01em;
}
.subline { color: var(--ink-2); margin: 0; }
.message {
  max-width: 560px; margin: 18px auto 0; color: var(--ink-2);
  white-space: pre-line; font-size: 15px;
}

.wrap { padding: 0 16px; max-width: 1800px; margin: 0 auto; }

/* ── Avisos ── */
.notice {
  max-width: 720px; margin: 0 auto 22px; padding: 14px 18px;
  border-radius: var(--radius); background: #fff; border: 1px solid var(--line);
  display: flex; gap: 12px; align-items: center; font-size: 14px;
}
.notice .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }

/* ── Secciones ── */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 8px 0 14px;
}
.section-head h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 0; }
.section-head p { margin: 0; color: var(--ink-2); font-size: 14px; }
.finals { margin-bottom: 56px; }

/* ── Filtros ── */
.toolbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; justify-content: center; gap: 6px; padding: 10px 16px; margin: 0 -16px 12px;
  border-bottom: 1px solid transparent;
}
.toolbar.stuck { border-bottom-color: var(--line); }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 7px 16px; font-size: 14px; color: var(--ink-2);
  transition: background .15s, color .15s, border-color .15s;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .n { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* ── Cuadrícula justificada ── */
.grid { display: flex; flex-direction: column; gap: 6px; padding-bottom: 120px; }
.row { display: flex; gap: 6px; }
.tile {
  position: relative; flex: none; overflow: hidden; border-radius: 3px;
  background: var(--paper-2);
}
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in;
  opacity: 0; transition: opacity .3s ease;
}
.tile img.loaded { opacity: 1; }
.tile .fname {
  position: absolute; left: 8px; bottom: 6px; font-size: 11px; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.6); opacity: 0; transition: opacity .15s; pointer-events: none;
}
.tile:hover .fname { opacity: .95; }

.heart {
  position: absolute; right: 6px; bottom: 6px; width: 40px; height: 40px;
  border: 0; border-radius: 50%; display: grid; place-items: center;
  background: rgba(20,20,20,.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: transform .12s ease, background .15s;
}
.heart svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; transition: fill .15s, stroke .15s; }
.heart:active { transform: scale(.88); }
.tile.on .heart { background: #fff; }
.tile.on .heart svg { fill: var(--heart); stroke: var(--heart); }
.tile.on { outline: 3px solid var(--heart); outline-offset: -3px; }
.tile.on img { opacity: .92; }
@media (hover: hover) {
  .heart { opacity: .0; }
  .tile:hover .heart, .tile.on .heart { opacity: 1; }
}
@media (hover: none) {
  .heart { opacity: 1; }
}

.final-tile .dl {
  position: absolute; right: 6px; bottom: 6px; width: 40px; height: 40px;
  border-radius: 50%; background: rgba(255,255,255,.94);
  display: grid; place-items: center; color: var(--ink);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.final-tile .dl svg { width: 18px; height: 18px; }

.empty { text-align: center; color: var(--ink-2); padding: 60px 16px 140px; }

/* ── Barra inferior ── */
.dock {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 30; display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: var(--paper); border-radius: 999px;
  padding: 8px 8px 8px 20px; box-shadow: 0 10px 30px rgba(0,0,0,.18);
  width: max-content; max-width: calc(100vw - 24px);
}
.dock .count { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dock .count svg { width: 18px; height: 18px; fill: var(--heart); }
.dock .count small { color: #b9b4ab; font-size: 13px; }
.dock .count.over small { color: #ffb4a6; }
.btn {
  border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 600; font-size: 14px;
  background: var(--paper); color: var(--ink); white-space: nowrap;
  text-decoration: none; display: inline-block;
  transition: transform .12s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.heart-btn { background: var(--heart); color: #fff; }

.saving { font-size: 12px; color: #b9b4ab; }

/* ── Visor ── */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: #0e0e0d; color: #eee;
  display: grid; grid-template-rows: auto 1fr auto;
  touch-action: pan-y;
}
.lb-top, .lb-bottom { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; gap: 12px; }
.lb-info { font-size: 13px; color: #aaa; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stage { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 0; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; transition: opacity .2s; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.08); display: grid; place-items: center;
}
.lb-nav:hover { background: rgba(255,255,255,.16); }
.lb-nav svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 2; }
.lb-prev { left: 14px; } .lb-next { right: 14px; }
@media (max-width: 700px) { .lb-nav { display: none; } }
.icon-btn { border: 0; background: transparent; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.icon-btn:hover { background: rgba(255,255,255,.08); }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.lb-heart {
  display: flex; align-items: center; gap: 10px; border: 1px solid #444; background: transparent; color: #eee;
  border-radius: 999px; padding: 10px 20px 10px 16px; font-size: 15px;
}
.lb-heart svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.lb-heart.on { background: var(--heart); border-color: var(--heart); color: #fff; }
.lb-heart.on svg { fill: #fff; stroke: #fff; }
.lb-dl { display: flex; align-items: center; gap: 8px; text-decoration: none; border: 1px solid #444; border-radius: 999px; padding: 10px 18px; font-size: 14px; }

/* ── Modales ── */
.modal-bg {
  position: fixed; inset: 0; z-index: 60; background: rgba(20,18,15,.45);
  display: grid; place-items: center; padding: 16px;
}
.modal {
  background: var(--paper); border-radius: 14px; width: min(520px, 100%); padding: 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: calc(100vh - 32px); overflow: auto;
}
.modal h3 { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 0 0 8px; }
.modal p { color: var(--ink-2); margin: 0 0 14px; }
.modal .strip { display: flex; gap: 4px; overflow: hidden; margin: 14px 0; height: 54px; }
.modal .strip img { height: 54px; width: auto; border-radius: 3px; }
.modal .warn { background: var(--heart-soft); color: #7a2a1c; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.modal textarea, .modal input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff;
  font: inherit; resize: vertical;
}
.modal label { display: block; font-size: 13px; color: var(--ink-2); margin: 14px 0 6px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

/* ── Pantallas (contraseña / error / carga) ── */
.screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; text-align: center; }
.screen .box { width: min(380px, 100%); }
.screen h1 { font-family: var(--serif); font-weight: 400; font-size: 34px; margin: 18px 0 8px; }
.screen p { color: var(--ink-2); }
.screen form { display: flex; gap: 8px; margin-top: 18px; }
.screen input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px; font: inherit; background: #fff; min-width: 0; }
.err { color: var(--heart); font-size: 14px; min-height: 20px; margin-top: 10px; }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 80;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

footer.foot { text-align: center; color: var(--ink-3); font-size: 13px; padding: 10px 16px 130px; }
footer.foot a { color: var(--ink-2); }

@media (max-width: 600px) {
  .masthead { padding-top: 30px; }
  .dock { padding-left: 16px; gap: 10px; }
  .btn { padding: 10px 16px; }
  .heart { width: 36px; height: 36px; right: 4px; bottom: 4px; }
  .heart svg { width: 18px; height: 18px; }
  .grid, .row { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
