/* =============================================================
   POKÉDEX — Design system (light)
   Display: Archivo Black · UI: Inter · Data/labels: JetBrains Mono
   ============================================================= */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  /* surfaces */
  --bg: #ffffff;
  --surface: #f7f6f3;
  --surface-2: #efeee9;
  --card: #ffffff;
  --line: #e6e3dd;
  --line-strong: #d3cfc7;

  /* ink — all pass 4.5:1 on white except --ink-faint (decorative only) */
  --ink: #14141a;
  --ink-2: #3d3d46;
  --ink-dim: #66666f;
  --ink-faint: #9b9ba3;

  /* brand */
  --accent: #d80032;
  --accent-hover: #b30029;
  --accent-soft: #ffeef1;
  --accent-line: #ffc9d3;
  --on-accent: #ffffff;

  /* type identities — one hue each; chips derive tint + dark ink via color-mix */
  --t-normal: #7a7a6e;   --t-fire: #e2571f;     --t-water: #1f74d0;
  --t-electric: #c99700; --t-grass: #2f9140;    --t-ice: #0f8fa3;
  --t-fighting: #c0392b; --t-poison: #9b2fb0;   --t-ground: #b0761f;
  --t-flying: #5a6fd0;   --t-psychic: #d81b60;  --t-bug: #6f8f14;
  --t-rock: #8c7a2e;     --t-ghost: #6a45ab;    --t-dragon: #4b32c9;
  --t-dark: #5b4a3d;     --t-steel: #4f6b7a;    --t-fairy: #c43d84;

  /* TCG energy */
  --e-grass: #3aa14b; --e-fire: #e2571f; --e-water: #1f74d0;
  --e-lightning: #d4a600; --e-psychic: #a44bb8; --e-fighting: #b5651d;
  --e-darkness: #3f4a52; --e-metal: #6b7f8c; --e-fairy: #d2559c;
  --e-dragon: #9a7d1f; --e-colorless: #9c9c94;

  /* geometry & motion */
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 26px;
  --sp: 8px;
  --shadow-sm: 0 1px 2px rgba(20,20,26,.05);
  --shadow-md: 0 8px 24px -12px rgba(20,20,26,.22);
  --shadow-lg: 0 32px 64px -24px rgba(20,20,26,.32);
  --ease: cubic-bezier(.2,.8,.25,1);

  --maxw: 1280px;
  --pad: clamp(20px, 5vw, 64px);
  --header-h: 68px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.06; }
p { margin: 0; }
dl, dd, dt { margin: 0; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

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

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 500;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

.display { font-family: 'Archivo Black', 'Inter', sans-serif; font-weight: 400; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* =============================================================
   Header
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 300;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 0 var(--pad);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(180deg, var(--accent) 0 50%, #fff 50% 100%);
  border: 2px solid var(--ink);
  position: relative; flex-shrink: 0;
}
.brand-mark::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 7px; height: 7px; border-radius: 50%;
  background: #fff; border: 2px solid var(--ink);
}
.brand-text {
  font-family: 'Archivo Black', sans-serif;
  font-size: 19px; letter-spacing: -.02em; color: var(--ink);
}

.main-nav { display: flex; gap: 4px; }
.main-nav a {
  position: relative;
  display: inline-flex; align-items: center; height: 40px; padding: 0 14px;
  font-size: 14.5px; font-weight: 500; color: var(--ink-dim);
  border-radius: var(--r-sm);
  transition: color .18s var(--ease), background .18s var(--ease);
}
.main-nav a:hover { color: var(--ink); background: var(--surface); }
.main-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.main-nav a[aria-current="page"]::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px;
  height: 2px; background: var(--accent); border-radius: 2px;
}

