/* ============================================================
   Home page — focused, search-first "Three Doors" launcher.
   One centered focal block: Track your MP / Track a Bill /
   Ask Mzalendo. Everything is composed from core.css tokens so
   it stays on-brand and consistent with the rest of the site.
   (No islands bundle is loaded on this page — it is featherweight.)
   ============================================================ */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Home page only (home.css loads only here): trim the shell's top padding —
   the launcher is vertically centred, so the default 2rem is excess (~80% cut). */
.site-content { padding-top: 0.4rem; }

/* ---- Hero canvas: subtle Kenyan-flag-tinted warmth, centered ---- */
.home-hero {
  position: relative;
  min-height: 82svh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Vertical padding cut ~80% per request (was 3rem / 2rem); side gutter kept. */
  padding: 0.6rem var(--space-4) 0.4rem;
  /* Soft brand wash: a faint red glow from top-centre + a green hint
     from top-right, over white. Both alphas are ~0.08–0.1, so it reads
     as warmth, not the old loud gradient hero. */
  background:
    radial-gradient(120% 70% at 50% -20%, var(--colour-primary-alpha-10) 0%, transparent 60%),
    radial-gradient(80% 55% at 92% -5%, var(--colour-secondary-alpha-10) 0%, transparent 55%),
    var(--colour-bg);
}

.home-hero__inner {
  width: 100%;
  max-width: 1060px;
  margin-inline: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ---- Head: wordmark, headline, tagline ---- */
.home-hero__head { margin: 0; }
.home-hero__wordmark {
  font-size: var(--text-sm);
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--colour-primary);
  margin: 0 0 var(--space-3);
}
.home-hero__title {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: var(--fw-extrabold);
  line-height: var(--leading-tight);
  color: var(--colour-text);          /* override global h1 { color: primary } */
  margin: 0 0 var(--space-2);
  max-width: none;
}
.home-hero__tagline {
  font-size: var(--text-lg);
  color: var(--colour-text-muted);
  margin: 0;
}

/* ---- The three doors ---- */
.doors {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  text-align: left;
}

.door {
  /* Per-door Kenyan-flag colour: a soft surface tint + a coloured top edge so
     each card lifts off the canvas and the three together read as the flag's
     three bands (red / green / black). Deliberately subtle — colour on the
     surface, not a loud fill. The values are set per door below. */
  --door-accent: var(--colour-border-strong);
  --door-tint: transparent;
  --door-icon-bg: var(--colour-bg-subtle);

  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  text-align: center;
  background:
    linear-gradient(180deg, var(--door-tint) 0%, transparent 62%),
    var(--colour-bg);
  border: 1px solid var(--colour-border);
  border-top: 3px solid var(--door-accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--motion-base) var(--ease-standard);
}
.door[data-door="mp"] {
  --door-accent: var(--colour-primary);   /* flag RED */
  --door-tint: hsl(var(--primary-hue) var(--primary-saturation) var(--primary-lightness) / 0.07);
  --door-icon-bg: var(--colour-primary-alpha-10);
}
.door[data-door="bill"] {
  --door-accent: var(--colour-secondary); /* flag GREEN */
  --door-tint: var(--colour-secondary-alpha-10);
  --door-icon-bg: var(--colour-secondary-alpha-10);
}
.door[data-door="ask"] {
  --door-accent: hsl(0 0% 14%);           /* flag BLACK band */
  --door-tint: hsl(0 0% 0% / 0.045);
  --door-icon-bg: hsl(0 0% 0% / 0.06);
}
.door:hover { box-shadow: var(--shadow-md); }
.door:focus-within { box-shadow: var(--shadow-md); }

/* Action icon tile — tinted in the door's own flag colour. */
.door__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem; height: 3rem;
  margin: 0 auto var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--door-icon-bg);
  color: var(--door-accent);
  font-size: 1.35rem;
}
.door__title {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: var(--colour-text);
  margin: 0 0 var(--space-1);
}
.door__sub {
  font-size: var(--text-sm);
  color: var(--colour-text-muted);
  margin: 0 0 var(--space-4);
}

/* Field + flag accent + typeahead popover live in a relative wrapper,
   pushed to the bottom of the card so the fields line up across doors. */
.door__search { position: relative; margin-top: auto; }

