/* Fuentes locales (subset latino, incluye ñ ¡ ¿ á é í ó ú) — funcionan sin internet */
@font-face { font-family: "Anton"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/anton-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 600 700; font-display: swap; src: url(fonts/caveat.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/figtree.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --cream: #f8f0e2;
  --paper: #fffbf3;
  --wine: #7a091e;
  --wine-deep: #4a0614;
  --red: #aa0217;
  --ink: #2a1212;
  --muted: #7a5a52;
  --gold: #fed62f;
  --line: rgba(122, 9, 30, .16);
  --shadow: 0 1px 2px rgba(60, 15, 15, .08), 0 8px 24px -8px rgba(60, 15, 15, .22);
  --display: "Anton", "Impact", sans-serif;
  --script: "Caveat", "Segoe Script", cursive;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(70px + env(safe-area-inset-top, 0px)); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 1rem/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
a, .card__open { touch-action: manipulation; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(1200px, 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)) 10px max(var(--gutter), env(safe-area-inset-left, 0px));
  background: var(--wine); color: var(--cream);
  box-shadow: 0 2px 12px rgba(60, 15, 15, .25);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: .95rem; line-height: 1.15; min-width: 0; }
.brand b { font-weight: 700; color: var(--gold); }
.brand span { overflow: hidden; text-overflow: ellipsis; }
.hat { width: 30px; height: 30px; flex: none; }
.topnav { display: flex; gap: 6px; margin-left: auto; flex: none; }
.topnav a {
  text-decoration: none; font-weight: 700; font-size: .85rem; padding: 8px 13px; border-radius: 999px;
  background: rgba(248, 240, 226, .14); color: var(--cream); transition: background .15s;
}
.topnav a:hover { background: rgba(248, 240, 226, .28); }
.topnav a:last-child { background: var(--gold); color: var(--wine-deep); }
.topnav a:last-child:hover { background: #ffe25c; }
@media (max-width: 520px) {
  .topnav a { padding: 7px 10px; font-size: .8rem; }
  .brand span { font-size: .78rem; }
  .brand b { display: block; }
}

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(900px 400px at 85% 10%, rgba(254, 214, 47, .22), transparent 60%),
    linear-gradient(180deg, var(--wine) 0%, var(--wine-deep) 100%);
  color: var(--cream);
  overflow: hidden;
}
.hero__inner {
  width: min(1200px, 100% - 2 * var(--gutter)); margin-inline: auto;
  display: grid; gap: 28px; align-items: center;
  padding: clamp(32px, 6vw, 72px) 0 clamp(40px, 6vw, 72px);
}
@media (min-width: 900px) { .hero__inner { grid-template-columns: 1.05fr .95fr; gap: 48px; } }

.kicker {
  display: inline-block; margin: 0 0 14px;
  padding: 4px 12px; border-radius: 6px 6px 6px 0;
  background: var(--cream); color: var(--wine);
  font: 700 .8rem/1.4 var(--body); letter-spacing: .12em; text-transform: uppercase;
}
h1 {
  margin: 0; font: 400 clamp(2.6rem, 8.5vw, 5.2rem)/.98 var(--display);
  text-transform: uppercase; letter-spacing: .005em; text-wrap: balance;
}
h1 span { display: block; color: var(--gold); }
.hero__script {
  margin: 14px 0 0; font: 700 clamp(1.5rem, 4vw, 2.1rem)/1.1 var(--script);
  display: inline; background: linear-gradient(transparent 82%, rgba(254, 214, 47, .85) 82% 92%, transparent 92%);
}
.hero__lead { margin: 18px 0 0; max-width: 34em; font-size: 1.05rem; color: rgba(251, 244, 230, .9); }
.hero__lead strong { color: #fff; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 26px; }
.hero__count { font-size: .95rem; color: rgba(251, 244, 230, .85); }
.hero__count b { font: 400 1.6rem/1 var(--display); color: var(--gold); margin-right: 4px; }

.btn {
  display: inline-block; text-decoration: none; font-weight: 700; font-size: 1.05rem;
  padding: 14px 26px; border-radius: 999px; transition: transform .15s ease, box-shadow .15s ease;
}
.btn--gold { background: var(--gold); color: var(--wine-deep); box-shadow: 0 6px 0 #c9a017, 0 10px 20px rgba(0, 0, 0, .25); }
.btn--gold:hover { transform: translateY(-2px); }
.btn--gold:active { transform: translateY(3px); box-shadow: 0 3px 0 #c9a017; }

/* Abanico de fichas */
.hero__stack { position: relative; height: clamp(300px, 62vw, 470px); }
.fan {
  position: absolute; top: 50%; left: 50%; height: 88%; width: auto; aspect-ratio: 2 / 3;
  border-radius: 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, .45); background: var(--paper);
  transform: translate(-50%, -50%);
}
.fan--l { transform: translate(-86%, -48%) rotate(-9deg) scale(.92); }
.fan--r { transform: translate(-14%, -48%) rotate(9deg) scale(.92); }
.fan--c { z-index: 1; }
.sticker {
  position: absolute; z-index: 2; right: 2%; top: 2%;
  padding: 8px 14px; border-radius: 10px; background: var(--gold); color: var(--wine-deep);
  font: 700 1.25rem/1.05 var(--script); text-align: center; transform: rotate(7deg);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
}
@media (min-width: 900px) { .sticker { font-size: 1.6rem; right: 6%; } }

/* ---------- Pasos ---------- */
.steps { background: var(--paper); border-bottom: 1px solid var(--line); }
.steps ul {
  list-style: none; margin: 0 auto; padding: 14px var(--gutter);
  width: min(1200px, 100%); display: grid; gap: 8px;
}
.steps li { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .95rem; }
.steps li span {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--wine); color: var(--cream); font: 700 .85rem/1 var(--body);
}
@media (min-width: 720px) { .steps ul { grid-auto-flow: column; justify-content: space-between; padding-block: 16px; } }

/* ---------- Biblioteca ---------- */
.library { padding: clamp(32px, 5vw, 56px) 0 clamp(48px, 7vw, 88px); }
.library__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 18px; }
.library h2 { margin: 0; font: 400 clamp(1.9rem, 5vw, 2.8rem)/1 var(--display); text-transform: uppercase; color: var(--red); }
.library__head p { margin: 0; color: var(--muted); font-size: .95rem; }

.toolbar { display: grid; gap: 14px; margin-bottom: 24px; }
.search {
  display: flex; align-items: center; gap: 10px; padding: 0 16px; min-height: 50px;
  background: var(--paper); border: 2px solid var(--line); border-radius: 999px; color: var(--wine);
  transition: border-color .15s;
}
.search:focus-within { border-color: var(--wine); }
.search svg { width: 22px; height: 22px; flex: none; }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: 500 1rem var(--body); color: var(--ink); padding: 12px 0;
}
.search input::placeholder { color: #a98d85; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 calc(-1 * var(--gutter)); padding-inline: var(--gutter); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; } }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper);
  font-weight: 600; font-size: .92rem; white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.chip small { font-weight: 700; font-size: .75rem; opacity: .6; }
.chip:hover { border-color: var(--wine); }
.chip[aria-pressed="true"] { background: var(--wine); border-color: var(--wine); color: var(--cream); }
.chip[aria-pressed="true"] small { opacity: .85; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 24px; } }

