/* ============================================================
   🔒 HARD LOCKED — bottom bar (LOCKED.md invariant 19)
   Locked Nov 27 2026; REBUILT FROM THE GROUND UP Nov 29 2026
   on the owner's explicit order (see the history below and
   LOCKED.md invariant 19). This file is the bottom bar's ONLY
   sheet: ALL bar code lives in this file and
   public/js/tabbar.js — and nowhere else. The slab, its
   seating, its buttons, badges and states, the content
   clearance and the desktop sidebar are all here. The
   seating does not change
   again on anyone's initiative: if it ever needs a change,
   Ms. Pink ASKS Asce first and only his yes unlocks it. The
   unlock ships as its own piece and updates this banner,
   LOCKED.md and the guard pins in tests/locked-code.test.js
   in the same piece.
   ============================================================
   TAB BAR — public/css/tabbar.css
   (Ground-up rebuild, Nov 29 2026 — owner order ~02:23 CT:
   "rip the old code out, rebuild it from the ground up. The
   bar and measurement every. Rebuild it properly. Get rid of
   the old code cause no matter what we do, it's still
   broken.")
   ------------------------------------------------------------
   WHAT THIS IS: one solid black slab on both sides — fan and
   model render the same #tabbar element — with the icons and
   word labels inside it, seated by CSS alone:

     position: absolute; bottom: 0 — seated on the app frame
     (#phone, which since the Nov 29 2026 frame seat is
     position: fixed with inset: 0 in styles.css — the frame
     IS the screen's edges, no viewport unit is measured),
     never on the viewport iOS keeps re-measuring;
     height: var(--sc-bar-h) + the safe-area inset;
     the buttons ride the slab's full height, their icon +
     word unit at its bottom edge with the owner's measured
     10px gap under the words (Piece 1e-8's seat, kept word
     for word — the rebuild changes HOW the bar seats, never
     how it looks).

   There is NO JavaScript geometry anywhere in the bar: no
   viewport measuring, no seat formula, no pins, no caps, no
   device records, no stability windows. public/js/tabbar.js
   holds only the legacy-record cleanup and the keyboard
   body class; rendering, active state and badge counts are
   app.js content code (renderTabbar / refreshTabBadges).

   THE LAYOUT-DOOR HOOK: the slab's bottom offset reads ONE
   variable, --sc-bar-offset (default 0px), applied as the
   slab's margin-bottom — the Layout Door registry can move
   the bar later by setting that variable, with no code
   change. The content clearance below carries the same
   offset, so content follows the bar.

   AMENDMENT (Phase C, Nov 29 2026 — the owner's direct
   unlock, his words: "I want the black bar to be able to
   move by itself without getting stuck to the icons. I
   want full controls over everything."): the slab and the
   icon row are independent now. The slab (this box's black
   paint + hairline) seats by a SECOND variable,
   --sc-bar-slab-offset (default 0px), as the box's
   margin-bottom; the icon row keeps --sc-bar-offset, read
   as the buttons' counter-shift (each button translates by
   slab − bar, so the row holds its own seat whatever the
   slab does — at both variables 0 the geometry is exactly
   the pre-split seat, pixel for pixel). The slab also
   publishes OFF: its paint reads --sc-bar-slab-bg /
   --sc-bar-slab-edge (fallbacks = today's black + hairline),
   which the registry's slab entry (fan_slab / model_slab)
   sets to transparent when the owner publishes the black
   bar off — icons float, fully tappable, no black behind
   them. And the content clearance gains the owner's own
   number, --sc-content-clearance (default 0px): the
   reserve is the bar footprint + the bar offset + his
   clearance, set per side (fan_clearance / model_clearance)
   in the tool — nothing follows the slab automatically,
   on his explicit order. Every other property in this
   sheet is byte-identical to the rebuild. The faded layer
   behind the row is a separate sheet's business and is
   not touched here — it stays anchored to this box, as
   it always was.

   CONTENT CLEARANCE: the scroller (#app) reserves exactly
   the slab's footprint — var(--sc-bar-h) + safe-area inset
   + the door offset — as bottom padding, in this sheet, so
   content never slides under the slab. No spacer, no JS.

   KEYBOARD: while a text entry is focused the bar slides
   away (body.kb-open, set by tabbar.js from focus alone —
   the same focus-based detection app.js's live band uses).
   The composers are in-flow flex bands and seat themselves;
   nothing pins them.

   DESKTOP: at min-width:1024px the same element becomes the
   left sidebar (the construction the desktop layout has
   always used, carried into this file with the rest of the
   bar). The seasonal theme packs carry no bar rules at all
   (their desktop-sidebar tints were removed in this piece)
   — this sheet is the bar's one background definition at
   every width. The sidebar's gradient brand block stays in
   styles.css: this sheet carries no gradient (invariant
   20's guard), so the wordmark rides with the desktop
   frame — the one deliberate exception, named in the piece
   report.

   HISTORY (what was ripped out, and why): Pieces 1e-4..1e-9
   (Nov 27 2026) built a measurement sentinel
   (public/js/tabbar.js) that measured the layout box against
   the glass and pinned the row to the paintable bottom
   (Piece 1e-7), floated the icons with no slab (Piece 1e-5),
   and seated labels on the owner's measured ~10pt gap
   (Piece 1e-8); the faded plum wash behind the row ships
   separately under invariant 20 and is untouched by this
   rebuild. Four measurement builds then failed the owner's
   phone in a row — the open-shift guard (PR #217), the
   reopen guard (PR #221), the tall-box cap (PR #230) and
   the record write guard (Nov 28 2026, main 005d15c): his
   Nov 29 2026 02:21 CT screenshots still showed the row
   floating translucent over cards and chat rows, labels
   overlapping content, no slab. The owner ordered the whole
   measurement paradigm deleted, and it is: the sentinel,
   the seat formula, the guards, the cap, the records and
   the spacer clearance are gone from the code, not amended.
   The old localStorage records (sc_tabbar_paintable,
   sc_tabbar_paintable_v2) are removed on sight by the new
   tabbar.js and never read or written again.
   ============================================================ */

