/* ==========================================================================
   3D Studio theme. The page is a dark glass stage; js/studio-scene.js renders
   the 3D gifts on a fixed canvas behind it (only when WebGL is available and
   the visitor allows motion). Without it the CSS aurora alone still looks finished.
   ========================================================================== */

[data-theme="studio"] {
  color-scheme: dark;
}

/* Aurora: slow drifting glows (also the fallback when WebGL is off). */
[data-theme="studio"] body {
  background:
    radial-gradient(60vmax 45vmax at 85% -10%, rgba(25, 211, 197, 0.16), transparent 60%),
    radial-gradient(55vmax 40vmax at -10% 30%, rgba(143, 123, 255, 0.14), transparent 60%),
    radial-gradient(50vmax 40vmax at 60% 110%, rgba(255, 122, 107, 0.1), transparent 60%),
    var(--c-bg);
  background-attachment: fixed;
}

/* The 3D canvas sits behind everything and never takes clicks. */
.studio-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1200ms var(--ease-out);
}

.studio-scene.is-ready {
  opacity: 1;
}

[data-theme="studio"] main,
[data-theme="studio"] .site-footer,
[data-theme="studio"] .announcement {
  position: relative;
  z-index: 1;
}

/* --- Chrome --------------------------------------------------------------- */

[data-theme="studio"] .announcement {
  background: linear-gradient(90deg, rgba(25, 211, 197, 0.16), rgba(143, 123, 255, 0.16));
  border-bottom: 1px solid var(--glass-line);
  backdrop-filter: blur(12px);
}

[data-theme="studio"] .announcement strong {
  color: var(--gold);
}

[data-theme="studio"] .site-header {
  background: rgba(6, 10, 19, 0.55);
  border-bottom: 1px solid var(--glass-line);
  backdrop-filter: saturate(1.5) blur(18px);
}

/* The logo sits on a light pill so its colours read on the dark stage. */
[data-theme="studio"] .site-header .logo__img,
[data-theme="studio"] .site-footer .logo__img {
  padding: 4px 10px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 0 30px -6px rgba(25, 211, 197, 0.6);
}

[data-theme="studio"] :is(.deliver-to, .search__input, .input, .select) {
  border-color: var(--glass-line);
  background: var(--glass);
  color: var(--c-ink);
}

[data-theme="studio"] .search__input::placeholder {
  color: var(--c-muted);
}

[data-theme="studio"] .cart-link:hover {
  background: var(--glass-strong);
}

/* --- Type: luminous gradient words ----------------------------------------- */

[data-theme="studio"] :is(.hero__title, .section__title, .checkout-head__title, .placed__title) em,
[data-theme="studio"] mark.sticker {
  padding: 0;
  border-radius: 0;
  background: var(--g-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  rotate: 0deg;
  box-shadow: none;
}

[data-theme="studio"] .section__title,
[data-theme="studio"] .hero__title {
  background: none;
}

[data-theme="studio"] .hero__title {
  font-size: clamp(2.6rem, 1.4rem + 5vw, 5.4rem);
  line-height: 0.98;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

[data-theme="studio"] .eyebrow {
  color: var(--glow-teal);
  letter-spacing: 0.3em;
}

/* --- Buttons: glowing gradient, moving sheen ----------------------------------- */

[data-theme="studio"] .btn--primary {
  background: var(--g-primary);
  background-size: 200% 100%;
  color: #04121a;
  box-shadow: var(--shadow-rose);
  transition: background-position 600ms var(--ease-out), transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease-out);
}

[data-theme="studio"] .btn--primary:hover {
  background-position: 100% 0;
  box-shadow: 0 14px 50px -6px rgba(57, 184, 255, 0.75);
  transform: translateY(-2px) scale(1.02);
}

[data-theme="studio"] .btn--primary .icon {
  color: inherit;
}

[data-theme="studio"] .btn--ghost {
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--c-ink);
  backdrop-filter: blur(10px);
}

[data-theme="studio"] .btn--ghost:hover {
  border-color: rgba(25, 211, 197, 0.6);
  box-shadow: 0 0 30px -8px rgba(25, 211, 197, 0.6);
}

[data-theme="studio"] .chip {
  border-color: var(--glass-line);
  background: var(--glass);
  color: var(--c-ink);
  backdrop-filter: blur(10px);
}

