/* Light-scene mixer: /lighting-design-phnom-penh/ (EN, /km/, /zh/).
   Behaviour lives in /assets/lightscene.js. The stacked <img> layers are the
   no-WebGL fallback (plus-lighter = additive); the canvas replaces them. */

.lightscene { margin-top: 2.5rem; }

.lightscene__stage {
  position: relative; aspect-ratio: 1920 / 1072; overflow: hidden;
  border-radius: var(--radius); background: #06070a;
}
.lightscene__stage img,
.lightscene__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.lightscene__layer { opacity: 0; mix-blend-mode: plus-lighter; }
@supports not (mix-blend-mode: plus-lighter) { .lightscene__layer { mix-blend-mode: screen; } }
.lightscene.is-gl .lightscene__layer { visibility: hidden; }

/* ---- fixtures you can touch in the room ---- */
.ls-hot {
  position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h);
  padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; display: none;
}
.lightscene.is-live .ls-hot { display: block; }
.ls-hot__mark {
  position: absolute; left: var(--mx); top: var(--my);
  width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  border: 1px solid rgba(244, 242, 236, 0.75);
  background: rgba(15, 13, 9, 0.35);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ls-hot__mark::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  background: rgba(244, 242, 236, 0.9); opacity: 0.35;
  transition: opacity var(--dur) var(--ease);
}
.ls-hot.is-on .ls-hot__mark::after { opacity: 1; }
.ls-hot__label {
  position: absolute; left: var(--mx); top: var(--my); transform: translate(20px, -50%);
  white-space: nowrap; padding: 0.45em 0.8em;
  font-family: var(--font-body); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: #f4f2ec; background: rgba(15, 13, 9, 0.72); border-radius: var(--radius);
  opacity: 0; pointer-events: none; transition: opacity 300ms var(--ease);
}
.ls-hot--flip .ls-hot__label { transform: translate(calc(-100% - 20px), -50%); }
@media (hover: hover) {
  .ls-hot:hover .ls-hot__label { opacity: 1; }
  .ls-hot:hover .ls-hot__mark { background: rgba(15, 13, 9, 0.6); border-color: #f4f2ec; }
}

/* ---- what the current mix is doing, in a designer's words ---- */
.ls-caption {
  font-family: var(--font-display); font-size: clamp(1.15rem, 1.9vw, 1.5rem); line-height: 1.35;
  color: var(--ink); max-width: 46ch; min-height: 2.7em; margin-top: 1.6rem;
  transition: opacity 260ms var(--ease);
}
.ls-caption.is-out { opacity: 0; }
.ls-caption:empty { display: none; }

/* ---- dimmers ---- */
.ls-channels {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(1.5rem, 4vw, 3.5rem);
  margin-top: 1.4rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.ls-channel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.ls-switch {
  display: inline-flex; align-items: center; gap: 0.7em; padding: 0.3em 0; cursor: pointer;
  border: 0; background: none; text-align: left;
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); transition: color var(--dur) var(--ease);
}
.ls-switch::before {
  content: ""; flex: none; width: 9px; height: 9px; border: 1px solid var(--g3); border-radius: var(--radius);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ls-switch[aria-pressed="true"] { color: var(--ink); }
.ls-switch[aria-pressed="true"]::before { background: var(--gold); border-color: var(--gold); }
.ls-channel__val { font-size: 0.78rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.ls-channel__role { margin-top: 0.15rem; font-size: 0.82rem; color: var(--muted); }

.ls-range {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 28px; margin: 0.5rem 0 0;
  background: none; cursor: pointer; --p: 0%;
}
.ls-range::-webkit-slider-runnable-track {
  height: 2px; border-radius: var(--radius);
  background: linear-gradient(to right, var(--ink) var(--p), var(--line) var(--p));
}
.ls-range::-moz-range-track { height: 2px; border-radius: var(--radius); background: var(--line); }
.ls-range::-moz-range-progress { height: 2px; background: var(--ink); }
.ls-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 10px; height: 20px; margin-top: -9px;
  border: 0; border-radius: var(--radius); background: var(--ink);
}
.ls-range::-moz-range-thumb { width: 10px; height: 20px; border: 0; border-radius: var(--radius); background: var(--ink); }
.ls-range:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }

/* ---- scenes + colour temperature ---- */
.ls-foot {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.6rem 3rem;
  margin-top: 2rem;
}
.ls-scenes { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.ls-toggle {
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.7em 1.3em; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: transparent; color: var(--muted);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ls-toggle[aria-pressed="true"] { color: var(--ink); border-color: var(--gold); }
@media (hover: hover) { .ls-toggle:hover { color: var(--ink); } .ls-switch:hover { color: var(--ink); } }

.ls-temp { flex: 0 1 20rem; min-width: min(100%, 15rem); }
.ls-temp__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.ls-temp__head output { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; color: var(--ink); }
/* the track is the scale itself: candle-warm to cool white */
.ls-range--temp::-webkit-slider-runnable-track { background: linear-gradient(to right, #e59a4a, #f0c690 45%, #f1e9dc 75%, #d9e2ee); }
.ls-range--temp::-moz-range-track { background: linear-gradient(to right, #e59a4a, #f0c690 45%, #f1e9dc 75%, #d9e2ee); }
.ls-range--temp::-moz-range-progress { background: none; }
.ls-range--temp::-webkit-slider-runnable-track { height: 4px; }
.ls-range--temp::-moz-range-track { height: 4px; }
.ls-range--temp::-webkit-slider-thumb { margin-top: -8px; }
.lightscene.is-basic .ls-temp { display: none; }

.ls-note { margin-top: 1.6rem; font-size: 0.82rem; color: var(--muted); }

/* Khmer and Chinese labels: no forced caps tracking on scripts without case */
:lang(km) .ls-switch, :lang(km) .ls-toggle, :lang(km) .ls-temp__head, :lang(km) .ls-hot__label,
:lang(zh) .ls-switch, :lang(zh) .ls-toggle, :lang(zh) .ls-temp__head, :lang(zh) .ls-hot__label { letter-spacing: 0.02em; font-size: 0.85rem; }
:lang(km) .ls-caption { font-family: inherit; line-height: 1.8; }

@media (max-width: 640px) {
  /* full-bleed stage: every pixel of width matters for a 16:9 room on a phone */
  .lightscene__stage { margin-inline: calc(-1 * var(--gut)); border-radius: 0; }
  .ls-hot__mark { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
  .ls-hot__mark::after { inset: 5px; }
  .ls-channels { grid-template-columns: 1fr; gap: 1.3rem; }
  .ls-caption { min-height: 4.1em; }
  .ls-temp { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ls-hot__mark, .ls-hot__mark::after, .ls-hot__label, .ls-caption,
  .ls-switch, .ls-switch::before, .ls-toggle { transition: none; }
}
