/* ==========================================================================
   Water page only · Safe Water Fund hero, project finder + carousel,
   "why water", giving in someone's name, appeal video.
   Loaded after the shared files; uses the tokens from base.css.
   ========================================================================== */

/* ---------- Shared bits ---------- */

.FundHero__eyebrow,
.Named__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgb(var(--navy));
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.FundHero__eyebrow svg,
.Named__eyebrow svg { inline-size: 20px; block-size: 20px; flex: none; color: rgb(var(--blue)); }

/* ---------- 1. Safe Water Fund hero ---------- */

.FundHero { padding-block: clamp(22px, 4vw, 60px) clamp(36px, 5vw, 76px); }

.FundHero__grid {
  display: grid;
  grid-template-areas: 'intro' 'media' 'give';
  gap: 20px;
}

.FundHero__intro { grid-area: intro; display: grid; gap: 12px; justify-items: start; }

.FundHero__title {
  color: rgb(var(--ink-soft));
  font-size: clamp(2.375rem, 1.55rem + 3.4vw, 4.25rem);
  font-weight: 700;
  line-height: 1;
}

.FundHero__lede {
  max-inline-size: 40ch;
  color: rgb(var(--ink-soft));
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.5;
}

.FundHero__media {
  grid-area: media;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-media);
  background: rgb(var(--off));
}

.FundHero__media img { inline-size: 100%; block-size: 100%; object-fit: cover; }

/* On phones the quick-give card sits over the bottom of the photo */
.FundHero .QuickGive { grid-area: give; position: relative; margin: -64px 10px 0; }

@media (min-width: 960px) {
  .FundHero__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    grid-template-areas: 'intro media' 'give media';
    column-gap: clamp(40px, 5vw, 80px);
    row-gap: 28px;
  }
  .FundHero__intro { align-self: end; }
  .FundHero .QuickGive { align-self: start; margin: 0; }
  .FundHero__media { align-self: center; aspect-ratio: 5 / 4; }
}

/* Quick-give card: reuses the donation menu's .Amount and .Custom styles from give.css */
.QuickGive {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 0 0 1px rgb(var(--ink) / 0.08), var(--shadow-md);
}

@media (min-width: 960px) { .QuickGive { padding: 22px; max-inline-size: 520px; } }

.QuickGive__set { min-inline-size: 0; margin: 0; padding: 0; border: 0; }

.QuickGive__legend {
  margin-block-end: 10px;
  padding: 0;
  color: rgb(var(--ink));
  font-size: 0.9375rem;
  font-weight: 600;
}

.QuickGive__amounts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.QuickGive__custom { grid-column: 1 / -1; }

@media (min-width: 440px) {
  .QuickGive__amounts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .QuickGive__custom { grid-column: auto; }
}

.QuickGive .Amount:not([aria-pressed='true']):hover { box-shadow: inset 0 0 0 1.5px rgb(var(--ink) / 0.4); }
.QuickGive .Input { min-block-size: 50px; font-weight: 600; }
.QuickGive .Input::placeholder { color: rgb(var(--muted)); font-weight: 500; }
.QuickGive .Input[aria-invalid='true'] { box-shadow: inset 0 0 0 2px rgb(var(--red)); }

.QuickGive__error { color: rgb(var(--red)); font-size: 0.875rem; font-weight: 600; }
.QuickGive__error[hidden] { display: none; }
.QuickGive__note { color: rgb(var(--muted)); font-size: 0.8125rem; text-align: center; }

/* ---------- 3. All water projects ---------- */

.Projects {
  container-type: inline-size;
  --gap: 16px;
  --wrap: min(100cqi - var(--gutter) * 2, var(--page));
  --edge: max(var(--gutter), (100cqi - var(--page)) / 2);
  --card: min(82cqi, 330px);
  background: rgb(var(--off));
}

@media (min-width: 640px) { .Projects { --card: calc((var(--wrap) - var(--gap) * 2) / 2.35); } }
@media (min-width: 1000px) { .Projects { --gap: 24px; --card: calc((var(--wrap) - var(--gap) * 2) / 3); } }

/* Filter bar, same pattern as the Major Giving "Finder" */
.Finder {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgb(var(--ink) / 0.1);
  border-radius: var(--radius);
  background: rgb(var(--ink) / 0.1);
  box-shadow: var(--shadow-md);
}

.Finder__field--wide { grid-column: 1 / -1; }

