/* ============================================================
   Helia — src/index.css  (global utilities + tokens)
   ============================================================ */

/* Display face for headings — refined optical serif paired with Inter body.
   To restyle the whole site's headings, swap --font-display below.
   Curated alternatives (each on Google Fonts):
     'Newsreader'        — warm editorial serif (current)
     'Schibsted Grotesk' — modern premium grotesk
     'Fraunces'          — high-contrast display serif  */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600&display=swap');

:root {
  --helia-bg: #F7F7F7;
  --font-display: 'Newsreader', 'Inter', Georgia, 'Times New Roman', serif;
  /* Radius scale — single source of truth. Retheme roundness here. */
  --r-card: 1.5rem;     /* 24px — content cards */
  --r-panel: 1.75rem;   /* 28px — large panels & images */
  --r-hero: 2.25rem;    /* 36px — hero CTA panel */
  --r-tile: 1rem;       /* 16px — icon tiles, chips, inputs */
  --r-tile-sm: 0.75rem; /* 12px — small interactive rows */
  --helia-green: #31463B;     /* heading dark green */
  --helia-green-2: #3C684D;
  --helia-green-3: #4A7144;
  /* premium easing tokens */
  --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  /* tonal warm-neutral wash rather than a flat grey — reads richer */
  background:
    radial-gradient(120% 80% at 50% -10%, #FBFBFA 0%, var(--helia-bg) 46%, #F2F3F0 100%);
  background-attachment: fixed;
  color: var(--helia-green);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* premium Inter rendering: contextual alternates + slashed zero off, kerning on */
  font-feature-settings: 'cv11' 1, 'ss01' 1, 'kern' 1, 'calt' 1;
  font-optical-sizing: auto;
}

/* ----- Fine grain overlay — tactility, not texture-for-its-own-sake ----- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(74, 113, 68, 0.18); color: #31463B; }

/* refined display headings — tighter optical leading, balanced wrap */
.helia-display { text-wrap: balance; font-feature-settings: 'ss01' 1, 'cv11' 1, 'kern' 1; }

/* ----- Liquid glass (chrome surfaces) ----- */
.liquid-glass {
  background: rgba(255, 255, 255, 0.01);
  background-blend-mode: luminosity;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border: none;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}
.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.15) 20%,
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0.15) 80%,
    rgba(255, 255, 255, 0.45) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* glass that sits on light bg needs a touch more body */
.liquid-glass--solid { background: rgba(255, 255, 255, 0.55); }

/* ----- Scroll-aware floating navbar ----- */
.helia-nav {
  transition: padding 0.5s var(--ease-out-soft);
}
.helia-nav__bar {
  transition:
    max-width 0.55s var(--ease-out-soft),
    background 0.4s ease,
    box-shadow 0.5s var(--ease-out-soft),
    border-color 0.4s ease,
    transform 0.5s var(--ease-out-soft);
  border: 1px solid transparent;
  border-radius: 999px;
}
.helia-nav.is-stuck { padding-top: 0.7rem; padding-bottom: 0.7rem; }
.helia-nav.is-stuck .helia-nav__bar {
  max-width: 1040px;
  background: rgba(250, 250, 249, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-color: rgba(49, 70, 59, 0.08);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 12px 30px -12px rgba(49, 70, 59, 0.22),
    0 2px 6px -2px rgba(0, 0, 0, 0.06);
  padding-left: 1.1rem;
  padding-right: 0.55rem;
}

/* ----- Premium pill button: specular shine + lift ----- */
.helia-btn {
  position: relative;
  isolation: isolate;
  transition: transform 0.45s var(--ease-out-soft), box-shadow 0.45s var(--ease-out-soft);
  will-change: transform;
}
.helia-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0) 42%);
  pointer-events: none;
  z-index: 1;
}
.helia-btn > * { position: relative; z-index: 2; }
.helia-btn:hover { transform: translateY(-2px); }
.helia-btn:active { transform: translateY(0); transition-duration: 0.1s; }

/* sheen sweep on the primary CTA */
.helia-shine { position: relative; overflow: hidden; }
.helia-shine::before {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(105deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-18deg);
  z-index: 1;
  pointer-events: none;
}
.helia-shine:hover::before {
  animation: heliaSheen 0.9s var(--ease-out-soft);
}
@keyframes heliaSheen { to { left: 130%; } }