.door__field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 3rem;                 /* ≥48px tap target */
  padding: 0 var(--space-4);
  background: var(--colour-bg);
  border: 1px solid var(--colour-border-strong);
  border-radius: var(--radius-pill);
  transition: border-color var(--motion-fast) var(--ease-standard),
              box-shadow var(--motion-fast) var(--ease-standard);
}
.door__field:focus-within {
  border-color: var(--colour-primary);
  box-shadow: 0 0 0 3px var(--colour-primary-alpha-20);
}
.door__field-icon { color: var(--colour-text-muted); flex: none; }
.door__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--colour-text);
  padding: var(--space-2) 0;
}
.door__input::placeholder { color: var(--colour-text-muted); }
/* Hide the native search "clear" control — the field owns its own look. */
.door__input::-webkit-search-cancel-button { -webkit-appearance: none; }
/* The .door__field:focus-within ring is the single focus indicator. Suppress the
   global `input:focus-visible` outline (core.css) so the field doesn't also show a
   second, inner outline inside the rounded field. Higher specificity than the
   global rule so it actually wins. */
.door__input:focus,
.door__input:focus-visible { outline: none; box-shadow: none; }

/* Signature micro-interaction: the focused door's flag stripe draws itself
   from the centre outward and fades into red–black–green on focus. */
.door__flag {
  display: block;
  height: 2px;
  width: 100%;
  margin: var(--space-2) auto 0;
  border-radius: 2px;
  background: var(--colour-border);
  transform: scaleX(0.25);
  transform-origin: center;
  transition: transform var(--motion-base) var(--ease-standard),
              background var(--motion-base) var(--ease-standard);
}
.door:focus-within .door__flag {
  transform: scaleX(1);
  background: linear-gradient(90deg,
    var(--colour-primary) 0 33%,
    #0b0b0b 33% 66%,
    var(--colour-secondary) 66% 100%);
}

/* ---- Typeahead popover (MP + Bill doors) ---- */
.typeahead {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: var(--z-dropdown);
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  text-align: left;
  background: var(--colour-bg);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 21rem;
  overflow-y: auto;
}
.typeahead[hidden] { display: none; }
.typeahead__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--colour-text);
  text-decoration: none;
  cursor: pointer;
}
.typeahead__row:hover,
.typeahead__row--active { background: var(--colour-bg-subtle); }
.typeahead__avatar {
  width: 2rem; height: 2rem;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--colour-bg-subtle);
}
.typeahead__glyph {
  width: 2rem; height: 2rem;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--colour-secondary-alpha-10);
  color: var(--colour-secondary);
  font-size: 0.9rem;
}
.typeahead__text { min-width: 0; display: flex; flex-direction: column; }
.typeahead__name {
  font-weight: var(--fw-semibold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.typeahead__meta {
  font-size: var(--text-xs);
  color: var(--colour-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.typeahead__empty {
  padding: var(--space-2) var(--space-3);
  color: var(--colour-text-muted);
  font-size: var(--text-sm);
}

/* ---- Ask door example chips (real links; work with no JS) ---- */
.ask-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.ask-chip {
  font-size: var(--text-xs);
  color: var(--colour-text-muted);
  background: var(--colour-bg);
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
  text-decoration: none;
  transition: border-color var(--motion-fast) var(--ease-standard),
              color var(--motion-fast) var(--ease-standard);
}
.ask-chip:hover { border-color: var(--colour-primary); color: var(--colour-primary); }

/* ---- Quiet "everything else" link row ---- */
.explore-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}
.explore-links__label {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--colour-text-muted);
}
.explore-links a {
  color: var(--colour-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
  font-weight: var(--fw-medium);
}
.explore-links a:hover,
.explore-links a:focus-visible {
  text-decoration-thickness: 2px;
  opacity: 0.85;
}

/* ---- One quiet "alive" signal: membership counts + In focus link ---- */
.home-heartbeat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--colour-text-muted);
  font-variant-numeric: tabular-nums;
}
.home-heartbeat__focus {
  color: var(--colour-primary);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}
.home-heartbeat__focus:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---- Responsive: stack the doors on narrow screens ---- */
@media (max-width: 860px) {
  .home-hero { min-height: auto; }
  .doors { grid-template-columns: 1fr; }
  .home-hero__inner { gap: var(--space-5); }
  .explore-links { gap: var(--space-3) var(--space-4); }
  .explore-links a { padding: var(--space-1) 0; }   /* larger tap target */
  .ask-chip { padding: var(--space-2) var(--space-3); }
}

/* ---- Motion-safe: no draw animation, no shadow easing ---- */
@media (prefers-reduced-motion: reduce) {
  .door, .door__field, .door__flag, .ask-chip { transition: none; }
  .door__flag { transform: none; }   /* full-width faint bar at rest */
}
