/* ==========================================================================
   GREENLYTES — LUMEN SCALE

   Interactive lumen-level visualizer.

   Dependencies:
   1. base.css
   2. components.css
   3. guide.css

   Scope:
   - Lumen slider and controls
   - Power indicator
   - Interactive night scene
   - House and landscape illustration
   - Dynamic lighting effects
   - Dynamic explanation panel
   - Application summary

   This file should only be loaded on pages using the lumen scale tool.
   ========================================================================== */


/* ==========================================================================
   Lumen scale container
   ========================================================================== */

.lumen-scale {
  overflow: hidden;
  border: 1px solid rgba(39, 72, 43, 0.12);
  border-radius: 26px;
  background: #f8faf6;
  box-shadow:
    0 24px 65px rgba(28, 53, 31, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

/* ==========================================================================
   Slider controls
   ========================================================================== */

.lumen-scale__controls {
  display: grid;
  grid-template-columns: 225px minmax(0, 1fr);
  align-items: center;
  gap: 48px;
  padding: 30px 35px;
  border-bottom: 1px solid rgba(39, 72, 43, 0.1);
  background: #ffffff;
}

.lumen-scale__value p {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 9px 0 0;
}

.lumen-scale__value strong {
  color: var(--color-green-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 4.2vw, 4.5rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.lumen-scale__value p span {
  color: var(--color-text-muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.88rem;
}

.lumen-scale__value > small {
  display: block;
  max-width: 210px;
  margin-top: 12px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.lumen-scale__control-panel {
  min-width: 0;
}

.lumen-scale__control-panel > label {
  display: block;
  margin-bottom: 16px;
  color: var(--color-ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.lumen-scale__slider {
  width: 100%;
  height: 7px;
  margin: 0;
  border-radius: 999px;
  appearance: none;
  background: #dce8d7;
  cursor: pointer;
}

.lumen-scale__slider::-webkit-slider-thumb {
  width: 27px;
  height: 27px;
  border: 5px solid #ffffff;
  border-radius: 50%;
  appearance: none;
  background: var(--color-green-dark);
  box-shadow:
    0 0 0 1px rgba(38, 78, 42, 0.18),
    0 7px 17px rgba(33, 72, 38, 0.22);
}

.lumen-scale__slider::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 5px solid #ffffff;
  border-radius: 50%;
  background: var(--color-green-dark);
  box-shadow:
    0 0 0 1px rgba(38, 78, 42, 0.18),
    0 7px 17px rgba(33, 72, 38, 0.22);
}

.lumen-scale__slider:focus-visible {
  outline: 3px solid rgba(72, 126, 67, 0.4);
  outline-offset: 6px;
}

.lumen-scale__ticks {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: rgba(31, 48, 34, 0.5);
  font-size: 0.68rem;
  font-weight: 750;
}

.lumen-scale__power {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin-top: 17px;
  color: rgba(31, 48, 34, 0.54);
  font-size: 0.66rem;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lumen-scale__power-track {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      rgba(111, 157, 92, 0.2),
      rgba(54, 113, 57, 0.65)
    );
}

.lumen-scale__power-track span {
  --marker-position: 10%;

  position: absolute;
  top: 50%;
  left: var(--marker-position);
  width: 9px;
  height: 9px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--color-green-dark);
  box-shadow: 0 2px 8px rgba(37, 74, 40, 0.25);
  transform: translate(-50%, -50%);
  transition: left 260ms ease;
}

/* ==========================================================================
   Visual layout
   ========================================================================== */

.lumen-scale__visual {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(285px, 0.45fr);
  min-height: 500px;
  background: #0d1c13;
}

.lumen-scale__scene {
  --scene-brightness: 0.08;
  --beam-opacity: 0.16;
  --beam-width: 32%;
  --beam-height: 66%;
  --ambient-opacity: 0.05;
  --ground-opacity: 0.06;
  --fixture-glow: 0.24;
  --window-brightness: 0.38;

  position: relative;
  min-height: 500px;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(
      180deg,
      #061422 0%,
      #0a1c22 47%,
      #15251a 48%,
      #0c1b11 100%
    );
  transition:
    filter 420ms ease,
    background 420ms ease;
}

/* ==========================================================================
   Scene stacking order

   Layer 1: ambient illumination
   Layer 2: beam and ground glow
   Layer 3: lawn, path, trees and plants
   Layer 4: house
   Layer 5: fixtures
   ========================================================================== */

.lumen-scale__ambient-light {
  z-index: 1;
  pointer-events: none;
}

.lumen-scale__beam,
.lumen-scale__ground-light {
  z-index: 2;
  pointer-events: none;
}

.lumen-scale__sky,
.lumen-scale__moon,
.lumen-scale__lawn,
.lumen-scale__path,
.lumen-scale__tree,
.lumen-scale__plant {
  z-index: 3;
}

.lumen-scale__house {
  z-index: 4;
}

.lumen-scale__fixture {
  z-index: 5;
}

.lumen-scale__sky {
  position: absolute;
  inset: 0 0 51%;
  background:
    radial-gradient(
      circle at 76% 28%,
      rgba(190, 218, 223, 0.15),
      transparent 15%
    ),
    linear-gradient(
      180deg,
      #071724 0%,
      #112632 100%
    );
}

.lumen-scale__moon {
  position: absolute;
  top: 11%;
  right: 12%;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  opacity: 0.48;
  background: #dce6df;
  box-shadow: 0 0 30px rgba(212, 230, 222, 0.18);
}

/* ==========================================================================
   House
   ========================================================================== */

.lumen-scale__house {
  position: absolute;
  right: 7%;
  bottom: 20%;
  width: 39%;
  height: 45%;
  background: #17201a;
  box-shadow: -18px 20px 45px rgba(0, 0, 0, 0.2);
}

.lumen-scale__roof {
  position: absolute;
  right: -5%;
  bottom: 100%;
  width: 110%;
  height: 32%;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  background: #111a16;
}

.lumen-scale__window,
.lumen-scale__door {
  position: absolute;
  bottom: 14%;
  background:
    rgba(
      255,
      222,
      157,
      var(--window-brightness)
    );
  box-shadow:
    0 0 30px
    rgba(
      255,
      207,
      116,
      calc(var(--window-brightness) * 0.45)
    );
  transition:
    background 420ms ease,
    box-shadow 420ms ease;
}

.lumen-scale__window {
  width: 25%;
  height: 36%;
}

.lumen-scale__window--one {
  left: 11%;
}

.lumen-scale__window--two {
  left: 41%;
}

.lumen-scale__door {
  right: 10%;
  width: 20%;
  height: 54%;
}

.lumen-scale__step {
  position: absolute;
  right: 7%;
  bottom: -5%;
  width: 28%;
  height: 10%;
  background: #31382f;
}

/* ==========================================================================
   Path and lawn
   ========================================================================== */

.lumen-scale__path {
  position: absolute;
  left: 13%;
  bottom: -13%;
  width: 43%;
  height: 66%;
  clip-path: polygon(36% 0, 63% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(
      180deg,
      #414b3e 0%,
      #2f3930 100%
    );
  opacity: 0.83;
}

.lumen-scale__lawn {
  position: absolute;
  inset: 48% 0 0;
  z-index: 3;
  background:
    linear-gradient(
      180deg,
      #1b2e1e 0%,
      #0c1d11 100%
    );
}

/* ==========================================================================
   Trees and plants
   ========================================================================== */

.lumen-scale__tree {
  position: absolute;
  bottom: 22%;
  width: 15px;
  height: 120px;
  border-radius: 8px;
  background: #132017;
}

.lumen-scale__tree > span {
  position: absolute;
  left: 50%;
  bottom: 78%;
  width: 105px;
  height: 125px;
  border-radius: 50% 50% 42% 42%;
  background: #102017;
  transform: translateX(-50%);
}

.lumen-scale__tree--one {
  left: 8%;
}

.lumen-scale__tree--two {
  left: 64%;
  bottom: 18%;
  transform: scale(0.78);
}

.lumen-scale__plant {
  position: absolute;
  bottom: 17%;
  border-radius: 50% 50% 35% 35%;
  background: #172b1c;
}

.lumen-scale__plant--one {
  left: 4%;
  width: 58px;
  height: 83px;
}

.lumen-scale__plant--two {
  left: 58%;
  width: 71px;
  height: 106px;
}

.lumen-scale__plant--three {
  right: 2%;
  width: 48px;
  height: 72px;
}

/* ==========================================================================
   Light fixtures
   ========================================================================== */

.lumen-scale__fixture {
  position: absolute;
  bottom: 21%;
  width: 5px;
  height: 51px;
  border-radius: 3px;
  background: #18231b;
}

.lumen-scale__fixture-head {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 23px;
  height: 19px;
  border-radius: 4px 4px 8px 8px;
  background: #1d2b20;
  transform: translateX(-50%);
}

.lumen-scale__fixture-head::after {
  content: "";
  position: absolute;
  inset: 5px 4px 3px;
  border-radius: 2px;
  background: #ffe3a6;
  box-shadow:
    0 0 20px
    rgba(
      255,
      214,
      136,
      calc(var(--fixture-glow) * 1.3)
    );
}

.lumen-scale__fixture-glow {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  opacity: var(--fixture-glow);
  background: #ffe4a7;
  filter: blur(7px);
  transform: translateX(-50%);
  transition:
    width 420ms ease,
    height 420ms ease,
    opacity 420ms ease;
}

.lumen-scale__fixture-glow::after {
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  background: rgba(255, 229, 163, 0.35);
  filter: blur(14px);
}

.lumen-scale__fixture--one {
  left: 22%;
}

.lumen-scale__fixture--two {
  left: 39%;
  bottom: 31%;
}

.lumen-scale__fixture--three {
  left: 52%;
  bottom: 40%;
}

.lumen-scale__fixture--four {
  left: 67%;
  bottom: 49%;
}

/* ==========================================================================
   Dynamic light effects
   ========================================================================== */

.lumen-scale__beam {
  position: absolute;
  z-index: 2;
  left: 38%;
  bottom: -8%;
  width: var(--beam-width);
  height: var(--beam-height);
  opacity: var(--beam-opacity);
  clip-path: polygon(43% 0, 57% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(
      180deg,
      rgba(255, 228, 159, 0.22),
      rgba(255, 216, 125, 0.68)
    );
  filter: blur(4px);
  transform: translateX(-50%);
  transform-origin: center bottom;
  transition:
    width 430ms cubic-bezier(0.22, 1, 0.36, 1),
    height 430ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 430ms ease;
  pointer-events: none;
}

.lumen-scale__ambient-light {
  position: absolute;
  z-index: 1;
  inset: 0;
  opacity: var(--ambient-opacity);
  pointer-events: none;
  background:
    radial-gradient(
      circle at 43% 60%,
      rgba(255, 235, 180, 0.85),
      rgba(255, 217, 130, 0.25) 32%,
      transparent 72%
    );
  mix-blend-mode: screen;
  will-change: opacity;
  transition: opacity 430ms ease;
}

.lumen-scale__ground-light {
  position: absolute;
  z-index: 2;
  left: 43%;
  bottom: -23%;
  width: 95%;
  height: 85%;
  border-radius: 50%;
  opacity: var(--ground-opacity);
  background:
    radial-gradient(
      ellipse,
      rgba(255, 226, 157, 0.8) 0%,
      rgba(255, 212, 119, 0.28) 36%,
      transparent 72%
    );
  filter: blur(10px);
  transform: translateX(-50%);
  transition:
    width 430ms ease,
    opacity 430ms ease;
  will-change: width, opacity;
}

/* ==========================================================================
   Dynamic explanation panel
   ========================================================================== */

.lumen-scale__visual-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 38px 35px;
  color: #ffffff;
  background:
    linear-gradient(
      145deg,
      #173c22 0%,
      #092a17 100%
    );
}

.lumen-scale__visual-copy-inner {
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.lumen-scale__visual-copy.is-changing
  .lumen-scale__visual-copy-inner {
  opacity: 0;
  transform: translateY(8px);
}

.lumen-scale__level {
  color: #b9d9ac;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.lumen-scale__visual-copy p {
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.4rem, 2.3vw, 2.1rem);
  line-height: 1.34;
}

/* ==========================================================================
   Application summary
   ========================================================================== */

.lumen-scale__summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid rgba(39, 72, 43, 0.1);
  background: #ffffff;
}

.lumen-scale__summary-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 17px;
  padding: 27px 32px;
}

.lumen-scale__summary-card + .lumen-scale__summary-card {
  border-left: 1px solid rgba(39, 72, 43, 0.1);
}

.lumen-scale__summary-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.lumen-scale__summary-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lumen-scale__summary-icon--good {
  color: var(--color-green-dark);
  background: #eaf3e5;
}

.lumen-scale__summary-icon--avoid {
  color: #9b3f34;
  background: #f8ebe8;
}

.lumen-scale__summary-card ul {
  display: grid;
  gap: 7px;
  margin: 13px 0 0;
  padding: 0;
  list-style: none;
}

.lumen-scale__summary-card li {
  position: relative;
  padding-left: 15px;
  color: var(--color-text-muted);
  font-size: 0.80rem;
  line-height: 1.45;
}

.lumen-scale__summary-card li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-green-dark);
}

/* ==========================================================================
   RESPONSIVE — LUMEN SCALE
   ========================================================================== */

@media (max-width: 1050px) {
  .lumen-scale__visual {
    grid-template-columns: 1fr;
  }

  .lumen-scale__visual-copy {
    min-height: 230px;
  }
}

@media (max-width: 680px) {
  .lumen-scale {
    border-radius: 21px;
  }

  .lumen-scale__controls {
    grid-template-columns: 1fr;
    gap: 27px;
    padding: 25px 20px;
  }

  .lumen-scale__value > small {
    max-width: none;
  }

  .lumen-scale__ticks {
    font-size: 0.64rem;
  }

  .lumen-scale__power {
    grid-template-columns: auto minmax(55px, 1fr) auto;
    font-size: 0.62rem;
  }

  .lumen-scale__scene {
    min-height: 355px;
  }

  .lumen-scale__visual {
    min-height: 0;
  }

  .lumen-scale__visual-copy {
    min-height: 0;
    padding: 30px 22px;
  }

  .lumen-scale__summary {
    grid-template-columns: 1fr;
  }

  .lumen-scale__summary-card {
    padding: 24px 20px;
  }

  .lumen-scale__summary-card
    + .lumen-scale__summary-card {
    border-top: 1px solid rgba(39, 72, 43, 0.1);
    border-left: 0;
  }
}


/* ==========================================================================
   REDUCED MOTION — LUMEN SCALE
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .lumen-scale__scene *,
  .lumen-scale__visual-copy-inner,
  .lumen-scale__value > small,
  .lumen-scale__power-track span {
    transition: none;
  }
}