/* ================================================================
   style.css — For You, Siyuu 💕
   Two-scene romantic experience: Galaxy → Outro
   Built by Sarshij Karn
   ================================================================ */

/* ── GOOGLE FONT loaded via HTML ── */

/* ── 1. TOKENS ── */
:root {
  --bg:          #06030f;
  --rose:        #e8678a;
  --gold:        #f0c070;
  --purple:      #b06dca;
  --pink-lt:     #ffd6e7;
  --text:        #f0e8f8;
  --muted:       #9a8ab0;
  --dim:         #4a3f5c;

  --serif:       'Cormorant Garamond', Georgia, serif;
  --display:     'Playfair Display', Georgia, serif;
  --script:      'Dancing Script', cursive;

  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── 2. RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  /* snap the two scenes */
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-weight: 300;
  overflow-x: hidden;
  /* custom cursor only on devices that can hover */
  cursor: none;
}

/* Restore default cursor on touch-only devices */
@media (hover: none) {
  body { cursor: auto; }
}

/* ── 3. ACCESS GATE (PRIVATE ENTRY) ── */
.access-gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1s var(--ease-out), visibility 1s;
}

.access-gate.unlocked {
  opacity: 0;
  visibility: hidden;
}

.gate-content {
  text-align: center;
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  animation: slide-up 1.2s var(--ease-out) both;
}

.gate-label {
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.gate-title {
  font-family: var(--display);
  font-size: 2.5rem;
  margin-bottom: 2rem;
}

.gate-input-wrapper {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--dim);
  border-radius: 50px;
  padding: 4px;
  transition: border-color 0.3s;
}

.gate-input-wrapper:focus-within {
  border-color: var(--rose);
  box-shadow: 0 0 15px rgba(232, 103, 138, 0.2);
}

#gateInput {
  background: none;
  border: none;
  padding: 0.8rem 1.5rem;
  color: #fff;
  font-family: var(--serif);
  font-size: 1.1rem;
  flex: 1;
  outline: none;
  width: 100%;
}

#gateBtn {
  background: var(--rose);
  color: #fff;
  border: none;
  padding: 0 1.8rem;
  border-radius: 50px;
  font-family: var(--display);
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

#gateBtn:hover {
  background: #f0c070;
  transform: scale(1.05);
}

.gate-error {
  color: var(--rose);
  font-size: 0.9rem;
  margin-top: 1rem;
  min-height: 1.2rem;
  font-style: italic;
}

/* ── 4. CUSTOM CURSOR (desktop only) ── */
.cursor {
  display: none; /* shown via JS only if hover media matches */
  position: fixed;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 12px var(--rose), 0 0 24px rgba(232,103,138,0.4);
  pointer-events: none;
  z-index: 9000;
  transform: translate(-50%, -50%);
  /* smoothed with JS lerp — no CSS transition needed */
  will-change: left, top;
}

/* ── 4. GLOBAL CANVAS ── */
#bgCanvas {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ── 5. AUDIO BUTTON ── */
.audio-btn {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 800;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(232,103,138,0.3);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.25s, transform 0.25s;
  /* usable on touch */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.audio-btn:hover, .audio-btn:active {
  background: rgba(232,103,138,0.18);
  transform: scale(1.1);
}

/* ── 6. SCENES (full-viewport) ── */
.scene {
  position: relative;
  width: 100%;
  min-height: 100svh;   /* svh = small viewport height — correct on mobile */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  scroll-snap-align: start;
  z-index: 1;
}

/* ── AMBIENT GLOW ORBS (placed absolutely) ── */
.glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0;
  animation: glow-in 2s 0.5s var(--ease-out) forwards;
}

.glow--rose {
  width: clamp(300px, 55vw, 600px);
  height: clamp(300px, 55vw, 600px);
  background: radial-gradient(circle, rgba(232,103,138,0.18) 0%, transparent 70%);
  top: -10%; right: -10%;
}

.glow--purple {
  width: clamp(250px, 45vw, 500px);
  height: clamp(250px, 45vw, 500px);
  background: radial-gradient(circle, rgba(176,109,202,0.14) 0%, transparent 70%);
  bottom: 5%; left: -5%;
  animation-delay: 1s;
}

@keyframes glow-in {
  to { opacity: 1; }
}

/* ════════════════════════════════════════════════
   SCENE 1 — GALAXY
   ════════════════════════════════════════════════ */
