/* ============================================================
   Components — marketplace shell
   ============================================================ */

/* -- header ----------------------------------------------- */
/* A floating material with content passing underneath, not an opaque strip.
   The divider is a scroll-edge effect — it only exists once something is
   actually behind the chrome. */
.hdr {
  position: sticky;
  top: 0;
  z-index: var(--z-head);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-mid) var(--ease),
    background var(--t-mid) var(--ease);
}
.hdr.is-stuck {
  background: rgba(255, 255, 255, 0.82);
  border-bottom-color: var(--rule);
}
.hdr__in {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(0.6rem, 0.3rem + 1.4vw, 1.75rem);
  min-height: 68px;
  padding-block: 0.6rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
}
.brand img { width: 36px; }
.brand__t {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.brand__t span {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--mute);
}
@media (max-width: 620px) { .brand__t { display: none; } }

/* search is the primary control, not an afterthought */
.search { position: relative; }
.search input {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 1rem 0.6rem 2.9rem;
  border: 2px solid var(--rule);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--t-md);
  font-weight: 500;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.search input:hover { border-color: var(--rule-2); }
.search input:focus { background: var(--white); border-color: var(--green); outline: none; }
.search input::placeholder { color: var(--mute); font-weight: 450; }
.search > svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mute);
  pointer-events: none;
}

.hdr__acts { display: flex; align-items: center; gap: 0.4rem; }

.icobtn {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding-inline: 0.5rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--r-pill);
  background: var(--white);
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 750;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.icobtn:hover { border-color: var(--green); background: var(--green-tint); }

.quotebtn { position: relative; }
.quotebtn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--green);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  border: 2px solid var(--white);
}

/* -- category strip --------------------------------------- */
.catstrip {
  border-bottom: 1px solid var(--rule);
  background: var(--white);
}
.catstrip__in {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-block: 0.65rem;
  scrollbar-width: none;
}
.catstrip__in::-webkit-scrollbar { display: none; }

/* -- hero banner ------------------------------------------ */
/* A class, not an inline style — the CSP forbids style attributes. */
.hero-bay { padding-top: var(--bay); }

/* Short and wide, like a supermarket promo strip — the grid should start
   near the fold, not a screen and a half down. */
.banner {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: center;
  gap: clamp(0.75rem, 0.4rem + 1.4vw, 1.75rem);
  padding: clamp(1rem, 0.7rem + 1.4vw, 1.9rem) clamp(1.1rem, 0.6rem + 2.2vw, 2.75rem);
  border-radius: var(--r-lg);
  /* Deeper than --green so white body copy clears 4.5:1 on it. */
  background: var(--green-deep);
  color: #fff;
  overflow: hidden;
  position: relative;
}
@media (max-width: 780px) {
  .banner { grid-template-columns: 1fr; text-align: left; }
}
/* Now that the banner is short, the vertically-centred arrows sit level
   with the copy — inset the content so nothing runs underneath them. */
@media (min-width: 781px) {
  .banner { padding-inline: 3.6rem; }
}

.banner__txt { position: relative; z-index: 1; }
.banner .eyebrow { color: rgba(255, 255, 255, 0.92); font-size: 0.66rem; }
.banner h1 {
  color: #fff;
  margin: 0.35rem 0 0.3rem;
  font-size: clamp(1.4rem, 0.95rem + 1.9vw, 2.5rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
/* Inline, not stacked — stacking cost three lines of height. */
.banner h1 .n {
  font-size: 1.3em;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}
.banner__sub {
  font-size: var(--t-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.94);
  max-width: 44ch;
  line-height: 1.35;
}

.banner__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0 0.75rem;
}
/* Darkening beats lightening here — a white veil over green lifts the
   ground toward the text and kills the contrast. */
.bstat {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.17);
}
.bstat b {
  font-size: var(--t-sm);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.bstat span {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

.banner__pick { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.85rem; }
.banner__pick .chip { min-height: 30px; padding: 0.2rem 0.65rem; font-size: 0.72rem; }
.banner__pick .chip {
  background: rgba(0, 0, 0, 0.17);
  border-color: rgba(255, 255, 255, 0.42);
  color: #fff;
}
.banner__pick .chip:hover { border-color: #fff; background: rgba(0, 0, 0, 0.28); color: #fff; }
.banner__pick .chip[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--green-dark); }

.banner .btn {
  background: #fff;
  border-color: #fff;
  color: var(--green-dark);
  min-height: 38px;
  padding: 0.35rem 1rem;
  font-size: var(--t-sm);
}
.banner .btn:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

.banner__shot {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
}
.banner__shot img {
  max-height: clamp(120px, 15vw, 190px);
  width: auto;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.3));
}
@media (max-width: 780px) {
  .banner__shot { display: none; }
}
/* soft halo so the cut-out sits in the green rather than on it */
.banner__shot::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 68%);
}

