/* Wave Purple — UI pack: category heading plate, Browse button (phones), Favorites switch, AIR switch + drop-down.
   Load once, AFTER style.css / operators.css. */

/* Wave Purple — category page heading in a glass plate.  STAGING.
   Load AFTER style.css / operators.css / stats-flip.css.  Touches only .category-page-title (category pages).

   - Same family as the stat plates (graphite gloss), but no blur, no 3D, no animation: it is plain gradients,
     so it draws on any phone, including very low-end ones.
   - ONE fixed width and height for every category, whatever the name length.
   - It follows the stat plates' colour theme automatically (--sf-g0/1/2 come from stats-flip.css); the
     fallbacks below are the "graphite-gloss-light" shade.

   Tuning knobs (change here):
     --wp-ct-w      plate width (it never gets wider than the column)
     --wp-ct-h      plate height
     --wp-ct-size   heading font size (was the browser default, 32px; now 23px on desktop) */
.category-page-title {
  --wp-ct-w: 340px;
  --wp-ct-h: 50px;
  --wp-ct-size: clamp(18px, 5.2vw, 23px);

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
  width: min(100%, var(--wp-ct-w));
  height: var(--wp-ct-h);
  margin: 6px 0 14px;
  padding: 0 16px;

  font-size: var(--wp-ct-size);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .2px;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);

  border-radius: 12px;
  border: 1px solid #0b0c10;
  background:
    /* soft diagonal glare */
    linear-gradient(112deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 34%, rgba(255,255,255,.11) 40%, rgba(255,255,255,.04) 50%, rgba(255,255,255,0) 56%, rgba(255,255,255,0) 100%),
    /* top-half gloss, crisp lower edge */
    linear-gradient(180deg, rgba(255,255,255,.20) 0%, rgba(255,255,255,.07) 47%, rgba(255,255,255,0) 50%),
    /* fine brushed grain */
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, rgba(0,0,0,.14) 1px 2px),
    /* body */
    linear-gradient(180deg, var(--sf-g0, #6f737f) 0%, var(--sf-g1, #565a65) 48%, var(--sf-g2, #41444d) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 0 0 1px rgba(255,255,255,.06),
    inset 0 -2px 4px rgba(0,0,0,.55),
    0 4px 12px -2px rgba(0,0,0,.55);
}

/* the count, "(45)", as a small recessed pill inside the plate; hidden until script.js has filled it in */
.category-page-title .category-count {
  margin: 0;
  padding: 0;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 0.8em;           /* a little smaller than the name, but in the same typeface and colour family */
  font-weight: 600;
  letter-spacing: 0;
  color: rgba(255,255,255,.88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  background: none;           /* no dark pill: it sits on the plate like the name does */
  border-radius: 0;
  box-shadow: none;
}
.category-page-title .category-count:empty { display: none; }

/* the blurb keeps its place under the plate */
.category-page-blurb { margin-top: 0; }


/* Wave Purple — "Browse <Category> Stations" button (phones only).  UI TEST.
   Load AFTER style.css. The button only exists below 900px, so everything here sits inside that query.

   Look : a glass plate in the same graphite family as the category heading, amber chevron disc pointing UP
          (the station list slides up from the bottom).
   Calm : while a station is playing the button is just the plate.
   Idle : while nothing is playing (body.wp-attn, set by wp-browse.js) it gets an amber edge, a soft sheen that
          sweeps across every 3 s, and a small nudge of the chevron. No blinking. Only movement and fade, so it is
          cheap on weak phones. Reduced-motion visitors get just the amber edge. */
@media (max-width: 899px) {
  :root {
    --wp-browse-bg:
      linear-gradient(112deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 34%, rgba(255,255,255,.10) 40%, rgba(255,255,255,.03) 50%, rgba(255,255,255,0) 56%, rgba(255,255,255,0) 100%),
      linear-gradient(180deg, rgba(255,255,255,.20) 0%, rgba(255,255,255,.07) 47%, rgba(255,255,255,0) 50%),
      repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, rgba(0,0,0,.14) 1px 2px),
      linear-gradient(180deg, var(--sf-g0, #6f737f) 0%, var(--sf-g1, #565a65) 48%, var(--sf-g2, #41444d) 100%);
  }

  .mp-browse-btn {
    position: relative;
    overflow: hidden;
    min-height: 58px;
    padding: 10px 14px;
    gap: 10px;
    border: 1px solid #0b0c10;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.25;
    text-align: center;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
    background: var(--wp-browse-bg);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.55),
      inset 0 0 0 1px rgba(255,255,255,.06),
      inset 0 -2px 4px rgba(0,0,0,.55),
      0 4px 12px -2px rgba(0,0,0,.55);
    transition: border-color .4s ease;
  }
  .mp-browse-btn:active { background: var(--wp-browse-bg); filter: brightness(.92); }

  /* chevron: amber disc, pointing up */
  .mp-browse-btn svg {
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    padding: 6px;
    flex: 0 0 auto;
    color: var(--amber-500);
    background: rgba(0, 0, 0, .30);
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5);
    transform: rotate(180deg);
  }

  /* idle: nothing playing yet */
  body.wp-attn .mp-browse-btn { border-color: rgba(217, 164, 65, .75); }
  body.wp-attn .mp-browse-btn::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 40%;
    background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,255,255,.26), rgba(255,255,255,0));
    pointer-events: none;
    animation: wpSheen 3s ease-in-out infinite;
  }
  body.wp-attn .mp-browse-btn svg { animation: wpNudge 3s ease-in-out infinite; }

  @keyframes wpSheen {
    0%, 55% { transform: translateX(-130%) skewX(-18deg); }
    100%    { transform: translateX(330%) skewX(-18deg); }
  }
  @keyframes wpNudge {
    0%, 8%, 28%, 100% { transform: rotate(180deg) translateY(0); }
    16%               { transform: rotate(180deg) translateY(4px); }   /* rotated frame: 4px = up */
  }
}
@media (max-width: 899px) and (prefers-reduced-motion: reduce) {
  body.wp-attn .mp-browse-btn::after,
  body.wp-attn .mp-browse-btn svg { animation: none; }
}


