/* =============================================================
   HZL Microsite — Section 14: Sustainability Overview
   plan-az.com style — 3D card rotates flat into full-screen
   ─────────────────────────────────────────────────────────────
   Phase 1 (p 0.00 → 0.55) card: rotateY(-42°→0) + scale(0.5→1)
                                   + border-radius(20→0px)
   Phase 2 (p 0.50 → 0.68) overlay text fades in / rises
   Phase 3 (p 0.65 → 1.00) stats stagger in, then hold
   ============================================================= */

/* ── Section shell ──────────────────────────────────────────── */
.sustain {
  position: relative;
  background: transparent;
  margin-top: -100vh;
  z-index: 1;
}

/* ── Scroll track ─────────────────────────────────────────── */
.sustain__track {
  position: relative;
  height: 200vh;
}
/* Desktop: longer track so the reveal isn't rushed and the revealed
   content holds before fading out. Tablet (641–768) keeps its own
   shorter height (mobile.css); mobile keeps the 200vh base. */
@media (min-width: 769px) {
  .sustain__track { height: 300vh; }
}

/* ── Sticky viewport ────────────────────────────────────────── */
.sustain__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: #020c04;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ════════════════════════════════════════════════════════════
   CARD — Rise from Black
   Starts tiny + transparent at centre, scales up to fill.
   No 3-D rotation — pure scale + lift + opacity.
   ════════════════════════════════════════════════════════════ */
.sustain__card {
  position: absolute;
  inset: 0;
  overflow: hidden;
  will-change: transform, border-radius, opacity;
  /* CSS initial — overridden by JS immediately */
  transform: scale(0.1) translateY(80px);
  border-radius: 32px;
  opacity: 0;
  box-shadow:
    0 40px 90px rgba(0, 0, 0, 0.80),
    0 12px 28px rgba(0, 0, 0, 0.55);
}

.sustain__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* Scrim for text legibility. The headline/eyebrow/description/stats sit in
   the upper-middle (~20–55%), which on wide viewports lands over the bright
   sky/field — the old scrim was nearly clear there (0.18) so the text washed
   out. Darkened across the whole text band while still letting the image show. */
.sustain__img-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to bottom,
      rgba(2, 12, 4, 0.55)  0%,
      rgba(2, 12, 4, 0.50) 28%,
      rgba(2, 12, 4, 0.52) 48%,
      rgba(2, 12, 4, 0.62) 66%,
      rgba(2, 12, 4, 0.78) 82%,
      rgba(2, 12, 4, 0.90) 100%
    );
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════════
   TEXT OVERLAY
   opacity + translateY driven by JS after card is flat
   ════════════════════════════════════════════════════════════ */
.sustain__overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding:
    calc(var(--utility-h, 0px) + var(--bar-h, 76px) + 2rem)
    var(--gutter)
    4rem;
  gap: 2rem;
  /* Initial — overridden by JS */
  opacity: 0;
  transform: translateY(24px);
  will-change: opacity, transform;
}

/* Overlay is passthrough for the scroll animation, but the text and CTA
   must stay selectable / clickable — re-enable pointer events on them. */
.sustain__overlay-tag,
.sustain__overlay-bottom { pointer-events: auto; }

/* ── Section tag — top-centre ───────────────────────────────── */
.sustain__overlay-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  align-self: center;
}

.sustain__section-no {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #7fb942;
  line-height: 1;
}

.sustain__tag-divider {
  display: block;
  width: 28px;
  height: 1.5px;
  background: rgba(127, 185, 66, 0.45);
  flex-shrink: 0;
}

.sustain__eyebrow {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7fb942;
  line-height: 1;
}

/* ── Bottom content block ──────────────────────────────────── */
.sustain__overlay-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 940px;
  align-self: center;
  text-align: center;
  width: 100%;
}

.sustain__title {
  font-family: var(--font-display);
  font-size: 35px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.04;
  text-transform: uppercase;
  color: #ffffff;
  margin: 0;
  text-align: center;
  text-shadow: 0 2px 20px rgba(2, 12, 4, 0.80);
}