/* refined card hover */
.helia-card {
  transition: transform 0.5s var(--ease-out-soft), box-shadow 0.5s var(--ease-out-soft);
}
.helia-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 50px -24px rgba(49, 70, 59, 0.28);
}

/* circular icon button (footer socials etc.) */
.helia-icon-btn {
  transition: transform 0.4s var(--ease-out-soft), color 0.3s ease, box-shadow 0.4s var(--ease-out-soft);
}
.helia-icon-btn:hover {
  transform: translateY(-3px);
  color: #31463B;
  box-shadow: 0 12px 26px -12px rgba(49, 70, 59, 0.35);
}

/* animated underline for inline nav links */
.helia-link {
  position: relative;
}
.helia-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease-out-soft);
}
.helia-link:hover::after { transform: scaleX(1); transform-origin: left; }

/* HowItWorks — connector draws in, step icons lift on hover */
.reveal-ready .helia-connector { transform: scaleX(0); transform-origin: center; }
.reveal-ready .helia-connector.in {
  transform: scaleX(1);
  transition: transform 1.3s var(--ease-out-soft) 0.25s;
}
.helia-step-icon {
  transition: transform 0.5s var(--ease-spring), box-shadow 0.5s var(--ease-out-soft);
}
.helia-step-glyph { transition: transform 0.5s var(--ease-spring); }
.helia-step:hover .helia-step-icon {
  transform: translateY(-5px) scale(1.07);
  box-shadow: 0 18px 34px -14px rgba(49, 70, 59, 0.4);
}
.helia-step:hover .helia-step-glyph { transform: scale(1.08) rotate(-4deg); }
.helia-step:hover .helia-step-title { color: #3C684D; }

/* tabular numerals so count-ups don't reflow width */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* trust marquee — pause on hover, dim wordmarks until hovered */
.helia-marquee { animation: scroll 40s linear infinite; }
.helia-marquee:hover { animation-play-state: paused; }
.helia-wordmark { opacity: 0.42; transition: opacity 0.4s var(--ease-out-soft); }
.helia-wordmark:hover { opacity: 1; }

/* savings calculator range slider */
.helia-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, #3C684D 0%, #4A7144 var(--pct, 50%), rgba(49,70,59,0.12) var(--pct, 50%), rgba(49,70,59,0.12) 100%);
  outline: none;
  cursor: pointer;
}
.helia-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 6px solid #31463B;
  box-shadow: 0 4px 10px -2px rgba(49,70,59,0.45), 0 0 0 1px rgba(49,70,59,0.08);
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring);
}
.helia-range::-webkit-slider-thumb:hover { transform: scale(1.14); }
.helia-range::-webkit-slider-thumb:active { transform: scale(1.06); }
.helia-range::-moz-range-thumb {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 6px solid #31463B;
  box-shadow: 0 4px 10px -2px rgba(49,70,59,0.45);
  cursor: pointer;
}

/* cursor-follow glow on stat cards */
.helia-glow { position: relative; isolation: isolate; }
.helia-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(220px circle at var(--gx, 50%) var(--gy, 0%), rgba(120,168,115,0.16), rgba(120,168,115,0) 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 0;
}
.helia-glow:hover::before { opacity: 1; }
.helia-glow > * { position: relative; z-index: 1; }
/* lighter glow for cards on the dark impact band */
.helia-glow--light::before {
  background: radial-gradient(220px circle at var(--gx, 50%) var(--gy, 0%), rgba(255,255,255,0.10), rgba(255,255,255,0) 60%);
}

/* hero scroll cue */
.helia-scroll-cue {
  width: 26px; height: 42px;
  border-radius: 999px;
  border: 1.5px solid rgba(49,70,59,0.22);
  display: flex; justify-content: center;
  padding-top: 7px;
}
.helia-scroll-cue span {
  width: 3px; height: 8px; border-radius: 999px;
  background: rgba(49,70,59,0.5);
  animation: heliaScrollDot 1.8s var(--ease-out-soft) infinite;
}
@keyframes heliaScrollDot {
  0% { opacity: 0; transform: translateY(-4px); }
  35% { opacity: 1; }
  70% { opacity: 1; transform: translateY(8px); }
  100% { opacity: 0; transform: translateY(12px); }
}

