/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --ink: #14171c;
  --ink-2: #1b1f26;
  --surface: #20242c;
  --surface-line: #2c313b;
  --paper: #eee7d8;
  --gold: #e8b33d;
  --gold-dim: #a9863a;
  --text: #eceef1;
  --text-dim: #9aa1ad;

  --e-fuego: #ef7c56;
  --e-agua: #5a9bd8;
  --e-planta: #6fb35b;
  --e-rayo: #e8c33d;
  --e-psiquico: #b579d6;
  --e-lucha: #c46a3f;
  --e-oscuro: #6b6f8a;
  --e-metal: #9aa7b0;
  --e-hada: #e08fbf;
  --e-dragon: #7166d8;
  --e-incoloro: #c9c9c0;

  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Inter", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, var(--ink) 70%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--surface-line);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 24px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand .mark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--ink);
  background: var(--gold);
  padding: 3px 8px 1px;
  border-radius: 3px;
  text-transform: uppercase;
}

.brand h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--text);
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  padding: 4px;
}

.tab-btn {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  background: var(--gold);
  color: var(--ink);
}

.tab-btn:focus-visible,
button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

main { max-width: 1080px; margin: 0 auto; padding: 32px 24px 80px; }

.view { display: none; }
.view.active { display: block; animation: rise .35s ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .view.active { animation: none; }
}

/* ==========================================================================
   Section heads
   ========================================================================== */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 2px;
}

.section-head p { margin: 0; color: var(--text-dim); font-size: 14px; }

.picker {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  padding: 9px 14px;
  border-radius: 8px;
  min-width: 220px;
}

/* ==========================================================================
   Category cards (Torneos Mensuales / Nacional 2025 / etc.)
   ========================================================================== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.cat-card {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 12px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}

.cat-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }

.cat-card.active {
  border-color: var(--gold);
  background: var(--surface-line);
}

.cat-card h3 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
}

.cat-card .cat-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.cat-card.active .cat-count { color: var(--gold); }

/* ==========================================================================
   Tournament meta strip
   ========================================================================== */
.tourney-meta {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin: 6px 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--surface-line);
}

.tourney-meta .stat { display: flex; flex-direction: column; gap: 2px; }
.tourney-meta .stat b {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--gold);
}
.tourney-meta .stat span {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ==========================================================================
   Standings — "match slip" rows
   ========================================================================== */
.slip {
  --stub: 64px;
  display: grid;
  grid-template-columns: var(--stub) 1fr auto;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  position: relative;
}

.slip::after {
  content: "";
  position: absolute;
  left: var(--stub);
  top: 0; bottom: 0;
  width: 0;
  border-left: 2px dashed var(--ink);
  opacity: .5;
}

.slip .rank {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  text-align: center;
  padding: 14px 0;
  color: var(--text-dim);
}

.slip.top1 .rank, .slip.top1 { border-color: var(--gold-dim); }
.slip.top1 .rank { color: var(--gold); }
.slip.top2 .rank { color: #d7d9de; }
.slip.top3 .rank { color: #c98a55; }

.slip .body {
  padding: 10px 18px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.slip .who {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.slip .player {
  font-weight: 600;
  font-size: 15px;
}

.slip .deckname {
  font-size: 13px;
  color: var(--text-dim);
}

.slip .record {
  font-family: var(--mono);
  font-size: 14px;
  padding: 14px 18px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ==========================================================================
   Deck cards
   ========================================================================== */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.deck-card {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}

.deck-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }

.deck-card .top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chip {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--ink);
  white-space: nowrap;
}

.deck-card h3 {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.deck-card .pilot { font-size: 13px; color: var(--text-dim); }
.deck-card .result {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
}

/* ==========================================================================
   Deck detail (modal-ish panel)
   ========================================================================== */
.deck-detail {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 14px;
  padding: 26px 28px;
  margin-top: 22px;
}

.deck-detail .close-btn {
  float: right;
  background: transparent;
  border: 1px solid var(--surface-line);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: var(--body);
  font-size: 13px;
}
.deck-detail .close-btn:hover { color: var(--text); border-color: var(--gold-dim); }

.deck-detail h3 { font-family: var(--display); font-size: 28px; margin: 0 0 4px; }
.deck-detail .pilot { color: var(--text-dim); margin-bottom: 18px; }

.deck-photo {
  display: block;
  width: 100%;
  max-width: 640px;
  border-radius: 10px;
  border: 1px solid var(--surface-line);
  margin: 0 0 22px;
}

.list-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.list-cols h4 {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 8px;
}

.list-cols ul { list-style: none; margin: 0; padding: 0; }
.list-cols li {
  font-family: var(--mono);
  font-size: 13.5px;
  padding: 4px 0;
  border-bottom: 1px solid var(--ink-2);
  color: var(--text);
}

/* ==========================================================================
   Empty states
   ========================================================================== */
.empty {
  border: 1px dashed var(--surface-line);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  color: var(--text-dim);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--surface-line);
  padding: 22px 24px 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 560px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .section-head h2 { font-size: 26px; }
  .slip { --stub: 48px; }
  .slip .rank { font-size: 20px; }
}


/* ==========================================================================
   Noticias
   ========================================================================== */
.news-hero {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--surface-line);
  aspect-ratio: 16 / 8;
  min-height: 300px;
  background: var(--ink-2);
}

.news-track {
  display: flex;
  height: 100%;
  transition: transform .55s cubic-bezier(.3, .7, .2, 1);
}

.news-slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  cursor: pointer;
}

.news-slide img, .news-card img, .news-modal-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(20,23,28,.94) 0%, rgba(20,23,28,.45) 48%, transparent 100%);
}

