/* -------------------------------------------------------- */
/* 🔹 Example Day Curve                                     */
/* -------------------------------------------------------- */
/* The example day's hourly price curve with pins. The SVG    */
/* stretches to the plot box (non-scaling strokes), so pins   */
/* and axis labels are positioned in percent of the same box  */

/* Room above the plot for the pins' labels */
.example-day {
  padding-top: 72px;
}

.example-day__plot {
  position: relative;
  height: 240px;
  border-bottom: 1px solid var(--color-outline);
}

.example-day__curve {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.example-day__area {
  fill: var(--color-selected-bg);
}

.example-day__line {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.example-day__line--low { stroke: var(--color-price-green); }
.example-day__line--medium { stroke: var(--color-price-yellow); }
.example-day__line--high { stroke: var(--color-price-red); }

.example-day__axis {
  position: relative;
  height: 28px;
}

.example-day__tick {
  position: absolute;
  top: var(--space-s);
  transform: translateX(-50%);
  font-size: var(--text-body-small);
  color: var(--color-on-surface-variant);
}

.example-day__tick:first-child { transform: none; }
.example-day__tick:last-child { transform: translateX(-100%); }

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


/* -------------------------------------------------------- */
/* 🔹 Pins                                                  */
/* -------------------------------------------------------- */
/* Label, stem and dot in a column, centered on the hour's   */
/* price                                                      */

.curve-pin {
  --pin-color: var(--color-secondary);
  --pin-dot: 10px;
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, calc(-100% + var(--pin-dot) / 2));
}

.curve-pin--high {
  --pin-color: var(--color-price-red);
}

.curve-pin__label {
  display: flex;
  flex-direction: column;
  padding: var(--space-s) var(--space-m);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  background-color: var(--color-surface);
  box-shadow: var(--shadow);
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.4;
}

.curve-pin__title {
  font-weight: 700;
  color: var(--color-on-surface);
}

.curve-pin__text {
  font-weight: var(--text-title-weight);
  color: var(--pin-color);
}

.curve-pin__stem {
  width: 2px;
  height: var(--space-m);
  background-color: var(--color-outline);
}

.curve-pin__dot {
  width: var(--pin-dot);
  height: var(--pin-dot);
  border-radius: var(--radius-pill);
  background-color: var(--pin-color);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pin-color) 15%, transparent);
}

/* -------------------------------------------------------- */
/* 🔹 Mobile                                                */
/* -------------------------------------------------------- */
/* Smaller pins on a shorter plot. The edge pins align their  */
/* label away from the edge, and the car pin hangs below its  */
/* dot so it clears the laundry pin                           */

@media (max-width: 767px) {
  .example-day__plot {
    height: 200px;
  }

  .curve-pin__label {
    padding: var(--space-xs) var(--space-s);
    font-size: var(--text-body-small);
  }

  .curve-pin__stem {
    height: var(--space-s);
  }

  /* A longer stem lifts the laundry label clear of the dishwasher's */
  .curve-pin--laundry .curve-pin__stem {
    height: var(--space-xxxxl);
  }

  .curve-pin--car .curve-pin__stem {
    height: var(--space-lxl);
  }

  /* Left edge — label starts at the dot */
  .curve-pin--dishwasher {
    align-items: flex-start;
    transform: translate(calc(var(--pin-dot) / -2), calc(-100% + var(--pin-dot) / 2));
  }

  .curve-pin--dishwasher .curve-pin__stem {
    margin-left: calc(var(--pin-dot) / 2 - 1px);
  }

  /* Right edge — label ends at the dot */
  .curve-pin--car {
    flex-direction: column-reverse;
    align-items: flex-end;
    transform: translate(calc(-100% + var(--pin-dot) / 2), calc(var(--pin-dot) / -2));
  }

  .curve-pin--car .curve-pin__stem {
    margin-right: calc(var(--pin-dot) / 2 - 1px);
  }
}
