/*
 * Scoped progressive shared-element navigation for Home → Item detail and
 * Explore → Item detail.  Nothing here changes a normal server render.
 */
.sv-hero-overlay {
  position: fixed;
  z-index: 2147483647;
  display: block;
  margin: 0;
  pointer-events: none;
  object-fit: cover;
  object-position: center;
  background: #edf0f8;
  box-shadow: 0 18px 42px rgba(20, 29, 67, .22);
  transform-origin: top left;
  will-change: transform, opacity, border-radius;
}

html.sv-hero-navigation-active,
html.sv-hero-navigation-active body {
  overscroll-behavior: none;
}

#page-wrapper[data-sevor-hero-shell] {
  min-height: 100vh;
  min-height: 100svh;
  background: #f8f9ff;
}

.sv-hero-detail-shell {
  box-sizing: border-box;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding: 22px 12px calc(138px + env(safe-area-inset-bottom, 0px));
  color: #1a213b;
  background:
    radial-gradient(circle at 93% 8%, rgba(5, 161, 194, .09), transparent 27%),
    radial-gradient(circle at 4% 83%, rgba(122, 64, 212, .075), transparent 31%),
    #f8f9ff;
}

.sv-hero-detail-shell__shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.sv-hero-detail-shell__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.23fr) minmax(320px, .77fr);
  gap: 24px;
  align-items: start;
}

.sv-hero-detail-shell__gallery,
.sv-hero-detail-shell__summary,
.sv-hero-detail-shell__section {
  min-width: 0;
  border: 1px solid rgba(88, 93, 161, .13);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .985), rgba(249, 251, 255, .91));
  box-shadow: 0 16px 38px rgba(34, 49, 104, .085), 0 2px 8px rgba(26, 33, 59, .035);
}

.sv-hero-detail-shell__gallery { padding: 10px; }

.sv-hero-detail-shell__stage {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 520px;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(135deg, #f7f9ff, #e9eef9);
}

.page .sv-hero-detail-shell__stage > img {
  display: block;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  /* The card image is already available.  Keeping it visible guarantees that
     a slow or interrupted transition can never show a blank gallery stage. */
  opacity: 1;
}

.sv-hero-detail-shell__back {
  position: absolute;
  z-index: 1;
  top: 13px;
  left: 13px;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(38, 46, 85, .1);
  border-radius: 50%;
  color: #202745;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 5px 16px rgba(20, 29, 67, .13);
  font-size: 1.25rem;
}

.sv-hero-detail-shell__summary {
  position: relative;
  display: grid;
  gap: 16px;
  min-height: 285px;
  padding: 30px;
}

.sv-hero-detail-shell__summary::before {
  position: absolute;
  top: 0;
  right: 24px;
  left: 24px;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(118deg, #7a40d4, #2e63de 55%, #05a1c2);
  content: "";
}

.sv-hero-detail-shell__below {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .36fr);
  gap: 24px;
  margin-top: 24px;
}

.sv-hero-detail-shell__section {
  min-height: 146px;
  padding: 25px;
}

.sv-hero-skeleton {
  display: block;
  height: .88rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(120, 128, 162, .12), rgba(233, 237, 249, .85), rgba(120, 128, 162, .12));
  background-size: 240% 100%;
  animation: sv-hero-shimmer 1.35s linear infinite;
}

.sv-hero-skeleton--title { width: 73%; height: 2rem; }
.sv-hero-skeleton--price { width: 37%; height: 1.45rem; margin-top: 6px; }
.sv-hero-skeleton--short { width: 47%; }
.sv-hero-skeleton--line { width: 100%; margin-top: 8px; }
.sv-hero-skeleton--line-short { width: 68%; }

.sv-hero-detail-shell__error {
  display: grid;
  gap: 12px;
  max-width: 490px;
  margin: 28px auto 0;
  padding: 22px;
  border: 1px solid rgba(112, 97, 160, .16);
  border-radius: 20px;
  color: #343049;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 12px 28px rgba(35, 44, 87, .08);
}

.sv-hero-detail-shell__error-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sv-hero-detail-shell__retry,
.sv-hero-detail-shell__return {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 13px;
  font-weight: 750;
}
.sv-hero-detail-shell__retry { color: #fff; background: linear-gradient(118deg, #7a40d4, #2e63de 55%, #05a1c2); }
.sv-hero-detail-shell__return { color: #39324f; background: #edf0f7; }

/* Text is only eased in after the fetched detail has been mounted.  Direct
   detail pages retain their existing presentation exactly as before. */
[data-item-detail][data-sevor-hero-entering] :is(
  .item-detail__summary,
  .item-detail__below-hero,
  .item-detail__thumbs
) {
  opacity: 0;
  transform: translateY(8px);
}

[data-item-detail][data-sevor-hero-ready] :is(
  .item-detail__summary,
  .item-detail__below-hero,
  .item-detail__thumbs
) {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease-out, transform 220ms cubic-bezier(.22, .8, .25, 1);
}

[data-sevor-hero-target].sv-hero-target-awaiting {
  /* The card source stays visible underneath the floating Hero copy.  Hiding
     it here caused iOS to reveal the gallery background for one paint. */
  opacity: 1;
}

[data-sevor-hero-target].sv-hero-target-card-fit {
  /* Match the floating card image until the decoded detail image can take
     over under its own temporary layer. */
  object-fit: cover;
}

.sv-hero-detail-upgrade {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  pointer-events: none;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  will-change: opacity;
}

.sv-hero-detail-upgrade--card {
  object-fit: cover;
}

@keyframes sv-hero-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -140% 0; }
}

@media (max-width: 900px) {
  .sv-hero-detail-shell__layout,
  .sv-hero-detail-shell__below { grid-template-columns: minmax(0, 1fr); }
  .sv-hero-detail-shell__below { display: none; }
}

@media (max-width: 620px) {
  .sv-hero-detail-shell { padding: 12px 12px calc(150px + env(safe-area-inset-bottom, 0px)); }
  .sv-hero-detail-shell__gallery { padding: 10px; border-radius: 23px; }
  .sv-hero-detail-shell__stage { aspect-ratio: 4 / 3; max-height: 390px; border-radius: 17px; }
  .sv-hero-detail-shell__summary { min-height: 235px; padding: 24px 20px; border-radius: 23px; }
  .sv-hero-detail-shell__summary::before { right: 20px; left: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .sv-hero-overlay,
  .sv-hero-detail-upgrade,
  .sv-hero-skeleton,
  [data-item-detail][data-sevor-hero-ready] :is(.item-detail__summary, .item-detail__below-hero, .item-detail__thumbs) {
    animation: none !important;
    transition: none !important;
  }
}