/* accessible focus rings */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #4A7144;
  outline-offset: 3px;
  border-radius: 6px;
}
.helia-range:focus-visible { outline-offset: 6px; }

/* ----- Type helper ----- */
.tracking-tight-custom { letter-spacing: -0.06em; }

/* ----- Marquee ----- */
@keyframes scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ----- Hero ambient (boomerang fallback) ----- */
@keyframes heliaDrift {
  0%   { transform: translate3d(-4%, 2%, 0) scale(1); }
  50%  { transform: translate3d(5%, -3%, 0) scale(1.12); }
  100% { transform: translate3d(-4%, 2%, 0) scale(1); }
}
@keyframes heliaDrift2 {
  0%   { transform: translate3d(3%, -2%, 0) scale(1.05); }
  50%  { transform: translate3d(-6%, 4%, 0) scale(0.95); }
  100% { transform: translate3d(3%, -2%, 0) scale(1.05); }
}
@keyframes heliaSun {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.05); }
}

/* ----- Core node pulse (orbit centre) ----- */
@keyframes heliaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(120, 168, 115, 0.45), 0 0 60px 8px rgba(120,168,115,0.25); }
  50%      { box-shadow: 0 0 0 14px rgba(120, 168, 115, 0), 0 0 90px 18px rgba(120,168,115,0.35); }
}
@keyframes heliaSpinSlow { to { transform: rotate(360deg); } }

/* badge live-dot ping */
@keyframes heliaPing {
  0%   { transform: scale(1);   opacity: 0.55; }
  70%, 100% { transform: scale(2.6); opacity: 0; }
}

/* hide scrollbars on marquee row */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ============================================================
   Reveal system — progressive enhancement.
   Elements are VISIBLE by default. Only once JS adds
   `.reveal-ready` to <body> do they start hidden and animate in
   when `.in` is added (by observer or safety timeout). If JS never
   runs, everything just stays visible — nothing can get stuck.
   ============================================================ */
.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(-18px);
}
.reveal-ready .reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: var(--rv-delay, 0s);
}

/* staggered heading characters — opacity is driven by StaggeredFade's JS
   (Web Animations API) so it can never freeze blank. Visible by default. */
.sf-char { display: inline; }
@keyframes sfFade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .reveal-ready .reveal, .reveal-ready .sf .sf-char { opacity: 1 !important; transform: none !important; animation: none !important; }
}

/* ============================================================
   Premium pass — display typography + unified image grade
   ============================================================ */

/* Headings use the display face. Defined AFTER .tracking-tight-custom so
   the serif gets its own, looser optical tracking (the tight Inter value
   reads cramped on a serif). Numbers/labels stay Inter. */
.helia-display,
.sf {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.018em;
  font-feature-settings: 'kern' 1, 'liga' 1;
}
.sf .sf-char { letter-spacing: inherit; }

/* Fluid display type — headings scale smoothly across every viewport
   (no breakpoint "steps"). Upper clamp bound == the prior desktop size,
   so large screens are unchanged; phones/tablets interpolate. Per-heading
   maxima are overridable via the --h1-max / --band-max custom properties. */
.h1-fluid   { font-size: clamp(2.05rem, 1.15rem + 4.4vw, var(--h1-max, 4.25rem)); }
.h2-fluid   { font-size: clamp(1.7rem,  1.05rem + 3.1vw, var(--h2-max, 3rem)); }
.band-fluid { font-size: clamp(1.5rem,  1.05rem + 2.3vw, var(--band-max, 2.4rem)); }

/* Radius tokens as utility classes (replace ad-hoc rounded-[..]). */
.r-card    { border-radius: var(--r-card); }
.r-panel   { border-radius: var(--r-panel); }
.r-hero    { border-radius: var(--r-hero); }
.r-tile    { border-radius: var(--r-tile); }
.r-tile-sm { border-radius: var(--r-tile-sm); }

/* Unified art-direction for every photograph (<Shot> + orbit nodes):
   one tonal grade + a hairline frame so mismatched stock reads as a
   single, intentional series rather than a grab-bag. */
