/* The frame belongs to the photograph; product links and shop controls stay native. */
:is(
  body.chummy-after-dark:is(.vice-page-index, .vice-page-collection, .vice-page-search) main,
  body.chummy-after-dark.vice-page-product main :is(product-recommendations, .product-recommendations-wrapper, recently-viewed-products)
) .product-card-wrapper:not(:where(cart-drawer *, quick-add-modal *, predictive-search *, .drawer__inner *, [role="dialog"] *)) {
  --deck-ink: #282132;
  --deck-keyline: #413249;
  --deck-cream: #fff5df;
  --deck-peach: #ffbc9c;
  --deck-butter: #ffdf92;
  --deck-dust: #d6bec6;
  --hover-subtle-zoom-amount: 1;

  & > .card {
    padding: 0;
    gap: 0;
    border: 2px solid var(--deck-ink);
    border-radius: 2px;
    background: var(--deck-ink);
    box-shadow: 2px 3px 0 rgb(52 36 54 / 23%);
  }

  & .card--block-media,
  & > .card > .card__inner {
    position: relative;
    border-radius: 0;
    background: var(--deck-ink);
    overflow: clip;
  }

  /* Crop marks sit inside the printed picture area and accept no input. */
  & :is(.card--block-media, .card__inner > .card__media)::after {
    content: "";
    position: absolute;
    inset: 5px;
    z-index: 1;
    pointer-events: none;
    --mark: linear-gradient(currentColor, currentColor);
    color: var(--deck-cream);
    background:
      var(--mark) left top / 12px 2px,
      var(--mark) left top / 2px 12px,
      var(--mark) right bottom / 12px 2px,
      var(--mark) right bottom / 2px 12px;
    background-repeat: no-repeat;
    opacity: .72;
    filter: drop-shadow(0 1px 1px rgb(26 15 31 / 65%));
  }

  /* Classic Ella cards also have a content layer inside the picture for badges.
     Only the final information row below the picture receives the dark strip. */
  & > .card > .card__content {
    color: var(--deck-cream);
    background: var(--deck-ink);
  }

  & :is(.card-product-information, .card > .card__content > .card__information) {
    position: relative;
    padding: clamp(13px, 1.25vw, 19px) clamp(11px, 1.25vw, 19px);
    gap: 7px;
    border-block-start: 2px solid var(--deck-keyline);
    border-radius: 0;
    background: var(--deck-ink);
    color: var(--deck-cream);
  }

  & :is(.card-product-information, .card > .card__content > .card__information)::before {
    content: "";
    position: absolute;
    inset-block-start: -2px;
    inset-inline-start: 0;
    width: 41px;
    height: 2px;
    pointer-events: none;
    transform-origin: left center;
    background: linear-gradient(90deg, var(--deck-peach) 0 25px, transparent 25px 28px,
        var(--deck-butter) 28px 34px, transparent 34px 37px, var(--deck-cream) 37px);
  }

  & :is(.card-product-information, .card > .card__content > .card__information) :is(.card-title-change, .card-title-change .text) {
    color: var(--deck-cream);
    font-size: clamp(17px, 1.38vw, 23px);
    font-weight: 760;
    line-height: 1.12;
    letter-spacing: -.032em;
  }

  & :is(.card-product-information, .card > .card__content > .card__information) .price {
    --default-price-color: var(--deck-peach);
    --default-sale-color: var(--deck-butter);
    --default-compare-color: var(--deck-dust);
    color: var(--deck-peach);
    font-size: clamp(13px, 1.04vw, 16px);
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: .012em;
    font-variant-numeric: tabular-nums;
  }

  & :is(.card-product-information, .card > .card__content > .card__information) .price--on-sale .price-item--regular {
    font-weight: 450;
    text-decoration-thickness: 1px;
  }

  & .card-product-information .product-description__collection,
  & > .card > .card__content > .card__information :is(.caption-large, .caption-with-letter-spacing) {
    color: var(--deck-dust);
  }

  & .card__badge :is(.sale-badge, .sold-out-badge) {
    border: 1px solid var(--deck-ink);
    border-radius: 1px;
    font-size: clamp(10px, .85vw, 12px);
    line-height: 1.1;
    font-weight: 750;
    letter-spacing: .045em;
  }

  & .card__badge .sale-badge {
    color: var(--deck-ink);
    background: var(--deck-butter);
  }

  & .card__badge .sold-out-badge {
    color: var(--deck-cream);
    background: var(--deck-keyline);
  }

  /* Ella also has an icon-only quick add; its existing dimensions are intentional. */
  & :is(.card--block-button, .card > .card__content > .quick-add) .quick-add__submit:not(:disabled, [aria-disabled="true"]) {
    --button-background-color: var(--deck-butter);
    --button-text-color: var(--deck-ink);
    --button-border-color: var(--deck-ink);
    background-color: var(--deck-butter);
    color: var(--deck-ink);
    border-color: var(--deck-ink);
  }

  & :is(.card-title-change, .quick-add__submit, .card-product__group-btn):focus-visible {
    outline: 2px solid var(--deck-butter);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--deck-ink);
  }

  &:has(:focus-visible) > .card {
    outline: 2px solid var(--deck-ink);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--deck-butter);
  }

  &:has(:focus-visible) :is(.card--block-media, .card__inner > .card__media)::after {
    inset: 8px;
    opacity: 1;
    color: var(--deck-butter);
  }

  &:has(:focus-visible) :is(.card-product-information, .card > .card__content > .card__information)::before {
    transform: scaleX(1.7);
  }

  @media (prefers-reduced-motion: no-preference) {
    & :is(.card-product-information, .card > .card__content > .card__information)::before {
      transition: transform 200ms ease-out;
    }
  }

  @media (hover: hover) and (pointer: fine) {
    & :is(.card--block-media, .card__inner > .card__media)::after {
      transition: inset 180ms ease-out, opacity 180ms ease-out, color 180ms ease-out;
    }

    & .card__media > .media--hover-effect {
      transition: scale 260ms ease-out;
    }

    &:hover :is(.card--block-media, .card__inner > .card__media)::after {
      inset: 8px;
      opacity: 1;
      color: var(--deck-butter);
    }

    &:hover :is(.card-product-information, .card > .card__content > .card__information)::before {
      transform: scaleX(1.7);
    }

    &:hover .card__media > .media--hover-effect {
      scale: 1.023;
    }
  }
  @media (max-width: 749px) {
    & :is(.card-product-information > .card--block-title, .card > .card__content > .card__information) > .card__heading {
      font-size: clamp(15px, 3.8vw, 19px);
      line-height: 1.16;
      min-block-size: 2lh;
    }

    & :is(.card-product-information, .card > .card__content > .card__information) {
      padding: 12px 10px 13px;
      gap: 5px;
    }

    & :is(.card-product-information, .card > .card__content > .card__information) :is(.card-title-change, .card-title-change .text) {
      font-size: clamp(15px, 3.8vw, 19px);
      line-height: 1.16;
    }
  }
  @media (pointer: coarse) {
    &:active > .card {
      border-color: #995643;
      box-shadow: 0 0 0 2px #ffbc9c;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    & :is(.card--block-media, .card__inner > .card__media)::after,
    & :is(.card-product-information, .card > .card__content > .card__information)::before,
    & .card__media > .media--hover-effect {
      transition: none;
    }

    &:hover .card__media > .media--hover-effect {
      scale: none;
    }
  }
}