/* -- rails ------------------------------------------------- */
.rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}
.rail::-webkit-scrollbar { height: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 99px; }
.rail > .card { flex: 0 0 clamp(150px, 42vw, 208px); scroll-snap-align: start; }

/* -- grid -------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
}

/* -- product card ------------------------------------------ */
/* Hairline ring + layered shadow instead of a 1px border — the surface
   reads as lifted off the page rather than drawn onto it. */
.card {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  background: var(--white);
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(12, 16, 12, 0.055), var(--lift);
  transition: box-shadow var(--t-mid) var(--ease),
    transform var(--t-mid) var(--ease);
}
.card:hover,
.card:focus-visible {
  box-shadow: 0 0 0 1px rgba(12, 16, 12, 0.07), var(--lift-3);
  transform: translateY(-3px);
}
.card:active { transform: translateY(-1px) scale(0.99); transition-duration: 110ms; }

.card__media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  /* Without these the image's intrinsic height beats aspect-ratio and
     every card gets a different image box. */
  min-height: 0;
  overflow: hidden;
  padding: 0.9rem;
  background: var(--white);
}
.card__media img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: transform var(--t-mid) var(--ease);
}
.card:hover .card__media img { transform: scale(1.045); }

.card__flag {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1;
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0 0.75rem 0.85rem;
}
.card__name {
  font-size: var(--t-sm);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.012em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}
.card__spec {
  font-size: var(--t-xs);
  color: var(--mute);
  line-height: 1.3;
  margin-bottom: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__price {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: auto;
}
.card__price .num { font-size: 1.18rem; }
.card__price .from { font-size: var(--t-xs); color: var(--mute); font-weight: 600; }
.card__unit {
  font-size: var(--t-xs);
  color: var(--mute);
  font-weight: 600;
  margin-top: 0.15rem;
}
.card__unit b { color: var(--ink-2); font-weight: 750; font-variant-numeric: tabular-nums; }

.empty { grid-column: 1 / -1; padding: 3.5rem 1rem; text-align: center; }
.empty__t { font-size: var(--t-lg); font-weight: 750; }
.empty__h { color: var(--mute); font-size: var(--t-sm); margin-top: 0.3rem; }

/* -- filters row ------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.1rem; }

/* -- panels ------------------------------------------------ */
.scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-panel);
  background: rgba(10, 10, 10, 0.42);
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease);
}
.scrim.is-open { opacity: 1; }

.panel {
  position: fixed;
  z-index: calc(var(--z-panel) + 1);
  background: var(--white);
  display: flex;
  flex-direction: column;
  transition: transform 420ms var(--ease);
  box-shadow: var(--lift-2);
}

.drawer {
  inset: auto 0 0 0;
  max-height: 90vh;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  transform: translateY(100%);
}
.drawer.is-open { transform: translateY(0); }
@media (min-width: 840px) {
  .drawer {
    inset: 0 0 0 auto;
    width: min(660px, 95vw);
    max-height: none;
    border-radius: var(--r-lg) 0 0 var(--r-lg);
    transform: translateX(100%);
  }
  .drawer.is-open { transform: translateX(0); }
}

