/* ==========================================================================
   Eden · Miasma Hollow — Y2K aquacore room
   ========================================================================== */

:root {
  /* palette */
  --abyss: #021238;
  --deep: #062a66;
  --ocean: #0a8fc4;
  --aqua: #3fd0ff;
  --cyan: #8eeaff;
  --foam: #ecfdff;
  --lime: #a4f25a;
  --ink: #06284a;
  --paper: #fbfdfd;

  /* type */
  --font-display: "Audiowide", system-ui, sans-serif;
  --font-mono: "Share Tech Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* spacing scale (4pt) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* radii */
  --r-sm: 3px; --r-md: 12px; --r-lg: 22px; --r-pill: 999px;

  /* elevation */
  --shadow-photo:
    0 1px 1px rgba(2, 18, 56, .10),
    0 6px 14px -4px rgba(2, 18, 56, .35),
    0 22px 40px -16px rgba(2, 18, 56, .55);
  --shadow-photo-lift:
    0 2px 2px rgba(2, 18, 56, .10),
    0 14px 24px -6px rgba(2, 18, 56, .40),
    0 40px 60px -20px rgba(2, 18, 56, .60);
  --glow-aqua: 0 0 0 1px rgba(142, 234, 255, .22), 0 0 48px rgba(63, 208, 255, .28);

  /* motion */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .5, 1);
  --t-fast: 160ms;
  --t-med: 320ms;

  --room-img: image-set(url("/assets/img/room.webp") type("image/webp"), url("/assets/img/room.jpg") type("image/jpeg"));
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--abyss);
  color: var(--foam);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 4px;
}

/* ---------- room ---------------------------------------------------------- */

.room {
  position: relative;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.room__backdrop {
  position: absolute;
  inset: -60px;
  z-index: -2;
  background: url("/assets/img/room.jpg") center / cover;
  background: var(--room-img) center / cover;
  filter: blur(36px) saturate(1.25) brightness(.62);
  transform: scale(1.05);
}

/* soft vignette + depth tint over everything behind the content */
.room::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 40%, rgba(2, 10, 40, .55) 100%),
    linear-gradient(180deg, rgba(2, 18, 56, .25), transparent 30%, transparent 70%, rgba(2, 18, 56, .45));
}

/* tasteful film grain */
.room::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: .07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.room__stage {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 0;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 415 / 739;
  transform: translate(-50%, -50%);
  background: url("/assets/img/room.jpg") center / cover;
  background: var(--room-img) center / cover;
  box-shadow: var(--glow-aqua);
}

/* inner sheen on the stage — reads like glass over the photo */
.room__stage::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .14), transparent 28%),
    radial-gradient(90% 60% at 50% 50%, transparent 55%, rgba(2, 14, 50, .35) 100%);
  box-shadow: inset 0 0 0 1px rgba(236, 253, 255, .18);
}

@media (min-aspect-ratio: 3/4) {
  .room__stage {
    height: calc(100% - var(--s-7));
    border-radius: var(--r-lg);
  }
}

/* ---------- hero title ---------------------------------------------------- */

.hero {
  position: absolute;
  top: 47%;
  left: 50%;
  z-index: 8;
  width: 100%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.hero .hero__title { pointer-events: auto; cursor: default; }
.hero__title { pointer-events: auto; cursor: pointer; }

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0 0 var(--s-2);
  padding: var(--s-1) var(--s-4);
  border-radius: var(--r-pill);
  font-size: clamp(11px, 1vw, 13px);
  letter-spacing: .42em;
  text-transform: uppercase;
  text-indent: .42em;
  color: var(--foam);
  background: rgba(4, 30, 80, .32);
  border: 1px solid rgba(236, 253, 255, .22);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  text-shadow: 0 1px 2px rgba(2, 18, 56, .6);
}

.hero__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
}

.hero__title {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(84px, 15vw, 224px);
  line-height: .95;
  letter-spacing: -.01em;
  color: transparent;
  background: linear-gradient(180deg,
      #ffffff 0%,
      #e6fcff 34%,
      var(--cyan) 47%,
      var(--ocean) 53%,
      #39c2d6 74%,
      var(--lime) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, .85);
  filter:
    drop-shadow(0 2px 0 rgba(2, 18, 56, .45))
    drop-shadow(0 14px 28px rgba(2, 18, 56, .55))
    drop-shadow(0 0 22px rgba(164, 242, 90, .38));
  animation: float 7s ease-in-out infinite;
}