.helia-img {
  filter: saturate(0.9) contrast(1.04) brightness(1.01);
}
.helia-grade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(150deg, rgba(255,244,214,0.18) 0%, rgba(255,244,214,0) 44%),
    linear-gradient(330deg, rgba(35,48,40,0.34) 0%, rgba(35,48,40,0) 50%);
  mix-blend-mode: soft-light;
}
.helia-ring {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(49,70,59,0.08);
}

/* ============================================================
   Quality pass — anchor offset, skip link, motion safety
   ============================================================ */

/* In-page anchors (#savings, #faq, #how, …) must clear the fixed navbar
   so the section heading isn't hidden underneath it on jump. */
[id] { scroll-margin-top: 104px; }

/* Keyboard skip-to-content affordance — hidden until focused. */
.helia-skip {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10001;
  transform: translateY(-160%);
  background: #31463B;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font: 500 14px 'Inter', system-ui, sans-serif;
  box-shadow: 0 10px 26px -10px rgba(49,70,59,0.5);
  transition: transform 0.25s var(--ease-out-soft);
}
.helia-skip:focus {
  transform: none;
  outline: 2px solid #4A7144;
  outline-offset: 2px;
}

/* Respect reduced-motion across the ambient/looping animations that the
   per-element guards don't already cover (marquee, orbit spin, pulses,
   drifts, scroll cue, smooth scrolling). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .helia-marquee,
  .helia-scroll-cue span,
  [style*="heliaSpinSlow"],
  [style*="heliaPulse"],
  [style*="heliaPing"],
  [style*="heliaDrift"],
  [style*="heliaSun"] { animation: none !important; }
}

/* Mobile menu — give the bar a readable backdrop while the sheet is open
   (so it reads over a hero image), and animate the sheet in. */
.helia-nav.is-open .helia-nav__bar {
  background: rgba(250, 250, 249, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-color: rgba(49, 70, 59, 0.08);
  border-radius: 18px;
  box-shadow: 0 10px 30px -14px rgba(49, 70, 59, 0.22);
}
.helia-sheet {
  animation: heliaSheetIn 0.28s var(--ease-out-soft);
  transform-origin: top center;
}
@keyframes heliaSheetIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .helia-sheet { animation: none; } }

/* ============================================================
   MOBILE RESPONSIVE OVERRIDES (≤768px) — keep desktop look intact
   ============================================================ */
@media (max-width: 768px) {
  /* Floating nav pill bg was too translucent on mobile — scrolled content
     bled through the saturated blur AND through the side/top margins where
     the pill is narrower than the viewport. On small screens, give the
     whole header a solid bg so nothing bleeds; keep the pill border for
     identity. */
  .helia-nav {
    background: rgba(250, 250, 249, 0.96);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
  }
  .helia-nav.is-stuck .helia-nav__bar { background: rgba(250, 250, 249, 0); box-shadow: none; border-color: transparent; }
  .helia-nav.is-open  .helia-nav__bar { background: rgba(250, 250, 249, 0); box-shadow: none; border-color: transparent; }

  /* Mobile dropdown sheet: fully opaque + heavier shadow so it sits
     clearly above the hero behind. Was readable as a translucent panel
     before — hero headline showed through. */
  .helia-sheet {
    background: #FAFAF9 !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.35);
  }

  /* Full-viewport dim backdrop behind the mobile sheet so the visible
     page content below the panel doesn't fight the drawer for focus. */
  .helia-nav.is-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: -1;
    animation: heliaDimIn 0.28s var(--ease-out-soft);
  }
  @keyframes heliaDimIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* Back-to-top floating FAB overlaps the bottom-right content of every
     section. Mobile users have status-bar tap to scroll-top on iOS;
     hide the FAB on small screens. */
  .helia-icon-btn.fixed.bottom-5.right-5 { display: none !important; }

  /* Step-number eyebrows ("01"/"02"/"03") use tracking-[0.2em] which
     reads as "0 1" / "0 2" at the small font size. Tighten on mobile. */
  .text-xs.tracking-\[0\.2em\].text-gray-400 { letter-spacing: 0.05em; }
}
