/* The bar (T-288; src/shell and crates/places): the icons, the frame of places and More. One file
   for the app (index.html, before kit.css), the site's plain pages and the front page (layout.html,
   landing.html) and mcl-open's open pages (crates/open-service, which serves this same file), so
   the bar looks the same everywhere. Tokens only (tokens.css; ops/site/rawcheck.py). */
:root { --bottom-bar: 0px; }
body { padding-bottom: var(--bottom-bar); }

/* ---- Icon: one from the sprite (src/kit: Icon). Lucide's 24 px grid; look B is a 2.1 px stroke
   with a tinted fill on the place icons (.tone). Sized by the text around it. ---- */
.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.tone { stroke-width: 2.1; fill: color-mix(in srgb, currentColor 18%, transparent); }
/* ---- Frame (src/shell, PHASE3_PLAN step 3; D-AR.16-19, D-AR.24): the places, one nav drawn per
   format. Phone: tabs along the foot, the current one's icon in a colour tile; a board screen
   (data-screen="board") has its own bar instead. iPad: a rail down the left with labels under
   the icons. Desktop: the same as a slimmer side bar. Both a step darker than the page (D-AR.21),
   the brand tile on top, You at the foot. --frame-l is the room it takes on the left: every
   board-sizing rule takes it off the screen's width (--vw). ---- */
:root { --frame-l: 0px; --frame-t: 0px; --tabbar-h: 3.5rem; --vw: calc(100vw - var(--frame-l));
  --vh: calc(100dvh - var(--frame-t)); --svh: calc(100svh - var(--frame-t)); }
