/**
 * Light Studio
 *
 * The room is one photograph. Everything else is painted over it, inside one
 * isolated group so every blend mode composites against the room:
 *
 *   0. The room, exposed by one number, --dls-light, which the script computes
 *      from the lamps AND the time of day. A dark room is not a dim copy of a
 *      lit one — it is darker, flatter and nearly colourless — so exposure moves
 *      brightness, contrast and saturation together.
 *   1. Glass. Lamps never light the garden: outside follows the time of day on
 *      its own, and at night the pane becomes a faint mirror of the interior.
 *   2. Signature layers — where each fixture's light falls, screen-blended.
 *   3. The star ceiling, drawn on a canvas clipped to the ceiling plane.
 *   4. Luminaires, drawn as SVG. Cores burn toward white; colour is in the halo.
 *   5. A tint tipping the white balance toward the lamp temperature.
 *
 * Every position is a custom property. The defaults are traced from one
 * photograph; a buyer's room has its ceiling and windows somewhere else, so all
 * of it can be overridden per instance without touching the markup.
 *
 * No theme dependency: every value is defined here.
 */

.dls {
  --dls-ratio: 3/2;
  /* Numeric twin of the ratio, because calc() cannot divide a `3/2` token.
     Used to cap the stage by height. PHP keeps the two in step. */
  --dls-aspect: 1.5;
  --dls-vh-cap: 74vh;
  --dls-max-w: 1500px;

  /* Dark chrome. A white panel beside a dark stage makes the room read darker
     than it is — simultaneous contrast works against the whole point here. */
  --dls-console: #0a0c10;
  --dls-surface: rgba(255, 255, 255, 0.05);
  --dls-surface-hi: rgba(255, 255, 255, 0.10);
  --dls-line: rgba(255, 255, 255, 0.11);
  --dls-line-hi: rgba(255, 255, 255, 0.26);
  --dls-text: #eceff4;
  --dls-muted: #98a0ad;
  --dls-accent: #f0b429;
  --dls-radius: 10px;

  /* Set by the script. */
  --dls-light: 0;     /* overall exposure: lamps and daylight combined */
  --dls-lampmix: 0;   /* how much of that light is lamp, for the tint */
  --dls-reflect: 0;   /* strength of the interior reflected in night glass */
  --dls-lamp: 255, 180, 107;
  --dls-tint: 255, 172, 92;

  /* Geometry traced from the default photograph, in stage percentages. */
  --dls-ceiling: polygon(0% 0%, 100% 0%, 100% 31.5%, 81% 31.5%, 73% 34%, 60% 35%,
                         60% 22%, 58% 22.5%, 57.8% 18.6%, 51% 18.2%, 27% 17.4%, 0% 7.5%);
  --dls-window-1: polygon(0% 14%, 21.5% 21.2%, 21.5% 63.3%, 6.5% 63.6%, 6.5% 16.2%, 5.1% 15.7%, 5.1% 64%, 0% 65.8%);
  --dls-window-2: polygon(69.7% 39%, 74.2% 38.6%, 74.2% 56.2%, 69.7% 56.2%);


  font-family: inherit;
  container-type: inline-size;
}

/* Break out of the content column so the room is the size of a room rather
   than the size of a paragraph. Width is capped three ways: the viewport (less
   a gutter that also clears a scrollbar), an absolute maximum, and the height
   budget — never by cropping, so every traced percentage stays valid. */
.dls--wide {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(
    calc(100vw - 2.5rem),
    var(--dls-max-w),
    calc(var(--dls-vh-cap) * var(--dls-aspect))
  );
  max-width: none;
}

.dls__heading {
  margin: 0 0 1rem;
  font-size: clamp(1.4rem, 1rem + 1.6vw, 2rem);
  line-height: 1.15;
  color: inherit;
  text-wrap: balance;
}

/* Stage and controls are one object — a lit instrument, not a picture with a
   form underneath it. */
.dls__console {
  border-radius: 14px;
  overflow: hidden;
  background: var(--dls-console);
  color: var(--dls-text);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 34px 80px -34px rgba(0, 0, 0, 0.7);
}

/* ---------- stage ---------- */

