/* ════════════════════════════════════════
   style.css — Ruchira Edirisinghe Portfolio
   ════════════════════════════════════════ */

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

:root {
  --bg: #02030a;
  --white: #ffffff;
  --muted: rgba(255,255,255,0.72);
  --aurora-color1: rgba(168, 85, 247, 0.2);
  --aurora-color2: rgba(79, 70, 229, 0.2);
}

html, body { width:100%; height:100%; }

body {
  background: var(--bg);
  color: var(--white);
  font-family: 'Montserrat', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── Canvases ── */
#space-canvas, #scatter-canvas, #cursor-canvas {
  position:fixed; inset:0; width:100%; height:100%; pointer-events:none;
}
#space-canvas   { z-index:0; }
#scatter-canvas { z-index:10; opacity:0; }
#cursor-canvas  { z-index:9997; }

/* Grain */
body::before {
  content:''; position:fixed; inset:0; pointer-events:none; z-index:100;
  opacity:0.03;
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size:200px 200px;
}

/* Vignette */
body::after {
  content:''; position:fixed; inset:0; pointer-events:none; z-index:99;
  background:radial-gradient(ellipse at center, transparent 30%, rgba(2,3,10,0.5) 100%);
}

/* ── Layout ── */
.page {
  flex:1; display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  padding:60px 20px 40px; position:relative; z-index:2;
}
.hero {
  position:relative; width:100%; max-width:700px;
  display:flex; flex-direction:column; align-items:center;
}

/* ── Photo ── */
.photo-wrapper {
  width:490px; max-width:90vw; aspect-ratio:1/1;
  border-radius:8px; overflow:hidden; position:relative;
  box-shadow:0 24px 64px rgba(0,0,0,0.65);
  animation:fadeUp 0.9s cubic-bezier(0.22,0.61,0.36,1) forwards;
  opacity:0; transform:translateY(32px);
  will-change:transform,opacity;
}
.photo-wrapper img {
  width:100%; height:100%; object-fit:cover; display:block;
  filter:brightness(0.85) contrast(1.05);
  transition:transform 0.7s cubic-bezier(0.25,0.46,0.45,0.94);
  will-change:transform;
}
.photo-wrapper:hover img { transform:scale(1.04); }

/* ── Hero text group ── */
.hero-text-group {
  display:flex; flex-direction:column; align-items:center;
  position:relative; z-index:2;
}
.subtitle {
  font-size:11px; font-weight:400; letter-spacing:0.22em;
  color:var(--muted); text-transform:uppercase;
  margin-top:-48px;
  animation:fadeUp 0.8s cubic-bezier(0.22,0.61,0.36,1) 0.25s forwards;
  opacity:0; transform:translateY(24px);
  transition:transform 0.38s cubic-bezier(0.34,1.56,0.64,1),
             letter-spacing 0.38s cubic-bezier(0.34,1.56,0.64,1),
             color 0.3s ease;
}
.name {
  font-family:'Great Vibes', cursive;
  font-size:clamp(56px,8vw,96px); color:var(--white);
  line-height:1.1; margin-top:18px; text-align:center;
  animation:fadeUp 0.85s cubic-bezier(0.22,0.61,0.36,1) 0.42s forwards;
  opacity:0; transform:translateY(28px);
  transition:transform 0.38s cubic-bezier(0.34,1.56,0.64,1),
             text-shadow 0.38s ease;
}
.hero-text-group:hover .subtitle {
  transform:translateY(-6px) scale(1.06);
  letter-spacing:0.30em; color:var(--white);
}
.hero-text-group:hover .name {
  transform:scale(1.18) translateY(-6px);
  text-shadow:0 8px 40px rgba(255,255,255,0.16),
              0 2px 16px rgba(200,220,255,0.12);
}

