/* ============================================================
   Home page — front-page.php specific styles
   Enqueued conditionally (is_front_page()) via inc/enqueue.php
   ============================================================ */

/* Front page: sticky-hero layout — override generic .site-content spacing */
.home .site-content {
  padding: 0;
  min-height: unset;
}

/* ── Sticky hero: full viewport on load; top 50vh scrolls away, bottom 50vh locks ── */
.home-hero {
  position: sticky;
  top: calc(160px - 50vh); /* top portion scrolls off; bottom 50vh locks at viewport top */
  height: calc(100vh - 160px); /* reduced from full-screen by 160px */
  z-index: 40;   /* above content (z:1); below header (z:1000) */
  overflow: hidden;
}

/* Hero section fills the sticky container */
.home-hero .hero {
  height: 100%;
  min-height: unset;
  background-color: var(--navy); /* navy fallback while halves slide in */
  background-image: none;        /* image lives on .hero-half, not the section */
}

/* ── Entrance animation: left and right halves slide in from the sides ── */
.hero-half {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  background-size: cover;
  will-change: transform;
}

.hero-half--left {
  left: 0;
  background-position: left center;
  transform: translateX(-101%);
}

.hero-half--right {
  right: 0;
  background-position: right center;
  transform: translateX(101%);
}

/* JS adds .is-loaded → halves slide to centre and meet */
.home-hero.is-loaded .hero-half--left,
.home-hero.is-loaded .hero-half--right {
  transform: translateX(0);
  transition: transform 0.9s cubic-bezier(0.16, 0.84, 0.44, 1);
}

/* Teal centre-seam flash as the halves meet (~0.85 s in) */
.home-hero.is-loaded::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  background: var(--green);
  transform: translateX(-50%);
  opacity: 0;
  animation: heroSeamFlash 0.25s ease-out 0.85s forwards;
  z-index: 5;
  pointer-events: none;
}

@keyframes heroSeamFlash {
  0%   { opacity: 0.85; }
  100% { opacity: 0; }
}

/* ── Text band: pinned to the bottom 50vh of the hero ── */
/* On full-screen load it sits near the bottom of the screen.         */
/* When the hero locks, this band aligns exactly with the 0–50vh band. */
.hero-text-band {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50vh;
  display: flex;
  align-items: center;
  z-index: 3;
}

/* Text starts hidden; reveals after the halves have joined (~0.85 s) */
.home-hero .hero__content {
  opacity: 0;
  transform: translateY(18px);
  text-align: center;
  color: #fff;
  max-width: 760px;
  margin-inline: auto;
  padding-inline: var(--container-pad);
  width: 100%;
}

.home-hero.is-loaded .hero__content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.85s ease 0.85s, transform 0.85s ease 0.85s;
}

/* Suppress per-element animations — text reveal handled by parent transition */
.home-hero .hero__overlay,
.home-hero .hero__label,
.home-hero .hero__title,
.home-hero .hero__subtitle,
.home-hero .hero-cta-buttons {
  animation: none;
}

/* Scrollable content sits behind the sticky hero */
.home-content {
  position: relative;
  z-index: 1;
  background: var(--bg);
}

@media (max-width: 768px) {
  .home-hero {
    top: calc(160px - 55vh); /* locks ~45vh band on mobile */
  }
  .hero-text-band {
    height: 45vh; /* match locked band so text centres correctly */
  }
  .home-hero .hero__title {
    font-size: clamp(1.8rem, 6vw, 3rem);
  }
}

/* prefers-reduced-motion: skip slide/fade; full-height and lock still apply */
@media (prefers-reduced-motion: reduce) {
  .hero-half--left,
  .hero-half--right {
    transform: translateX(0) !important;
    transition: none !important;
  }
  .home-hero .hero__content {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .home-hero.is-loaded::after {
    display: none;
  }
}

/* ── Shared section rhythm ── */
.section-wps,
.section-news,
.section-partners {
  padding-block: var(--space-xl);
}

.section-news {
  background: #f5f7fb;
}

/* Section heading with red underline accent */
.section-heading {
  margin-bottom: var(--space-lg);
}

.section-heading--center {
  text-align: center;
}

.section-heading__title {
  display: inline-block;
  position: relative;
  margin-bottom: 0;
}

.section-heading__title::after {
  content: '';
  display: block;
  width: 44px;
  height: 3px;
  background: var(--red);
  border-radius: 2px;
  margin-top: 0.45em;
}

.section-heading--center .section-heading__title::after {
  margin-inline: auto;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  min-height: 82vh;
  display: flex;
  align-items: center;
  background-color: var(--navy);       /* solid fallback when no image */
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  overflow: hidden;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(0, 32, 91, 0.72) 0%,
    rgba(0, 32, 91, 0.50) 100%
  );
}

.hero .container {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero__content {
  max-width: 760px;
  text-align: center;
  margin-inline: auto;
  padding-block: var(--space-xl);
  color: #fff;
}

.hero__label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 2em;
  padding: 0.3em 1.1em;
  margin-bottom: var(--space-md);
}

