/* ==========================================================================
   Cockpits · audience band (section presentation)
   ==========================================================================
   Everything the reader sees of the audience switch: the band it sits in, its
   caption and the control itself. Nothing here reaches another section — the
   cross-section contract (which branch is shown) belongs to
   shared/CockpitBranching, and the script talks to this markup through
   data-attributes only, never through these class names.
   ========================================================================== */

.cockpit-audience-band {
  padding-block: clamp(1rem, 3vw, 2.25rem);
  text-align: center;
}

.cockpit-audience-band__caption {
  margin: 0 0 clamp(0.9rem, 1.8vw, 1.25rem);
  /* Optical centring: letter-spacing hangs a gap off the last glyph. */
  padding-left: 0.2em;
  color: var(--feat-muted);
  font-family: var(--feat-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.cockpit-audience-band__switch {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  /* Hugs its two options and takes the band's centre. */
  width: max-content;
  padding: 5px;
  margin-inline: auto;
  border: 1px solid var(--feat-line);
  border-radius: var(--feat-radius-pill);
  background: rgba(14, 12, 38, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 12px 30px rgba(2, 3, 18, 0.35);
}

/* The travelling thumb. One element for two states: the transform carries the
   movement, so there is nothing to keep in sync between the options. It reads
   the same `data-active` the script writes, so the paint follows the state
   without a second class to toggle. */
.cockpit-audience-band__switch::before {
  position: absolute;
  z-index: 0;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc(50% - 5px);
  border-radius: var(--feat-radius-pill);
  background: linear-gradient(118deg, rgba(124, 60, 255, 0.92), rgba(90, 116, 255, 0.86));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 8px 22px rgba(124, 60, 255, 0.34);
  content: '';
  transition: transform 0.42s cubic-bezier(0.42, 0, 0.16, 1);
}

.cockpit-audience-band__switch[data-active='user']::before {
  transform: translateX(100%);
}

.cockpit-audience-band__option {
  position: relative;
  z-index: 1;
  padding: 0.95rem clamp(1.35rem, 2.6vw, 2.3rem);
  border: 0;
  border-radius: var(--feat-radius-pill);
  background: none;
  color: var(--feat-muted);
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 1.15vw, 1.1rem);
  font-weight: 620;
  letter-spacing: -0.012em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.28s ease;
}

.cockpit-audience-band__option.is-active {
  color: var(--feat-ink);
}

.cockpit-audience-band__option:focus-visible {
  outline: 2px solid var(--feat-violet-soft);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .cockpit-audience-band__option:not(.is-active):hover {
    color: var(--feat-text);
  }
}

/* Narrow enough that the control is better off spanning the column than
   sitting as a pill in the middle of it. */
@media (max-width: 560px) {
  .cockpit-audience-band__switch {
    width: 100%;
  }

  .cockpit-audience-band__option {
    padding-inline: 0.8rem;
    font-size: 0.9rem;
  }
}

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