.card { content-visibility: auto; contain-intrinsic-size: auto 430px; position: relative; display: flex; flex-direction: column; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-4px); }
.card__open { all: unset; cursor: pointer; display: flex; flex-direction: column; flex: 1; }
.card__open:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; border-radius: 14px; }
.card__img { aspect-ratio: 2 / 3; width: 100%; height: auto; object-fit: cover; background: #efe3cc; }
.card__body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.card__meta { display: flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.card__title { margin: 0; font-weight: 700; font-size: 1rem; line-height: 1.25; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 6px; background: var(--wine); color: var(--cream); font: 700 .78rem/1.5 var(--body); letter-spacing: .04em; white-space: nowrap; }

.fav {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255, 251, 243, .92); color: var(--wine); box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transition: transform .15s;
}
.fav:hover { transform: scale(1.1); }
.fav svg { width: 22px; height: 22px; fill: none; }
.fav[aria-pressed="true"] svg, .icon-btn[aria-pressed="true"] svg { fill: currentColor; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 1.05rem; }

/* ---------- Footer ---------- */
.footer { background: var(--wine); color: var(--cream); text-align: center; padding: 36px var(--gutter) calc(44px + env(safe-area-inset-bottom, 0px)); }
.footer p { margin: 0; }
.footer__script { font: 700 clamp(1.7rem, 5vw, 2.4rem)/1.1 var(--script); }
.footer p:last-child { margin-top: 6px; color: var(--gold); font-weight: 600; }

/* ---------- Visor ---------- */
body.no-scroll { overflow: hidden; }
.viewer {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  background: #1e080c; color: var(--cream);
}
.viewer[hidden] { display: none; }
.viewer__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)) 10px max(var(--gutter), env(safe-area-inset-left, 0px)); background: var(--wine-deep); flex: none;
}
.viewer__title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.viewer__title h3 { margin: 0; font: 700 1rem/1.2 var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { flex: none; }
.viewer__title .pill { background: var(--gold); color: var(--wine-deep); }
.viewer__actions { display: flex; gap: 6px; flex: none; }
.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: rgba(251, 244, 230, .12); color: var(--cream); text-decoration: none;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(251, 244, 230, .24); }
.icon-btn svg { width: 22px; height: 22px; fill: none; }
.icon-btn[aria-pressed="true"] { color: var(--gold); }

