/* ==========================================================================
   PUBLIC COMPONENTS - the gift card, badges, filter panel, pager, empty states.
   The gift card is the single most repeated element on the site; everything
   here is built to keep it cheap to paint.
   ========================================================================== */

/* ---- Gift card -------------------------------------------------------- */

.card-g {
    display: flex;
    flex-direction: column;
    /* No surface and no hairline. On a cream canvas a white box with a 1px border
     reads as a form control; letting the photograph and the copy sit directly
     on the page is what makes a catalogue look like a catalogue rather than a
     grid of tiles.

     overflow stays — it is what keeps the action bar parked out of sight below
     the card on desktop (see .card-g__act). */
    background: transparent;
    border: 0;
    border-radius: var(--radius-card);
    overflow: hidden;
    position: relative;
    transition: transform var(--dur-component) var(--ease-brand);
}

@media (hover: hover) {
    /* Lift only, no shadow. With no card behind it, a drop shadow would fall
     around the text as well as the image and read as a rendering fault. The
     lift plus the image zoom already carry the interaction. */
    .card-g:hover {
        transform: translateY(-3px);
    }
}

.card-g__media {
  position: relative;
  aspect-ratio: 4 / 5;          /* reserved space: keeps CLS at zero */
  background: var(--cream-deep);
  overflow: hidden;
  display: block;
}

.card-g__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-section) var(--ease-brand);
}

/* The second gallery image SLIDES in from the right, the way most retail sites
   do it — a cross-fade reads as a page still loading, whereas a slide reads as
   a deliberate second view. */
.card-g__media img.is-alt {
  opacity: 0;
  transform: translateX(12%);
  transition: opacity var(--dur-component) var(--ease-brand),
              transform var(--dur-component) var(--ease-brand);
}

@media (hover: hover) {
  /* Two effects, and the zoom is the one that always fires.

     The slide needs a SECOND image, and most gifts are loaded with only one —
     so on a real catalogue the hover did nothing and looked broken. A gentle
     zoom needs no extra asset, so every card responds; the slide layers on top
     wherever a second image exists.

     Both are transform and opacity only, so nothing reflows. */
  .card-g:hover .card-g__media img:not(.is-alt) { transform: scale(1.06); }

  .card-g:hover .card-g__media img.is-alt {
    opacity: 1;
    transform: translateX(0) scale(1.02);
  }

  /* Keyboard users get it too. The media wrapper is the link, so focusing a
     card by tabbing reveals the second view exactly as hovering does. */
  .card-g__media:focus-visible ~ * img.is-alt,
  .card-g:focus-within .card-g__media img.is-alt {
    opacity: 1;
    transform: translateX(0) scale(1.02);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card-g__media img { transition: opacity var(--dur-micro) linear; }
  .card-g__media img.is-alt { transform: none; }

  .card-g:hover .card-g__media img,
  .card-g:hover .card-g__media img.is-alt { transform: none; }
}

.card-g__media--empty {
  display: grid;
  place-items: center;
  color: var(--ink-mute);
  font-size: var(--fs-small);
}

.card-g__body {
    /* Flush left with the photograph above it. Inset text was the card's padding;
     without a card it just looks misaligned. */
    padding: var(--sp-3) 0 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    flex: 1;
}

.card-g__name {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  color: var(--ink);
}

.card-g__name a { color: inherit; text-decoration: none; }


.card-g__sub {
  font-size: 0.8rem;
  color: var(--ink-mute);
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-g__price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px var(--sp-2);
  margin-top: auto;
  padding-top: var(--sp-2);
  font-variant-numeric: tabular-nums;
}

.card-g__now { font-size: 1.0625rem; font-weight: 700; color: var(--tbs-green); }
.card-g__was { font-size: 0.85rem; color: var(--ink-mute); text-decoration: line-through; }

/* "20% off" was breaking across two lines in a narrow two-up mobile grid,
   leaving "off" stranded under the price. It is three words that must stay
   together or not appear at all. */
.card-g__off {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--danger);
  white-space: nowrap;
}

@media (max-width: 420px) {
  /* On the narrowest phones there is not room for price, struck MRP and the
     discount on one line. The discount is the least important of the three —
     the saving is still visible from the two prices. */
  .card-g__off { display: none; }
}

/* Action bar: slides up on hover, but always visible on touch. Never rely on
   hover for a primary action. */
.card-g__act {
    display: flex;
    gap: var(--sp-2);
    padding: var(--sp-2) 0 0;
}

/* The action bar must line up across a row. It already sits at the bottom of
   each card, but a button whose label wraps to two lines is taller and starts
   higher than its neighbour — which is what made "Choose packaging" and "Add to
   shortlist" sit at different heights. Tightening the horizontal padding on a
   narrow card keeps both on one line. */
