/* ==========================================================================
   CAPA Peer Support Directory

   Colours and type follow the Good Care Visual Identity Guidelines:
     #FFFFFF  white
     #FCF0C2  pale yellow, quiet callouts
     #E8B8E5  lilac, tints and dark-mode accent
     #9F3E94  magenta, the one action colour
     #582D80  deep purple, headings and links
   Type: Poppins (Bold for headings, Regular for body).

   The two pale brand tints are backgrounds only, they are far too light to
   put text on. Every text/background pair here is checked by
   scripts/check_contrast.py; run it after changing any colour.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Poppins, the Good Care brand face, hosted inside this project so the page
   never makes a request to a third party and works with no internet.
   Poppins is licensed under the SIL Open Font License 1.1; see
   assets/fonts/OFL.txt. Two subsets are included: "latin" covers English and
   French, "latin-ext" adds further European accents. Anything outside them
   falls back to the stack in --font, which is the correct behaviour.
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/poppins-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/poppins-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/poppins-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/poppins-600-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/poppins-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/poppins-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}


:root {
  /* brand */
  --brand-white:   #ffffff;
  --brand-yellow:  #fcf0c2;
  --brand-lilac:   #e8b8e5;
  --brand-magenta: #9f3e94;
  --brand-purple:  #582d80;

  /* light theme */
  --bg:            #faf5fb;
  --surface:       #f7f1f8;
  --card:          #ffffff;
  --text:          #241c2b;
  --text-muted:    #574d61;
  --heading:       #582d80;
  --border:        #e4d9e8;
  --border-strong: #8a7b93;
  --accent:        #582d80;
  --accent-solid:  #9f3e94;
  --accent-on:     #ffffff;
  --accent-soft:   #f2dff0;
  --focus:         #582d80;
  --callout:       #fdf6da;
  --callout-edge:  #9f3e94;
  --badge:         #fbeecd;
  --hero-bg:       #582d80;
  --hero-text:     #ffffff;
  --hero-muted:    #e8b8e5;
  --shadow:        0 1px 2px rgba(36, 22, 48, 0.05), 0 4px 14px rgba(36, 22, 48, 0.05);
  --shadow-lift:   0 2px 4px rgba(36, 22, 48, 0.07), 0 10px 26px rgba(36, 22, 48, 0.09);

  --radius:    12px;
  --radius-sm: 8px;
  --measure:   58ch;
  --tap:       44px;

  /* Poppins is the brand face and is bundled in assets/fonts/. The fallbacks
     are the closest geometric sans faces shipping with macOS and Windows, so
     the page still keeps its shape if a font file ever fails to load. */
  --font: "Poppins", "Avenir Next", "Century Gothic", "Futura",
          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* This directory is light-only, to match the Good Care identity sheet, which
   is built on white and the two pale brand tints. A dark theme was built and
   removed on request; git history has it if it is ever wanted back. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* Avoids a lone word stranded on the last line of a paragraph. */
  text-wrap: pretty;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;              /* 17px */
  line-height: 1.65;
  /* Long words (emails, URLs, French compounds) must never force the page
     sideways at small widths or large text sizes. */
  overflow-wrap: break-word;
}

h1, h2, h3 { color: var(--heading); font-weight: 700; letter-spacing: -0.01em; }

/* A thin brand rule across the top, the magenta bar from the identity sheet. */
body::before {
  content: "";
  display: block;
  height: 4px;
  background: var(--brand-magenta);
}

.wrap { width: 100%; max-width: 84rem; margin: 0 auto; padding: 0 1.5rem; }

/* --- accessibility helpers ------------------------------------------------ */

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 0.75rem; top: -5rem;
  background: var(--accent-solid); color: var(--accent-on);
  padding: 0.75rem 1.25rem; border-radius: var(--radius-sm);
  font-weight: 600; z-index: 100;
}
.skip-link:focus { top: 0.75rem; }

