/* home-week.css: the two homepage sections under the grant list.
   .hw   "This week in Canadian funding" (three lists on a card)
   .hwm  "Every program, by province"    (drawn map + index)
   Markup is written by dev-tools/build-home-this-week.js; js/home-week.js keeps the dates right and draws the map.
   Loaded without blocking first paint (both sections are far below the fold). Component-scoped on purpose:
   every rule is a compound selector (.hw .x / .hwm .x) so the page's element rules (h1-h4, a, a:hover) cannot win. */

.hw, .hwm { background: var(--parchment, #FAF7F2); }
.hw[hidden], .hwm [hidden], .hw [hidden] { display: none !important; }
.hw .hw-sr, .hwm .hw-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; font-style: normal; }

/* ───────────────────────────── this week ───────────────────────────── */
.hw { padding: 0 2rem 3.5rem; }
.hw .hw__in { max-width: 1280px; margin: 0 auto; padding: 2rem 2.25rem 1.75rem; background: var(--white, #fff); border: 1px solid var(--ink-5, #E7E5E4); border-radius: var(--r-xl, 20px); box-shadow: var(--sh-sm, 0 1px 3px rgba(28, 25, 23, .04)); }
.hw .hw__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem 2rem; padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--ink-5, #E7E5E4); }
.hw .hw__h { margin: 0; font: 600 1.75rem/1.15 var(--serif, 'Fraunces', Georgia, serif); letter-spacing: -.012em; color: var(--ink, #1C1917); text-transform: none; }
.hw .hw__when { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.25rem; font: 500 .9375rem/1.4 var(--sans, sans-serif); color: var(--ink-2, #57534E); }
.hw .hw__when time { font-weight: 600; color: var(--ink, #1C1917); }
.hw .hw__now { display: inline-flex; align-items: center; gap: .5rem; }
.hw .hw__now i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--forest-mid, #2D6A4F); box-shadow: 0 0 0 4px var(--forest-glow, rgba(45, 106, 79, .08)); }

/* wide screens: the three lists side by side. A list with nothing in it is hidden and the others share the row */
.hw .hw__tabs { display: none; }
.hw .hw__lanes { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: 0 -1.75rem; }
.hw .hw__lane { display: flex; flex-direction: column; min-width: 0; padding: 0 1.75rem; }
.hw .hw__lane:not([hidden]) ~ .hw__lane:not([hidden]) { border-left: 1px solid var(--ink-5, #E7E5E4); }
.hw .hw__lh { display: flex; align-items: baseline; gap: .5rem; margin: 0 0 .25rem; font: 700 .9375rem/1.3 var(--sans, sans-serif); letter-spacing: 0; text-transform: none; color: var(--ink, #1C1917); }
.hw .hw__lh span { font-weight: 600; font-size: .8125rem; color: var(--ink-2, #57534E); font-variant-numeric: tabular-nums; }
/* a list on its own (the other two had nothing to show) sets its items two across, not four in one long column */
@media (min-width: 1024px) { .hw .hw__lanes[data-hw-lanes="1"] .hw__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 3.5rem; } }
/* every shown item carries a rule above it and the list hides the first one, so rows line up in one column or two */
.hw .hw__list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.hw .hw__item { margin-top: -1px; border-top: 1px solid var(--ink-5, #E7E5E4); }
.hw .hw__item a { display: flex; align-items: flex-start; gap: .875rem; min-height: 44px; padding: .75rem 0; color: inherit; text-decoration: none; }
.hw .hw__t { min-width: 0; padding-top: 1px; }
.hw .hw__n { display: block; font: 600 .9375rem/1.35 var(--sans, sans-serif); color: var(--ink, #1C1917); text-wrap: pretty; overflow-wrap: anywhere; }
.hw .hw__item a:hover .hw__n { color: var(--sienna-dk, #A3401F); text-decoration: underline; text-underline-offset: 3px; }
.hw .hw__w { display: block; margin-top: 2px; font: 400 .8125rem/1.4 var(--sans, sans-serif); color: var(--ink-2, #57534E); }
.hw .hw-cal { flex: none; display: grid; align-content: center; justify-items: center; gap: 2px; width: 44px; height: 46px; border-radius: 10px; line-height: 1; white-space: nowrap; }
.hw .hw-cal b { font: 600 1.1875rem/1 var(--serif, 'Fraunces', Georgia, serif); font-variant-numeric: lining-nums; }
.hw .hw-cal span { font: 600 .6875rem/1 var(--sans, sans-serif); }
.hw .hw-cal--close { background: #fbece4; color: #8f3d1c; }
.hw .hw-cal--open { background: #e4f1e9; color: #1b4332; }
.hw .hw-cal--new { background: var(--parchment-dk, #F2EBE0); color: var(--ink-2, #57534E); }
.hw .hw__more { align-self: flex-start; margin-top: auto; padding: 1rem 0 .375rem; font: 600 .875rem/1.3 var(--sans, sans-serif); color: var(--forest-mid, #2D6A4F); text-decoration: underline; text-decoration-color: rgba(45, 106, 79, .35); text-underline-offset: 3px; }
.hw .hw__more:hover { color: var(--forest, #1B4332); text-decoration-color: currentColor; }
.hw .hw__item a:focus-visible, .hw .hw__more:focus-visible { outline: 2px solid var(--forest-mid, #2D6A4F); outline-offset: 3px; border-radius: 6px; }

/* tablets and phones: one list at a time, picked on a three-way switch (plain radio buttons, so it works with no script).
   A browser without :has() keeps the three lists stacked under their headings instead. */
@media (max-width: 1023px) {
  .hw .hw__lanes { display: block; margin: 0; }
  .hw .hw__lane { padding: 0; }
  .hw .hw__lane:not([hidden]) ~ .hw__lane:not([hidden]) { border-left: 0; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--ink-5, #E7E5E4); }
  @supports selector(:has(a)) {
    .hw .hw__tabs { display: flex; gap: 4px; min-width: 0; margin: 0 0 .5rem; padding: 4px; border: 0; border-radius: 12px; background: #f4f1ea; }
    .hw .hw__tab { position: relative; flex: 1 1 0; min-width: 0; margin: 0; }
    .hw .hw__tab input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
    .hw .hw__tab span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 6px; border-radius: 9px; font: 600 .9375rem/1 var(--sans, sans-serif); color: var(--ink-2, #57534E); white-space: nowrap; }
    .hw .hw__tab b { font-weight: 500; font-size: .8125rem; font-variant-numeric: tabular-nums; }
    .hw .hw__tab input:checked + span { background: #fff; color: var(--ink, #1C1917); box-shadow: 0 1px 3px rgba(28, 25, 23, .1); }
    .hw .hw__tab input:focus-visible + span { outline: 2px solid var(--forest-mid, #2D6A4F); outline-offset: 2px; }
    .hw .hw__in:has(.hw__tab input[value="close"]:checked) .hw__lane:not(.hw__lane--close),
    .hw .hw__in:has(.hw__tab input[value="open"]:checked) .hw__lane:not(.hw__lane--open),
    .hw .hw__in:has(.hw__tab input[value="new"]:checked) .hw__lane:not(.hw__lane--new) { display: none; }
    .hw .hw__lane:not([hidden]) ~ .hw__lane:not([hidden]) { margin-top: 0; padding-top: 0; border-top: 0; }
    /* the switch names the list, so its heading is kept for screen readers only */
    .hw .hw__lh { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .hw .hw__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2.25rem; }
}
@media (max-width: 768px) {
  .hw { padding: 0 1rem 2.5rem; }
  .hw .hw__in { padding: 1.375rem 1.125rem 1.125rem; border-radius: var(--r-lg, 14px); }
  .hw .hw__head { display: block; padding-bottom: 1rem; margin-bottom: 1rem; }
  .hw .hw__h { font-size: 1.4375rem; }
  .hw .hw__when { display: block; margin-top: .5rem; font-size: .875rem; }
  .hw .hw__now { display: flex; margin-top: .375rem; }
  .hw .hw__item a { padding: .6875rem 0; }
  .hw .hw__more { padding: 1rem 0 .75rem; }
}
@media (max-width: 359px) {
  .hw .hw__tab span { font-size: .875rem; gap: 4px; padding: 0 2px; }
}

/* ───────────────────────────── every program, by province ───────────────────────────── */
.hwm { padding: 1rem 2rem 2.5rem; }
.hwm .hwm__in { max-width: 1280px; margin: 0 auto; }
.hwm .hwm__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .4rem 2rem; margin-bottom: .25rem; }
.hwm .hwm__h { margin: 0; font: 600 2rem/1.12 var(--serif, 'Fraunces', Georgia, serif); letter-spacing: -.014em; color: var(--ink, #1C1917); text-transform: none; }
.hwm .hwm__when { margin: 0; font: 500 .9375rem/1.4 var(--sans, sans-serif); color: var(--ink-2, #57534E); }
.hwm .hwm__grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 0 2.5rem; align-items: center; margin-top: 1rem; }
.hwm .hwm__mapwrap { min-width: 0; }
/* the box is reserved at the drawing's own shape (set by the builder), so the map arriving moves nothing */
.hwm .hwm__map { width: 100%; aspect-ratio: var(--hw-ar, 1000 / 694); }
.hwm.is-nomap .hwm__mapwrap { display: none; }
.hwm.is-nomap .hwm__grid { display: block; }
.hwm .hwm__cap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: -4px 0 0; font: 400 .8125rem/1.45 var(--sans, sans-serif); color: var(--ink-2, #57534E); }
.hwm .hwm__hint--touch { display: none; }
@media (hover: none), (pointer: coarse) {
  /* the "tap a stack" sentence is for a small map under a finger (no standing names); a map with its names on keeps the first one */
  .hwm .hwm__map--small ~ .hwm__cap .hwm__hint--point { display: none; }
  .hwm .hwm__map--small ~ .hwm__cap .hwm__hint--touch { display: inline; }
  /* under a finger a name on the map is the thing to tap: mark it as a link */
  .hwm .gm a.gm-l::after { content: '\203A'; margin-left: 1px; font-weight: 700; color: var(--forest-mid, #2D6A4F); }
}
.hwm .hwm__coin { display: inline-block; width: 20px; height: 15px; margin: 0 6px 0 2px; vertical-align: -3px; fill: initial; stroke: none; }
/* the index: three short lists in two aligned columns, biggest place first, each count beside its name */
.hwm .hwm__ix { min-width: 0; }
.hwm .hwm__p { margin: 0 0 .75rem; font: 400 .9375rem/1.5 var(--sans, sans-serif); color: var(--ink-2, #57534E); }
.hwm .hwm__row { padding: .875rem 0 .75rem; border-top: 1px solid var(--ink-5, #E7E5E4); }
.hwm .hwm__k { margin: 0 0 .25rem; font: 700 .8125rem/1.4 var(--sans, sans-serif); letter-spacing: 0; text-transform: none; color: var(--ink-2, #57534E); }
.hwm .hwm__links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem; }
.hwm .hwm__links li { min-width: 0; }
.hwm .hwm__links a { display: inline-block; max-width: 100%; padding: .3125rem 0; font: 600 .9375rem/1.35 var(--sans, sans-serif); color: var(--forest, #1B4332); text-decoration: none; }
.hwm .hwm__links a:hover { color: var(--forest, #1B4332); text-decoration: underline; text-underline-offset: 3px; }
.hwm .hwm__links a > span { margin-left: .125rem; white-space: nowrap; font-weight: 500; font-size: .8125rem; color: var(--ink-2, #57534E); font-variant-numeric: tabular-nums; }
.hwm .hwm__links a:focus-visible { outline: 2px solid var(--forest-mid, #2D6A4F); outline-offset: 2px; border-radius: 4px; }
/* names on the map are links (gc-map draws them); keep them in the map's own ink, with a visible focus */
.hwm .gm a.gm-l { text-decoration: none; }
.hwm .gm a.gm-l:hover { color: var(--gm-ink, #1c1917); }
.hwm .gm a.gm-l:focus-visible { outline: 2px solid var(--forest-mid, #2D6A4F); outline-offset: 2px; }

@media (max-width: 1023px) {
  .hwm .hwm__grid { grid-template-columns: 1fr; gap: 1.25rem; margin-top: 0; }
  .hwm .hwm__mapwrap { max-width: 760px; width: 100%; margin: 0 auto; }
  .hwm .hwm__links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .hwm { padding: 2rem 1rem 1.5rem; }
  .hwm .hwm__h { font-size: 1.5rem; }
  .hwm .hwm__when { margin-top: .25rem; font-size: .875rem; }
  /* the map runs edge to edge on a phone; its words stay on the page's margin */
  .hwm .hwm__mapwrap { width: auto; margin: 0 -1rem; }
  .hwm .hwm__cap { margin: 0 1rem; font-size: .78125rem; }
  .hwm .hwm__links { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }
  .hwm .hwm__links a { display: block; padding: .8125rem 0; line-height: 1.25; }   /* one line of text is a 44px row */
  .hwm .hwm__row { padding: .75rem 0 .5rem; }
}
@media (hover: none), (pointer: coarse) {
  /* on a small map the name a tap brings up is the thing to tap next: give it a finger's height */
  .hwm .hwm__map--small.gm a.gm-l { align-items: center; min-height: 44px; padding: 0 14px 0 15px; font-size: 14px; }
}
@media (max-width: 359px) {
  .hwm .hwm__links:not(.hwm__links--place) { grid-template-columns: 1fr; }
}
@media (max-width: 359px) {
  .hwm .hwm__links a { font-size: .875rem; padding: .84375rem 0; }
  .hwm .hwm__links { column-gap: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hw *, .hwm .hwm__ix * { transition: none !important; }
}
