/* =====================================================================
   Reels ("Straight from the grill") + social links.
   Cards and viewer: reels.js. Items: reels-data.js.
   Resting CSS is the open fan; reels.js animates towards it on scroll.
   ===================================================================== */

/* ---------- Social links (reels header, navigation, footer) ---------- */
.shop-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.shop-socials a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px 0 14px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  color: var(--shop-blue);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: background-color .2s ease, color .2s ease, transform .2s var(--ease-out);
}
.shop-social-icon {
  flex: none;
  width: 20px;
  height: 20px;
}
.shop-socials--on-blue a {
  color: var(--paper);
  border-color: var(--on-blue-line);
}
@media (hover: hover) {
  .shop-socials a:hover {
    background: var(--shop-blue);
    color: var(--paper);
    transform: translateY(-2px);
  }
  .shop-socials--on-blue a:hover {
    background: var(--paper);
    color: var(--shop-blue);
    border-color: var(--paper);
  }
}
.shop-socials a:active {
  transform: scale(.97);
}
.shop-nav-foot .shop-socials {
  gap: 8px;
}
.shop-footer-follow {
  display: grid;
  gap: 14px;
  margin-top: 32px;
}

/* ---------- Section ---------- */
.shop-section.shop-reels {
  background: var(--paper-2);
  overflow: hidden;
}
.shop-reels .section-heading {
  align-items: flex-end;
}
.reels-follow {
  display: grid;
  justify-items: start;
  gap: 18px;
}

/* ---------- Stage: three 9:16 cards fanned from the bottom centre ---------- */
.reels-stage {
  perspective: 1400px;
  padding: 24px 0 clamp(64px, 7vw, 110px);
}
.reels-track {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(20px, 3vw, 52px);
  margin: 0;
  padding: 0;
  list-style: none;
  transform-origin: 50% 60%;
}
.reel {
  flex: 0 0 clamp(220px, 23vw, 360px);
  transform-origin: 50% 100%;
}
/* reels.js writes a transform on .reel every tick while the stage is in view (fan-in, then pointer
   tilt); a standing will-change isn't needed once it settles back out of view, so it's scoped to
   the window that's actually animating instead of being permanent. */
.reels-stage.is-in .reel {
  will-change: transform;
}
/* Resting fan (also the reduced-motion and pre-script layout) */
@media (min-width: 768px) {
  .reel:nth-child(1):not(:last-child) {
    transform: translate3d(0, 34px, 0) rotate(-5deg) scale(.94);
  }
  .reel:nth-child(2) {
    z-index: var(--z-lift);
    transform: scale(1.02);
  }
  .reel:nth-child(3) {
    transform: translate3d(0, 34px, 0) rotate(5deg) scale(.94);
  }
}
.reel.is-away {
  opacity: 0;
}

.reel-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  margin: 0;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  border: 0;
  border-radius: var(--photo-radius);
  background: var(--shop-ink);
  color: var(--paper);
  text-align: left;
  box-shadow: var(--shadow-3), var(--photo-edge);
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow .4s var(--ease-out);
}
@media (scripting: enabled) {
  .reel-card {
    opacity: 0;
    translate: 0 48px;
    transition: opacity .7s ease, translate 1s var(--ease-out), box-shadow .4s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 90ms);
  }
  .reels-stage.is-in .reel-card {
    opacity: 1;
    translate: none;
  }
}
.reel-media,
.reel-el {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.reel-el {
  object-fit: cover;
  transform: scale(1.02);
  transition: transform .8s var(--ease-out);
}
/* Photos (and the placeholders) get a slow push-in while they "play". */
img.reel-el {
  animation: reel-push 14s ease-in-out infinite alternate paused;
}
.reel.is-playing img.reel-el {
  animation-play-state: running;
}
@keyframes reel-push {
  from { transform: scale(1.02); }
  to { transform: scale(1.16) translate3d(0, -2%, 0); }
}
.reel-shade {
  position: absolute;
  inset: 0;
  z-index: var(--z-raised);
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(16, 26, 67, .38), rgba(16, 26, 67, 0) 22%),
    linear-gradient(0deg, rgba(16, 26, 67, .78), rgba(16, 26, 67, 0) 44%);
}
.reel-index {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: var(--z-lift);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  opacity: .85;
}
.reel-caption {
  position: absolute;
  left: 18px;
  right: 76px;
  bottom: 20px;
  z-index: var(--z-lift);
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-family: var(--veneer);
  font-size: clamp(24px, 2vw, 32px);
  line-height: .98;
  text-wrap: balance;
}
.reel-play {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: var(--z-lift);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--shop-blue);
  box-shadow: var(--shadow-2);
  transition: transform .45s var(--ease-spring), background-color .2s ease, color .2s ease;
}
.reel-play svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
}
@media (hover: hover) {
  .reel-card:hover {
    box-shadow: 18px 34px 60px -22px rgba(16, 26, 67, .5), var(--photo-edge);
  }
  .reel-card:hover .reel-el {
    transform: scale(1.06);
  }
  .reel-card:hover .reel-play {
    transform: scale(1.12);
    background: var(--shop-blue);
    color: var(--paper);
  }
}
.reel-card:active .reel-play {
  transform: scale(.94);
}
.reels-dots {
  display: none;
}

