/* Páginas de pilotos, piloto, calculadora y circuito.
   Pensadas primero para móvil: rejillas que bajan a 2 columnas, tablas con
   scroll horizontal propio y botones que pasan a otra línea. */

.explore-section { padding: var(--space-8) 0 var(--space-16); }
.explore-block { margin-bottom: var(--space-10); }
.explore-label {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .1em;
  color: var(--color-text-muted); margin-bottom: var(--space-4);
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
}
.explore-note { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-2); }

/* Tablas con scroll horizontal en pantallas estrechas */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 560px; }
.explore-table { width: 100%; border-collapse: collapse; }
.explore-table th {
  text-align: left; padding: var(--space-2) var(--space-3); font-size: var(--text-xs);
  color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--color-border); white-space: nowrap;
}
.explore-table td { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); border-bottom: 1px solid var(--color-divider); }
.explore-table tr:hover td { background: var(--color-surface-offset); }
.explore-table a { color: inherit; text-decoration: underline; text-decoration-color: var(--color-border); text-underline-offset: 3px; }
.explore-table a:hover { color: var(--color-primary); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--color-text-muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: var(--space-2); vertical-align: middle; }
.out-badge {
  display: inline-block; padding: 0 var(--space-2); border: 1px solid var(--color-error, #e74c3c);
  color: var(--color-error, #e74c3c); border-radius: var(--radius-md); font-size: 10px; letter-spacing: .05em;
}

/* Fichas de datos */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(130px, 45%), 1fr)); gap: var(--space-3); }
.stat-tile {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-4); min-width: 0;
}
.stat-value { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-value--long { font-size: var(--text-lg); }
.stat-label { font-size: var(--text-xs); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .08em; margin-top: var(--space-1); }

/* ── Parrilla de pilotos ─────────────────────────────────────────── */
.drivers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 46%), 1fr)); gap: var(--space-4); }
.driver-card {
  position: relative; display: flex; flex-direction: column; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.driver-card:hover { transform: translateY(-3px); border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.driver-card-photo { position: relative; height: 150px; display: flex; align-items: flex-end; justify-content: center; }
.driver-card-photo img { height: 140px; object-fit: contain; }
.driver-card-number {
  position: absolute; top: var(--space-2); right: var(--space-3); font-family: var(--font-display);
  font-size: var(--text-2xl); font-weight: 900; color: rgba(255, 255, 255, .85); line-height: 1;
}
.driver-card-pos {
  position: absolute; top: var(--space-3); left: var(--space-3); font-family: var(--font-display); font-size: var(--text-xs);
  font-weight: 700; background: var(--color-bg); color: var(--color-text); padding: 2px 8px; border-radius: var(--radius-full);
}
.driver-card-body { padding: var(--space-3) var(--space-4) var(--space-4); border-top: 3px solid var(--team, #888); }
.driver-card-name { font-family: var(--font-display); font-weight: 700; font-size: var(--text-base); line-height: 1.2; }
.driver-card-team { font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: var(--space-2); }
.driver-card-stats { display: flex; gap: var(--space-3); font-size: var(--text-xs); color: var(--color-text-muted); flex-wrap: wrap; }
.driver-card-stats strong { color: var(--color-text); font-variant-numeric: tabular-nums; }
/* Silueta cuando F1 no tiene foto del piloto (images/helmets/NoDriverPhoto.svg).
   La caja interior tiene la proporción del SVG (200×220) para que las
   iniciales caigan siempre sobre el mono, sea cual sea el tamaño. */
.driver-silhouette { display: flex; align-items: flex-end; justify-content: center; height: 100%; width: 100%; }
.driver-silhouette .driver-silhouette-inner {
  position: relative; display: block; flex: 0 0 auto; height: 96%; aspect-ratio: 200 / 220;
}
.driver-silhouette .driver-silhouette-inner img {
  display: block; width: 100%; height: 100%; object-fit: contain;
}
/* SVG superpuesto con las iniciales (mismo viewBox que la figura) */
.driver-silhouette .driver-silhouette-initials {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.driver-silhouette-initials text {
  font-family: var(--font-display); font-weight: 900; font-size: 26px; letter-spacing: 2px;
  fill: rgba(255, 255, 255, .85); paint-order: stroke; stroke: rgba(0, 0, 0, .35); stroke-width: 2px;
}
.photo-disclaimer { margin-top: var(--space-4); }
@media (max-width: 480px) {
  .driver-card-photo { height: 110px; }
  .driver-card-photo img { height: 105px; }
  .driver-card-number { font-size: var(--text-xl); }
}

/* ── Parrilla de constructores ───────────────────────────────────── */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: var(--space-4); }
.team-card {
  position: relative; display: flex; flex-direction: column; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.team-card:hover { transform: translateY(-3px); border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.team-card-head { position: relative; height: 120px; display: flex; align-items: flex-end; justify-content: center; }
.team-card-avatars { display: flex; align-items: flex-end; gap: var(--space-2); }
.team-avatar {
  width: 96px; height: 104px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden;
}
.team-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
@media (max-width: 480px) {
  .team-card-head { height: 100px; }
  .team-avatar { width: 80px; height: 88px; }
}
.team-share { display: flex; height: 14px; border-radius: var(--radius-full); overflow: hidden; background: var(--color-surface-offset); max-width: 640px; }
.team-share span { display: block; height: 100%; }
.team-share-legend { display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: var(--text-sm); margin-top: var(--space-2); }
.team-drivers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 46%), 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }

/* ── Página de piloto ────────────────────────────────────────────── */
.driver-hero { display: flex; align-items: flex-end; gap: var(--space-6); flex-wrap: wrap; }
.driver-hero-photo {
  width: 150px; height: 150px; border-radius: var(--radius-lg); overflow: hidden; flex-shrink: 0;
  display: flex; align-items: flex-end; justify-content: center;
}
.driver-hero-photo img { height: 145px; object-fit: contain; }
.driver-hero-meta { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; color: var(--color-text-muted); }
.team-pill { display: inline-flex; align-items: center; gap: var(--space-2); padding: 2px 10px; border-radius: var(--radius-full); border: 1px solid var(--color-border); font-size: var(--text-sm); }
@media (max-width: 480px) {
  .driver-hero { gap: var(--space-4); }
  .driver-hero-photo { width: 100px; height: 100px; }
  .driver-hero-photo img { height: 96px; }
}

.h2h-bars { display: flex; flex-direction: column; gap: var(--space-4); max-width: 640px; }
.h2h-bar-row { display: grid; grid-template-columns: 3.5rem 1fr 3.5rem; align-items: center; gap: var(--space-3); }
.h2h-bar-row .num { font-family: var(--font-display); font-weight: 700; }
.h2h-bar-row .num:last-child { text-align: right; }
.h2h-bar-label { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: calc(-1 * var(--space-2)); }
.h2h-bar { display: flex; height: 12px; border-radius: var(--radius-full); overflow: hidden; background: var(--color-surface-offset); }
.h2h-bar span { display: block; height: 100%; }

/* ── Calculadora ─────────────────────────────────────────────────── */
.calc-status {
  background: var(--color-surface); border: 1px solid var(--color-border); border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-lg); padding: var(--space-5); margin-bottom: var(--space-6);
}
.calc-status h2 { font-family: var(--font-display); font-size: var(--text-lg); margin-bottom: var(--space-2); }
.calc-status p { font-size: var(--text-sm); color: var(--color-text-muted); margin: var(--space-1) 0; }
.calc-status strong { color: var(--color-text); }
.calc-table select { min-width: 74px; padding: 4px 6px; }
.calc-table select.conflict { border-color: var(--color-error, #e74c3c); color: var(--color-error, #e74c3c); }
.calc-table th.contender { text-align: center; }
.calc-table td.cell { text-align: center; }
.calc-decided { color: var(--color-primary); font-weight: 700; white-space: nowrap; }
.calc-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin: var(--space-4) 0; }
.calc-actions button {
  padding: var(--space-2) var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  font-size: var(--text-sm); color: var(--color-text); background: transparent; cursor: pointer;
}
.calc-actions button:hover { border-color: var(--color-primary); color: var(--color-primary); }
.calc-result-row.leader td { font-weight: 700; }

/* ── Circuito ────────────────────────────────────────────────────── */
.circuit-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-8); align-items: center; }
.circuit-hero img { width: 100%; max-height: 260px; object-fit: contain; }
@media (max-width: 768px) { .circuit-hero { grid-template-columns: 1fr; gap: var(--space-5); } .circuit-hero img { max-height: 200px; } }
.chart-box { width: 100%; min-height: 320px; }