.sustain__body {
  font-family: var(--font-body);
  font-size: 18px;
  font-style: normal;
  line-height: 1.35;
  color: rgba(238, 242, 246, 0.88);
  margin: 0;
  max-width: 620px;
  text-align: center;
  text-shadow: 0 1px 12px rgba(2, 12, 4, 0.70);
}

/* ── Stats row ──────────────────────────────────────────────── */
.sustain__stats {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  border-top: 1px solid rgba(127, 185, 66, 0.18);
  padding-top: 1.5rem;
  margin-top: 0.25rem;
  width: 100%;
}

.sustain__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-right: 2.25rem;
  margin-right: 2.25rem;
  border-right: 1px solid rgba(127, 185, 66, 0.12);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.sustain__stat:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

.sustain__stat.is-visible {
  opacity: 1;
  transform: none;
}

/* Stat value */
.sustain__stat-value {
  font-family: var(--font-display);
  font-size: 35px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #7fb942;
  margin-bottom: 8px;
}

.sustain__stat-sup {
  font-size: 0.46em;
  font-weight: 700;
  vertical-align: top;        /* align to the top of the number, not floating above */
  line-height: 1;
  letter-spacing: 0;
}

/* Stat label */
.sustain__stat-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(238, 242, 246, 0.80);
  line-height: 1.55;
  text-shadow: 0 1px 8px rgba(2, 12, 4, 0.60);
}

/* ── CTA ─────────────────────────────────────────────────────── */
.sustain__cta-wrap {
  margin-top: 0.75rem;   /* shifted up so the button isn't cut off on shorter screens */
}

/* .sustain__cta — shimmer pill handled by shared rule in base.css */
.sustain__cta-arrow {
  display: inline-block;
  transition: transform 0.22s;
}
.sustain__cta:hover .sustain__cta-arrow { transform: translateX(5px); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sustain__card {
    transform: perspective(900px) rotateY(-180deg) scale(0.22);
  }
  .sustain__title { font-size: 35px; }
  .sustain__stats { flex-wrap: wrap; gap: 1.4rem 0; }
  .sustain__stat  {
    width: 50%;
    border-right: none;
    padding-right: 1.5rem;
    margin-right: 0;
    padding-bottom: 0;
  }
}

@media (max-width: 600px) {
  .sustain__overlay {
    padding:
      calc(var(--utility-h, 0px) + var(--bar-h, 76px) + 1.5rem)
      var(--gutter)
      2.5rem;
  }
  .sustain__title  { font-size: 28px; }
  .sustain__stats  { flex-wrap: wrap; gap: 1.2rem 0; }
  .sustain__stat   { width: 50%; }
  .sustain__stat-value { font-size: 28px; }
}

/* ── Short windows: stop the stats/CTA colliding with the bottom arc-nav.
   On low-height viewports the centred overlay content (taller once the
   stats wrap to 2 rows) reaches the fixed bottom nav. Compress the
   vertical spacing and reserve clearance below for the arc-nav. ── */
@media (min-width: 641px) and (max-height: 780px) {
  .sustain__overlay {
    justify-content: flex-start;
    gap: 0.85rem;
    padding-top: calc(var(--utility-h, 0px) + var(--bar-h, 76px) + 0.6rem);
    padding-bottom: 8rem;   /* reserve space for the bottom arc-nav */
  }
  .sustain__overlay-bottom { gap: 0.55rem; }
  .sustain__title { font-size: 27px; }
  .sustain__body  { font-size: 13px; line-height: 1.4; }
  .sustain__stats { gap: 0.7rem 0; padding-top: 0.8rem; margin-top: 0; }
  .sustain__stat-value { font-size: 23px; margin-bottom: 4px; }
  .sustain__stat-label { font-size: 10px; }
  .sustain__cta-wrap { margin-top: 0.2rem; }
}

/* ── Energy saver / reduced motion ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .sustain__card { will-change: auto; }
  .sustain__stat { transition: opacity 0.2s; }
}
