/* BCS · the one tab bar of the website and the app (assets/js/tabbar.js), phones only. v2, 14 Nov 2026.
   It never moves: same size everywhere, no sliding, the current tab is simply lit.
   Shape (set by tabbar.js on <html data-tabbar>):
     float · a glass capsule above the home bar; on iPhones its corners are concentric with the
             screen's corners: --tab-side = screen corner radius − half the bar's height
     flat  · iPhones with a home button: flat on the bottom edge, like Instagram */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar {
    --tab-h: 62px;
    --tab-pad: 4px;
    --tab-bottom: max(var(--tab-side, 12px), calc(env(safe-area-inset-bottom, 0px) - 12px));
    position: fixed; z-index: 60;
    left: max(var(--tab-side, 12px), env(safe-area-inset-left, 0px));
    right: max(var(--tab-side, 12px), env(safe-area-inset-right, 0px));
    bottom: var(--tab-bottom);
    max-width: 520px; margin: 0 auto;
    height: var(--tab-h); padding: var(--tab-pad); box-sizing: border-box;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px;
    border-radius: calc(var(--tab-h) / 2);
    background: rgb(255 255 255 / .8);
    -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgb(0 0 0 / .08);
    box-shadow: 0 10px 30px -6px rgb(0 0 0 / .22), inset 0 1px 0 rgb(255 255 255 / .5);
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
    transform: translateZ(0);   /* its own layer: no shimmer while the page scrolls under it */
  }
  [data-theme="dark"] .tabbar {
    background: rgb(30 30 33 / .74);
    border-color: rgb(255 255 255 / .1);
    box-shadow: 0 10px 30px -6px rgb(0 0 0 / .6), inset 0 1px 0 rgb(255 255 255 / .07);
  }
  .tabbar[hidden] { display: none; }
  .tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 0; height: 100%; padding: 0 2px; border-radius: calc((var(--tab-h) - 2 * var(--tab-pad)) / 2);
    color: var(--muted, #6E6E73); text-decoration: none; font-size: 0.6875rem; font-weight: 600; line-height: 1.1; text-align: center;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar a[aria-current="page"] { color: var(--accent-ink, #B4561A); background: rgb(242 139 48 / .14); }
  [data-theme="dark"] .tabbar a[aria-current="page"] { color: #FFB273; background: rgb(242 139 48 / .16); }
  .tabbar a:active { background: rgb(127 127 127 / .14); }
  .tabbar a:focus-visible { outline: 2px solid var(--accent, #F28B30); outline-offset: -2px; }
  .tabbar__icon { position: relative; display: grid; place-items: center; width: 28px; height: 26px; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[aria-current="page"] svg { stroke-width: 2.3; }
  .tabbar__face { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
  .tabbar a[aria-current="page"] .tabbar__face { box-shadow: 0 0 0 2px currentColor; }
  .tabbar__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .badge {
    position: absolute; top: -5px; left: 17px; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: #D70015; color: #fff; font-size: 0.6875rem; font-weight: 700; box-shadow: 0 0 0 2px var(--canvas, #fff);
  }
  .tabbar .badge[hidden] { display: none; }
  .tabbar .badge--dot { top: -1px; left: 22px; min-width: 10px; width: 10px; height: 10px; padding: 0; background: #F28B30; }

  /* iPhone with a home button: flat on the bottom edge */
  :root[data-tabbar="flat"] .tabbar {
    left: 0; right: 0; bottom: 0; max-width: none;
    height: calc(var(--tab-h) - 6px + env(safe-area-inset-bottom, 0px));
    padding: 3px 6px calc(3px + env(safe-area-inset-bottom, 0px));
    border-radius: 0; border-width: 1px 0 0; box-shadow: none;
  }

  /* the page keeps room for it, so nothing hides behind it */
  body.has-tabbar { padding-bottom: calc(62px + max(var(--tab-side, 12px), calc(env(safe-area-inset-bottom, 0px) - 12px)) + 14px); }
  :root[data-tabbar="flat"] body.has-tabbar { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }

  /* away while you type (the keyboard is up) and inside a chat, like Instagram */
  :root.kb-open .tabbar, body.chat-mode .tabbar { display: none; }
}

/* 17 Nov 2026: no cross-page view transition any more. In Safari, going back to a page while the theme
   was being restored froze the fade half-way between dark and light (the "grey theme"). Pages now
   simply appear, like apple.com. */
