@font-face {
  font-family: "LeMondeLivre";
  src: url("LeMondeLivre.ttf") format("truetype");
}

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

body {
  background: url("img/cows.jpg")  no-repeat;
  background-size: cover;
  background-position: top;
  height: 100vh;
  font-family: "LeMondeLivre";
  font-weight: 500;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1500px;
  flex-direction: column;
  /* CSS custom property for dynamic viewport height */
  --vh: 100vh;
}

.sr-only {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
}

.mobile-nav {
  display: none;
}


/* 3D CD Case Container */
.cd-case-3d {
    width: min(90vh, 75vw);
    height: min(90vh, 75vw);
    position: relative;
    /* Smooth transition for interactive movement */
    transition: transform 0.1s ease-out;
    /* Base tilt to show 3D depth */
    transform: rotateY(-5deg) rotateX(2deg);
    padding: 3vw 0;
  }
  

@media (max-width: 768px) {
    .cd-case-3d {
        width: min(60vh, 75vw);
        height: min(60vh, 75vw);
    }
  body {
    justify-content: flex-start;
    background-size: 169vh;
    padding-top: 5dvh;
  }

  .mobile-nav {
    display: flex;
  }
}

/* Remove cd-open class styling - no animation on click */

/* CD Layout with jewel case background */
.cd-layout {
  padding: 4cqh 4cqh 3cqh 13cqh;
  width: 100%;
  height: 100%;
  background: url("img/jewel-case.png") center/contain no-repeat;
  position: relative;
  aspect-ratio: 1.2;
  /* Ensure case appears in front of disc initially */
  z-index: 1;
  /* Enable container queries for proportional scaling */
  container-type: size;
  /* Enable 3D transforms for case flip */
  transform-style: preserve-3d;
  transition: transform 0.8s ease-in-out;
}

/* Content overlay container */
.jewel-case-content {
  top: 0;
  left: 0;
  width: 100%;
  max-height: 100%;
  display: grid;
  grid-template-columns: 0.5fr 0.2fr 1fr;
  aspect-ratio: 1;
  /* padding-left: 11%; */
  /* padding-right: 3%; */
}

/* Navigation with white background */
.navigation {
  padding: 4.7cqh 2.7cqh;
  background: white;
  border-right: 2px solid black;
  display: flex;
  gap: 1.5cqh;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-evenly;
}

.track-item {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 0.5cqh;
  position: relative;
}

.track-link {
  font-size: 4.4cqh;
  font-weight: bold;
  text-orientation: mixed;
  text-decoration: none;
  color: black;
  transition: all 0.3s ease;
  padding: 0.2cqw;
}

.track-link:hover {
  text-decoration: underline;
  background: rgba(0, 0, 0, 0.1);
}

/* Center column with white background */
.center-column {
  background: white;
  border-right: 2px solid black;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  justify-content: space-between;
}

.description-text {
    font-size: 2.5cqh;
    padding: 1.8cqw 2cqw;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-weight: bold;
}

/* Main content with white background */
.main-content {
  background: white;
  padding: 1.5cqh;
  display: grid;
  grid-template-rows: 0.85fr auto;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.main-content:hover {
  background: #f8f8f8;
}

.photo-container {
  width: 100%;
  height: 100%;
  overflow: hidden;
  margin-bottom: 1cqh;
  box-shadow: 0 0.4cqw 0.8cqw rgba(0, 0, 0, 0.2);
}

.band-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.1) saturate(1.1);
  border: 0.2px solid rgb(64, 64, 64);
}

.LEEVAI {
  font-size: 18cqh;
  transform: scaleY(1.9) translateY(8.3cqh);
  font-weight: bold;
  text-align: center;
  font-family: "LeMondeLivre", serif;
  line-height: 0.9;
  color: black;
}