:root {
  --sc-bar-h: 64px;       /* the slab's content height — one height, both sides */
  --sc-bar-offset: 0px;   /* layout-door hook: the registry moves the icon row by setting this */
  --sc-bar-slab-offset: 0px; /* Phase C: the registry moves the black slab alone by setting this */
  --sc-content-clearance: 0px; /* Phase C: the owner's own extra content reserve, set in the tool */
  --tabbar-h: var(--sc-bar-h); /* legacy alias: other components (help button,
                                  sheets, banners) still size off the bar height */
}

/* ---------- The slab ---------- */
#tabbar {
  /* Seated against #phone (the app frame, position: relative), NOT the
     viewport: the viewport is the one thing iOS keeps re-measuring on
     scroll/resume — the frame is pinned (styles.css, 100svh), so a seat
     taken from the frame cannot move. (Frame pin, Nov 29 2026.) */
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--sc-bar-slab-offset);
  max-width: 480px;
  height: calc(var(--sc-bar-h) + env(safe-area-inset-bottom));
  background: var(--sc-bar-slab-bg, #000);
  border-top: 1px solid var(--sc-bar-slab-edge, rgba(255, 255, 255, .08));
  display: flex;
  z-index: 30;
  transition: transform .28s ease, opacity .28s ease;
}

/* ---------- Items: icon + word, one unit, seated at the slab's
   bottom edge — the owner's approved seat (Piece 1e-8): the
   unit rides the full bar height with a 10px gap under the
   words, the gap the owner measured and locked. (The old
   sheet expressed the gap as max(10px, inset − 24px); the
   two agree on every current device — the max only bites
   past a 34px inset — and the constant is the seat with the
   measurement language gone.) ---------- */
#tabbar button {
  flex: 1;
  background: none;
  border: none;
  color: #cdbcf0;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding-bottom: 10px;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  /* Phase C slab split: the row holds its OWN seat — each
     button counter-shifts by (slab − bar), so the icons sit
     at --sc-bar-offset whatever the slab does. Both variables
     at 0 = translateY(0px) = the pre-split seat, exactly. */
  transform: translateY(calc(var(--sc-bar-slab-offset) - var(--sc-bar-offset)));
  transition: color .2s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
#tabbar button:active { transform: translateY(calc(var(--sc-bar-slab-offset) - var(--sc-bar-offset))) scale(.92); }
#tabbar button .ico {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; line-height: 1;
  transition: transform .15s ease;
}
#tabbar button .fl-nav-icon {
  width: 30px; height: 30px; object-fit: contain; display: block;
  filter: drop-shadow(0 3px 8px rgba(255, 45, 120, .35));
}
#tabbar button.active { color: #fff; }
#tabbar button.active .ico { transform: scale(1.1); }
#tabbar button.active::after {
  content: '';
  position: absolute;
  bottom: 8px;
  width: 20px; height: 3px; border-radius: 2px;
  /* No background here: the underline's pink-to-peach
     gradient paint lives in styles.css (the one bar line
     that stays there) because this sheet carries no
     gradient — invariant 20's guard. Geometry here, paint
     there, exactly as the pre-rebuild sheets split it. */
}
/* The count badge rides the icon's top corner — the seat the
   Nov 27 2026 skin fix gave it, kept: the old override
   anchored it at the owner's measured seat + 30px
   (max(10px, inset − 24px) + 30px), which is 40px on every
   current device. The constant is that seat with the
   measurement language gone. */
