﻿/* =============================================================
   Section: Hero
   Maps to: template-parts/sections/section-hero.php
   ============================================================= */

.hero {
  position: relative;
  /* Always exactly the first screen tall, with a sane floor for very
     short viewports. Reserves space for the fixed nav via padding-top
     so the headline never tucks under the header. */
  height: 100svh;
  min-height: 640px;
  max-height: 1100px;
  background: var(--ink);
  color: var(--bone);
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Bottom padding is sized to reserve space for the .proof stats row
     that visually overlaps into the hero via a negative margin-top
     (see proof.css). Keeps the hero meta rail and CTAs from colliding
     with the stat strip on shorter laptop viewports. */
  padding-block:
    calc(var(--header-h) + clamp(1.5rem, 4vw, 3rem))
    clamp(8rem, 14vw, 14rem);
  /* Straight bottom edge */
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

/* Each rotator slide is a stacked, absolutely-positioned <img> that
   fades in when the rotator JS adds .is-active. Only the active slide
   runs the Ken Burns animation -- when it ends, hero-rotator.js
   advances to the next slide. */
.hero__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  filter: grayscale(0.25) contrast(1.05);
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 900ms var(--ease-out);
  will-change: opacity, transform;
}

.hero__slide.is-active {
  opacity: 1;
  /* Duration mirrors SLIDE_DURATION_MS in assets/js/hero-rotator.js so
     the Ken Burns finishes just as the rotator crossfades. Tune both
     together if you change the dwell. */
  animation: hero-drift 8s ease-in-out forwards;
}

@keyframes hero-drift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to   { transform: scale(1.10) translate3d(-2%, -1.4%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero__slide.is-active { animation: none; transform: scale(1); }
}

/* Video variant of the hero background. Uses the same absolute-cover
   treatment as .hero__slide so it sits behind the gradient/grain
   overlays from .hero::before / .hero::after. The grayscale + contrast
   filter keeps footage tonally consistent with the photo rotator.
   Random start offset + loop are wired in assets/js/hero-rotator.js
   (ACI.initHeroVideo). */
.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  filter: grayscale(0.25) contrast(1.05);
}

/* Hero mode toggle. The aci-traxx/hero-video pattern bakes BOTH the
   <video> wrapper (.hero__media--video) AND the project rotator
   (.hero__media[data-hero-rotator] from the [traxx_hero_rotator]
   shortcode) into the same .hero. The data-hero-mode attribute on the
   section decides which surface stays visible; the inactive sibling
   is fully removed from layout so it can't intercept the gradient
   overlay or the grain texture. JS in hero-rotator.js mirrors the
   same gate so the inactive surface skips its init work entirely. */
.hero[data-hero-mode="video"]   .hero__media[data-hero-rotator] { display: none; }
.hero[data-hero-mode="rotator"] .hero__media--video             { display: none; }

/* In video mode, the right-rail meta block (Featured Work label,
   project line, detail, CTA pair) is suppressed. That rail is
   designed to cycle alongside the rotator's slides; with a continuous
   muted video there is no "currently featured project" to surface,
   so showing the rail just dumps stale static copy on screen. The
   headline group stays put — it's the editorial anchor of either
   mode. Toggle the section's data-hero-mode to "rotator" to bring
   the rail back. */
.hero[data-hero-mode="video"] .hero__meta { display: none; }

/* When the meta rail is hidden, give the headline group the full
   width so it doesn't sit awkwardly inside the half-grid column.
   Only applies above the breakpoint where the meta column would
   normally split off; below 980px the layout is single-column anyway. */
@media (min-width: 980px) {
  .hero[data-hero-mode="video"] .hero__inner {
    grid-template-columns: 1fr;
  }
  .hero[data-hero-mode="video"] .hero__headgroup {
    grid-column: 1;
  }
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(11,11,12,0.55) 0%, rgba(11,11,12,0.35) 35%, rgba(11,11,12,0.85) 100%),
    linear-gradient(90deg, rgba(11,11,12,0.55) 0%, rgba(11,11,12,0.05) 50%, rgba(11,11,12,0.35) 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("../../img/textures/grain.svg");
  background-size: 320px 320px;
  opacity: 0.08;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.hero__inner {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  /* Two rows on every viewport: headline group stays anchored at the
     top of the hero (right under the nav clearance), meta panel sits
     in the bottom-right of the same column on small screens or the
     opposite column on wide screens. Prevents the "everything piles
     up against the bottom edge" overlap on shorter laptop viewports. */
  grid-template-rows: auto 1fr auto;
  row-gap: var(--s-5);
  column-gap: var(--s-7);
}

.hero__headgroup {
  grid-row: 1;
  grid-column: 1;
  align-self: start;
  padding-top: 20px;
  transform: translate(-25px, 55px);
}

.hero__meta {
  grid-row: 3;
  grid-column: 1;
  align-self: end;
  justify-self: stretch;
}

@media (min-width: 980px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: var(--s-8);
  }
  .hero__headgroup {
    grid-row: 1 / span 2;
    grid-column: 1;
    align-self: start;
    /* No max-width cap -- each line in the headline declares its own
       white-space: nowrap below, and the grid column already bounds
       the available space. The eyebrow + the short "Since 1962." line
       are explicitly nowrap so they never wrap to a second line. */
  }
  .hero__meta {
    grid-row: 2;
    grid-column: 2;
    align-self: end;
    justify-self: end;
    max-width: 380px;
  }
}

/* ----- Left column: oversized split headline ----- */
.hero__headline {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  line-height: 0.88;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  margin: 0;
}

.hero__headline .line {
  display: block;
  /* Each editorial line is one row -- never let the browser break
     it mid-phrase. The hero is full-bleed so there's room. */
  white-space: nowrap;
}

.hero__headline .line--indent {
  padding-left: clamp(1.2rem, 6vw, 6rem);
}

/* Eyebrow above the headline never wraps either; it reads as a
   single editorial dateline ("EST. 1962 · Tacoma · WA · Roads · Utilities · Sites"). */
.hero__headgroup .eyebrow {
  white-space: nowrap;
}

.hero__headline .accent {
  color: var(--safety);
}

.hero__headline .stroke {
  -webkit-text-stroke: 1.5px var(--bone);
  color: transparent;
  font-style: italic;
}

.hero__eyebrow {
  margin-bottom: var(--s-5);
}

/* ----- Right column: meta rail ----- */
.hero__meta {
  display: grid;
  gap: var(--s-4);
  border-left: 1px solid var(--rule-dark);
  padding-left: var(--s-5);
}

@media (max-width: 979px) {
  .hero__meta {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--rule-dark);
    padding-top: var(--s-4);
  }
}

.hero__meta-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--safety);
}

.hero__meta-project {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.6vw, 1.55rem);
  line-height: 1.15;
  text-transform: uppercase;
}

.hero__meta-detail {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-dark);
  line-height: 1.5;
}

.hero__cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-3);
}

/* ----- Bottom signal: scroll cue + tagline ----- */
.hero__foot {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: var(--s-5);
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule-dark);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-dark);
  flex-wrap: wrap;
}

.hero__foot strong { color: var(--bone); font-weight: 500; }

.hero__scroll {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--bone);
}
.hero__scroll-line {
  width: 60px;
  height: 1px;
  background: var(--safety);
  position: relative;
  overflow: hidden;
}
.hero__scroll-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bone);
  transform: translateX(-100%);
  animation: scroll-pulse 2.4s ease-in-out infinite;
}
@keyframes scroll-pulse {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}