:where(a, button, input, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- header --------------------------------------------------------------- */

.site-header { background: var(--card); border-bottom: 1px solid var(--border); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 4.5rem; flex-wrap: wrap;
}
.logo-link { display: inline-flex; align-items: center; min-height: var(--tap); }
.logo { height: 2.35rem; width: auto; display: block; }

.lang-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); min-width: var(--tap);
  padding: 0.5rem 1.15rem;
  border: 1.5px solid var(--border-strong); border-radius: 999px;
  color: var(--accent); text-decoration: none; font-weight: 600;
}
.lang-toggle:hover { background: var(--accent-soft); border-color: var(--accent); }

/* --- page intro ----------------------------------------------------------- */

/* A band in the deep brand purple. It anchors the page, puts the search where
   the eye lands first, and fills width that used to sit empty. */
.hero {
  background: var(--hero-bg);
  color: var(--hero-text);
  padding: 3rem 0 3.25rem;
}
.hero .page-title { color: var(--hero-text); }
.hero .page-subtitle { color: var(--hero-muted); }
.hero .field-label { color: var(--hero-text); }
.hero .field-hint { color: var(--hero-muted); }

.page-title {
  font-size: clamp(1.875rem, 1.4rem + 2.2vw, 3rem);
  line-height: 1.08; margin: 0 0 0.6rem; max-width: 20ch;
}
.page-subtitle {
  margin: 0 0 1.9rem;
  font-size: 1.125rem; line-height: 1.5; max-width: 52ch;
}

.disclaimer {
  margin-top: 2rem;
  background: var(--surface);
  border-left: 3px solid var(--brand-magenta);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.8rem 1.1rem;
  margin-bottom: 0;
  max-width: 40rem;
  color: var(--text-muted);
}
/* The heading stays for screen readers and for the aside's accessible name.
   On screen the block speaks for itself, and a bold label wedged against grey
   body text looked like a mistake rather than a label. */
