/* Mobile-only detail polish. The desktop bottle and the shared site header stay unchanged. */
@media (max-width: 840px) and (pointer: coarse) {
  body:has(.product-detail-page) {
    padding-top: 0;
  }

  body:has(.product-detail-page) .editorial-header {
    box-shadow: 0 6px 24px rgba(32, 20, 22, .12);
    pointer-events: none;
    transform: translate3d(0, -105%, 0);
    transition: transform 280ms cubic-bezier(.22, 1, .36, 1), box-shadow 280ms ease;
  }

  body:has(.product-detail-page) .editorial-header.is-scrolled {
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
  }

  body:has(.product-detail-page) .editorial-header.is-scrolled .editorial-nav {
    min-height: max(3.75rem, calc(3.25rem + env(safe-area-inset-top)));
  }

  .wine-detail-stage {
    min-height: min(80svh, 44rem);
    padding: 0;
  }

  .wine-detail-stage--beer {
    background-color: #f7d991;
    background-image: url("/assets/mobile-beer-detail-backdrop.webp");
    background-position: center bottom;
    background-size: cover;
  }

  /* The supplied backdrop's shelf line sits 241px above its 887px-wide
     bottom edge. Since the mobile cover scales to the stage width, this
     keeps each beer bottle or can standing on that exact line. */
  .wine-detail-stage--beer .wine-detail-bottle-wrap {
    align-items: flex-end;
    bottom: 27.17vw;
    padding: 0 .5rem;
    top: clamp(2.75rem, 8svh, 5rem);
  }

  .wine-detail-stage--beer .wine-detail-bottle-wrap .wine-detail-bottle {
    height: 100%;
    max-height: 100%;
    max-width: calc(100vw - 1rem);
    object-fit: contain;
    object-position: center bottom;
    width: auto;
  }

  .wine-detail-back {
    align-items: center;
    background: rgba(35, 19, 23, .34);
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    font-size: 1.65rem;
    height: 3.1rem;
    justify-content: center;
    left: max(1rem, env(safe-area-inset-left));
    min-height: 0;
    padding: 0 0 .18rem;
    position: absolute;
    text-decoration: none;
    top: calc(max(3.75rem, 3.25rem + env(safe-area-inset-top)) + 1rem);
    width: 3.1rem;
    z-index: 5;
  }

  .wine-detail-back:hover,
  .wine-detail-back:focus-visible {
    background: rgba(35, 19, 23, .68);
    color: #fff;
    outline: 2px solid #fff;
    outline-offset: 3px;
  }

  .wine-detail-back-label,
  .wine-detail-pager {
    display: none;
  }

  .wine-detail-bottle-wrap {
    align-items: center;
    padding: max(3.8rem, calc(env(safe-area-inset-top) + 3rem)) 1rem 4.25rem;
  }

  .wine-detail-bottle-wrap .wine-detail-bottle {
    height: min(64svh, 35rem);
    max-width: 78vw;
  }

  /* Let the blue backdrop reach the top of the mobile product viewport. The
     stage already has its own back control, so the fixed header is redundant. */
  body:has(.wine-detail-stage--white-wine) > .site-header {
    display: none;
  }

  .wine-detail-stage--white-wine .wine-detail-bottle-wrap {
    transform: translateY(-1rem);
  }

  .wine-detail-stage--white-wine .wine-detail-bottle {
    max-width: 90vw;
  }

  .wine-detail-swipe-card {
    background: #f7f1e9;
    border: 1px solid rgba(79, 49, 39, .1);
    border-radius: 1.25rem;
    min-height: 13.25rem;
    padding: 1.35rem;
  }

  .wine-detail-swipe-card--alcohol {
    background: linear-gradient(145deg, #f8eee7, #f4e4e1);
    color: #3b2526;
  }

  .wine-detail-abv-layout {
    align-items: center;
    display: flex;
    gap: .7rem;
    justify-content: space-between;
    min-height: 10.5rem;
  }

  .wine-detail-abv-copy strong {
    display: block;
    font: 400 clamp(4.4rem, 19vw, 6.6rem)/.85 Georgia, 'Times New Roman', serif;
    letter-spacing: -.085em;
  }

  .wine-detail-abv-copy strong small {
    font-size: .44em;
    letter-spacing: -.04em;
    margin-left: .07em;
  }

  .wine-detail-abv-copy p {
    color: #765c58;
    font: 700 .72rem/1.3 Arial, sans-serif;
    letter-spacing: .03em;
    margin-top: .9rem;
  }

  .wine-detail-abv-layout svg {
    color: #7c3445;
    flex: 0 0 5.5rem;
    height: 7rem;
    width: 5.5rem;
  }

  .wine-detail-swipe-card--facts {
    background: #fffdf9;
  }

  .wine-detail-mobile-facts {
    display: grid;
    gap: 0 1.1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: .8rem 0 0;
  }

  .wine-detail-mobile-facts > div {
    border-top: 1px solid rgba(59, 37, 38, .13);
    min-width: 0;
    padding: .8rem 0 .9rem;
  }

  .wine-detail-mobile-facts dt {
    color: #876e67;
    font: 800 .61rem/1.2 Arial, sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
  }

  .wine-detail-mobile-facts dd {
    color: #302726;
    font: 500 .96rem/1.35 Georgia, 'Times New Roman', serif;
    margin: .4rem 0 0;
    overflow-wrap: anywhere;
  }

  /* Leave enough document scroll beyond the map for the fixed purchase bar. */
  body .product-detail-page {
    padding-bottom: calc(8.5rem + env(safe-area-inset-bottom));
  }

  .bottle-origin-region-label {
    border: 1px solid rgba(255, 250, 243, .55);
    border-radius: 999px;
    bottom: 1rem;
    box-shadow: 0 .3rem 1rem rgba(48, 25, 27, .2);
    left: 50%;
    padding: .55rem .95rem;
    transform: translateX(-50%);
    white-space: nowrap;
  }
}

@media (max-width: 360px) and (pointer: coarse) {
  .wine-detail-mobile-facts { gap: 0 .7rem; }
  .wine-detail-abv-layout svg { flex-basis: 4.25rem; width: 4.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  body:has(.product-detail-page) .editorial-header { transition: none; }
}
