/* Anahata v2 — PDP page frame. Figma 1473:915 "Product Page (New)".
   Vertical rhythm is the frame's own auto-layout: hero -> body 15px (1516:4804),
   title block -> intro 25px (1516:4781), title -> price 5px (1502:3580), every
   block after that 10px (1516:4782). */

body.has-fixed-action-bar {
  padding-bottom: calc(102px + var(--a-space-5) + env(safe-area-inset-bottom, 0px));
}

.pdp {
  position: relative;
}

/* ---- topbar (1516:4691): three 48 x 47 grey pills over the hero ---- */
.pdp__topbar {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--a-gutter);
}

.pdp__topbar-end {
  display: flex;
  align-items: center;
  gap: var(--a-space-3);
}

.pdp__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 47px;
  padding: 3px;
  border: 0;
  border-radius: var(--a-radius-pill-btn);
  background: var(--a-fill-secondary);
  color: var(--a-ink);
  text-decoration: none;
  cursor: pointer;
}

.pdp__icon-btn:focus-visible {
  outline: 2px solid var(--a-ink-pure);
  outline-offset: 2px;
}

/* basket + red count: 13px dot at (15.5, 18) inside the 31px icon */
.pdp__bag {
  position: relative;
  display: flex;
}

.pdp__cart-count {
  position: absolute;
  left: 15.5px;
  top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: var(--a-radius-round);
  background: var(--a-danger);
  color: var(--a-surface);
  font-family: var(--a-font-body);
  font-weight: 700;
  font-size: 6.5px;
  line-height: 1;
}

.pdp__cart-count[hidden] {
  display: none;
}

/* ---- body ---- */
.pdp__body {
  display: flex;
  flex-direction: column;
  gap: var(--a-space-3);
  padding: var(--a-space-4) var(--a-gutter) var(--a-space-3);
}

.pdp__intro {
  display: flex;
  flex-direction: column;
  gap: var(--a-space-6);
}

.pdp__heading {
  display: flex;
  flex-direction: column;
  gap: var(--a-space-2);
}

.pdp__title {
  margin: 0;
  padding: var(--a-space-3) 0;
  font-family: var(--a-font-display);
  font-weight: 400;
  font-size: var(--a-fs-title);
  line-height: var(--a-lh-title);
  color: var(--a-ink-pure);
  letter-spacing: 0;
}

.pdp__price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--a-space-3);
}

.pdp__price {
  font-family: var(--a-font-body);
  font-weight: 700;
  font-size: var(--a-fs-price);
  line-height: normal;
  color: var(--a-ink-pure);
  white-space: nowrap;
}

.pdp__lede {
  margin: 0;
  font-family: var(--a-font-body);
  font-size: var(--a-fs-body);
  line-height: var(--a-lh-body-relaxed);
  color: var(--a-text-muted);
}

/* Weight | Material pair (1502:3345) */
.pdp__pair {
  display: flex;
  gap: var(--a-space-3);
}

/* The info blocks under the intro — options, weight / material, the three
   highlights, delivery — are flat, split by horizontal hairlines only
   (owner 2026-09-28: lighter than the outlined cards they replace). */
.pdp__body > .option-chips,
.pdp__body > .pdp__pair,
.pdp__body > .highlight-strip,
.pdp__body > .pdp-delivery {
  padding-top: var(--a-space-3);
  border-top: 1px solid var(--a-rule-warm);
}

.pdp__body > .pdp-delivery {
  padding-bottom: var(--a-space-3);
  border-bottom: 1px solid var(--a-rule-warm);
}

.pdp__notice {
  margin: 0;
  font-family: var(--a-font-body);
  font-size: var(--a-fs-label);
  color: var(--a-text-muted);
}

.pdp__notice:empty {
  display: none;
}

/* ---- fixed action bar (1516:4617) ---- */
.pdp__action-bar-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Wider screens: there is no desktop product design yet, so the phone layout
   is kept as one centred column — a full-bleed 1440px hero pushed every bit
   of product information below the fold. The action bar matches it. */
