/* ==========================================================================
   Northern Skies — design tokens
   Two explicit themes (dark default, light alternate), toggled via
   [data-theme] on <html>. No gradient text, no blur, one restrained
   signature illustration instead of decorative glows.
   ========================================================================== */
:root{
  --radius-sm: 3px;
  --radius:    5px;
  --container: 1100px;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* aurora hues — used only in the horizon illustration and as a single
     thin rule, never as text fill or ambient background glow */
  --aurora-green:  #35b57a;
  --aurora-teal:   #2f9aa6;
  --aurora-violet: #6f63c4;
}

:root,
:root[data-theme="dark"]{
  --bg:        #0c0f0e;
  --bg-alt:    #12100c;
  --surface:   #17140f;
  --border:    #2c2820;
  --text:      #e9e4da;
  --text-dim:  #b3ab9c;
  --text-mute: #766f61;
  --accent:    #4fae7c;
  --accent-ink:#06110b;
  --line:      #2c2820;

  /* hero illustration — night */
  --illus-sky-top:        #0e1210;
  --illus-celestial:      #d8dde6;
  --illus-celestial-glow: #aeb9d8;
  --illus-hill-far:       #1b2a24;
  --illus-hill-near:      #16211c;
  --illus-pond:           #16292d;
  --illus-tree-trunk:     #3a2f22;
  --illus-tree-canopy-a:  #234230;
  --illus-tree-canopy-b:  #2b4d38;
  --illus-turbine-mast:   #4a564e;
  --illus-turbine-blade:  #7c8a80;
  --illus-building:       #1c1912;
  --illus-building-line:  #33291c;
  --illus-panel:          #14202c;
  --illus-panel-line:     #2a3a48;
  --illus-cable:          #4a564e;
  --illus-battery-indicator: #e0a94f;
}

:root[data-theme="light"]{
  --bg:        #f3f0e8;
  --bg-alt:    #ece7db;
  --surface:   #fbfaf5;
  --border:    #d8d0bd;
  --text:      #241f16;
  --text-dim:  #4d4536;
  --text-mute: #8a806b;
  --accent:    #23724a;
  --accent-ink:#f3f0e8;
  --line:      #d8d0bd;

  /* hero illustration — day */
  --illus-sky-top:        #cfe7f4;
  --illus-celestial:      #eab857;
  --illus-celestial-glow: #f3cf7d;
  --illus-hill-far:       #a9cf9a;
  --illus-hill-near:      #7fb373;
  --illus-pond:           #a9d9e6;
  --illus-tree-trunk:     #7a5236;
  --illus-tree-canopy-a:  #4f8f52;
  --illus-tree-canopy-b:  #5c9c5c;
  --illus-turbine-mast:   #cfd8d2;
  --illus-turbine-blade:  #f4f8f6;
  --illus-building:       #e9e4d6;
  --illus-building-line:  #c9c0a6;
  --illus-panel:          #2c4f7c;
  --illus-panel-line:     #1b3a5c;
  --illus-cable:          #55606b;
  --illus-battery-indicator: #3fae63;
}

/* ==========================================================================
   Reset / base
   ========================================================================== */
*, *::before, *::after{ box-sizing: border-box; }

