/* 1. Global Reset (Fixes the top gap) */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

/* 2. Fonts */
@font-face {
  font-family: "LTPerfume2";
  src: url("fonts/LTPerfume2.ttf") format("truetype");
}

@font-face {
  font-family: "Gabrielle";
  src: url("fonts/Gabrielle.ttf") format("truetype");
}

/* 3. Body (Original Layout) */
body {
  margin: 0;
  background-image: url("images/gradientbg.png");
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  user-select: none;
}

.main-window {
  position: relative;
  z-index: 999;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 100vh;
}

/* 4. Top Border (Fixed for <img> tag) */
.top-border {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  width: 100%;
  height: auto;
  display: block;
  line-height: 0;
  vertical-align: top;
  /* Removed background-image properties since you are using an <img> tag */
}

.bottom-border {
  pointer-events: none;
  position: absolute;
  bottom: 0;  /* Changed from top: 0 */
  left: 0;
  z-index: 5;
  width: 100%;
  height: auto;
  display: block;
  line-height: 0;
  /* vertical-align: bottom;  <-- Remove this, it doesn't work with absolute positioning */
}

h2 {
  position: relative;
  z-index: 1000;
  cursor: pointer;
}

/* 5. Tabs */
.tab {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.tab.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* --- Scroll Wrapper (Fixed + Optimized) --- */
/* --- Scroll Wrapper (Fixed Clipping) --- */
/* --- Scroll Wrapper (Restored: No Scroll When Content Fits) --- */
.tab .tab-scroll {
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding: 0;
  width: 100%;
  
  /* GPU Acceleration */
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Story Tab (Original Padding) */
#Story {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 100px;
}

#Story .tab-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

/* --- Gallery Tab (Fixed 3-Column Grid for Perfect Symmetry) --- */
/* --- Gallery Tab (Fixed Clipping + Smooth Animations) --- */
#Gallery .tab-scroll {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  justify-content: center;
  align-content: start;
  
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  
  /* Balanced padding for hover space */
  padding-top: 110px;
  padding-left: 20px;
  padding-right: 20px;
  padding-bottom: 70px;
  
  /* Allow scrolling when needed, hide when not */
  overflow-y: auto;
  overflow-x: hidden;
  
  transform: translateZ(0);
  backface-visibility: hidden;
}

#Gallery .tab-scroll a {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  text-decoration: none;
  position: relative;
  
  /* Small padding for hover buffer */
  padding: 8px;
  
  will-change: transform, box-shadow, filter;
  transform: translateZ(0);
  backface-visibility: hidden;
  
  /* ENTER HOVER: Fast */
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#Gallery .tab-scroll a:hover {
  /* Conservative movement to prevent clipping */
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3),
              0 0 0 1px rgba(255, 255, 255, 0.1);
  
  /* EXIT HOVER: Slow & Smooth */
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#Gallery .tab-scroll img {
  width: 100%;
  max-width: 280px;
  height: 350px;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  border: 4px solid rgba(255, 255, 255, 0.5);
  
  transform: translateZ(0);
  backface-visibility: hidden;
  
  /* Sharp Image Rendering */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: high-quality;
  
  /* Prevent blur during animation */
  will-change: filter, border-color, box-shadow;
  
  transition: border-color 0.3s ease,
              filter 0.3s ease,
              box-shadow 0.3s ease;
  
  filter: brightness(1) contrast(1);
}

#Gallery .tab-scroll a:hover img {
  border-color: rgba(255, 255, 255, 0.9);
  filter: brightness(1.08) contrast(1.05);
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.15);
  
  /* EXIT HOVER: Slow & Smooth */
  transition: border-color 0.7s ease,
              filter 0.7s ease,
              box-shadow 0.7s ease;
}

/* Tablets: Switch to 2 Columns */
@media (max-width: 900px) {
  #Gallery .tab-scroll {
    grid-template-columns: repeat(2, 1fr); /* Exactly 2 columns */
    gap: 20px;
    max-width: 700px;
  }
}

