/*
 * Coverage Widget — styles for assets/js/coverage-widget/coverage-widget.js.
 * Everything is scoped under .twpcw so it can sit inside any site template.
 *
 * Design: "Homepage Coverage Widget" artifact, board "4B colour-led: Proof
 * white-led" with the flat (Rounded) buttons, chosen by Chris 2026-11-18.
 * The colours are the board's own Proof palette, kept as tokens below so a
 * palette decision (brand blue #2D6484 / ask orange #F06D32 vs these) is a
 * one-line change here.
 */
.twpcw {
  --twpcw-navy: #0B2E4A;        /* dark: giving band, 52% figure + rule */
  --twpcw-pale: #E8F1F8;        /* light: top section */
  --twpcw-blue: #126DAA;        /* "100%", subline, water */
  --twpcw-water-light: #7CC6F0; /* the bright line on the waterline */
  --twpcw-ink: #1A2B38;
  --twpcw-muted: #4A6174;
  --twpcw-card-bg: #DDE3E8;     /* a card before (or without) its photo */
  --twpcw-donate: #CB4B00;
  --twpcw-donate-hover: #9E3A00;
  --twpcw-pad: 72px;

  background: #fff;
  font-family: Montserrat, -apple-system, 'Segoe UI', sans-serif;
  color: var(--twpcw-ink);
  box-sizing: border-box;
  text-align: left;
}
.twpcw *, .twpcw *::before, .twpcw *::after { box-sizing: border-box; }
/* The homepage's critical CSS sets h1–h5 to font-weight:300 !important (and
   its own font stack); the widget's headings are 800 by design, so they must
   win on the real homepage too. */
.twpcw h2, .twpcw h3 { font-family: Montserrat, -apple-system, 'Segoe UI', sans-serif !important; font-weight: 800 !important; }

/* The board is a 1280px frame with 72px gutters; centre that on wide screens. */
.twpcw-head-in, .twpcw-regions, .twpcw-giving-in { max-width: 1280px; margin: 0 auto; padding-left: var(--twpcw-pad); padding-right: var(--twpcw-pad); }

/* ── Top section ── */
.twpcw-head { background: var(--twpcw-pale); }
.twpcw-head-in {
  padding-top: 72px; padding-bottom: 48px;
  display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 48px; align-items: end;
}
.twpcw-intro { display: flex; flex-direction: column; gap: 10px; }
.twpcw h2 { margin: 0; display: flex; flex-direction: column; gap: 6px; color: var(--twpcw-navy); font-weight: 800; }
.twpcw-h-big { font-size: clamp(96px, 17vw, 220px); line-height: .8; letter-spacing: -.06em; color: var(--twpcw-blue); }
.twpcw-h-rest { font-size: clamp(30px, 4vw, 48px); line-height: 1.05; letter-spacing: -.02em; }
.twpcw-sub { margin: 8px 0 0; font-size: 22px; line-height: 1.4; font-weight: 500; color: var(--twpcw-blue); }
.twpcw-def { margin: 4px 0 0; font-size: 17px; line-height: 1.65; color: var(--twpcw-muted); max-width: 640px; }

.twpcw-todate {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 0 0 8px 24px; border-left: 3px solid var(--twpcw-navy);
}
.twpcw-eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--twpcw-ink); }
.twpcw-todate-num { font-size: clamp(72px, 7.5vw, 96px); line-height: .85; font-weight: 800; letter-spacing: -.05em; color: var(--twpcw-navy); }
.twpcw-todate-label { font-size: 15px; line-height: 1.4; }
.twpcw-muted { font-size: 13px; line-height: 1.5; color: var(--twpcw-muted); }
.twpcw-sample {
  align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--twpcw-navy); background: #fff; padding: 4px 10px; border-radius: 100px;
}

/* ── The photo cards, lifted over the end of the pale top section ──
   This strip was a navy band until 2026-12-02 (Michelle: with the navy giving
   band right below the cards, two dark bars was one too many). It stays pale
   rather than white so the page doesn't stripe. */
