/* Analytics-specific styles */

.hero--compact {
  padding-block: 4rem 3rem;
}

.hero--compact .hero__content {
  display: block;
}

/* Timeline Section */
.timeline-section {
  padding-block: 2.5rem;
}

.timeline-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.timeline-label {
  color: var(--color-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.timeline-value {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.timeline-control {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.timeline-btn {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--color-border);
  color: var(--color-accent);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--color-accent);
}

.timeline-btn--secondary {
  background: rgba(15, 23, 42, 0.6);
  color: var(--color-muted);
}

.timeline-btn--secondary:hover {
  background: rgba(15, 23, 42, 0.8);
  color: var(--color-text);
}

.timeline-slider-wrapper {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right,
    var(--color-accent) 0%,
    var(--color-accent) var(--slider-progress, 100%),
    rgba(148, 163, 184, 0.2) var(--slider-progress, 100%),
    rgba(148, 163, 184, 0.2) 100%
  );
  outline: none;
  cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid var(--color-background);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
  cursor: grab;
  transition: transform 0.2s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.timeline-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.timeline-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid var(--color-background);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
  cursor: grab;
  transition: transform 0.2s ease;
}

.timeline-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.timeline-slider::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.timeline-ticks {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.timeline-tick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.timeline-tick__mark {
  width: 2px;
  height: 8px;
  background: rgba(148, 163, 184, 0.3);
  border-radius: 1px;
}

.timeline-tick__label {
  font-size: 0.7rem;
  color: var(--color-muted);
  font-weight: 600;
}

/* Chart Cards */
.chart-card {
  background: rgba(11, 18, 32, 0.85);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}

.chart-card__header {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.chart-card__header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

.chart-subtitle {
  margin: 0.35rem 0 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.chart-controls--h2h {
  gap: 0.75rem;
}

.chart-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--color-border);
  transition: all 0.2s ease;
}

.chart-toggle:has(input:checked) {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--color-accent);
}

.chart-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.chart-toggle span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
}

.chart-toggle:has(input:checked) span {
  color: var(--color-text);
}

.chart-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.chart-select span {
  color: var(--color-muted);
  font-weight: 600;
  white-space: nowrap;
}

.chart-select select {
  appearance: none;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: rgba(15, 23, 42, 0.8) url('data:image/svg+xml,%3csvg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"%3e%3cpath d="M1 1.5L6 6.5L11 1.5" stroke="%2394a3b8" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/%3e%3c/svg%3e') no-repeat right 0.75rem center;
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.chart-select select:focus-visible {
  border-color: var(--color-accent);
  outline: none;
}

.h2h-vs {
  font-weight: 700;
  color: var(--color-accent);
  font-size: 1rem;
}

.chart-container {
  position: relative;
  width: 100%;
  min-height: 350px;
}

.chart-container canvas {
  max-height: 500px;
}

/* Heatmap */
.heatmap-container {
  overflow-x: auto;
  margin-top: 1rem;
}

.heatmap-grid {
  display: grid;
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-width: 600px;
}

.heatmap-row {
  display: grid;
  grid-template-columns: 150px repeat(auto-fit, minmax(45px, 1fr));
  gap: 1px;
  background: var(--color-border);
}

.heatmap-cell {
  background: rgba(11, 18, 32, 0.9);
  padding: 0.65rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.heatmap-cell--header {
  background: rgba(15, 23, 42, 0.7);
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: sticky;
  left: 0;
  z-index: 2;
}

.heatmap-cell--driver {
  background: rgba(15, 23, 42, 0.7);
  justify-content: flex-start;
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid var(--color-border);
}

.heatmap-cell--position {
  position: relative;
  font-weight: 700;
}

.heatmap-cell--dnf {
  color: rgba(248, 113, 113, 0.7);
  font-style: italic;
}

/* Position colors - gradient from gold to gray */
.heatmap-cell[data-position="1"] {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.3), rgba(251, 191, 36, 0.2));
  color: #fbbf24;
}

.heatmap-cell[data-position="2"] {
  background: linear-gradient(135deg, rgba(203, 213, 225, 0.25), rgba(148, 163, 184, 0.15));
  color: #cbd5e1;
}

.heatmap-cell[data-position="3"] {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.25), rgba(251, 146, 60, 0.15));
  color: #fb923c;
}

.heatmap-cell[data-position="4"],
.heatmap-cell[data-position="5"],
.heatmap-cell[data-position="6"] {
  background: rgba(56, 189, 248, 0.1);
  color: #94a3b8;
}

.heatmap-cell[data-position="7"],
.heatmap-cell[data-position="8"],
.heatmap-cell[data-position="9"],
.heatmap-cell[data-position="10"] {
  background: rgba(71, 85, 105, 0.15);
  color: #64748b;
}

/* Head-to-Head Summary & Fastest Lap Stats */
.h2h-summary,
.fastest-lap-stats {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.h2h-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.h2h-stat {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.h2h-stat__label {
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.h2h-stat__value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

.h2h-stat__value--winner {
  color: var(--color-accent);
}

/* Navigation active state */
.site-nav a.is-active {
  background: rgba(56, 189, 248, 0.18);
  color: var(--color-text);
}

/* Responsive */
@media (max-width: 640px) {
  .timeline-control {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .timeline-btn {
    width: 100%;
    justify-content: center;
  }

  .chart-card {
    padding: 1.25rem;
  }

  .chart-card__header {
    gap: 1rem;
  }

  .chart-controls--h2h {
    flex-direction: column;
    width: 100%;
  }

  .chart-select {
    width: 100%;
  }

  .chart-select select {
    flex: 1;
  }

  .h2h-vs {
    align-self: center;
  }

  .heatmap-cell--driver {
    font-size: 0.75rem;
    padding: 0.5rem;
  }

  .timeline-display {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

@media (min-width: 768px) {
  .chart-card__header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  .chart-container {
    min-height: 400px;
  }

  .timeline-ticks {
    top: 20px;
  }
}

@media (min-width: 1024px) {
  .chart-container canvas {
    max-height: 600px;
  }
}