.dls__stage {
  position: relative;
  aspect-ratio: var(--dls-ratio);
  overflow: hidden;
  background: #05070b;
  isolation: isolate;
}

.dls__view {
  position: absolute;
  inset: 0;
  z-index: 0;
  isolation: isolate;
}

.dls__room {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter:
    brightness(calc(0.15 + (0.85 * var(--dls-light))))
    contrast(calc(0.90 + (0.20 * var(--dls-light))))
    saturate(calc(0.25 + (0.85 * var(--dls-light))));
  transition: filter 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Cool moonlight sitting under everything. It must reach exactly zero before
   every fixture is on: any residue reads as a grey sheet over the photograph. */
.dls__view::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(16, 28, 56, 0.5), rgba(5, 9, 18, 0.66));
  opacity: max(0, calc(1 - (1.45 * var(--dls-light))));
  transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
  pointer-events: none;
}

/* ---------- glass ---------- */

.dls__glass {
  position: absolute;
  inset: 0;
  z-index: 1;
  clip-path: var(--dls-window-1);
  pointer-events: none;
}
.dls__glass--2 { clip-path: var(--dls-window-2); }

.dls__glass > span {
  position: absolute;
  inset: 0;
  transition: opacity 900ms ease, filter 900ms ease;
}

/* The garden, on its own clock. */
.dls__glass-view {
  background: var(--dls-img) center / cover no-repeat;
  filter: brightness(0.2) saturate(0.4);
}
.dls[data-ambient="dusk"] .dls__glass-view { filter: brightness(0.5) saturate(0.8); }
.dls[data-ambient="day"]  .dls__glass-view { filter: none; }

/* Blue hour: deep blue overhead, the last warmth at the horizon. */
.dls__glass-dusk {
  opacity: 0;
  background: linear-gradient(180deg,
    rgba(18, 32, 84, 0.78) 14%,
    rgba(58, 66, 138, 0.56) 30%,
    rgba(214, 120, 96, 0.46) 42%,
    rgba(248, 158, 84, 0.42) 46%,
    rgba(22, 26, 44, 0.62) 52%,
    rgba(10, 14, 26, 0.7) 66%);
}
.dls[data-ambient="dusk"] .dls__glass-dusk { opacity: 1; }

.dls__glass-night {
  opacity: 0;
  background: linear-gradient(180deg, rgba(8, 14, 34, 0.8), rgba(3, 6, 14, 0.88));
}
.dls[data-ambient="night"] .dls__glass-night { opacity: 1; }

/* Night glass is a mirror: dark outside, lit inside, and you see the room. A
   mirrored copy of the photograph is only an approximation of that reflection,
   which is why it is kept faint — at low strength it reads as correct. */
.dls__glass-reflect {
  background: var(--dls-img) center / cover no-repeat;
  transform: scaleX(-1);
  opacity: var(--dls-reflect);
  filter: blur(3px) brightness(calc(0.2 + (0.8 * var(--dls-light))));
  mix-blend-mode: screen;
}

/* ---------- signature layers: where the light lands ---------- */

/* Projected layers are SVGs; without an explicit size an absolutely placed
   SVG falls back to 300x150. */
svg.dls__layer,
.dls__tray,
.dls__fx--stage { width: 100%; height: 100%; }

/* Pools, scallops and beams all take the lamp colour from here. */
.dls__stop { stop-color: rgb(var(--dls-lamp)); }

/* A beam is only visible in darkness or haze. */
.dls__beam {
  opacity: calc(1 - (0.72 * var(--dls-light)));
  transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* The star-ceiling tray: a dark recess, because fibre-optic stars are set into
   a dark ceiling — on white plaster they would be invisible under any other
   light, which is exactly what the first version showed. Lamps still lift it
   a little, as they would a real painted ceiling. */
.dls__tray {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  filter: brightness(calc(0.8 + (0.9 * var(--dls-light))));
  transition: opacity 900ms cubic-bezier(0.25, 0.1, 0.25, 1), filter 800ms ease;
  pointer-events: none;
}
.dls[data-on~="starry"] .dls__tray { opacity: 0.95; }

/* Everything on the ceiling plane sits behind what hangs from it. The mask is
   the room profile's occluders — here, the pendant bars and their cables. */
.dls__tray,
.dls__stars,
.dls__fx--cove,
.dls__fx--downlight {
  -webkit-mask-image: var(--dls-occlude, none);
          mask-image: var(--dls-occlude, none);
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
}

.dls__layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
  pointer-events: none;
}

