* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  background: #000;
  color: #fff;
  perspective: 1500px;
  transform-style: preserve-3d;
}

#current-page {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

#floating-images {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  transform-style: preserve-3d;
  transition: transform 1s ease;
}

#floating-images.fly-through {
  transform: translateZ(3000px);
}

#floating-images > * {
  pointer-events: auto;
}

.floating-image,
.floating-video {
  position: absolute;
  border-radius: 12px;
  object-fit: cover;
  will-change: transform, opacity;
  user-select: none;
  cursor: pointer;
  opacity: 1;
  transition: opacity 1.5s ease;
}

main {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
}

/* === Content Transition Layer === */
.scene-layer {
  position: relative;
  transform-style: preserve-3d;
  transform-origin: center center;
  transition: transform 0.5s ease, opacity 0.5s ease;
  opacity: 1;
  transform: translateZ(0);
  z-index: 2;
}

.scene-layer.fly-out-forward {
  transform: translateZ(-3000px);
  opacity: 0;
}

.scene-layer.fly-out-back {
  transform: translateZ(3000px);
  opacity: 0;
}

.scene-layer.pre-enter-forward {
  transform: translateZ(3000px);
  opacity: 0;
}

.scene-layer.pre-enter-back {
  transform: translateZ(-3000px);
  opacity: 0;
}

.scene-layer.fly-in {
  transform: translateZ(0);
  opacity: 1;
}

/* === Animate card and subpage through Z-axis like floaters === */
.card, .subpage {
  transition: transform 1s ease, opacity 1s ease;
  transform-style: preserve-3d;
  transform: scale(1) translateZ(0);
}

/* === Subpage animations === */
.scene-layer.pre-enter-forward .subpage {
  transform: scale(0.5) translateZ(2000px);
  opacity: 0;
}

.scene-layer.pre-enter-back .subpage {
  transform: scale(1.2) translateZ(-2000px);
  opacity: 0;
}

.scene-layer.fly-in .subpage {
  transform: scale(1) translateZ(0);
  opacity: 1;
}

/* === Homepage card animations — CORRECTED === */
.scene-layer.fly-out-forward .card {
  transform: scale(1.2) translateZ(-2000px); /* going FROM home → subpage */
  opacity: 0;
}

.scene-layer.pre-enter-back .card {
  transform: scale(1.2) translateZ(-2000px); /* entering FROM subpage → home */
  opacity: 0;
}

.scene-layer.fly-in .card {
  transform: scale(1) translateZ(0); /* settle to normal size */
  opacity: 1;
}

/* === Home card === */
.card {
  position: relative;
  z-index: 1;
  padding: 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, .06);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
}

.profile-img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 2px solid rgba(255,255,255,0.4);
}

.card h1 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.typewriter {
  min-height: 1.5em;
  margin-bottom: 2rem;
  white-space: nowrap;
  overflow: hidden;
}

.button-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.2rem;
}

.primary-btn {
  padding: .5rem 1rem;
  border-radius: 20px;
  background: #fff2cc;
  color: #6d3e00;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-size: .95rem;
}

.social-row {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.social-link {
  color: #fff;
  font-size: .9rem;
  text-decoration: none;
}

/* === Subpage === */
.subpage {
  width: 100%;
  text-align: center;
  font-size: 2rem;
  font-weight: bold;
  padding: 2rem;
}

/* === Lightbox === */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

#lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

#lightbox-content img,
#lightbox-content video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(0,0,0,.6);
}

#lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  font-size: 1.2rem;
  color: #000;
  background: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* === Navbar === */
.navbar {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .8);
  z-index: 10;
}

.nav-list {
  list-style: none;
  display: flex;
  padding: 0;
  margin: 0;
}

.nav-link {
  display: block;
  padding: .7rem 1.9rem;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s ease;
}

.nav-list li:first-child .nav-link {
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

.nav-list li:last-child .nav-link {
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
}

.nav-link:hover,
.nav-link:focus {
  background: rgba(255, 255, 255, .2);
}

.nav-link.active {
  background: rgba(255, 255, 255, .3);
  color: #fff;
}
