/* ============================================================================
   Cloud 9 · Lingerie — animated landing page
   Visual palette = Figma source of truth. Motion/easing/shadow = engineering spec.
   Continuous transforms (headline mask, products, hero, parallax) are written by
   JS only. CSS owns discrete state transitions (shadow, hover, reveal).
   ============================================================================ */

:root {
  /* Palette — from the Figma file */
  --blush-bg:    #f5e5e6;   /* page background */
  --blush-soft:  #efd8d4;   /* panel base */
  --rose-red:    #ee3131;   /* headline + body text */
  --rose-deep:   #af0937;   /* arrow stroke / deep accent */
  --rose-pink:   #f5bbc9;   /* arrow disc */
  --cream:       #fbf4f1;   /* shimmer / highlight */
  --ink:         #3a2e2c;   /* shadow tint base */

  /* Shadows — soft, layered, never harsh */
  --shadow-rest:  0 8px 24px rgba(58, 46, 44, 0.10);
  --shadow-hover: 0 16px 40px rgba(58, 46, 44, 0.16);
  --shadow-drag:  0 28px 64px rgba(58, 46, 44, 0.24);

  /* Radii */
  --radius-card: 24px;
  --radius-pill: 999px;

  /* Easing — never linear for UI motion */
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-io-soft:   cubic-bezier(0.45, 0, 0.55, 1);

  /* Durations */
  --d-fast: 160ms;
  --d-med:  320ms;
  --d-slow: 560ms;
  --stagger: 45ms;

  --gutter: clamp(18px, 2.4vw, 34px);
  --maxw: 1440px;
}

/* ----------------------------------------------------------- reset / base */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--blush-bg);
  color: var(--rose-red);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
  line-height: 1.4;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* keep page width stable when the scrollbar appears */
  scrollbar-gutter: stable;
}

img { user-select: none; -webkit-user-drag: none; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--rose-red); color: var(--blush-bg); }

/* image-filled text — shared by loader + headline (§6) */
[data-clip-text] {
  background-image: url("../assets/hero.jpg");
  background-repeat: no-repeat;
  background-size: 130% auto;
  background-position: 50% 38%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ============================================================ world / layout */
.world {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 40px) var(--gutter) clamp(40px, 5vw, 80px);
}

/* ============================================================ masthead (§6/§7) */
.masthead { position: relative; }

.headline {
  position: relative;
  width: 100%;
  margin-top: clamp(4px, 1vw, 14px);
  isolation: isolate;
}

.headline__word {
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-weight: 800;
  font-size: clamp(58px, 22.6vw, 332px);
  line-height: 0.84;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: center;
  /* intro transform owner = JS; default rest state below */
  transform: translateZ(0);
}

/* brush script overlapping the wordmark (§7) */
.headline__script {
  position: absolute;
  left: 56%;
  bottom: clamp(2px, 1.4vw, 26px);
  transform: translateX(-50%) rotate(-3deg);
  transform-origin: center;
  font-family: "Kaushan Script", cursive;
  font-weight: 400;
  font-size: clamp(40px, 11vw, 156px);
  line-height: 0.8;
  color: var(--rose-red);
  pointer-events: none;
  z-index: 2;
  /* drawn-in by JS via clip-path; default rest = fully shown */
  will-change: clip-path, transform;
}

/* lede row: left + right flank, center sits lower (§ masthead layout) */
.lede {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(0, 1.5fr) minmax(160px, 1fr);
  align-items: start;
  column-gap: clamp(20px, 3vw, 56px);
  margin-top: clamp(18px, 2.5vw, 34px);
  font-weight: 500;
}
.lede p { margin: 0; text-transform: lowercase; }

.lede__left {
  grid-column: 1;
  max-width: 22ch;
  font-size: clamp(15px, 1.7vw, 24px);
  line-height: 1.18;
}
.lede__right {
  grid-column: 3;
  justify-self: end;
  text-align: right;
  max-width: 24ch;
  font-size: clamp(15px, 1.7vw, 24px);
  line-height: 1.18;
}
.lede__center {
  grid-column: 2;
  justify-self: center;
  text-align: center;
  max-width: 616px;
  margin-top: clamp(28px, 5.5vw, 96px);
  font-size: clamp(16px, 1.95vw, 28px);
  line-height: 1.22;
}