/* ── Buttons ── */
.cta-row {
  display:flex; gap:20px; margin-top:36px;
  flex-wrap:wrap; justify-content:center;
  animation:fadeUp 0.8s cubic-bezier(0.22,0.61,0.36,1) 0.6s forwards;
  opacity:0; transform:translateY(24px);
}
.btn {
  display:inline-flex; align-items:center; gap:10px;
  padding:16px 46px; border-radius:50px;
  font-family:'Montserrat',sans-serif; font-size:13px;
  font-weight:600; letter-spacing:0.15em; text-transform:uppercase;
  text-decoration:none; white-space:nowrap;
  position:relative; overflow:hidden;
  transition:transform 0.4s cubic-bezier(0.34,1.56,0.64,1),
             box-shadow 0.4s ease, letter-spacing 0.4s cubic-bezier(0.34,1.56,0.64,1),
             border-color 0.4s ease, background 0.4s ease;
}
.btn-outline {
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.28); color:#fff;
  backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px);
  box-shadow:0 4px 20px rgba(0,0,0,0.2),
             inset 0 1px 0 rgba(255,255,255,0.2),
             inset 0 -1px 0 rgba(255,255,255,0.05);
}
.btn-outline:hover {
  transform:translateY(-4px) scale(1.04); letter-spacing:0.22em;
  border-color:rgba(255,255,255,0.5); background:rgba(255,255,255,0.1);
  box-shadow:0 12px 32px rgba(0,0,0,0.28),0 0 24px rgba(160,210,255,0.15),
             inset 0 1px 0 rgba(255,255,255,0.28);
}
.btn-solid {
  background:#ffffff; border:1px solid rgba(255,255,255,0.9); color:#0a0b14;
  box-shadow:0 4px 20px rgba(255,255,255,0.1),0 2px 8px rgba(0,0,0,0.28);
}
.btn-solid:hover {
  transform:translateY(-4px) scale(1.04); letter-spacing:0.22em;
  background:#f0f4ff;
  box-shadow:0 12px 32px rgba(255,255,255,0.18),0 4px 16px rgba(0,0,0,0.22);
}

/* Shimmer sweep */
.btn::before {
  content:''; position:absolute; top:-60%; left:-80%;
  width:55%; height:220%;
  background:linear-gradient(105deg,rgba(255,255,255,0) 0%,rgba(255,255,255,0.2) 50%,rgba(255,255,255,0) 100%);
  transform:skewX(-15deg);
  transition:left 0.5s cubic-bezier(0.25,0.46,0.45,0.94);
  pointer-events:none;
}
.btn-solid::before { background:linear-gradient(105deg,rgba(255,255,255,0) 0%,rgba(255,255,255,0.38) 50%,rgba(255,255,255,0) 100%); }
.btn:hover::before { left:130%; }
.btn::after {
  content:''; position:absolute; top:0; left:12%; right:12%; height:1px;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,0.55),transparent);
  pointer-events:none;
}
.btn-solid::after { background:linear-gradient(90deg,transparent,rgba(255,255,255,0.85),transparent); }
.btn svg { width:16px; height:16px; }

/* ── Footer ── */
footer {
  display:flex; align-items:center; justify-content:space-between;
  padding:20px 40px 28px; position:relative; z-index:200;
  animation:fadeUp 0.8s cubic-bezier(0.22,0.61,0.36,1) 0.75s forwards;
  opacity:0; transform:translateY(20px);
}
.social-links { display:flex; gap:16px; align-items:center; }
.social-links a {
  color:rgba(255,255,255,0.55);
  transition:color 0.4s ease, transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  display:flex; align-items:center;
}
.social-links a:hover { color:#fff; transform:translateY(-3px) scale(1.15); }
.social-links svg { width:20px; height:20px; fill:currentColor; }
.copyright {
  font-size:10px; letter-spacing:0.18em;
  color:rgba(255,255,255,0.4); text-transform:uppercase;
}

/* ── Menu overlay ── */
#menu-overlay {
  position:fixed; inset:0; z-index:50;
  pointer-events:none; opacity:0;
  display:flex; align-items:center; justify-content:center;
  transition:opacity 0.4s ease;
}
#menu-overlay.visible { pointer-events:all; }
.menu-nav { display:flex; flex-direction:column; align-items:center; gap:18px; }
.menu-item {
  display:flex; flex-direction:column; align-items:center;
  text-decoration:none; padding:10px 48px;
  position:relative; opacity:0; transform:scale(0.2);
  background:transparent; border:none;
  white-space:nowrap; text-align:center;
  transition:transform 0.38s cubic-bezier(0.34,1.56,0.64,1);
}
.menu-item:hover { transform:translateY(-3px) scale(1.04); }
.menu-item-title {
  font-family:'Great Vibes', cursive;
  font-size:clamp(38px,5.5vw,70px); font-weight:400;
  color:rgba(255,255,255,0.9); line-height:1.1;
  letter-spacing:0.02em; text-transform:none;
  transition:color 0.38s ease, text-shadow 0.38s ease,
             letter-spacing 0.45s cubic-bezier(0.34,1.56,0.64,1);
}
.menu-item:hover .menu-item-title {
  color:#fff; letter-spacing:0.07em;
  text-shadow:0 0 16px rgba(140,215,255,0.9),
              0 0 40px rgba(80,165,255,0.55),
              0 0 80px rgba(60,120,255,0.28);
}
.menu-item-desc {
  font-family:'Montserrat', sans-serif;
  font-size:clamp(10px,1.1vw,12px); font-weight:400;
  color:rgba(255,255,255,0.35); letter-spacing:0.14em;
  text-transform:uppercase; margin-top:2px;
  transition:color 0.38s ease, transform 0.38s cubic-bezier(0.34,1.56,0.64,1);
}
.menu-item:hover .menu-item-desc {
  color:rgba(255,255,255,0.62); transform:translateY(-1px);
}

