/* ============================================================================
   United Way of Rhode Island — Board & Leadership directory
   Loaded after styles.v2.css + mobile.css + styles.v3.css + pages.css, and
   only on /about-us/leadership/. Adds four things the component library
   doesn't already have:
     1. a sticky search + filter toolbar (.uwb-toolbar)
     2. the board member card (.uwb-card) from the Figma comp
     3. a drag/snap "coverflow" rail for the members below the officer grid
     4. an inline detail drawer (.uwb-panel) shared by every card
   Everything degrades: with JS off the rail is a plain horizontal scroller,
   the toolbar hides itself, and every card and bio is present in the markup.
   ========================================================================== */

.uwb {
  --uwb-card-r: 22px;
  --uwb-ring: 6px;
  --uwb-top: 96px;                    /* replaced by JS with the real header height */
  --uwb-ease: cubic-bezier(.22, 1, .36, 1);
}

/* ── sticky search + filter toolbar ─────────────────────────────────────── */
.uwb-toolbar {
  position: sticky;
  top: var(--uwb-top);
  z-index: 60;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid rgba(33, 41, 107, .12);
  padding: clamp(14px, 1.5vw, 22px) 0;
  transition: box-shadow .24s ease;
}
.uwb-toolbar.is-stuck { box-shadow: 0 14px 34px rgba(20, 32, 63, .13); }
.uwb-toolbar__in {
  display: grid;
  grid-template-columns: minmax(260px, 460px) 1fr;
  align-items: center;
  gap: clamp(12px, 1.6vw, 26px) clamp(16px, 2vw, 32px);
}

