/*
Theme Name: Piratas
Theme URI: https://github.com/jnarvg/piratas
Author: Piratas FC
Description: Sitio de una sola página con estadísticas del equipo Piratas: temporada actual, rol de juegos, tabla general, jugadores, historia y resultados. Los datos se editan en data/stats.json.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: MIT
License URI: https://opensource.org/licenses/MIT
Text Domain: piratas
*/

:root {
  --ink: #0f1114;
  --muted: #666b75;
  --paper: #f2f0eb;
  --white: #fff;
  --night: #07080b;
  --night-2: #10131a;
  /* Azul rey del uniforme */
  --blue: #1f4fd8;
  --blue-dark: #1538a8;
  --blue-bright: #6f9bff;
  --blue-soft: #c3d4ff;
  --navy: #0b1233;
  --green: #1d8a55;
  --amber: #cc8212;
  --red: #d7263d;
  --line: rgba(15, 17, 20, .12);
  --line-dark: rgba(255, 255, 255, .12);
  --radius: 22px;
  --shadow: 0 24px 70px rgba(11, 12, 16, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Aptos, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, select { font: inherit; }
img { max-width: 100%; }
.empty-state { margin: 0; color: #aeb3bd; font-size: .9rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 78px;
  padding: 12px clamp(20px, 5vw, 76px);
  color: var(--white);
  background: rgba(7, 8, 11, .94);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(16px);
}
.admin-bar .site-header { top: 32px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1rem; letter-spacing: .1em; text-transform: uppercase; }
.brand small { margin-top: 2px; color: #aeb3bd; font-size: .72rem; }
.crest { display: block; width: 46px; height: 46px; overflow: hidden; background: #fff; border-radius: 12px; }
.crest img { display: block; width: 100%; height: 100%; padding: 3px; object-fit: contain; }
.site-nav { display: flex; gap: 28px; }
.site-nav a { color: #c9ccd2; font-size: .84rem; font-weight: 700; text-decoration: none; transition: color .2s ease; }
.site-nav a:hover { color: var(--blue-soft); }
.nav-toggle {
  display: none;
  color: #fff;
  background: none;
  border: 1px solid #464b55;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: clamp(40px, 8vw, 110px);
  min-height: 650px;
  padding: clamp(72px, 10vw, 145px) clamp(20px, 7vw, 110px);
  color: var(--white);
  background:
    radial-gradient(circle at 80% 25%, rgba(31, 79, 216, .42), transparent 30%),
    radial-gradient(circle at 10% 90%, rgba(31, 79, 216, .16), transparent 34%),
    linear-gradient(135deg, #07080b 0%, #0e1430 62%, #07080b 100%);
}
.hero::after {
  content: "P";
  position: absolute;
  right: -3vw;
  bottom: -25%;
  color: rgba(255, 255, 255, .025);
  font-size: min(48vw, 620px);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}
.hero-copy, .hero-side { position: relative; z-index: 1; }
.league-lockup { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.league-lockup .eyebrow { margin: 0; }
.league-logo {
  display: grid;
  place-items: center;
  width: 74px;
  height: 54px;
  overflow: hidden;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .24);
}
.league-logo img { width: 100%; height: 100%; object-fit: contain; }
.hero-side { align-self: end; display: grid; justify-items: center; gap: 24px; width: 100%; max-width: 430px; }
.hero-crest {
  width: clamp(150px, 18vw, 230px);
  height: auto;
  aspect-ratio: 1;
  padding: 14px;
  object-fit: contain;
  background: #fff;
  border: 8px solid rgba(255, 255, 255, .08);
  border-radius: 30px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .32);
}
.eyebrow {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(3.3rem, 8vw, 7.4rem);
  line-height: .9;
  letter-spacing: -.065em;
  text-transform: uppercase;
}
.hero h1 em { color: #979da8; font-style: normal; }
.hero-intro { max-width: 590px; margin: 28px 0 0; color: #bdc1ca; font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
}
.button-primary { background: var(--blue); color: #fff; }
.button-primary:hover { background: #2d5ff0; }
.button-ghost { border: 1px solid #454b56; color: #e4e6ea; }
.button-ghost:hover { border-color: #777e8b; }

.latest-card, .next-card {
  width: 100%;
  max-width: 430px;
  padding: 30px;
  background: rgba(255, 255, 255, .065);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
  backdrop-filter: blur(12px);
}
.latest-label, .next-label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #aeb3bd;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.next-label { color: var(--blue-soft); }
.scoreline { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 28px 0 20px; }
.score-team { font-weight: 850; text-transform: uppercase; }
.score-team:last-child { text-align: right; }
.score { display: flex; gap: 8px; align-items: center; font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 900; letter-spacing: -.06em; }
.score small { color: #717784; font-size: .55em; }
.latest-meta { margin: 0; color: #b6bac3; font-size: .88rem; }
.next-card { padding: 24px 28px; background: rgba(255, 255, 255, .1); }
.next-card:empty { display: none; }
.next-rival { margin-top: 17px; font-size: 1.32rem; font-weight: 900; letter-spacing: -.025em; text-transform: uppercase; }
.next-rival span { margin-right: 4px; font-size: 1rem; }
.next-meta { margin: 8px 0 0; color: #b6bac3; font-size: .84rem; }
.duty { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .13); }
.duty span { color: #aeb3bd; font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.duty strong { color: #fff; font-size: .92rem; text-align: right; }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 9vw, 120px) clamp(20px, 7vw, 110px); }
.section-current { background: #fff; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.section h2 { margin: 0; font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; letter-spacing: -.045em; }
.updated, .section-tag { margin: 0; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.section-tag { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; }

.metric-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); width: 100%; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric { min-width: 0; padding: 24px 12px; border-right: 1px solid var(--line); }
.metric:first-child { padding-left: 0; }
.metric:last-child { border-right: 0; }
.metric strong { display: block; font-size: clamp(1.55rem, 3.2vw, 2.8rem); line-height: 1; letter-spacing: -.05em; }
.metric span { display: block; margin-top: 9px; color: var(--muted); font-size: .67rem; font-weight: 750; letter-spacing: .06em; line-height: 1.25; overflow-wrap: anywhere; text-transform: uppercase; }
.record-bar { display: flex; height: 8px; margin-top: 28px; overflow: hidden; border-radius: 999px; background: #e1e1de; }
.record-bar span { min-width: 2px; transition: width .45s ease; }
.bar-win { background: var(--green); }
.bar-draw { background: var(--amber); }
.bar-loss { background: var(--red); }

/* ---------- Rol de juegos ---------- */
.section-schedule { background: var(--night-2); color: var(--white); }
.section-schedule .section-tag { color: #d4d7dd; border-color: rgba(255, 255, 255, .18); }
.schedule-feature {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  min-height: 290px;
  margin-bottom: 22px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, #2a5cf0 50%, var(--blue-dark) 100%);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.schedule-feature:empty { display: none; }
.feature-copy { display: grid; align-content: center; gap: 12px; padding: clamp(28px, 4vw, 48px); }
.feature-label { display: flex; align-items: center; justify-content: space-between; color: rgba(255, 255, 255, .78); font-size: .72rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.feature-label b { display: inline-grid; place-items: center; min-width: 40px; height: 32px; padding: 0 10px; background: #fff; color: var(--blue-dark); border-radius: 10px; font-size: .8rem; }
.feature-title { margin: 6px 0 0; font-size: clamp(2rem, 4.5vw, 3.4rem); font-weight: 900; line-height: .95; letter-spacing: -.05em; text-transform: uppercase; }
.feature-title small { display: block; margin: 4px 0; font-size: .38em; letter-spacing: .04em; color: rgba(255, 255, 255, .62); }
.feature-meta { margin: 0; font-size: 1rem; font-weight: 700; }
.feature-duty { display: flex; gap: 12px; align-items: baseline; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .24); }
.feature-duty span { font-size: .7rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.feature-duty strong { font-size: .95rem; }
.feature-crests { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 28px; background: rgba(7, 8, 11, .92); color: #fff; }
.feature-crests .team-logo { width: clamp(80px, 10vw, 120px); height: clamp(80px, 10vw, 120px); border-radius: 22px; font-size: 1.6rem; }
.feature-crests .vs { color: #8b909b; font-size: 1rem; font-weight: 900; letter-spacing: .1em; }

.schedule-list { display: grid; gap: 10px; }
.fixture {
  display: grid;
  grid-template-columns: 80px 1.3fr 1fr 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 18px;
}
.fixture.is-next { border-color: var(--blue-bright); background: rgba(31, 79, 216, .16); }
.fixture-day { display: grid; }
.fixture-day span { color: #8b909b; font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.fixture-day strong { font-size: 1.5rem; line-height: 1.1; }
.fixture-rival { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fixture-rival div { display: grid; min-width: 0; }
.fixture-rival small { color: #8b909b; font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.fixture-rival strong { font-size: .95rem; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fixture-when strong { display: block; font-size: .95rem; }
.fixture-when span { color: #aeb3bd; font-size: .8rem; }
.fixture-duty span { display: block; color: #aeb3bd; font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.fixture-duty strong { font-size: .88rem; }
.fixture-status { display: grid; justify-items: center; min-width: 96px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .08); text-align: center; }
.fixture-status strong { font-size: 1.1rem; letter-spacing: -.02em; }
.fixture-status span { font-size: .6rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; color: #aeb3bd; }
.fixture-status.status-next { background: var(--blue); color: #fff; }
.fixture-status.status-next span { color: #fff; }
.fixture-status.status-rescheduled { background: rgba(204, 130, 18, .18); color: #f2be68; }
.fixture-status.status-rescheduled span { color: #f2be68; }
.fixture-status.status-final { background: rgba(255, 255, 255, .12); }

/* Logos de equipos (imagen o iniciales de respaldo) */
.team-logo {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  overflow: hidden;
  background: #fff;
  border-radius: 9px;
  object-fit: cover;
}
.team-logo-fallback { color: var(--night); font-size: .62rem; font-weight: 900; letter-spacing: .04em; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
thead th { padding: 16px 14px; color: var(--muted); font-size: .66rem; font-weight: 850; letter-spacing: .12em; text-align: center; text-transform: uppercase; border-bottom: 1px solid var(--line); }
thead th:first-child { text-align: left; padding-left: 22px; }
tbody th, tbody td { padding: 14px; text-align: center; font-size: .92rem; border-bottom: 1px solid var(--line); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { text-align: left; padding-left: 22px; font-weight: 700; }
.standings-identity { display: flex; align-items: center; gap: 12px; }
.standings-rank { display: inline-grid; place-items: center; width: 26px; height: 26px; background: var(--night); color: #fff; border-radius: 8px; font-size: .74rem; }
.standings-points { font-weight: 900; }
.standings-ours { background: rgba(31, 79, 216, .09); }
.standings-ours th { color: var(--blue-dark); }
.standings-ours .standings-rank { background: var(--blue); color: #fff; }
.table-note { margin: 14px 4px 0; color: var(--muted); font-size: .78rem; }

/* ---------- Jugadores ---------- */
.players-layout { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
.leader-card {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: end;
  min-height: 340px;
  padding: 30px;
  color: #fff;
  background: linear-gradient(160deg, #15204a, var(--night) 70%);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.leader-card::after { content: "⚓"; position: absolute; right: -10px; top: -20px; font-size: 200px; color: rgba(255, 255, 255, .04); }
.leader-label { display: flex; align-items: center; gap: 8px; color: var(--blue-bright); font-size: .7rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.leader-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--blue-bright); }
.leader-number { margin: 14px 0 0; font-size: 5rem; font-weight: 900; line-height: .9; letter-spacing: -.06em; }
.leader-name { margin: 8px 0 0; font-size: 1.35rem; font-weight: 850; letter-spacing: -.02em; }
.leader-meta { margin: 6px 0 0; color: #aeb3bd; font-size: .86rem; }
.players-table tbody th { white-space: nowrap; }
.players-table tbody td { font-weight: 700; }
.position-pill { margin-left: 8px; padding: 3px 8px; background: var(--night); color: #fff; border-radius: 999px; font-size: .58rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; vertical-align: middle; }
.card-dot { display: inline-block; width: 8px; height: 11px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
.card-yellow { background: #f2c11a; }
.card-red { background: var(--red); }
.card-cell { white-space: nowrap; }
.card-cell .card-dot { margin-right: 6px; }

/* ---------- Historia ---------- */
.section-dark { background: var(--night); color: #fff; }
.hero .eyebrow, .section-dark .eyebrow, .section-schedule .eyebrow { color: var(--blue-bright); }
.ranking-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; background: rgba(255, 255, 255, .06); border-radius: 999px; }
.ranking-tabs button { padding: 9px 16px; color: #c9ccd2; background: none; border: 0; border-radius: 999px; font-size: .8rem; font-weight: 800; cursor: pointer; }
.ranking-tabs button.is-active { background: #fff; color: var(--night); }
.history-layout { display: grid; grid-template-columns: 340px 1fr; gap: 22px; align-items: start; }
.leaders-panel { padding: 26px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line-dark); border-radius: 24px; }
.panel-label { margin: 0 0 10px; color: #aeb3bd; font-size: .68rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.leaders-list { margin: 0; padding: 0; list-style: none; counter-reset: leader; }
.leaders-list li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-dark); }
.leaders-list li:last-child { border-bottom: 0; }
.leaders-list li::before { counter-increment: leader; content: counter(leader, decimal-leading-zero); color: #8b909b; font-size: .72rem; font-weight: 800; }
.leaders-list strong { font-size: .95rem; }
.leaders-list span { font-size: 1.05rem; font-weight: 900; letter-spacing: -.02em; }
.season-cards { display: grid; gap: 12px; }
.season-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; align-items: center; padding: 22px 26px; color: var(--ink); background: #fff; border-radius: 20px; }
.season-card h3 { margin: 0; font-size: 1.15rem; letter-spacing: -.02em; }
.season-card p { margin: 0; color: var(--muted); font-size: .84rem; }
.season-card .season-record { text-align: right; font-size: 1.5rem; font-weight: 900; letter-spacing: -.04em; }
.season-card .season-record small { display: block; color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.season-card .season-cards-row { grid-column: 1 / -1; display: flex; gap: 12px; font-size: .78rem; font-weight: 800; }
.season-card.is-current { outline: 2px solid var(--blue); }
.season-card.is-champion { background: linear-gradient(135deg, #fff 60%, #e7eeff 100%); }
.season-card.is-champion p { color: var(--blue-dark); font-weight: 750; }
.trophy { margin-right: 8px; }

/* ---------- Resultados ---------- */
.season-picker { display: grid; gap: 6px; color: var(--muted); font-size: .68rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.season-picker select { padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; font-size: .84rem; font-weight: 700; letter-spacing: 0; text-transform: none; }
.results-list { display: grid; gap: 10px; }
.result-row {
  display: grid;
  grid-template-columns: 70px 1fr auto 1fr 40px;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.result-row .result-date { color: var(--muted); font-size: .78rem; }
.result-row .result-team { font-weight: 850; }
.result-row .result-team:nth-of-type(2) { text-align: right; }
.result-row .result-score { font-size: 1.15rem; font-weight: 900; letter-spacing: -.02em; }
.result-badge { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #fff; font-size: .74rem; font-weight: 900; }
.result-G { background: var(--green); }
.result-E { background: var(--amber); }
.result-P { background: var(--red); }

/* ---------- Footer ---------- */
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 34px clamp(20px, 7vw, 110px); color: #aeb3bd; background: var(--night); font-size: .8rem; }
.site-footer p { margin: 0; }
.footer-brand { color: #fff; font-size: 1rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.footer-brand em { color: var(--blue-bright); font-style: normal; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-side { max-width: none; justify-items: stretch; }
  .hero-crest { justify-self: center; }
  .latest-card, .next-card { max-width: none; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metric:nth-child(4) { border-right: 0; }
  .metric:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .metric:nth-child(5) { padding-left: 0; }
  .players-layout, .history-layout { grid-template-columns: 1fr; }
  .leader-card { min-height: 240px; }
  .schedule-feature { grid-template-columns: 1fr; }
  .fixture { grid-template-columns: 64px 1fr 1fr auto; }
  .fixture-duty { display: none; }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; position: absolute; top: 100%; right: 0; left: 0; flex-direction: column; gap: 0; padding: 8px 20px 16px; background: rgba(7, 8, 11, .98); border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
  .section-heading { flex-direction: column; align-items: start; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding-left: 0; }
  .metric:nth-child(odd) { border-right: 1px solid var(--line); }
  .metric:nth-child(even) { border-right: 0; }
  .metric:nth-child(-n+6) { border-bottom: 1px solid var(--line); }
  .fixture { grid-template-columns: 56px 1fr auto; }
  .fixture-when { display: none; }
  .result-row { grid-template-columns: 1fr auto 1fr; }
  .result-row .result-date { grid-column: 1 / -1; }
  .result-badge { display: none; }
}
