/* Sufra — the product page: the photos, then the dish: its name, price, serving size, calories
   and diet, sizes at their own prices, add-ons sent with it, how often, the button with the total
   and when it arrives; then what's in it and reviews. Loaded on product pages (and by the quick
   view). */

.product-section {
  padding-block: 1.25rem clamp(3rem, 6vw, 4.5rem);
}

.product {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 990px) {
  .product {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: clamp(2.5rem, 5vw, 4.5rem);
    align-items: start;
  }

  .product--sticky .product__media {
    position: sticky;
    inset-block-start: calc(var(--header-height) + 1.5rem);
  }
}

/* The photos: one at a time, rounded, with a row of thumbnails under them on large screens. */
.product__media {
  display: grid;
  gap: 0.875rem;
}

.product__stage {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) + 8px);
  background: var(--media);
}

.product__gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.product__gallery::-webkit-scrollbar {
  display: none;
}

.product__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
}

.product__slide img,
.product__placeholder {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.product__badge {
  position: absolute;
  inset-block-start: 1rem;
  inset-inline-start: 1rem;
}

.gallery-status {
  position: absolute;
  inset-block-end: 0.875rem;
  inset-inline: 0;
  display: flex;
  justify-content: center;
}

.gallery-status__count {
  display: none;
}

.gallery-status__dots {
  display: flex;
  gap: 0.375rem;
  direction: ltr;
}

.gallery-status__dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 999px;
  background: rgb(42 27 19 / 0.25);
  transition: width 200ms var(--ease), background-color 200ms ease-out;
}

.gallery-status__dot.is-current {
  width: 1.25rem;
  background: var(--color-text);
}

.product__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 990px) {
  .gallery-status {
    display: none;
  }
}

@media (max-width: 989px) {
  .product__thumbs {
    display: none;
  }

  .product__stage {
    margin-inline: calc(-1 * var(--gutter));
    border-radius: 0;
  }
}

.product__thumb {
  display: block;
  width: 6rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 0.7);
  background: var(--media);
  transition: border-color 140ms ease-out;
}

.product__thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.product__thumb:hover {
  border-color: var(--line-strong);
}

.product__thumb.is-current {
  border: 2px solid var(--fg);
}

/* The buy column. */
.product__info {
  display: grid;
  align-content: start;
  gap: 1.25rem;
  min-width: 0;
}

.product__heading {
  display: grid;
  justify-items: start;
  gap: 0.75rem;
}

.product__title {
  margin: 0;
  font-size: clamp(2rem, 1.5rem + 2vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.product__intro {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--text-lead);
}

.product__facts .food-facts {
  font-size: var(--text-small);
}

.product__rating {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-block-start: -0.75rem;
  font-size: var(--text-small);
  text-decoration: none;
}

.product__rating .rating {
  font-size: var(--text-small);
}

.product__rating-link {
  color: var(--fg-muted);
}

.product__rating:hover .product__rating-link {
  text-decoration: underline;
}

.product__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
}

.product__tax-note {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--text-caption);
}

/* Choices: colours by photo, everything else as tiles with their own price. */
.variant-picker {
  display: grid;
  gap: 1.5rem;
}

.variant-picker__option legend,
.add-ons__legend {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
  margin-block-end: 0.75rem;
  color: var(--fg);
  font-size: var(--text-small);
  font-weight: 500;
}

.variant-picker__value {
  color: var(--fg-muted);
  font-weight: 400;
}

.variant-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
  gap: 0.625rem;
}

.variant-value {
  position: relative;
  display: grid;
  align-content: center;
  gap: 0.125rem;
  min-height: 3.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  cursor: pointer;
  transition: border-color 140ms ease-out, background-color 140ms ease-out;
}

.variant-value input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.variant-value:hover {
  border-color: var(--fg);
}

.variant-value:has(input:checked) {
  border-color: var(--fg);
  background: var(--bg-raised);
  box-shadow: inset 0 0 0 1px var(--fg);
}

.variant-value:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.variant-value__name {
  font-weight: 500;
}

.variant-value__price {
  color: var(--fg-muted);
  font-size: var(--text-small);
}

.variant-value:has(input:checked) .variant-value__price {
  color: var(--fg);
}

.variant-value--unavailable {
  border-style: dashed;
}

.variant-value--unavailable .variant-value__name {
  color: var(--fg-subtle);
  text-decoration: line-through;
}

/* Add-ons: a tick, the photo, the name and what it adds; sent with the dish (`with`). */
.add-ons {
  display: grid;
}

.add-on {
  display: grid;
  grid-template-columns: auto 3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.875rem;
  padding-block: 0.625rem;
  border-block-end: 1px solid var(--line);
  cursor: pointer;
}

