/* ScrollCraft layer for lanailightingclips.com — demo 2026-09-04
   Pure CSS scroll-driven animation with IO fallback (.js-in). */

/* ---------- HERO: four layers ---------- */
.hero-layered {
  min-height: 100vh;
  min-height: 100svh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white);
  background: var(--navy);
}
.hero-layered .layer {
  position: absolute; inset: -10% 0 -10% 0;
  will-change: transform;
  pointer-events: none;
}
.layer-sky {
  background-size: cover;
  background-position: center 40%;
  filter: brightness(0.55) saturate(0.9);
  transform: scale(1.06);
}
/* string of lights lives in the top quarter of the hero, above the headline */
.hero-layered .layer-lights { z-index: 2; inset: -4% 0 auto 0; height: 46%; }
.layer-lights svg { width: 100%; height: 100%; display: block; }
/* proof card: a real photo of the clip in the channel, floating bottom-right.
   Scroll parallax lives on the figure, the load fade-in on .proof-inner, so they never fight. */
.hero-layered .layer-proof {
  z-index: 5; /* above the foreground gradient so the photo stays bright */
  inset: auto 3.5% 6% auto;
  width: clamp(200px, 20vw, 280px);
  margin: 0;
  pointer-events: auto;
  transform: rotate(-2deg);
}
.proof-inner {
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10,22,40,0.85);
  box-shadow: 0 20px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.12);
  opacity: 0;
  animation: word-in 0.8s ease-out both;
  animation-delay: 1.6s;
}
.layer-proof img { width: 100%; height: auto; display: block; }
.hero-layered .layer-proof--left { inset: 23% 3.5% auto auto; width: clamp(170px, 17vw, 230px); transform: rotate(2deg); }  /* beam: upper right */
.hero-layered .layer-proof--bulb { inset: 23% auto auto 3.5%; width: clamp(140px, 14vw, 190px); transform: rotate(-2deg); }  /* bulb: upper left */
.hero-layered .layer-proof--install { inset: auto auto 6% 3.5%; width: clamp(200px, 20vw, 280px); transform: rotate(2deg); }  /* install: lower left */
.layer-proof--install .proof-inner { animation-delay: 2.3s; }
.layer-proof--bulb .proof-inner { animation-delay: 2.1s; }
.layer-proof--left .proof-inner { animation-delay: 1.9s; }
.layer-proof figcaption { font-size: 0.72rem; line-height: 1.35; color: rgba(255,255,255,0.85); padding: 0.55rem 0.75rem 0.65rem; text-align: left; }
.layer-fg {
  z-index: 4;
  background:
    linear-gradient(to top, rgba(10,22,40,0.95) 0%, rgba(10,22,40,0.35) 28%, rgba(10,22,40,0) 55%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 4px);
  mask-image: linear-gradient(to top, #000 30%, transparent 75%);
}
.hero-layered .hero-content { position: relative; z-index: 5; max-width: 760px; padding: 11rem 1.5rem 4rem; }
.hero-layered h1 { text-shadow: 0 2px 18px rgba(0,0,0,0.6); }
.hero-layered p { color: rgba(255,255,255,0.88); text-shadow: 0 1px 8px rgba(0,0,0,0.6); }

/* Scroll cue */
.scroll-cue {
  position: absolute; left: 50%; bottom: 1.4rem; z-index: 6;
  transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid rgba(255,255,255,0.55); border-radius: 14px;
}
.scroll-cue::after {
  content: ""; position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; border-radius: 2px;
  background: var(--accent); transform: translateX(-50%);
  animation: cue 1.6s ease-in-out infinite;
}
@keyframes cue { 0%,100% { transform: translate(-50%,0); opacity: 1 } 60% { transform: translate(-50%,14px); opacity: 0 } }

/* Parallax: each layer moves at its own rate as the hero scrolls out */
@keyframes par-slow { to { transform: translateY(-6%) scale(1.06); } }
@keyframes par-mid  { to { transform: translateY(-14%); } }
@keyframes par-fast { to { transform: translateY(-26%); } }
@keyframes par-proof { to { transform: rotate(-2deg) translateY(-45%); opacity: 0; } }
@keyframes par-proof-l { to { transform: rotate(2deg) translateY(-30%); opacity: 0; } }
@keyframes par-proof-b { to { transform: rotate(-2deg) translateY(-30%); opacity: 0; } }
@keyframes par-proof-i { to { transform: rotate(2deg) translateY(-38%); opacity: 0; } }
@keyframes par-text { to { transform: translateY(-40%); opacity: 0.15; } }
@supports (animation-timeline: scroll()) {
  .layer-sky    { animation: par-slow linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
  .layer-lights { animation: par-mid  linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
  .hero-layered .layer-proof { animation: par-proof linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
  .hero-layered .layer-proof--left { animation-name: par-proof-l; }
  .hero-layered .layer-proof--bulb { animation-name: par-proof-b; }
  .hero-layered .layer-proof--install { animation-name: par-proof-i; }
  .layer-fg     { animation: par-fast linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
  .hero-layered .hero-content { animation: par-text linear both; animation-timeline: scroll(root); animation-range: 0 90vh; }
}

/* ---------- BULBS: light up in sequence on load ---------- */
.bulb { --i: 0; }
.bulb .glow { opacity: 0; transform-origin: center; }
.bulb .glass { fill: #3a3a3a; }
.bulb.lit .glow, .hero-layered.ready .bulb .glow {
  animation: glow-on 0.9s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(0.35s + var(--i) * 0.11s);
}
.bulb.lit .glass, .hero-layered.ready .bulb .glass {
  animation: glass-on 0.6s ease-out both;
  animation-delay: calc(0.35s + var(--i) * 0.11s);
}
@keyframes glow-on { from { opacity: 0; transform: scale(0.4) } 70% { opacity: 1; transform: scale(1.15) } to { opacity: 0.85; transform: scale(1) } }
@keyframes glass-on { from { fill: #3a3a3a } to { fill: #fff1cc } }
/* gentle sway of the whole string */
.layer-lights svg { animation: sway 7s ease-in-out infinite alternate; transform-origin: 50% 0; }
@keyframes sway { from { transform: rotate(-0.35deg) } to { transform: rotate(0.35deg) } }

/* ---------- TEXT REVEALS ---------- */
.reveal-word { display: inline-block; opacity: 0; transform: translateY(0.6em); animation: word-in 0.7s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(0.15s + var(--w) * 0.07s); }
@keyframes word-in { to { opacity: 1; transform: none } }
.reveal-late { opacity: 0; animation: word-in 0.8s ease-out both; animation-delay: 1.1s; }
.reveal-late-2 { opacity: 0; animation: word-in 0.8s ease-out both; animation-delay: 1.35s; }

/* Sections: rise in when they enter the viewport */
.rv { opacity: 0; transform: translateY(28px); }
@supports (animation-timeline: view()) {
  .rv { animation: rv-in linear both; animation-timeline: view(); animation-range: entry 0% entry 45%; }
}
.rv.js-in { opacity: 1; transform: none; transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(.2,.8,.2,1); }
@keyframes rv-in { to { opacity: 1; transform: none } }
.rv-d1 { animation-delay: 0.08s; transition-delay: 0.08s; }
.rv-d2 { animation-delay: 0.16s; transition-delay: 0.16s; }
.rv-d3 { animation-delay: 0.24s; transition-delay: 0.24s; }

/* ---------- STATS ---------- */
.stats {
  background: var(--navy); color: var(--white);
  padding: 0 1.5rem 3rem;
  margin-top: -1px;
}
.stats-inner {
  max-width: var(--max-width); margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
  border-top: 1px solid rgba(255,255,255,0.12); padding-top: 2rem;
}
.stat { text-align: center; }
.stat-num { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-num small { font-size: 0.55em; font-weight: 700; margin-left: 0.1em; }
.stat-label { font-size: 0.85rem; color: rgba(255,255,255,0.7); margin-top: 0.4rem; }

/* ---------- STACKING PRODUCT CARDS ---------- */
@media (min-width: 900px) {
  .stack { display: block; }
  .stack .product-card {
    position: sticky;
    top: calc(80px + var(--k) * 26px);
    max-width: 720px;
    margin: 0 auto 3vh;
    flex-direction: row;
    box-shadow: 0 14px 40px rgba(10,22,40,0.18);
  }
  .stack .product-card picture { flex: 0 0 46%; display: block; }
  .stack .product-card img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; }
  .stack .product-info { flex: 1 1 auto; justify-content: center; padding: 2rem; }
  .stack .product-info h3 { font-size: 1.35rem; }
  .stack-spacer { height: 0; }
  @supports (animation-timeline: view()) {
    .stack .product-card { animation: card-settle linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
  }
}
@keyframes card-settle { to { transform: scale(0.94) translateY(-10px); filter: brightness(0.92); } }

/* ---------- MOBILE ---------- */
@media (max-width: 899px) {
  .hero-layered .layer-proof { display: none; }
  /* keep the string of bulbs above the headline on narrow screens */
  .hero-layered .layer-lights { inset: -8% 0 auto 0; height: 44%; }
  .stats-inner { grid-template-columns: repeat(2, 1fr); }
  .hero-layered .hero-content { padding-top: 9rem; }
}

/* ---------- ACCESSIBILITY ---------- */
@media (prefers-reduced-motion: reduce) {
  .layer, .layer-proof, .proof-inner, .hero-layered .hero-content, .layer-lights svg, .reveal-word, .reveal-late, .reveal-late-2, .rv, .scroll-cue::after, .stack .product-card { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; }
  .bulb .glow { opacity: 0.85; } .bulb .glass { fill: #fff1cc; }
}

/* Pre-existing bug found by the verification loop 2026-09-04: footer link row does not wrap on phones, causing 19px sideways scroll on every page */
.footer-links { flex-wrap: wrap; row-gap: 0.5rem; }

/* ---------- CARDS ARE LINKS ---------- */
.proof-link { display: block; color: inherit; text-decoration: none; }
.proof-link:hover { text-decoration: none; }
.proof-link img { transition: transform 0.35s cubic-bezier(.2,.8,.2,1); }
.proof-link:hover img { transform: scale(1.05); }
.proof-inner { transition: box-shadow 0.25s; }
.proof-inner:hover { box-shadow: 0 24px 48px rgba(0,0,0,0.6), 0 0 0 2px var(--accent); }
.proof-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.proof-link figcaption::after { content: " →"; color: var(--accent); }

/* ---------- PHONE: SWIPE ROW ---------- */
.proof-row-wrap { display: none; }
@media (max-width: 899px) {
  .proof-row-wrap { display: block; background: var(--navy); padding: 0 0 1.5rem; }
  .proof-row {
    display: flex; gap: 0.8rem; margin: 0; padding: 0 1.5rem 0.6rem;
    overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; text-align: left;
  }
  .proof-row::-webkit-scrollbar { display: none; }
  .proof-row .proof-inner { flex: 0 0 62%; scroll-snap-align: center; opacity: 1; animation: none; transform: rotate(0); }
  .proof-row .proof-inner img { aspect-ratio: 4/3; object-fit: cover; width: 100%; height: auto; }
  .proof-row .proof-inner figcaption, .proof-row figcaption { font-size: 0.78rem; }
  .hero-layered .hero-content { padding-bottom: 3rem; }
}

/* ---------- BULB HOVER ---------- */
.bulb .glow { transition: transform 0.25s ease-out, opacity 0.25s ease-out; }

/* ---------- STACKING INSTALL STEPS (desktop) ---------- */
@media (min-width: 900px) {
  .steps-stack { display: block; }
  .steps-stack .step {
    position: sticky;
    top: calc(90px + var(--k) * 28px);
    max-width: 640px;
    margin: 0 auto 3vh;
    background: var(--blue);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.35);
    padding: 2.5rem 2.5rem 2.25rem;
    text-align: left;
  }
  .steps-stack .step::before { position: absolute; top: -20px; left: 2rem; }
  .steps-stack .step h3 { font-size: 1.3rem; }
  .steps-spacer { height: 0; }
  @supports (animation-timeline: view()) {
    .steps-stack .step { animation: card-settle linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
  }
}

/* ---------- HURRICANE BANNER WIND ---------- */
.hurricane-banner { position: relative; overflow: hidden; padding-top: 1rem; }
.hb-wind { max-width: 720px; margin: 0 auto 0.5rem; height: 130px; }
.hb-wind svg { width: 100%; height: 100%; display: block; overflow: visible; }
.hb-string { transform-origin: 400px 30px; animation: gust 6s cubic-bezier(.45,.05,.55,.95) infinite; }
@keyframes gust {
  0%   { transform: rotate(0deg) }
  18%  { transform: rotate(4deg) }
  30%  { transform: rotate(-3deg) }
  42%  { transform: rotate(7deg) }
  55%  { transform: rotate(-2deg) }
  70%  { transform: rotate(2.5deg) }
  100% { transform: rotate(0deg) }
}
.hb-bulb { transform-box: fill-box; transform-origin: 50% 0; animation: swing 2.2s ease-in-out infinite alternate; animation-delay: calc(var(--j) * -0.3s); }
@keyframes swing { from { transform: rotate(-9deg) } to { transform: rotate(9deg) } }
.hb-streaks path { stroke: rgba(255,255,255,0.35); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 60 200; animation: streak 2.4s linear infinite; }
.hb-streaks path:nth-child(2) { animation-delay: -0.8s; } .hb-streaks path:nth-child(3) { animation-delay: -1.5s; } .hb-streaks path:nth-child(4) { animation-delay: -0.4s; }
@keyframes streak { from { stroke-dashoffset: 260 } to { stroke-dashoffset: 0 } }
@media (prefers-reduced-motion: reduce) { .hb-string, .hb-bulb, .hb-streaks path { animation: none !important; } }

/* Pre-existing: cost table wider than a phone screen on the installation guide (found 2026-09-05) */
@media (max-width: 768px) {
  .install-section table { display: block; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
}

/* Phones: shorter reveal delays so the largest paint lands early (Lighthouse mobile LCP) */
@media (max-width: 899px) {
  .reveal-word { animation-duration: 0.45s; animation-delay: calc(0.05s + var(--w) * 0.035s); }
  .reveal-late { animation-delay: 0.4s; animation-duration: 0.5s; }
  .reveal-late-2 { animation-delay: 0.55s; animation-duration: 0.5s; }
  .layer-sky { filter: brightness(0.55); transform: none; }
}

@media (min-width: 900px) {
  .stack .product-card:last-of-type, .steps-stack .step:last-of-type { margin-bottom: 0; }
}

/* Tighter gaps around the two stacked groups on desktop */
@media (min-width: 900px) {
  section:has(> .section-inner > .stack) { padding-bottom: 1rem; }
  section:has(> .section-inner > .steps-stack) { padding-top: 2rem; padding-bottom: 1rem; }
  .cta { padding-top: 2.5rem; }
}
