/* ==========================================================================
   SHOPAHOLIC — Coming Soon Campaign
   Swiss editorial restraint meets architectural fluted-glass luxury cinema.
   ========================================================================== */

:root {
  --canvas-bg: #1c1916;
  --ivory: #f7f5f0;
  --ivory-muted: rgba(247, 245, 240, 0.86);
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --glass-shift-x: 0px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--canvas-bg);
  color: var(--ivory);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

/* Full-viewport edge-to-edge campaign stage */
.campaign {
  position: relative;
  width: 100vw;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background-color: var(--canvas-bg);
  user-select: none;
  -webkit-user-select: none;
}

.media-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Shared poster, video & still geometry + unified fluted-glass diffusion & editorial colour grade.
   Applying blur directly to media (with 1.03 edge bleed) avoids Safari's expensive backdrop-filter
   readback pass over live <video>, keeping older iPhones silky-smooth and glitch-free. */
.campaign-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Desktop 16:9 default: balanced architectural composition */
  object-position: 50% 52%;
  transform: scale(1.03);
  filter: blur(4.2px) contrast(1.06) saturate(0.95) brightness(0.99);
  pointer-events: none;
}

/* Video stays active in viewport so iOS Safari autoplays immediately, completely shielded while buffering */
.campaign-video {
  z-index: 1;
  opacity: 1;
}

/* Pre-rendered local opening frame sits ABOVE <video> until smooth frames are flowing */
.campaign-poster {
  z-index: 2;
  opacity: 1;
  transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity;
}

/* Pre-rendered local 2560px final still; fades in cleanly on end and breathes subtly behind fixed glass ribs */
.campaign-still {
  z-index: 3;
  opacity: 0;
  transform: scale(1.03) translate3d(0, 0, 0);
  transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

/* Defensively suppress any residual native Safari / iOS playback chrome */
.campaign-video::-webkit-media-controls,
.campaign-video::-webkit-media-controls-enclosure,
.campaign-video::-webkit-media-controls-panel,
.campaign-video::-webkit-media-controls-play-button,
.campaign-video::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* State classes managed by app.js */
.campaign.is-playing .campaign-poster {
  opacity: 0;
}

.campaign.is-static .campaign-still,
.campaign.is-still-locked .campaign-still {
  opacity: 1;
}

/* Almost subliminal showroom breathing parallax behind stationary fluted glass once settled */
.campaign.is-still-locked .campaign-still {
  animation: atelierBreath 24s ease-in-out infinite alternate;
}

@keyframes atelierBreath {
  0% {
    transform: scale(1.03) translate3d(0, 0, 0);
  }
  100% {
    transform: scale(1.046) translate3d(-0.35%, -0.2%, 0);
  }
}

/* Only hide <video> when permanently static (reduced motion or autoplay failure) */
.campaign.is-static .campaign-video {
  opacity: 0;
  visibility: hidden;
}

/* ==========================================================================
   35mm Organic Film Grain Overlay
   ========================================================================== */

.campaign-grain {
  position: absolute;
  inset: -12%;
  z-index: 4;
  background-image: url('assets/film-grain.png');
  background-repeat: repeat;
  background-size: 220px 220px;
  mix-blend-mode: soft-light;
  opacity: 0.24;
  pointer-events: none;
  will-change: transform;
  animation: filmGrainShift 0.55s steps(1, end) infinite;
}

/* Settle into calm fine-art print grain once playback ends or in static mode */
.campaign.is-ended .campaign-grain,
.campaign.is-static .campaign-grain {
  animation-play-state: paused;
  opacity: 0.20;
  transition: opacity 700ms ease-out;
}

@keyframes filmGrainShift {
  0%   { transform: translate3d(0, 0, 0); }
  14%  { transform: translate3d(-4%, -3%, 0); }
  28%  { transform: translate3d(3%, -5%, 0); }
  42%  { transform: translate3d(-5%, 2%, 0); }
  57%  { transform: translate3d(4%, 4%, 0); }
  71%  { transform: translate3d(-2%, 5%, 0); }
  85%  { transform: translate3d(5%, -2%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Subtle cinema prime-lens optical vignette */
.campaign-vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: radial-gradient(
    ellipse 78% 74% at 52% 48%,
    rgba(20, 17, 14, 0) 48%,
    rgba(20, 17, 14, 0.13) 78%,
    rgba(16, 13, 10, 0.32) 100%
  );
  pointer-events: none;
}

/* ==========================================================================
   Architectural Fluted / Reeded Showroom Glass + Living Ambient Refractions
   ========================================================================== */

/* Repeating vertical cylindrical flutes catching warm highlights & shadowed grooves */
.glass-fluted-ribs {
  position: absolute;
  inset: 0;
  z-index: 6;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 252, 245, 0.13) 0px,
    rgba(255, 252, 245, 0.04) 3px,
    rgba(255, 252, 245, 0.0) 8px,
    rgba(18, 15, 12, 0.11) 14px,
    rgba(14, 11, 8, 0.18) 17px,
    rgba(255, 252, 245, 0.09) 21px,
    rgba(255, 252, 245, 0.0) 24px
  );
  mix-blend-mode: overlay;
  opacity: 0.88;
  pointer-events: none;
}

/* Delicate shifting caustic highlights catching the edges of the glass flutes */
.glass-caustics {
  position: absolute;
  inset: 0 -24px;
  z-index: 6;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0px,
    rgba(255, 249, 236, 0.16) 2px,
    transparent 5px,
    transparent 24px
  );
  mix-blend-mode: soft-light;
  opacity: 0.22;
  pointer-events: none;
  will-change: transform, opacity;
  transition: opacity 1200ms ease-out;
  animation: causticShimmer 13s ease-in-out infinite alternate;
}