.add-on:has(img) {
  grid-template-columns: auto 3rem minmax(0, 1fr) auto;
}

.add-on:not(:has(img)) {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.add-on__check {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--fg);
}

.add-on img {
  width: 3rem;
  height: 3rem;
  border-radius: calc(var(--radius) * 0.5);
  object-fit: cover;
}

.add-on__text {
  display: grid;
  min-width: 0;
}

.add-on__title {
  font-size: var(--text-small);
  font-weight: 500;
}

.add-on__detail {
  overflow: hidden;
  color: var(--fg-muted);
  font-size: var(--text-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-on__price {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  font-size: var(--text-small);
  font-weight: 500;
  direction: ltr;
}

.add-ons__note {
  margin: 0.625rem 0 0;
  color: var(--fg-muted);
  font-size: var(--text-caption);
}

/* Buying. */
.product__form {
  display: grid;
  gap: 0.875rem;
}

.buy-row {
  display: flex;
  gap: 0.75rem;
}

.buy-row .button {
  padding-inline: 1.25rem;
  white-space: nowrap;
}

@media (max-width: 389px) {
  .buy-row .button__total {
    display: none;
  }
}

.buy-row .button .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.purchase-options {
  display: grid;
  gap: 0.5rem;
}

.purchase-options legend {
  margin-block-end: 0.5rem;
  color: var(--fg-muted);
  font-size: var(--text-small);
  font-weight: 500;
}

.purchase-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 0.875rem 1.125rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  cursor: pointer;
}

.purchase-option:has(input:checked) {
  border-color: var(--fg);
  background: var(--bg-raised);
  box-shadow: inset 0 0 0 1px var(--fg);
}

.purchase-option strong {
  color: var(--fresh);
  font-weight: 500;
}

/* The total beside the label: what the add costs, add-ons and quantity included. */
.button__total {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.button__total::before {
  content: '·';
  opacity: 0.7;
}

.purchase-options__note {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--text-caption);
}

.info-lines {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-lines .info-line {
  padding-block: 0.875rem;
  border-block-end: 1px solid var(--line);
}

.info-line {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: var(--text-small);
}

.info-line > .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.info-line > span {
  display: grid;
  gap: 0.125rem;
}

.info-line strong {
  font-weight: 500;
}

.info-line .subtle {
  font-size: var(--text-caption);
}

.product__whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-small);
  font-weight: 500;
  text-decoration: none;
}

.product__whatsapp:hover {
  text-decoration: underline;
}

/* The bar that keeps Add to cart in reach once the buttons scroll away. */
.sticky-buy {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 25;
  border-block-start: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 -8px 24px -12px rgb(42 27 19 / 0.18);
  translate: 0 110%;
  transition: translate 260ms var(--ease);
}

.sticky-buy.is-visible {
  translate: 0 0;
}

.sticky-buy__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
}

.sticky-buy__summary {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
}

.sticky-buy__summary img {
  border-radius: var(--radius-media);
  background: var(--media);
}

.sticky-buy__title {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticky-buy__price {
  font-weight: 600;
}

@media (max-width: 749px) {
  .sticky-buy__summary img,
  .sticky-buy__title {
    display: none;
  }

  .sticky-buy__inner {
    padding-block: 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
  }

  .sticky-buy .button {
    flex: 1;
  }

  .has-compare-bar .compare-bar {
    inset-block-end: 5.5rem;
  }
}

/* ---------- What's in it: the description after its opening paragraph ---------- */

/* Each heading starts a group (what's in it, allergens, nutrition); two groups to a row on large
   screens, a table reads as a nutrition table. */
.specs {
  columns: 2 22rem;
  column-gap: clamp(2.5rem, 7vw, 6rem);
}

.specs > * {
  break-inside: avoid;
}

.specs h2,
.specs h3,
.specs h4 {
  margin: 2.25rem 0 0.75rem;
  font-size: var(--text-h2);
  break-after: avoid;
}

.specs > :first-child {
  margin-block-start: 0;
}

.specs p {
  color: var(--fg-muted);
  font-size: var(--text-lead);
}

.specs table {
  width: 100%;
  margin-block-end: 1.5rem;
  border-collapse: collapse;
}

.specs th,
.specs td {
  padding: 0.75rem 0;
  border-block-end: 1px solid var(--line);
  font-size: var(--text-small);
  font-weight: 500;
  text-align: end;
  vertical-align: top;
}

.specs tr > :first-child {
  padding-inline-end: 1rem;
  font-weight: 400;
  text-align: start;
}

.specs ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
}