.uwb-search { position: relative; display: flex; align-items: center; }
.uwb-search__icon {
  position: absolute; left: 18px; width: 18px; height: 18px;
  color: var(--uw-blue); pointer-events: none;
}
.uwb-search input {
  width: 100%;
  padding: 14px 46px 14px 48px;
  font: inherit;
  font-size: clamp(15px, 1.05vw, 17px);
  color: var(--uw-ink);
  background: #fff;
  border: 2px solid rgba(33, 41, 107, .22);
  border-radius: 40px;
  -webkit-appearance: none; appearance: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.uwb-search input::-webkit-search-cancel-button { display: none; }
.uwb-search input::placeholder { color: rgba(35, 31, 32, .5); }
.uwb-search input:hover { border-color: rgba(33, 41, 107, .38); }
.uwb-search input:focus {
  outline: none;
  border-color: var(--uw-blue);
  box-shadow: 0 0 0 4px rgba(0, 68, 181, .14);
}
.uwb-search input:focus-visible { outline: 3px solid var(--uw-gold); outline-offset: 2px; }
.uwb-search__clear {
  position: absolute; right: 10px;
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: rgba(33, 41, 107, .1); color: var(--uw-navy);
  font-size: 17px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  transition: background-color .2s ease;
}
.uwb-search__clear:hover { background: rgba(33, 41, 107, .2); }
.uwb-search__clear[hidden] { display: none !important; }

.uwb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.uwb-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  font-family: var(--uw-display); font-weight: 600; text-transform: uppercase;
  font-size: clamp(12px, .92vw, 14px); letter-spacing: .02em;
  color: var(--uw-navy);
  background: transparent;
  border: 2px solid rgba(33, 41, 107, .22);
  border-radius: 40px;
  cursor: pointer;
  transition: background-color .22s ease, color .22s ease, border-color .22s ease, transform .22s var(--uwb-ease);
}
.uwb-chip span {
  font-family: var(--uw-body); font-weight: 700; font-size: 11px;
  padding: 2px 7px; border-radius: 20px;
  background: rgba(33, 41, 107, .1); color: var(--uw-navy);
}
.uwb-chip:hover { border-color: var(--uw-blue); transform: translateY(-1px); }
.uwb-chip.is-on { background: var(--uw-navy); border-color: var(--uw-navy); color: #fff; }
.uwb-chip.is-on span { background: rgba(255, 255, 255, .2); color: #fff; }

.uwb-count {
  grid-column: 1 / -1;
  margin: 0;
  font-size: clamp(12px, .95vw, 14px);
  font-weight: 700;
  color: rgba(35, 31, 32, .62);
}
.uwb-count b { color: var(--uw-navy); }
@media (max-width: 860px) {
  .uwb-toolbar__in { grid-template-columns: 1fr; }
  .uwb-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .uwb-chip { flex: none; }
}

/* ── section shells ─────────────────────────────────────────────────────── */
.uwb-band {
  position: relative;
  background: linear-gradient(180deg, #4050D1 0%, #2E3A99 46%, #21296B 100%);
  padding: clamp(48px, 5.2vw, 88px) 0 clamp(52px, 5.6vw, 96px);
  overflow: hidden;
}
.uwb-band::after {                      /* the 211 ring ghost, as on the hero */
  content: "";
  position: absolute; z-index: 0; pointer-events: none;
  width: clamp(420px, 46vw, 780px); aspect-ratio: 1;
  left: clamp(-330px, -18vw, -210px); top: clamp(-140px, -10vw, -80px);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    transparent 0 45%,
    rgba(255, 255, 255, .07) 45% 59%,
    transparent 59% 71%,
    rgba(167, 210, 255, .09) 71% 84%,
    transparent 84%);
}
.uwb-band > .uw-wrap { position: relative; z-index: 1; }
.uwb-band .uwb-head h2 { color: #fff; }
.uwb-band .uwb-head p { color: rgba(255, 255, 255, .8); }

.uwb-plain { background: #fff; padding: clamp(48px, 5.2vw, 88px) 0 clamp(40px, 4.4vw, 72px); }

.uwb-head { margin-bottom: clamp(26px, 3vw, 46px); max-width: 62rem; }
.uwb-head h2 {
  font-family: var(--uw-display); font-weight: 700; text-transform: uppercase;
  color: var(--uw-navy);
  font-size: clamp(28px, 3.4vw, 52px); line-height: 1.06;
  margin: 0;
}
.uwb-head p {
  margin: clamp(12px, 1.3vw, 18px) 0 0;
  max-width: 58ch;
  font-size: clamp(15px, 1.1vw, 18px); line-height: 1.55;
  color: rgba(35, 31, 32, .74);
}
.uwb-head__kicker {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--uw-display); font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; font-size: clamp(12px, 1vw, 15px);
  color: var(--uw-gold);
  margin-bottom: clamp(10px, 1.1vw, 16px);
}
.uwb-head__kicker::before { content: ""; width: 30px; height: 3px; border-radius: 2px; background: var(--uw-gold); }
.uwb-plain .uwb-head__kicker { color: var(--uw-blue); }
.uwb-plain .uwb-head__kicker::before { background: var(--uw-blue); }

/* ── the board member card ──────────────────────────────────────────────── */
.uwb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 1.9vw, 30px);
}
@media (max-width: 900px) { .uwb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .uwb-grid { grid-template-columns: 1fr; } }

.uwb-card {
  position: relative;
  display: flex; flex-direction: column;
  background: #fff;
  border-radius: var(--uwb-card-r);
  overflow: hidden;
  box-shadow: 0 18px 34px rgba(15, 24, 62, .18);
  transition: transform .45s var(--uwb-ease), box-shadow .45s ease, opacity .45s ease;
}
.uwb-card__cap {                        /* the pale-blue band behind the portrait */
  position: relative;
  height: clamp(78px, 8vw, 104px);
  background: var(--uw-blue-pale);
  overflow: hidden;
}
.uwb-card__cap::before {                /* a slow sheen, so the tile isn't flat */
  content: "";
  position: absolute; inset: -40% -10%;
  background: radial-gradient(60% 70% at 22% 0%, rgba(255, 255, 255, .55), transparent 70%);
}
.uwb-card__photo {
  position: relative; z-index: 2;
  display: block;
  width: clamp(112px, 11.4vw, 150px); aspect-ratio: 1;
  margin: calc(clamp(78px, 8vw, 104px) * -0.62) auto 0;
  border-radius: 50%;
  border: var(--uwb-ring) solid var(--uw-blue);
  background: var(--uw-blue-pale);
  overflow: hidden;
  transition: transform .5s var(--uwb-ease), border-color .3s ease;
}
.uwb-card__photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.uwb-card__body {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; gap: 8px;
  padding: clamp(18px, 1.9vw, 26px) clamp(18px, 1.9vw, 26px) clamp(58px, 5vw, 68px);
  flex: 1;
}
.uwb-card__name {
  font-family: var(--uw-body); font-weight: 900; text-transform: none;
  font-size: clamp(18px, 1.25vw, 22px); line-height: 1.22;
  color: var(--uw-navy-deep);
  margin: 0;
}
.uwb-card__role {
  margin: 0;
  font-weight: 700; font-size: clamp(13px, .98vw, 15px); line-height: 1.35;
  color: var(--uw-blue);
}
.uwb-card__title {
  margin: 0;
  font-size: clamp(13px, .98vw, 15px); line-height: 1.42;
  color: rgba(35, 31, 32, .78);
}
.uwb-card__toggle {
  position: absolute; right: clamp(16px, 1.7vw, 24px); bottom: clamp(16px, 1.7vw, 22px);
  z-index: 3;
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: var(--uw-navy-deep); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  transition: background-color .25s ease, transform .35s var(--uwb-ease);
}
.uwb-card__toggle svg { width: 17px; height: 17px; transition: transform .35s var(--uwb-ease); }
.uwb-card__toggle:hover { background: var(--uw-blue); transform: scale(1.08); }
.uwb-card.is-open .uwb-card__toggle { background: var(--uw-gold); color: var(--uw-navy); }
.uwb-card.is-open .uwb-card__toggle svg { transform: rotate(180deg); }

/* pointer spotlight — a soft light that tracks the cursor across the tile */
.uwb-card::after {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%),
              rgba(80, 130, 240, .17), transparent 62%);
  transition: opacity .35s ease;
}
.uwb-card:hover { transform: translateY(-8px); box-shadow: 0 30px 54px rgba(15, 24, 62, .28); }
.uwb-card:hover::after { opacity: 1; }
.uwb-card:hover .uwb-card__photo { transform: scale(1.05); }
.uwb-card:focus-within { transform: translateY(-8px); }
.uwb-card.is-open { box-shadow: 0 0 0 3px var(--uw-gold), 0 30px 54px rgba(15, 24, 62, .3); }