.campaign.is-ended .glass-caustics,
.campaign.is-still-locked .glass-caustics {
  opacity: 0.56;
}

@keyframes causticShimmer {
  0% {
    transform: translate3d(calc(-5px + var(--glass-shift-x) * 0.35), 0, 0);
  }
  50% {
    transform: translate3d(calc(4px + var(--glass-shift-x) * 0.35), 0, 0);
  }
  100% {
    transform: translate3d(calc(-2px + var(--glass-shift-x) * 0.35), 0, 0);
  }
}

/* Slow passing golden-hour daylight & subtle prism refraction sweeping across the glass */
.glass-refraction {
  position: absolute;
  inset: -14%;
  z-index: 6;
  background: linear-gradient(
    114deg,
    transparent 0%,
    transparent 14%,
    rgba(255, 248, 235, 0.03) 20%,
    rgba(255, 252, 245, 0.095) 26%,
    rgba(232, 238, 244, 0.04) 30%,
    transparent 37%,
    transparent 52%,
    rgba(255, 245, 228, 0.065) 59%,
    rgba(255, 252, 246, 0.11) 63%,
    rgba(255, 248, 238, 0.03) 68%,
    transparent 76%,
    transparent 100%
  );
  mix-blend-mode: screen;
  opacity: 0.55;
  pointer-events: none;
  will-change: transform, opacity;
  transition: opacity 1400ms ease-out;
  animation: refractionDrift 18s ease-in-out infinite alternate;
}

/* Gently bloom ambient light refraction once the showroom settles at the final frame */
.campaign.is-ended .glass-refraction,
.campaign.is-still-locked .glass-refraction {
  opacity: 0.95;
}

@keyframes refractionDrift {
  0% {
    transform: translate3d(calc(-7% + var(--glass-shift-x)), -1%, 0) skewX(-2deg);
  }
  50% {
    transform: translate3d(calc(2% + var(--glass-shift-x)), 0.5%, 0) skewX(0.5deg);
  }
  100% {
    transform: translate3d(calc(8% + var(--glass-shift-x)), 1.5%, 0) skewX(2deg);
  }
}

/* Hairline architectural glass pane inner edge */
.glass-frame {
  position: absolute;
  inset: 0;
  z-index: 7;
  box-shadow: inset 0 0 0 1px rgba(247, 245, 240, 0.12);
  pointer-events: none;
}

/* Whisper-subtle lower atmospheric scrim for crisp ivory readability over sunlit stone */
.campaign-scrim {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 7;
  height: clamp(160px, 28svh, 300px);
  background: linear-gradient(
    to top,
    rgba(20, 17, 14, 0.56) 0%,
    rgba(20, 17, 14, 0.26) 44%,
    rgba(20, 17, 14, 0.07) 74%,
    rgba(20, 17, 14, 0) 100%
  );
  pointer-events: none;
}