.specs li {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-raised);
  font-size: var(--text-small);
}

/* ---------- Reviews ---------- */

.product-reviews {
  display: grid;
  gap: 2rem;
}

@media (min-width: 990px) {
  .product-reviews {
    grid-template-columns: 20rem minmax(0, 1fr);
    gap: 5rem;
    align-items: start;
  }
}

.product-reviews__summary {
  display: grid;
  justify-items: start;
  gap: 0.5rem;
}

.product-reviews__summary h2 {
  margin: 0 0 0.5rem;
}

.product-reviews__average {
  margin: 0;
  font-size: 3.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}

.product-reviews__summary .rating__stars {
  width: 6rem;
  height: 1.125rem;
  -webkit-mask-size: 1.2rem 1.125rem;
  mask-size: 1.2rem 1.125rem;
}

.product-reviews__summary p {
  margin: 0;
}

.product-reviews__none {
  font-weight: 500;
}

.product-reviews__note {
  font-size: var(--text-small);
}

.review {
  display: grid;
  gap: 0.5rem;
  padding-block: 1.5rem;
  border-block-end: 1px solid var(--line);
}

.review:first-child {
  padding-block-start: 0;
}

.review__title {
  margin: 0.25rem 0 0;
  font-size: var(--text-body);
  font-weight: 600;
}

.review__body {
  margin: 0;
}

.review__photos {
  display: flex;
  gap: 0.5rem;
}

.review__photos img {
  border-radius: var(--radius-media);
  object-fit: cover;
}

.review__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--text-small);
}

.review__author {
  color: var(--fg);
  font-weight: 500;
}

.review__verified {
  color: var(--success);
}

.review__reply {
  margin-block-start: 0.5rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-control);
  background: var(--bg-raised);
  font-size: var(--text-small);
}

.review__reply p {
  margin: 0;
}

.review__reply-label {
  margin-block-end: 0.25rem !important;
  font-weight: 600;
}

/* Quantity limits under the price (ADR-0076). */
.product__quantity-rule {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--text-small);
}

/* The heart by the title, pre-orders, bundles, priced answers, back-in-stock requests. */
.product__title-row{display:flex;justify-content:space-between;gap:.75rem}
.wishlist-toggle--page .wishlist-toggle__button{border:1px solid var(--line)}
.preorder-note,.stock-alert__title{display:flex;align-items:center;gap:.5rem;margin:0 0 .875rem;font-size:var(--text-small)}
.stock-alert__title{margin:0;font-weight:600}
.preorder-note[hidden],.stock-alert[hidden],.stock-alert__done,.stock-alert__error,.stock-alert.is-done .stock-alert__row{display:none}
.preorder-note svg,.stock-alert__title svg{width:1.125rem;height:1.125rem}
.preorder-note__detail,.bundle-item__variant,.bundle-item__quantity,.field__price{color:var(--fg-muted)}
.bundle-items{margin:0 0 1.25rem;padding-block:1rem;border-block:1px solid var(--line);font-size:var(--text-small)}
.bundle-items__title{margin:0;font-weight:600}
.bundle-items__list{display:grid;gap:.5rem;margin:.75rem 0 0;padding:0;list-style:none}
.bundle-item{display:flex;align-items:center;gap:.75rem}
.bundle-item__image{width:3rem;height:3rem;border-radius:var(--radius);object-fit:cover}
.bundle-item a{color:inherit}
.bundle-items__savings{margin:.75rem 0 0;color:var(--sale)}
.stock-alert{display:grid;gap:.75rem;margin-block-start:1rem;padding:1rem;border:1px solid var(--line);border-radius:var(--radius)}
.stock-alert__row{display:flex;flex-wrap:wrap;gap:.5rem}
.stock-alert__row input{flex:1 1 12rem}
.stock-alert__error{color:var(--sale)}
.stock-alert.is-done .stock-alert__done,.stock-alert.is-error .stock-alert__error,.stock-alert__done:target,.stock-alert__error:target{display:block;margin:0;font-size:var(--text-small)}

.product__earns {
  margin-block: 0.5rem 0;
  color: var(--fg-muted);
  font-size: var(--text-small);
}

.price-breaks {
  width: 100%;
  margin-block: 0.75rem;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.price-breaks caption {
  padding-block-end: 0.375rem;
  font-weight: 600;
  text-align: start;
}
.price-breaks th,
.price-breaks td {
  padding-block: 0.375rem;
  border-block-start: 1px solid color-mix(in srgb, currentColor 15%, transparent);
  font-weight: 400;
  text-align: start;
}
.price-breaks td:last-child {
  text-align: end;
}
