/**
 * @file
 * Full-bleed, animated homepage hero -- matching the D7 homepage: the image
 * fills the section edge to edge (no floating white content card, no
 * horizontal border/margin), text is centered over it with a dark scrim
 * for legibility, and the image/heading/button fade in in sequence.
 *
 * The base "hero" SDC (components/hero/hero.css) is a generic, heavily
 * parameterized component built around CSS custom properties -- this file
 * redefines the relevant --hero-*/--field-hero-image-* properties at
 * higher specificity (repeated classes) rather than fighting it, so this
 * works regardless of the two files' load order. It also adds sizing for
 * the *actual* image field class (.field--name-field-image), since the
 * base component's image rules target .field--name-field-hero-image, a
 * field name that doesn't exist on this project's hero paragraph type --
 * they've never applied.
 */

.paragraph--type--hero .hero.hero {
  --hero-min-height: 85vh;
  min-height: var(--hero-min-height);
}

/* The real image field (not .field--name-field-hero-image, which the base
 * component styles but which doesn't exist here) -- full-bleed cover. */
.paragraph--type--hero .field--name-field-image {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.paragraph--type--hero .field--name-field-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dark scrim between the image and the text so the heading/button stay
 * legible regardless of what the photo looks like. A flat gradient alone
 * wasn't dark enough against a bright photo -- darkened it and added a
 * radial darkening centered on the text itself as a second layer of
 * insurance, plus a text-shadow on the text as a third. */
.paragraph--type--hero .hero__overlay.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgb(0 0 0 / 0.55) 0%, rgb(0 0 0 / 0.3) 60%, rgb(0 0 0 / 0.35) 100%),
    linear-gradient(180deg, rgb(0 0 0 / 0.35) 0%, rgb(0 0 0 / 0.6) 100%);
}

/* Replace the floating 40vw white card with a full-bleed, centered
 * overlay. */
.paragraph--type--hero .hero .hero__container.hero__container {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: var(--sp2);
  background: transparent;
}

.paragraph--type--hero .hero__text-container.hero__text-container {
  position: relative;
  z-index: 2;
  max-width: 40rem;
  text-align: center;
  color: var(--color--white);
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.6), 0 1px 12px rgb(0 0 0 / 0.4);
}

.paragraph--type--hero .hero__text-container .field--name-field-hero-title {
  color: var(--color--white);
}

/* Same green/white/black treatment as the Donate banner's button. Bold to
 * match the Donate button, which gets font-weight:700 for free from the
 * base .button class -- this link doesn't use that class, so it needs its
 * own font-weight. */
.paragraph--type--hero .hero__text-container .field--name-field-cta a {
  display: inline-block;
  margin-block-start: var(--sp1);
  padding: 0.5rem 1.5rem;
  border-radius: var(--border-radius);
  background-color: rgb(139, 192, 0);
  color: var(--color--white);
  font-weight: 700;
  text-shadow: none;
  text-decoration: none;
}

/* White card behind the mission-statement paragraph (field_description) so
 * it stays readable at body-copy length regardless of the photo behind it --
 * the grey (#444, set in theme.css for the old white-card hero layout) reads
 * as nearly invisible over a dark photo + scrim. */
.paragraph--type--hero .hero__text-container .field--name-field-description {
  margin-block-start: var(--sp1);
  padding: var(--sp1-5) var(--sp2);
  background-color: var(--color--white);
  border-radius: var(--border-radius);
  text-shadow: none;
}

.paragraph--type--hero .hero__text-container .field--name-field-cta a:hover,
.paragraph--type--hero .hero__text-container .field--name-field-cta a:focus {
  background-color: var(--color--black);
}

/* Staged fade-in: image, then heading, then the button. Respects
 * prefers-reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes hero-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes hero-fade-in-up {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: translateY(0); }
  }

  .paragraph--type--hero .field--name-field-image {
    opacity: 0;
    animation: hero-fade-in 1.2s ease forwards;
  }

  .paragraph--type--hero .hero__text-container > * {
    opacity: 0;
    animation: hero-fade-in-up 0.7s ease forwards;
  }

  .paragraph--type--hero .field--name-field-eyebrow { animation-delay: 0.5s; }
  .paragraph--type--hero .field--name-field-hero-title { animation-delay: 0.7s; }
  .paragraph--type--hero .field--name-field-blurb { animation-delay: 0.9s; }
  .paragraph--type--hero .field--name-field-description { animation-delay: 1.05s; }
  .paragraph--type--hero .field--name-field-cta { animation-delay: 1.2s; }
}