[data-theme="studio"] .chip:hover,
[data-theme="studio"] .chip.is-active {
  border-color: var(--glow-teal);
  background: rgba(25, 211, 197, 0.14);
  color: #ffffff;
}

/* --- Glass surfaces -------------------------------------------------------------- */

[data-theme="studio"] :is(.note-card, .review__bubble, .steps__item, .panel, .summary, .cart-line, .empty-state, .filters__panel, .location-dialog__card, .story) {
  border: 1px solid var(--glass-line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(16px) saturate(1.3);
  color: var(--c-ink);
}

[data-theme="studio"] .review__bubble::after {
  display: none;
}

[data-theme="studio"] .promise,
[data-theme="studio"] .site-footer {
  background: linear-gradient(180deg, rgba(3, 6, 12, 0.4), rgba(3, 6, 12, 0.92));
  border-top: 1px solid var(--glass-line);
}

/* --- Product cards: glass tiles that tilt in 3D under the cursor (js/studio.js sets --rx/--ry) --- */

[data-theme="studio"] .product-card {
  --rx: 0deg;
  --ry: 0deg;
  padding: 8px 8px var(--s-4);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-card-lg);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(14px);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 500ms var(--ease-out), border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

[data-theme="studio"] .product-card.is-tilting {
  transition: transform 80ms linear, border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

[data-theme="studio"] .product-card__media {
  border: 0;
  transform: translateZ(30px);
}

[data-theme="studio"] .product-card__body {
  padding-inline: var(--s-2);
  transform: translateZ(18px);
}

[data-theme="studio"] .product-card__price {
  color: var(--gold);
}

@media (hover: hover) {
  [data-theme="studio"] .product-card:hover {
    border-color: rgba(25, 211, 197, 0.55);
    box-shadow: 0 30px 60px -25px rgba(25, 211, 197, 0.45);
  }

  [data-theme="studio"] .product-card:hover .product-card__media {
    box-shadow: none;
    transform: translateZ(30px);
  }
}

[data-theme="studio"] .badge--express {
  background: rgba(6, 10, 19, 0.7);
  color: var(--c-fresh);
}

/* --- Home hero: the 3D gift box replaces the photo collage ------------------------ */

/* (visibility, not opacity: the frames' entrance animation would override an opacity rule) */
[data-theme="studio"].has-3d .hero__frame {
  visibility: hidden;
  animation: none;
}

[data-theme="studio"] .hero__stage {
  min-height: 26rem;
}

[data-theme="studio"] .hero__frame {
  border-color: rgba(255, 255, 255, 0.14);
  transition: opacity 900ms var(--ease-out);
}

[data-theme="studio"] .category-tile__ring {
  background: var(--g-primary);
  box-shadow: 0 0 30px -10px rgba(25, 211, 197, 0.7);
}

[data-theme="studio"] .category-tile__ring img {
  border-color: var(--c-bg);
}

[data-theme="studio"] .occasion-tile {
  border: 1px solid var(--glass-line);
}

[data-theme="studio"] .flash--warn {
  background: rgba(245, 199, 107, 0.16);
  color: var(--gold);
}

[data-theme="studio"] .flash--ok {
  background: rgba(62, 229, 160, 0.14);
}

[data-theme="studio"] .flash--error {
  background: rgba(255, 122, 107, 0.16);
}

@media (prefers-reduced-motion: reduce) {
  [data-theme="studio"] .product-card {
    transform: none;
  }

  [data-theme="studio"] body {
    background-attachment: scroll;
  }
}

/* ==========================================================================
   Gift runway (home, 3D Studio only): a pinned stage while the page scrolls
   through five steps; js/studio-runway.js morphs the gift between them.
   ========================================================================== */

.runway {
  position: relative;
  z-index: 1;
  margin-block: var(--s-8);
}

/* With JavaScript the section gets tall so scrolling drives the morph; without it, it is a plain list. */
.js .runway {
  height: 520vh;
  margin-block: 0;
}

.runway__sticky {
  position: relative;
}

.js .runway__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  /* A darker stage so the floating background gifts don't compete with the runway. */
  background: radial-gradient(70% 60% at 70% 55%, rgba(13, 22, 38, 0.55), rgba(6, 10, 19, 0.92));
}

.runway__stage {
  position: absolute;
  inset: 0;
}

.runway__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.runway__glow {
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: min(70vw, 46rem);
  aspect-ratio: 3 / 1;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(25, 211, 197, 0.35), rgba(143, 123, 255, 0.12) 60%, transparent);
  filter: blur(20px);
  pointer-events: none;
}

