/* HELIOS GRID — community solar
   Signature system: the whole page is lit by one scroll-driven sun.
   JS writes custom properties on :root every frame:
     --day     0 (dawn) → 1 (noon)
     --sky0/1/2  sky gradient stops (warmth follows the sun)
     --shx --shy --shblur --shalpha   global shadow vector (long at dawn, short at noon)
   Everything below *consumes* those variables; nothing else knows the time. */

:root {
  --daylight: #fff8ec;
  --amber: #f5a300;
  --amber-deep: #b87a00;   /* AA-safe amber for small text on cream */
  --pine: #173f35;
  --pine-soft: #38584e;
  --glint: #ffd166;

  /* daylight defaults = mid-morning (used before JS runs / reduced motion / no-JS) */
  --day: 0.62;
  --sky0: #fff3da;
  --sky1: #fff7e6;
  --sky2: #fff8ec;
  --shx: 6px;
  --shy: 10px;
  --shblur: 26px;
  --shalpha: 0.16;

  --shadow: var(--shx) var(--shy) var(--shblur) rgba(60, 42, 5, var(--shalpha));
  --ease-sunrise: cubic-bezier(.16, .84, .32, 1);  /* fast lift, long glide */
  --font-display: "Bricolage Grotesque", "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  color: var(--pine);
  background: var(--daylight);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--amber); color: var(--pine); }

/* ---------- daylight layers ---------- */
.sky {
  position: fixed; inset: 0; z-index: -2;
  background: linear-gradient(180deg, var(--sky0) 0%, var(--sky1) 55%, var(--sky2) 100%);
}
.sun {
  position: fixed; z-index: -1;
  width: clamp(160px, 24vw, 320px); height: auto;
  left: 0; top: 0;
  /* JS sets --sunx/--suny in px; defaults ≈ mid-morning upper-left */
  transform: translate(calc(var(--sunx, 30vw) - 50%), calc(var(--suny, 24vh) - 50%));
  pointer-events: none;
  will-change: transform;
}

/* ---------- a11y ---------- */
.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 60;
  background: var(--pine); color: var(--daylight);
  padding: .55rem 1rem; border-radius: .35rem;
  text-decoration: none; font-weight: 600; font-size: .85rem;
  transition: top .2s;
}
.skip:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--amber-deep); outline-offset: 3px; border-radius: 2px; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 1.25rem;
  padding: .8rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--sky1) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(23, 63, 53, .08);
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--pine); text-decoration: none;
  font-family: var(--font-display); font-weight: 800; font-size: 1.1rem;
  letter-spacing: -.01em;
}
.daytime {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: .8rem; font-weight: 600; color: var(--pine-soft);
  display: flex; align-items: baseline; gap: .45rem;
}
.daytime-label { font-weight: 400; font-style: italic; opacity: .75; }
.nav nav { display: flex; align-items: center; gap: clamp(.7rem, 2vw, 1.4rem); }
.nav nav a {
  color: var(--pine); text-decoration: none; font-size: .9rem; font-weight: 500;
  padding: .25rem 0; border-bottom: 2px solid transparent;
  transition: border-color .25s var(--ease-sunrise);
  white-space: nowrap;
}
.nav nav a:hover { border-bottom-color: var(--amber); }
.nav-cta {
  background: var(--pine); color: var(--daylight) !important;
  padding: .5rem 1rem !important; border-radius: 2rem;
  border-bottom: none !important;
  transition: background .25s;
}
.nav-cta:hover { background: #0f2d26; }

/* ---------- shared ---------- */
main { display: block; }
section { padding: clamp(4.5rem, 10vw, 8.5rem) clamp(1.25rem, 5vw, 4rem); }
.section-head { max-width: 46rem; margin: 0 auto 3rem; text-align: center; }
.eyebrow {
  font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--amber-deep); margin-bottom: .9rem;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.04; letter-spacing: -.02em; }
h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 800; }
.section-sub { margin-top: 1rem; color: var(--pine-soft); }