.panel__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--rule);
  flex: none;
}
.panel__bar h3 { font-size: var(--t-lg); }
.panel__x {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1.5px solid var(--rule);
  border-radius: var(--r-pill);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}
.panel__x:hover { border-color: var(--ink); }

.drawer__body { overflow-y: auto; padding: 1.1rem; }
@media (min-width: 620px) { .drawer__body { padding: 1.6rem; } }

.drawer__media {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border-radius: var(--r-md);
  background: var(--surface);
}
.drawer__media img { max-height: 100%; width: auto; object-fit: contain; mix-blend-mode: multiply; }

.drawer__info h3 { font-size: var(--t-xl); margin-bottom: 0.5rem; }
.drawer__sub { color: var(--mute); font-size: var(--t-sm); margin-bottom: 1.1rem; }
.drawer__h { font-size: var(--t-md); font-weight: 750; margin: 1.5rem 0 0.6rem; }

.meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.meta span {
  padding: 0.3rem 0.65rem;
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-2);
}

/* variant table */
.tblwrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-md); }
.vtbl { border-collapse: collapse; width: 100%; min-width: 430px; font-size: var(--t-sm); }
.vtbl thead th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mute);
  white-space: nowrap;
}
.vtbl td { padding: 0.65rem 0.8rem; border-top: 1px solid var(--rule); }
.vtbl td.n { font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap; }
.vtbl td.u { color: var(--mute); font-size: var(--t-xs); white-space: nowrap; }
.vtbl tr.is-best td { background: var(--green-tint); }
.vtbl tr.is-best td.u { color: var(--green-ink); font-weight: 700; }
.vtbl td.add { width: 1%; text-align: right; }

/* quote */
.qpanel { inset: 0 0 0 auto; width: min(440px, 96vw); transform: translateX(100%); }
.qpanel.is-open { transform: translateX(0); }
.qpanel__body { flex: 1; overflow-y: auto; padding: 0.25rem 1.1rem; }
.qpanel__foot {
  flex: none;
  padding: 1.1rem;
  border-top: 1px solid var(--rule);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.qtotal { display: flex; align-items: baseline; justify-content: space-between; }
.qtotal .num { font-size: 1.5rem; }
.qnote { font-size: var(--t-xs); color: var(--mute); line-height: 1.45; }
.qactions { display: flex; gap: 0.5rem; }
.qactions .btn { flex: 1; }

.qrow {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule);
}
.qrow__img {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 5px;
}
.qrow__img img { max-height: 100%; width: auto; mix-blend-mode: multiply; }
.qrow__n { font-size: var(--t-sm); font-weight: 650; line-height: 1.25; }
.qrow__p { font-size: var(--t-xs); color: var(--mute); margin-top: 0.1rem; }
.qrow__r { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.qrow__t { font-size: var(--t-sm); font-variant-numeric: tabular-nums; font-weight: 750; }
.qstep { display: flex; align-items: center; border: 1.5px solid var(--rule); border-radius: var(--r-pill); }
.qstep button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
  border-radius: var(--r-pill);
}
.qstep button:hover { background: var(--surface); }
.qstep span { min-width: 1.7rem; text-align: center; font-size: var(--t-sm); font-weight: 750; font-variant-numeric: tabular-nums; }

@media (pointer: coarse) {
  .qstep button { width: 44px; height: 44px; }
  .btn--sm { min-height: 44px; }
}

/* -- toast -------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: var(--z-toast);
  transform: translate(-50%, 160%);
  padding: 0.7rem 1.1rem;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  font-size: var(--t-sm);
  font-weight: 600;
  box-shadow: var(--lift-2);
  transition: transform var(--t-mid) var(--ease);
  max-width: min(92vw, 28rem);
  text-align: center;
}
.toast.is-on { transform: translate(-50%, 0); }

/* -- info strip + footer ----------------------------------- */
.strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.info {
  padding: 1.1rem;
  border-radius: var(--r-md);
  background: var(--surface);
}
.info b { display: block; font-size: var(--t-md); font-weight: 750; margin-bottom: 0.15rem; }
.info span { font-size: var(--t-sm); color: var(--mute); line-height: 1.4; display: block; }
.info a { font-weight: 650; word-break: break-word; }