.nav-toggle {
  display: none; width: 44px; height: 44px; border-radius: var(--r-sm);
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s var(--ease), opacity .2s; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

.mobile-nav {
  position: sticky; top: var(--header-h); z-index: 290;
  display: flex; flex-direction: column;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 8px var(--pad) 14px;
}
.mobile-nav a {
  display: flex; align-items: center; min-height: 48px;
  font-size: 16px; font-weight: 500; color: var(--ink-dim);
  border-bottom: 1px solid var(--line);
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

@media (max-width: 780px) {
  .main-nav { display: none; }
  .nav-toggle { display: flex; }
}
@media (min-width: 781px) {
  .mobile-nav { display: none !important; }
}

/* =============================================================
   Hero
   ============================================================= */
.hero {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) var(--pad) clamp(28px, 4vw, 44px);
}
.hero-alt { border-bottom: none; }

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.hero-title {
  font-family: 'Archivo Black', sans-serif; font-weight: 400;
  font-size: clamp(38px, 7.2vw, 82px);
  letter-spacing: -.035em; color: var(--ink);
}

.hero-sub {
  max-width: 56ch; margin-top: 20px;
  font-size: clamp(15.5px, 1.6vw, 18px); line-height: 1.6; color: var(--ink-dim);
}

.hero-search {
  position: relative; display: flex; align-items: center;
  max-width: 620px; margin-top: 32px;
}
.search-icon {
  position: absolute; left: 20px; width: 20px; height: 20px;
  color: var(--ink-faint); pointer-events: none;
}
.hero-search input {
  width: 100%; height: 60px;
  padding: 0 52px 0 52px;
  background: var(--bg);
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  font-size: 16px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.hero-search input::placeholder { color: var(--ink-faint); }
.hero-search input:focus {
  outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(20,20,26,.07);
}
.hero-search input::-webkit-search-cancel-button { display: none; }

.input-clear {
  position: absolute; right: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2);
  font-size: 20px; line-height: 1;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.input-clear:hover { background: var(--ink); color: #fff; }

.hero-stats {
  display: flex; flex-wrap: wrap; gap: clamp(24px, 5vw, 56px);
  margin-top: 40px; padding-top: 26px;
  border-top: 1px solid var(--line);
}
.hstat dt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim);
}
.hstat dd {
  font-family: 'Archivo Black', sans-serif;
  font-size: clamp(24px, 3vw, 32px); letter-spacing: -.03em; color: var(--ink); margin-top: 4px;
}

/* =============================================================
   Browse: toolbar + filters
   ============================================================= */
.browse {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(20px, 3vw, 32px) var(--pad) 0;
}

.toolbar {
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.filter-block { display: flex; flex-direction: column; gap: 10px; }
.filter-block-inline { flex-direction: row; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim);
}
.chip-group { display: flex; flex-wrap: wrap; gap: 7px; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px; padding: 0 14px;
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  transition: border-color .16s var(--ease), background .16s var(--ease), color .16s var(--ease);
}
.chip-btn:hover { border-color: var(--ink); color: var(--ink); }
.chip-btn.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--ink-faint)); flex-shrink: 0; }
.chip-btn.is-active .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.25); }

.select-field { display: flex; flex-direction: column; gap: 6px; }
.select-field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim);
}
.select-field select {
  min-height: 40px; padding: 0 34px 0 12px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366666f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: 14px; color: var(--ink);
  appearance: none; -webkit-appearance: none; cursor: pointer;
  max-width: 240px;
}
.select-field select:hover { border-color: var(--ink); }
.select-field select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20,20,26,.07); }

/* results bar */
.results-bar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding: 24px 2px 16px;
}
.results-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; letter-spacing: .04em; color: var(--ink-dim);
}
.results-count b { color: var(--ink); font-weight: 700; }
.results-tools { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 40px; height: 24px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  position: relative; flex-shrink: 0;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease);
}
.switch input:checked ~ .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked ~ .switch-track .switch-thumb { transform: translateX(16px); }
.switch input:focus-visible ~ .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-label { font-size: 14px; color: var(--ink-2); }