/* The graze itself is drawn along the traced runs; this is only the ambient
   lift a cove gives the upper room. */
.dls__layer--cove {
  background:
    linear-gradient(180deg,
      rgba(var(--dls-lamp), 0.40) 0%,
      rgba(var(--dls-lamp), 0.16) 8%,
      transparent 24%),
    linear-gradient(0deg, rgba(var(--dls-lamp), 0.10) 0%, transparent 18%);
}

/* A star ceiling gives almost no light; the faint lift is the fibres' own
   glow on the ceiling around them. */
.dls__layer--starry {
  background: radial-gradient(80% 26% at 40% 0%, rgba(var(--dls-lamp), 0.07), transparent 70%);
}

/* ---------- the star ceiling ---------- */

.dls__stars {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 900ms cubic-bezier(0.25, 0.1, 0.25, 1);
  pointer-events: none;
}

/* ---------- the luminaires themselves ---------- */

.dls__fixtures-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.dls__fx {
  position: absolute;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 520ms cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 520ms cubic-bezier(0.25, 0.1, 0.25, 1);
  overflow: visible;
}

/* Drawn in stage-percentage space, so they cover the stage exactly. */
.dls__fx--stage { left: 0; top: 0; width: 100%; height: 100%; transform: none; }

/* The fixture appears only when its switch is on. */
.dls[data-on~="track"]      .dls__fx--track,
.dls[data-on~="panel"]      .dls__fx--panel,
.dls[data-on~="cove"]       .dls__fx--cove,
.dls[data-on~="pendant"]    .dls__fx--pendant,
.dls[data-on~="downlight"]  .dls__fx--downlight,
.dls[data-on~="chandelier"] .dls__fx--chandelier {
  opacity: 1;
  transform: translateY(0);
}
.dls[data-on~="cove"] .dls__fx--cove,
.dls[data-on~="pendant"] .dls__fx--pendant { transform: none; }