#tabbar button .badge {
  background: #ff5c9e; color: #fff; font-size: 10px; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
  position: absolute;
  bottom: 40px;
  right: calc(50% - 20px);
}
/* The 6-up model bar's labels run smaller so "Settings"
   fits whole (carried from Piece 1e-8 — a fit rule, not a
   seating rule; it keys on the settings tab, which only the
   model bar carries, so the fan bar is untouched). */
#tabbar:has(> button[data-tab="settings"]) button { font-size: 10px; }

/* ---------- States: the bar slides away, it never re-seats ----------
   A sheet or modal is open, a DM chat or the community room
   owns the screen (their composers are the bottom chrome
   there), or the keyboard is up over a text entry
   (body.kb-open — tabbar.js, focus only). One rule for all
   four: the slab slides off the bottom edge and takes no
   taps. Nothing here measures or moves the seat. */
body.sheet-open #tabbar, body.in-chat #tabbar, body.in-community #tabbar, body.kb-open #tabbar {
  transform: translateY(105%); opacity: 0; pointer-events: none;
}

/* ---------- Content clearance ----------
   The scroller reserves the slab's exact footprint as
   bottom padding, so the last row of any screen can always
   rest fully above the slab. Phone widths only — the
   desktop sidebar takes its room from the left (the desktop
   block in styles.css zeroes this reserve there). The
   body-state rules in styles.css (sheet-open / in-chat /
   in-live) collapse the reserve while the bar is away, as
   they always have — they outrank this plain #app rule. */
@media (max-width: 1023px) {
  #app { padding-bottom: calc(var(--sc-bar-h) + env(safe-area-inset-bottom) + var(--sc-bar-offset) + var(--sc-content-clearance)); }
}

/* ---------- Desktop: the same element is the left sidebar ----------
   Carried from the desktop layout block (it lived in
   styles.css until this rebuild): full-height left strip,
   row items, the count badge at the row's right edge (the
   brand block is the one piece that stays behind — see the
   note inside). The sidebar never slides away — a
   sheet, a chat or the community room has nothing to stack
   on in this geometry. While a seasonal banner/promo strip
   is up across the top of #phone (it paints over the
   sidebar's top corner), the sidebar's top padding grows
   to clear it. */
@media (min-width: 1024px) {
  #tabbar {
    position: absolute;
    top: 0; right: auto; bottom: 0; left: 0;
    width: 232px; height: auto; max-width: none;
    margin: 0;
    flex-direction: column; justify-content: flex-start;
    gap: 4px;
    padding: 18px 12px 14px;
    border-top: none;
    border-right: 1px solid rgba(255, 255, 255, .08);
  }
  /* The sidebar's brand block (#tabbar::before, the gradient
     wordmark) stays with the desktop frame in styles.css:
     this sheet carries no gradient at all (invariant 20 —
     the wash is the only gradient allowed near the bar, and
     it lives in its own sheet). */
  #tabbar button {
    flex: 0 0 auto;
    width: 100%;
    flex-direction: row; justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: normal;
    /* The sidebar is one full-height strip — the Phase C
       phone counter-shift never applies here. */
    transform: none;
  }
  #tabbar button:active { transform: scale(.92); }
  #tabbar button .ico { font-size: 20px; }
  #tabbar button:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
  #tabbar button.active { background: rgba(255, 92, 158, .12); }
  /* The active pill moves from under the icon to the left edge. */
  #tabbar button.active::after {
    bottom: auto; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 22px; border-radius: 2px;
  }
  #tabbar button .badge {
    top: 50%; right: 12px; bottom: auto;
    transform: translateY(-50%);
  }
  body.sheet-open #tabbar, body.in-chat #tabbar, body.in-community #tabbar {
    transform: none; opacity: 1; pointer-events: auto;
  }
  #phone:has(> .sc-theme-banner) #tabbar { padding-top: 66px; }
  #phone:has(> .sc-theme-promo) #tabbar { padding-top: 50px; }
  #phone:has(> .sc-theme-banner):has(> .sc-theme-promo) #tabbar { padding-top: 98px; }
}

/* 🔒 HARD LOCKED — bottom bar (LOCKED.md invariant 19).
   The slab, its CSS-only seat, the clearance and the
   sidebar above are locked. Changes only on Asce's unlock,
   requested by Ms. Pink — see the banner at the top of
   this file and LOCKED.md. */