@keyframes menuPop {
  0%   { opacity:0; transform:scale(0.2); filter:blur(12px); }
  50%  { opacity:1; transform:scale(1.08); filter:blur(0px); }
  70%  { transform:scale(0.97); }
  85%  { transform:scale(1.02); }
  100% { opacity:1; transform:scale(1); filter:blur(0px); }
}
@keyframes menuShrink {
  0%   { opacity:1; transform:scale(1);   filter:blur(0px); }
  15%  { transform:scale(1.03); }
  30%  { transform:scale(0.96); }
  100% { opacity:0; transform:scale(0.2); filter:blur(12px); }
}

/* ── Close button ── */
#menu-close {
  position:fixed; top:32px; right:36px; z-index:201;
  background:rgba(255,255,255,0.07); border:1px solid rgba(255,255,255,0.16);
  color:#fff; width:46px; height:46px; border-radius:50%;
  font-size:18px; display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none;
  transition:opacity 0.4s ease, background 0.3s ease,
             transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
}
#menu-close svg {
  width:20px; height:20px;
  fill:none; stroke:currentColor;
  stroke-width:2.5; stroke-linecap:round; stroke-linejoin:round;
}
#menu-close.visible { opacity:1; pointer-events:all; }
#menu-close:hover { background:rgba(255,255,255,0.15); transform:rotate(90deg) scale(1.1); }

/* ── Hero elements base transitions (always smooth) ── */
.photo-wrapper {
  transition:opacity 0.55s cubic-bezier(0.25,0.46,0.45,0.94),
             transform 0.55s cubic-bezier(0.25,0.46,0.45,0.94) !important;
}
.subtitle {
  transition:opacity 0.45s cubic-bezier(0.25,0.46,0.45,0.94) 0.05s,
             transform 0.45s cubic-bezier(0.25,0.46,0.45,0.94) 0.05s,
             letter-spacing 0.38s cubic-bezier(0.34,1.56,0.64,1),
             color 0.3s ease !important;
}
.name {
  transition:opacity 0.45s cubic-bezier(0.25,0.46,0.45,0.94) 0.1s,
             transform 0.45s cubic-bezier(0.25,0.46,0.45,0.94) 0.1s,
             text-shadow 0.38s ease !important;
}
.cta-row {
  transition:opacity 0.4s cubic-bezier(0.25,0.46,0.45,0.94) 0.15s,
             transform 0.4s cubic-bezier(0.25,0.46,0.45,0.94) 0.15s !important;
}

/* ── Exploded: drift up + fade ── */
body.exploded .photo-wrapper {
  opacity:0 !important; pointer-events:none;
  transform:scale(0.96) translateY(-18px) !important;
}
body.exploded .subtitle {
  opacity:0 !important; pointer-events:none;
  transform:translateY(-12px) scale(0.95) !important;
}
body.exploded .name {
  opacity:0 !important; pointer-events:none;
  transform:scale(0.94) translateY(-16px) !important;
}
body.exploded .cta-row {
  opacity:0 !important; pointer-events:none;
  transform:translateY(-10px) scale(0.96) !important;
}

/* ── Button active press ── */
.btn:active {
  transform: translateY(-1px) scale(0.97) !important;
  transition: transform 0.1s ease !important;
}

/* ── Ripple effect on buttons ── */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255,255,255,0.35);
  pointer-events: none;
  animation: rippleAnim 0.6s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}
.btn-solid .ripple {
  background: rgba(10,11,20,0.15);
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ── Global click particle burst ── */
.click-particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  transform: translate(-50%, -50%) scale(1);
  animation: particleBurst 0.55s cubic-bezier(0.25,0.46,0.45,0.94) forwards;
}
@keyframes particleBurst {
  0%   { opacity: 0.8; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0;   transform: translate(var(--tx), var(--ty)) scale(0); }
}

/* ── Music toggle button ── */
#music-btn {
  position: fixed;
  top: 28px; left: 36px;
  z-index: 201;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background 0.3s ease, transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  animation: fadeUp 0.8s cubic-bezier(0.22,0.61,0.36,1) 1.1s forwards;
  opacity: 0;
}
#music-btn:hover { background: rgba(255,255,255,0.15); transform: scale(1.1); }
#spectrum-canvas { display: block; }
#music-btn.playing {
  animation: musicPulse 2s ease infinite, fadeUp 0.8s cubic-bezier(0.22,0.61,0.36,1) 1.1s forwards;
}
@keyframes musicPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.4); }
  70%  { box-shadow: 0 0 0 12px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

#cursor-dot {
  position:fixed; top:0; left:0; width:5px; height:5px;
  background:#fff; border-radius:50%; pointer-events:none; z-index:9999;
  transform:translate(-50%,-50%); transition:opacity 0.4s ease;
}