/* Mobile: Switch to 1 Column */
@media (max-width: 600px) {
  #Gallery .tab-scroll {
    grid-template-columns: 1fr; /* Exactly 1 column */
    gap: 20px;
    max-width: 400px;
    padding-left: 20px;
    padding-right: 20px;
  }
  
  #Gallery .tab-scroll img {
    max-width: 100%;
  }
}


/* Very Small Screens (max-width: 400px) */
@media (max-width: 400px) {
  #Gallery .tab-scroll {
    padding-top: 80px; /* Reduce top padding for more space */
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* 7. Audio Player (Smooth Animation) */
.audioplayer {
  margin: auto;
  margin-bottom: 40px; /* Spacing between players */
  width: 450px;
  height: 200px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: default;
  will-change: transform;
}

.audioplayer:last-child {
  margin-bottom: 0;
}

.audioplayer:hover {
  transform: scale(1.03);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.15);
  z-index: 10;
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.audioplayer::before {
  pointer-events: none;
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("images/borderaudioplayer.png");
  background-size: cover;
  opacity: 0.6;
  z-index: 0;
  transition: opacity 0.3s ease;
}

.audioplayer:hover::before {
  opacity: 0.9;
  transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.playButton {
  position: relative;
  z-index: 1;
  font-size: 40px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  line-height: 1;
  /* Removed pointer-events: none so the button works */
}

.player-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.songTitle {
  font-family: "LTPerfume2";
  color: white;
  font-size: 24px;
  text-align: center;
  letter-spacing: 1px;
  opacity: 0.9;
}

.time-controls {
  display: flex;
  align-items: center;
  justify-content: center; /* ← Centers the seekbar */
  gap: 10px;
  width: 100%;
  max-width: 350px;
}

.seekBar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  cursor: pointer;
}

.seekBar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

.seekBar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  border: none;
  cursor: pointer;
}

.seekBar:hover::-webkit-slider-thumb {
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

.currentTime,
.duration {
  color: white;
  font-family: "LTPerfume2";
  font-size: 14px;
  min-width: 40px;
  text-align: center;
}

/* 8. Story End Text (Fin.) - Black Color */
.story-end-text {
  font-family: "LTPerfume2";
  color: black;
  font-size: 20px;
  letter-spacing: 4px;
  text-transform: lowercase;
  opacity: 0.8;
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: 60px;
  margin-bottom: 60px;
  position: relative;
  top: auto;
}

.end-line {
  width: 50px;
  height: 1px;
  background: rgba(0, 0, 0, 0.4);
}

/* 9. Navigation & Volume (Original Layout) */
.nav-buttons {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.nav-buttons h2 {
  margin: 0;
  cursor: pointer;
  color: black;
  font-size: 24px;
  letter-spacing: 1px;
  opacity: 0.5; /* Dim inactive tabs */
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: relative;
}

/* Hover effect for all nav buttons */
.nav-buttons h2:hover {
  opacity: 0.8;
  transform: translateX(5px);
}

/* ACTIVE TAB INDICATOR */
.nav-buttons h2.active {
  opacity: 1; /* Full brightness for active tab */
  transform: translateX(10px); /* Slight shift to the right */
}

/* Optional: Add a small dot indicator */
.nav-buttons h2.active::before {
  content: "●";
  position: absolute;
  left: -15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: black;
  opacity: 0.8;
}

.volume-wrapper {
  position: fixed;
  bottom: 15px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.volume-btn {
  font-size: 22px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  backdrop-filter: blur(6px);
  transition: 0.15s ease;
}

.volume-btn:hover {
  transform: scale(1.05);
  background: rgba(0, 0, 0, 0.5);
}

.volume-btn:active {
  transform: scale(0.95);
}

.volume-wrapper.show .volume-btn {
  background: rgba(255, 255, 255, 0.15);
}

.volume-popup {
  position: absolute;
  bottom: calc(100% + 60px);
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: 0.15s ease;
}

.volume-wrapper.show .volume-popup {
  opacity: 1;
  pointer-events: auto;
}

#volumeControl {
  width: 120px;
  transform: rotate(-90deg);
  transform-origin: center;
  cursor: pointer;
}

.responsive-img {
  width: 100%;
  height: auto;
  max-width: 450px;
}