.disclaimer-heading {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.disclaimer p { margin: 0; font-size: 1rem; }

.hero-search { max-width: 44rem; margin-bottom: 0; }
.hero-search .search-input {
  font-size: 1.125rem;
  min-height: 3.25rem;
  padding: 0.7rem 1rem;
  background: var(--card);
}
.hero-search .field-label { margin-bottom: 0.45rem; }

/* --- layout --------------------------------------------------------------- */

.layout { display: block; margin-top: 2rem; }

@media (min-width: 56rem) {
  .layout {
    display: grid;
    grid-template-columns: 19rem minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
  }
}

/* --- filters -------------------------------------------------------------- */

.filters-toggle {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; min-height: var(--tap);
  padding: 0.75rem 1.15rem; margin-bottom: 1.25rem;
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer;
}
.filters-badge {
  margin-left: auto;
  background: var(--accent-solid); color: var(--accent-on);
  border-radius: 999px; padding: 0.15rem 0.65rem;
  font-size: 0.9375rem; font-weight: 700;
}

.filters-panel {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  margin-bottom: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 1.25rem 1.25rem;
  box-shadow: var(--shadow);
}
.filters-panel[hidden] { display: none; }

@media (max-width: 55.99rem) {
  .filters-panel { padding: 0.35rem 1.1rem 1.1rem; }
}

@media (min-width: 56rem) {
  .filters-toggle { display: none; }
  .filters-panel {
    display: block !important;
    position: sticky; top: 1.5rem;
    /* Without this, a filter list taller than the window puts its own bottom
       (including "Clear all filters") somewhere you cannot scroll to. */
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.filters-heading {
  font-size: 1.0625rem; margin: 0 0 1.25rem;
  color: var(--heading); font-weight: 700;
}

.field { margin-bottom: 1.5rem; }
.field-label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.field-hint { margin: 0.4rem 0 0; font-size: 0.9375rem; color: var(--text-muted); line-height: 1.5; }

.search-input {
  width: 100%; min-height: var(--tap);
  padding: 0.65rem 0.85rem;
  font: inherit; color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
}
.search-input:focus { border-color: var(--accent); }

fieldset.filter-group {
  border: 0; border-top: 1px solid var(--border);
  margin: 0; padding: 1.4rem 0 1rem;
}
fieldset.filter-group:first-of-type { border-top: 0; }
fieldset.filter-group legend {
  font-weight: 700; padding: 0; color: var(--heading);
}

.option-list { list-style: none; margin: 0.35rem 0 0; padding: 0; }
/* Deliberately not scrollable on its own. The whole panel scrolls instead,
   so keyboard and screen reader users never meet a scroller inside a scroller. */

.option {
  display: flex; align-items: flex-start; gap: 0.7rem;
  min-height: var(--tap);
  padding: 0.25rem 0.5rem;
  cursor: pointer; border-radius: var(--radius-sm);
}
.option:hover { background: var(--accent-soft); }
/* Ring the whole 44px row, not just the small checkbox. The rule on the input
   itself stays as a fallback for browsers without :has(). */
.option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.option:has(input:checked) { background: var(--accent-soft); font-weight: 600; }

.option input {
  width: 1.15rem; height: 1.15rem; flex: none;
  /* nudge down so it sits on the first line of a label that wraps */
  margin: 0.5rem 0 0;
  accent-color: var(--accent-solid);
}
.option > span:not(.option-count) { padding: 0.35rem 0; }
.option-count { padding: 0.35rem 0; }
/* min-width:0 lets a long option name wrap instead of widening the panel. */
.option > span { min-width: 0; overflow-wrap: anywhere; }
.option-count {
  margin-left: auto; flex: none; white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.875rem; font-variant-numeric: tabular-nums;
}

.more-filters { margin-top: 1.25rem; }
.more-filters > summary {
  min-height: var(--tap);
  display: flex; align-items: center; gap: 0.6rem;
  font-weight: 600; cursor: pointer;
  padding: 0.6rem 0.9rem;
  color: var(--accent);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  list-style: none;
}
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters > summary:hover { background: var(--accent-soft); border-color: var(--accent); }

/* The arrow is decoration. The word "More" beside it carries the meaning. */
.more-filters > summary::after {
  content: ""; margin-left: auto; flex: none;
  width: 0.55rem; height: 0.55rem;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
}
.more-filters[open] > summary {
  background: var(--accent-soft); border-color: var(--accent);
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.more-filters[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
@media (prefers-reduced-motion: no-preference) {
  .more-filters > summary::after { transition: transform 160ms ease; }
}
.more-filters[open] {
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--card);
}
.more-filters[open] > summary { margin: -1.5px -1.5px 0; }
.more-filters[open] > fieldset.filter-group { padding-left: 0.9rem; padding-right: 0.9rem; }
.more-filters[open] > fieldset.filter-group:first-of-type { border-top: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0.65rem 1.5rem;
  font: inherit; font-weight: 600;
  border-radius: var(--radius-sm); border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--accent-solid); color: var(--accent-on); }
.btn-primary:hover { filter: brightness(0.92); }
.btn-quiet {
  background: transparent; color: var(--accent);
  border-color: var(--border-strong); width: 100%;
  margin-top: 1.25rem;
}
.btn-quiet:hover { background: var(--accent-soft); border-color: var(--accent); }

.filters-panel::-webkit-scrollbar { width: 8px; }
.filters-panel::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 999px;
}
.filters-panel:hover::-webkit-scrollbar-thumb { background: var(--border-strong); }

/* --- results -------------------------------------------------------------- */

.results-column:focus { outline: none; }

.result-count {
  font-weight: 700; margin: 0 0 1.25rem;
  font-size: 1.0625rem; color: var(--heading);
  padding-bottom: 0.85rem;
  border-bottom: 2px solid var(--brand-lilac);
}

.result-list { display: grid; gap: 1.5rem; align-items: start; }
@media (min-width: 80rem) {
  .result-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.card {
  overflow-wrap: anywhere;
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.4rem 1.75rem;
  box-shadow: var(--shadow);
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 5px; border-radius: var(--radius) 0 0 var(--radius);
  background: var(--brand-lilac);
}
.card:hover::before { background: var(--brand-magenta); }
@media (prefers-reduced-motion: no-preference) {
  .card { transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease; }
  .card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
}
.card:hover { border-color: var(--border-strong); }

.card-name { font-size: 1.25rem; line-height: 1.25; margin: 0 0 0.25rem; }
.card-org { margin: 0 0 1.1rem; color: var(--text-muted); font-size: 0.9375rem; }
.card-desc { margin: 0 0 1.5rem; max-width: var(--measure); color: var(--text); }

.sample-badge {
  display: inline-block; margin: 0 0 0.7rem;
  font-size: 0.8125rem; font-weight: 700;
  background: var(--badge);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 0.2rem 0.7rem; color: var(--text);
}

/* Chips stay quiet so the group's name is the first thing you read. The name
   keeps its place at the top of the card so heading navigation still works. */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0 0 1.25rem; padding: 0; }
.chip {
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.22rem 0.75rem; font-size: 0.875rem;
  background: var(--surface); color: var(--text-muted);
}
/* Moderation is the field people most need to trust, so it is set apart, but always by its own words, never by the colour on its own. */
.chip-mod-yes, .chip-mod-no, .chip-mod-unknown {
  font-weight: 600; border-color: var(--border-strong);
}
.chip-mod-yes { background: var(--accent-soft); }
/* A non-Canadian listing is called out by its words; the tint only reinforces. */
.chip-based { font-weight: 600; border-color: var(--border-strong); background: var(--callout); }

.card-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

.details-toggle { background: transparent; color: var(--accent); border-color: var(--border-strong); }
.details-toggle:hover { background: var(--accent-soft); border-color: var(--accent); }

.card-details {
  margin-top: 1.4rem; border-top: 1px solid var(--border); padding-top: 1.25rem;
}
.card-details[hidden] { display: none; }

.detail-list { margin: 0; display: grid; gap: 1rem; }
.detail-list dt {
  font-weight: 700; font-size: 0.9375rem;
  color: var(--heading); margin-bottom: 0.1rem;
}
.detail-list dd { margin: 0; max-width: var(--measure); overflow-wrap: anywhere; }

.card-footer {
  margin-top: 1.25rem;
  font-size: 0.875rem; color: var(--text-muted);
}
.stale-note {
  display: block; margin-top: 0.4rem; color: var(--text);
  border-left: 4px solid var(--callout-edge);
  background: var(--callout);
  padding: 0.4rem 0.7rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* --- empty state ---------------------------------------------------------- */

.empty {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
}
.empty h3 { margin: 0 0 0.5rem; font-size: 1.3125rem; }
.empty ul {
  list-style: none; margin: 1.5rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.7rem;
}
.empty ul .btn-quiet { width: auto; margin-top: 0; }

/* --- footer --------------------------------------------------------------- */

.suggest { margin: 3rem 0 1rem; }
.suggest a, .empty a, .card a:not(.btn) { color: var(--accent); }

/* Standalone links get a full-size target, this community includes a lot of
   people with hand and wrist pain, so nothing to press is smaller than 44px. */
.suggest a, .card-source a, .empty p a {
  display: inline-flex; align-items: center;
  min-height: var(--tap); padding: 0.25rem 0;
  font-weight: 600;
}

.card-source { margin: 1.25rem 0 0; }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 3rem; padding: 2rem 0 3rem;
  color: var(--text-muted); font-size: 0.9375rem;
}
.site-footer p { margin: 0 0 0.4rem; max-width: var(--measure); }

/* --- narrow screens ------------------------------------------------------- */

@media (max-width: 26rem) {
  .wrap { padding: 0 1rem; }
  .card, .empty { padding: 1.25rem; }
  /* The panel is not a box any more, so it needs no padding of its own here.
     Leaving the old value in re-added 1.1rem and pushed the page sideways
     once text was scaled up. */
  .filters-panel { padding: 0; }
}
