/**
 * Sameday Foundation — Home page
 * Scoped to body.p-home so the shared design system on other pages is untouched.
 * Tokens and shared primitives (.h-wrap, .h-h2, .h-btn, .h-ask …) live in brand.css.
 * Signature element: the Mt. Elgon ridgeline that carries a patient's path (#the-path).
 */

.p-home { color: var(--h-ink); font-family: var(--h-body); }
.p-home main { font-size: 1.0625rem; line-height: 1.6; }

.h-hero .h-btn--give { background: var(--h-orange-bright); color: var(--h-deep); }
.h-hero .h-btn--give:hover { background: #FF9447; color: var(--h-deep); }

/* ---------- 1. Hero ---------- */
.h-hero {
  background: var(--h-blue);
  color: #FFFFFF;
}

/* Text and photo share the page's content width, so the text starts under the
   logo and the photo ends under the Donate button: equal margins on both sides */
.h-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  min-height: min(calc(100vh - var(--header-height) - 38px), 720px);
  padding-top: clamp(40px, 5vw, 64px);
  padding-bottom: clamp(40px, 5vw, 64px);
}

.h-hero__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.h-hero__title {
  font-family: var(--h-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 4.4vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.028em;
  font-variation-settings: "opsz" 96;
  color: #FFFFFF;
  max-width: 14ch;
  margin-bottom: 28px;
}
/* The orange rule under the title echoes the "Restoring Hope" rule in the logo */
.h-hero__title::after {
  content: "";
  display: block;
  width: 96px;
  height: 6px;
  margin-top: 28px;
  border-radius: 3px;
  background: var(--h-orange-bright);
}

.h-hero__lead {
  font-size: clamp(1.0625rem, 1.35vw, 1.25rem);
  line-height: 1.55;
  color: #E4EEFA;
  max-width: 44ch;
  margin-bottom: 36px;
}

.h-hero__note {
  margin-top: 36px;
  font-size: 0.9375rem;
  color: var(--h-pale);
}

.h-hero__media {
  position: relative;
  align-self: stretch;
  min-height: 420px;
  border-radius: 20px;
  overflow: hidden;
}
.h-hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  object-position: 38% 45%;
}

/* Facts strip under the hero */
.h-facts { background: linear-gradient(90deg, #F84E00, var(--h-orange) 45%, #FF7A1A); color: var(--h-deep); }
.h-facts ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.h-facts li {
  padding: 22px 24px 22px 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--h-deep);
}
.h-facts li + li { padding-left: 24px; border-left: 1px solid rgba(10, 36, 72, 0.25); }
.h-facts strong {
  display: block;
  font-family: var(--h-display);
  font-size: 1.125rem;
  font-weight: 800;
  color: #FFFFFF;
}
.h-facts a { color: inherit; }
.h-facts a:hover { color: var(--h-deep); }

/* ---------- 2. The need ---------- */
.h-need {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
}
.h-need__barriers { margin-top: 8px; }
.h-need__barriers li {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--h-line);
}
.h-need__barriers li:last-child { border-bottom: 1px solid var(--h-line); }
.h-need__barriers h3 {
  font-family: var(--h-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--h-orange-text);
}
.h-need__barriers p { color: var(--h-ink-soft); max-width: 46ch; }

