/* -------------------------------------------------------- */
/* 🔹 Year Comparison Card                                  */
/* -------------------------------------------------------- */
/* Average price per month, year against year — a table    */
/* with the newest year first                                */


.year-comparison {
  display: flex;
  flex-direction: column;
}

.year-comparison__card {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  padding: var(--space-xl);
}

.year-comparison__note {
  font-size: var(--text-body-small);
  color: var(--color-on-surface-variant);
}


/* -------------------------------------------------------- */
/* 🔹 Table                                                 */
/* -------------------------------------------------------- */
/* Scrolls sideways on narrow screens with the month column  */
/* pinned; values are tinted with the price colors           */

.year-comparison__scroll {
  overflow-x: auto;
}

.year-comparison__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-body-medium);
  font-variant-numeric: tabular-nums;
}

.year-comparison__table th,
.year-comparison__table td {
  padding: var(--space-xs) var(--space-s);
  border-bottom: 1px solid var(--color-divider);
  text-align: right;
  white-space: nowrap;
}

.year-comparison__table thead th {
  font-weight: var(--text-title-weight);
  color: var(--color-on-surface-variant);
}

.year-comparison__table .year-comparison__month {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--color-surface);
  text-align: left;
  font-weight: 400;
  color: var(--color-on-surface);
}

.year-comparison__table thead .year-comparison__month {
  color: var(--color-on-surface-variant);
  font-weight: var(--text-title-weight);
}

.year-comparison__average-row th,
.year-comparison__average-row td {
  border-bottom: none;
  font-weight: var(--text-title-weight);
}

.year-comparison__average-row .year-comparison__month {
  font-weight: var(--text-title-weight);
}

.year-comparison__value {
  display: inline-block;
  min-width: 56px;
  padding: var(--space-xxs) var(--space-s);
  border-radius: var(--radius-small);
}

.year-comparison__value--low {
  background-color: color-mix(in srgb, var(--color-price-green) 14%, transparent);
}

.year-comparison__value--mid {
  background-color: color-mix(in srgb, var(--color-price-yellow) 22%, transparent);
}

.year-comparison__value--high {
  background-color: color-mix(in srgb, var(--color-price-red) 14%, transparent);
}

@media (max-width: 767px) {
  .year-comparison__card {
    padding: var(--space-l);
  }
}