.scene--galaxy {
  background: radial-gradient(ellipse 100% 90% at 50% 45%, #0e0520 0%, #06030f 70%);
  flex-direction: column;
}

.galaxy-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(1.5rem, 5vw, 3rem) clamp(1rem, 4vw, 2rem);
  gap: 0;
  /* slide-up on load */
  animation: slide-up 1.2s var(--ease-out) both;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.galaxy-eyebrow {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(0.78rem, 2.5vw, 0.95rem);
  color: var(--muted);
  letter-spacing: 0.12em;
  margin-bottom: 0.9rem;
  animation: slide-up 1.2s 0.15s both;
}

.galaxy-title {
  font-family: var(--display);
  font-size: clamp(2.6rem, 9vw, 6rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 0.6rem;
  animation: slide-up 1.2s 0.28s both;
}

.galaxy-title em {
  font-style: italic;
  /* gradient text */
  background: linear-gradient(120deg, var(--rose) 0%, var(--gold) 55%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.galaxy-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--muted);
  margin-bottom: 1.6rem;
  animation: slide-up 1.2s 0.4s both;
}

/* ── STAR-WRAP: positions timer behind + star-field in front ── */
.star-wrap {
  position: relative;           /* stacking context for children */
  width: min(380px, 88vw);
  height: min(360px, 84vw);
  flex-shrink: 0;
  margin-bottom: 1rem;
  animation: slide-up 1.4s 0.55s both;
}

/* Timer — sits at z-index 0, blurred & subtle so stars shine above */
.timer-bg {
  position: absolute;
  inset: 0;
  z-index: 0;                   /* behind .star-field (z:1) */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.2rem;
  border-radius: 50%;           /* matches the heart's bounding circle */
  pointer-events: none;
}

.timer-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(0.62rem, 1.8vw, 0.78rem);
  color: rgba(232,103,138,0.55);
  letter-spacing: 0.06em;
  text-align: center;
  line-height: 1.3;
  margin-bottom: 0.3rem;
}

.timer-digits {
  display: flex;
  align-items: flex-start;
  gap: clamp(4px, 1.5vw, 10px);
}

.timer-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

/* Large timer numbers — semi-transparent so stars read on top */
.t-num {
  font-family: var(--display);
  font-size: clamp(1.4rem, 6vw, 2.6rem);
  font-weight: 700;
  color: rgba(240,192,112,0.55); /* gold, dimmed */
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 0 20px rgba(240,192,112,0.3);
}

.t-sub {
  font-family: var(--serif);
  font-size: clamp(0.45rem, 1.2vw, 0.6rem);
  color: rgba(154,138,176,0.45);
  letter-spacing: 0.18em;
}

.timer-sep {
  font-family: var(--display);
  font-size: clamp(1.2rem, 5vw, 2.2rem);
  color: rgba(232,103,138,0.35);
  line-height: 1.2;
  align-self: flex-start;
  padding-top: 2px;
}

.timer-since {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(0.55rem, 1.5vw, 0.7rem);
  color: rgba(232,103,138,0.4);
  text-align: center;
  margin-top: 0.3rem;
  letter-spacing: 0.04em;
}

/* ── STAR FIELD — floats above the timer ── */
.star-field {
  position: absolute;           /* fills .star-wrap exactly */
  inset: 0;
  z-index: 1;                   /* above .timer-bg */
  pointer-events: auto;         /* stars stay clickable */
}

/* Individual star dots — styled via JS inline */
.s {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  will-change: transform, opacity;
  /* twinkling via JS-assigned animation */
  animation: twinkle var(--d, 2s) var(--dl, 0s) ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: var(--lo, 0.4); transform: translate(-50%,-50%) scale(1); }
  50%       { opacity: 1;             transform: translate(-50%,-50%) scale(1.5); }
}

.galaxy-caption {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(0.75rem, 2.2vw, 0.88rem);
  color: var(--dim);
  letter-spacing: 0.12em;
  animation: slide-up 1.4s 0.7s both;
}

/* ── SCROLL CUE (chevron arrow) ── */
.scroll-cue {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.35;
  animation: cue-bounce 2s ease-in-out infinite;
}

.scroll-cue span {
  display: block;
  width: 16px; height: 16px;
  border-right: 2px solid var(--rose);
  border-bottom: 2px solid var(--rose);
  transform: rotate(45deg);
}

.scroll-cue span:first-child { opacity: 0.5; }

@keyframes cue-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(7px); }
}

/* ════════════════════════════════════════════════
   SCENE 2 — OUTRO
   ════════════════════════════════════════════════ */
.scene--outro {
  background: radial-gradient(ellipse 90% 90% at 50% 50%, #100320 0%, #04020a 70%);
}

/* Full-scene heart canvas */
#heartCanvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.outro-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: clamp(1.5rem, 5vw, 3rem) clamp(1rem, 4vw, 2rem);
  opacity: 0;
  animation: slide-up 1.4s 0.4s var(--ease-out) forwards;
}

.outro-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  color: var(--muted);
  letter-spacing: 0.12em;
  margin-bottom: 1.4rem;
}

.outro-title {
  font-family: var(--display);
  font-size: clamp(2.8rem, 10vw, 6.5rem);
  font-weight: 400;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 1.4rem;
}

.outro-name {
  display: block;
  font-style: italic;
  font-weight: 700;
  background: linear-gradient(110deg, var(--rose) 0%, var(--gold) 60%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.outro-sig {
  font-family: var(--script);
  font-size: clamp(1.1rem, 3.5vw, 1.6rem);
  color: var(--muted);
}

/* ── FLOATING HEARTS stage ── */
.hearts-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Each floating heart — animated via JS-set CSS vars */
.fh {
  position: absolute;
  bottom: -10%;
  font-size: var(--sz, 1rem);
  left: var(--lft, 50%);
  animation: rise var(--dur, 7s) var(--dl, 0s) ease-in both;
  pointer-events: none;
  user-select: none;
}

@keyframes rise {
  0%   { opacity: 0;   transform: translateY(0)  scale(0.7) rotate(var(--rot, 0deg)); }
  10%  { opacity: 0.9; }
  90%  { opacity: 0.6; }
  100% { opacity: 0;   transform: translateY(-105vh) scale(1.1) rotate(var(--rot2, 10deg)); }
}

/* ── UTIL: visually hidden (accessibility) ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}