/* ── the drag rail: everyone who is not an officer ────────────────────
   The rail component itself lives in rail.css / rail.js. What is here is only
   what the board page adds: how wide a card sits, and what the rail turns into
   while a search is running. ─────────────────────────────────── */
.uwb-rail-wrap { margin-top: clamp(26px, 3vw, 44px); }
.uwb-rail > .uwb-card { flex: 0 0 clamp(250px, 25vw, 318px); }

/* a live query flattens the rail into a plain results grid */
.uwb-rail.is-flat {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: visible;
  cursor: default;
  padding: 0;
}
.uwb-js .uwb-rail.is-flat > .uwb-card { transform: none; opacity: 1; }
.uwb-js .uwb-rail.is-flat > .uwb-card:hover { transform: translateY(-8px); }
.uwb-rail.is-flat > .uwb-card { flex: initial; }
@media (max-width: 900px) { .uwb-rail.is-flat { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .uwb-rail.is-flat { grid-template-columns: 1fr; } }

/* ── the shared detail drawer ───────────────────────────────────────────── */
.uwb-panel {
  display: grid;
  grid-template-rows: 0fr;
  margin: 0;
  border-radius: var(--uwb-card-r);
  background: #fff;
  opacity: 0;
  transition: grid-template-rows .5s var(--uwb-ease), opacity .35s ease, margin .5s var(--uwb-ease);
}
.uwb-panel[hidden] { display: none; }
.uwb-panel.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin: clamp(16px, 1.9vw, 30px) 0;
  box-shadow: 0 26px 60px rgba(15, 24, 62, .28);
}
.uwb-panel__clip { overflow: hidden; }
.uwb-panel__in {
  display: grid;
  grid-template-columns: clamp(150px, 16vw, 210px) 1fr;
  gap: clamp(20px, 2.6vw, 44px);
  padding: clamp(24px, 2.8vw, 44px);
}
.uwb-panel__photo {
  width: 100%; aspect-ratio: 1; border-radius: 50%;
  border: 7px solid var(--uw-blue); overflow: hidden; background: var(--uw-blue-pale);
}
.uwb-panel__photo img { width: 100%; height: 100%; object-fit: cover; }
.uwb-panel__name {
  font-family: var(--uw-body); font-weight: 900; text-transform: none;
  font-size: clamp(24px, 2.2vw, 36px); line-height: 1.14; color: var(--uw-navy-deep);
  margin: 0 0 10px;
}
.uwb-panel__meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 clamp(14px, 1.6vw, 22px); }
.uwb-tag {
  display: inline-flex; align-items: center;
  padding: 6px 14px; border-radius: 40px;
  font-family: var(--uw-body); font-weight: 700; font-size: 12.5px; letter-spacing: .02em;
  background: rgba(0, 68, 181, .1); color: var(--uw-blue);
}
.uwb-tag--gold { background: rgba(255, 186, 0, .22); color: #8a6200; }
.uwb-panel__title {
  margin: 0 0 clamp(14px, 1.6vw, 20px);
  font-size: clamp(15px, 1.2vw, 19px); line-height: 1.5; font-weight: 700; color: var(--uw-navy);
}
.uwb-panel__bio p { margin: 0; font-size: clamp(14.5px, 1.06vw, 17px); line-height: 1.62; color: rgba(35, 31, 32, .82); }
.uwb-panel__bio p + p { margin-top: .85em; }
.uwb-panel__close {
  margin-top: clamp(16px, 1.8vw, 24px);
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 0; cursor: pointer;
  font-family: var(--uw-display); font-weight: 600; text-transform: uppercase;
  font-size: 13px; letter-spacing: .04em; color: var(--uw-blue);
}
.uwb-panel__close:hover { color: var(--uw-navy); }
@media (max-width: 640px) {
  .uwb-panel__in { grid-template-columns: 1fr; justify-items: start; }
  .uwb-panel__photo { width: 150px; }
}

/* ── pull quote between the two boards ──────────────────────────────────── */
.uwb-quote {
  position: relative;
  margin: clamp(34px, 4vw, 60px) auto 0;
  max-width: 62rem;
  padding: clamp(24px, 2.8vw, 40px) clamp(24px, 3vw, 46px);
  border-radius: var(--uwb-card-r);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
}
.uwb-quote blockquote {
  margin: 0;
  font-size: clamp(17px, 1.5vw, 24px); line-height: 1.45; font-weight: 700; color: #fff;
}
.uwb-quote figcaption {
  margin-top: clamp(12px, 1.4vw, 18px);
  font-size: clamp(13px, 1vw, 15px); color: var(--uw-gold); font-weight: 700;
}

/* ── community advisory board ───────────────────────────────────────────── */
.uwb-cab {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1.3vw, 20px);
}
@media (max-width: 900px) { .uwb-cab { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .uwb-cab { grid-template-columns: 1fr; } }
.uwb-mini {
  position: relative;
  padding: clamp(14px, 1.5vw, 20px) clamp(15px, 1.6vw, 22px);
  border-radius: 14px;
  background: #EAF3FE;
  border: 1px solid rgba(0, 68, 181, .12);
  overflow: hidden;
  transition: transform .4s var(--uwb-ease), box-shadow .4s ease, background-color .3s ease;
}
.uwb-mini::before {                      /* gold rail that grows in on hover */
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--uw-gold);
  transform: scaleY(0); transform-origin: top center;
  transition: transform .42s var(--uwb-ease);
}
.uwb-mini:hover {
  transform: translateY(-4px);
  background: #fff;
  box-shadow: 0 18px 34px rgba(33, 41, 107, .16);
}
.uwb-mini:hover::before { transform: scaleY(1); }
.uwb-mini__name {
  margin: 0 0 5px;
  font-family: var(--uw-body); font-weight: 700;
  font-size: clamp(14.5px, 1.06vw, 16.5px); line-height: 1.25; color: var(--uw-navy-deep);
}
.uwb-mini__title {
  margin: 0;
  font-size: clamp(12.5px, .92vw, 14px); line-height: 1.4; color: rgba(35, 31, 32, .7);
}
.uwb-mini__flag {
  display: inline-block; margin-left: 6px;
  font-family: var(--uw-body); font-weight: 700; font-size: 10.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--uw-blue);
  vertical-align: 2px;
}