body{
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

img{ max-width: 100%; display: block; }
a{ color: inherit; }

h1, h2, h3, h4{
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 600;
}

p{ margin: 0 0 1em; color: var(--text-dim); }

.container{
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* breadcrumb-style tag, replaces the old pill "eyebrow" badge */
.crumb{
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 14px;
}
.crumb .sep{ color: var(--border); margin: 0 6px; }
.crumb .here{ color: var(--accent); }

/* buttons — flat, no lift/hover transform gimmick */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover{ border-color: var(--accent); }

.btn-accent{
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.btn-accent:hover{ filter: brightness(1.08); }

/* ==========================================================================
   Header / Nav
   ========================================================================== */
header{
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.nav-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 16px;
}

#branding h1{
  font-size: 19px;
  margin: 0;
  white-space: nowrap;
}

#branding .highlight{ color: var(--accent); font-weight: 700; }

#branding .tagline{
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
}

.nav-cluster{ display: flex; align-items: center; gap: 14px; }

nav ul{
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

nav a{
  text-decoration: none;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
nav a:hover{ color: var(--text); }
nav li.current a{ color: var(--accent); border-color: var(--accent); }

/* theme toggle */
.theme-toggle{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 6px;
  cursor: pointer;
}
.theme-toggle svg{ width: 15px; height: 15px; display: block; }
.theme-toggle .sun{ display: none; }
.theme-toggle .moon{ display: block; }
:root[data-theme="light"] .theme-toggle .sun{ display: block; }
:root[data-theme="light"] .theme-toggle .moon{ display: none; }

.nav-toggle{
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span{ width: 22px; height: 2px; background: var(--text); }

/* ==========================================================================
   Hero — horizon/aurora illustration is the one signature element
   ========================================================================== */
#showcase{
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.hero-illustration{
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--line);
}

#showcase .hero-copy{
  padding: 48px 0 64px;
}

#showcase h1{
  font-size: clamp(28px, 4.4vw, 46px);
  max-width: 20ch;
  margin-bottom: 18px;
}

#showcase p{
  font-size: 17px;
  max-width: 60ch;
}

.hero-actions{
  display: flex;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Newsletter
   ========================================================================== */
#newsletter{
  padding: 34px 0;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
}

#newsletter .container{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

#newsletter .newsletter-copy h2{ font-size: 18px; margin-bottom: 4px; }
#newsletter .newsletter-copy p{ margin: 0; font-size: 14px; }

.newsletter-form{ display: flex; gap: 10px; flex-wrap: wrap; }