.news-slide-text {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 1;
  padding: 28px 84px 46px 84px;
  max-width: 820px;
}

.news-slide-text h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.02;
  margin: 10px 0 10px;
}

.news-slide-text p {
  margin: 0;
  font-size: 16px;
  color: var(--text);
  opacity: .85;
  max-width: 56ch;
}

.news-slide:hover h2 { color: var(--gold); }

.news-chip { background: var(--gold); }

.news-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  width: 46px; height: 46px;
  padding: 0 0 4px;
  border: 1px solid var(--surface-line);
  border-radius: 50%;
  background: rgba(20,23,28,.78);
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.news-arrow:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.news-prev { left: 14px; }
.news-next { right: 14px; }

.news-dots {
  position: absolute;
  z-index: 2;
  right: 22px; bottom: 18px;
  display: flex;
  gap: 8px;
}
.news-dots button {
  width: 22px; height: 4px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: rgba(238,231,216,.35);
  cursor: pointer;
}
.news-dots button.on { background: var(--gold); width: 34px; }

/* tarjetas chicas */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.news-card {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color .15s ease, transform .15s ease;
}
.news-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.news-card img { aspect-ratio: 3 / 2; height: auto; }
.news-card-text { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.news-card h3 {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
}
.news-card:hover h3 { color: var(--gold); }

.news-card time, .news-modal-body time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

/* lector */
.news-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
}
.news-modal[hidden] { display: none; }
.news-modal-bg { position: absolute; inset: 0; background: rgba(8,10,13,.8); }

.news-modal-box {
  position: relative;
  width: min(760px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 14px;
  animation: rise .25s ease both;
}
.news-modal-box img { height: auto; max-height: 70vh; object-fit: contain; background: var(--ink-2); }

.news-modal-body { padding: 24px 30px 34px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.news-modal-body h2 {
  font-family: var(--display);
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 700;
  line-height: 1.05;
  margin: 8px 0 2px;
}
.news-modal-body p {
  font-size: 17px;
  line-height: 1.7;
  max-width: 62ch;
  margin: 14px 0 0;
  color: var(--text);
  white-space: pre-line; /* respeta los saltos de línea escritos en data.js */
}

.news-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  width: 38px; height: 38px;
  padding: 0 0 3px;
  border: 1px solid var(--surface-line);
  border-radius: 50%;
  background: rgba(20,23,28,.82);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.news-close:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); }

.news-slide:focus-visible, .news-card:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

@media (max-width: 640px) {
  .news-hero { aspect-ratio: 4 / 5; }
  .news-slide-text { padding: 20px 20px 70px; }
  .news-slide-text p { display: none; }
  .news-arrow { width: 38px; height: 38px; top: auto; bottom: 10px; transform: none; }
  .news-prev { left: 10px; }
  .news-next { right: 10px; }
  .news-dots { bottom: 26px; }
  .news-dots { left: 0; right: 0; justify-content: center; }
  .news-modal-body { padding: 20px 20px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .news-track { transition: none; }
  .news-modal-box { animation: none; }
}


/* galería de fotos dentro de una noticia */
.news-gallery {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 22px;
}
.news-gallery a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--surface-line); }
.news-gallery img { width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; transition: transform .2s ease; }
.news-gallery a:hover img { transform: scale(1.03); }
@media (max-width: 640px) { .news-gallery { grid-template-columns: 1fr; } }