/* ── search results state ───────────────────────────────────────────────── */
mark.uwb-hl { background: rgba(255, 186, 0, .5); color: inherit; border-radius: 3px; padding: 0 1px; }
.uwb-band mark.uwb-hl { background: rgba(255, 186, 0, .78); color: var(--uw-navy-deep); }
[data-person].is-hidden { display: none !important; }
.uwb-empty {
  margin: clamp(20px, 2.4vw, 34px) 0 0;
  padding: clamp(26px, 3vw, 44px);
  border-radius: var(--uwb-card-r);
  border: 2px dashed rgba(33, 41, 107, .25);
  text-align: center;
}
.uwb-band .uwb-empty { border-color: rgba(255, 255, 255, .3); color: #fff; }
.uwb-empty h3 {
  font-family: var(--uw-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(19px, 1.8vw, 26px); color: inherit; margin: 0 0 8px;
}
.uwb-empty p { margin: 0; font-size: 15px; opacity: .78; }
.uwb-empty button {
  margin-top: 16px;
  background: none; border: 0; padding: 0; cursor: pointer;
  font-weight: 700; color: var(--uw-gold); text-decoration: underline; text-underline-offset: 3px;
}
.uwb-plain .uwb-empty button { color: var(--uw-blue); }

/* ── reduced motion: keep the layout, drop the movement ─────────────────── */
@media (prefers-reduced-motion: reduce) {
  .uwb-card, .uwb-card__photo, .uwb-mini, .uwb-panel, .uwb-chip { transition: none !important; }
  .uwb-card:hover, .uwb-mini:hover, .uwb-card:focus-within { transform: none !important; }
}

/* panel behaves as a full-width row inside whichever grid it lands in */
.uwb-grid > .uwb-panel,
.uwb-rail > .uwb-panel { grid-column: 1 / -1; }
.uwb-grid > .uwb-panel.is-open,
.uwb-rail > .uwb-panel.is-open { margin: 0; }
.uwb-panel__bio[hidden] { display: none; }

/* [hidden] has to beat the display rules on these containers */
.uwb-grid[hidden], .uwb-cab[hidden] { display: none !important; }
.uwb-empty[hidden] { display: none !important; }


/* ── staggered entrance for the two member grids ─────────────────────────
   Scoped with :not(.is-in) so the rules stop matching the moment the grid
   has revealed — otherwise they would out-specify .uwb-card:hover. */
.uwb-js .uwb-grid > .uwb-card,
.uwb-js .uwb-cab  > .uwb-mini { transition-delay: var(--stagger, 0ms); }
.uwb-js .uwb-grid:not(.is-in) > .uwb-card,
.uwb-js .uwb-cab:not(.is-in)  > .uwb-mini { opacity: 0; transform: translateY(22px); }
.uwb-mini { transition: transform .4s var(--uwb-ease), box-shadow .4s ease, background-color .3s ease, opacity .5s ease; }
@media (prefers-reduced-motion: reduce) {
  .uwb-js .uwb-grid:not(.is-in) > .uwb-card,
  .uwb-js .uwb-cab:not(.is-in)  > .uwb-mini { opacity: 1; transform: none; }
}