/* ---------- Viewer ---------- */
html.reel-viewer-open {
  overflow: hidden;
}
.reel-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--paper);
  overflow: hidden;
}
.reel-viewer[open] {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.reel-viewer::backdrop {
  background: transparent;
}
.reel-viewer-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--shop-ink);
}
.reel-viewer-backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .5;
  filter: blur(44px) saturate(1.25);
  transform: scale(1.25);
}
.reel-viewer-backdrop img:not([src]) {
  display: none;
}
.reel-viewer-frame {
  position: relative;
  grid-column: 2;
  width: min(100vw, calc(94dvh * 9 / 16));
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: var(--photo-radius);
  background: #000;
  box-shadow: 0 50px 120px -30px rgba(0, 0, 0, .65);
  touch-action: none;
  cursor: pointer;
  transform-origin: 50% 50%;
}
.reel-viewer-media,
.reel-viewer-media > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.reel-viewer-media > * {
  object-fit: cover;
}
.reel-viewer.is-video .reel-viewer-media img,
.reel-viewer:not(.is-video) .reel-viewer-media video {
  display: none;
}
.reel-viewer:not(.is-video) .reel-viewer-media img {
  animation: reel-push 9s ease-out forwards;
}
.reel-viewer.is-paused .reel-viewer-media img {
  animation-play-state: paused;
}
.reel-viewer-chrome {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, 0) 20%),
    linear-gradient(0deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0) 32%);
}
.reel-viewer-chrome :is(a, button) {
  pointer-events: auto;
}
.reel-viewer-bars {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
}
.reel-viewer-bars span {
  flex: 1;
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, .32);
}
.reel-viewer-bars i {
  display: block;
  height: 100%;
  background: var(--paper);
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
}
.reel-viewer-top {
  position: absolute;
  top: 24px;
  left: 12px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.reel-viewer-handle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-right: auto;
  padding: 0 6px;
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
}
.reel-viewer-handle svg {
  width: 22px;
  height: 22px;
}
.reel-viewer-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  transition: background-color .2s ease, transform .15s var(--ease-out);
}
.reel-viewer-icon[hidden] {
  display: none;
}
.reel-viewer-icon svg {
  width: 22px;
  height: 22px;
}
.reel-viewer-icon:active {
  transform: scale(.9);
}
.reel-viewer-foot {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 22px;
  display: grid;
  justify-items: start;
  gap: 10px;
}
.reel-viewer-caption {
  max-width: 22ch;
  font-family: var(--veneer);
  font-size: clamp(28px, 3.2vh, 40px);
  line-height: .98;
  text-wrap: balance;
}
.reel-viewer-post {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--shop-blue);
  font-size: 13px;
  font-weight: 600;
}
.reel-viewer-post[hidden] {
  display: none;
}
.reel-viewer-post svg {
  width: 16px;
  height: 16px;
}
.reel-viewer-paused {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(16, 26, 67, .55);
  color: var(--paper);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.8);
  transition: opacity .2s ease, transform .3s var(--ease-spring);
}
.reel-viewer-paused svg {
  width: 30px;
  height: 30px;
  margin-left: 4px;
}
.reel-viewer.is-paused .reel-viewer-paused {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.reel-viewer-nav {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 clamp(16px, 3vw, 40px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--shop-blue);
  box-shadow: var(--shadow-on-blue);
  transition: transform .2s var(--ease-out);
}
.reel-viewer-nav--prev {
  grid-column: 1;
  justify-self: end;
}
.reel-viewer-nav--next {
  grid-column: 3;
  justify-self: start;
}
.reel-viewer-nav svg {
  width: 24px;
  height: 24px;
  transform: rotate(45deg);
}
.reel-viewer-nav--prev svg {
  transform: rotate(-135deg);
}
.reel-viewer {
  --focus-ring: var(--paper); /* always a dark backdrop */
}
.reel-viewer :is(a, button):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}
@media (hover: hover) {
  .reel-viewer-icon:hover {
    background: rgba(255, 255, 255, .16);
  }
  .reel-viewer-nav:hover {
    transform: scale(1.08);
  }
}
.reel-viewer-nav:active {
  transform: scale(.94);
}