.bottom-elements {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.music-label {
  font-size: 2.8cqh;
  font-weight: bold;
  transform: rotate(-15deg) scaleY(1.5) translateX(0.7cqh);
  color: #333;
  padding-bottom: 2cqh;
}
.listening {
    padding: .5cqh;
    width: 100%;

}
.color-block {
  width: 100%;
  height: clamp(20px, 9cqh, 60px);
  background: url("img/sideways-leevai.jpg") center/cover no-repeat;
  border-top: 1px black solid;
  box-shadow: 0 0.2cqw 0.4cqw rgba(0, 0, 0, 0.2);
  position: relative;
}

.color-block::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: #ff69b4;
  mix-blend-mode: multiply;
}

/* CD Disc - positioned behind case, slides out */
.cd-disc {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 80%;
  transform: translate(-50%, -50%);
  transition: transform 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: 48%;
  /* behind the case */
  z-index: -1;
  /* Enable 3D transforms for flip */
  transform-style: preserve-3d;
}

.cd-disc.disc-emerge {
  /* Slide out to the right just a tiny bit */
  animation: discRotateCentered 4s linear infinite;
}

.cd-layout.case-flipped {
  /* Flip the entire CD case to show the back */
  transform: rotateY(180deg);
}

/* Fixed rotation around perfect center */
@keyframes discRotateCentered {
  from {
    transform: translate(-0%, -50%) rotateZ(0deg);
  }
  to {
    transform: translate(-0%, -50%) rotateZ(360deg);
  }
}

.cd-image {
  width: 100%;
  object-fit: contain;
  aspect-ratio: 1;
}

.cd-artist-name {
  font-family: "LeMondeLivre", serif;
  font-weight: bold;
  color: #333;
  text-align: center;
  /* Scale font size based on CD container width */
  font-size: clamp(8px, 8cqw, 40px);
  letter-spacing: 0.5cqw;
  margin-bottom: 1cqh;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.cd-album-title {
  font-family: "LeMondeLivre", serif;
  font-weight: normal;
  color: #666;
  text-align: center;
  /* Smaller font size for album title */
  font-size: clamp(4px, 4cqw, 20px);
  letter-spacing: 0.2cqw;
  margin-bottom: 3cqh;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.cd-center-hole {
  width: 3cqw;
  height: 3cqw;
  background: #333;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

/* CD Case Front and Back Sides */
.case-front {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 4cqh 4cqh 3cqh 13cqh;
  backface-visibility: hidden;
  transform: rotateY(0deg);
  text-transform: uppercase;

}

.case-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 4cqh 13cqh 3cqh 4cqh;
    backface-visibility: hidden;
    transform: rotateY(180deg);
}

.case-back-content {
  padding: 3cqh 5cqw;
  border-radius: 1cqw;
  border: 2px solid #333;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  p {
    max-width: 400px;
    font-size: 3.3cqh;
    margin-bottom: 1.5cqh;
    text-align: left;
  }
  > div {
    overflow: scroll;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1cqh;
    align-items: flex-end;
  }
  img {
    width: 100%;
    padding: 1cqw;
    object-fit: cover;
    object-position: center;
  }
  .barcode {
    padding: 3cqw;
    width: 60cqw;
  }
  .back-title {
    font-family: "LeMondeLivre", serif;
    font-size: 4cqh;
    font-weight: bold;
    margin-bottom: 2cqh;
    letter-spacing: 0.2cqw;
    text-transform: uppercase;
  }
}


.back-signature {
  font-size: clamp(6px, 1.8cqh, 14px);
  font-style: italic;
  margin: 2cqh 0;
  opacity: 0.8;
  border-top: 1px solid #ccc;
  padding-top: 1cqh;
}

.back-return {
  margin-top: 2cqh;
}

.back-return a {
  font-size: clamp(8px, 2cqh, 16px);
  color: #333;
  text-decoration: none;
  font-weight: bold;
  padding: 0.5cqh 1cqw;
  border: 1px solid #333;
  border-radius: 0.5cqw;
  transition: all 0.3s ease;
}

.back-return a:hover {
  background: #333;
  color: white;
  transform: translateY(-1px);
}

/* Enable container queries for the CD disc */
.cd-disc {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 80%;
  transform: translate(-50%, -50%);
  transition: transform 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: 48%;
  /* behind the case */
  z-index: -1;
  /* Enable container queries */
  container-type: size;
}

/* Mobile Navigation Bar */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 2px solid #333;
  padding: 12px 0;
  z-index: 9999;
  display: flex;
  justify-content: space-around;
  align-items: center;
  font-family: "LeMondeLivre", serif;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  /* Multiple strategies for mobile browser compatibility */
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  min-height: calc(60px + env(safe-area-inset-bottom, 0px));
  /* Force hardware acceleration and prevent clipping */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Use the smallest viewport to ensure visibility */
  bottom: max(0px, env(safe-area-inset-bottom, 0px));
  /* Prevent browser UI from hiding the nav */
  position: -webkit-sticky;
  position: sticky;
  position: fixed;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #333;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  min-width: 60px;
  text-align: center;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
  background: rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.mobile-nav-item:active {
  transform: translateY(0);
}

.mobile-nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
  display: block;
}