/* ============================================================ hero band (§9) */
.hero {
  position: relative;
  margin-top: clamp(26px, 4vw, 56px);
  /* full-bleed: span the full viewport width edge-to-edge, like the Figma frame */
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  /* overflow visible so floating products are not clipped */
}

.hero__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1440 / 726;
  overflow: hidden;          /* no rounded corners — image meets the screen edges */
  background: var(--blush-soft);
  contain: paint;
}

.hero__model {
  position: absolute;
  inset: -8% 0 0 0;            /* slight headroom for parallax travel */
  width: 100%;
  height: 116%;
  object-fit: cover;
  object-position: 50% 28%;
  /* transform owner = JS hero updater */
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* sunglasses microinteraction overlay (§9) — positioned by JS from data-glasses-* */
.hero__glasses {
  position: absolute;
  z-index: 2;
  border-radius: 999px;
  pointer-events: auto;
  /* amber glow, hidden until active */
  background: radial-gradient(60% 60% at 50% 50%,
              rgba(255, 168, 76, 0.55), rgba(238, 49, 49, 0) 70%);
  opacity: 0;
  transition: opacity 220ms var(--ease-out-quart);
  overflow: hidden;
}
.hero__glasses.is-lit { opacity: 0.4; }

.hero__gloss {
  position: absolute;
  top: -20%;
  left: -40%;
  width: 40%;
  height: 140%;
  background: linear-gradient(105deg,
              rgba(251, 244, 241, 0) 0%,
              rgba(251, 244, 241, 0.85) 50%,
              rgba(251, 244, 241, 0) 100%);
  transform: translateX(-260%) rotate(8deg);
  pointer-events: none;
}
.hero__glasses.is-swept .hero__gloss {
  animation: gloss-sweep 480ms var(--ease-out-quart) forwards;
}
@keyframes gloss-sweep {
  from { transform: translateX(-260%) rotate(8deg); }
  to   { transform: translateX(640%) rotate(8deg); }
}

/* ----------------------------------------------------- floating products (§8) */
.products {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;   /* container transparent; products opt back in */
}

.product {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;     /* we own the pointer gestures */
  filter: drop-shadow(0 18px 30px rgba(58, 46, 44, 0.22));
  transition: filter var(--d-med) var(--ease-out-quart);
  /* transform owner = JS product updater. will-change toggled by JS. */
  transform: translateZ(0);
  contain: layout paint;
}
.product img { width: 100%; height: auto; display: block; }
.product[data-state="drag"]  { cursor: grabbing; filter: drop-shadow(0 30px 50px rgba(58, 46, 44, 0.30)); }
.product[data-state="hover"] { filter: drop-shadow(0 24px 40px rgba(58, 46, 44, 0.26)); }

.product--grey { width: clamp(116px, 14vw, 198px); left: 2.4%;  top: -18%; }
.product--pink { width: clamp(126px, 15vw, 214px); right: 2.4%; top: -15%; z-index: 1; }
.product--tee  { width: clamp(96px, 11vw, 152px);  right: 3.5%; top: 50%;  }

/* ============================================================ collections (§12) */
.collections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(16px, 2.2vw, 32px);
  margin-top: clamp(40px, 6vw, 100px);
}

.card {
  position: relative;
  display: block;
  aspect-ratio: 670 / 651;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--blush-soft);
  box-shadow: var(--shadow-rest);
  isolation: isolate;
  contain: layout paint;
  transition: box-shadow var(--d-med) var(--ease-out-quart),
              transform var(--d-med) var(--ease-out-quart);
}
.card:focus-visible {
  outline: 3px solid var(--rose-red);
  outline-offset: 4px;
}
.card[data-hover="true"] { box-shadow: var(--shadow-hover); }

.card__media { position: absolute; inset: 0; overflow: hidden; }
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  transform: scale(1.02);
  transition: transform var(--d-slow) var(--ease-out-expo);
  will-change: transform;
}
.card[data-hover="true"] .card__media img { transform: scale(1.12); }

