/* Shared treatments used by more than one surface.
   Loaded by the desktop dashboard, the mobile app, the in-car centre
   display and the design-system specimens, so a component is described
   once and cannot drift between a live surface and its documentation. */

:root {
  /* Media family: the playing-music progress bar and the volume line share
     one track, one fill and one radius. */
  --media-track: rgba(122, 174, 255, 0.16);
  --media-fill: linear-gradient(90deg, rgba(56, 189, 248, 0.5), #38bdf8);
  --media-radius: 2px;

  /* Identity avatar: a non-interactive photo in a quiet cyan ring. */
  --avatar-ring: rgba(122, 174, 255, 0.34);
  --avatar-wash: rgba(56, 189, 248, 0.08);

  /* Card type ladder — four steps, and only four.
     label:   the name of a card or of a reading (eyebrow, status, row key)
     body:    any sentence, note, plan line or meta text
     value:   a reading's number
     primary: the one number a card leads with
     Each surface overrides the four values at its own container (px on the
     desktop sheet, cqw on the phone canvas and the centre display), but the
     roles never change. A card may not introduce an off-ladder size; if a
     new size seems necessary, the card is wrong, not the ladder. */
  --card-label: 9.5px;
  --card-body: 10.5px;
  --card-value: 18px;
  --card-primary: 30px;
}

/* ------------------------------------------------------------------ */
/* Battery energy readings                                            */
/* ------------------------------------------------------------------ */

/* The two battery facts that belong with the ring and the range:
   "1.8 kWh to destination" and "14.9 kWh/100 km". Same words,
   same ink and same value/label relationship on all three surfaces; only
   the size is per surface, through --energy-note-size.
   Placement: on desktop and mobile the pair is one footnote row under the
   band, reaching both card edges (1.8 left, 14.9 right). The narrow in-car
   card stacks the pair under the band on the content edge. */
.energy-notes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.energy-note {
  margin: 0;
  font: 400 var(--energy-note-size, var(--card-body))/1.4 var(--font);
  letter-spacing: 0.01em;
  color: var(--text-prose);
  /* Two short lines are better than a one-word widow at 320 px. */
  text-wrap: balance;
}

.energy-note b {
  font-weight: 500;
  color: var(--text-value);
}

/* The unit stays the one unit token (.u); inside a sentence it is set a
   step below the sentence, as in-car already did. */
.energy-note em.u {
  font-size: 0.85em;
  font-weight: 500;
}

/* ------------------------------------------------------------------ */
/* Paint preview orb                                                   */
/* ------------------------------------------------------------------ */

/* A flat fill cannot show what paint is: paint is a base colour under a
   clearcoat, lit by a small specular source and a large environment.
   This orb stacks those four optical layers over --swatch:
     1. a tight specular point (clearcoat hotspot),
     2. a broad elliptical sky/environment lift across the upper face,
     3. a faint horizon reflection across the middle,
     4. body shading between a lifted and a deepened tint of the base.
   --metal (0–1) and --rough (0–1) modulate the hotspot's intensity and
   its spread, so a 0.95-metal / 0.36-rough paint reads harder and tighter
   than a 0.55-metal / 0.22-rough one. Neither layer is a lighter copy of
   the fill: the base remains the dominant colour.

   COLOUR SOURCE: --swatch is written at runtime from the same data-color
   that app.js assigns to the car's CarPaint material (see the paint
   selector in app.js). The orb carries no colour literal of its own. */
.paint-orb {
  --paint-deep: color-mix(in oklab, var(--swatch, #1d4f79) 70%, #04070b);
  --paint-lift: color-mix(in oklab, var(--swatch, #1d4f79) 55%, #ffffff);
  --paint-rim:
    inset 0 1px 1px rgba(255, 255, 255, 0.55),
    inset 0 -3px 6px rgba(0, 0, 0, 0.4);
  background-color: var(--swatch, #1d4f79);
  background-image:
    radial-gradient(circle at 32% 24%,
      rgb(255 255 255 / calc(0.55 + var(--metal, 0.9) * 0.4)) 0,
      rgb(255 255 255 / calc(0.16 + var(--metal, 0.9) * 0.2)) calc(5% + var(--rough, 0.3) * 9%),
      rgb(255 255 255 / 0) calc(19% + var(--rough, 0.3) * 15%)),
    radial-gradient(ellipse 115% 80% at 26% 4%,
      rgb(255 255 255 / calc(0.1 + var(--metal, 0.9) * 0.18)) 0,
      rgb(255 255 255 / 0) 64%),
    linear-gradient(178deg,
      rgb(255 255 255 / 0) 47%,
      rgb(190 225 255 / 0.1) 51%,
      rgb(255 255 255 / 0) 56%),
    radial-gradient(circle at 46% 34%,
      var(--paint-lift) 0,
      var(--swatch, #1d4f79) 54%,
      var(--paint-deep) 100%);
  box-shadow: var(--paint-rim);
}