/* active filters */
.active-filters-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; padding: 0 2px 18px;
}
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.active-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 0 8px 0 13px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--accent-hover);
  transition: background .16s var(--ease);
}
.active-chip:hover { background: #ffdde4; }
.active-chip .x {
  width: 18px; height: 18px; border-radius: 50%; background: rgba(216,0,50,.14);
  display: grid; place-items: center; font-size: 13px; line-height: 1;
}
.link-btn {
  font-size: 13.5px; font-weight: 600; color: var(--ink-dim);
  text-decoration: underline; text-underline-offset: 3px; padding: 6px 2px;
  transition: color .16s var(--ease);
}
.link-btn:hover { color: var(--accent); }

/* =============================================================
   Pokémon grid
   ============================================================= */
.poke-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
@media (min-width: 560px) {
  .poke-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

.poke-card {
  position: relative; display: flex; flex-direction: column;
  text-align: left; width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 12px 12px 14px;
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.poke-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.poke-card:active { transform: translateY(-1px); }

.card-frame {
  position: relative; aspect-ratio: 1/1; overflow: hidden;
  border-radius: var(--r-md); background: var(--surface);
  margin-bottom: 12px;
}
.card-img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s var(--ease); }
.poke-card:hover .card-img { transform: scale(1.05); }

.card-dex {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,.92); color: var(--ink-2);
  padding: 3px 8px; border-radius: 999px;
  backdrop-filter: blur(4px);
}

.card-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface);
  color: var(--ph, var(--ink-faint));
}
.card-placeholder svg { width: 36%; max-width: 56px; opacity: .32; }
.card-placeholder span {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint);
}

.card-name {
  font-family: 'Archivo Black', sans-serif; font-weight: 400;
  font-size: 17px; letter-spacing: -.02em; color: var(--ink);
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}
.card-types { display: flex; flex-wrap: wrap; gap: 5px; }

/* type chips — tint bg + darkened ink from one hue, always ≥4.5:1 */
.type-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  background: color-mix(in srgb, var(--t) 12%, #fff);
  color: color-mix(in srgb, var(--t) 80%, #000);
  border: 1px solid color-mix(in srgb, var(--t) 24%, #fff);
}
.type-chip.solid {
  background: var(--t); color: #fff; border-color: transparent;
  padding: 5px 12px; font-size: 12px;
}

.t-normal{--t:var(--t-normal);}   .t-fire{--t:var(--t-fire);}
.t-water{--t:var(--t-water);}     .t-electric{--t:var(--t-electric);}
.t-grass{--t:var(--t-grass);}     .t-ice{--t:var(--t-ice);}
.t-fighting{--t:var(--t-fighting);} .t-poison{--t:var(--t-poison);}
.t-ground{--t:var(--t-ground);}   .t-flying{--t:var(--t-flying);}
.t-psychic{--t:var(--t-psychic);} .t-bug{--t:var(--t-bug);}
.t-rock{--t:var(--t-rock);}       .t-ghost{--t:var(--t-ghost);}
.t-dragon{--t:var(--t-dragon);}   .t-dark{--t:var(--t-dark);}
.t-steel{--t:var(--t-steel);}     .t-fairy{--t:var(--t-fairy);}

/* =============================================================
   Empty state & pagination
   ============================================================= */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 80px 20px; text-align: center;
}
.empty-title { font-family: 'Archivo Black', sans-serif; font-size: 22px; letter-spacing: -.02em; }
.empty-sub { color: var(--ink-dim); font-size: 15px; margin-bottom: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; border: 1.5px solid transparent;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.btn-solid { background: var(--ink); color: #fff; }
.btn-solid:hover { background: var(--accent); }
.btn-outline { border-color: var(--line-strong); color: var(--ink); background: var(--bg); }
.btn-outline:hover { border-color: var(--ink); }

.pagination {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px;
  padding: 44px 0 clamp(60px, 8vw, 90px);
}
.page-btn {
  min-width: 44px; height: 44px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--bg); color: var(--ink-2);
  font-family: 'JetBrains Mono', monospace; font-size: 13.5px;
  transition: border-color .16s var(--ease), background .16s var(--ease), color .16s var(--ease);
}
.page-btn:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.page-btn.is-active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }
.page-btn svg { width: 16px; height: 16px; }
.page-ellipsis { color: var(--ink-faint); padding: 0 4px; font-family: 'JetBrains Mono', monospace; }

/* =============================================================
   TCG card grid
   ============================================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: clamp(14px, 2vw, 22px);
}
@media (min-width: 560px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
}

.tcg-item {
  display: flex; flex-direction: column; gap: 10px;
  text-align: left; width: 100%;
  transition: transform .2s var(--ease);
}
.tcg-item:hover { transform: translateY(-4px); }
.tcg-thumb {
  position: relative; aspect-ratio: 245/342; border-radius: var(--r-md);
  background: var(--surface); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s var(--ease);
}
.tcg-item:hover .tcg-thumb { box-shadow: var(--shadow-md); }
.tcg-thumb img { width: 100%; height: 100%; object-fit: contain; }
.tcg-thumb.is-loading::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -60% 0; } }

.tcg-meta { display: flex; flex-direction: column; gap: 3px; }
.tcg-name {
  font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.tcg-set {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tcg-rarity {
  font-size: 11px; font-weight: 600; color: var(--ink-dim);
  display: inline-flex; align-items: center; gap: 5px;
}
.tcg-rarity::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--rar, var(--ink-faint)); }
.tcg-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 700; color: var(--ink);
  margin-top: 2px; font-variant-numeric: tabular-nums;
}

/* =============================================================
   Espacios publicitarios (AdSense)
   La altura se reserva de antemano para que el anuncio no empuje
   el contenido al cargar (evita el salto de layout / CLS).
   ============================================================= */
.ad-slot {
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 var(--pad);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.browse > .ad-slot { padding: 0; }

.ad-slot:not(.is-filled) { margin-block: clamp(28px, 4vw, 44px); }
.ad-slot.is-filled { margin-block: clamp(28px, 4vw, 44px); }

.ad-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint);
}