/* ── Keyframes ── */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(32px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes heroReturn {
  0%   { opacity:0; transform:translateY(20px) scale(0.95); filter:blur(4px); }
  60%  { opacity:1; filter:blur(0px); }
  80%  { transform:translateY(-4px) scale(1.01); }
  100% { opacity:1; transform:translateY(0) scale(1); filter:blur(0px); }
}

/* ══════════════════════════════════
   WATER FILL PRELOADER
══════════════════════════════════ */
#preloader {
  position:fixed; inset:0; z-index:99999;
  background:#000;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:32px;
  overflow: hidden;
}

.aurora-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.aurora-bg-pulse {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: 
    radial-gradient(circle, var(--aurora-color1) 0%, transparent 80%),
    radial-gradient(circle, var(--aurora-color2) 0%, transparent 80%);
  background-size: 100% 100%;
  animation: aurora-pulse 10s infinite;
}

.aurora-blob {
  position: absolute;
  width: 50%;
  height: 50%;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  mix-blend-mode: screen;
}

.blob-1 { top: -25%; left: -25%; background: #9333ea; animation: blob-move-1 30s infinite alternate ease-in-out; }
.blob-2 { bottom: -25%; right: -25%; background: #c026d3; animation: blob-move-2 40s infinite alternate ease-in-out; }
.blob-3 { top: 33%; left: 33%; width: 33%; height: 33%; background: #4338ca; animation: blob-move-3 50s infinite alternate ease-in-out; opacity: 0.3; }

.preloader-content { position: relative; z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 32px; }

.preloader-star { position: absolute; width: 2px; height: 2px; background: #fff; border-radius: 50%; opacity: 0; }

@keyframes aurora-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes blob-move-1 {
  0% { transform: translate(-50px, -20px) scale(1); }
  50% { transform: translate(50px, 20px) scale(1.2); }
  100% { transform: translate(-50px, -20px) scale(1); }
}

@keyframes blob-move-2 {
  0% { transform: translate(50px, 20px) scale(1); }
  50% { transform: translate(-50px, -20px) scale(1.3); }
  100% { transform: translate(50px, 20px) scale(1); }
}

@keyframes blob-move-3 {
  0% { transform: translate(20px, -30px) rotate(0deg); }
  50% { transform: translate(-20px, 30px) rotate(180deg); }
  100% { transform: translate(20px, -30px) rotate(360deg); }
}

@keyframes star-twinkle {
  0%, 100% { opacity: 0; }
  50% { opacity: var(--star-opacity, 0.8); }
}

#preloader-canvas {
  display:block;
  width: min(500px, 72vw);
  height: auto;
}

/* Progress bar track */
#progress-track {
  width: min(500px, 72vw);
  height: 2px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

/* Glowing fill line */
#progress-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0%;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255,255,255,0.8),
              0 0 20px rgba(255,255,255,0.3);
  transition: none;
}

/* ── Split screen panels (for reveal) ── */
#split-top, #split-bottom {
  position:fixed; left:0; right:0; z-index:99998;
  background:#02030a;
  transition: transform 0.85s cubic-bezier(0.76,0,0.24,1);
}
#split-top    { top:0; height:50%; transform:translateY(0); }
#split-bottom { bottom:0; height:50%; transform:translateY(0); }
#split-top.open    { transform:translateY(-100%); }
#split-bottom.open { transform:translateY(100%); }
#split-top.gone, #split-bottom.gone { display:none; }

/* Desktop: standalone vibe line hidden; inline span visible */
.subtitle-vibe { display:none; }
.vibe-inline   { display:inline; }

/* Desktop only — extra breathing room between subtitle and name */
@media (min-width:601px) {
  .name { margin-top:36px; }
}

@media (max-width:600px) {
  .photo-wrapper { width:85vw; }
  footer { padding:16px 24px 24px; }
  .cta-row { gap:12px; }
  .btn { padding:14px 32px; font-size:11px; }
  .menu-item-title { font-size:clamp(30px,8vw,48px); }

  /* Hide the inline portion on mobile */
  .vibe-inline { display:none; }

  /* Show and animate the dedicated mobile line */
  .subtitle-vibe {
    display:block;
    margin-top:6px;
    animation:fadeUp 0.8s cubic-bezier(0.22,0.61,0.36,1) 0.35s forwards;
  }
}
