/* THE MARKET'S BAR (Steven 2026-11-10: "This should say Toll Bench Market
   at the top."; of the want's page: "keep the Market header, except the top
   should say Back to market"). components/_market_bar.html, one bar for
   the shop, a want's card page and an offer's card page. Its dark, padding
   and grid are the shop's own (pages/shop.css .shop-chrome), its X the
   round .drawer-x (css/layout.css); this sheet adds the words, the Back to
   market control, and on a card page the bar fixed on top with the deck of
   one under it. Tokens only. */

/* ---- the words: TOLL Bench Market ------------------------------------- */
/* the Toll Bench wordmark, its O the yellow target (components/
   toll-wordmark.css), then "Market", in the bar's title face */
.market-bar .market-bar__words {
    display: inline-flex;
    align-items: baseline;
    gap: .25em;
    min-width: 0;
    color: var(--text-inverse);
    white-space: nowrap;
}

/* ---- Back to market: a chevron and the words -------------------------- */
/* the shop's back button wore mono capitals; the market's back speaks in
   the bar's own face, the same on every market page */
.shop-chrome .market-bar__back {
    gap: var(--space-1);
    min-height: var(--size-10);
    padding: 0 var(--space-2) 0 0;
    color: var(--text-inverse);
    font-family: var(--font-heading);
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    letter-spacing: normal;
    line-height: 1;
    text-decoration: none;
    text-transform: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.shop-chrome .market-bar__back:hover,
.shop-chrome .market-bar__back:visited { color: var(--text-inverse); }
.shop-chrome .market-bar__back:focus-visible { outline: 2px solid var(--interactive-focus-ring); outline-offset: 2px; }
.market-bar__chev { display: block; flex: none; width: var(--size-5); height: var(--size-5); }

/* ---- a card page: the bar fixed on top -------------------------------- */
body:has(.market-bar--card) {
    --market-bar-h: calc(var(--mb-top) + 80px);
}
.shop-chrome.market-bar--card {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: var(--z-sticky);
    box-sizing: border-box;
    height: var(--market-bar-h);
    gap: var(--space-2);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: 0;
}
/* the back is always there on a card page (the shop shows its own only
   over an open product or a section) */
.market-bar--card .shop-chrome__back { display: inline-flex; }
.market-bar--card .shop-chrome__wordmark { justify-self: center; min-width: 0; }
/* a phone: the words a size down, so Back to market, the words and the X
   share one line */
.shop-chrome.market-bar--card .shop-chrome__wordmark.toll-bench-header__title { font-size: var(--text-lg); }
@media (min-width: 600px) {
    .shop-chrome.market-bar--card .shop-chrome__wordmark.toll-bench-header__title { font-size: var(--text-2xl); }
}

/* the deck of one under the bar (css/pages/home-cards.css .hc-deck, the
   deck shell's sizes, components/deck-shell.css) */
.app-shell--deck-shell:has(.market-bar--card) .hc-deck:not(.hc-deck--market) {
    top: var(--market-bar-h);
    bottom: auto;
    height: calc(100vh - var(--market-bar-h));
    height: calc(100dvh - var(--market-bar-h));
}
/* the bar holds the safe area; the card keeps the deck's own inset */
.app-shell--deck-shell:has(.market-bar--card) .hc-slide { padding-top: var(--ds-slide-pad); }
/* from 600px every card is the deck's tall playing card (deck-shell.css
   THE CARD'S SHAPE), measured in the room under the bar so it keeps its
   shape and the two discs stand on its corners */
@media (min-width: 600px) {
    .app-shell--deck-shell:has(.market-bar--card) {
        --ds-card-w: min(100vw - 2 * var(--ds-slide-pad), (100vh - var(--market-bar-h) - 2 * var(--ds-slide-pad) - var(--ds-stack-strip)) * 9 / 16);
    }
}
@supports (height: 100dvh) {
    @media (min-width: 600px) {
        .app-shell--deck-shell:has(.market-bar--card) {
            --ds-card-w: min(100vw - 2 * var(--ds-slide-pad), (100dvh - var(--market-bar-h) - 2 * var(--ds-slide-pad) - var(--ds-stack-strip)) * 9 / 16);
        }
    }
}

/* THE BIG ROUND BUTTON, top left (Steven 2026-11-12, the Market beside the
   Passport: "The big button needs to be on the market too. It's got the
   same positioning..."): the Passport's own floating white round
   (css/pages/passport-feed.css THE DOT AND THE X FLOAT OVER THE PASSPORT):
   its 40px place at the page frame's corner (4px in on a phone, 12px from
   768px, 18px more to the mark), the 75px white round round it with the
   soft shadow, the stack of cards where the Passport's face sits (40px),
   the count on its shoulder (js/shell/market-bar.js); a tap opens the
   drawer. The X sits where the Passport's does, on the same row. The bar
   is the frame's top strip high (84px on a phone) and its words start
   clear of the round. */
:root {
    --mb-in: 4px;
    --mb-top: calc(env(safe-area-inset-top, 0px) + var(--mb-in));
    --mb-left: calc(env(safe-area-inset-left, 0px) + var(--mb-in));
    --mb-mark: 18px;
    --mb-round: 75px;
}
@media (min-width: 768px) {
    :root { --mb-in: 12px; }
}
.shop-chrome .market-bar__count {
    position: fixed;
    top: calc(var(--mb-top) + var(--mb-mark));
    left: calc(var(--mb-left) + var(--mb-mark));
    z-index: 2;
    isolation: isolate;
    display: block;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-full, 9999px);
    background: none;
    color: var(--text-primary, #111);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.shop-chrome .market-bar__count::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: calc((40px - var(--mb-round)) / 2);
    border-radius: var(--radius-full, 9999px);
    background: none;                 /* the bar's scoop is its round now (THE BLACK CURVES ROUND THE ROUND) */
}
.shop-chrome .market-bar__count:focus-visible { outline: 2px solid var(--interactive-focus-ring); outline-offset: 20px; }
.market-bar__cards { display: block; width: 40px; height: 40px; pointer-events: none; }
.market-bar__badge {
    position: absolute;
    top: -4px;
    right: -8px;
    box-sizing: border-box;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: var(--radius-full, 9999px);
    background: var(--color-purple-500);
    color: var(--color-white, #fff);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: var(--font-semibold, 600);
    line-height: 20px;
    text-align: center;
    pointer-events: none;
}
.market-bar__badge[hidden] { display: none; }
/* the bar: the frame's top strip high, its words clear of the round */
.shop-chrome.market-bar {
    box-sizing: border-box;
    min-height: calc(var(--mb-top) + 80px);
    padding-left: calc(var(--mb-left) + var(--mb-round) + var(--space-3, 12px));
}
/* the X where the Passport's is: 40px, 16px in from the right, on the
   round's row */
.shop-chrome.market-bar .drawer-x {
    position: fixed;
    top: calc(var(--mb-top) + var(--mb-mark));
    right: calc(env(safe-area-inset-right, 0px) + var(--space-4, 16px));
    z-index: 2;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
}
/* the right column only keeps the fixed X's room: the title may run to 4px
   short of the X */
.shop-chrome.market-bar .shop-chrome__right { min-width: 32px; }

/* THE BLACK CURVES ROUND THE ROUND (Steven 2026-11-12, the Cards page:
   "Make the black curve aroudn the icon here too"): the bar's black wraps
   the round button the way a feed card's inside line wraps its top left
   mark (components/_card_frame.html, the ROUND pocket): the button's 75px
   round, 17.5px of the page's own colour round the 40px button, opens into
   the page under the bar through two small concave curves into the bar's
   straight bottom edge, no corner. The card's pocket meets its line 35
   degrees below the circle's middle; the bar's foot lies further down
   (42px under the button's centre, the pocket's line 32.5), so the curves
   are radius 13 (the pocket's 7 would pinch the round into a neck) and
   meet the round at that same 35 degrees: the same outline. One shape,
   drawn in the colour of what lies under the bar (the list's page, a
   card's deck), over the bar's black and its bottom hairline, under the
   button. The bar is --mb-top + 80px and the button --mb-top + 18px down
   at every width, so the shape is fixed: 82.686 wide, 79.5 high, the
   round's centre 41.343 in and 37.5 down. It rides the bar, sticky or
   fixed, so it never moves against it as the page scrolls. */
.shop-chrome.market-bar { --mb-scoop-fill: var(--surface-app, #f4f6fa); }
.shop-chrome.market-bar.market-bar--card { --mb-scoop-fill: var(--surface-secondary, #f1f5f9); }
.shop-chrome.market-bar::after {
    content: "";
    position: absolute;
    z-index: 1;
    left: calc(var(--mb-left) + var(--mb-mark) + 20px - 41.343px);   /* the button's centre, less half the shape */
    bottom: -1px;                       /* over the bar's bottom hairline */
    width: 82.686px;
    height: 79.5px;                     /* from the round's top (--mb-top + 0.5) to the bar's foot */
    background: var(--mb-scoop-fill);
    pointer-events: none;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 82.686 79.5'%3E%3Cpath d='M0 79.5A13 13 0 0 0 10.643 59.035A37.5 37.5 0 1 1 72.043 59.035A13 13 0 0 0 82.686 79.5Z'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 82.686 79.5'%3E%3Cpath d='M0 79.5A13 13 0 0 0 10.643 59.035A37.5 37.5 0 1 1 72.043 59.035A13 13 0 0 0 82.686 79.5Z'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
}

/* THE TITLE A STEP BIGGER (Steven 2026-11-12: "You can make the text
   larger too. I think thte titles are pretty standard here. for tToll bench
   cards"): 24px was the shop's (pages/shop.css); now 28px on a phone,
   held to the room between the round and the X (about 9 widths of its
   size, 158px of the window spoken for), never under 20px, and 32px from
   600px. Its bullseye O is sized in em (components/toll-wordmark.css), so
   it grows with the words. A card open keeps the back arrow beside it, so
   there it is 22px on a phone (18px before), 32px from 600px. */
.shop-chrome.market-bar .shop-chrome__wordmark.toll-bench-header__title {
    font-size: min(28px, max(20px, calc((100vw - 158px) / 9)));
}
.shop-chrome.market-bar.market-bar--card .shop-chrome__wordmark.toll-bench-header__title {
    font-size: min(22px, max(var(--text-lg), calc((100vw - 207px) / 9)));
}
@media (min-width: 600px) {
    .shop-chrome.market-bar .shop-chrome__wordmark.toll-bench-header__title,
    .shop-chrome.market-bar.market-bar--card .shop-chrome__wordmark.toll-bench-header__title { font-size: 32px; }
}

/* A CARD OPEN (Steven 2026-11-12: "just keep the toll bench Market there
   with the back button beside it"; "the close is always the same"): the
   arrow, then the words beside it, on the left; the X on the right */
.shop-chrome.market-bar--card { grid-template-columns: auto minmax(0, 1fr) auto; }
.market-bar--card .shop-chrome__wordmark { justify-self: start; }
.shop-chrome .market-bar--card .market-bar__back,
.shop-chrome.market-bar--card .market-bar__back { padding: 0; min-width: var(--size-10); justify-content: center; }
