/* ==========================================================================
   Green Sun Technologies — preloader "LIGHTS ON"
   assets/css/loader.css  ·  pairs with assets/js/loader.js

   One solar street light, drawn in hairlines. Its panel charges cell by cell
   (real progress), the LED head flickers on, and the light cone opens the
   page: the page appears inside the light.

   Markup: the #gsl snippet, first child of <body>.
   Shown only when <html class="js"> (set inline in <head>), so visitors
   without JavaScript never see it. Every animated state starts hidden, so the
   first paint (before loader.js runs) is just the dark.

   Layers (inside .gsl-stage):
     .gsl-curtain  the dark scene; loader.js cuts the light cone out of it (mask)
     .gsl-beam     warm light over the page inside the cone (unmasked)
     .gsl-glow     the lit LED lens + halo (unmasked)
   Drawing units: the SVG viewBox is 0 0 520 340 and 1 unit = var(--u) px.
   The LED lens centre is (424.14, 168.07), 92.89 units long, tilted -8.75deg;
   the beam axis is 171.25deg (CSS conic angle). loader.js uses the same values.
   ========================================================================== */

/* Scroll lock while loading; the reserved gutter avoids a layout shift when
   the scrollbar comes back. Browsers paint that gutter with the root
   background, so match it to the loader's edge tone. */
