/* ============================================================
   NATTY+ glass: the admin's look on the store, in small doses.
   Pages link this after their own styles, as /glass.css.

   It goes only on what floats over the page (the cart button, the
   product page's cart bar, messages) or gets pressed (size chips,
   Add, and the floating buttons). Product text, the cart's contents
   and the checkout form stay plain.

   Every rule sits on top of the page's own solid look. A browser
   that cannot blur, or a visit where this file fails to load, gets
   that solid look and loses nothing.

   No rim and no line along any edge of anything: depth is the fill
   and a soft shadow (the operator's rule, DECISIONS 6q). Frosted
   only: iPhone Safari cannot bend light through a lens.
   ============================================================ */
:root {
  --glass-ink: #1a1814;
  --glass-ink-2: #3d382f;
  /* Clear enough to see the page move behind it. contrast() and brightness() lift whatever
     dark thing passes under the glass, so ink words stay readable over an ink chip. */
  --glass-fill: rgba(255, 254, 250, 0.38);
  --glass-frost: blur(9px) saturate(170%) contrast(.74) brightness(1.1);
  --glass-sheen: linear-gradient(112deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 26%, rgba(255,255,255,0) 72%, rgba(255,255,255,0.28) 100%);
  /* Soft all round, and faded out before the bottom of the window. iPhone Safari draws the page on under its toolbar
     but cuts anything fixed off at the window's bottom, so a shadow still showing there ended in a hard line under the
     cart button (owner, Nov 9: "do you see the bottom hovering carts shadow's sharp cutoff line? i don't like that").
     The cart button floats 24 px up and the product page's bar 18 px; these shadows are gone within 18 px, the
     lifted one (a held hover) within 24. */
  --glass-float: inset 0 0 16px rgba(255,255,255,0.4), 0 0 14px rgba(26,24,20,0.09), 0 6px 14px -6px rgba(26,24,20,0.28);
  --glass-float-up: inset 0 0 16px rgba(255,255,255,0.4), 0 0 16px rgba(26,24,20,0.1), 0 8px 16px -7px rgba(26,24,20,0.32);
  --amber-glass: linear-gradient(180deg, #b3722f 0%, #a56528 45%, #9c5e24 100%);
  --amber-lift: 0 2px 6px rgba(90,52,18,0.16), 0 8px 18px -8px rgba(184,115,51,0.5);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --settle: cubic-bezier(.16, 1, .3, 1);
}

/* ===== THE TOP BAR =====
   Edge to edge, so nothing pokes out at its sides as the page moves under it (the owner: "the
   header that follows feels a little messy"). Invisible at the top of a page; /glass.js adds
   .is-stuck once the page has moved under it, and .is-away while a phone reads downward.
   The side padding is the page's own, so the wordmark sits on the content's left edge. */
.gbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 4px;
  width: 100%; margin: 0; padding: 7px max(var(--page-gutter, 16px), calc((100% - var(--page-width, 1032px)) / 2));
  background: #f5f1e8; font-size: 13.5px; font-weight: 600; color: var(--glass-ink);
  transition: transform .34s var(--settle), box-shadow .2s var(--settle);
}
.gbar.is-stuck { box-shadow: 0 10px 26px -18px rgba(26,24,20,0.3); }
/* The page keeps what it scrolls to clear of the bar (scroll-padding-top). The bar's own buttons
   sit inside that zone, so tabbing to one used to scroll the page up and send the categories away
   before they could be reached. While focus is in the bar, nothing scrolls. */
html:has(.gbar :focus) { scroll-padding-top: 0; }
.gbar.is-away { transform: translateY(-100%); box-shadow: none; }
.gbar a { color: inherit; text-decoration: none; }
:where(.gbar) button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.gbar .brand { font-size: 18px; margin: 0; white-space: nowrap; flex: none; }
.gbar-gap { flex: 1 1 auto; min-width: 2px; }
.gbar-back { display: inline-flex; align-items: center; gap: 2px; padding: 8px 10px 8px 0; border-radius: 999px; white-space: nowrap; }
.gbar-back svg { width: 16px; height: 16px; flex: none; }
.gbar-link { padding: 8px 10px; border-radius: 999px; white-space: nowrap; }
/* The cart is a real cart control (owner, Nov 6: "cart is just the word cart?"), drawn as a
   shopping cart (owner, Nov 6 ~08:00: "cart should be like a shopping cart"): its basket fills in
   with how many are in it, then the total in the amber capsule (HANDOFF 3.4.26). Empty, it is the
   outline alone, and its name says "Cart, 0 items". The capsule sits 4px in from the pill on every
   side, so nothing needs a line beside it. (The class names still say bag.) */