.newsletter-form input[type="email"]{
  font-family: var(--font-body);
  font-size: 14px;
  padding: 11px 13px;
  min-width: 230px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.newsletter-form input[type="email"]::placeholder{ color: var(--text-mute); }

.newsletter-form input:focus,
button:focus-visible,
a:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-status{
  font-family: var(--font-mono);
  font-size: 13px;
  margin: 10px 0 0;
  min-height: 1.2em;
}
.form-status[data-state="ok"]{ color: var(--accent); }
.form-status[data-state="err"]{ color: #c25b4f; }
.form-status[data-state="pending"]{ color: var(--text-mute); }

/* ==========================================================================
   Services — a manifest/listing, not a card grid
   ========================================================================== */
#boxes{ padding: 60px 0; }
#boxes .section-head{ max-width: 60ch; margin-bottom: 30px; }
#boxes .section-head h2{ font-size: clamp(22px, 3vw, 30px); }

.manifest{
  border-top: 1px solid var(--line);
}

.manifest-row{
  display: grid;
  grid-template-columns: 110px 200px 1fr;
  gap: 20px;
  align-items: start;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.manifest-row .id{
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-mute);
  padding-top: 3px;
}

.manifest-row img{
  width: 34px;
  height: 34px;
  object-fit: contain;
  margin-bottom: 8px;
}

.manifest-row h3{ font-size: 16px; margin-bottom: 2px; }

.manifest-row p{ font-size: 14px; margin: 0; }

/* ==========================================================================
   Ad slots — plain reserved space, no decorative pattern
   ========================================================================== */
.ad-slot{
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 12px;
  min-height: 100px;
  padding: 16px;
}
.ad-slot span.bay-id{
  display: block;
  color: var(--text-mute);
  font-size: 11px;
  margin-top: 4px;
}

.ad-row{ padding: 8px 0 56px; }
.ad-slot--banner{ min-height: 90px; }
.ad-slot--rect{ min-height: 250px; max-width: 336px; margin: 0 auto; }
.ad-slot--sidebar{ min-height: 260px; }

/* ==========================================================================
   Main content / about / page layout
   ========================================================================== */
#main{ padding: 56px 0; }

.page-grid{
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  align-items: start;
}

.page-title{
  font-size: clamp(26px, 3.6vw, 34px);
  margin-bottom: 18px;
}

.panel{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--surface);
}
.panel h3{ font-size: 15px; margin-bottom: 10px; }
.panel p{ font-size: 14px; margin-bottom: 12px; }
.panel p:last-child{ margin-bottom: 0; }

#sidebar > * + *{ margin-top: 20px; }

.video-frame{
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border: 1px solid var(--line);
  overflow: hidden;
}
.video-frame iframe{ position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* stat strip */
.stat-strip{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 26px 0;
}
.stat{
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}
.stat:last-child{ border-right: none; }
.stat .stat-value{ font-family: var(--font-mono); font-size: 21px; color: var(--accent); }
.stat .stat-label{ font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); }

/* contact form */
.contact-form{ display: grid; gap: 14px; max-width: 520px; }
.contact-form label{
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.contact-form input,
.contact-form textarea{
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
.contact-form textarea{ min-height: 130px; }

/* ==========================================================================
   Footer
   ========================================================================== */
footer{
  padding: 44px 0 28px;
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
}

.footer-grid{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-brand h2{ font-size: 17px; margin-bottom: 6px; }
.footer-brand p{ font-size: 13px; margin: 0; max-width: 34ch; }

.footer-meta{ font-family: var(--font-mono); font-size: 12px; color: var(--text-mute); text-align: right; }

.footer-bottom{
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-mute);
  text-align: center;
}

/* ==========================================================================
   Hero illustration — one shared scene, re-lit for day vs night
   ========================================================================== */

/* night-only elements (stars, aurora) shown by default (dark theme);
   day-only elements (clouds) hidden by default, shown in light theme */
.day-only{ display: none; }
:root[data-theme="light"] .day-only{ display: block; }
:root[data-theme="light"] .night-only{ display: none; }

/* --- celestial disc: moon by night, sun by day, same position --- */
@keyframes celestialPulse{
  0%, 100%{ opacity: 0.85; }
  50%{ opacity: 1; }
}
.celestial-glow{ animation: celestialPulse 6s ease-in-out infinite; }

/* --- night: aurora bands drift slowly, stars twinkle --- */
.aurora-band{
  transform-box: view-box;
  transform-origin: 600px 130px;
  animation: aurora-drift 18s ease-in-out infinite alternate;
}
.aurora-band.band-2{ animation-duration: 23s; animation-delay: -4s; }
.aurora-band.band-3{ animation-duration: 15s; animation-delay: -8s; }

@keyframes aurora-drift{
  0%   { transform: translateX(-24px) scaleY(0.96); }
  50%  { transform: translateX(10px) scaleY(1.04); }
  100% { transform: translateX(28px) scaleY(0.98); }
}

.star{ animation: star-twinkle 4s ease-in-out infinite; }
@keyframes star-twinkle{
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 0.25; }
}

/* --- day: drifting clouds --- */
@keyframes cloudSway{
  0%, 100%{ transform: translateX(0); }
  50%{ transform: translateX(16px); }
}
.cloud{ animation: cloudSway 11s ease-in-out infinite; }

/* --- shared ground: trees sway, turbines spin, pond shimmers, both
       day and night, since wind and water don't stop at sundown --- */
.tree{
  transform-box: view-box;
  animation: tree-sway 4.5s ease-in-out infinite;
}
.tree-b{ transform-origin: 560px 232px; animation-duration: 5s; }
.tree-c{ transform-origin: 615px 236px; animation-duration: 4.2s; animation-delay: -1.5s; }
.tree-d{ transform-origin: 655px 230px; animation-duration: 4.8s; animation-delay: -0.8s; }

@keyframes tree-sway{
  0%, 100% { transform: rotate(-2deg); }
  50%      { transform: rotate(2deg); }
}

.turbine-blades{
  transform-box: view-box;
  animation: turbine-spin 7s linear infinite;
}
.turbine-1 .turbine-blades{ transform-origin: 790px 96px; animation-duration: 6s; }
.turbine-2 .turbine-blades{ transform-origin: 920px 84px; animation-duration: 7.5s; }

@keyframes turbine-spin{
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.pond-glint{
  animation: pond-shimmer 3.2s ease-in-out infinite;
}
@keyframes pond-shimmer{
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.8; }
}

/* --- lamp by the pond: fixture is always drawn, but the glow only
       lights up at night; this is the load that draws on the battery --- */
.lamp-glow-halo,
.lamp-glow-core{
  opacity: 0;
}
:root:not([data-theme="light"]) .lamp-glow-halo{
  opacity: 0.3;
  animation: lamp-flicker 4s ease-in-out infinite;
}
:root:not([data-theme="light"]) .lamp-glow-core{
  opacity: 0.9;
  animation: lamp-flicker 4s ease-in-out infinite;
}
@keyframes lamp-flicker{
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 1; }
}

/* --- solar panels: physically present day and night, but only glint
       and feed the battery while there's sun --- */
.panel-glint{
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
}
:root[data-theme="light"] .panel-glint{
  animation: panel-sweep 4s ease-in-out infinite;
}
.solar-2 .panel-glint{ animation-delay: -1.3s; }

/* the glint rects carry their own skewX(-8) attribute to match the panel;
   restated here because a CSS transform takes precedence over a
   presentation attribute and would otherwise cancel the skew */
@keyframes panel-sweep{
  0%, 100% { opacity: 0; transform: skewX(-8deg) translateX(-6px); }
  50%      { opacity: 0.55; transform: skewX(-8deg) translateX(6px); }
}

/* --- battery: pulses steadily since the turbines always feed it;
       the indicator colour itself is set per-theme via
       --illus-battery-indicator (amber overnight, green by day) --- */
@keyframes battery-pulse{
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}
.battery-indicator{ animation: battery-pulse 3s ease-in-out infinite; }

/* --- cables: dashed strokes with a moving dash offset read as current
       flowing. Turbine cables always flow — wind doesn't stop at night.
       Solar only flows by day. The lamp cable only flows at night,
       when it's the one load pulling from the battery. --- */
.cable{
  fill: none;
  stroke: var(--illus-cable);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 6 6;
}
@keyframes cable-flow{
  to{ stroke-dashoffset: -24; }
}

.cable-turbine{
  opacity: 0.9;
  animation: cable-flow 1.1s linear infinite;
}

.cable-solar{ opacity: 0.22; }
:root[data-theme="light"] .cable-solar{
  opacity: 0.9;
  animation: cable-flow 1.1s linear infinite;
}

.cable-lamp{ opacity: 0.9; animation: cable-flow 1.1s linear infinite; }
:root[data-theme="light"] .cable-lamp{
  opacity: 0.22;
  animation: none;
}



/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px){
  .page-grid{ grid-template-columns: 1fr; }
  #sidebar{ order: 2; }
  .manifest-row{ grid-template-columns: 1fr; gap: 6px; }
  .manifest-row .id{ padding-top: 0; }
}

@media (max-width: 720px){
  .nav-toggle{ display: flex; }

  nav{
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
  }
  nav.is-open{ max-height: 320px; }
  nav ul{ flex-direction: column; gap: 0; padding: 8px 24px 16px; }
  nav li{ padding: 10px 0; border-bottom: 1px solid var(--line); }
  nav li:last-child{ border-bottom: none; }

  header{ position: relative; }

  #newsletter .container{ flex-direction: column; align-items: stretch; }
  .newsletter-form{ flex-direction: column; }
  .newsletter-form input[type="email"]{ min-width: 0; }
  .newsletter-form button{ width: 100%; }

  .footer-grid{ flex-direction: column; }
  .footer-meta{ text-align: left; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}