:root[data-format=ipad] { --frame-l: 5.5rem; }
:root[data-format=desk] { --frame-l: 4.75rem; }
:root[data-format=phone]:not([data-screen=board]) body { --bottom-bar: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
body { padding-left: var(--frame-l); }

.frame { position: fixed; z-index: var(--z-bar); left: 0; right: 0; bottom: 0; display: flex; background: var(--rail);
  box-shadow: 0 -1px 0 var(--line);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
:root[data-format=phone][data-screen=board] .frame { display: none; }
.frame-place { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s1); min-height: var(--tabbar-h); color: var(--dim); text-decoration: none;
  font-size: var(--fs-xs); letter-spacing: var(--ls-xs); font-weight: var(--w-bold); }
.frame-tile { display: grid; place-items: center; width: 3rem; height: 1.75rem; border-radius: var(--r-panel); }
.frame-tile .ic { width: 1.375rem; height: 1.375rem; stroke-width: 2.1; fill: color-mix(in srgb, currentColor 18%, transparent); }
.frame-place[aria-current=page] { color: var(--ink); }
.frame-place[aria-current=page] .frame-tile { background: var(--accent); color: var(--on-accent); }
.frame-place[aria-current=page] .frame-tile .ic { fill: color-mix(in srgb, currentColor 25%, transparent); }
@media (hover: hover) {
  .frame-place:hover { color: var(--ink); }
  .frame-place:not([aria-current=page]):hover .frame-tile { background: var(--hover); }
}
.frame-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* On a phone, no brand tile, and five tabs for everyone: Home, Analyse, Players, Puzzles, More
   (T-288, D-SO2.2); Library, Repertoire, Guess and You are at the top of More. */
.frame-brand, .frame-gap { display: none; }
.frame-you.unknown { visibility: hidden; }
:root[data-format=phone] :is(.frame-theme, .frame-guess, .frame-repertoire, .frame-library, .frame-you) { display: none; }
/* The colours button (D-OF.3 A) and More are buttons sized as the rail's links. */
button.frame-theme, button.frame-more { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; font-family: inherit; cursor: pointer; }
button.frame-more[aria-expanded=true]:not([aria-current=page]) .frame-tile { background: var(--hover); color: var(--ink); }

/* More (src/shell/more.rs; T-288, D-SO2.1–3): a panel beside the rail on desktop and iPad, a sheet
   from the bottom on a phone. The scrim leaves the rail free. */
.more-scrim { position: fixed; inset: 0; left: var(--frame-l); z-index: var(--z-scrim); background: var(--shade); }
.more-panel { position: fixed; z-index: var(--z-sheet); left: calc(var(--frame-l) + var(--s1)); bottom: var(--s3); width: 20.5rem;
  max-height: calc(100dvh - var(--frame-t) - 2 * var(--s3)); overflow-y: auto; display: grid; gap: var(--s3); padding: var(--s4);
  background: var(--panel); color: var(--ink); border-radius: var(--r-card); box-shadow: 0 8px 24px var(--shade); }
.more-panel:focus { outline: none; }
:root[data-format=phone] .more-panel { left: 0; right: 0; bottom: 0; width: auto; max-height: 78dvh;
  border-radius: var(--r-card) var(--r-card) 0 0; padding-bottom: calc(var(--s5) + env(safe-area-inset-bottom)); }
.more-grab { width: 2.5rem; height: 0.25rem; border-radius: 2px; background: var(--panel2); justify-self: center; }
.more-grp { display: grid; gap: calc(var(--s1) / 2); }
.more-grp h3 { margin: 0 0 calc(var(--s1) / 2); font-size: 0.6875rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.more-item { display: flex; gap: var(--s3); align-items: center; padding: var(--s2); border-radius: var(--r-control); color: var(--ink); text-decoration: none; }
.more-item .ic { width: 1.125rem; height: 1.125rem; color: var(--dim); flex: none; }
.more-item b { display: block; font-weight: var(--w-bold); font-size: 0.84375rem; }
.more-item small { display: block; color: var(--dim); font-size: 0.75rem; }
@media (hover: hover) { .more-item:hover { background: var(--hover); } }
.more-item:focus-visible { background: var(--acc-soft); }
.more-legal { display: flex; flex-wrap: wrap; gap: var(--s3); padding: 0 var(--s2); font-size: 0.75rem; }
.more-legal a { color: var(--dim); text-decoration: none; }
/* "Your places" and the grab bar are the phone's (D-SO2.2); a plain page draws them for every format. */
:root:not([data-format=phone]) :is(.more-yours, .more-grab) { display: none; }
.more-panel[hidden], .more-scrim[hidden] { display: none; }
/* A plain page (the front page, the site's plain pages: T-288 step 2) carries the bar but no
   desktop menu bar, so nothing sits across the top. */
:root[data-plain][data-format] { --frame-t: 0px; }

/* iPad and desktop: down the left edge. */
:root:not([data-format=phone]) .frame { top: 0; right: auto; width: var(--frame-l); flex-direction: column; align-items: stretch;
  gap: var(--s1); padding: var(--s3) 0 calc(var(--s3) + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  box-shadow: 1px 0 0 var(--line); overflow-y: auto; scrollbar-width: none; }
:root:not([data-format=phone]) .frame-place { flex: none; min-height: 3.75rem; }
:root:not([data-format=phone]) .frame-tile { width: 2.75rem; height: 2.25rem; }
:root:not([data-format=phone]) .frame-gap { display: block; flex: 1; }
:root:not([data-format=phone]) .frame-brand { display: grid; place-items: center; margin-bottom: var(--s2); }
.frame-brand .frame-tile { width: 2.5rem; height: 2.5rem; background: var(--accent); color: var(--on-accent); border-radius: var(--r-panel);
  box-shadow: var(--shadow); }
.frame-brand .frame-tile .ic { fill: currentColor; width: 1.5rem; height: 1.5rem; }
/* The desktop's is slimmer: smaller tiles and labels. */
:root[data-format=desk] .frame-place { min-height: 3.25rem; font-weight: var(--w-text); }
:root[data-format=desk] .frame-tile { width: 2.5rem; height: 2rem; }
/* A short screen (a phone on its side counts as an iPad by the format rule): icons only. */
@media (max-height: 520px) {
  :root:not([data-format=phone]) .frame { gap: 0; padding-top: var(--s2); }
  :root:not([data-format=phone]) .frame-label { display: none; }
  :root:not([data-format=phone]) .frame-place { min-height: 2.75rem; }
  :root:not([data-format=phone]) .frame-brand { margin-bottom: 0; }
}

/* The Analyse icon's count of open tabs (D-AR.19). */
.frame-tile { position: relative; }
.frame-count { position: absolute; top: calc(-1 * var(--s1)); right: calc(-1 * var(--s1)); min-width: 1.125rem; height: 1.125rem;
  padding: 0 var(--s1); border-radius: 999px; background: var(--ink); color: var(--bg); font-size: var(--fs-xs); line-height: 1.125rem;
  text-align: center; font-weight: var(--w-bold); letter-spacing: 0; }