.viewer__stage {
  flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 12px;
  -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; overscroll-behavior: contain;
}
.viewer__stage img {
  max-width: 100%; max-height: calc(100vh - 100px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); max-height: calc(100dvh - 100px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); width: auto; height: auto; object-fit: contain;
  border-radius: 10px; cursor: zoom-in; background: var(--paper); box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
  user-select: none; -webkit-user-drag: none;
}
.viewer__stage.is-zoomed { place-items: start center; }
.viewer__stage.is-zoomed img { max-width: none; max-height: none; width: 1024px; cursor: zoom-out; flex: none; }

.nav {
  position: absolute; top: 50%; z-index: 2; display: none; place-items: center; width: 52px; height: 52px; margin-top: 10px;
  border: 0; border-radius: 50%; background: rgba(251, 244, 230, .16); color: var(--cream);
  backdrop-filter: blur(6px); transition: background .15s;
}
.nav:hover { background: rgba(251, 244, 230, .3); }
.nav svg { width: 26px; height: 26px; }
.nav--prev { left: 14px; } .nav--next { right: 14px; }
@media (min-width: 720px) { .nav { display: grid; } }
.viewer.is-zoomed .nav { display: none; }

.viewer__hint {
  position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 2; transform: translateX(-50%);
  margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(0, 0, 0, .6);
  font-size: .82rem; font-weight: 600; pointer-events: none; transition: opacity .4s; white-space: nowrap;
}
.viewer__hint.is-hidden { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- PWA: botones, sin internet, guardado offline, avisos ---------- */
.btn { border: 0; font-family: inherit; cursor: pointer; }
.btn--ghost { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 2px rgba(248, 240, 226, .7); }
.btn--ghost:hover { background: rgba(248, 240, 226, .12); }
.btn--ghost[hidden] { display: none; }
.btn--wine { background: var(--wine); color: var(--cream); box-shadow: 0 5px 0 var(--wine-deep); }
.btn--wine:hover { transform: translateY(-2px); }
.btn--wine:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--wine-deep); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }

.net-badge {
  flex: none; padding: 4px 10px; border-radius: 999px;
  background: var(--gold); color: var(--wine-deep); font-size: .75rem; font-weight: 700; white-space: nowrap;
}
.net-badge[hidden] { display: none; }