/* ==========================================================================
   Redes sociales
   ========================================================================== */
.social { display: flex; gap: 8px; align-items: center; }
.social a {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--surface-line);
  border-radius: 50%;
  color: var(--text);
  background: var(--surface);
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.social a:hover { transform: translateY(-1px); }

/* colores originales de cada red */
.social a[aria-label="Instagram"] {
  color: #fff;
  border-color: transparent;
  background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%);
}
.social a[aria-label="Facebook"] {
  color: #fff;
  border-color: transparent;
  background: #1877f2;
}
.social a[aria-label="Instagram"]:hover,
.social a[aria-label="Facebook"]:hover {
  color: #fff;
  border-color: transparent;
  filter: brightness(1.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.social a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.footer-social { margin-bottom: 8px; }
.footer-social a { color: var(--gold); text-decoration: none; font-weight: 600; }
.footer-social a:hover { text-decoration: underline; }


/* ==========================================================================
   Miniaturas de Pokémon + decklist desplegable en standings
   ========================================================================== */
.sprites {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.sprites img {
  display: block;
  image-rendering: pixelated;
  margin-left: -8px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .45));
}
.sprites img:first-child { margin-left: 0; }

.slip-item { margin-bottom: 10px; }
.slip-item .slip { margin-bottom: 0; }

.slip.clickable { cursor: pointer; transition: border-color .15s, background .15s; }
.slip.clickable:hover { border-color: var(--gold-dim); background: #252a33; }
.slip.clickable:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.slip.open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-color: var(--gold-dim); }

.slip .record { display: flex; align-items: center; gap: 10px; }
.slip .chev { color: var(--gold-dim); font-size: 14px; transition: transform .2s; }
.slip.open .chev { transform: rotate(180deg); }

.slip-panel {
  background: var(--surface);
  border: 1px solid var(--gold-dim);
  border-top: 1px dashed var(--surface-line);
  border-radius: 0 0 10px 10px;
  padding: 20px 22px;
}
.slip-panel[hidden] { display: none; }

.deck-inline + .deck-inline {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--surface-line);
}
.deck-inline-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.deck-inline-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 24px;
  margin: 0 0 4px;
}
.deck-inline .pilot { color: var(--text-dim); font-size: 13px; }
.deck-inline .deck-photo { margin-bottom: 18px; }

.goto-deck {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 7px 12px;
  font: 500 12.5px var(--body);
  cursor: pointer;
  white-space: nowrap;
}
.goto-deck:hover { background: rgba(232, 179, 61, .1); }

.deck-card .sprites { margin: 2px 0 8px; }
.deck-detail h3 { display: flex; align-items: center; gap: 10px; }

@media (max-width: 560px) {
  .slip .body { padding: 8px 10px; gap: 8px; }
  .slip .sprites img { width: 32px; height: 32px; margin-left: -6px; }
  .slip .record { padding: 14px 10px; gap: 6px; }
  .slip-panel { padding: 16px 14px; }
  .deck-inline-head { flex-direction: column; }
}

/* enlaces dentro del texto de las noticias */
.news-modal-body p a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }
.news-modal-body p a:hover { filter: brightness(1.2); }

/* aviso de privacidad en el pie de página */
.footer-privacy {
  max-width: 720px;
  margin: 14px auto 12px;
  padding: 12px 16px;
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-dim);
  text-align: left;
}
.footer-privacy strong { color: var(--text); }
.footer-privacy a { color: var(--gold); font-weight: 600; text-decoration: none; }
.footer-privacy a:hover { text-decoration: underline; }


/* portadas horizontales: mantener visible el flyer (a la derecha) */
.news-card img.portada { object-position: 88% 50%; }
@media (max-width: 640px) { .news-slide img.portada { object-position: 94% 50%; } }

/* con portada horizontal: el texto no tapa el flyer de la derecha */
@media (min-width: 641px) { .news-slide.con-portada .news-slide-text { max-width: 600px; } }

/* subcategoría de una noticia (ej. Comunidad › Torneo 21 de noviembre) */
.news-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.news-chip.sub {
  white-space: normal;
  max-width: 100%;
  line-height: 1.25;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}

/* video dentro de una noticia */
.news-modal-box video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  background: #000;
}
