/* HKXR POWER — homepage v1
   Parallax scene: bg → transformer → switchgear → leaves(mid) → scrim → leaves(front) → copy.
   Only transform / opacity are animated; layout never changes during scroll. */

:root {
  --navy: #0d2440;
  --navy-hover: #173c66;
  --navy-soft: #31506f;
  --ink: #4d647c;
  --muted: #6b8095;
  --line: #dde7f1;
  --header-h: 72px;
  --shell: clamp(24px, 4vw, 64px);
  --sky-top: #6fb0e6;
  --sky-bottom: #dceaf6;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: #fbfdff;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 36px);
  height: var(--header-h);
  padding: 0 var(--shell);
  transition: background-color 0.35s ease, box-shadow 0.35s ease, backdrop-filter 0.35s ease;
}

.site-header.is-scrolled {
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(1.2) blur(10px);
  box-shadow: 0 1px 0 rgba(13, 36, 64, 0.09);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--navy);
  text-decoration: none;
  white-space: nowrap;
}

.brand b {
  font-weight: 500;
  color: var(--navy-soft);
}

.brand-mark {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(158deg, #1f5893 0%, #0d2440 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  width: 1.5px;
  background: rgba(255, 255, 255, 0.78);
}

.brand-mark::before {
  left: 8px;
}

.brand-mark::after {
  right: 8px;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.7vw, 28px);
  margin-left: auto;
  font-size: 13.5px;
}

.primary-nav a {
  padding: 6px 1px;
  color: var(--navy-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.primary-nav a:hover {
  color: var(--navy);
  border-bottom-color: rgba(13, 36, 64, 0.35);
}

.header-quote {
  margin-left: clamp(8px, 1.4vw, 22px);
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: var(--navy);
  border-radius: 2px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.header-quote:hover {
  background: var(--navy-hover);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-toggle span[aria-hidden] {
  display: block;
  width: 22px;
  height: 1.5px;
  margin: 5px auto;
  background: var(--navy);
}

/* ---------- Parallax scene ---------- */

.parallax-scene {
  position: relative;
  /* 250vh scroll runway inside a 100vh sticky stage → 150vh of scrubbed motion. */
  height: 250vh;
}

.scene-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
  isolation: isolate;
}

/* Layer 1 — sky / substation environment. Taller than the stage so it can
   drift slowly without ever exposing an edge. */
.scene-bg {
  position: absolute;
  top: -9%;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 118%;
  object-fit: cover;
  object-position: 50% 58%;
  pointer-events: none;
  will-change: transform;
}

/* Layer 2 / 3 — transparent equipment cut-outs. */
.scene-product {
  position: absolute;
  z-index: 2;
  height: 120vh;
  width: auto;
  pointer-events: none;
  will-change: transform;
}

.scene-transformer {
  right: 1vw;
  bottom: -12vh;
  transform-origin: 65% 55%;
}

.scene-switchgear {
  z-index: 3;
  right: 3vw;
  bottom: -3vh;
  height: 130vh;
  opacity: 0;
  transform-origin: 60% 72%;
}

/* Layer 4 / 5 — leaves canopy, mid ground and foreground. Both use the same
   transparent cut-out at different scale, blur and speed. */
.scene-leaves {
  position: absolute;
  pointer-events: none;
  will-change: transform;
}

.scene-leaves img {
  display: block;
  width: 100%;
  height: auto;
}

.scene-leaves-mid {
  z-index: 4;
  top: 0;
  left: -10%;
  width: 66%;
}

.scene-leaves-front {
  z-index: 6;
  top: 0;
  left: -30%;
  width: 108%;
  filter: blur(1.6px);
}

/* Mirrored so the two canopy layers never read as the same branch. */
.scene-leaves-front img {
  transform: scaleX(-1);
}

/* Gentle wind: each canopy sways on its own period. */
.sway {
  transform: translate3d(0, 0, 0);
  animation: sway-a 7.5s ease-in-out infinite alternate;
}

.sway-front {
  animation: sway-b 5.8s ease-in-out infinite alternate;
}

@keyframes sway-a {
  from {
    transform: translate3d(-4px, 1px, 0) rotate(-0.6deg);
  }
  to {
    transform: translate3d(5px, -2px, 0) rotate(0.9deg);
  }
}

@keyframes sway-b {
  from {
    transform: translate3d(4px, 2px, 0) rotate(0.7deg);
  }
  to {
    transform: translate3d(-6px, -2px, 0) rotate(-1.1deg);
  }
}

/* CSS-only light scrim so the left copy stays readable over sky and leaves. */
.scene-scrim {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.76) 0%,
      rgba(255, 255, 255, 0.4) 24%,
      rgba(255, 255, 255, 0) 48%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 24%);
}

/* Layer 6 — copy. Two blocks share one slot and cross-dissolve. */
.scene-copy {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}

.copy-block {
  position: absolute;
  top: 0;
  left: var(--shell);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: min(37vw, 560px);
  height: 100%;
  pointer-events: auto;
}

.copy-two {
  opacity: 0;
}

.copy-eyebrow {
  margin: 0 0 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #5b7d9e;
}

.copy-title {
  margin: 0 0 16px;
  font-size: clamp(32px, 2.9vw, 46px);
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--navy);
  text-shadow: 0 1px 18px rgba(255, 255, 255, 0.55);
}