.card__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0) 30%),
    linear-gradient(0deg, rgba(0,0,0,0.34) 0%, rgba(0,0,0,0) 42%),
    rgba(0,0,0,0.10);
  transition: background var(--d-med) var(--ease-out-quart);
}
.card[data-hover="true"] .card__overlay { background:
    linear-gradient(180deg, rgba(0,0,0,0.22) 0%, rgba(0,0,0,0) 32%),
    linear-gradient(0deg, rgba(0,0,0,0.40) 0%, rgba(0,0,0,0) 44%),
    rgba(0,0,0,0.14); }

/* shimmer streak (§12.5) — runs once per hover-enter */
.card::before {
  content: "";
  position: absolute;
  z-index: 4;
  top: -25%;
  left: -60%;
  width: 40%;
  height: 150%;
  background: linear-gradient(105deg,
              rgba(251,244,241,0) 0%, rgba(251,244,241,0.55) 50%, rgba(251,244,241,0) 100%);
  transform: translateX(-160%) rotate(8deg);
  pointer-events: none;
  opacity: 0;
}
.card[data-hover="true"]::before { animation: card-shimmer 700ms var(--ease-out-quart); }
@keyframes card-shimmer {
  0%   { transform: translateX(-160%) rotate(8deg); opacity: 0; }
  12%  { opacity: 1; }
  100% { transform: translateX(360%) rotate(8deg); opacity: 0; }
}

.card__label {
  position: absolute;
  top: clamp(20px, 2.4vw, 38px);
  left: clamp(22px, 2.6vw, 40px);
  z-index: 5;
  font-family: "Kaushan Script", cursive;
  font-size: clamp(30px, 3.6vw, 52px);
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0,0,0,0.25);
  transform: translateY(0);
  transition: transform var(--d-med) var(--ease-spring);
}
.card[data-hover="true"] .card__label { transform: translateY(-4px); }

/* glass pill CTA */
.card__cta {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: clamp(20px, 2.6vw, 34px);
  transform: translateX(-50%) translateY(0);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 10px 18px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.20);
  border: 1px solid rgba(255, 255, 255, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  color: #fff;
  white-space: nowrap;
  opacity: 0.94;
  transition: transform var(--d-med) var(--ease-spring),
              opacity var(--d-med) var(--ease-out-quart),
              background var(--d-med) var(--ease-out-quart);
}
.card[data-hover="true"] .card__cta {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
  background: rgba(255, 255, 255, 0.30);
  transition-delay: 0ms, 80ms, 0ms;
}
.card__cta-text { font-size: clamp(13px, 1.3vw, 18px); font-weight: 400; }
.card__cta-icon { width: 30px; height: 30px; flex: none; transition: transform var(--d-med) var(--ease-spring); }
.card[data-hover="true"] .card__cta-icon { transform: translateX(3px); }

/* ============================================================ footer */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: clamp(28px, 4vw, 56px);
  font-size: 13px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  opacity: 0.7;
}
.footer__hint { font-size: 12px; opacity: 0.8; }