.hero__title {
  font-size: clamp(2.4rem, 7vw, 5rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

.hero__subtitle {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.7;
  max-width: 580px;
  margin-inline: auto;
  margin-bottom: 0;
}

/* ============================================================
   Work Packages
   ============================================================ */
.wps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

/* WP1 alone on the first row; WP2–5 auto-flow into the two columns */
.wps-grid > .wp-card:first-child {
  grid-column: 1 / -1;
}

/* Card is an <a> — reset link styles */
.wp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 2rem;
  min-height: 200px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.wp-card:hover {
  text-decoration: none;
}

.wp-card__icon {
  width: 120px;
  height: 120px;
  margin: 0 auto var(--space-lg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wp-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wp-card__icon-placeholder {
  width: 100%;
  height: 100%;
  background: rgba(0, 32, 91, 0.08);
  border-radius: 8px;
}

.wp-card__name {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--space-xs);
  line-height: 1.3;
}

.wp-card__desc {
  display: block;
  font-size: 0.82rem;
  color: var(--text);
  opacity: 0.75;
  line-height: 1.5;
}

.wps-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text);
  opacity: 0.6;
}

/* ============================================================
   News
   ============================================================ */
.section-news .section-heading {
  text-align: center;
}

.section-news .section-heading__title::after {
  margin-inline: auto;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.news-card__image {
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.news-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.news-card:hover .news-card__image img {
  transform: scale(1.05);
}

.news-card__body {
  padding: var(--space-lg);
}

.news-card__date {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
  margin-bottom: var(--space-xs);
}

.news-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  line-height: 1.35;
}

.news-card__title a {
  color: var(--navy);
}

.news-card__title a:hover {
  text-decoration: underline;
}

.news-card__excerpt {
  font-size: 0.88rem;
  color: var(--text);
  opacity: 0.8;
  line-height: 1.6;
}

.news-card__excerpt p {
  margin-bottom: 0;
}

/* MORE NEWS pill */
.news-more {
  text-align: center;
  margin-top: var(--space-lg);
}

.btn--pill {
  display: inline-block;
  padding: 0.65em 2.2em;
  border: 2px solid var(--green);
  border-radius: 2em;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}

.btn--pill:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
  text-decoration: none;
}

/* ============================================================
   Partners
   ============================================================ */
.partners-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-xl);
  align-items: start;
}

.partners-heading h2 {
  position: sticky;
  top: calc(var(--header-height) + var(--space-lg));
}

.partners-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  align-items: center;
}

.partner-card {
  background: var(--card-bg);
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  text-decoration: none;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.partner-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
  text-decoration: none;
}

.partner-card__logo {
  width: 100%;
  height: 110px;
}

.partner-card__name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  text-align: center;
}

/* ============================================================
   Hero CTA Buttons
   ============================================================ */
.hero-cta-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.hero-cta-buttons .btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
}

.hero-cta-buttons .btn-primary {
  background-color: var(--green);
  color: #fff;
  border: 2px solid var(--green);
}

.hero-cta-buttons .btn-primary:hover {
  background-color: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
  text-decoration: none;
}

/* Secondary on dark hero overlay — red fill (Canadian flag accent) */
.hero-cta-buttons .btn-secondary {
  background-color: var(--red);
  color: #fff;
  border: 2px solid var(--red);
  font-weight: 700;
}

.hero-cta-buttons .btn-secondary:hover {
  background-color: #fff;
  color: var(--red);
  border-color: #fff;
  text-decoration: none;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .partners-layout {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .partners-heading h2 {
    position: static;
  }
}

@media (max-width: 768px) {
  .wps-grid {
    grid-template-columns: 1fr; /* single column on mobile */
  }

  .wp-card__icon {
    width: 90px;
    height: 90px;
  }

  .partners-grid {
    grid-template-columns: 1fr; /* 1 per row on mobile */
  }

  .hero {
    min-height: 70vh;
  }

  .hero-cta-buttons {
    flex-direction: column;
    gap: 1rem;
  }

  .hero-cta-buttons .btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .wps-grid {
    /* Very small screens: still 2 per row but tighter */
    gap: var(--space-md);
  }
}

/* ============================================================
   Hero — on-load animations (1–2 s, staggered)
   ============================================================ */

@keyframes heroSlideUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes heroFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Overlay: fade in over 1.2 s — creates dramatic reveal */
.hero__overlay {
  animation: heroFadeIn 1.2s ease-out both;
}

/* Text elements cascade in with increasing delays */
.hero__label {
  animation: heroSlideUp 0.7s ease-out 0.3s both;
}
.hero__title {
  animation: heroSlideUp 0.9s ease-out 0.55s both;
}
.hero__subtitle {
  animation: heroSlideUp 0.7s ease-out 0.75s both;
}
.hero-cta-buttons {
  animation: heroSlideUp 0.7s ease-out 0.95s both;
}

@media (prefers-reduced-motion: reduce) {
  .hero__overlay,
  .hero__label,
  .hero__title,
  .hero__subtitle,
  .hero-cta-buttons {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