/* a single specular streak across the chrome */
.hero__title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: transparent;
  -webkit-text-stroke: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .85) 48%, transparent 58%) no-repeat;
  background-size: 250% 100%;
  background-position: 120% 0;
  -webkit-background-clip: text;
  background-clip: text;
  animation: sheen 9s var(--ease-out) 1.2s infinite;
}

@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes sheen { 0%, 70% { background-position: 120% 0; } 100% { background-position: -20% 0; } }

/* ---------- polaroids ----------------------------------------------------- */

.gallery { position: absolute; inset: 0; z-index: 3; }

.polaroid {
  --rot: 0deg;
  position: absolute;
  margin: 0;
  --pad: clamp(5px, .5vw, 9px);
  padding: var(--pad) var(--pad) calc(var(--pad) * 3.2);
  min-width: 72px;
  background:
    linear-gradient(170deg, #ffffff, var(--paper) 60%, #eef6f8);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-photo);
  transform: rotate(var(--rot));
  transition:
    transform var(--t-med) var(--ease-spring),
    box-shadow var(--t-med) var(--ease-out);
  animation: settle .7s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 45ms + 150ms);
}

.polaroid:hover,
.polaroid:focus-within {
  z-index: 6;
  transform: rotate(0deg) translateY(-6px) scale(1.06);
  box-shadow: var(--shadow-photo-lift);
}

/* washi tape */
.polaroid::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  z-index: 2;
  width: 44%;
  height: 18px;
  transform: translateX(-50%) rotate(calc(var(--rot) * -1 - 2deg));
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .18) 0 4px, transparent 4px 8px),
    linear-gradient(rgba(178, 240, 255, .78), rgba(140, 226, 250, .7));
  box-shadow: 0 1px 2px rgba(2, 18, 56, .18);
  clip-path: polygon(0 0, 100% 0, 98% 25%, 100% 50%, 98% 75%, 100% 100%, 0 100%, 2% 75%, 0 50%, 2% 25%);
  opacity: .92;
}

.polaroid__frame {
  position: relative;
  overflow: hidden;
  background: linear-gradient(var(--foam), var(--aqua));
  box-shadow: inset 0 0 0 1px rgba(2, 18, 56, .08);
}

.polaroid__frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* glossy print */
.polaroid__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, .32), transparent 42%);
}

@keyframes settle {
  from { opacity: 0; transform: rotate(calc(var(--rot) * 2)) translateY(14px) scale(.96); }
}

/* --- the secret card --- */
.polaroid--flip { cursor: pointer; perspective: 800px; }

.polaroid--flip button {
  all: unset;
  display: block;
  width: 100%;
  cursor: pointer;
}

.polaroid--flip button:focus-visible { outline: 2px solid var(--lime); outline-offset: 6px; }

.polaroid__flipper {
  position: relative;
  transform-style: preserve-3d;
  transition: transform .8s var(--ease-spring);
}

.polaroid--flip.is-flipped .polaroid__flipper { transform: rotateY(180deg); }

.polaroid--flip.is-nudged .polaroid__flipper { animation: nudge .35s var(--ease-out); }
@keyframes nudge { 40% { transform: rotateY(-14deg); } }

.polaroid__frame,
.polaroid__back {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.polaroid__back {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--s-3);
  transform: rotateY(180deg);
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(12px, 1.6vw, 22px);
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 2px 6px rgba(2, 40, 90, .55);
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, .55), transparent 46%),
    linear-gradient(180deg, var(--cyan), var(--ocean) 62%, #3fc3a0);
}

/* ---------- bubbles + fish ------------------------------------------------ */

.fx { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden; }

.bubble {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 255, 255, .95) 0 6%, rgba(255, 255, 255, .35) 14%, transparent 36%),
    radial-gradient(circle at 70% 78%, rgba(164, 242, 90, .22), transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(142, 234, 255, .06) 55%, rgba(142, 234, 255, .38) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(236, 253, 255, .55),
    inset 0 -6px 12px rgba(255, 255, 255, .22),
    0 0 14px rgba(142, 234, 255, .25);
  will-change: transform, opacity;
  transform: translate3d(-9999px, -9999px, 0);
}

.ring {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  border: 1.5px solid rgba(236, 253, 255, .95);
  pointer-events: none;
  animation: ring .45s var(--ease-out) forwards;
}
@keyframes ring { to { transform: scale(8); opacity: 0; } }

.fish {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(72px, 8.5vw, 128px);
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 8px 12px rgba(2, 30, 80, .45));
  will-change: transform;
  background: transparent;
  border: 0;
  padding: 0;
}
.fish img { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; -webkit-user-drag: none; }