/* Housings: dark, so they read as objects in a dim room rather than stickers. */
.dls__fx-body  { fill: #15171c; stroke: #15171c; }

/* A downlight's trim ring and the dark reflector around the lamp. */
.dls__fx-trim { fill: rgba(28, 30, 34, 0.55); stroke: rgba(18, 20, 24, 0.55); stroke-width: 1px; }

.dls__fx-rod { fill: none; stroke: #15171c; stroke-width: 1.5px; }
.dls__fx--chandelier .dls__fx-frame { stroke: rgba(20, 22, 26, 0.8); stroke-width: 1.4px; }

/* A panel's bezel is a slim trim against a pale ceiling, not an outline. */
.dls__fx-frame { fill: none; stroke: rgba(22, 24, 30, 0.26); stroke-width: 1.2; }

/* A cove is concealed: you never see the channel, only the lit edge and the
   wash above it, plus the soft shadow the recess casts under the strip. The
   fill must be set here — presentation attributes lose to the rule above. */
.dls__fx--cove .dls__fx-body {
  fill: none;
  stroke: rgba(10, 12, 16, 0.30);
  stroke-width: 6px;
}

/* Anything that emits burns toward white and shows its colour in the halo.
   A lamp that is on is brighter than everything around it, so its core clips. */
.dls__fx-lens {
  fill: rgb(var(--dls-lamp)); /* fallback where color-mix is unsupported */
  fill: color-mix(in srgb, rgb(var(--dls-lamp)) 30%, #fff);
  filter: brightness(calc(0.45 + (0.55 * var(--dls-dim, 1))))
          drop-shadow(0 0 7px rgba(var(--dls-lamp), 0.95))
          drop-shadow(0 0 18px rgba(var(--dls-lamp), 0.6));
  transition: fill 420ms ease;
}
.dls__fx--panel .dls__fx-lens {
  fill: rgba(var(--dls-lamp), 0.92);
  fill: color-mix(in srgb, rgb(var(--dls-lamp)) 20%, #fff);
  opacity: 0.9;
  filter: brightness(calc(0.45 + (0.55 * var(--dls-dim, 1))))
          drop-shadow(0 0 18px rgba(var(--dls-lamp), 0.55));
}
.dls__fx-lens-stroke {
  stroke: rgb(var(--dls-lamp));
  stroke: color-mix(in srgb, rgb(var(--dls-lamp)) 34%, #fff);
  stroke-width: 2.4px;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: brightness(calc(0.45 + (0.55 * var(--dls-dim, 1))))
          drop-shadow(0 0 8px rgba(var(--dls-lamp), 0.9));
  transition: stroke 420ms ease;
}
.dls__fx--pendant .dls__fx-lens-stroke { stroke-width: 3px; }

/* The wash a linear source throws onto the surface next to it. */
.dls__fx-glow {
  fill: none;
  stroke: rgba(var(--dls-lamp), 0.55);
  stroke-width: 22px;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: blur(10px);
  opacity: calc(0.3 + (0.7 * var(--dls-dim, 1)));
  mix-blend-mode: screen;
}
.dls__fx--pendant .dls__fx-glow { stroke-width: 16px; stroke: rgba(var(--dls-lamp), 0.5); }

/* Light leaving the fixture. A beam has no hard edge, and you only see one in
   darkness or haze, so it fades as the room fills with light. */
.dls__fx-beam {
  fill: rgba(var(--dls-lamp), 0.16);
  mix-blend-mode: screen;
  filter: blur(7px);
  opacity: calc(1 - (0.72 * var(--dls-light)));
  transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.dls__fx-beam-soft {
  fill: rgba(var(--dls-lamp), 0.10);
  mix-blend-mode: screen;
  filter: blur(12px);
  opacity: calc(1 - (0.72 * var(--dls-light)));
  transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* The moment of switching on: a short ramp with one flicker, which is what
   sells it as a light rather than an opacity change. */
.dls[data-on~="track"]      .dls__fx--track .dls__fx-lens,
.dls[data-on~="panel"]      .dls__fx--panel .dls__fx-lens,
.dls[data-on~="downlight"]  .dls__fx--downlight .dls__fx-lens,
.dls[data-on~="chandelier"] .dls__fx--chandelier .dls__fx-lens,
.dls[data-on~="cove"]       .dls__fx--cove .dls__fx-lens-stroke,
.dls[data-on~="pendant"]    .dls__fx--pendant .dls__fx-lens-stroke {
  animation: dls-strike 620ms cubic-bezier(0.25, 0.1, 0.25, 1) both;
}

@keyframes dls-strike {
  0%   { opacity: 0; }
  38%  { opacity: 1; }
  52%  { opacity: 0.55; }
  100% { opacity: 1; }
}

/* White balance: tips the scene toward the lamp. Weighted by how much of the
   light is lamp, so daylight is not recoloured by a 2200K switch. */
.dls__tint {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgb(var(--dls-tint));
  mix-blend-mode: soft-light;
  opacity: calc(0.26 * var(--dls-lampmix));
  transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1), background 500ms ease;
  pointer-events: none;
}

/* ---------- tap the light ---------- */

.dls__hot {
  position: absolute;
  z-index: 6;
  left: var(--x);
  top: var(--y);
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dls__hot::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.14);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s, background 0.3s;
}
/* The targets are invisible: rings over the photograph blocked the view. The
   light itself is the target — the cursor changes over it and its name
   appears — and the status line tells the visitor they can tap. */
.dls__hot::before { content: none; }

@keyframes dls-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45); }
  70%  { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.dls__hot-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  transform: translateX(-50%);
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  background: rgba(8, 10, 14, 0.8);
  color: #fff;
  font-size: 0.68rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.dls__hot:hover .dls__hot-label { opacity: 1; }

/* ---------- controls floating over the stage ---------- */

.dls__float {
  position: absolute;
  z-index: 7;
}
/* Kept off the ceiling's right-hand side, where the track and chandelier hang. */
.dls__float--tl { top: 0.9rem; left: 0.9rem; }
.dls__float--br { bottom: 0.9rem; right: 0.9rem; }

.dls__pill-btn,
.dls__ambient {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 100px;
  background: rgba(8, 10, 14, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
}

.dls__pill-btn {
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: border-color 0.2s, background 0.2s;
}
.dls__pill-btn[aria-pressed="true"] { border-color: var(--dls-accent); background: rgba(8, 10, 14, 0.8); }

.dls__ambient { display: flex; padding: 3px; gap: 2px; }
.dls__ambient button {
  padding: 0.35rem 0.75rem;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.dls__ambient button[aria-checked="true"] { background: #fff; color: #111318; }

.dls__state {
  position: absolute;
  z-index: 5;
  left: 1rem;
  bottom: 1rem;
  width: fit-content;
  max-width: calc(100% - 17rem);
  margin: 0;
  padding: 0.4rem 0.8rem;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 10, 14, 0.58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@container (max-width: 560px) {
  .dls__float--tl { top: 0.6rem; left: 0.6rem; }
  .dls__float--br { bottom: 0.6rem; right: 0.6rem; }
  .dls__pill-btn { padding: 0.35rem 0.6rem; font-size: 0.62rem; }
  .dls__ambient button { padding: 0.28rem 0.55rem; font-size: 0.62rem; }
  .dls__state { left: 0.6rem; bottom: 0.6rem; font-size: 0.6rem; max-width: calc(100% - 12.5rem); }
}

/* ---------- control bar ---------- */

.dls__bar {
  display: grid;
  gap: 1.1rem;
  padding: 1.1rem 1.25rem 1.35rem;
  border-top: 1px solid var(--dls-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent);
}

.dls__legend {
  padding: 0;
  margin-bottom: 0.65rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dls-muted);
}

.dls__scenes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-bottom: 1.05rem;
  border-bottom: 1px solid var(--dls-line);
}
.dls__scenes .dls__legend { margin: 0; }
.dls__scene-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.dls__scene {
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--dls-line);
  border-radius: 100px;
  background: var(--dls-surface);
  color: var(--dls-text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.dls__scene:hover { border-color: var(--dls-line-hi); }
.dls__scene[aria-pressed="true"] {
  border-color: var(--dls-accent);
  background: var(--dls-accent);
  color: #1c1505;
}

.dls__grid { display: grid; gap: 1.2rem 1.7rem; }
@container (min-width: 880px) {
  .dls__grid {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 1.3fr) minmax(0, 0.58fr);
    align-items: start;
  }
}

.dls__group { border: 0; padding: 0; margin: 0; min-width: 0; }

.dls__fixtures { display: grid; gap: 0.45rem; }
@container (min-width: 520px) {
  .dls__fixtures { grid-template-columns: 1fr 1fr; }
}

.dls__toggle {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--dls-line);
  border-radius: var(--dls-radius);
  background: var(--dls-surface);
  color: var(--dls-text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.dls__toggle:hover { border-color: var(--dls-line-hi); transform: translateY(-1px); }
.dls__toggle[aria-pressed="true"] {
  border-color: var(--dls-accent);
  background: var(--dls-surface-hi);
}

.dls__toggle-dot {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.dls__toggle[aria-pressed="true"] .dls__toggle-dot {
  background: var(--dls-accent);
  border-color: var(--dls-accent);
  box-shadow: 0 0 12px rgba(240, 180, 41, 0.8);
}

.dls__toggle-text { display: grid; gap: 1px; min-width: 0; }
.dls__toggle-text strong { font-size: 0.85rem; font-weight: 600; }
.dls__toggle-text small { font-size: 0.71rem; color: var(--dls-muted); }

/* The star ceiling is the showpiece, so it gets its own card: a night-sky
   ground, and its effects revealed only once it is on. */
.dls__feature {
  margin-top: 0.45rem;
  border: 1px solid var(--dls-line);
  border-radius: var(--dls-radius);
  background:
    radial-gradient(1px 1px at 78% 30%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1px 1px at 88% 62%, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(1.5px 1.5px at 70% 70%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(120% 160% at 100% 0%, rgba(72, 92, 190, 0.26), transparent 62%),
    var(--dls-surface);
  transition: border-color 0.2s;
}
.dls[data-on~="starry"] .dls__feature { border-color: var(--dls-accent); }

.dls__toggle--feature {
  border: 0;
  background: transparent;
}
.dls__toggle--feature:hover { transform: none; }
.dls__toggle--feature[aria-pressed="true"] { background: transparent; }
.dls__toggle--feature .dls__toggle-dot { margin-left: auto; }

.dls__star-icon { flex: 0 0 auto; width: 22px; height: 22px; fill: #d6ddff; }

.dls__star-opts {
  display: none;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.8rem 0.75rem;
}
.dls[data-on~="starry"] .dls__star-opts { display: flex; }

.dls__chip {
  padding: 0.32rem 0.7rem;
  border: 1px solid var(--dls-line);
  border-radius: 100px;
  background: transparent;
  color: var(--dls-muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.dls__chip[aria-pressed="true"] {
  color: var(--dls-text);
  border-color: rgba(240, 180, 41, 0.6);
  background: var(--dls-surface-hi);
}

/* ---------- temperature and dimmer ---------- */

.dls__readout {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}
.dls__readout-value {
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.dls__readout-note { font-size: 0.76rem; color: var(--dls-muted); }

/* Custom range: the track IS the scale — colour temperatures for the slider,
   the lamp fading up for the dimmer. */
.dls__range {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.dls__range--dim {
  --dls-track: linear-gradient(90deg, rgba(var(--dls-lamp), 0.12), rgb(var(--dls-lamp)));
}
.dls__range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 100px;
  background: var(--dls-track);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.dls__range::-moz-range-track {
  height: 8px;
  border-radius: 100px;
  background: var(--dls-track);
}
.dls__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--dls-console);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55), 0 2px 8px rgba(0, 0, 0, 0.5);
}
.dls__range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--dls-console);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55), 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Ticks sit exactly under their stops: the thumb's travel is inset by half its
   width at each end, so the ticks are too. */
.dls__ticks {
  position: relative;
  height: 2.1rem;
  margin-top: 0.2rem;
}
.dls__tick {
  position: absolute;
  top: 0;
  left: calc(10px + (100% - 20px) * var(--i) / (var(--n) - 1));
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 2px 3px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--dls-muted);
  font: inherit;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.dls__tick-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.dls__tick[aria-pressed="true"] { color: var(--dls-text); }
.dls__tick[aria-pressed="true"] .dls__tick-dot { box-shadow: 0 0 0 2px var(--dls-accent); }

.dls__switch {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.7rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--dls-text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.dls__switch small { display: block; font-size: 0.68rem; font-weight: 400; color: var(--dls-muted); }
.dls__switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 18px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.2s;
}
.dls__switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.dls__switch[aria-pressed="true"] .dls__switch-track { background: var(--dls-accent); }
.dls__switch[aria-pressed="true"] .dls__switch-track::after { transform: translateX(14px); }

.dls__buttons { display: grid; gap: 0.4rem; margin-top: 0.85rem; }

.dls__btn {
  width: 100%;
  padding: 0.55rem;
  border: 1px solid var(--dls-line);
  border-radius: var(--dls-radius);
  background: var(--dls-surface);
  color: var(--dls-text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dls__btn:hover { border-color: var(--dls-line-hi); background: var(--dls-surface-hi); }
.dls__btn--primary { border-color: rgba(240, 180, 41, 0.55); color: #ffd97a; }

.dls__caveat {
  margin: 1rem 0 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: inherit;
  opacity: 0.62;
  max-width: 62ch;
}

.dls__notice,
.dls-notice {
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--dls-accent);
  background: #fff8e6;
  color: #14161a;
  font-size: 0.85rem;
}

.dls__toggle:focus-visible,
.dls__scene:focus-visible,
.dls__chip:focus-visible,
.dls__tick:focus-visible,
.dls__switch:focus-visible,
.dls__btn:focus-visible,
.dls__pill-btn:focus-visible,
.dls__ambient button:focus-visible,
.dls__range:focus-visible {
  outline: 2px solid var(--dls-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .dls__room,
  .dls__layer,
  .dls__tint,
  .dls__fx,
  .dls__stars,
  .dls__glass > span,
  .dls__view::before { transition-duration: 1ms; }
  .dls__fx-lens,
  .dls__fx-lens-stroke,
  .dls__hot::before { animation: none !important; }
  .dls__toggle:hover { transform: none; }
}