.mobile-nav-text {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

/* Hide mobile nav on desktop */
@media (min-width: 769px) {
  .mobile-nav {
    display: none;
  }
}

/* Show mobile nav only on mobile and for screen readers */
@media (max-width: 768px) {
  .mobile-nav {
    display: flex;
    /* Force it to always be visible regardless of browser UI */
    position: fixed !important;
    bottom: 0 !important;
    /* Ensure it's always in the visible area */
    margin-bottom: env(keyboard-inset-height, 0px);
  }

  /* Adjust body padding to account for mobile nav */
  body {
    padding-bottom: max(90px, calc(90px + env(safe-area-inset-bottom, 0px)));
    /* Use the smallest viewport height to ensure nav is always visible */
    min-height: 100vh;
    min-height: 100svh; /* Small viewport height - excludes browser UI */
    min-height: 100dvh; /* Dynamic viewport height - includes browser UI changes */
    /* Prevent content from being hidden behind nav */
    box-sizing: border-box;
    /* Ensure body takes full height even with dynamic browser UI */
    height: 100vh;
    height: 100svh;
  }
}

/* Always visible for screen readers regardless of screen size */
@media (prefers-reduced-motion: reduce) {
  .mobile-nav {
    display: flex !important;
  }
}

/* Fallback for browsers that don't support env() */
@supports not (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .mobile-nav {
      bottom: 0 !important;
      padding-bottom: 20px !important; /* Extra padding for devices without safe-area support */
    }

    body {
      padding-bottom: 100px !important; /* Extra body padding */
    }
  }
}

/* Specific fixes for Android Chrome and iOS Safari */
@media screen and (max-width: 768px) {
  .mobile-nav {
    /* Force hardware acceleration */
    will-change: transform;
    /* Ensure it's always at the bottom of the visible area */
    bottom: 0 !important;
    position: fixed !important;
    /* Additional support for older browsers */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* Force it above any browser UI */
    z-index: 999999 !important;
    /* Prevent any layout shifts */
    contain: layout style paint;
  }

  /* Ensure body has enough padding for all device types */
  body {
    padding-bottom: max(100px, calc(100px + env(safe-area-inset-bottom, 0px))) !important;
    /* Use the most reliable viewport height */
    min-height: 100vh !important;
    min-height: 100svh !important; /* Small viewport height - most reliable */
    /* Prevent scrolling issues */
    position: relative;
  }

  /* Additional support for devices with notches or rounded corners */
  @supports (padding: max(0px)) {
    body {
      padding-bottom: max(100px, calc(100px + env(safe-area-inset-bottom))) !important;
    }
    
    .mobile-nav {
      padding-bottom: max(15px, env(safe-area-inset-bottom)) !important;
      min-height: calc(70px + env(safe-area-inset-bottom)) !important;
    }
  }

  /* Force navigation to be visible even with browser UI changes */
  .mobile-nav {
    /* Ensure it's always painted on top */
    isolation: isolate;
    /* Use a more aggressive approach for problematic browsers */
    position: -webkit-sticky !important;
    position: sticky !important;
    position: fixed !important;
    bottom: 0 !important;
  }
}