.gbar-cart { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 9px; border-radius: 999px; background: rgba(255,255,255,0.62); box-shadow: 0 1px 6px rgba(26,24,20,0.08); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gbar-bag { position: relative; flex: none; width: 22px; height: 22px; }
.gbar-bag svg { display: block; width: 22px; height: 22px; }
.gbar-cart.has .bag-body { fill: currentColor; }
.gbar-cart .count { position: absolute; left: 2px; right: 0; top: 5px; text-align: center; font-size: 10px; font-weight: 700; line-height: 11px; letter-spacing: -0.02em; color: #fff; }
.gbar-cart .sum { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; margin: 0 -5px 0 0; border-radius: 999px; background: var(--amber-glass); color: #fff; font-size: 13px; font-weight: 700; line-height: 1; }
.gbar-cart .count[hidden], .gbar-cart .sum[hidden] { display: none; }
@media (hover: hover) {
  .gbar-back:hover, .gbar-link:hover { background: rgba(255,255,255,0.55); }
  .gbar-cart:hover { background: #fff; }
}

/* ===== DESKTOP HOVER: GROW AND RIPPLE =====
   With a mouse, a control says "I am live" by growing a touch: 1.03 for buttons, chips and
   Add, 1.01 for tiles and offer rows. The grow uses the individual `scale` property, so it
   stacks on the transform the page already sets (a tile's 2px rise, a button's 1px rise)
   rather than replacing it. A control that is held down is left alone, so its press still
   reads as a press. The shadows stay even and soft: depth, never a line on one edge.
   Only a mouse with hover gets any of this. Nothing moves under reduced motion, and phones
   keep the pages as they were.
   The ripple (in /glass.js) sets --lift on the tiles near the pointer. The `translate` below
   reads it, so the ripple stacks with the grow as well. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  :is(.gbar-link, .gbar-back, .gbar-cart, .filter, .variant, .opt, .tier, .act[data-i], .p-add,
      .buy-add, .bag a, .hero-btn, .pc-btn):hover:not(:disabled):not(:active):not(.is-pressed):not(.off):not(.disabled) {
    scale: 1.03;
  }
  .tile:hover:not(:active), .more-card:hover:not(:active) {
    scale: 1.01;
    box-shadow: 0 6px 20px -6px rgba(26,24,20,0.2), 0 2px 8px rgba(26,24,20,0.06);
  }
  .offer:hover:not(:active) { scale: 1.01; }
  .offers.compact .offer:hover:not(:active) { box-shadow: var(--lift-up); }

  /* The grow eases in over .2s and back out on leave. These repeat the page's own transition
     lists with `scale` added, so nothing else they animate changes. (The press section below
     adds `scale` to the chips and Add it styles itself.) */
  .gbar-link, .gbar-back, .gbar-cart { transition: scale .2s ease-out, background-color .2s ease-out; }
  .hero-btn { transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease, box-shadow .18s ease, scale .2s ease-out; }
  .pc-btn { transition: transform .12s, box-shadow .18s, background .15s, scale .2s ease-out; }
  .p-add { transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), filter .2s, scale .2s ease-out; }
  .opt, .tier { transition: background-color .15s, color .15s, box-shadow .2s, transform .28s cubic-bezier(.16, 1, .3, 1), scale .2s ease-out; }
  .buy-add { transition: filter .2s, background-color .15s, transform .28s cubic-bezier(.16, 1, .3, 1), scale .2s ease-out; }
  .tile, .more-card { transition: transform .28s cubic-bezier(.16, 1, .3, 1), box-shadow .28s cubic-bezier(.16, 1, .3, 1), scale .2s ease-out; }
  .offer { transition: scale .2s ease-out, box-shadow .2s ease-out; }

  /* The ripple: /glass.js sets --lift (0 to 4px) on the tiles near the pointer and lets it go
     back on a spring. No transition here, because the spring is the script's. */
  .tile, .more-card { translate: 0 calc(var(--lift, 0) * -1px); }
}
/* Partners sits beside the cart where there is room for it. A phone keeps it in the footer, and
   its links sit a little closer so a four-figure total still fits beside them. */
@media (max-width: 640px) { .gbar-partners { display: none; } .gbar { gap: 2px; } .gbar-link { padding: 8px 7px; } }
@media (max-width: 430px) { .gbar-back { padding-right: 4px; } .gbar-cart .sum { padding: 0 8px; font-size: 12.5px; } }
/* On a phone "Catalog" and the wordmark stood 6 px apart and read as one run (audit, Nov 8). */
@media (max-width: 640px) { .gbar-back + .brand { margin-left: 10px; } }
@media (max-width: 389px) { .gbar-word { display: none; } }
/* Small phones lose the word, never the way back: the link keeps its name for screen readers. */
@media (max-width: 379px) { .gbar-word { display: none; } .gbar-back { padding: 8px 2px 8px 4px; } .gbar-link { padding: 8px 6px; } .gbar-cart { padding: 0 8px; } }
/* The smallest phones (320 wide) with a four-figure total: everything a little smaller, never a sideways scroll. */
@media (max-width: 359px) { .gbar .brand { font-size: 16px; } .gbar-link { padding: 8px 4px; } .gbar-cart .sum { padding: 0 7px; font-size: 12px; } }

/* ===== THE NEXT STEP ===== Add, in the amber of the capsule. */
.act[data-i]:not(.pre):not(.added) { background: var(--amber-glass); color: #fff; box-shadow: var(--amber-lift); }
@media (hover: hover) { .act[data-i]:not(.pre):not(.added):hover { filter: brightness(1.07); } }

/* ===== WHAT FLOATS ===== */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .gbar.is-stuck { background: rgba(245, 241, 232, 0.66); -webkit-backdrop-filter: blur(16px) saturate(170%); backdrop-filter: blur(16px) saturate(170%); }
  .cart-fab, .bag {
    background: var(--glass-fill); color: var(--glass-ink);
    -webkit-backdrop-filter: var(--glass-frost); backdrop-filter: var(--glass-frost);
    box-shadow: var(--glass-float);
  }
  .cart-fab::before, .bag::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: var(--glass-sheen);
  }
  .bag > * { position: relative; }

  .cart-fab:hover { box-shadow: var(--glass-float-up); }
  .cart-fab .count { background: var(--amber-glass); color: #fff; }
  /* The total is the amber capsule, the same next step as the product page's bar. It sits
     7px in from the pill on every side, so it needs no line beside it. */
  .cart-fab .sep { display: none; }
  .cart-fab .total {
    display: inline-block; height: 36px; line-height: 36px; padding: 0 15px; margin: -8px -17px -8px -2px;
    border-radius: 999px; background: var(--amber-glass); color: #fff; box-shadow: var(--amber-lift);
  }

  .bag .bagInfo em { color: var(--glass-ink-2); }
  .bag a { background: var(--amber-glass); color: #fff; box-shadow: var(--amber-lift); }

  .toast {
    background: rgba(255,255,255,0.66); color: var(--glass-ink);
    -webkit-backdrop-filter: blur(15px) saturate(190%); backdrop-filter: blur(15px) saturate(190%);
    box-shadow: 0 2px 10px rgba(26,24,20,0.1), 0 16px 34px -10px rgba(26,24,20,0.36);
  }
  .toast.ok { background: rgba(226,243,232,0.8); color: #125330; }
  .toast.err { background: rgba(251,232,228,0.76); color: #7e261b; }
}

/* Whoever turns see-through off gets a solid fill with the same dark words. */
@media (prefers-reduced-transparency: reduce) {
  .gbar, .gbar.is-stuck, .cart-fab, .bag, .toast { -webkit-backdrop-filter: none; backdrop-filter: none; background: #fbf9f3; }
  .toast.ok { background: #e6f4eb; }
  .toast.err { background: #fbeae7; }
  .cart-fab::before, .bag::before { display: none; }
}

/* ===== MESSAGES =====
   left:50% with no width caps a fixed box at half the screen, so a long message
   wrapped into a tall lozenge (DECISIONS 9). The spring is the admin's. */
.toast {
  right: auto; width: max-content; max-width: calc(100vw - 32px);
  padding: 11px 20px; border-radius: 22px; text-align: center;
  font-size: 13px; font-weight: 600; letter-spacing: 0;
  transform: translateX(-50%) translateY(-10px) scale(.96);
  transition: opacity .18s var(--settle), transform .5s var(--spring);
}
.toast.show { transform: translateX(-50%); }

/* ===== WHAT GETS PRESSED =====
   Down fast, back on the spring, and it lights up where the finger landed.
   /glass.js sets --px, --py and .is-pressed. */
.variant, .cart-fab, .act[data-i], .bag a { -webkit-tap-highlight-color: transparent; }
.variant, .act[data-i], .bag a { position: relative; }

/* A chosen or added size shows at once: no colour fade (on the product page the same fade made the chosen chip take
   about 200 ms to read as chosen; owner, Nov 6: "selecting quantity/size has a lagging/slow effect"). */
.variant { transition: transform .46s var(--spring), box-shadow .28s var(--settle), scale .2s ease-out; }
.cart-fab { transition: opacity .2s var(--settle), transform .46s var(--spring), box-shadow .28s var(--settle); }
.act[data-i] { transition: transform .46s var(--spring), background-color .15s, filter .2s var(--settle), scale .2s ease-out; }
.bag a { transition: transform .46s var(--spring), filter .2s var(--settle), scale .2s ease-out; }
@media (hover: hover) { .bag a:hover { filter: brightness(1.07); } }

:is(.variant, .cart-fab, .act[data-i], .bag a)::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(100px 100px at var(--px, 50%) var(--py, 50%), var(--press-light, rgba(255,244,228,0.32)), rgba(255,244,228,0) 72%);
  opacity: 0; transition: opacity .42s var(--settle);
}
.variant { --press-light: rgba(184,115,51,0.24); }
.variant.in-cart { --press-light: rgba(255,244,228,0.34); }
@media (hover: hover) { .variant:hover { --press-light: rgba(255,244,228,0.34); } }
.cart-fab { --press-light: rgba(255,255,255,0.8); }
/* Under the words, or the brightest part of the press washes them out. */
.cart-fab > * { position: relative; z-index: 1; }
:is(.variant, .cart-fab, .act[data-i], .bag a).is-pressed::after { opacity: 1; transition-duration: .05s; }

:is(.variant, .act[data-i], .bag a).is-pressed { transform: scale(1.035, .965); transition-duration: .08s; }
.cart-fab.is-pressed { transform: translateX(-50%) scale(1.035, .965); transition-duration: .08s; }

/* Adding a size draws the whole list again, so the chip under the finger is gone before
   it can spring back. The chip that replaces it finishes the press. */
@media (prefers-reduced-motion: no-preference) {
  .variant.is-settling { animation: press-settle .46s var(--spring); }
  @keyframes press-settle { from { transform: scale(1.035, .965); } }
}

/* The store's keyboard ring rounds its target to 4px, which squared these off. */
.cart-fab:focus-visible, .variant:focus-visible { border-radius: 999px; }

/* A shop tile eases down a touch as one piece when pressed (glass.js), and springs back. */
.tile.is-pressed { scale: .975; }
@media (hover: none) {
  .tile { transition: transform .28s cubic-bezier(.16, 1, .3, 1), box-shadow .28s cubic-bezier(.16, 1, .3, 1), scale .34s var(--spring); }
  .tile.is-pressed { transition-duration: .28s, .28s, .08s; }
}
@media (prefers-reduced-motion: reduce) {
  :is(.gbar, .variant, .cart-fab, .act[data-i], .bag a, .toast) { transition-duration: .01ms !important; }
  .tile.is-pressed { scale: none; }
  :is(.variant, .act[data-i], .bag a).is-pressed { transform: none; }
  .cart-fab.is-pressed { transform: translateX(-50%); }
}