/* Enhancements only. The untouched storefront is the resting and no-JS state. */
@media (prefers-reduced-motion: no-preference) {
  .chummy-after-dark {
    --vice-settle: cubic-bezier(.18,.68,.23,1);
    --vice-drift-start: -18px;
  }
  [dir="rtl"] .chummy-after-dark,
  .chummy-after-dark[dir="rtl"] { --vice-drift-start: 18px; }

  /* Only the first, already-visible Red Friday picture moves, never its track. */
  .chummy-after-dark.vice-page-index [id$="__slideshow_tyrRgz"]
  .slide__media--primary[data-after-dark-entered=""] {
    animation: vice-camera-settle 1100ms var(--vice-settle) 1 backwards;
  }
  .chummy-after-dark.vice-page-index .ad-collections__heading[data-after-dark-entered],
  .chummy-after-dark.vice-page-index .section-global__header .section-header--block h2[data-after-dark-entered] {
    animation: vice-heading-arrive 720ms var(--vice-settle) 1 backwards;
  }

  .chummy-after-dark.vice-page-index .ad-collections__item[data-after-dark-entered] {
    position: relative;
    --vice-poster-delay: 0ms;
  }
  .chummy-after-dark.vice-page-index .ad-collections__item:nth-child(2) { --vice-poster-delay: 85ms; }
  .chummy-after-dark.vice-page-index .ad-collections__item:nth-child(3) { --vice-poster-delay: 170ms; }
  .chummy-after-dark.vice-page-index .ad-collections__item[data-after-dark-entered] .ad-collections__photo {
    animation: vice-poster-drift 1050ms var(--vice-settle) var(--vice-poster-delay) 1 backwards;
  }
  .chummy-after-dark.vice-page-index .ad-collections__item[data-after-dark-entered] .ad-collections__caption {
    animation: vice-poster-caption 750ms var(--vice-settle) var(--vice-poster-delay) 1 backwards;
  }
  /* This short reflection sits inside the card bounds. Neither the image,
     the title nor the accessible focus ring is masked by the entrance. */
  .chummy-after-dark.vice-page-index .ad-collections__item[data-after-dark-entered]::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    border-radius: 2px;
    opacity: 0;
    background: linear-gradient(116deg, transparent 43%, rgb(255 137 124 / 7%) 47%,
      rgb(255 225 167 / 26%) 49.7%, rgb(255 218 167 / 17%) 50%, transparent 54%) 125% 50% / 230% 100% no-repeat;
    animation: vice-poster-light 920ms ease-in-out var(--vice-poster-delay) 1;
  }

  .chummy-after-dark.vice-page-collection .collection-hero[data-after-dark-entered] h1 {
    position: relative;
    animation: vice-location-arrive 880ms var(--vice-settle) 1 backwards;
  }
  .chummy-after-dark.vice-page-collection .collection-hero[data-after-dark-entered] h1::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    inset-block-end: -.24em;
    width: clamp(68px, 9vw, 136px);
    height: 2px;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(90deg, #f45c91, #ffa580 72%, #ffe4a0);
    transform-origin: left center;
    animation: vice-location-line 1250ms cubic-bezier(.25,.68,.25,1) 90ms 1;
  }
  [dir="rtl"] .chummy-after-dark .collection-hero[data-after-dark-entered] h1::after { transform-origin: right center; }
  .chummy-after-dark.vice-page-collection .collection-hero[data-after-dark-entered]:not(.collection-hero--with-image)::after {
    transform-origin: right center;
    animation: vice-location-art 1050ms var(--vice-settle) 1 backwards;
  }
}