/* Wave Purple — switches and chips.  UI TEST.   Load AFTER style.css, operators.css and personalize.css.
   1. "Favorites"  : the My favourites / All stations pair becomes ONE green on/off switch (home page, signed-in visitors).
   2. AIR toggle   : By state / By language as a recessed graphite track with a green, raised selected side.
   3. AIR chips    : big tappable chips under the toggle, following the toggle (states or languages).
   Plain gradients only (no blur, no 3D transforms), so it draws on weak phones too. */

:root {
  --wp-gr-0: #1d9a4c;   /* green: bright top edge   */
  --wp-gr-1: #107535;   /* green: body (white text on it >= 4.5:1) */
  --wp-gr-2: #0b5a28;   /* green: lower edge        */
  --wp-green-tex:
    linear-gradient(180deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,.04) 48%, rgba(255,255,255,0) 50%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 1px, rgba(0,0,0,.10) 1px 3px),
    linear-gradient(180deg, var(--wp-gr-0) 0%, var(--wp-gr-1) 22%, var(--wp-gr-1) 62%, var(--wp-gr-2) 100%);
  --wp-plate:
    linear-gradient(112deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 34%, rgba(255,255,255,.10) 40%, rgba(255,255,255,.03) 50%, rgba(255,255,255,0) 56%, rgba(255,255,255,0) 100%),
    linear-gradient(180deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.06) 47%, rgba(255,255,255,0) 50%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.045) 0 1px, rgba(0,0,0,.13) 1px 2px),
    linear-gradient(180deg, var(--sf-g0, #6f737f) 0%, var(--sf-g1, #565a65) 48%, var(--sf-g2, #41444d) 100%);
}

/* ============ 1. Favorites switch ============ */
.wp-seg.wp-seg-off { display: none; }          /* the original two buttons stay in the page (they do the work), just not shown */

.wp-favsw {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 50px; padding: 8px 10px 8px 16px;
  font: 700 17px/1 var(--font-body, system-ui, sans-serif);
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6);
  background: var(--wp-plate);
  border: 1px solid #0b0c10; border-radius: 14px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -2px 4px rgba(0,0,0,.5), 0 3px 10px -2px rgba(0,0,0,.5);
}
.wp-favsw:focus-visible { outline: 3px solid var(--amber-500, #d9a441); outline-offset: 2px; }
.wp-favsw:active { filter: brightness(.94); }

.wp-favsw-track {
  position: relative; flex: 0 0 auto; width: 62px; height: 34px; border-radius: 18px;
  background: linear-gradient(180deg, #b7676b 0%, #a15559 100%);          /* OFF: soft muted red */
  box-shadow: inset 0 2px 4px rgba(60,10,14,.55), inset 0 -1px 0 rgba(255,255,255,.16), 0 1px 0 rgba(255,255,255,.18);
  transition: background-color .15s ease;
}
.wp-favsw-txt { display: none;
 
  position: absolute; top: 0; bottom: 0; right: 11px; display: flex; align-items: center;
  font: 700 12px/1 var(--font-body, system-ui, sans-serif); letter-spacing: .08em; color: #c4c8d2; text-shadow: none;
}
.wp-favsw-track i {                                                        /* the knob: brushed silver, raised */
  position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,.0) 0 2px, rgba(0,0,0,.05) 2px 3px),
    radial-gradient(circle at 35% 28%, #ffffff 0%, #d5d8de 45%, #8f939d 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,.65), inset 0 -2px 3px rgba(0,0,0,.25), inset 0 1px 0 #fff;
  transition: transform .18s ease;
}
.wp-favsw.is-on .wp-favsw-track {                                          /* ON: green, ribbed, slightly extruded */
  background: var(--wp-green-tex);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 -2px 3px rgba(0,0,0,.4), 0 0 0 1px rgba(0,0,0,.5), 0 0 10px rgba(40,200,100,.35);
}
.wp-favsw.is-on .wp-favsw-track i { transform: translateX(28px); }
.wp-favsw.is-on .wp-favsw-txt { right: auto; left: 12px; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.5); }

/* ============ 2. AIR toggle (By state | By language) ============ */
.op-toggle {
  padding: 4px; gap: 4px; overflow: visible; border-radius: 15px;
  border: 1px solid #0b0c10;
  background: linear-gradient(180deg, #1b1d22 0%, #2b2e35 100%);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.75), inset 0 -1px 0 rgba(255,255,255,.12), 0 1px 0 rgba(255,255,255,.14);
}
.op-toggle button, .op-toggle button + button {
  min-height: 48px; padding: 0 20px; border: 0; border-radius: 11px;
  font: 700 16px/1 var(--font-body, system-ui, sans-serif); color: #c4c8d2; background: transparent; cursor: pointer;
}
.op-toggle button[aria-pressed="true"] {
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6);
  background: var(--wp-green-tex);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 -2px 3px rgba(0,0,0,.4), 0 2px 5px rgba(0,0,0,.6), 0 0 0 1px rgba(0,0,0,.55);
}
@media (max-width: 899px) { .op-toggle { width: 100%; } .op-toggle button { flex: 1 1 50%; padding: 0 8px; } }

/* ============ 3. AIR chips (compact: about half the earlier size) ============ */
.wp-chips { margin: 4px 0 12px; }
.wp-chips-label { margin: 0 0 8px; font: 700 13px/1 var(--font-body, system-ui, sans-serif); letter-spacing: .09em; text-transform: uppercase; color: var(--text-mid, #c9bfe0); }
.wp-chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.wp-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 9px;
  font: 700 13px/1.1 var(--font-body, system-ui, sans-serif); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6);
  background: var(--wp-plate); border: 1px solid #0b0c10; border-radius: 9px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -1px 3px rgba(0,0,0,.5), 0 1px 4px -1px rgba(0,0,0,.5);
}
.wp-chip:active { filter: brightness(.92); }
.wp-chip:focus-visible { outline: 3px solid var(--amber-500, #d9a441); outline-offset: 2px; }
.wp-chip .nat { font-weight: 500; font-size: 12px; opacity: .9; }
.wp-chip .n {
  padding: 2px 6px 1px; font: 400 10.5px/1 var(--font-mono, ui-monospace, monospace); color: var(--sf-lblc, #f0f2f8); text-shadow: none;
  background: rgba(0,0,0,.28); border-radius: 999px; box-shadow: inset 0 1px 2px rgba(0,0,0,.45);
}
.wp-chip.is-on { border-color: var(--amber-500, #d9a441); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -2px 4px rgba(0,0,0,.5), 0 0 0 2px rgba(217,164,65,.55); }
.wp-chip.is-on .n { color: var(--amber-500, #d9a441); }

/* the old language-only link row is replaced by the chips above once they are on the page (it stays in the HTML for search engines / no-JS) */
.wp-static-off { display: none; }

@media (prefers-reduced-motion: reduce) { .wp-favsw-track, .wp-favsw-track i { transition: none; } }

/* ============ 4. AIR drop-down: toggle and list on one bar ============ */
:root {   /* "Amethyst" shade */
  --wp-am-0: #7e5aad; --wp-am-1: #664592; --wp-am-2: #533776; --wp-am-line: #8e6cc0; --wp-am-text: #f4efe4;
}
.wp-airbar { display: flex; align-items: center; gap: 10px; flex: 1 1 100%; min-width: 0; position: relative; }
.wp-airbar .op-toggle { flex: 0 0 auto; width: auto; }
.wp-airbar .op-toggle button { min-height: 44px; padding: 0 14px; font-size: 15px; flex: 0 0 auto; }
.wp-dd { flex: 1 1 0; min-width: 0; }
.wp-ddbtn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 52px; padding: 0 12px;
  font: 700 15px/1 var(--font-body, system-ui, sans-serif); color: var(--wp-am-text); text-align: left; cursor: pointer;
  background: linear-gradient(180deg, var(--wp-am-0) 0%, var(--wp-am-1) 55%, var(--wp-am-2) 100%);
  border: 1px solid var(--wp-am-line); border-radius: 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 2px 6px -1px rgba(0,0,0,.45);
}
.wp-ddtxt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-ddbtn svg { flex: 0 0 auto; transition: transform .15s ease; }
.wp-ddbtn[aria-expanded="true"] svg { transform: rotate(180deg); }
.wp-ddbtn:focus-visible, .wp-ddlist li:focus-visible { outline: 3px solid var(--amber-500, #d9a441); outline-offset: 2px; }
.wp-ddpop {   /* opens under the bar, never wider than the bar, never taller than half the screen */
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; padding: 6px 4px 6px 6px;
  background: var(--wp-am-2); border: 1px solid var(--wp-am-line); border-radius: 13px;
  box-shadow: 0 14px 30px -8px rgba(0,0,0,.7);
}
.wp-ddpop[hidden] { display: none; }
.wp-ddlist {
  list-style: none; margin: 0; padding: 0 5px 0 0; max-height: min(45vh, 340px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #c6aaf0 transparent;
}
.wp-ddlist::-webkit-scrollbar { width: 4px; }
.wp-ddlist::-webkit-scrollbar-track { background: transparent; }
.wp-ddlist::-webkit-scrollbar-thumb { background: #c6aaf0; border-radius: 4px; }
.wp-ddlist li {
  display: flex; align-items: baseline; gap: 8px; min-height: 36px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font: 600 14px/1.2 var(--font-body, system-ui, sans-serif); color: var(--wp-am-text);
}
.wp-ddlist li .b { font-weight: 500; opacity: .85; font-size: 13px; }
.wp-ddlist li .c { margin-left: auto; font: 400 12px/1 var(--font-mono, ui-monospace, monospace); opacity: .85; }
.wp-ddlist li:hover, .wp-ddlist li[aria-selected="true"] { background: rgba(255,255,255,.16); }
@media (max-width: 899px) {
  .wp-airbar .op-toggle { width: auto; }
  .wp-airbar .op-toggle button { padding: 0 8px; font-size: 13px; flex: 0 0 auto; }
  .wp-ddlist { max-height: min(40vh, 280px); }
  .wp-ddlist li { min-height: 30px; padding: 6px 8px; font-size: 12px; }          /* about two-thirds of the usual 18px list text */
  .wp-ddlist li .b { font-size: 11px; } .wp-ddlist li .c { font-size: 10.5px; }
}
@media (max-width: 339px) { .wp-airbar { flex-wrap: wrap; } .wp-dd { flex: 1 1 100%; } }

/* BBC: one group at a time — the drop-down names the group, so its own heading row is hidden */
#categoryList.wp-filter > .category:not(.open) { display: none; }
#categoryList.wp-filter > .category.open > .category-head { display: none; }
/* drop-down alone on the bar (BBC, language pages): full width */
.wp-airbar > .wp-dd:only-child { flex: 1 1 100%; }
/* BBC "All stations": every group open under its heading; headings are plain labels, not buttons */
#categoryList.wp-filter-all > .category > .category-head { display: flex; pointer-events: none; cursor: default; }
#categoryList.wp-filter-all > .category > .category-head .category-chevron { display: none; }

/* The static "By language" link row stays in the HTML for crawlers, but is hidden from the first paint so it never flashes
   before the drop-down appears (wp-ui.js also adds .wp-static-off once it has built the drop-down). */
nav:has(> ul.air-chips) { display: none; }