.ad-body {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

/* alturas reservadas por formato horizontal responsive */
.ad-horizontal .ad-body { min-height: 100px; }
@media (min-width: 560px)  { .ad-horizontal .ad-body { min-height: 90px; } }
@media (min-width: 1024px) { .ad-horizontal .ad-body { min-height: 90px; } }

/* recuadro de referencia mientras no hay IDs configurados */
.ad-slot.is-placeholder .ad-body {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 10px, var(--bg) 10px, var(--bg) 20px);
  color: var(--ink-faint);
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .06em;
  text-align: center; padding: 12px;
}

/* banners propios: la imagen manda la altura. Con width/height en el <img>
   el navegador deduce la proporción y reserva el hueco antes de descargarla,
   así que no hace falta la altura mínima del formato horizontal. */
.ad-slot.has-banner .ad-body { min-height: 0; }
.ad-banner {
  display: block; width: 100%; height: auto;
  border-radius: var(--r-md);
}
.ad-banner-link {
  display: block; width: 100%;
  line-height: 0;                 /* sin el hueco de línea base bajo la imagen */
  border-radius: var(--r-md);
  transition: opacity .2s var(--ease);
}
.ad-banner-link:hover { opacity: .92; }
.ad-banner-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* si AdSense no rellena la unidad, el hueco no debe quedar vacío */
.ad-slot.is-empty { display: none; }

.ad-slot .adsbygoogle { display: block; width: 100%; }

/* =============================================================
   Prose (Proyecto)
   ============================================================= */
