:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --ink: #1d1b19;
  --muted: #6f6a63;
  --line: #e3ddd4;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px rgb(0 0 0 / .06);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161412;
    --surface: #211e1b;
    --ink: #f3efe9;
    --muted: #a29b91;
    --line: #36312c;
    --accent: #f97316;
    --accent-ink: #1a0f06;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; }
a { color: inherit; }
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 16px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: transform .1s, background .15s;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #dc2626; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

input, textarea, select {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }

/* Portada */
.site-head { padding: 56px 0 32px; }
.site-head h1 { font-size: clamp(32px, 6vw, 56px); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; padding-bottom: 64px; }
.card { text-decoration: none; display: block; }
.card .cover {
  aspect-ratio: 3 / 4; border-radius: 6px 12px 12px 6px; overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow), inset 6px 0 10px -6px rgb(0 0 0 / .3); transition: transform .25s, box-shadow .25s;
}
.card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:hover .cover { transform: translateY(-4px) rotate(-.6deg); }
.card h3 { font-size: 19px; margin-top: 14px; }
.card p { margin: 2px 0 0; font-size: 14px; }
.empty { padding: 64px 0; text-align: center; }

/* Visor */
body.viewer { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.v-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.v-bar h1 { font-size: 18px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; min-height: 0; }
#frame { width: 100%; margin: 0 auto; transform-origin: 0 0; }
#frame.zoom-anim { transition: transform .28s cubic-bezier(.2, .7, .3, 1); }
.v-stage { touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; cursor: default; }
.v-stage.zoomed { cursor: grab; }
.v-stage.zoomed:active { cursor: grabbing; }
.page { background: #fff; overflow: hidden; }
.page img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.hotspot {
  position: absolute; display: block; border-radius: 6px; z-index: 2;
  background: rgb(249 115 22 / .0); outline: 2px solid rgb(249 115 22 / 0); transition: background .2s, outline-color .2s;
}
.hotspot:hover, .show-hotspots .hotspot { background: rgb(249 115 22 / .14); outline-color: rgb(249 115 22 / .85); }
.v-nav { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px 14px; }
.v-count { min-width: 80px; text-align: center; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); }
.icon-btn { width: 40px; height: 40px; padding: 0; }
.icon-btn svg { width: 18px; height: 18px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50;
}
.toast.show { opacity: 1; }
@media (max-width: 600px) {
  .v-bar .hide-sm { display: none; }
}
