/* The "who are you?" switch.
 *
 * A segmented control, not a grey utility bar. The earlier version read as a
 * cookie banner -- a strip of chrome bolted above the page, in its own
 * colours, that you dismiss and forget. This one belongs to the page: it sits
 * on the page's own ground, centred under the header, and the current segment
 * is filled rather than outlined so which one you are on is legible at a
 * glance rather than on inspection.
 *
 * Built on tokens.css. The dark variant is not a separate component -- the
 * same markup picks up the page's ground through .page-dark, so there is one
 * control and no chance of the two drifting.
 */

.audience-chooser {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--oa-space-3) var(--oa-space-5);
  padding: var(--oa-space-5) clamp(16px, 5vw, 48px);
  background: var(--oa-surface);
}

.audience-chooser__question {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--oa-muted);
}

/* The track. One inset well holding the three segments, which is what makes
   them read as a single control with a choice made, rather than three
   buttons that happen to sit together. */
.audience-chooser__options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: var(--oa-radius-pill);
  background: var(--oa-surface-sunken);
  border: 1px solid var(--oa-line);
}

.audience-chooser__option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 9px 20px;
  border-radius: var(--oa-radius-pill);
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.audience-chooser__option:hover,
.audience-chooser__option:focus-visible {
  background: var(--oa-surface);
  text-decoration: none;
}

.audience-chooser__role {
  font-size: 14px;
  font-weight: 600;
  color: var(--oa-ink-soft);
  white-space: nowrap;
}

.audience-chooser__hint {
  font-size: 11.5px;
  color: var(--oa-faint);
  white-space: nowrap;
}

/* Filled, not outlined. An outline on a light ground is easy to miss, and the
   whole job of this control is to say where you are. */
.audience-chooser__option.is-current {
  background: var(--oa-accent);
  box-shadow: var(--oa-shadow-sm);
}

.audience-chooser__option.is-current .audience-chooser__role,
.audience-chooser__option.is-current .audience-chooser__hint {
  color: #ffffff;
}

.audience-chooser__option.is-current .audience-chooser__hint { opacity: 0.82; }

/* --- on a dark page ------------------------------------------------------ */

.page-dark .audience-chooser {
  background: var(--oa-stage);
  border-bottom: 1px solid #1d222c;
}

.page-dark .audience-chooser__question { color: #7b8698; }

.page-dark .audience-chooser__options {
  background: #161a23;
  border-color: #222836;
}

.page-dark .audience-chooser__option:hover,
.page-dark .audience-chooser__option:focus-visible {
  background: #1d2330;
}

.page-dark .audience-chooser__role { color: #cfd5e0; }
.page-dark .audience-chooser__hint { color: #6c7382; }

.page-dark .audience-chooser__option.is-current {
  background: var(--oa-accent);
  box-shadow: 0 6px 18px rgba(108, 99, 255, 0.36);
}

.page-dark .audience-chooser__option.is-current .audience-chooser__role,
.page-dark .audience-chooser__option.is-current .audience-chooser__hint {
  color: #ffffff;
}

@media (max-width: 640px) {
  /* One row of three, not three stacked rows. Stacked, the control took a
     third of a phone's first screen and pushed the page's own headline and
     button below the fold -- a switch most visitors never touch was the
     biggest thing they saw. The segments are rounded rectangles rather than
     pills, so a label that wraps inside one ("School or department") reads
     as two lines in a box, not as the tall lozenge the pill version became.
     The hints go: at a third of 390px they cannot be read anyway. */
  .audience-chooser {
    padding: var(--oa-space-3) clamp(12px, 4vw, 20px);
  }

  .audience-chooser__question {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .audience-chooser__options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 4px;
    border-radius: var(--oa-radius-md);
  }

  .audience-chooser__option {
    justify-content: center;
    min-height: 44px;
    padding: 6px 8px;
    border-radius: 8px;
    text-align: center;
  }

  .audience-chooser__role {
    font-size: 13px;
    line-height: 1.25;
    white-space: normal;
  }

  .audience-chooser__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .audience-chooser__option { transition: none; }
}