.runway__copy {
  position: relative;
  display: grid;
  gap: var(--s-4);
  align-content: center;
  height: 100%;
  padding-block: var(--s-8);
  pointer-events: none;
}

.runway__copy a {
  pointer-events: auto;
}

.runway__title {
  max-width: 12ch;
  font-size: clamp(2.2rem, 1.4rem + 3.4vw, 4.2rem);
  line-height: 1;
}

.runway__title em {
  background: var(--g-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.runway__steps {
  display: grid;
  gap: var(--s-3);
  max-width: 24rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.runway__step {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: var(--s-3);
  align-items: start;
}

.js .runway__step {
  opacity: 0.28;
  transform: translateX(-6px);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}

.js .runway__step.is-active {
  opacity: 1;
  transform: none;
}

.runway__num {
  font-family: var(--font-heading);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--glow-teal, #19d3c5);
}

.runway__step-title {
  font-size: var(--fs-h3);
}

.runway__line {
  margin: 0.15rem 0 0.35rem;
  color: var(--c-ink-soft);
}

.js .runway__step:not(.is-active) .runway__line,
.js .runway__step:not(.is-active) .link-arrow {
  display: none;
}

.runway__progress {
  width: min(24rem, 100%);
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.runway__progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--g-primary);
  transform-origin: left;
  transform: scaleX(var(--progress, 0));
}

/* Mobile: the gift owns the top of the screen, the active step sits at the bottom. */
@media (max-width: 899px) {
  .js .runway__copy {
    align-content: end;
    padding-bottom: var(--s-7);
  }

  .js .runway__step:not(.is-active) {
    display: none;
  }

  .runway__title {
    font-size: clamp(1.8rem, 1.2rem + 3vw, 2.6rem);
  }
}

@media (min-width: 900px) {
  .runway__copy {
    max-width: var(--container);
  }
}

/* ==========================================================================
   Opening moment (js/studio-intro.js): the gift box assembles, spins and bursts,
   then the page builds itself in. Hidden only while html.intro-pending is set.
   ========================================================================== */

html.intro-pending body {
  overflow: hidden;
}

html.intro-pending :is(.announcement, .site-header, main, .site-footer, .theme-picker, .proof) {
  opacity: 0;
}

.intro {
  --fade: 1;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgb(6 10 19 / var(--fade));
  pointer-events: none;
}

.intro canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* The website populates: header drops in, then each section rises into place in turn. */
html.intro-reveal :is(.announcement, .site-header) {
  animation: intro-drop 700ms var(--ease-out) both;
}

html.intro-reveal main > * {
  animation: intro-rise 800ms var(--ease-out) both;
}

html.intro-reveal main > :nth-child(2) { animation-delay: 90ms; }
html.intro-reveal main > :nth-child(3) { animation-delay: 180ms; }
html.intro-reveal main > :nth-child(4) { animation-delay: 270ms; }
html.intro-reveal main > :nth-child(n + 5) { animation-delay: 360ms; }

@keyframes intro-drop {
  from { opacity: 0; transform: translateY(-24px); }
}

@keyframes intro-rise {
  from { opacity: 0; transform: translateY(40px) scale(0.98); }
}

/* ==========================================================================
   Sections built from dots (js/studio-build.js). Only sections below the fold
   get .dot-build (from script), so nothing is ever hidden without JavaScript.
   ========================================================================== */

.dot-build {
  position: relative;
}

.dot-build > :not(.dot-build__canvas) {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(14px) scale(0.985);
  transition: opacity 650ms var(--ease-out), filter 650ms var(--ease-out), transform 650ms var(--ease-out);
}

.dot-build.is-built > :not(.dot-build__canvas) {
  opacity: 1;
  filter: none;
  transform: none;
}

.dot-build.is-built > :nth-child(2) { transition-delay: 80ms; }
.dot-build.is-built > :nth-child(3) { transition-delay: 160ms; }
.dot-build.is-built > :nth-child(n + 4) { transition-delay: 240ms; }

.dot-build__canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  width: 100%;
  pointer-events: none;
}