.offline {
  display: grid; gap: 16px; align-items: center; margin-top: clamp(32px, 5vw, 56px);
  padding: clamp(20px, 4vw, 32px); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow);
  border: 2px dashed var(--line);
}
.offline[hidden] { display: none; }
@media (min-width: 760px) { .offline { grid-template-columns: 1fr auto; gap: 8px 32px; } .offline .progress { grid-column: 1 / -1; } }
.offline h3 { margin: 0 0 4px; font: 400 1.6rem/1.1 var(--display); text-transform: uppercase; color: var(--red); }
.offline p { margin: 0; max-width: 42em; }
.offline__status { margin-top: 6px !important; font-weight: 700; color: var(--wine); min-height: 1.4em; }
.progress { height: 10px; border-radius: 999px; background: rgba(122, 9, 30, .12); overflow: hidden; }
.progress[hidden] { display: none; }
.progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--wine); transition: width .2s; }

.toast {
  position: fixed; z-index: 80; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(440px, calc(100% - 32px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px 12px 18px; border-radius: 14px; background: var(--ink); color: var(--cream);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-weight: 600; font-size: .95rem;
}
.toast[hidden] { display: none; }
.toast button { flex: none; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--gold); color: var(--wine-deep); font-weight: 700; }
.toast button[hidden] { display: none; }

.sheet {
  width: min(420px, calc(100% - 32px)); padding: 24px; border: 0; border-radius: 20px;
  background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.sheet::backdrop { background: rgba(30, 8, 12, .7); }
.sheet h3 { margin: 0 0 12px; font: 400 1.6rem/1.1 var(--display); text-transform: uppercase; color: var(--red); }
.sheet ol { margin: 0 0 20px; padding-left: 1.2em; display: grid; gap: 10px; }
.sheet svg { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -.25em; color: var(--wine); }


/* ---------- Bonos ---------- */
.bonos { padding: clamp(32px, 5vw, 56px) 0 clamp(8px, 2vw, 16px); background: linear-gradient(180deg, #fff3d6 0%, var(--cream) 100%); }
.bonos__head { margin-bottom: 20px; }
.ribbon {
  display: inline-block; margin-bottom: 10px; padding: 3px 12px; border-radius: 6px; background: var(--gold); color: var(--wine-deep);
  font: 700 1.25rem/1.15 var(--script); transform: rotate(-3deg);
}
.bonos h2 { margin: 0; font: 400 clamp(1.9rem, 5vw, 2.8rem)/1 var(--display); text-transform: uppercase; color: var(--red); }
.bonos__head p { margin: 8px 0 0; max-width: 40em; color: var(--muted); }

.bonos__row {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 18px;
}
.bonos__row::-webkit-scrollbar { display: none; }
.bono { flex: 0 0 min(62vw, 230px); scroll-snap-align: start; display: flex; flex-direction: column; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
@media (min-width: 1000px) {
  .bonos__row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; overflow: visible; margin: 0; padding: 4px 0 18px; }
  .bono { flex: none; }
}
.bono__open { all: unset; cursor: pointer; display: flex; flex-direction: column; flex: 1; }
.bono__open:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; border-radius: 14px; }
.bono__img { aspect-ratio: 2 / 3; width: 100%; height: auto; object-fit: cover; background: #efe3cc; transition: transform .3s; }
.bono:hover .bono__img { transform: scale(1.02); }
.bono__body { display: grid; gap: 4px; padding: 12px 14px 12px; }
.bono__body h3 { margin: 4px 0 0; font-weight: 700; font-size: 1.02rem; line-height: 1.2; }
.bono__sub { font-size: .85rem; line-height: 1.35; color: var(--muted); }
.bono__meta { margin-top: 2px; font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--wine); }
.pill--gold { justify-self: start; background: var(--gold); color: var(--wine-deep); }
.bono__extras { display: grid; gap: 8px; padding: 0 14px 14px; margin-top: auto; }
.mini-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--cream); color: var(--wine); font: 700 .85rem/1.2 var(--body); text-decoration: none;
  transition: border-color .15s, background .15s;
}
.mini-btn:hover { border-color: var(--wine); background: #fff; }
.mini-btn svg { width: 18px; height: 18px; flex: none; }
