/* The catalog shares a card grammar across categories. Only the photographed tea
   cartons need correction for the white canvas and reflection in the source. */
.products-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.7rem clamp(1.3rem, 2.6vw, 2.5rem);
}

.product-card,
.product-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-body { flex: 1; }

.product-media {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin: 0 0 0.95rem;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--oat);
  box-shadow: 0 3px 7px -5px rgb(50 39 19 / 24%);
  cursor: pointer;
}

.product-media img {
  display: block;
  width: 87%;
  height: 87%;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: translate 180ms ease-out;
}

.product-media:is(
  [data-open-product="501699"], [data-open-product="501698"],
  [data-open-product="501732"], [data-open-product="501733"],
  [data-open-product="500581"], [data-open-product="500582"],
  [data-open-product="500583"], [data-open-product="500584"],
  [data-open-product="500585"], [data-open-product="500586"],
  [data-open-product="500587"], [data-open-product="500588"],
  [data-open-product="500589"], [data-open-product="501501"],
  [data-open-product="501591"]
) img {
  /* The bottom of the printed carton sits 82% down the stage. Fade only
     the reflection below it, keeping the printed edges and original files intact. */
  position: absolute;
  top: 82%;
  left: 50%;
  width: var(--print-size, 82%);
  height: auto;
  aspect-ratio: 1;
  transform: translate(-50%, calc(0% - var(--print-foot, 76.2%)));
  mask-image: linear-gradient(to bottom,
    black calc(var(--print-foot, 76.2%) + 0.3%),
    transparent calc(var(--print-foot, 76.2%) + 7%));
}

.product-media:is([data-open-product="501698"], [data-open-product="501699"]) {
  --print-size: 63%;
  --print-foot: 91.5%;
}

.product-media[data-open-product="501733"] {
  --print-size: 92%;
  --print-foot: 67.4%;
}

.product-media[data-open-product="501501"] { --print-foot: 73.5%; }
.product-media[data-open-product="501591"] { --print-foot: 79.1%; }

.product-title {
  order: -1;
  margin: 0;
  color: var(--forest);
  font: 600 clamp(1.6rem, 1.12rem + 0.95vw, 1.98rem) / 1.04 var(--serif);
  text-wrap: balance;
}

.product-title-btn {
  display: block;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  text-wrap: inherit;
  cursor: pointer;
}

.product-meta-row,
.modal-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.9rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.4;
}

.product-meta-row { margin-top: 0.45rem; }

.product-price,
.modal-price {
  color: var(--accent);
  font: 600 1.28rem / 1.3 var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.product-price { order: -1; }

.product-excerpt {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  margin: 0.62rem 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.product-footer {
  margin-top: auto;
  padding-top: 1rem;
}

.product-actions,
.order-chooser,
.modal-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.3rem;
}

.btn-card-order,
.btn-card-more,
.btn-messenger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.55rem 1.32rem;
  border: 0;
  border-radius: var(--control-radius, 4px);
  font: 600 1rem / 1.35 var(--sans);
  text-align: center;
  cursor: pointer;
  transition: color 160ms ease-out, background-color 160ms ease-out;
}

.btn-card-order,
.btn-messenger-primary {
  background: var(--accent);
  color: var(--white);
  text-decoration: none;
}

.btn-card-more,
.modal-original-link {
  background: transparent;
  color: var(--forest);
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.btn-card-more {
  padding-inline: 0.1rem;
  font-weight: 500;
}

.order-chooser {
  gap: 0.45rem 0.6rem;
  margin-top: 0.65rem;
}

.order-chooser[hidden] { display: none; }
.order-chooser .btn-messenger { padding-inline: 0.9rem; }

.btn-messenger-secondary {
  background: var(--oat);
  color: var(--forest);
  text-decoration: none;
}

.btn-messenger svg,
.modal-original-link svg { flex: none; }

.product-modal {
  box-sizing: border-box;
  width: min(64rem, calc(100% - 3rem));
  max-width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
}

.product-modal::backdrop { background: rgb(23 41 31 / 66%); }

.modal-shell {
  box-sizing: border-box;
  max-height: 90vh;
  max-height: 90dvh;
  padding: 0 clamp(1.15rem, 3.3vw, 2.8rem) 2.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding: 4.4rem 0 0.7rem;
}

.modal-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding-block: 0.6rem;
  background: var(--white);
}

