/* VIEW BAR — the When filter pills (.when-filter) and the List / Map switch (.segmented), one component.
   build.py injects this file at the view_bar_css placeholder in home.html. Markup and states: design-system/index.html
   ("Filter pills" and "View switch"). Behaviour: the pills' filtering lives in home.html, the phone dropdown in view-bar.js.
   Any new filter or switch on the site starts here: reuse these classes, don't write a new one.
   Only palette tokens. The map's own phone toolbar (body.gm-open rules) stays in home.html with the map. */
/* The filters sit straight on the page ground (--bg), not on a white card, so they use the second tone of the pair (--well-page / --chosen-page). */
.filter-row{display:flex;flex-wrap:wrap;align-items:center;gap:12px}   /* the bar that holds the week filter and the view switch */
.filter-row,.when-filter,.segmented{--well:var(--well-page);--chosen:var(--chosen-page)}
/* One row: the When filters lead on the left, the List / Map switch sits at the right (it wraps under on a narrow phone). */
.filter-row .when-filter{margin:0;flex:1 1 auto}
.filter-row .segmented{margin-left:auto}
body.gm-open .filter-row .when-filter{display:none}   /* the map has no week filter */
.segmented{display:inline-flex;padding:4px;border-radius:999px;background:var(--well);border:0}
.segmented button{min-height:40px;padding:0 20px;border:0;background:transparent;border-radius:999px;font-family:var(--ui);font-size:var(--sm);font-weight:500;color:var(--ink2);cursor:var(--kick);transition:background 160ms var(--out),color 160ms var(--out)}
.segmented button[aria-pressed="true"]{background:var(--chosen);color:var(--ink);box-shadow:none}
/* Tabs variant (.segmented--tabs): the same track, full width, equal segments, for page-level tabs (My games / Profile / Settings).
   Real tabs: role="tablist" on the track, role="tab" + aria-selected on the buttons. Never collapses to the phone dropdown. */
.segmented--tabs{display:flex;width:100%}
.segmented--tabs button{flex:1 1 0;min-height:48px;padding:0 12px;font-size:var(--base)}
.segmented--tabs button[aria-selected="true"]{background:var(--surface);color:var(--ink);font-weight:600;box-shadow:0 1px 3px rgb(var(--accent-rgb) / .2)}
.segmented--tabs button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.when-filter{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 22px}
.when-filter[hidden],.when-filter-empty[hidden]{display:none}
.when-filter button{min-height:44px;padding:0 20px;border-radius:999px;background:var(--well);border:0;font-family:var(--ui);font-size:var(--sm);font-weight:500;color:var(--ink2);cursor:var(--kick);transition:background 160ms var(--out),color 160ms var(--out),border-color 160ms var(--out)}
.when-filter button[aria-pressed="true"]{background:var(--chosen);border-color:transparent;color:var(--ink)}
.when-filter button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.when-filter-empty{font-family:var(--ui);font-size:var(--base);color:var(--ink2);margin:0 6px 22px}
.when-filter-empty button{border:0;background:none;font:inherit;font-weight:700;color:var(--accent);text-decoration:underline;cursor:var(--kick);min-height:44px;padding:0 4px}
/* Phone, list view: the filters shrink to fit one line and List / Map becomes a dropdown (the current view is the
   trigger, the other view opens beneath it). In the map the switch goes back to the two-button toggle in the top bar. */
@media(max-width:720px){
  body:not(.gm-open) .filter-row{flex-wrap:nowrap;gap:8px}
  body:not(.gm-open) .when-filter{gap:6px}
  body:not(.gm-open) .when-filter button{min-height:38px;padding:0 12px;font-size:13px}
  body:not(.gm-open) .segmented{position:relative;padding:0;border:0;background:none;flex:none}
  body:not(.gm-open) .segmented button{min-height:38px;padding:0 12px;border:0;background:var(--well);color:var(--ink);font-size:13px}
  body:not(.gm-open) .segmented button[aria-pressed="true"]{display:inline-flex;align-items:center;background:var(--well);color:var(--ink);box-shadow:none}
  body:not(.gm-open) .segmented button[aria-pressed="true"]::after{content:'';width:6px;height:6px;margin:-3px 0 0 9px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg)}
  body:not(.gm-open) .segmented button[aria-pressed="false"]{display:none}
  body:not(.gm-open) .segmented.is-open button[aria-pressed="false"]{display:block;position:absolute;top:calc(100% + 6px);right:0;min-width:100%;text-align:left;z-index:5;box-shadow:0 6px 20px rgb(var(--accent-rgb) / .18)}
  body:not(.gm-open) .segmented.is-open button[aria-pressed="true"]::after{transform:rotate(225deg);margin-top:3px}
  body:not(.gm-open) .segmented.segmented--tabs{position:static;display:flex;padding:4px;background:var(--well);flex:1 1 auto}
  body:not(.gm-open) .segmented.segmented--tabs button{min-height:44px;padding:0 8px;background:transparent;font-size:var(--sm)}
  body:not(.gm-open) .segmented.segmented--tabs button[aria-selected="true"]{background:var(--surface);box-shadow:0 1px 3px rgb(var(--accent-rgb) / .2)}
}