.foot { border-top: 1px solid var(--rule); margin-top: var(--bay); padding-block: 1.5rem 2.5rem; }
.foot__in { display: flex; flex-wrap: wrap; gap: 0.4rem 2rem; justify-content: space-between; }
.foot p { font-size: var(--t-xs); color: var(--mute); }

/* -- catalogue toolbar ------------------------------------- */
.bay-tools { display: flex; align-items: center; gap: 0.85rem; }

.sortwrap { position: relative; display: inline-flex; align-items: center; }
.sortwrap select {
  appearance: none;
  min-height: 40px;
  padding: 0.35rem 2rem 0.35rem 0.9rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--r-pill);
  background: var(--white);
  font-size: var(--t-sm);
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
}
.sortwrap select:hover { border-color: var(--green); }
.sortwrap svg { position: absolute; right: 0.75rem; pointer-events: none; color: var(--mute); }

/* -- quantity + add, inside the variant table -------------- */
.addrow { display: flex; align-items: center; gap: 0.45rem; justify-content: flex-end; }
.addrow .qstep { flex: none; }
.addrow .qstep button { width: 30px; height: 30px; font-size: 14px; }
.addrow .qstep span { min-width: 1.5rem; font-size: var(--t-xs); }
@media (pointer: coarse) { .addrow .qstep button { width: 38px; height: 38px; } }
@media (max-width: 520px) { .addrow { flex-direction: column; align-items: stretch; gap: 0.3rem; } }

/* -- carousel ---------------------------------------------- */
.banner__txt,
.banner__shot { transition: opacity 170ms var(--ease); }
.banner.is-swapping .banner__txt,
.banner.is-swapping .banner__shot { opacity: 0; }

.banner__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.banner__arrow:hover { background: rgba(0, 0, 0, 0.42); }
.banner__arrow--prev { left: 0.6rem; }
.banner__arrow--next { right: 0.6rem; }

/* On narrow screens the arrows would sit on top of the copy. */
@media (max-width: 780px) {
  .banner__arrow { top: auto; bottom: 0.6rem; transform: none; width: 40px; height: 40px; }
  .banner__arrow--prev { left: auto; right: 3.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .banner__txt,
  .banner__shot { transition: none; }
}

/* -- Apple-pass refinements -------------------------------- */
/* Chrome sits on the same material family as the header. */
.catstrip {
  position: relative;
  z-index: calc(var(--z-head) - 1);
  border-bottom-color: var(--rule);
}

/* Press feedback on every control the finger can reach. */
.icobtn,
.panel__x,
.banner__arrow,
.sortwrap select { transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform 110ms var(--ease-press); }
.icobtn:active,
.panel__x:active,
.banner__arrow:active,
.sortwrap select:active { transform: scale(0.94); }
.qstep button:active { transform: scale(0.9); }

/* Panels are large surfaces, so they carry the heaviest shadow. */
.panel { box-shadow: var(--lift-3); }

/* Product shot gets a ground shadow so it sits on the card, not in it. */
.card__media img { filter: drop-shadow(0 6px 10px rgba(12, 16, 12, 0.09)); }
.drawer__media img { filter: drop-shadow(0 10px 18px rgba(12, 16, 12, 0.12)); }

/* Vibrancy: text over the translucent header needs weight, not grey. */
.hdr .brand__t { letter-spacing: -0.03em; }
.hdr .brand__t span { color: var(--ink-2); }

/* Bright top edge — light catching the material. */
.banner { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), var(--lift-2); }

/* -- variant options (aroma / colour) ---------------------- */
.opts { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.opts .opt[aria-checked="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.opts .opt[aria-checked="true"]:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }

/* -- awaiting photography ---------------------------------- */
.ph {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--rule-2);
}
.card__media.is-empty,
.drawer__media.is-empty { background: var(--surface); }
.qrow__img.is-empty .ph svg { width: 22px; height: 22px; }