.btn {
  display: inline-block; text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: .85rem 1.6rem; border-radius: 2.2rem; border: 2px solid var(--pine);
  transition: transform .3s var(--ease-sunrise), background .3s, color .3s, box-shadow .3s;
  cursor: pointer;
}
.btn-solid { background: var(--pine); color: var(--daylight); box-shadow: var(--shadow); }
.btn-solid:hover { transform: translateY(-2px); background: #0f2d26; }
.btn-ghost { background: transparent; color: var(--pine); }
.btn-ghost:hover { background: rgba(23, 63, 53, .07); }

.card {
  background: color-mix(in srgb, #ffffff 62%, var(--sky2));
  border: 1px solid rgba(23, 63, 53, .09);
  border-radius: 1.1rem;
  box-shadow: var(--shadow);
}

/* scroll reveals — sunrise easing */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease-sunrise), transform .9s var(--ease-sunrise); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
  padding-top: 7rem; padding-bottom: 0;
}
.hero-copy { max-width: 54rem; margin-inline: auto; text-align: center; position: relative; z-index: 2; }
.hero-title {
  font-size: clamp(2.7rem, 8.4vw, 6.4rem); font-weight: 800; color: var(--pine);
  margin: .4rem 0 1.4rem;
}
.hero-title em { font-style: italic; color: var(--amber-deep); }
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line > span { display: inline-block; transform: translateY(110%); }
.hero-title.shown .line > span { transform: none; transition: transform 1.1s var(--ease-sunrise); }
.hero-title.shown .line:nth-child(2) > span { transition-delay: .12s; }
.hero-sub { max-width: 40rem; margin: 0 auto 2rem; color: var(--pine-soft); font-size: clamp(1rem, 1.4vw, 1.15rem); }
.hero-actions { display: flex; gap: .9rem; justify-content: center; flex-wrap: wrap; }

.hero-hint {
  position: relative; z-index: 2;
  margin: clamp(2rem, 6vh, 4rem) auto 0; text-align: center;
  font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--pine-soft);
}
.hint-line {
  display: block; width: 1px; height: 44px; margin: .7rem auto 0;
  background: linear-gradient(var(--pine-soft), transparent);
}

.skyline { display: block; width: 100%; height: clamp(140px, 24vw, 300px); margin-top: auto; }
.panel { fill: #245448; }
.panel-glint { fill: var(--glint); opacity: 0; }
@media (prefers-reduced-motion: reduce) { .panel-glint { opacity: .35; } }

/* ---------- how ---------- */
.how-grid {
  list-style: none; display: grid; gap: 1.4rem;
  grid-template-columns: repeat(3, 1fr);
  max-width: 72rem; margin: 0 auto;
}
.how-grid .card { padding: 2rem 1.8rem; position: relative; }
.step-no {
  position: absolute; top: 1.4rem; right: 1.6rem;
  font-family: var(--font-display); font-weight: 300; font-size: 1.6rem;
  color: rgba(23, 63, 53, .28); font-variant-numeric: tabular-nums;
}
.step-icon { width: 44px; height: 44px; color: var(--pine); margin-bottom: 1.1rem; }
.how-grid h3 { font-size: 1.3rem; font-weight: 600; margin-bottom: .6rem; }
.how-grid p { color: var(--pine-soft); font-size: .95rem; }
.how-note { text-align: center; margin: 2.4rem auto 0; max-width: 40rem; color: var(--pine-soft); font-size: .9rem; }

/* ---------- impact ---------- */
.counters {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem;
  max-width: 72rem; margin: 0 auto 4rem;
}
.counter { text-align: left; border-top: 2px solid var(--pine); padding-top: 1.1rem; }
.counter dt { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--amber-deep); }
.counter dd {
  font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em;
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  font-variant-numeric: tabular-nums;
  margin: .25rem 0 .2rem;
}
.counter .unit { font-size: .55em; font-weight: 600; margin-left: .12em; }
.counter dd .unit:first-child { margin-left: 0; margin-right: .06em; }
.counter p { font-size: .85rem; color: var(--pine-soft); }

