/* ---------- Tipografías autoalojadas (ver fonts/LICENSES.txt) ---------- */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/bricolage-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/bricolage-latin.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: "Chango";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/chango-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Chango";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/chango-latin.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 {
  --bg: #0b0b14;
  --surface: #151524;
  --surface-2: #1e1e33;
  --text: #f2f2f8;
  --muted: #9a9ab5;
  --accent: #ffcb05;
  --accent-2: #7c5cff;
  --danger: #ff5470;
  --ok: #3ddc97;
  --radius: 16px;

  --poke-blue: #3466af;
  --poke-blue-dark: #2a4b9b;
  --poke-red: #ee1515;
  /* Colores de tipo de energía (chips y etiquetas de categoría) */
  --type-fire: #f5793b;
  --type-water: #4a9eea;
  --type-grass: #5dbb63;
  --type-electric: #ffcb05;
  --type-psychic: #d06bd6;
  --font-display: "Chango", "Arial Black", system-ui, sans-serif;

  --line: rgba(255, 255, 255, .08);
  --holo: linear-gradient(115deg, #ff6ad5 0%, #ffcb05 18%, #3ddc97 36%, #3ec7ff 54%, #7c5cff 72%, #ff6ad5 90%);
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 16px;
  --max: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 76px;   /* los anclas aterrizan bajo la cabecera fija */
  scrollbar-gutter: stable;   /* al bloquear el scroll con el detalle abierto, la página no salta */
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html.modal-open { overflow: hidden; } /* la página de fondo no se desplaza tras el detalle */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23ffffff' stroke-opacity='.05' stroke-width='3'%3E%3Ccircle cx='50' cy='50' r='46'/%3E%3Cpath d='M4 50h30M66 50h30'/%3E%3Ccircle cx='50' cy='50' r='15'/%3E%3Ccircle cx='50' cy='50' r='7'/%3E%3C/svg%3E") no-repeat right -160px top 40px / 520px,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23ffffff' stroke-opacity='.035' stroke-width='3'%3E%3Ccircle cx='50' cy='50' r='46'/%3E%3Cpath d='M4 50h30M66 50h30'/%3E%3Ccircle cx='50' cy='50' r='15'/%3E%3Ccircle cx='50' cy='50' r='7'/%3E%3C/svg%3E") no-repeat left -140px top 900px / 380px,
    radial-gradient(70% 45% at 90% -5%, rgba(52, 102, 175, .35), transparent 70%),
    radial-gradient(50% 35% at -10% 15%, rgba(238, 21, 21, .12), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  overflow-x: clip; /* clip (no hidden): no crea contenedor de scroll ni rompe el sticky */
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--gutter); top: -60px; z-index: 50;
  background: var(--accent); color: #111; padding: 10px 14px; border-radius: 10px; font-weight: 700;
}
.skip:focus { top: 10px; }

