/* Per-competition pages (src/site/build_landing_pages.py): probabilidades /
   evolução / jogos (próximos + passados merged), each at its own URL. The
   tables/charts reuse the live markup + style.css; only the page-specific
   chrome is here. */

/* View tabs -- Probabilidades · Evolução · Próximos · Passados */
.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin: 0.5rem 0 0.75rem;
  border-bottom: 1px solid var(--border);
}

.view-tabs a {
  padding: 0.4rem 0.7rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.view-tabs a:hover {
  color: var(--text-primary);
}

.view-tabs a.is-active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-strong);
}

/* Competition switcher -- a row of pill links to the same view of
   each other competition (rendered by competition_picker.js). */
.competition-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
  margin: 0 0 1rem;
  font-size: 0.85rem;
}

.competition-switch-label {
  color: var(--text-muted);
}

.competition-switch-link,
.competition-switch-link:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  text-decoration: none;
}

.competition-switch-link:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.competition-switch-link[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* season switcher sits right under the competition switcher -- tighten the gap */
.season-switch {
  margin-top: -0.5rem;
}

span.competition-switch-link[aria-current="page"] {
  cursor: default;
}

.competition-switch-link .flag-icon,
.competition-switch-link svg {
  width: 15px;
  height: auto;
}

/* /competicoes/ hub */
.hub-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  margin-top: 1.25rem;
}

.hub-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: var(--surface-1);
}

.hub-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.hub-card h2 a {
  color: var(--text-primary);
  text-decoration: none;
}

.hub-views,
.hub-archive {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.hub-archive {
  color: var(--text-muted);
}

/* Pre-rendered match list (crawlers + first paint; the sticker grid replaces
   it on hydration). */
.pm-list {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  font-size: 0.9rem;
}

.pm-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--gridline);
}

.pm-home {
  justify-content: flex-end;
}

.pm-home,
.pm-away {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pm-score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pm-when {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Match the site's <main> width (style.css: max-width 1200px, padding 1rem)
   so the wide Série A table -- Time + 6 stats + 6 probability columns --
   fits without a horizontal scroll; only the bottom padding is extra. */
main.landing {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.landing-title {
  font-size: 1.6rem;
  line-height: 1.25;
  margin: 1.5rem 0 0.35rem;
  color: var(--text-primary);
}

.landing-updated {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.landing-lede {
  margin: 0 0 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.landing .table-scroll {
  margin-top: 1rem;
}

.landing-cta {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Season notes in the page footer (e.g. a points sanction) -- see
   build_landing_pages.py's _footer. Inherits .page-footer's muted, centered
   small text; capped to a readable line length on wide screens. The bottom
   padding keeps the last line clear of the footer's .corner-arc ornament
   (60px visible), which full-width text reaches on a narrow screen. */
.season-notes {
  max-width: 48rem;
  margin: 0 auto;
  padding-bottom: 2rem;
  line-height: 1.5;
}

.season-note {
  margin: 0.25rem 0;
}

/* Table | position-heatmap switch on the Probabilidades view (app.js). */
.view-toggle {
  display: inline-flex;
  margin: 0.75rem 0 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.view-toggle[hidden] {
  display: none;
}

.view-toggle-btn {
  padding: 0.35rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.view-toggle-btn:hover {
  color: var(--text-primary);
}

.view-toggle-btn.is-active {
  color: var(--page-plane);
  background: var(--accent-strong);
}

.view-toggle-btn:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: -2px;
}

/* Finishing-position heatmap: club rows x final-position columns. */
.position-heatmap-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.position-heatmap-col {
  min-width: 2.7rem;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  border-bottom: 3px solid transparent;
}

/* Spot bar under the position number, same colors as the table's zone bars,
   plus a faint tint of the same color down the whole column. */
.position-heatmap-col.zone-libertadores-grupos {
  border-bottom-color: var(--zone-libertadores-grupos);
}
.position-heatmap-cell.zone-libertadores-grupos {
  background-color: color-mix(in srgb, var(--zone-libertadores-grupos) 8%, transparent);
}
.position-heatmap-col.zone-libertadores-pre {
  border-bottom-color: var(--zone-libertadores-pre);
}
.position-heatmap-cell.zone-libertadores-pre {
  background-color: color-mix(in srgb, var(--zone-libertadores-pre) 8%, transparent);
}
.position-heatmap-col.zone-sulamericana {
  border-bottom-color: var(--zone-sulamericana);
}
.position-heatmap-cell.zone-sulamericana {
  background-color: color-mix(in srgb, var(--zone-sulamericana) 8%, transparent);
}
.position-heatmap-col.zone-rebaixamento {
  border-bottom-color: var(--zone-rebaixamento);
}
.position-heatmap-cell.zone-rebaixamento {
  background-color: color-mix(in srgb, var(--zone-rebaixamento) 8%, transparent);
}
.position-heatmap-col.zone-direct-promotion {
  border-bottom-color: var(--zone-direct-promotion);
}
.position-heatmap-cell.zone-direct-promotion {
  background-color: color-mix(in srgb, var(--zone-direct-promotion) 8%, transparent);
}
.position-heatmap-col.zone-playoff-promotion {
  border-bottom-color: var(--zone-playoff-promotion);
}
.position-heatmap-cell.zone-playoff-promotion {
  background-color: color-mix(in srgb, var(--zone-playoff-promotion) 8%, transparent);
}
.position-heatmap-col.zone-group-third {
  border-bottom-color: var(--zone-group-third);
}
.position-heatmap-cell.zone-group-third {
  background-color: color-mix(in srgb, var(--zone-group-third) 8%, transparent);
}

/* A column whose spot depends on where a guaranteed club ends: striped with every zone involved (see app.js). */
.position-heatmap-col.is-uncertain {
  /* The stripes (inline background-image, app.js) fill the 3px bar. */
  background-origin: border-box;
  background-position: bottom;
  background-repeat: no-repeat;
  background-size: 100% 3px;
  cursor: help;
}

.position-heatmap-note {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.position-heatmap-cell {
  padding: 0.35rem 0.1rem;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  text-align: center;
  border: 1px solid var(--page-plane);
}

/* Team column stays put while the 20 position columns scroll sideways. */
.position-heatmap-table th:first-child,
.position-heatmap-table td.team-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface-1);
}

.position-heatmap-table th:first-child {
  z-index: 2;
}

/* Position header = sort button (app.js): looks like the plain number. */
.position-heatmap-sort {
  /* Fills the whole header cell, so the entire cell is the click target. */
  display: block;
  width: 100%;
  padding: 0.3rem 0.1rem;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.position-heatmap-col:hover .position-heatmap-sort {
  color: var(--text-primary);
}

.position-heatmap-col {
  cursor: pointer;
  user-select: none;
}

.position-heatmap-col:hover {
  background-color: rgba(127, 127, 127, 0.16);
}

.position-heatmap-sort:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}

.position-heatmap-col.is-sorted .position-heatmap-sort {
  color: var(--text-primary);
}

.position-heatmap-col.is-sorted .position-heatmap-sort::after {
  content: " \25BE";
}

/* Row + column under the pointer (app.js). Inset shadow paints over the
   zone tint and probability shade alike, under the number. */
.position-heatmap-table .is-hover {
  box-shadow: inset 0 0 0 999px rgba(127, 127, 127, 0.16);
}
