/* -------------------------------------------------------- */
/* 🔹 Price Day Summary                                     */
/* -------------------------------------------------------- */
/* Today's prices as text under the chart: the title with a  */
/* "show table" toggle beside it, a sentence with the day's   */
/* numbers and, opened, the spot price hour by hour — a today */
/* / tomorrow choice above a tile per hour in its price color */

/* Below the chart card's disclaimer and article link */
.day-summary {
  margin-top: var(--spacing-between-sections);
}


/* -------------------------------------------------------- */
/* 🔹 Header                                                */
/* -------------------------------------------------------- */
/* The <details> summary: the title with the toggle beside it */
/* and the sentence below. All of it opens the table, so it   */
/* reaches out over the card's padding                        */

.day-summary__header {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title toggle"
    "sentence sentence";
  align-items: center;
  gap: var(--space-xs) var(--space-l);
  margin: calc(-1 * var(--card-padding));
  padding: var(--card-padding);
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
}

/* Opened, its bottom padding is the space above the table's divider */
.day-summary__hourly[open] .day-summary__header {
  margin-bottom: 0;
}

.day-summary__header::-webkit-details-marker {
  display: none;
}

.day-summary__header:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.day-summary__title {
  grid-area: title;
  font-size: var(--text-headline-medium);
  font-weight: var(--text-title-weight);
  color: var(--color-on-surface);
}

.day-summary__sentence {
  grid-area: sentence;
  font-size: var(--text-body-medium);
  line-height: var(--text-body-medium-height);
  color: var(--color-on-surface-variant);
}

/* Styled as the saving tips card's link */
.day-summary__toggle {
  grid-area: toggle;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-body-medium);
  font-weight: var(--text-title-weight);
  color: var(--color-primary);
  white-space: nowrap;
}

.day-summary__toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.day-summary__hourly[open] .day-summary__toggle svg {
  transform: rotate(180deg);
}

.day-summary__toggle-hide,
.day-summary__hourly[open] .day-summary__toggle-show {
  display: none;
}

.day-summary__hourly[open] .day-summary__toggle-hide {
  display: inline;
}


/* -------------------------------------------------------- */
/* 🔹 Hourly prices                                         */
/* -------------------------------------------------------- */

/* Positioned, so the hidden radio buttons stay inside the page's
   scroll container — focusing one would otherwise scroll the body */
.day-summary__hourly-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  padding-top: var(--space-l);
  border-top: 1px solid var(--color-divider);
}

/* The day choice with the color legend beside it */
.day-summary__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m) var(--space-l);
}

/* Today / tomorrow — a compact segmented control like the
   spot / incl. VAT choice, driven by the radio buttons */
.day-summary__days {
  display: flex;
  gap: var(--space-xxs);
  width: fit-content;
  padding: 3px;
  border-radius: 10px;
  background-color: var(--color-press-highlight);
}

.day-summary__day {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 var(--space-l);
  border-radius: var(--radius-medium);
  font-size: var(--text-body-medium);
  color: var(--color-on-surface-variant);
  cursor: pointer;
}

.day-summary__day-input[value="today"]:checked ~ .day-summary__controls [for="day-summary-today"],
.day-summary__day-input[value="tomorrow"]:checked ~ .day-summary__controls [for="day-summary-tomorrow"] {
  background-color: var(--color-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  font-weight: var(--text-title-weight);
  color: var(--color-primary);
}

.day-summary__day-input[value="today"]:focus-visible ~ .day-summary__controls [for="day-summary-today"],
.day-summary__day-input[value="tomorrow"]:focus-visible ~ .day-summary__controls [for="day-summary-tomorrow"] {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.day-summary__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-l);
  margin: 0;
  padding: 0;
  list-style: none;
}

.day-summary__legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  font-size: var(--text-body-small);
  color: var(--color-on-surface-variant);
}

.day-summary__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* A tile per hour — as many per row as fit */
.day-summary__hours {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: var(--space-s);
  margin: 0;
  padding: 0;
  list-style: none;
}

.day-summary__day-input[value="today"]:checked ~ .day-summary__hours[data-day="tomorrow"],
.day-summary__day-input[value="tomorrow"]:checked ~ .day-summary__hours[data-day="today"] {
  display: none;
}

.day-summary__hour {
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
  padding: var(--space-s) var(--space-m);
  border-radius: var(--radius-medium);
}

.day-summary__hour-time {
  font-size: var(--text-body-small);
  color: var(--color-on-surface-variant);
}

.day-summary__hour-price {
  font-size: var(--text-body-large);
  font-weight: var(--text-title-weight);
  font-variant-numeric: tabular-nums;
  color: var(--color-on-surface);
}

/* The price colors as soft tints, like the year comparison's values */
.day-summary__hour--low {
  background-color: color-mix(in srgb, var(--color-price-green) 14%, transparent);
}

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

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

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


/* -------------------------------------------------------- */
/* 🔹 Mobile                                                */
/* -------------------------------------------------------- */
/* The toggle moves below the sentence                       */

@media (max-width: 599px) {
  .day-summary__header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "sentence"
      "toggle";
  }
}