@media (min-width: 700px) {
  .Finder { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .Finder__field--wide { grid-column: auto; }
}

/* The select covers the whole field, so a tap anywhere opens it */
.Finder__field {
  position: relative;
  display: block;
  min-block-size: 70px;
  background: #fff;
  transition: background-color 200ms;
}

.Finder__field:hover { background: rgb(var(--off)); }

.Finder__label {
  position: absolute;
  inset: 14px 18px auto;
  z-index: 1;
  color: rgb(var(--muted));
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  pointer-events: none;
}

.Finder__select select {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  padding: 32px 44px 12px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgb(var(--ink));
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.Finder__select::after {
  content: '';
  position: absolute;
  inset: auto 18px 15px auto;
  inline-size: 18px;
  block-size: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23084274' d='m12 15.5-5-5L8.4 9 12 12.7 15.6 9 17 10.5l-5 5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

/* Two fields share a row on phones, so give the values a little more room */
@media (max-width: 699px) {
  .Finder__label { inset-inline: 16px; }
  .Finder__select select { padding-inline: 16px 34px; font-size: 0.9375rem; }
  .Finder__select::after { inset-inline-end: 12px; }
}

/* A field with a filter set reads as "on" */
.Finder__field.is-set { background: color-mix(in srgb, rgb(var(--blue)) 9%, #fff); }
.Finder__field.is-set .Finder__label { color: rgb(var(--navy)); }

@supports selector(:has(*)) {
  .Finder__select select:focus-visible { outline: none; }
  .Finder__field:has(select:focus-visible) { outline: 2px solid rgb(var(--red)); outline-offset: -3px; }
}

/* Count, active-filter chips and carousel arrows */
.Projects__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'count nav' 'chips chips';
  align-items: center;
  gap: 12px 16px;
  margin-block: 18px 16px;
}

@media (min-width: 700px) {
  .Projects__bar { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'count chips nav'; }
}

.Projects__count { grid-area: count; color: rgb(var(--ink-soft)); font-size: 0.9375rem; }
.Projects__count strong { color: rgb(var(--ink)); font-weight: 700; }

.Projects__chips { grid-area: chips; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.Projects__chips[hidden] { display: none; }

.FilterChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-block-size: 36px;
  padding: 6px 10px 6px 14px;
  border: 1px solid rgb(var(--blue) / 0.45);
  border-radius: 99px;
  background: rgb(var(--blue) / 0.12);
  color: rgb(var(--navy));
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  animation: chipIn 360ms var(--ease) both;
  transition: background-color 200ms, border-color 200ms;
}

.FilterChip:hover { background: rgb(var(--blue) / 0.22); border-color: rgb(var(--blue)); }
.FilterChip svg { inline-size: 16px; block-size: 16px; fill: currentColor; flex: none; }

@keyframes chipIn { from { opacity: 0; transform: scale(0.9); } }

.Projects__clear {
  min-block-size: 36px;
  padding: 6px 8px;
  border-radius: 8px;
  color: rgb(var(--ink-soft));
  font-size: 0.875rem;
  font-weight: 600;
  transition: color 200ms, background-color 200ms;
}

.Projects__clear:hover { color: rgb(var(--ink)); background: rgb(var(--ink) / 0.06); }

.Projects__nav { grid-area: nav; display: flex; gap: 8px; }
.Projects__nav .IconBtn[aria-disabled='true'] { opacity: 0.35; cursor: default; transform: none; box-shadow: inset 0 0 0 1.5px rgb(var(--ink) / 0.14); }

/* Carousel: a native scroller with snap points, bleeding to the screen edges.
   position: relative keeps absolutely positioned children (e.g. .u-sr text) inside the scroller. */
.Projects__viewport {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--edge);
  scrollbar-width: none;
}

.Projects__viewport::-webkit-scrollbar { display: none; }
.Projects__viewport:focus-visible { outline: 2px solid rgb(var(--red)); outline-offset: -2px; border-radius: 0; }
.Projects__viewport[hidden] { display: none; }

.Projects__list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--card);
  gap: var(--gap);
  inline-size: max-content;
  margin: 0;
  padding: 4px var(--edge) 10px;
  list-style: none;
}

/* Project card */
.Well {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 0 0 1px rgb(var(--ink) / 0.07), var(--shadow-sm);
  scroll-snap-align: start;
}

.Well[hidden] { display: none; }

.Well__media { margin: 0; overflow: hidden; aspect-ratio: 3 / 2; background: rgb(var(--chalk)); }
.Well__media img { inline-size: 100%; block-size: 100%; object-fit: cover; transition: transform 900ms var(--ease); }
.Well:hover .Well__media img { transform: scale(1.04); }

.Well__body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 10px; padding: 18px 20px 20px; }

