/* ============================================================
   12 — Member Directory · "Roster"
   Clean card wall. Monogram avatars, availability dot, live shuffle.
   Font: Space Grotesk.
   ============================================================ */

@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/fonts/SpaceGrotesk-Variable.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --hairline: #E3E6EC;
  --ink: #16181D;
  --muted: #646B79;
  --accent: #4B3BEA;
  --open: #137A50;
  --busy: #935E3F;

  --display: "Space Grotesk", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

/* The UA's `[hidden] { display: none }` loses to any author `display` rule
   below, and every demo here toggles `element.hidden` to show and hide
   panels. Without this, hiding silently stops working. */
[hidden] { display: none !important; }

/* A long unbroken token -- a pasted URL, a 200-character "word" -- must wrap
   rather than push its container past its grid track and break the row.
   `anywhere` rather than `break-word` on purpose: only `anywhere` reduces the
   element's min-content width, and a grid or flex item defaults to
   `min-width: auto`, which refuses to shrink below its longest word. With
   `break-word` alone, demo-06 and demo-10 still blew 1.4k px past the viewport.
   The `min-width: 0` below is the other half of the same fix. */
h1, h2, h3, h4, p, li, a, span, strong, em, code, label, time,
button, input, textarea { overflow-wrap: anywhere; }
.card, .post, .listing, .idea, .topic, .question, .profile-card, .submission,
.lesson, .resource, .nominee, .archive-item, .member-card, .comment, .reply,
.answer, .idea-body-wrap { min-width: 0; }


body {
  margin: 0;
  padding-block-end: 96px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.6;
}

.wrap { max-width: 1040px; margin-inline: auto; padding: 0 20px; }

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.025em; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar {
  padding-block: clamp(38px, 6vw, 68px) 22px;
  display: flex; flex-wrap: wrap; gap: 18px;
  justify-content: space-between; align-items: flex-end;
}
.topbar h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.06; }
.topbar > div > p { color: var(--muted); max-width: 52ch; margin-top: 12px; }

.identity-picker { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.identity-picker select {
  font: inherit; font-size: 14px; letter-spacing: 0; text-transform: none;
  margin-left: 6px; min-height: 44px; padding: 9px 12px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 11px;
}

/* ---------- Search + filters ---------- */

.search-bar { margin-bottom: 12px; }
.search-bar input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 13px; padding: 14px 18px; min-height: 52px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.search-bar input::placeholder { color: var(--muted); }
.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(75,59,234,0.10);
}

.tag-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tag-filter {
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  min-height: 44px; padding: 10px 18px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--hairline); border-radius: 999px;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.tag-filter:hover { color: var(--ink); border-color: var(--muted); }
.tag-filter.is-active { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---------- Cards ---------- */

.directory {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
}

.profile-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 22px;
  padding-top: 26px;
  display: flex; flex-direction: column;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.profile-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 18px 38px -24px rgba(75,59,234,0.5);
}

/* Monogram avatar, drawn from data-initial. */
.profile-card::before {
  content: attr(data-initial);
  display: grid; place-items: center;
  width: 3rem; height: 3rem;
  margin-bottom: 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent), #7C6BFF);
  color: #FFFFFF;
  font-size: 16px; font-weight: 600; letter-spacing: 0.03em;
}

.profile-avail {
  position: absolute; top: 18px; right: 18px;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  padding: 4px 11px 4px 20px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
}
.profile-avail::before {
  content: "";
  position: absolute; left: 9px; top: 50%;
  width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%;
  background: currentColor;
}
.profile-avail[data-avail="open"] { color: var(--open); }
.profile-avail[data-avail="busy"] { color: var(--busy); }
.profile-avail { white-space: nowrap; }

.profile-name { font-size: 18px; margin-bottom: 6px; }
.profile-bio { font-size: 14px; color: var(--muted); margin-bottom: 14px; }

.expertise-list {
  list-style: none; margin: 0 0 16px; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.expertise-tag {
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.05em;
  background: var(--bg); color: var(--muted);
  border-radius: 7px; padding: 4px 10px;
}

.profile-card > .btn-ghost { margin-top: auto; align-self: flex-start; }

/* ---------- Buttons ---------- */

.btn {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  min-height: 44px; padding: 12px 22px;
  background: var(--accent); color: #FFFFFF;
  border: 0; border-radius: 11px;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -14px var(--accent); }

.btn-ghost {
  font: inherit; font-size: 13px; cursor: pointer;
  min-height: 44px; padding: 10px 16px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--hairline); border-radius: 11px;
  transition: color 150ms ease, border-color 150ms ease;
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Contact panel ---------- */

.contact-panel {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  background: var(--surface);
  border-top: 1px solid var(--hairline);
  padding: 18px 20px;
  box-shadow: 0 -18px 40px -28px rgba(22,24,29,0.6);
}
.contact-panel-body { max-width: 1040px; margin-inline: auto; }
.contact-panel h2 { font-size: 16px; margin-bottom: 10px; }
.contact-panel textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--hairline);
  border-radius: 11px; padding: 11px 13px; min-height: 44px; resize: vertical;
}
.contact-panel-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* ---------- Toasts ---------- */

.toast-stack { position: fixed; right: 16px; bottom: 108px; display: grid; gap: 8px; z-index: 50; }
.toast {
  font-size: 13px;
  background: var(--ink); color: var(--surface);
  border-radius: 12px; padding: 12px 16px;
  box-shadow: 0 18px 40px -22px rgba(22,24,29,0.8);
}
.toast.error { background: #C24437; }

/* ---------- Motion ---------- */

.motion .profile-card { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .motion .profile-card { opacity: 1 !important; transform: none !important; }
  .btn, .btn-ghost, .tag-filter, .profile-card, .search-bar input { transition: none !important; }
}


/* ---------- Bigger monograms, availability as an edge ---------- */
/* Clean but generic. The monogram is the only distinctive mark on the card, so
   let it carry the card, and turn availability into a coloured top edge rather
   than a small chip. */

.profile-card::before {
  width: 4.25rem; height: 4.25rem;
  border-radius: 18px;
  font-size: 22px; letter-spacing: 0.04em;
  margin-bottom: 18px;
  box-shadow: 0 12px 26px -14px rgba(75,59,234,0.75);
}
.profile-card { border-top: 4px solid var(--open); padding-top: 22px; }
.profile-card:has(.profile-avail[data-avail="busy"]) { border-top-color: var(--busy); }
.profile-name { font-size: 20px; letter-spacing: -0.03em; }
.profile-avail { top: 22px; }