@media (max-width: 640px) {
    .card-g__act {
        padding: var(--sp-2) 0 0;
    }

  .card-g__act .b {
    flex: 1;
    min-width: 0;
    padding-inline: var(--sp-2);
    font-size: 0.8125rem;
    min-height: 44px;
    text-align: center;
  }

    .card-g__body {
        padding: var(--sp-3) 0 0;
        gap: 6px;
    }
}

@media (hover: hover) and (min-width: 1024px) {
    .card-g__act {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        padding: var(--sp-3) 0;
        /* Fades to the page canvas, not to white. The transparent stop must be the
       same colour with zero alpha — "transparent" resolves to rgba(0,0,0,0) in
       Safari and greys the middle of the gradient. */
        background: linear-gradient(to top, rgba(247, 244, 238, .98) 60%, rgba(247, 244, 238, 0));
        transform: translateY(102%);
        transition: transform var(--dur-component) var(--ease-brand);
    }

  .card-g:hover .card-g__act,
  .card-g:focus-within .card-g__act { transform: translateY(0); }
}

/* ---- Badges ----------------------------------------------------------- */

.badges {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-1);
  pointer-events: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.6rem;
    /* Explicit, not inherited. Without this the pill picks up --lh-body (1.6)
     from the body, giving a 10px label a 17px line box — a third of the badge's
     height was leading it had no use for. */
    line-height: 1;
    font-weight: 700;
    letter-spacing: .07em;
    padding: 5px 9px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    white-space: nowrap;
}

/* The grid is 2-up on phones, so a card is ~170px wide and a full-length label
   would claim most of it. */
@media (max-width: 640px) {
    .badge {
        font-size: 0.55rem;
        letter-spacing: .05em;
        padding: 4px 8px;
    }
}

.badge--green {
  background: var(--tbs-green);
  color: var(--white);
  box-shadow: 0 1px 6px rgba(0, 48, 31, .28);
}

/* ---- CUSTOMIZABLE --------------------------------------------------------
   This is the differentiator, and it has to survive being laid over unpredictable
   product photography. The previous flat gold washed out against pale backdrops,
   so: a deeper metallic gradient for contrast, near-black text rather than white
   (gold + white is unreadable at this size), a light inner ring to lift it off
   the image, a real shadow, and a slightly larger footprint than the other
   badges because it should win the glance.
   -------------------------------------------------------------------------- */

.badge--gold {
    /* Colour only. The size bump that used to live here was meant for
     CUSTOMIZABLE alone, but LIMITED EDITION also comes through as "gold" and
     was inheriting it — see .badge--hero below. */
    color: #241B08;
    background: linear-gradient(100deg, #A87628 0%, #D9B462 26%, #F4E4B8 44%, #D9B462 62%, #A87628 100%);
    background-size: 260% 100%;
    background-position: 100% 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55), 0 2px 10px rgba(120, 84, 20, .45);
}
}

.badge--gold svg { flex: 0 0 auto; }

/* The highlight travels across the metal, pauses, then repeats. Long pause so
   it reads as a material property rather than a blinking advert. */
