/* ==========================================================================
   3D Scene — click-based navigation
   ========================================================================== */

/* Scene wrapper — FIXED full-screen, stays put while user navigates */
#scene-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  z-index: 1;
  cursor: pointer;
  /* Matches the dark navy background of 3d.png so there is no flash */
  background-color: #131225;
}

/* First-click transition cover — hides the poster→video swap */
#scene-cover {
  position: absolute;
  inset: 0;
  background: #131225;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
}

/* Star canvas — fixed behind everything, does not pan with the scene */
#scene-stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Scene layers container */
#scene-layers {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Edge fade — blends all four sides of the video into the background colour */
#scene-layers::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, #131225 0%,   transparent 22%),
    linear-gradient(to top,    #131225 0%,   transparent 22%),
    linear-gradient(to right,  #131225 0%,   transparent 18%),
    linear-gradient(to left,   #131225 0%,   transparent 18%);
  pointer-events: none;
  z-index: 2;
}

/* Scene video — same sizing as the original 3d.png image */
#scene-img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  min-width: unset;
  height: auto;
  aspect-ratio: 3096 / 1688; /* matches 3d.png dimensions */
  object-fit: cover;
  user-select: none;
  pointer-events: none;
  will-change: transform;
  background-color: #131225; /* shown while poster/video loads */
  /* Feather the video's own edges — the zoomed-out intro framing shows them */
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 10%, #000 90%, transparent),
    linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 10%, #000 90%, transparent),
    linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
  mask-composite: intersect;
}

/* ==========================================================================
   Overlay Cards — fixed layer on top of scene
   ========================================================================== */

#overlay-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.section-card {
  position: absolute;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  will-change: opacity;
}

.section-card[data-section="hero"] {
  top: 50%;
  left: 5%;
  transform: translateY(-50%);
  text-align: left;
  width: min(90vw, 480px);
}

.section-card[data-section="about"] {
  top: 50%;
  left: 4%;
  transform: translateY(-50%);
  width: min(90vw, 360px);
}

.section-card[data-section="projects"] {
  top: 50%;
  right: 6%;
  transform: translateY(-50%);
  width: min(90vw, 380px);
}

.section-card[data-section="skills"] {
  top: 18%;
  left: 4%;
  transform: none;
  width: min(90vw, 500px);
  text-align: left;
}

.section-card[data-section="languages"] {
  top: 50%;
  right: 10%;
  transform: translateY(-50%);
  width: min(90vw, 360px);
}

.section-card[data-section="contact"] {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: min(90vw, 500px);
}

/* ==========================================================================
   Overlay Card Visual Style
   ========================================================================== */

.overlay-card {
  background: rgba(13, 11, 20, 0.82);
  border: 1px solid rgba(183, 148, 244, 0.25);
  border-radius: 18px;
  padding: 2rem;
  isolation: isolate;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    0 0 60px rgba(183, 148, 244, 0.08),
    inset 0 1px 0 rgba(183, 148, 244, 0.12);
}

.overlay-card h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  background: linear-gradient(135deg, #B794F4, #D6BCFA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

/* Hero headline is the page's h1 for SEO but keeps the card-heading look */
.overlay-card h1.hero-title {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 600;
  line-height: 1.5;
  background: none;
  color: #fff;
  -webkit-text-fill-color: #fff;
  margin-bottom: 0.75rem;
}

.overlay-card h2 {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.75rem;
}

.overlay-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.5rem;
}

.overlay-card p {
  color: #94a3b8;
  line-height: 1.6;
  font-size: 0.95rem;
}

.overlay-subtitle {
  color: #94a3b8;
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  margin-bottom: 1.25rem;
}

/* ==========================================================================
   Section Navigation Dots
   ========================================================================== */

#section-dots {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  z-index: 50;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(183, 148, 244, 0.25);
  border: 1px solid rgba(183, 148, 244, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.dot.active,
.dot:hover {
  background: #B794F4;
  box-shadow: 0 0 12px rgba(183, 148, 244, 0.8);
  transform: scale(1.4);
}

/* ==========================================================================
   Progress bar (bottom)
   ========================================================================== */

#scroll-progress {
  position: fixed;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, #B794F4, #D6BCFA);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
  z-index: 60;
  box-shadow: 0 0 12px rgba(183, 148, 244, 0.6);
}

/* ==========================================================================
   Nav hint — shown on load, stays until the first navigation
   ========================================================================== */

#nav-hint {
  position: fixed;
  bottom: 2.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: #E9D8FD;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.1rem 0.6rem 0.8rem;
  border: 1px solid rgba(183, 148, 244, 0.35);
  border-radius: 999px;
  background: rgba(13, 11, 20, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 24px rgba(183, 148, 244, 0.18);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

/* Mouse icon with a "click" ripple */
#nav-hint .hint-click {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  color: #B794F4;
  font-size: 1.15rem;
  animation: hint-press 1.8s ease-in-out infinite;
}

#nav-hint .hint-ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(183, 148, 244, 0.8);
  animation: hint-ripple 1.8s ease-out infinite;
}

@keyframes hint-press {
  0%, 60%, 100% { transform: scale(1); }
  30%           { transform: scale(0.82); }
}

@keyframes hint-ripple {
  0%, 25% { transform: scale(0.6); opacity: 0; }
  35%     { opacity: 1; }
  100%    { transform: scale(1.9); opacity: 0; }
}

#nav-hint .hint-sep {
  width: 1px;
  height: 1rem;
  background: rgba(183, 148, 244, 0.3);
}

#nav-hint .hint-keys {
  display: flex;
  gap: 0.25rem;
}

#nav-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border: 1px solid rgba(183, 148, 244, 0.4);
  border-radius: 4px;
  font-size: 0.65rem;
  font-family: inherit;
  color: rgba(214, 188, 250, 0.85);
  background: rgba(183, 148, 244, 0.08);
}

/* Next dot pulses until the visitor starts exploring */
.dot.dot-next {
  animation: dot-pulse 1.8s ease-out infinite;
}

@keyframes dot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(183, 148, 244, 0.75); }
  100% { box-shadow: 0 0 0 10px rgba(183, 148, 244, 0); }
}

@media (prefers-reduced-motion: reduce) {
  #nav-hint .hint-click,
  #nav-hint .hint-ripple,
  .dot.dot-next {
    animation: none;
  }
}

/* ==========================================================================
   Mobile Fallback
   ========================================================================== */

#mobile-fallback {
  display: none;
}

@media (max-width: 767px) {
  #scene-wrapper,
  #overlay-container,
  #section-dots,
  #nav-hint,
  #scroll-progress {
    display: none !important;
  }

  #mobile-fallback {
    display: flex !important; /* must beat the ID selector that blocks flex from Tailwind */
  }
}