/* ============================================================ ambient (§10) */
.ambient {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ============================================================ cloud veil (§14) */
.cloud-veil {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(40% 30% at 20% 30%, rgba(251,244,241,0.9), transparent 70%),
    radial-gradient(46% 34% at 78% 40%, rgba(245,187,201,0.7), transparent 72%),
    radial-gradient(50% 40% at 50% 75%, rgba(251,244,241,0.85), transparent 70%);
  filter: blur(22px);
  transition: opacity 520ms var(--ease-out-quart);
}
.cloud-veil.is-on { opacity: 0.9; }

/* ============================================================ reveal (§13)
   Hidden only when JS is active — no-JS / JS-error keeps content visible. */
.js .reveal {
  clip-path: inset(0 0 100% 0);
  opacity: 0;
  transform: translateY(10px);
  transition: clip-path 640ms var(--ease-spring),
              opacity 520ms var(--ease-out-quart),
              transform 640ms var(--ease-spring);
  transition-delay: var(--reveal-delay, 0ms);
}
.js .reveal.is-in {
  clip-path: inset(0 0 0% 0);
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================ loader (§5) */
.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;            /* shown only when JS is active (see .js .loader) */
  place-items: center;
  background: var(--blush-bg);
  /* dissolve = transform + opacity + mask wipe (no animated full-screen blur) */
  -webkit-mask-image: linear-gradient(to top, #000 0%, #000 100%);
  mask-image: linear-gradient(to top, #000 0%, #000 100%);
  transition: opacity 420ms var(--ease-out-quart), transform 520ms var(--ease-out-quart);
}
.loader.is-done {
  opacity: 0;
  transform: translateY(-44px);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to top, transparent 0%, #000 60%);
  mask-image: linear-gradient(to top, transparent 0%, #000 60%);
}
.js .loader { display: grid; }
.loader__inner { display: grid; justify-items: center; gap: 14px; padding: 24px; }
.loader__wordmark {
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-weight: 800;
  font-size: clamp(64px, 18vw, 200px);
  line-height: 0.84;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.loader__script {
  margin-top: -0.5em;
  font-family: "Kaushan Script", cursive;
  font-size: clamp(34px, 8vw, 84px);
  color: var(--rose-red);
  transform: scale(0.96);
  opacity: 0;
}
.loader__script.is-in { animation: script-settle 520ms var(--ease-spring) forwards; }
@keyframes script-settle { to { transform: scale(1); opacity: 1; } }

.loader__progress {
  width: clamp(180px, 26vw, 320px);
  height: 3px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(238, 49, 49, 0.18);
  overflow: hidden;
}
.loader__progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--rose-red);
}
.loader__label {
  margin: 2px 0 0;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  opacity: 0.7;
}
.loader__dots i { animation: dot-blink 1.4s infinite both; }
.loader__dots i:nth-child(2) { animation-delay: 0.2s; }
.loader__dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

/* drop ripple ring (§8) — pooled element */
.ripple {
  position: absolute;
  z-index: 4;
  width: 60px; height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 999px;
  border: 2px solid rgba(251, 244, 241, 0.85);
  background: radial-gradient(circle, rgba(245,187,201,0.35), transparent 70%);
  filter: blur(4px);              /* static blur on one small element — fine */
  pointer-events: none;
  opacity: 0;
}
.ripple.is-go { animation: ripple-pop 620ms var(--ease-out-expo) forwards; }
@keyframes ripple-pop {
  from { transform: scale(0);   opacity: 0.5; }
  to   { transform: scale(2.4); opacity: 0; }
}

/* ============================================================ responsive */
@media (max-width: 900px) {
  .headline__word { font-size: clamp(38px, 18.4vw, 200px); letter-spacing: -0.02em; }
  .headline__script { font-size: clamp(30px, 11vw, 110px); left: 54%; }

  .lede {
    grid-template-columns: 1fr;
    row-gap: 16px;
    margin-top: 22px;
    text-align: center;
    justify-items: center;
  }
  .lede__left, .lede__right, .lede__center {
    grid-column: 1;
    justify-self: center;
    text-align: center;
    margin-top: 0;
    max-width: 38ch;
    font-size: clamp(15px, 3.4vw, 19px);
  }
  .lede__right { text-align: center; }

  .hero { margin-top: 30px; }
  .hero__frame { aspect-ratio: 4 / 5; }
  .hero__model { object-position: 50% 26%; }

  /* products reflow: keep grey + pink at the seam, tuck the tee lower */
  .product--grey { width: clamp(86px, 24vw, 132px); top: -10%; left: 0%; }
  .product--pink { width: clamp(92px, 26vw, 140px); top: -8%; right: 0%; }
  .product--tee  { width: clamp(72px, 20vw, 110px); top: 62%; right: 2%; }

  .collections { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .headline__script { bottom: -2px; }
  .lede__center { font-size: 16px; }
  .footer { flex-direction: column; gap: 6px; text-align: center; }
}

/* ============================================================ reduced motion (§16) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .js .reveal { clip-path: inset(0 0 0% 0); opacity: 1; transform: none; }
  .loader { display: none !important; }
  .ambient { display: none; }
  .headline__script { clip-path: none !important; }
}