.prose {
  max-width: var(--maxw); margin: 0 auto;
  padding: 20px var(--pad) clamp(70px, 9vw, 110px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px;
}
.prose-block {
  padding-top: 22px; border-top: 2px solid var(--ink);
}
.prose-block h2 {
  font-family: 'Archivo Black', sans-serif; font-size: 19px;
  letter-spacing: -.02em; margin-bottom: 10px;
}
.prose-block p { color: var(--ink-dim); font-size: 15px; line-height: 1.7; }
.prose-block strong { color: var(--ink); font-weight: 600; }

/* =============================================================
   Footer
   ============================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.site-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  flex-wrap: wrap; padding: 32px var(--pad);
}
.footer-brand { display: inline-flex; align-items: center; gap: 10px; }
.site-footer p { color: var(--ink-dim); font-size: 12.5px; max-width: 620px; }
@media (max-width: 700px) { .site-footer p { text-align: left; } }

/* =============================================================
   Back to top
   ============================================================= */
.back-to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 250;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease), background .18s var(--ease);
}
.back-to-top svg { width: 20px; height: 20px; }
.back-to-top.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { background: var(--accent); }

/* =============================================================
   Modals (shared)
   ============================================================= */
body.is-locked { overflow: hidden; }

.modal {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 3vw, 32px);
}
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(20,20,26,.42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .24s var(--ease);
}
.modal.is-open .modal-overlay { opacity: 1; }

.modal-panel {
  position: relative; z-index: 1;
  width: min(900px, 100%); max-height: min(880px, 92vh);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.985);
  transition: opacity .26s var(--ease), transform .26s var(--ease);
}
.modal.is-open .modal-panel { opacity: 1; transform: none; }

.modal-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
}
.modal-dex { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--ink-dim); letter-spacing: .04em; }
.modal-bar-nav { display: flex; gap: 6px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
  transition: border-color .16s var(--ease), background .16s var(--ease), color .16s var(--ease);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; }

.modal-scroll { overflow-y: auto; overscroll-behavior: contain; }

.modal-top {
  display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 34px);
  padding: clamp(20px, 3vw, 30px);
}
.modal-media {
  position: relative; aspect-ratio: 1/1; border-radius: var(--r-lg); overflow: hidden;
  background: var(--surface); --ph: var(--ink-faint);
}
.modal-img { width: 100%; height: 100%; object-fit: cover; }
.media-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--ph);
}
.media-placeholder svg { width: 34%; max-width: 82px; opacity: .3; }
.media-placeholder span {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
}

.modal-head { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.modal-gen {
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim);
}
.modal-name {
  font-family: 'Archivo Black', sans-serif; font-weight: 400;
  font-size: clamp(30px, 4.4vw, 44px); letter-spacing: -.035em; color: var(--ink);
  margin-top: -6px;
}
.modal-types { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-blurb { color: var(--ink-2); font-size: 15.5px; line-height: 1.7; max-width: 60ch; }

.modal-stats {
  display: flex; flex-wrap: wrap; gap: 28px;
  padding-top: 16px; margin-top: 2px; border-top: 1px solid var(--line);
}
.mstat dt { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.mstat dd { font-family: 'Archivo Black', sans-serif; font-size: 19px; letter-spacing: -.02em; color: var(--ink); margin-top: 3px; }

.modal-section {
  padding: clamp(20px, 3vw, 28px) clamp(20px, 3vw, 30px);
  border-top: 1px solid var(--line);
}
.modal-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.modal-section-title {
  font-family: 'JetBrains Mono', monospace; font-weight: 500;
  font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-dim);
}
#evo-section .modal-section-title { margin-bottom: 16px; }

/* evolution chain */
.evo-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.evo-node {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 16px 8px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg);
  transition: border-color .16s var(--ease), background .16s var(--ease);
  min-height: 48px;
}
.evo-node:hover { border-color: var(--ink); }
.evo-node.is-current { background: var(--ink); border-color: var(--ink); }
.evo-node.is-current .evo-name { color: #fff; }
.evo-node.is-current .evo-dex { color: rgba(255,255,255,.6); }
.evo-thumb {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: var(--surface-2); flex-shrink: 0;
}
.evo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.evo-text { display: flex; flex-direction: column; line-height: 1.2; }
.evo-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.evo-dex { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--ink-dim); }
.evo-arrow { color: var(--ink-faint); display: grid; place-items: center; }
.evo-arrow svg { width: 18px; height: 18px; }