.modal-close,
.modal-thumb-btn {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: var(--oat);
  color: var(--forest);
  cursor: pointer;
}

.modal-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 1.2rem;
}

.modal-gallery {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  min-width: 0;
}

.modal-main-image {
  display: grid;
  place-items: center;
  isolation: isolate;
  height: min(38vh, 24rem);
  padding: 0.75rem;
  border-radius: 3px;
  background: var(--oat);
}

.modal-main-image img,
.modal-thumb-btn img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.modal-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.2rem;
}

.modal-thumb-btn {
  isolation: isolate;
  width: 3.65rem;
  height: 3.65rem;
  border-radius: 2px;
}

.modal-thumb-btn[aria-pressed="true"] {
  outline: 1px solid var(--forest);
  outline-offset: 1px;
}

.modal-details {
  display: grid;
  gap: 0.8rem;
  min-width: 0;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.9rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.4;
}

.modal-title {
  margin: 0;
  color: var(--forest);
  font: 600 clamp(2.05rem, 3.8vw, 3rem) / 1.03 var(--serif);
  text-wrap: balance;
}

.modal-price { font-size: 1.52rem; }

.modal-cta { gap: 0.55rem; }

.modal-section {
  min-width: 0;
  margin-top: 1rem;
}

.modal-section h4 {
  margin: 0 0 0.55rem;
  color: var(--forest);
  font: 600 1.55rem / 1.14 var(--serif);
}

.modal-prose,
.modal-usage {
  max-width: 67ch;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

.modal-prose p { margin: 0; }

.modal-prose ul {
  margin: 0;
  padding-inline-start: 1.18rem;
}

.modal-prose :is(p, ul) + :is(p, ul) { margin-top: 1rem; }
.modal-prose li + li { margin-top: 0.42rem; }
.modal-prose li::marker { color: var(--forest); }
.modal-usage { white-space: pre-line; }

.modal-original-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
}

:is(.product-card, .product-modal) :is(button, a):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

:is(.product-title-btn, .btn-card-more, .modal-original-link):active { color: var(--accent); }
:is(.btn-card-order, .btn-messenger-primary):active { background: var(--accent-hover); }
:is(.btn-messenger-secondary, .modal-close, .modal-thumb-btn):active { background: var(--line); }
.product-media:active img { translate: 0 1px; }
:is(.product-card, .product-modal) button:disabled { opacity: 0.55; cursor: default; }

@media (hover: hover) {
  .product-media:hover img { translate: 0 -3px; }
  :is(.product-title-btn, .btn-card-more, .modal-original-link):hover { color: var(--accent); }
  .btn-card-more:hover,
  .modal-original-link:hover { text-decoration-thickness: 2px; }
  :is(.btn-card-order, .btn-messenger-primary):hover { background: var(--accent-hover); }
  :is(.btn-messenger-secondary, .modal-close, .modal-thumb-btn):hover { background: var(--line); }
}

@media (min-width: 40rem) {
  .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Equal text and action baselines within each row, including after filtering. */
  @supports (grid-template-rows: subgrid) {
    .products-grid { row-gap: 0; }
    .product-card {
      display: grid;
      grid-row: span 5;
      grid-template-rows: subgrid;
      padding-bottom: clamp(2.7rem, 4.5vw, 4.4rem);
    }
    .product-body {
      display: grid;
      grid-row: span 4;
      grid-template-rows: subgrid;
    }
    .product-title { grid-row: 1; }
    .product-meta-row { grid-row: 2; }
    .product-excerpt { align-self: start; }
    .product-footer { align-self: start; margin-top: 0; }
  }
}

@media (min-width: 54rem) {
  .modal-body {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: clamp(1.8rem, 3vw, 2.8rem);
  }
  .modal-gallery { position: sticky; top: 4rem; }
  .modal-main-image { height: auto; max-height: 56vh; aspect-ratio: 1; }
}

@media (min-width: 63rem) {
  .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 39.99rem) {
  .product-modal,
  .modal-shell {
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }
  .modal-cta { align-items: stretch; }
  .modal-cta .btn-messenger { flex: 1 1 12rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .product-modal[open] { animation: product-dialog-open 190ms ease-out; }
  @keyframes product-dialog-open {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-media img, .btn-card-order, .btn-card-more, .btn-messenger { transition: none; }
  .product-media:is(:hover, :active) img { translate: none; }
}