/* caustic light wash over the room photo */
.caustics {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: .35;
  background:
    radial-gradient(30% 20% at 20% 30%, rgba(142, 234, 255, .55), transparent 60%),
    radial-gradient(25% 18% at 70% 55%, rgba(164, 242, 90, .35), transparent 55%),
    radial-gradient(40% 25% at 45% 75%, rgba(63, 208, 255, .4), transparent 60%);
  background-size: 140% 140%;
  animation: caustics 14s ease-in-out infinite alternate;
}
@keyframes caustics {
  from { background-position: 0% 20%, 80% 40%, 40% 80%; }
  to { background-position: 30% 60%, 40% 10%, 70% 30%; }
}

.jelly {
  position: absolute;
  top: 0; left: 0;
  width: clamp(36px, 4vw, 56px);
  pointer-events: none;
  opacity: .72;
  filter: drop-shadow(0 0 10px rgba(255, 120, 200, .35));
  will-change: transform;
}
.jelly svg { display: block; width: 100%; height: auto; }

.spark {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px 2px rgba(164, 242, 90, .8);
  pointer-events: none;
  animation: spark .9s var(--ease-out) forwards;
}
@keyframes spark {
  to { transform: translate(var(--sx), var(--sy)) scale(0); opacity: 0; }
}

.sonar {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(142, 234, 255, .55);
  pointer-events: none;
  animation: sonar 2.8s var(--ease-out) forwards;
}
@keyframes sonar { to { transform: scale(18); opacity: 0; } }

/* ---------- player -------------------------------------------------------- */

.player {
  position: absolute;
  left: 50%;
  bottom: calc(var(--s-5) + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 6px var(--s-4) 6px 6px;
  transform: translateX(-50%);
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .08));
  border: 1px solid rgba(236, 253, 255, .35);
  box-shadow: 0 10px 30px -8px rgba(2, 18, 56, .6), inset 0 1px 0 rgba(255, 255, 255, .35);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
}

.player__btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 46%),
    linear-gradient(180deg, var(--cyan), var(--ocean) 62%, #3fc3a0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6), inset 0 -4px 8px rgba(0, 60, 120, .35), 0 4px 12px rgba(2, 30, 80, .45);
  transition: transform var(--t-fast) var(--ease-out), filter var(--t-fast);
}
.player__btn:hover { filter: brightness(1.08); transform: scale(1.04); }
.player__btn:active { transform: scale(.96); }
.player__btn svg { width: 22px; height: 22px; fill: currentColor; filter: drop-shadow(0 1px 1px rgba(0, 40, 90, .6)); }
.player__btn .i-pause { display: none; }
.player.is-playing .i-play { display: none; }
.player.is-playing .i-pause { display: block; }

/* idle pulse invites the first tap */
.player:not(.is-playing) .player__btn::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px solid rgba(236, 253, 255, .7);
  animation: pulse 2.4s var(--ease-out) infinite;
}
@keyframes pulse { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }

.player__meta { display: flex; align-items: center; gap: var(--s-3); }

.player__label {
  min-width: 9ch;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--foam);
  text-shadow: 0 1px 2px rgba(2, 18, 56, .6);
}

.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.eq i {
  width: 3px;
  height: 30%;
  border-radius: 1px;
  background: var(--lime);
  box-shadow: 0 0 6px rgba(164, 242, 90, .6);
  transform-origin: bottom;
  transition: height var(--t-med);
}
.player.is-playing .eq i { animation: eq 1s ease-in-out infinite; height: 100%; }
.player.is-playing .eq i:nth-child(2) { animation-delay: -.3s; }
.player.is-playing .eq i:nth-child(3) { animation-delay: -.6s; }
.player.is-playing .eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.noscript {
  position: fixed; bottom: var(--s-4); left: 50%; transform: translateX(-50%);
  margin: 0; padding: var(--s-2) var(--s-4); border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .9); color: var(--ink); font-size: 12px;
}

/* ---------- small screens ------------------------------------------------- */

@media (max-aspect-ratio: 3/4) {
  .hero { top: 45%; }
  .hero__eyebrow { letter-spacing: .32em; text-indent: .32em; }
  .polaroid { --pad: clamp(4px, 1.4vw, 7px); }
  .player { bottom: calc(var(--s-4) + env(safe-area-inset-bottom)); }
}

/* ---------- reduced motion ------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .caustics { animation: none !important; opacity: .2; }
  .hero__title,
  .hero__title::after,
  .polaroid,
  .player .player__btn::after,
  .player.is-playing .eq i { animation: none !important; }
  .polaroid, .polaroid__flipper { transition-duration: 1ms; }
}
