/* Layout for #/insights. The charts themselves live in components/chart.css. */

.insights-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}

/* Season vs all-time. The season it means is the one in the header picker, so
   this is a scope switch rather than a second season selector. */
.toggle {
  display: inline-flex;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.toggle__option {
  padding: 0.35rem 0.85rem;
  border: 0;
  background: var(--color-surface);
  color: var(--color-text-soft);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background var(--transition);
}

/* Only an inactive option lifts on hover. Scoped with :not() rather than left to
   source order, because `:hover` outweighs a plain class — and the pointer is
   still sitting on the option you just clicked, so an unscoped hover would paint
   the newly-active option's white text onto a near-white background. */
.toggle__option:not(.toggle__option--active):hover {
  background: var(--color-surface-alt);
}

.toggle__option--active {
  background: var(--color-primary);
  color: #ffffff;
}

.toggle__option:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.insights-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
}

.chart {
  min-width: 0;
  margin: 0;
}

/* A season is 3 months and all-time is a dozen: the time series gets the whole
   row, or its later columns fall off the edge of a half-width cell. */
.chart--wide {
  grid-column: 1 / -1;
}

.chart__title {
  margin-bottom: var(--spacing-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.chart + .chart {
  margin-top: var(--spacing-lg);
}

@media (max-width: 768px) {
  .insights-grid {
    grid-template-columns: 1fr;
  }
}