@keyframes vice-camera-settle {
  from { scale: 1.025; translate: -.38% .12%; }
  to { scale: 1; translate: 0 0; }
}
@keyframes vice-heading-arrive {
  from { translate: var(--vice-drift-start) 6px; }
  to { translate: 0 0; }
}
@keyframes vice-poster-drift {
  from { scale: 1.055; translate: -.45% .26%; }
  to { scale: 1; translate: 0 0; }
}
@keyframes vice-poster-caption {
  from { translate: 0 13px; }
  to { translate: 0 0; }
}
@keyframes vice-poster-light {
  0% { opacity: 0; background-position: 128% 50%; }
  22% { opacity: 1; }
  75% { opacity: .86; }
  100% { opacity: 0; background-position: -32% 50%; }
}
@keyframes vice-location-arrive {
  from { translate: var(--vice-drift-start) 7px; }
  to { translate: 0 0; }
}
@keyframes vice-location-art {
  from { scale: 1.06; }
  to { scale: 1; }
}
@keyframes vice-location-line {
  0% { opacity: 0; scale: .04 1; }
  18% { opacity: .92; }
  62% { opacity: 1; scale: 1 1; }
  100% { opacity: 0; scale: 1 1; }
}

@media (prefers-reduced-data: reduce) {
  .chummy-after-dark [data-after-dark-entered],
  .chummy-after-dark [data-after-dark-entered]::after,
  .chummy-after-dark [data-after-dark-entered] :is(h1, .ad-collections__photo, .ad-collections__caption),
  .chummy-after-dark [data-after-dark-entered] h1::after { animation: none !important; }
}