/* mini TCG cards inside the Pokémon sheet */
.mini-cards {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(126px, 1fr);
  gap: 12px; overflow-x: auto; padding-bottom: 6px;
  scroll-snap-type: x proximity; overscroll-behavior-x: contain;
}
.mini-card { scroll-snap-align: start; transition: transform .18s var(--ease); }
.mini-card:hover { transform: translateY(-3px); }
.mini-thumb {
  position: relative;
  aspect-ratio: 245/342; border-radius: var(--r-sm); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.mini-thumb.is-loading::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.2s infinite linear;
}
.mini-thumb img { width: 100%; height: 100%; object-fit: contain; }
.mini-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--ink-dim);
  margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block;
}
.mini-price {
  display: block; font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 700; color: var(--ink); margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.mini-empty { color: var(--ink-dim); font-size: 14px; }

@media (max-width: 720px) {
  .modal-top { grid-template-columns: 1fr; }
  .modal-media { max-width: 260px; }
}

/* =============================================================
   Card viewer
   ============================================================= */
.card-viewer {
  position: relative; z-index: 1;
  width: min(880px, 100%); max-height: 92vh;
  background: var(--bg); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
  overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.985);
  transition: opacity .26s var(--ease), transform .26s var(--ease);
}
.modal.is-open .card-viewer { opacity: 1; transform: none; }
.cv-close { position: absolute; top: 14px; right: 14px; z-index: 3; background: rgba(255,255,255,.9); }
.cv-image {
  background: var(--surface); padding: clamp(20px, 4vw, 40px);
  display: grid; place-items: center; min-height: 0;
}
.cv-image img { max-height: min(74vh, 620px); width: auto; border-radius: 12px; box-shadow: var(--shadow-md); }
.cv-info { padding: clamp(24px, 3vw, 34px); display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.cv-set { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.cv-name { font-family: 'Archivo Black', sans-serif; font-weight: 400; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.03em; margin-top: -6px; }
/* price block */
.cv-price {
  padding: 16px 18px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
}
.cv-price-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cv-price-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim);
}
.cv-price-variant {
  font-size: 11px; font-weight: 600; color: var(--ink-2);
  background: var(--bg); border: 1px solid var(--line-strong);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.cv-price-main {
  font-family: 'Archivo Black', sans-serif; font-size: clamp(26px, 3.4vw, 34px);
  letter-spacing: -.03em; color: var(--ink); margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.cv-price-range, .cv-price-eur {
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--ink-dim); margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
/* texto informativo: --ink-dim cumple 4.5:1; --ink-faint no llega */
.cv-price-note { font-size: 11px; line-height: 1.5; color: var(--ink-dim); margin-top: 10px; }
.cv-price-empty { font-size: 13px; color: var(--ink-dim); }

.cv-meta { display: flex; flex-direction: column; gap: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.cv-meta > div { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.cv-meta dt { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
.cv-meta dd { font-size: 14.5px; font-weight: 600; text-align: right; }
.cv-actions {
  margin-top: auto; padding-top: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.cv-actions .btn { width: 100%; }

/* botón de Mercado Libre — amarillo de marca, texto oscuro (contraste ~14:1) */
.btn-meli {
  background: #ffe600; color: #2d3277;
  font-weight: 700; font-size: 13.5px; gap: 6px; padding: 0 14px;
}
.btn-meli:hover { background: #ffd900; transform: translateY(-1px); }
.btn-meli .btn-icon { width: 16px; height: 16px; flex-shrink: 0; }
.btn-meli .btn-ext { width: 14px; height: 14px; flex-shrink: 0; opacity: .65; }
.btn-meli span { flex: 1; text-align: center; }

@media (max-width: 760px) {
  .card-viewer { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .cv-image img { max-height: 44vh; }
}

/* =============================================================
   Motion preferences
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