.twpcw-band { height: 220px; background: var(--twpcw-pale); }
.twpcw-regions { margin-top: -190px; position: relative; }
.twpcw-loading {
  max-width: calc(1280px - 2 * var(--twpcw-pad)); margin: -190px auto 0; height: 360px; border-radius: 6px;
  background: linear-gradient(90deg, var(--twpcw-card-bg) 0%, #EEF2F5 50%, var(--twpcw-card-bg) 100%); background-size: 200% 100%;
  animation: twpcw-shimmer 1.4s linear infinite; position: relative;
}
@keyframes twpcw-shimmer { to { background-position: -200% 0; } }

.twpcw-region-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.twpcw-region { position: relative; }
.twpcw-region-card {
  display: block; width: 100%; padding: 0; border: none; background: none; font-family: inherit;
  color: #fff; text-align: left; cursor: pointer; border-radius: 6px;
}
.twpcw-region-card:focus-visible { outline: 3px solid var(--twpcw-blue); outline-offset: 3px; }
.twpcw-region-media { position: relative; display: block; border-radius: 6px; overflow: hidden; background: var(--twpcw-card-bg); }
.twpcw-water { display: block; width: 100%; height: auto; aspect-ratio: 280 / 400; }
.twpcw-water-fill { fill: var(--twpcw-blue); }
.twpcw-region-text {
  position: absolute; left: 18px; bottom: 16px; right: 12px; display: flex; flex-direction: column; gap: 4px;
  text-shadow: 0 1px 14px rgba(0, 0, 0, .65);
}
.twpcw-region-pct { font-size: 52px; line-height: 1; font-weight: 800; }
.twpcw-region-name { font-size: 16px; font-weight: 700; }
.twpcw-region-people { font-size: 12px; }

/* The waterline: rises once on load (staggered per card), then ripples. */
.twpcw-lift { animation: twpcw-lift 3s cubic-bezier(.16, .8, .24, 1) both; }
.twpcw-wave { animation: twpcw-wave 4s linear infinite; fill: none; }
.twpcw-wave[fill] { fill: #fff; }
.twpcw-wave--glow { stroke: var(--twpcw-blue); stroke-opacity: .22; stroke-width: 16; }
.twpcw-wave--body { stroke: var(--twpcw-blue); stroke-opacity: .55; stroke-width: 7; }
.twpcw-wave--light { stroke: var(--twpcw-water-light); stroke-opacity: .9; stroke-width: 2.5; }
.twpcw-wave--crest { stroke: #fff; stroke-opacity: .95; stroke-width: 1.4; }
@keyframes twpcw-lift { from { transform: translateY(440px); } }
@keyframes twpcw-wave { from { transform: translateX(0); } to { transform: translateX(-140px); } }
@media (prefers-reduced-motion: reduce) {
  .twpcw-lift, .twpcw-wave, .twpcw-loading { animation: none; }
}

.twpcw-pop {
  position: absolute; top: calc(100% + 8px); left: 0; width: 260px; max-width: 100%; z-index: 5; background: #fff;
  border-radius: 12px; box-shadow: 0 14px 34px rgba(10, 30, 50, .22);
  padding: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--twpcw-ink);
}
.twpcw-region-grid > .twpcw-region:last-child .twpcw-pop { left: auto; right: 0; }
.twpcw-pop-title { font-size: 16px; font-weight: 700; }
.twpcw-pop-row { display: flex; justify-content: space-between; gap: 12px; }
.twpcw-give-link { font-weight: 700; color: var(--twpcw-donate); }
.twpcw-give-link:hover { color: var(--twpcw-donate-hover); }
.twpcw-notes { padding-top: 24px; display: flex; flex-direction: column; gap: 4px; }
.twpcw-footnote { font-size: 12px; line-height: 1.5; color: var(--twpcw-muted); }

/* ── Giving choices on navy ── */
.twpcw-giving { margin-top: 32px; background: var(--twpcw-navy); color: #fff; }
.twpcw--nodata .twpcw-giving { margin-top: 0; }
.twpcw-giving-in { padding-top: 40px; padding-bottom: 72px; display: flex; flex-direction: column; gap: 18px; }
.twpcw-giving h3 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 800; color: #fff; }
.twpcw-choices { display: flex; gap: 14px; }
/* Flat buttons (the board's "Rounded" style): no gradient, border or shadow. */
.twpcw-btn {
  flex: 1 1 0; min-width: 0; height: 64px; padding: 0 24px; border-radius: 8px;
  background: var(--twpcw-donate); color: #fff !important; text-decoration: none !important;
  font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: background-color .15s;
}
.twpcw-btn:hover { background: var(--twpcw-donate-hover); }
.twpcw-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.twpcw-btn svg { flex-shrink: 0; }

/* ── Tablet ── */
@media (max-width: 1000px) {
  .twpcw { --twpcw-pad: 32px; }
  .twpcw-head-in { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 56px; }
  .twpcw-region-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Popups open under their own card; in a 2-wide grid the right column opens rightward-aligned. */
  .twpcw-region-grid > .twpcw-region:nth-child(even) .twpcw-pop { left: auto; right: 0; }
  .twpcw-region-grid > .twpcw-region:last-child:nth-child(odd) .twpcw-pop { left: 0; right: auto; }
  .twpcw-choices { flex-direction: column; }
  .twpcw-btn { flex: none; }
}

/* ── Phone ── */
@media (max-width: 600px) {
  .twpcw { --twpcw-pad: 16px; }
  .twpcw-head-in { padding-top: 48px; padding-bottom: 32px; }
  .twpcw-sub { font-size: 19px; }
  .twpcw-def { font-size: 16px; }
  .twpcw-band { height: 160px; }
  .twpcw-regions, .twpcw-loading { margin-top: -130px; }
  .twpcw-region-grid { gap: 10px; }
  .twpcw-region-text { left: 12px; bottom: 12px; }
  .twpcw-region-pct { font-size: 36px; }
  .twpcw-region-name { font-size: 14px; }
  /* On touch layouts the popup pushes content down instead of overlapping the next card. */
  .twpcw-pop, .twpcw-region-grid > .twpcw-region .twpcw-pop { position: static; width: auto; margin-top: 6px; }
  .twpcw-giving-in { padding-top: 32px; padding-bottom: 48px; }
  .twpcw-giving h3 { font-size: 24px; }
  .twpcw-btn { height: 56px; font-size: 17px; }
}
