/* Anand & Palak — Roka invitation. Base, layout, layer positioning, controls. */
:root {
  --canvas-w: 1080;
  --canvas-h: 1920;
  --letterbox: #16110d;
  --gold: #c9a45a;
  --focus: #ffd27a;
}

* { box-sizing: border-box; }

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

/* Fallback mode only: CSS scroll-snap between stacked slides. In journey mode the
   sections are pinned and ScrollTrigger owns snapping, so this must not apply. */
html:not(.journey-mode) { scroll-snap-type: y mandatory; }

body {
  margin: 0;
  background: var(--letterbox);
  color: #f4ead6;
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* --- Slides & stage ------------------------------------------------------ */
.invite { display: block; }

.slide {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Snap alignment belongs to fallback mode only (see html:not(.journey-mode) above). */
html:not(.journey-mode) .slide { scroll-snap-align: center; }

/* Stage keeps the exact PSD aspect ratio and shows the whole design (no crop). */
.stage {
  position: relative;
  width: min(100vw, calc(100svh * var(--canvas-w) / var(--canvas-h)));
  aspect-ratio: var(--canvas-w) / var(--canvas-h);
  overflow: hidden;
  background: var(--letterbox);
  box-shadow: 0 30px 90px -30px rgba(0, 0, 0, 0.8);
}

/* Per-slide tone so the composite base decodes over a matching colour, not black. */
.stage--slide1 { background: #3a2c1e; }
.stage--slide2 { background: #16110f; }
.stage--slide3 { background: #0d1425; }

/* --- Layers -------------------------------------------------------------- */
.ly {
  position: absolute;
  display: block;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.ly.base {
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Motion stack: .plx (parallax) > .jny (scroll-journey) > .enter (entrance) > img (ambient/reveal).
   Four independent transform channels so effects compose instead of clobbering. */
.plx { position: absolute; }
.plx > .jny { position: absolute; inset: 0; width: 100%; height: 100%; }
.plx .enter { position: absolute; inset: 0; width: 100%; height: 100%; }
.plx img.ly { position: absolute; inset: 0; width: 100%; height: 100%; }

.hero { will-change: transform, opacity, filter; }

/* --- Music toggle -------------------------------------------------------- */
.music-toggle {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 50;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(201, 164, 90, 0.6);
  background: rgba(22, 17, 13, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--gold);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.music-toggle:hover { transform: scale(1.06); }
.music-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.music-toggle__icon {
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: center / contain no-repeat var(--spk);
  mask: center / contain no-repeat var(--spk);
  --spk: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 9v6h4l5 5V4L8 9H4z" fill="black"/><path d="M16 8a5 5 0 0 1 0 8M18.5 5.5a9 9 0 0 1 0 13" stroke="black" stroke-width="1.8" fill="none" stroke-linecap="round"/></svg>');
  position: relative;
}
/* Muted state (default / paused): show a slash */
.music-toggle[aria-pressed="false"] .music-toggle__icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  -webkit-mask: center / contain no-repeat var(--slash);
  mask: center / contain no-repeat var(--slash);
  --slash: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 3l18 18" stroke="black" stroke-width="2" stroke-linecap="round"/></svg>');
}
.music-toggle.is-playing { box-shadow: 0 0 0 4px rgba(201, 164, 90, 0.14); }

/* --- Scroll cue (first screen) ------------------------------------------ */
.scroll-cue {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 2px solid rgba(244, 234, 214, 0.55);
  border-radius: 14px;
  z-index: 40;
  transition: opacity 0.4s ease;
}
.scroll-cue span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: rgba(244, 234, 214, 0.85);
  animation: scroll-cue 1.8s ease-in-out infinite;
}
.scroll-cue.is-hidden { opacity: 0; pointer-events: none; }
@keyframes scroll-cue {
  0% { transform: translateY(0); opacity: 0; }
  30% { opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { opacity: 0; }
}

/* --- Utilities ----------------------------------------------------------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed;
  left: 8px; top: -60px;
  z-index: 100;
  background: #16110d;
  color: var(--gold);
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 8px; }

/* Larger screens: give the portrait canvas breathing room */
@media (min-width: 700px) {
  .stage { width: min(calc(100svh * var(--canvas-w) / var(--canvas-h)), 46vw); }
}