/* Minimal editorial brand lockup etched cleanly onto the front glass plane */
.brand-lockup {
  position: absolute;
  left: 50%;
  bottom: calc(clamp(30px, 5.2svh, 58px) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(84vw, 320px);
  pointer-events: none;
  opacity: 0;
  animation: lockupReveal 900ms cubic-bezier(0.22, 1, 0.36, 1) 120ms forwards;
}

.brand-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.brand-logo {
  display: block;
  width: clamp(152px, 14.5vw, 214px);
  height: auto;
  opacity: 0.96;
  /* Crisp front-of-glass highlight + soft depth shadow onto the atelier behind */
  filter:
    drop-shadow(0 1px 1px rgba(255, 255, 255, 0.20))
    drop-shadow(0 8px 20px rgba(14, 11, 8, 0.52));
}

.brand-status {
  margin-top: clamp(11px, 1.35svh, 15px);
  font-size: clamp(9.5px, 0.72vw, 11px);
  font-weight: 400;
  letter-spacing: 0.36em;
  /* Optical right-padding compensation for trailing letter-spacing */
  padding-left: 0.36em;
  line-height: 1.2;
  color: var(--ivory-muted);
  text-transform: uppercase;
  text-shadow: 0 1px 12px rgba(14, 11, 8, 0.48);
}

/* Whisper-quiet corner entry to the Editorial Journal (crawlable for SEO/GEO without competing with the film) */
.journal-whisper {
  position: absolute;
  right: calc(clamp(20px, 2.8vw, 38px) + env(safe-area-inset-right, 0px));
  bottom: calc(clamp(22px, 3.2svh, 36px) + env(safe-area-inset-bottom, 0px));
  z-index: 9;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.28em;
  padding-left: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(247, 245, 240, 0.52);
  text-shadow: 0 1px 10px rgba(14, 11, 8, 0.45);
  transition: color 240ms ease, opacity 240ms ease;
}

.journal-whisper:hover,
.journal-whisper:focus-visible {
  color: var(--ivory);
  outline: none;
}

@keyframes lockupReveal {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ==========================================================================
   Responsive Focal Framing (Protects Clothing Racks & Handbag on Narrow Screens)
   In the 16:9 final frame, the two racks span ~35%-71% X and the handbag sits
   at ~70%-77% X. Shifting horizontal focal bias rightward keeps both racks and
   handbag harmoniously visible on tablet and portrait mobile screens.
   ========================================================================== */

/* Tablet / Near-Square Viewports */
@media (max-aspect-ratio: 4/3) {
  .campaign-media[data-source="desktop"] {
    object-position: 58% 54%;
  }
}

/* Mobile Portrait Viewports (9:16 & Narrow Tall Screens) */
@media (max-aspect-ratio: 3/4) {
  .campaign-media[data-source="desktop"] {
    object-position: 63% 56%;
  }

  /* If a dedicated 9:16 mobile Mux asset is configured, frame naturally centered */
  .campaign-media[data-source="mobile"] {
    object-position: 50% 50%;
  }

  /* Keep static subtle grain on narrow/older mobile devices to save GPU & battery */
  .campaign-grain {
    background-size: 180px 180px;
    opacity: 0.19;
    animation: none;
  }

  /* Proportionally tighter architectural flute spacing for narrow screens */
  .glass-fluted-ribs {
    background-image: repeating-linear-gradient(
      90deg,
      rgba(255, 252, 245, 0.13) 0px,
      rgba(255, 252, 245, 0.03) 2px,
      rgba(255, 252, 245, 0.0) 6px,
      rgba(18, 15, 12, 0.11) 10px,
      rgba(14, 11, 8, 0.18) 12px,
      rgba(255, 252, 245, 0.08) 15px,
      rgba(255, 252, 245, 0.0) 17px
    );
  }

  .glass-caustics {
    background-image: repeating-linear-gradient(
      90deg,
      transparent 0px,
      rgba(255, 249, 236, 0.15) 1.5px,
      transparent 4px,
      transparent 17px
    );
  }

  .campaign-scrim {
    height: 31svh;
    background: linear-gradient(
      to top,
      rgba(18, 15, 12, 0.64) 0%,
      rgba(18, 15, 12, 0.32) 46%,
      rgba(18, 15, 12, 0.08) 76%,
      rgba(18, 15, 12, 0) 100%
    );
  }

  .brand-lockup {
    bottom: calc(clamp(30px, 5.2svh, 52px) + env(safe-area-inset-bottom, 0px));
  }

  .brand-logo {
    width: clamp(144px, 41vw, 186px);
  }

  .brand-status {
    margin-top: 11px;
    font-size: 10px;
    letter-spacing: 0.34em;
    padding-left: 0.34em;
  }
}

/* Very Short Landscape Mobile Viewports */
@media (max-height: 460px) and (orientation: landscape) {
  .brand-lockup {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .brand-logo {
    width: 136px;
  }

  .brand-status {
    margin-top: 8px;
    font-size: 9px;
  }
}

/* Reduced Motion Accessibility: Static final frame, static fine grain, zero motion */
@media (prefers-reduced-motion: reduce) {
  .campaign-still {
    opacity: 1 !important;
    transition: none;
    animation: none !important;
    transform: scale(1.03) !important;
  }

  .campaign-video,
  .campaign-poster {
    display: none !important;
  }

  .campaign-grain,
  .glass-caustics,
  .glass-refraction {
    animation: none !important;
  }

  .campaign-grain {
    opacity: 0.20;
  }

  .brand-lockup {
    opacity: 1;
    animation: none;
    transform: translateX(-50%);
  }
}