/* isotype */
.isotype { max-width: 72rem; margin: 0 auto 4rem; }
.isotype figcaption { font-size: .9rem; color: var(--pine-soft); margin-bottom: 1rem; }
.iso-key { font-weight: 600; color: var(--pine); }
.iso-row { display: flex; flex-wrap: wrap; gap: .55rem; }
.iso-house { width: clamp(26px, 3.4vw, 40px); height: auto; display: block; }
.iso-house .fill { fill: var(--amber); }
.iso-house .base { fill: none; stroke: rgba(23, 63, 53, .35); stroke-width: 1.2; }
.iso-house .fill { transform: translateY(101%); transition: transform .7s var(--ease-sunrise); }
.isotype.in .iso-house .fill { transform: translateY(var(--iso-y, 0%)); }
@media (prefers-reduced-motion: reduce) {
  .iso-house .fill { transition: none; transform: translateY(var(--iso-y, 0%)); }
}

/* day curve chart — thin strokes, tabular numerals */
.daycurve { max-width: 72rem; margin: 0 auto; }
.daycurve figcaption { font-size: .9rem; font-weight: 600; margin-bottom: 1rem; }
.fig-note { font-weight: 400; color: var(--pine-soft); }
#curve { width: 100%; height: auto; overflow: visible; }
#curve .grid-lines line { stroke: rgba(23, 63, 53, .12); }
#curve .axis-text text {
  font-family: var(--font-body); font-size: 11px; fill: var(--pine-soft);
  font-variant-numeric: tabular-nums;
}
#curve .axis-unit { font-weight: 600; }
#curve-line { stroke: var(--pine); }
#curve-area { fill: rgba(245, 163, 0, .14); }
#curve-dot .dot-core { fill: var(--amber); }
#curve-dot .dot-halo { fill: none; stroke: var(--amber); stroke-width: 1; opacity: .5; }
.curve-readout { font-size: 12px; font-weight: 600; fill: var(--pine); font-variant-numeric: tabular-nums; }