/* ---------- Tablet ---------- */
@media (min-width: 768px) and (max-width: 1024px) {
  .shop-reels .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }
  .reel {
    flex-basis: 27vw;
  }
  .reel-caption {
    font-size: 22px;
    right: 64px;
  }
}

/* ---------- Mobile: swipeable coverflow, centred card plays ---------- */
@media (max-width: 767px) {
  .shop-reels .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }
  .reels-stage {
    margin-inline: calc(-1 * var(--gutter));
    padding: 0;
    perspective: none;
  }
  .reels-track {
    justify-content: flex-start;
    gap: 14px;
    padding: 20px 16vw 44px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    perspective: 900px;
  }
  .reels-track::-webkit-scrollbar {
    display: none;
  }
  .reel {
    flex: 0 0 68vw;
    scroll-snap-align: center;
    transform-origin: 50% 50%;
  }
  .reel-caption {
    font-size: 26px;
  }
  .reels-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
  }
  .reels-dots span {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background: var(--shop-line);
    transition: width .35s var(--ease-out), background-color .2s ease;
  }
  .reels-dots span.is-active {
    width: 24px;
    background: var(--shop-blue);
  }
  .reel-viewer[open] {
    grid-template-columns: 1fr;
  }
  .reel-viewer-frame {
    grid-column: 1;
    justify-self: center;
  }
  .reel-viewer-nav {
    display: none;
  }
  .shop-socials a {
    font-size: 13px;
  }
  /* the floating "the menu" badge sits fixed bottom-right over the footer; keep the follow pills
     from wrapping under it instead of relying only on the JS visibility timing */
  .o-footer .shop-socials {
    padding-right: calc(104px + env(safe-area-inset-right));
  }
}

/* ---------- Reduced motion: static fan, no autoplay ---------- */
@media (prefers-reduced-motion: reduce) {
  .reel-card,
  .reels-stage.is-in .reel-card {
    opacity: 1;
    translate: none;
    transition: none;
  }
  .reel-el,
  img.reel-el,
  .reel-viewer:not(.is-video) .reel-viewer-media img {
    animation: none;
    transition: none;
  }
  .shop-socials a,
  .reel-play,
  .reel-viewer-nav,
  .reel-viewer-paused,
  .reel-viewer-icon,
  .reels-dots span {
    transition: none;
  }
}

/* Failed photo: reel cards/viewer are always a dark house, not the brand paper colour.
   The general .is-img-error rule (styles.css) hides the broken img/video; this only fixes
   the fallback fill, since the default paper-3 would look wrong here. */
:is(.reel-media, .reel-viewer-media, .reel-viewer-frame).is-img-error {
  background: var(--shop-ink);
}

@media (forced-colors: active) {
  .reel-play,
  .reel-viewer-nav {
    border: 1px solid ButtonText;
  }
  .shop-socials a {
    border-color: ButtonText;
  }
}