.Well__type {
  color: rgb(var(--navy));
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.Well--fund .Well__type { justify-self: start; align-self: flex-start; padding: 2px 10px; border-radius: 99px; background: rgb(var(--yellow)); color: rgb(var(--ink)); }

.Well__title { margin-block-start: -4px; color: rgb(var(--ink)); font-size: clamp(1.25rem, 1.15rem + 0.35vw, 1.4375rem); line-height: 1.15; }
.Well__text { color: rgb(var(--ink-soft)); font-size: 0.9375rem; line-height: 1.5; }

.Well__facts { display: grid; gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; color: rgb(var(--ink-soft)); font-size: 0.9375rem; line-height: 1.4; }
.Well__facts li { display: flex; align-items: flex-start; gap: 8px; }
.Well__facts svg { inline-size: 18px; block-size: 18px; flex: none; margin-block-start: 1px; color: rgb(var(--blue)); }

.Well__meter { display: grid; gap: 6px; font-size: 0.875rem; color: rgb(var(--ink-soft)); }
.Well__meter b { color: rgb(var(--ink)); }
.Well__bar { block-size: 8px; overflow: hidden; border-radius: 99px; background: rgb(var(--ink) / 0.08); }
.Well__bar span { display: block; block-size: 100%; border-radius: inherit; background: linear-gradient(90deg, rgb(var(--yellow)), rgb(var(--gold))); }

.Well__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block-start: auto;
  padding-block-start: 14px;
  border-block-start: 1px solid rgb(var(--ink) / 0.08);
}

.Well__price { display: grid; line-height: 1.1; }
.Well__price small { color: rgb(var(--muted)); font-size: 0.8125rem; font-weight: 500; }
.Well__price b { color: rgb(var(--ink)); font-family: var(--font-h); font-size: 1.5rem; font-weight: 700; }

/* Empty state */
.Projects__empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: clamp(28px, 5vw, 52px) 22px;
  border: 2px dashed rgb(var(--ink) / 0.14);
  border-radius: var(--radius);
  background: #fff;
  color: rgb(var(--ink-soft));
  text-align: center;
}

.Projects__empty[hidden] { display: none; }
.Projects__empty p { max-inline-size: 46ch; }

.Projects__empty-icon {
  display: grid;
  place-items: center;
  inline-size: 52px;
  block-size: 52px;
  border-radius: 50%;
  background: rgb(var(--blue) / 0.14);
  color: rgb(var(--navy));
}

.Projects__empty-icon svg { inline-size: 24px; block-size: 24px; }
.Projects__empty-title { color: rgb(var(--ink)); font-size: 1.3rem; }
.Projects__empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-block-start: 6px; }

.Projects__more { margin-block-start: 22px; color: rgb(var(--ink-soft)); font-size: 0.9375rem; }

.Projects__more a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgb(var(--navy));
  font-weight: 600;
  text-decoration: none;
}

.Projects__more a svg { inline-size: 16px; block-size: 16px; fill: currentColor; transition: transform 300ms var(--ease); }
.Projects__more a:hover svg { transform: translateX(3px); }

/* Without JavaScript the cards still scroll; the filters and arrows need JS */
.no-js .Finder,
.no-js .Projects__bar { display: none; }
.no-js .Projects__viewport { margin-block-start: 8px; }

/* ---------- 4. Why water ---------- */

.WhyWater__grid { display: grid; gap: 24px; align-items: center; }

@media (min-width: 900px) {
  .WhyWater__grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(40px, 6vw, 96px); }
}

.WhyWater__text {
  max-inline-size: 54ch;
  margin-block-start: 14px;
  color: rgb(var(--ink-soft));
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.6;
}

.WhyWater__hadith { padding: clamp(24px, 3vw, 34px); }
.WhyWater__hadith blockquote { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem); line-height: 1.25; }

/* ---------- 5. Giving in someone's name ---------- */

.Named { padding-block-start: 0; }

.Named__grid { display: grid; gap: 22px; align-items: center; }

@media (min-width: 900px) {
  .Named__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 88px); }
}

.Named__media {
  position: relative;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-media);
  background: rgb(var(--off));
}

.Named__media img { inline-size: 100%; block-size: 100%; object-fit: cover; }

.Named__media figcaption {
  position: absolute;
  inset: auto 12px 12px 12px;
  justify-self: start;
  inline-size: fit-content;
  max-inline-size: calc(100% - 24px);
  padding: 6px 12px;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.92);
  color: rgb(var(--ink));
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
}

.Named__body { display: grid; gap: 14px; justify-items: start; }

.Named__lead { color: rgb(var(--ink)); font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem); font-weight: 600; line-height: 1.5; }

.Named__quote {
  position: relative;
  margin-block: 4px;
  padding-inline-start: 46px;
  color: rgb(var(--navy));
  font-family: var(--font-h);
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.65rem);
  font-weight: 600;
  line-height: 1.3;
}

.Named__quote svg { position: absolute; inset: 2px auto auto 0; inline-size: 32px; block-size: 32px; fill: rgb(var(--yellow)); }

.Named__note { color: rgb(var(--ink-soft)); font-size: 0.9375rem; line-height: 1.55; }

/* ---------- 6. Appeal video (.WaterFilm) ---------- */

.WaterFilm .Head { margin-block-end: clamp(16px, 2.4vw, 24px); }