/* ---------- calculator ---------- */
.calc-inner { max-width: 62rem; margin: 0 auto; padding: clamp(2rem, 5vw, 3.6rem); }
.calc-inner .section-head { text-align: left; margin: 0 0 2.2rem; }
.demo-tag {
  display: inline-block; margin-left: .6rem; padding: .15rem .6rem;
  background: rgba(245, 163, 0, .18); color: var(--amber-deep);
  border-radius: 1rem; font-size: .7rem; letter-spacing: .08em;
}
.calc-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(1.6rem, 4vw, 3.4rem); align-items: center; }
.calc-controls label { font-weight: 600; font-size: .95rem; display: block; margin-bottom: .4rem; }
.bill-readout {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(2.6rem, 6vw, 4rem);
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-bottom: .6rem;
}
input[type="range"] {
  width: 100%; appearance: none; -webkit-appearance: none;
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--amber) var(--fill, 27%), rgba(23, 63, 53, .18) var(--fill, 27%));
  outline-offset: 6px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--glint); border: 3px solid var(--pine);
  cursor: grab; box-shadow: var(--shadow);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--glint); border: 3px solid var(--pine);
  cursor: grab; box-shadow: var(--shadow);
}
.range-ends { display: flex; justify-content: space-between; font-size: .8rem; color: var(--pine-soft); margin-top: .5rem; font-variant-numeric: tabular-nums; }
.calc-results { display: grid; gap: 1.1rem; }
.calc-results div { border-left: 3px solid var(--amber); padding-left: 1rem; }
.calc-results dt { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--pine-soft); }
.calc-results dd {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.calc-fine { margin-top: 2rem; font-size: .8rem; color: var(--pine-soft); max-width: 46rem; }

/* ---------- faq ---------- */
.faq-list { max-width: 46rem; margin: 0 auto; }
.faq-list details { border-bottom: 1px solid rgba(23, 63, 53, .16); }
.faq-list summary {
  list-style: none; cursor: pointer; position: relative;
  font-family: var(--font-display); font-weight: 600; font-size: 1.1rem;
  padding: 1.2rem 2.4rem 1.2rem 0;
}
.faq-list summary::-webkit-details-marker { display: none; }
.sum-mark {
  position: absolute; right: .2rem; top: 50%; width: 14px; height: 14px;
  transform: translateY(-50%);
}
.sum-mark::before, .sum-mark::after {
  content: ""; position: absolute; background: var(--amber-deep); border-radius: 1px;
  transition: transform .3s var(--ease-sunrise);
}
.sum-mark::before { inset: 6px 0; }
.sum-mark::after { inset: 0 6px; }
details[open] .sum-mark::after { transform: scaleY(0); }
.faq-list details p { padding: 0 0 1.3rem; color: var(--pine-soft); max-width: 42rem; }

/* ---------- enroll ---------- */
.enroll {
  background: var(--pine); color: var(--daylight);
  border-radius: clamp(1.2rem, 3vw, 2rem);
  margin: 0 clamp(.6rem, 2vw, 2rem) clamp(1rem, 2vw, 2rem);
  position: relative; overflow: hidden;
}
.enroll::before {
  /* sheen derived from the surface color, not a dark smudge */
  content: ""; position: absolute; inset: -40% -20% auto;
  height: 80%;
  background: radial-gradient(closest-side, rgba(245, 163, 0, .22), rgba(23, 63, 53, 0));
  pointer-events: none;
}
.enroll-inner { max-width: 46rem; margin: 0 auto; text-align: center; position: relative; }
.enroll .eyebrow { color: var(--glint); }
.enroll h2 { color: #fffdf6; }
.enroll-sub { margin: 1.1rem auto 2.2rem; color: rgba(255, 248, 236, .82); max-width: 36rem; }
.enroll-form { display: flex; gap: .8rem; justify-content: center; align-items: flex-end; flex-wrap: wrap; text-align: left; }
.field label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .3rem; color: rgba(255, 248, 236, .85); }
.field input {
  font: inherit; color: var(--daylight);
  background: rgba(255, 248, 236, .08);
  border: 1.5px solid rgba(255, 248, 236, .35);
  border-radius: .6rem; padding: .8rem 1rem; width: 9rem;
}
.field-grow input { width: min(18rem, 70vw); }
.field input::placeholder { color: rgba(255, 248, 236, .45); }
.field input:focus-visible { outline-color: var(--glint); }
.enroll .btn-solid { background: var(--amber); border-color: var(--amber); color: var(--pine); }
.enroll .btn-solid:hover { background: var(--glint); border-color: var(--glint); }
.enroll-confirm { margin-top: 1.4rem; font-weight: 600; color: var(--glint); min-height: 1.5em; }
.enroll-fine { margin-top: 1.6rem; font-size: .8rem; color: rgba(255, 248, 236, .6); }

/* ---------- footer ---------- */
.footer { padding: 3rem clamp(1.25rem, 5vw, 4rem) 2.2rem; }
.footer-grid {
  display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
  max-width: 72rem; margin: 0 auto 2rem;
}
.footer-brand { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; margin-bottom: .4rem; }
.footer-grid p { color: var(--pine-soft); font-size: .9rem; }
.footer-grid nav { display: flex; flex-direction: column; gap: .4rem; }
.footer-grid a { color: var(--pine); font-size: .9rem; }
.footer-fine {
  max-width: 72rem; margin: 0 auto; padding-top: 1.4rem;
  border-top: 1px solid rgba(23, 63, 53, .14);
  font-size: .8rem; color: var(--pine-soft);
}
.footer-fine a { color: var(--pine); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .how-grid { grid-template-columns: 1fr; max-width: 34rem; }
  .counters { grid-template-columns: repeat(2, 1fr); }
  .calc-grid { grid-template-columns: 1fr; }
  .daytime { display: none; }
}
@media (max-width: 640px) {
  .br-d { display: none; }
  .nav { flex-wrap: wrap; gap: .5rem .9rem; padding-block: .6rem; }
  .nav nav { gap: .8rem; width: 100%; justify-content: space-between; }
  .nav nav a { font-size: .82rem; }
  .nav-cta { padding: .4rem .8rem !important; }
  .counters { gap: 1.6rem 1rem; }
  .enroll-form .btn { width: 100%; text-align: center; }
  .field, .field-grow { width: 100%; }
  .field input, .field-grow input { width: 100%; }
  .sun { width: 40vw; }
}

/* ---------- reduced motion: fixed mid-morning light, everything visible ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-title .line > span { transform: none; transition: none; }
  .btn, .nav nav a, .sum-mark::before, .sum-mark::after { transition: none; }
  .hint-line { display: none; }
}