/* ---------- 3. Your gift ---------- */
.h-gift { background: var(--h-peach); }
.h-gift__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 24px 48px;
  margin-bottom: 48px;
}
.h-gift__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.h-gift__item img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 18px;
}
.h-gift__item h3 {
  font-family: var(--h-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-bottom: 6px;
  color: var(--h-navy);
}
.h-gift__item img { border-bottom: 6px solid var(--h-orange); }
.h-gift__item p { font-size: 0.975rem; color: var(--h-ink-soft); }

/* ---------- 4. The path (signature) ---------- */
.h-path {
  background: var(--h-blue);
  color: #FFFFFF;
  overflow: hidden;
}
.h-path .h-h2 { color: #FFFFFF; }
.h-path .h-lead { color: #E4EEFA; }

.h-path__ridge {
  display: block;
  width: 100%;
  height: auto;
  margin: 56px 0 0;
  overflow: visible;
}
.h-path__fill { fill: var(--h-blue-2); }
.h-path__line {
  fill: none;
  stroke: var(--h-orange-bright);
  stroke-width: 4;
  stroke-linecap: round;
}
.h-path__stop circle { fill: var(--h-orange-bright); stroke: #FFFFFF; stroke-width: 3; }
.h-path__stop text {
  fill: var(--h-deep);
  font-family: var(--h-display);
  font-weight: 700;
  font-size: 17px;
  text-anchor: middle;
  dominant-baseline: central;
}

.h-path__steps {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  counter-reset: step;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.h-path__steps li { padding: 24px 12px 0; text-align: center; }
.h-path__steps h3 {
  font-family: var(--h-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 6px;
}
.h-path__steps p { font-size: 0.9rem; line-height: 1.5; color: var(--h-pale); }

.h-path__promise {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: #E4EEFA;
  max-width: 64ch;
}
.h-path__promise strong { color: #FFFFFF; }

/* The one orchestrated motion: the ridge draws, then the stops arrive in order */
.has-home-motion .h-path__line { stroke-dasharray: 1; stroke-dashoffset: 1; }
.has-home-motion .h-path__stop { opacity: 0; transition: opacity 300ms ease-out; }
.has-home-motion .h-path.is-drawn .h-path__line {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1800ms cubic-bezier(.5, 0, .2, 1);
}
.has-home-motion .h-path.is-drawn .h-path__stop { opacity: 1; }
.has-home-motion .h-path.is-drawn .h-path__stop:nth-of-type(1) { transition-delay: 150ms; }
.has-home-motion .h-path.is-drawn .h-path__stop:nth-of-type(2) { transition-delay: 400ms; }
.has-home-motion .h-path.is-drawn .h-path__stop:nth-of-type(3) { transition-delay: 650ms; }
.has-home-motion .h-path.is-drawn .h-path__stop:nth-of-type(4) { transition-delay: 900ms; }
.has-home-motion .h-path.is-drawn .h-path__stop:nth-of-type(5) { transition-delay: 1150ms; }
.has-home-motion .h-path.is-drawn .h-path__stop:nth-of-type(6) { transition-delay: 1400ms; }
.has-home-motion .h-path.is-drawn .h-path__stop:nth-of-type(7) { transition-delay: 1650ms; }

/* ---------- 5. Programmes ---------- */
.h-progs__head { margin-bottom: 40px; }
.h-progs__list li { border-top: 1px solid var(--h-line); }
.h-progs__list li:last-child { border-bottom: 1px solid var(--h-line); }
.h-progs__list a {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) auto;
  gap: 16px 40px;
  align-items: baseline;
  padding: 28px 0;
  color: var(--h-ink);
}
.h-progs__list h3 {
  font-family: var(--h-display);
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  transition: color 150ms ease-out;
}
.h-progs__list p { color: var(--h-ink-soft); }
.h-progs__more {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--h-blue);
  white-space: nowrap;
}
.h-progs__list h3 { color: var(--h-navy); }
.h-progs__list a:hover h3,
.h-progs__list a:focus-visible h3 { color: var(--h-orange-text); }
.h-progs__list a:hover .h-progs__more { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- 6. Where we work ---------- */
.h-where { background: var(--h-sky); }
.h-where__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
}
.h-where__hq {
  margin-top: 32px;
  font-size: 0.975rem;
  color: var(--h-ink-soft);
}
.h-where__hq strong { display: block; color: var(--h-ink); }
.h-districts li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--h-line);
  font-family: var(--h-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 3.4vw, 2.75rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--h-navy);
}
.h-districts li:first-child { border-top: 1px solid var(--h-line); }
.h-districts span {
  font-family: var(--h-body);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0;
  color: #FFFFFF;
  background: var(--h-orange-text);
  padding: 4px 12px;
  border-radius: 999px;
}

/* ---------- 7. Who we are ---------- */
.h-who {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
}
.h-who img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
}
.h-who blockquote {
  font-family: var(--h-display);
  font-weight: 600;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-indent: -0.42em;
  margin-bottom: 20px;
  color: var(--h-navy);
}
.h-who blockquote .h-q { color: var(--h-orange); }
.h-who figcaption {
  font-size: 0.9375rem;
  color: var(--h-ink-soft);
  margin-bottom: 28px;
}
.h-who__body p { color: var(--h-ink-soft); max-width: 56ch; margin-bottom: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .h-gift__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; }
  .h-gift__item img { aspect-ratio: 4 / 3; }
}

@media (max-width: 900px) {
  .h-hero__inner { grid-template-columns: 1fr; min-height: 0; gap: 28px; padding-top: 20px; padding-bottom: 44px; }
  .h-hero__media { order: -1; min-height: 0; aspect-ratio: 4 / 3; border-radius: 16px; }
  .h-hero__title { max-width: 12ch; }

  .h-need, .h-where__grid, .h-who { grid-template-columns: 1fr; }
  .h-who img { order: -1; }

  /* The path becomes a vertical trail */
  .h-path__ridge { display: none; }
  .h-path__steps {
    grid-template-columns: 1fr;
    border-top: 0;
    margin-top: 40px;
    padding-left: 22px;
    border-left: 4px solid var(--h-orange-bright);
  }
  .h-path__steps li {
    position: relative;
    text-align: left;
    padding: 0 0 28px 28px;
    counter-increment: step;
  }
  .h-path__steps li::before {
    content: counter(step);
    position: absolute;
    left: -42px;
    top: -4px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--h-orange-bright);
    color: var(--h-deep);
    border: 3px solid #FFFFFF;
    font-family: var(--h-display);
    font-weight: 700;
  }
  .h-path__steps li:last-child { padding-bottom: 0; }

  .h-progs__list a { grid-template-columns: 1fr; gap: 6px; padding: 22px 0; }
  .h-progs__more { display: none; }
}

@media (max-width: 640px) {
  .h-facts ul { grid-template-columns: 1fr; }
  .h-facts li, .h-facts li + li { padding: 16px 0; border-left: 0; }
  .h-facts li + li { border-top: 1px solid var(--h-line); }
  .h-need__barriers li { grid-template-columns: 1fr; gap: 6px; }
  .h-gift__grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .has-home-motion .h-path__line { stroke-dasharray: none; stroke-dashoffset: 0; }
  .has-home-motion .h-path__stop { opacity: 1; }
}

/* Section rhythm after moving "The need" below the programmes */
.h-need-wrap { background: var(--h-sky); }
.h-where { background: #FFFFFF; }
#who-we-are { background: var(--h-sky); }