html.is-loading { overflow: hidden; scrollbar-gutter: stable; background-color: #0C0C0F; }

.gsl { display: none; }

html.js .gsl {
  --void: #050507;
  --line: rgba(243, 239, 230, .34);
  --line-2: rgba(243, 239, 230, .13);
  --text: #F3EFE6;
  --muted: #8E8B98;
  --volt: #C6FF3D;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: 'Archivo', 'Arial Narrow', 'Roboto Condensed', Impact, sans-serif;
  --pad: clamp(16px, 2.2vw, 32px);

  /* the drawing: px per unit, and where its 0,0 sits (percentages of the screen) */
  --u: min(.108vh, .072vw, 1.2px);
  --lx: calc(44% - 100 * var(--u));     /* pole at 44% of the width */
  --ly: calc(21% - 24 * var(--u));      /* panel top at ~21% of the height */
  --fs: clamp(46px, 7.4vh, 88px);       /* readout numeral */

  display: block;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 2147483000;
  overflow: hidden;
  color: var(--text);
  font: 400 12px/1.4 var(--mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  overscroll-behavior: none;
  cursor: progress;
  forced-color-adjust: none;   /* decorative, short-lived: keep it intact in Windows high-contrast */
  /* Failsafe: if loader.js never runs, the curtain lifts by itself. */
  animation: gsl-failsafe .5s ease 9s forwards;
}
@keyframes gsl-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }

.gsl *, .gsl *::before, .gsl *::after { box-sizing: border-box; }

.gsl-sr {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.gsl-stage, .gsl-curtain, .gsl-beam { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }

/* ---------- the dark ------------------------------------------------------ */
.gsl-curtain {
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 62% -8%, rgba(70, 64, 112, .16), transparent 70%),   /* last of the dusk */
    radial-gradient(ellipse 120% 95% at 50% 40%, #09090D 0%, var(--void) 70%);
}
/* film grain over everything (a tiny tile); on top, so drawn shapes never punch holes in it */
.gsl-curtain::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- the street light ----------------------------------------------- */
.gsl-lamp {
  position: absolute; left: var(--lx); top: var(--ly);
  width: calc(520 * var(--u)); height: calc(340 * var(--u));
  overflow: visible; display: block;
  --sw: 1.5;   /* stroke width in drawing units; loader.js sets it to 1 CSS px */
}
.gsl-lamp path, .gsl-lamp circle {
  stroke: var(--line); stroke-width: calc(var(--sw) * 1px);
  stroke-linejoin: round;
}
.gsl-lamp .gsl-d, .gsl-lamp .gsl-lens { fill: none; }
/* solid parts are filled with the dark so they hide what is behind them; the fill
   comes in with the lines, so nothing shows before the drawing does */
.gsl-lamp .gsl-f { fill: var(--void); fill-opacity: 0; }
.gsl-lamp .gsl-d { stroke-dasharray: 1 2; stroke-dashoffset: 1.001; }
.gsl-lamp .gsl-lead { stroke: var(--line-2); }
.gsl-lamp .gsl-fin, .gsl-lamp .gsl-brk { stroke: var(--line-2); }
.gsl-lamp .gsl-pin { fill: var(--muted); stroke: none; opacity: 0; }
/* panel cells: hairline tiles that fill with charge (fill-opacity set by loader.js) */
.gsl-cells { opacity: 0; }
.gsl-lamp .gsl-c { stroke: var(--line-2); fill-opacity: 0; }
/* the LED lens, dark until the light comes on (the lit one is .gsl-glow) */
.gsl-lamp .gsl-lens { stroke: #2C2925; stroke-width: 3.2px; stroke-linecap: round; opacity: 0; }

/* the pole runs from the arm collar down off the bottom of the screen */
.gsl-pole {
  position: absolute; bottom: 0;
  left: calc(var(--lx) + 95.5 * var(--u) - .5px);
  width: calc(9 * var(--u) + 1px);
  top: calc(var(--ly) + 214 * var(--u));
  border: solid var(--line); border-width: 0 1px;
  background: var(--void);
  transform-origin: 50% 100%; transform: scaleY(0);
}

/* ---------- light: lens, halo, beam --------------------------------------- */
.gsl-glow {
  position: absolute;
  left: calc(var(--lx) + 424.14 * var(--u)); top: calc(var(--ly) + 168.07 * var(--u));
  width: calc(92.89 * var(--u)); height: calc(3.2 * var(--u));
  margin: 0; transform: translate(-50%, -50%) rotate(-8.75deg);
  opacity: 0; will-change: opacity; pointer-events: none;
}
.gsl-glow i, .gsl-glow::before, .gsl-glow::after { content: ''; position: absolute; display: block; }
/* the lens itself: white-hot */
.gsl-glow i {
  top: 0; right: 0; bottom: 0; left: 0; border-radius: 9px;
  background: #FFFDF5;
  box-shadow: 0 0 3px 1px #FFF1B8, 0 0 12px 3px rgba(255, 210, 110, .75), 0 0 34px 8px rgba(255, 160, 40, .35);
}
/* halo: wide and low, thrown downwards */
.gsl-glow::before {
  left: -60%; right: -60%; top: -60%; height: calc(220 * var(--u));
  background: radial-gradient(closest-side at 50% 18%, rgba(255, 214, 140, .30), rgba(255, 170, 60, .12) 45%, rgba(255, 122, 0, 0));
}
.gsl-glow::after {
  left: -10%; right: -10%; top: -900%; bottom: -900%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 246, 220, .55), rgba(255, 220, 150, .18) 50%, transparent);
}

/* light falling on the page inside the cone (background + mask set by loader.js) */
.gsl-beam { opacity: 0; pointer-events: none; }

/* ---------- type ----------------------------------------------------------- */
.gsl-top {
  position: absolute; left: var(--pad); right: var(--pad); top: var(--pad);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  white-space: nowrap;
}
.gsl-top > span { display: block; overflow: hidden; padding: 2px 0; }
.gsl-brand { display: grid !important; line-height: 1; }
.gsl-brand b {
  font: 900 14px/1 var(--display); font-stretch: 125%; font-variation-settings: 'wdth' 125;
  letter-spacing: -.01em; text-transform: uppercase; color: var(--text);
}
.gsl-brand small {
  margin-top: 5px; font: 500 8.5px/1 var(--mono); letter-spacing: .42em; text-transform: uppercase; color: var(--muted);
}
.gsl-geo { font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: 3px !important; }
.gsl-brand > *, .gsl-geo { opacity: 0; transform: translateY(8px); }

/* readout: a callout from the panel (the leader line ends 104 units left of the drawing) */
.gsl-read {
  position: absolute;
  right: calc(100% - var(--lx) + 104 * var(--u));
  top: calc(var(--ly) + 79 * var(--u));
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  transform: translateY(-50%);
  opacity: 0;
}
.gsl-lbl { font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.gsl-num {
  display: flex; align-items: flex-start;
  font-family: var(--display); font-weight: 800; font-stretch: 62%; font-variation-settings: 'wdth' 62;
  font-size: var(--fs); line-height: .8; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.gsl-num b { font-weight: inherit; }
.gsl-num small { font: 500 calc(var(--fs) * .2)/1 var(--mono); color: var(--muted); margin: .06em 0 0 .1em; }

.gsl-status {
  position: absolute; left: var(--pad); bottom: var(--pad); margin: 0;
  display: flex; align-items: center; gap: 10px;
  font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; opacity: 0;
}
.gsl-status i { width: 6px; height: 6px; border-radius: 1px; background: #3A3A44; transition: background .2s, box-shadow .2s; }
.gsl-status em { font-style: normal; opacity: .6; }
.gsl-on { color: rgba(243, 239, 230, .28); transition: color .2s; }

/* ---------- choreography (full run) --------------------------------------- */
/* times are ×2.5 to match STRETCH in loader.js */
.gsl--go .gsl-pole { transition: transform 2.25s var(--ease); transform: none; }
.gsl--go .gsl-cells { transition: opacity 1.25s var(--ease) .375s; opacity: .74; }
.gsl--go .gsl-f { transition: fill-opacity 1.25s 1.125s; fill-opacity: 1; }
.gsl--go .gsl-pin { transition: opacity 1s 1.875s; opacity: 1; }
.gsl--go .gsl-lens { transition: opacity 1s 1.5s; opacity: 1; }
.gsl--type .gsl-brand > *, .gsl--type .gsl-geo { transition: opacity .7s var(--ease), transform .9s var(--ease); opacity: 1; transform: none; }
.gsl--type .gsl-brand small { transition-delay: .06s; }
.gsl--type .gsl-geo { transition-delay: .1s; }
.gsl--type .gsl-read { transition: opacity .7s var(--ease) .15s; opacity: 1; }
.gsl--type .gsl-status { transition: opacity .7s var(--ease) .25s; opacity: 1; }

/* lights on: dusk — the panel stops charging, the battery feeds the lamp */
.gsl--on .gsl-cells { transition: opacity .5s var(--ease); opacity: .3; }
.gsl--on .gsl-status i { background: var(--volt); box-shadow: 0 0 10px rgba(198, 255, 61, .55); }
.gsl--on .gsl-on { color: var(--volt); }

/* the reveal: the interface steps back, the light takes over */
.gsl--reveal { pointer-events: none; cursor: auto; }
.gsl--reveal .gsl-top, .gsl--reveal .gsl-read, .gsl--reveal .gsl-status,
.gsl--reveal .gsl-lead, .gsl--reveal .gsl-pin { transition: opacity .3s; opacity: 0 !important; }

/* repeat visit in the same session: the lamp (already charged), flick, reveal */
.gsl--short .gsl-top, .gsl--short .gsl-read, .gsl--short .gsl-status, .gsl--short .gsl-lead, .gsl--short .gsl-pin { display: none; }
.gsl--short .gsl-pole { transform: none; }
.gsl--short .gsl-d { stroke-dashoffset: 0; }
.gsl--short .gsl-lens { opacity: 1; }
.gsl--short .gsl-cells { opacity: .5; }
.gsl--short .gsl-c, .gsl--short .gsl-f { fill-opacity: 1; }

/* reduced motion: a still frame (the light already on), then a plain fade */
.gsl--reduced .gsl-pole { transform: none; }
.gsl--reduced .gsl-d { stroke-dashoffset: 0; }
.gsl--reduced .gsl-pin, .gsl--reduced .gsl-lens,
.gsl--reduced .gsl-status, .gsl--reduced .gsl-glow { opacity: 1; }
.gsl--reduced .gsl-brand > *, .gsl--reduced .gsl-geo { opacity: 1; transform: none; }
.gsl--reduced .gsl-c, .gsl--reduced .gsl-f { fill-opacity: 1; }
.gsl--reduced .gsl-cells { opacity: .3; }
.gsl--reduced .gsl-read, .gsl--reduced .gsl-lead, .gsl--reduced .gsl-pin { display: none; }
.gsl--reduced .gsl-status i { background: var(--volt); }
.gsl--reduced .gsl-on { color: var(--volt); }
.gsl--reduced .gsl-beam {   /* a still cone of light */
  --bx: calc(var(--lx) + 424.14 * var(--u)); --by: calc(var(--ly) + 168.07 * var(--u));
  opacity: .8;
  background: radial-gradient(circle at var(--bx) var(--by), rgba(255, 240, 200, .42), rgba(255, 200, 100, .16) 14%, rgba(255, 150, 40, .06) 42%, rgba(255, 122, 0, 0) 75%);
  -webkit-mask: conic-gradient(from 141.25deg at var(--bx) var(--by), transparent, #000 6deg 54deg, transparent 60deg);
          mask: conic-gradient(from 141.25deg at var(--bx) var(--by), transparent, #000 6deg 54deg, transparent 60deg);
}
.gsl--reduced.gsl--out { transition: opacity .35s linear; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  html.js .gsl *, html.js .gsl *::before, html.js .gsl *::after { transition: none !important; animation: none !important; }
  html.js .gsl.gsl--out { transition: opacity .35s linear !important; }
}

/* ---------- phones and portrait screens -------------------------------------
   The drawing takes the width; readout and status sit bottom-right, clear of the pole. */
@media (max-width: 720px), (max-aspect-ratio: 4/5) {
  html.js .gsl {
    --u: min(calc((100vw - 56px) / 520), .1vh, 1.05px);
    --lx: calc(50% - 265 * var(--u));
    --ly: calc(25% - 24 * var(--u));
    --fs: clamp(44px, 7vh, 72px);
  }
  .gsl-lamp .gsl-lead, .gsl-lamp .gsl-pin { display: none; }
  .gsl-read { right: var(--pad); top: auto; bottom: calc(var(--pad) + 32px); transform: none; }
  .gsl-status { left: auto; right: var(--pad); }
}
@media (max-width: 400px) {
  .gsl-geo .gsl-city { display: none; }
  .gsl-status { font-size: 10px; letter-spacing: .1em; gap: 8px; }
  .gsl-geo { font-size: 10px; letter-spacing: .08em; }
}
/* landscape phones / short windows */
@media (max-height: 520px) and (min-aspect-ratio: 4/3) {
  html.js .gsl {
    --u: min(.13vh, .06vw);
    --lx: calc(50% - 100 * var(--u));
    --ly: calc(24% - 24 * var(--u));
    --fs: clamp(36px, 11vh, 56px);
  }
}

@media print {
  html.js .gsl { display: none; }
}