@keyframes sheen {
  0%, 62%  { background-position: 100% 0; }
  88%, 100% { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .badge--gold {
    animation: none;
    background: linear-gradient(100deg, #B8873A, #E0BE72);
  }
}


/* The differentiator, and the only badge that should win the glance. Applied
   to CUSTOMIZABLE only — the view decides, not the colour. */
.badge--hero {
    font-size: 0.66rem;
    letter-spacing: .1em;
    padding: 6px 11px;
}

    .badge--hero.badge--gold {
        animation: sheen 4.5s var(--ease-brand) infinite;
    }
/* ---- Grid ------------------------------------------------------------- */

.grid-g {
  display: grid;
  /* 2-up on phones, not 1-up: buyers scan, they do not read one card at a time.
     minmax(0, 1fr) rather than 1fr is deliberate - it stops any item whose
     content is wider than its track from pushing the whole column open. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  align-items: stretch;
}

/* Belt and braces: nothing in the grid may exceed its track. */
.grid-g > * { min-width: 0; max-width: 100%; }

@media (min-width: 640px)  { .grid-g { gap: var(--sp-4); } }
@media (min-width: 768px)  { .grid-g { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid-g { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-6) var(--sp-5); } }

/* Promotional cards occupy real grid cells. Declared spans, not improvised. */
.grid-g > .span-2 { grid-column: span 2; }
.grid-g > .span-full { grid-column: 1 / -1; }

@media (max-width: 639px) {
  .grid-g > .span-2, .grid-g > .span-full { grid-column: 1 / -1; }
}

/* ---- Filter panel ---------------------------------------------------- */

.catalog-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
  align-items: start;
}

@media (min-width: 1024px) {
  .catalog-layout { grid-template-columns: 248px 1fr; gap: var(--sp-6); }
}

.filters {
  /* Bottom sheet on mobile, sticky sidebar on desktop */
  position: fixed;
  inset: auto 0 0 0;
  max-height: 82vh;
  overflow-y: auto;
  background: var(--white);
  border-top: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 48, 31, .18);
  padding: var(--sp-5) var(--sp-4) var(--sp-8);
  transform: translateY(102%);
  transition: transform var(--dur-component) var(--ease-brand);
  z-index: var(--z-drawer);
}

.filters.is-open { transform: translateY(0); }

@media (min-width: 1024px) {
  .filters {
    position: sticky;
    top: 96px;
    inset: auto;
    transform: none;
    max-height: calc(100vh - 120px);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    z-index: 1;
  }
}

.filters__close { margin-bottom: var(--sp-4); }

@media (min-width: 1024px) {
  .filters__close { display: none; }
}

.filter-group {
  border-bottom: 1px solid var(--line);
  padding-block: var(--sp-4);
}

.filter-group:first-of-type { padding-top: 0; }

.filter-group > summary {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--tbs-green);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-group > summary::-webkit-details-marker { display: none; }
.filter-group > summary::after { content: "+"; font-size: 1rem; color: var(--ink-mute); }
.filter-group[open] > summary::after { content: "\2212"; }

.filter-group__body { padding-top: var(--sp-3); }

.filter-opt {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 7px 0;
  font-size: 0.9rem;
  color: var(--ink);
  text-decoration: none;
  min-height: 36px;
}


.filter-opt.is-on { color: var(--tbs-green); font-weight: 600; }

/* The checkbox is decorative - the whole row is an anchor, so the box must not
   swallow the click or toggle itself out of sync with the URL. */
.filter-opt input {
  width: 17px;
  height: 17px;
  accent-color: var(--tbs-green);
  pointer-events: none;
}
.filter-opt .n { margin-left: auto; font-size: 0.78rem; color: var(--ink-mute); }

.filter-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

/* ---- Active filter chips -------------------------------------------- */

.chips-active {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.chip-x {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--tbs-green-soft);
  color: var(--tbs-green);
  border: 1px solid transparent;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  text-decoration: none;
}

pager-g a:hove
.chip-x b { font-weight: 700; }
.chip-x .x { font-size: 1rem; line-height: 1; opacity: .6; }

/* ---- Toolbar above the grid ----------------------------------------- */

.list-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}

.list-bar__count { font-size: 0.9rem; color: var(--ink-mute); }
.list-bar__spacer { flex: 1 1 auto; }

.select-lite {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 9px 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  min-height: 40px;
}

.filter-trigger { display: inline-flex; }

@media (min-width: 1024px) {
  .filter-trigger { display: none; }
}

/* ---- Pager ---------------------------------------------------------- */

.pager-g {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-7);
  flex-wrap: wrap;
}

.pager-g a, .pager-g span {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding-inline: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  text-decoration: none;
  color: var(--tbs-green);
  background: var(--white);
  font-size: 0.9rem;
}

.pager-g .is-current { background: var(--tbs-green); color: var(--white); border-color: var(--tbs-green); font-weight: 700; }
.pager-g .is-off { color: var(--line); background: var(--cream-deep); }

/* ---- Empty state ---------------------------------------------------- */

.empty-g {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--sp-9) var(--sp-4);
}

.empty-g h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: var(--sp-2);
}

.empty-g p { color: var(--ink-mute); max-width: 44ch; margin-inline: auto; }

/* ---- Skeleton (AJAX filtering) -------------------------------------- */

.skel {
  background: var(--cream-deep);
  border-radius: var(--radius-card);
  aspect-ratio: 4 / 5;
  position: relative;
  overflow: hidden;
}

.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  transform: translateX(-100%);
  animation: sweep 1.3s infinite;
}

@keyframes sweep { to { transform: translateX(100%); } }

/* ---- Backdrop for the mobile filter sheet -------------------------- */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 48, 31, .42);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-component) var(--ease-brand);
  z-index: calc(var(--z-drawer) - 1);
}

.backdrop.is-on { opacity: 1; pointer-events: auto; }

/* Pointer devices only — see the note at the end of base.css. */
@media (hover: hover) {
    .card-g__name a:hover {
        color: var(--tbs-green);
    }

    /* .filter-opt.is-on stays ungated: it reflects the active filter in the URL,
     which is state rather than hover. */
    .filter-opt:hover {
        color: var(--tbs-green);
    }

    .chip-x:hover {
        border-color: var(--tbs-green);
    }

    .pager-g a:hover {
        border-color: var(--tbs-green);
        background: var(--tbs-green-soft);
    }
}