/* ---------- Poké Ball (dibujada en CSS) ---------- */
.pokeball {
  --size: 28px;
  display: inline-block; flex: none; vertical-align: middle;
  width: var(--size); height: var(--size); border-radius: 50%;
  border: calc(var(--size) * .07) solid #111;
  background:
    radial-gradient(circle, #fff 0 14%, #111 15% 23%, transparent 24%),
    linear-gradient(to bottom, var(--poke-red) 0 45%, #111 45% 55%, #f4f4f4 55%);
  box-shadow: inset calc(var(--size) * -.08) calc(var(--size) * -.08) 0 rgba(0, 0, 0, .18);
}
.pokeball.spin { --size: 18px; margin-right: 6px; animation: spin 1s cubic-bezier(.5, .1, .5, .9) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Rotulación estilo Pokémon ---------- */
.poke-title {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--accent);
  letter-spacing: .02em;
  line-height: 1;
  -webkit-text-stroke: .1em var(--poke-blue-dark);
  paint-order: stroke fill;
  text-shadow: .05em .07em 0 var(--poke-blue-dark), .05em .09em 0 #16285a;
}

.divider {
  display: flex; align-items: center; gap: 14px;
  max-width: var(--max); margin: 8px auto; padding: 0 var(--gutter);
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .18));
}
.divider::after { background: linear-gradient(-90deg, transparent, rgba(255, 255, 255, .18)); }
.divider .pokeball { --size: 26px; }
.featured .divider { padding: 0; margin-top: 18px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px var(--gutter);
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(11, 11, 20, .72);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { --size: 32px; transform: rotate(-20deg); border-color: #000; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-text strong {
  font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; letter-spacing: .03em;
  color: var(--accent); -webkit-text-stroke: .09em var(--poke-blue-dark); paint-order: stroke fill;
}
.brand-text span { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-ig {
  flex: none; font-size: .88rem; font-weight: 600; text-decoration: none;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
}
.header-ig:hover { border-color: rgba(255, 255, 255, .25); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px;
  border: 0; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: 1rem; text-decoration: none;
  transition: transform .15s ease, filter .15s ease, background-color .15s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { cursor: not-allowed; opacity: .4; filter: grayscale(1); }
.btn-primary { background: var(--accent); color: #14110a; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-ig { background: linear-gradient(100deg, #7c5cff, #d946ef 55%, #ff7a59); color: #fff; }
.btn-wa { background: var(--ok); color: #062517; }

/* ---------- Hero ---------- */
.hero {
  --px: 0; --py: 0;
  position: relative;
  max-width: var(--max); margin: 0 auto;
  padding: 36px var(--gutter) 28px;
  display: grid; gap: 28px;
}
.hero-title {
  font-size: clamp(1.8rem, 9.4vw, 4rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
  transform: rotate(-3deg);
  transform-origin: left center;
  padding: .08em 0 .12em;
}
.hero-lead { margin-top: 18px; max-width: 34ch; font-size: 1.08rem; color: #d6d6e6; }
.hero-stat {
  margin-top: 14px; display: inline-flex; align-items: center; gap: 8px;
  font-size: .9rem; color: var(--muted);
}
.hero-stat::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 4px rgba(61, 220, 151, .18);
}
.hero-copy .btn { margin-top: 22px; display: flex; width: fit-content; }

.hero-fan {
  position: relative; height: 210px;
  perspective: 900px;
}
.fan-card.ph {
  position: absolute; left: 50%; top: 50%;
  width: 128px; height: auto; aspect-ratio: 8 / 11;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .12) inset;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.fan-card img {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%;
  object-fit: contain; border-radius: inherit;
  opacity: 0; transition: opacity .6s ease;
}
.fan-card.has-img img { opacity: 1; }
.fan-card.has-img .pokeball { visibility: hidden; }
/* brillo holográfico que sigue al puntero sobre el abanico */
.fan-card.ph::after { z-index: 2; inset: 0; border: 0; border-radius: inherit;
  background:
    radial-gradient(circle at calc(50% + var(--px) * 160%) calc(40% + var(--py) * 160%), rgba(255, 255, 255, .45), transparent 45%),
    var(--holo);
  background-size: 100% 100%, 300% 300%;
  background-position: 0 0, calc(50% + var(--px) * 200%) 50%;
  mix-blend-mode: color-dodge; opacity: .35;
}
.fan-card:nth-child(1) { transform: translate(-50%, -50%) translateX(calc(-78px + var(--px) * -18px)) rotate(-16deg) rotateY(calc(var(--px) * 30deg)); }
.fan-card:nth-child(2) { transform: translate(-50%, -50%) translateY(calc(-8px + var(--py) * -14px)) rotateX(calc(var(--py) * -24deg)) rotateY(calc(var(--px) * 30deg)); z-index: 2; }
.fan-card:nth-child(3) { transform: translate(-50%, -50%) translateX(calc(78px + var(--px) * 18px)) rotate(16deg) rotateY(calc(var(--px) * 30deg)); }

/* ---------- Placeholder (sin foto) ---------- */
.ph {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 100%;
  color: rgba(255, 255, 255, .9);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 14px),
    radial-gradient(120% 80% at 50% 0%, #2c2552, #141326 70%);
}
.ph::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--holo); background-size: 300% 300%;
  mix-blend-mode: color-dodge; opacity: .22;
}
.ph::after {
  content: ""; position: absolute; inset: 9px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  pointer-events: none;
}
.ph .pokeball { --size: 58px; filter: drop-shadow(0 0 16px rgba(238, 21, 21, .35)); }
.d-media .ph .pokeball { --size: 110px; }
.ph-label { font-size: .78rem; font-weight: 600; color: rgba(242, 242, 248, .75); letter-spacing: .02em; padding: 0 12px; text-align: center; }
.fan-card.ph::before { opacity: .4; }
.fan-card.ph { background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .06) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .06) 0 1px, transparent 1px 12px),
    radial-gradient(120% 80% at 50% 0%, var(--poke-blue), #142041 75%); }
.fan-card .pokeball { --size: 46px; }

/* ---------- Sections ---------- */
.featured, .catalog { max-width: var(--max); margin: 0 auto; padding: 20px var(--gutter); }
.section-title { font-size: 1.9rem; transform: rotate(-1.5deg); transform-origin: left; }

.row {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(62vw, 240px); gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  margin: 14px calc(var(--gutter) * -1) 0; padding: 6px var(--gutter) 18px;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent;
}
.row > li { scroll-snap-align: start; }

.catalog { padding-bottom: 56px; }
.catalog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.count { color: var(--muted); font-size: .9rem; }

.toolbar { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
.field input, .field select {
  width: 100%; min-height: 48px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  font-size: 1rem;
}
.field input::placeholder { color: var(--muted); }
.search input {
  padding-left: 44px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9ab5' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px 50% / 20px;
}
.sort select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9ab5' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 18px;
}
.sort option { background: var(--surface); }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.chips {
  display: flex; gap: 8px; overflow-x: auto;
  margin: 12px calc(var(--gutter) * -1) 0; padding: 4px var(--gutter) 6px;
  scrollbar-width: none; overscroll-behavior-x: contain;
  padding-right: 36px;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); /* difuminado: hay más a la derecha */
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 8px 16px; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: .92rem; font-weight: 600; color: #d6d6e6;
}
[data-cat] { --type: #f2f2f8; }
[data-cat="carta"] { --type: var(--type-psychic); }
[data-cat="sobre"] { --type: var(--type-fire); }
[data-cat="caja"] { --type: var(--type-water); }
[data-cat="gradeada"] { --type: var(--type-electric); }
[data-cat="otro"] { --type: var(--type-grass); }
.chip { display: inline-flex; align-items: center; gap: 8px; }
.chip::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  background: var(--type); box-shadow: 0 0 0 2px rgba(255, 255, 255, .15), 0 0 10px var(--type);
}
.chip[data-cat="todo"]::before { width: 13px; height: 13px; background: linear-gradient(var(--poke-red) 0 44%, #111 44% 56%, #fff 56%); }
.chip:hover { border-color: var(--type); }
.chip[aria-pressed="true"] {
  color: #0b0b14; border-color: transparent; background: var(--type);
}
.chip[aria-pressed="true"]::before { box-shadow: 0 0 0 2px rgba(11, 11, 20, .5); background: #fff; }
.chip[data-cat="todo"][aria-pressed="true"]::before { background: linear-gradient(var(--poke-red) 0 44%, #111 44% 56%, #fff 56%); }

.grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  margin-top: 16px;
}

/* ---------- Product card ---------- */
.card {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none;
  text-align: left; cursor: pointer; perspective: 800px;
  -webkit-tap-highlight-color: transparent;
}
.card-tilt {
  position: relative; display: flex; flex-direction: column; height: 100%;
  border-radius: var(--radius); overflow: hidden;
  /* marco amarillo de carta */
  padding: 6px;
  background: linear-gradient(160deg, #ffe680, #f4b800 35%, #ffd94d 60%, #d69a00);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), box-shadow .3s ease;
  will-change: transform;
}
.card.is-active .card-tilt {
  transition: transform .08s linear, box-shadow .3s ease;
  box-shadow: 0 22px 50px rgba(0, 0, 0, .55), 0 0 40px rgba(255, 203, 5, .22);
}
.card:focus-visible { outline: none; }
.card:focus-visible .card-tilt { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Proporción de los escaneos de carta (600x825 = 8:11, ~63:88): se ven enteros, sin recorte. */
.card-art {
  position: relative; display: block; aspect-ratio: 8 / 11;
  background: var(--surface-2); overflow: hidden;
  border-radius: 9px; box-shadow: 0 0 0 2px rgba(90, 60, 0, .55);
}
.card-art img { width: 100%; height: 100%; object-fit: cover; }

.card-body {
  display: flex; flex-direction: column; gap: 3px; flex: 1;
  margin-top: 6px; padding: 9px 10px 11px;
  background: var(--surface); border-radius: 9px;
}
.card-cat { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--muted); }
.card-cat::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--type); }
.card-name {
  font-size: .95rem; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-price { margin-top: auto; padding-top: 6px; font-size: 1.1rem; font-weight: 800; color: var(--accent); white-space: nowrap; }

/* Holo glare: brillo blanco que sigue al puntero + lámina iridiscente */
.card-glare {
  position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  opacity: 0; transition: opacity .35s ease;
  background:
    radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 42%);
  mix-blend-mode: soft-light;
}
.card-glare::before {
  content: ""; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(115deg, transparent 0 6%, rgba(255, 255, 255, .12) 7% 8%, transparent 9% 14%),
    var(--holo);
  background-size: 100% 100%, 300% 300%;
  background-position: 0 0, var(--mx) var(--my);
  mix-blend-mode: color-dodge; opacity: .55;
}
.card.is-active .card-glare { opacity: 1; }
.card.is-tapped .card-glare { animation: tap-flash .7s ease-out; }
@keyframes tap-flash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }

/* Destacados: marco holográfico en lugar de amarillo */
.card.is-featured .card-tilt {
  background: var(--holo); background-size: 300% 300%;
  animation: holo-shift 8s linear infinite;
}
@keyframes holo-shift { to { background-position: 300% 0; } }

.badge {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  padding: 4px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; line-height: 1.3;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.badge-out { background: var(--poke-red); color: #fff; }
.badge-last { background: var(--accent); color: #14110a; box-shadow: 0 0 0 2px var(--poke-blue-dark); }
.badge-few { background: var(--poke-blue); color: #fff; }

.card.is-out .card-tilt { background: linear-gradient(160deg, #707088, #45455a); animation: none; }
.card.is-out .card-art > :not(.badge) { filter: grayscale(1) brightness(.55); }
.card.is-out .card-body { opacity: .6; }
.card.is-out .card-price { color: var(--muted); text-decoration: line-through; }

/* ---------- Skeleton / states ---------- */
.skeleton { border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; padding-bottom: 14px; }
.sk-art, .sk-line {
  display: block;
  background: linear-gradient(100deg, var(--surface-2) 30%, #2a2a45 50%, var(--surface-2) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.sk-art { aspect-ratio: 8 / 11; }
.sk-line { height: 12px; margin: 12px 12px 0; border-radius: 6px; }
.sk-line.short { width: 40%; height: 16px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.state {
  margin-top: 16px; padding: 36px 20px; text-align: center;
  border: 1px dashed rgba(255, 255, 255, .14); border-radius: var(--radius);
  display: grid; justify-items: center; gap: 8px; color: var(--muted);
}
.state[hidden] { display: none; }
.state-title { color: var(--text); font-weight: 700; font-size: 1.15rem; }
.state .btn { margin-top: 10px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px var(--gutter) max(28px, env(safe-area-inset-bottom));
  text-align: center; display: grid; gap: 10px;
}
.site-footer a { font-weight: 700; color: var(--accent); }
.disclaimer { max-width: 60ch; margin: 0 auto; font-size: .8rem; color: var(--muted); }

/* ---------- Dialog (hoja inferior en móvil) ---------- */
dialog {
  padding: 0; border: 0; color: var(--text); background: transparent;
  width: 100%; max-width: 100%; max-height: 94dvh;
  margin: auto 0 0;
  overflow: visible;
}
dialog:focus-visible { outline: none; }
dialog::backdrop { background: rgba(5, 5, 12, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog[open] { animation: sheet-in .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
.d-inner {
  position: relative;
  max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 0 0 1px var(--line) inset, 0 -20px 60px rgba(0, 0, 0, .5);
  padding-bottom: env(safe-area-inset-bottom);
}
.d-close {
  position: absolute; right: 12px; top: 12px; z-index: 3;
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(11, 11, 20, .7); color: var(--text);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.d-close:hover { background: rgba(11, 11, 20, .9); }
.d-media { aspect-ratio: 1 / 1; max-height: 52dvh; width: 100%; background: var(--surface-2); overflow: hidden; }
.d-media img { width: 100%; height: 100%; object-fit: contain; }
.d-media .ph-label { font-size: .95rem; }
.d-info { padding: 20px 20px 24px; display: grid; gap: 8px; }
.d-cat { font-size: .85rem; color: var(--muted); }
#d-name { font-size: 1.5rem; line-height: 1.15; font-weight: 800; letter-spacing: -.015em; overflow-wrap: anywhere; }
.d-price { font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.d-stock { font-weight: 600; font-size: .95rem; }
.d-stock.is-ok { color: var(--ok); }
.d-stock.is-few { color: var(--text); }
.d-stock.is-last { color: var(--accent); }
.d-stock.is-out { color: var(--danger); }
.d-desc { color: #d6d6e6; white-space: pre-line; max-width: 60ch; overflow-wrap: anywhere; }
.d-actions { display: grid; gap: 10px; margin-top: 12px; }
.d-note { font-size: .82rem; color: var(--muted); }

/* ---------- Cartas de la expansión ---------- */
.d-set { padding: 4px 20px 28px; border-top: 1px solid var(--line); }
.d-set h3 { margin: 22px 0 6px; font-size: 1.45rem; }
.set-note { font-size: .85rem; color: var(--muted); }
.set-meta { margin-top: 10px; font-size: .9rem; font-weight: 600; }
.d-set.is-loading .set-meta { color: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 12px; }
.set-card {
  display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  aspect-ratio: 8 / 11; border-radius: 6px; overflow: hidden; background: var(--surface-2);
  transition: transform .15s ease;
}
.set-card:hover { transform: translateY(-2px); }
.set-card img { width: 100%; height: 100%; object-fit: contain; }
.set-more { width: 100%; margin-top: 14px; }
.d-zoom {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 24px;
  border: 0; cursor: zoom-out; background: rgba(5, 5, 12, .9);
}
.d-zoom[hidden] { display: none; }
.d-zoom img { max-height: 88dvh; max-width: 100%; width: auto; aspect-ratio: 8 / 11; object-fit: contain; border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 100;
  width: max-content; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: .95rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Pantallas muy estrechas: el abanico del hero no debe salirse del ancho */
@media (max-width: 359px) {
  .fan-card:nth-child(1) { transform: translate(-50%, -50%) translateX(calc(-62px + var(--px) * -18px)) rotate(-16deg) rotateY(calc(var(--px) * 30deg)); }
  .fan-card:nth-child(3) { transform: translate(-50%, -50%) translateX(calc(62px + var(--px) * 18px)) rotate(16deg) rotateY(calc(var(--px) * 30deg)); }
}

/* ---------- Wider screens ---------- */
@media (min-width: 560px) {
  .toolbar { grid-template-columns: 1fr 240px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
}
@media (min-width: 760px) {
  :root { --gutter: 28px; }
  .hero { grid-template-columns: 1.3fr 1fr; align-items: center; padding-top: 72px; padding-bottom: 56px; }
  .hero-fan { height: 340px; }
  .fan-card.ph { width: 190px; }
  .hero-title { font-size: clamp(2.6rem, 6.2vw, 4.6rem); }
  .fan-card:nth-child(1) { transform: translate(-50%, -50%) translateX(calc(-130px + var(--px) * -24px)) rotate(-16deg) rotateY(calc(var(--px) * 30deg)); }
  .fan-card:nth-child(3) { transform: translate(-50%, -50%) translateX(calc(130px + var(--px) * 24px)) rotate(16deg) rotateY(calc(var(--px) * 30deg)); }
  .section-title { font-size: 2rem; }
  .chips { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; -webkit-mask-image: none; mask-image: none; }
  .row { margin-inline: 0; padding-inline: 0; grid-auto-columns: 240px; }

  dialog { margin: auto; width: min(920px, 92vw); }
  .d-inner { display: grid; grid-template-columns: 1fr 1fr; border-radius: 24px; max-height: 88vh; max-height: 88dvh; }
  .d-media { aspect-ratio: auto; max-height: none; height: 100%; min-height: 420px; }
  .d-info { padding: 36px 32px; align-content: center; }
  #d-name { font-size: 1.9rem; }
  .d-actions { grid-template-columns: 1fr 1fr; }
  .d-set { grid-column: 1 / -1; padding: 4px 32px 32px; }
  .set-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  @keyframes sheet-in { from { transform: scale(.96); opacity: 0; } }
}

/* Móvil / táctil: sin inclinación, sin blur ni animaciones de repintado que den tirones al hacer scroll. */
@media (hover: none), (pointer: coarse) {
  .card-tilt { will-change: auto; }
  .card.is-featured .card-tilt { animation: none; }
  .card:not(.is-tapped) .card-glare { display: none; }
  .badge { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .site-header { background: rgba(11, 11, 20, .94); backdrop-filter: none; -webkit-backdrop-filter: none; }
  dialog::backdrop { background: rgba(5, 5, 12, .85); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card-tilt, .fan-card { will-change: auto; }
}
