/* =========================================================
   temporada.css — páginas de «Estadísticas Temporadas Históricas»
   Misma línea que la portada: fondo blanco hueso, negro suave y
   rojo institucional. Los títulos de sección van en verde.
   ========================================================= */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #141416;
  --text: #2b2c30;
  --muted: #5d6169;
  --red: #c81d16;
  --red-dark: #a3150f;
  --green: #14753f;
  --line: rgba(20, 20, 22, .13);
  --line-soft: rgba(20, 20, 22, .08);
  --tint: rgba(200, 29, 22, .07);
  --shadow: 0 1px 2px rgba(20, 20, 22, .05), 0 6px 20px rgba(20, 20, 22, .05);
  --nav-h: 60px;
  --fh: 'Oswald', 'Arial Narrow', sans-serif;
  --fb: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--fb); background: var(--bg); color: var(--text); line-height: 1.55; overflow-x: hidden; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 700; }
.skip:focus { left: 8px; }
.icon { width: 1em; height: 1em; fill: currentColor; flex-shrink: 0; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Barra superior ---------- */
.top { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .96); border-top: 4px solid var(--red); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.top-in { height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--fh); font-weight: 600; font-size: 1.25rem; color: var(--red); white-space: nowrap; }
.brand .icon { font-size: 28px; }
.btn-inicio { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 18px; border: 1px solid rgba(20, 20, 22, .22); border-radius: 999px; background: #fff; font-weight: 700; font-size: .92rem; color: var(--ink); transition: background .2s, color .2s, border-color .2s; }
.btn-inicio .icon { font-size: 18px; }
.btn-inicio:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- Encabezado ---------- */
.hero { padding: 28px 0 8px; text-align: center; }
.eyebrow { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; color: var(--green); padding-bottom: 5px; border-bottom: 2px solid var(--red); margin-bottom: 10px; }
.hero h1 { font-family: var(--fh); font-weight: 700; font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.1; color: var(--ink); }
.hero h1 span { color: var(--red); }
.lead { max-width: 60ch; margin: 8px auto 0; color: var(--muted); font-size: clamp(.92rem, 1.6vw, 1.02rem); }

/* ---------- Indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 22px 0 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: 12px; padding: 12px 16px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi small { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.kpi b { display: block; margin: 3px 0 1px; font-family: var(--fh); font-weight: 600; font-size: 1.45rem; line-height: 1.15; color: var(--ink); overflow-wrap: anywhere; }
.kpi span { display: block; font-size: .8rem; color: var(--muted); }
.kpi.red { border-top-color: var(--red); }
.kpi.red b { color: var(--red); }
.kpi.up { border-top-color: var(--green); }
.kpi.up span { color: var(--green); font-weight: 500; }
.kpi.down span { color: var(--red-dark); font-weight: 500; }

/* ---------- Controles ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.controls { display: grid; gap: 14px; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > label, .lbl { font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field select, .field input[type="number"] { min-height: 42px; padding: 8px 12px; background: #fff; border: 1px solid rgba(20, 20, 22, .25); border-radius: 8px; }
.field input[type="number"] { width: 90px; }
.field select { min-width: 220px; max-width: 100%; }
.field select:focus, .field input:focus { border-color: var(--red); outline: 2px solid rgba(200, 29, 22, .25); outline-offset: 0; }
.seg { display: inline-flex; border: 1px solid rgba(20, 20, 22, .25); border-radius: 999px; overflow: hidden; background: #fff; }
.seg button { min-height: 42px; padding: 8px 18px; background: none; border: 0; font-weight: 500; transition: background .2s, color .2s; }
.seg button:hover { color: var(--red-dark); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.range-wrap { display: flex; align-items: center; gap: 12px; min-height: 42px; }
.range-wrap input[type="range"] { width: min(360px, 52vw); accent-color: var(--red); height: 28px; }
.range-wrap output { min-width: 2.2ch; font-family: var(--fh); font-size: 1.35rem; font-weight: 600; color: var(--red); text-align: right; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 16px; background: #fff; border: 1px solid rgba(20, 20, 22, .25); border-radius: 999px; font-weight: 500; transition: background .2s, color .2s, border-color .2s; }
.btn:hover { border-color: var(--red); color: var(--red-dark); }
.btn[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }

.teams-box { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.teams { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; max-height: 190px; overflow: auto; padding: 2px; }
.tchip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 5px 14px 5px 10px; background: #fff; border: 1px solid rgba(20, 20, 22, .2); border-radius: 999px; font-size: .88rem; font-weight: 500; transition: background .15s, border-color .15s; }
.tchip i { width: 12px; height: 12px; border-radius: 50%; background: #c9c6c0; flex-shrink: 0; }
.tchip:hover { border-color: var(--ink); }
.tchip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tchip[aria-pressed="true"] i { box-shadow: 0 0 0 2px #fff; }
.tchip.maipu { border-color: var(--red); }
.tchip[disabled], .tchip.legend { cursor: default; opacity: 1; }
.tchip.legend:hover { border-color: var(--ink); }

/* ---------- Gráfico ---------- */
.chart-card { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px 12px; box-shadow: var(--shadow); }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 0 4px 8px; }
.chart-head h2 { font-family: var(--fh); font-weight: 600; font-size: 1.15rem; color: var(--ink); }
.chart-head p { font-size: .82rem; color: var(--muted); }
.chart-box { position: relative; height: 460px; }
.chart-fallback { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---------- Tabla ---------- */
.sec { margin: 40px 0 14px; }
.sec h2 { position: relative; font-family: var(--fh); font-weight: 600; font-size: 1.55rem; line-height: 1.15; color: var(--green); padding-top: 14px; }
.sec h2::before { content: ''; position: absolute; left: 0; top: 0; width: 44px; height: 4px; background: var(--red); }
.sec p { margin-top: 4px; font-size: .9rem; color: var(--muted); }
.tbl-box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: auto; max-height: 560px; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
thead th { position: sticky; top: 0; z-index: 2; background: #f0eeea; border-bottom: 2px solid var(--ink); padding: 10px 14px; text-align: left; font-family: var(--fh); font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf9f7; }
tbody tr.me { background: var(--tint); font-weight: 700; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.up { color: var(--green); font-weight: 500; }
.down { color: var(--red-dark); font-weight: 500; }
.flat { color: var(--muted); }

/* ---------- Otras temporadas ---------- */
.seasons { margin-top: 8px; }
.seasons h2 { position: relative; font-family: var(--fh); font-weight: 600; font-size: 1.3rem; color: var(--green); padding-top: 14px; margin-bottom: 14px; }
.seasons h2::before { content: ''; position: absolute; left: 0; top: 0; width: 44px; height: 4px; background: var(--red); }
.sgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 10px; }
.sgroup b { flex: 0 0 150px; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.sgroup ul { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 64px; padding: 6px 14px; background: var(--surface); border: 1px solid rgba(20, 20, 22, .22); border-radius: 10px; font-family: var(--fh); font-size: 1rem; font-weight: 500; letter-spacing: .03em; color: var(--ink); transition: background .2s, color .2s, border-color .2s; }
.chip:hover { background: var(--red); border-color: var(--red); color: #fff; }
.chip[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.wide { font-family: var(--fb); font-size: .92rem; letter-spacing: 0; }


/* ---------- Complementos para la página de goles ---------- */
.field input[type="search"], .field input[type="text"] { min-height: 42px; padding: 8px 12px; background: #fff; border: 1px solid rgba(20, 20, 22, .25); border-radius: 8px; width: 100%; }
.field.grow { flex: 1 1 220px; }
table.wide { min-width: 860px; }
tfoot td { position: sticky; bottom: 0; background: #f0eeea; border-top: 2px solid var(--ink); font-weight: 700; padding: 10px 14px; }
/* ---------- Pie ---------- */
.footer { margin-top: 44px; padding: 28px 0 32px; text-align: center; background: var(--surface); border-top: 4px solid var(--ink); font-size: .88rem; color: var(--muted); }
.footer b { font-family: var(--fh); font-weight: 600; font-size: 1.15rem; color: var(--red); }

@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .brand span { display: none; }
  .chart-box { height: 380px; }
  .sgroup b { flex-basis: 100%; }
  .field select { min-width: 0; width: 100%; }
  .field { width: 100%; }
  .field input[type="number"] { width: 100%; }
  .range-wrap input[type="range"] { width: 100%; flex: 1; }
  .range-wrap { width: 100%; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 8px 6px; }
  thead th, tbody td { padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .top, .controls, .seasons, .footer { display: none; }
  body { background: #fff; }
}