@media screen and (min-width: 750px) {
  .pdp,
  .pdp__action-bar-wrap {
    max-width: 640px;
    margin-inline: auto;
  }
}

/* ---- Desktop (990px+): two columns (owner, 2026-09-25) ----------------------
   Left: the gallery + thumbnails, sticky. Right: the product details, then the
   "In the same set" rail — only this column moves while the gallery stays.
   From Customer Reviews on, sections run full width and everything scrolls.

   The gallery/details live in main-product and the rail is its own section, so
   they are brought into one grid on <main>: the main-product section wrapper
   and .pdp become `display: contents`, their children become grid items. Out-
   of-flow children are unaffected (the fixed action bar, the visually-hidden
   form, a closed <dialog>). Any other section spans both columns. */
@media screen and (min-width: 990px) {
  body.template-product #MainContent {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--a-space-6);
    align-items: start;
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--a-gutter);
  }

  body.template-product #MainContent > .shopify-section {
    grid-column: 1 / -1;
    min-width: 0;
  }

  body.template-product #MainContent > .shopify-section:has(.pdp),
  body.template-product .pdp {
    display: contents;
  }

  /* Left column, rows 1–2 (details + same-set rail). The grid items stretch
     the full height of those rows and their *contents* are sticky: a sticky
     box is held inside its parent, so pinning an inner box lets it go when
     the rail ends and the reviews start. (Pinning the grid item itself sticks
     to <main>, and the gallery rode over the reviews.) */
  body.template-product .pdp-gallery,
  body.template-product .pdp__topbar {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: stretch;
  }

  /* the photo's bottom lines up with the same-set cards' bottom: the rail's
     section padding is moved below it (next rule) and the gallery ends by the
     track's own shadow room (--a-space-2, component-ui-product-rail.css) */
  body.template-product .pdp-gallery {
    padding-top: var(--a-space-5);
    padding-bottom: var(--a-space-2);
  }

  body.template-product #MainContent > .shopify-section:has(.product-rail) .product-rail {
    padding-bottom: 0;
  }

  body.template-product #MainContent > .shopify-section:has(.pdp-reviews) {
    margin-top: var(--a-space-6);
  }

  /* photo + thumbnail strip stick together */
  body.template-product .pdp-gallery__stage {
    position: sticky;
    top: var(--a-space-5);
  }

  body.template-product .pdp-gallery__hero {
    border-radius: var(--a-radius);
  }

  /* back / share / cart pills: pinned on the photo; the stretched bar lets
     clicks through to the gallery everywhere but the pills */
  body.template-product .pdp__topbar {
    position: relative;
    top: auto;
    align-items: flex-start;
    padding-top: calc(var(--a-space-5) + 8px);
    /* release the pills together with the photo: reserve the hero's height
       (402:401 of the column width — % padding is width-based) under them */
    padding-bottom: calc(100% * 401 / 402 - 47px - 8px);
    z-index: 11;
    pointer-events: none;
  }

  body.template-product .pdp__topbar > * {
    position: sticky;
    top: calc(var(--a-space-5) + 8px);
    pointer-events: auto;
  }

  body.template-product .pdp__body {
    grid-column: 2;
    grid-row: 1;
    padding-top: var(--a-space-5);
  }

  body.template-product #MainContent > .shopify-section:has(.product-rail) {
    grid-column: 2;
    grid-row: 2;
  }

  /* v1's running line and product grid run edge to edge, out of the 1200px
     frame (applied unconditionally within this block, per the playbook's
     full-bleed lesson: no padded ancestor assumptions beyond <main>) */
  body.template-product #MainContent > .shopify-section:has(.marquee, .cell-grid) {
    margin-inline: calc(50% - 50vw);
  }

  /* the fixed bar spans the same 1200px frame instead of the phone column */
  body.template-product .pdp__action-bar-wrap {
    max-width: 1200px;
  }
}

/* phones: the product page ends at the buy bar, as designed — no footer.
   Desktop keeps the site footer (owner, 2026-09-29; layout/theme.liquid) */
@media screen and (max-width: 989px) {
  body.template-product .shopify-section-group-footer-group {
    display: none;
  }
}