.copy-cn {
  margin: 0 0 20px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #33506e;
}

.copy-body {
  margin: 0 0 30px;
  max-width: 34ch;
  font-size: 14.5px;
  line-height: 1.8;
  color: #3f566e;
}

.copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  padding: 13px 24px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: 2px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.button-primary {
  color: #fff;
  background: var(--navy);
}

.button-primary:hover {
  background: var(--navy-hover);
}

.button-secondary {
  color: var(--navy);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 0 0 1px rgba(13, 36, 64, 0.26);
}

.button-secondary:hover {
  background: rgba(255, 255, 255, 0.85);
}

/* ---------- Placeholder skeleton ---------- */

.placeholder-sections {
  padding: clamp(72px, 8vw, 120px) var(--shell);
  background: #fff;
  border-top: 1px solid var(--line);
}

.placeholder-head {
  max-width: 620px;
  margin-bottom: clamp(34px, 4vw, 54px);
}

.placeholder-head h2 {
  margin: 0;
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--navy);
}

.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.placeholder-card {
  padding: 26px 24px;
  background: #fcfdff;
  border: 1px solid var(--line);
  border-radius: 3px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.placeholder-card span {
  font-size: 11.5px;
  letter-spacing: 0.18em;
  color: #8ba3bb;
}

.placeholder-card h3 {
  margin: 14px 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--navy);
}

.placeholder-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.about-strip {
  padding: clamp(56px, 6vw, 88px) var(--shell);
  background: #f6fafd;
  border-top: 1px solid var(--line);
}

.about-strip p {
  margin: 0;
  max-width: 32ch;
  font-size: clamp(18px, 1.6vw, 24px);
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--navy);
}

.site-footer {
  padding: 56px var(--shell);
  background: var(--navy);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 32px;
}

.site-footer p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #fff;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .primary-nav {
    gap: 14px;
    font-size: 13px;
  }

  .copy-block {
    width: min(46vw, 480px);
  }
}

/* Mobile keeps the scroll scene but with a shorter runway, smaller parallax
   amplitudes (set in JS) and a re-flowed copy column. */
@media (max-width: 900px) {
  .nav-toggle {
    display: block;
  }

  .primary-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px var(--shell) 18px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 16px 28px rgba(13, 36, 64, 0.08);
  }

  .primary-nav.is-open {
    display: flex;
  }

  .primary-nav a {
    padding: 13px 0;
    border-bottom: 1px solid rgba(13, 36, 64, 0.07);
  }

  .header-quote {
    margin-left: 12px;
    padding: 10px 14px;
    font-size: 12.5px;
  }

  .parallax-scene {
    height: 230vh;
  }

  .scene-bg {
    top: -6%;
    height: 112%;
    object-position: 52% 62%;
  }

  .scene-transformer {
    height: 92vh;
    right: -16vw;
    bottom: -8vh;
  }

  .scene-switchgear {
    height: 96vh;
    right: -10vw;
    bottom: -4vh;
  }

  .scene-leaves-mid {
    left: -18%;
    width: 130%;
  }

  .scene-leaves-front {
    left: -48%;
    width: 195%;
  }

  /* Copy sits in the lower half so the canopy never covers it. */
  .scene-scrim {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, 0.82) 62%),
      linear-gradient(90deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 60%);
  }

  .copy-block {
    left: var(--shell);
    right: var(--shell);
    width: auto;
    justify-content: flex-end;
    padding-bottom: 11vh;
  }

  .copy-title {
    font-size: clamp(28px, 8vw, 36px);
  }

  .copy-body {
    font-size: 14px;
    max-width: 40ch;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .site-header,
  .button,
  .primary-nav a {
    transition: none;
  }

  .sway,
  .sway-front {
    animation: none;
  }
}
