/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

body {
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  color: white;
  font-family: 'Antonio', sans-serif;
  animation: fadeIn 2s ease-in-out forwards;
  opacity: 0;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1 {
  font-family: 'Teko', sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: 3em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: white;
  text-shadow: 0 0 10px white;
  animation: fadeIn 2s ease-in-out;
  user-select: none;
  cursor: default;
}

/* ============================================
   LAYOUT STRUCTURE
   ============================================ */

.header-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#overlay {
  position: relative;
  z-index: 2;
  max-width: 430px;
  margin: 20vh auto 40px;
  text-align: center;
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav-projects {
  position: fixed;
  top: 90px;
  left: 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3;
}

.nav-projects a {
  font-family: 'Antonio', sans-serif;
  font-size: 1.8em;
  font-weight: bold;
  color: #aaa;
  text-decoration: none;
  transition: color 0.3s ease;
}

.nav-projects a:hover {
  color: white;
  text-shadow: 0 0 10px white;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#photo {
  width: 100%;
  max-width: 430px;
  margin-top: 25px;
  border-radius: 10px;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.05);
}

/* ============================================
   MUSIC LINKS
   ============================================ */

.music-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.music-link {
  font-family: 'Antonio', sans-serif;
  font-size: 1.2em;
  color: #888;
  text-decoration: none;
  line-height: 1.1;
  white-space: nowrap;
  transition: color 0.3s ease;
  animation: fadeIn 2s ease-in-out forwards;
  opacity: 0;
  animation-delay: 0.5s;
}

.music-link:hover {
  color: white;
  text-shadow: 0 0 10px white;
}

/* ============================================
   VIDEO SECTION (L PROSPEKT only)
   ============================================ */

.video-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 40px 0;
}

.video-title {
  font-family: 'Antonio', sans-serif;
  font-size: 1.5em;
  font-weight: normal;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 20px 0;
  animation: fadeIn 2s ease-in-out forwards;
  opacity: 0;
  animation-delay: 0.5s;
}

.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 9 / 16;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
  animation: fadeIn 2s ease-in-out forwards;
  opacity: 0;
  animation-delay: 0.7s;
}

.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  border: none;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.1s ease-out;
}

/* Скрываем iframe плавно */
.video-wrapper iframe.hiding {
  opacity: 0;
}

.video-thumbnail {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  cursor: pointer;
}

.video-overlay-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 52px;
  background: #000;
  z-index: 10;
  pointer-events: none;
}

.play-button {
  width: 70px;
  height: 70px;
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  background: rgba(0, 0, 0, 0);
  transition: transform 0.2s;
}

.play-button::after {
  content: '';
  position: absolute;
  left: 28px;
  top: 20px;
  border-style: solid;
  border-width: 15px 0 15px 25px;
  border-color: transparent transparent transparent #fff;
}

.play-button:hover {
  transform: scale(1.08);
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  text-align: center;
  margin-top: 24px;
  padding-bottom: 40px;
  animation: fadeIn 2s ease-in-out forwards;
  opacity: 0;
  animation-delay: 0.5s;
  z-index: 10;
  position: relative;
}

.footer-email,
.footer-copy {
  margin: 0;
  line-height: 1.3;
}

.footer-email a {
  font-family: 'Antonio', sans-serif;
  font-size: 0.95rem;
  color: #888888;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-email a:hover {
  color: #fff;
}

.footer-copy {
  font-family: 'Antonio', sans-serif;
  font-size: 0.55rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 10px;
  user-select: none;
  cursor: default;
}

/* ============================================
   BACKGROUND & EFFECTS
   ============================================ */

#background,
#threejs-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none !important;
}

#background *,
#threejs-background * {
  pointer-events: none !important;
}

.noise {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('https://grainy-gradients.vercel.app/noise.svg');
  opacity: 0.06;
  z-index: 1;
  pointer-events: none;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* ============================================
   PAGE-SPECIFIC: L PROSPEKT
   ============================================ */

.page-lprospekt h1 {
  font-style: italic;
}

/* ============================================
   PAGE-SPECIFIC: SEPIIA
   ============================================ */

.page-sepiia h1 {
  font-family: 'Lusitana', serif;
}

/* ============================================
   PAGE-SPECIFIC: MOVEL (Light Theme)
   ============================================ */

.page-movel {
  background: #fff;
  color: #333;
}

.page-movel h1 {
  color: #666;
  font-weight: 1000;
  text-shadow: 0 0 2px #666;
}

.page-movel .nav-projects a,
.page-movel .music-link,
.page-movel .footer-email a,
.page-movel .footer-copy {
  color: #666;
  text-shadow: none;
}

.page-movel .nav-projects a:hover,
.page-movel .music-link:hover {
  color: #000;
  text-shadow: 0 1px 2px #666;
}

.page-movel .footer-email a:hover {
  color: #000;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.6), 0 0 8px rgba(0, 0, 0, 0.3);
}

/* ============================================
   DESKTOP STYLES
   ============================================ */

@media (min-width: 769px) {
  /* Fixed logo */
  h1 {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
  }

  /* Override for L PROSPEKT - keep logo in flow for scrolling */
  .page-lprospekt h1 {
    position: relative;
    transform: none;
    top: auto;
    left: auto;
    margin-top: 8vh;
    margin-bottom: 0;
  }
  
  .page-lprospekt #overlay {
    margin-top: 0;
  }

  /* Fixed music links on desktop */
  .music-links {
    position: fixed;
    left: 80px;
    bottom: 110px;
    z-index: 3;
    text-align: left;
  }

  /* Fixed footer for SEPIIA and MOVEL */
  .page-sepiia .site-footer,
  .page-movel .site-footer {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    margin: 0;
    padding: 0;
    z-index: 10;
  }

  /* Prevent scrolling on SEPIIA and MOVEL desktop */
  .page-sepiia,
  .page-movel {
    overflow: hidden;
    height: 100vh;
  }

  .page-sepiia #overlay,
  .page-movel #overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
  }

  /* Music links should NOT be inside overlay positioning for SEPIIA/MOVEL */
  .page-sepiia .music-links,
  .page-movel .music-links {
    position: fixed;
    left: 80px;
    bottom: 110px;
  }
}

/* ============================================
   TABLET (iPad)
   ============================================ */

@media (min-width: 769px) and (max-width: 1366px) and (orientation: portrait) {
  .page-lprospekt #overlay {
    margin-top: 1px;
  }
}

/* ============================================
   MOBILE BASE STYLES
   ============================================ */

@media (max-width: 768px) {
  body {
    padding: 0 12px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* SEPIIA and MOVEL should not stretch vertically on mobile */
  body.page-sepiia,
  body.page-movel {
    min-height: auto;
  }

  /* Header */
  .header-block {
    padding-top: 45px;
    margin-bottom: 4px;
  }

  h1 {
    position: static;
    transform: none;
    font-size: 1.8em;
    margin: 8px auto 4px;
    text-align: center;
    max-width: 90vw;
  }

  /* Navigation */
  .nav-projects {
    position: static;
    flex-direction: row;
    justify-content: center;
    margin: 0 auto 6px;
    gap: 25px;
  }
  
  /* MOVEL specific nav spacing */
  .page-movel .nav-projects {
    margin: 0 auto 2px;
  }

  .nav-projects a {
    font-size: 0.9em;
    padding: 6px 4px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Main content */
  #overlay {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  
  /* L PROSPEKT needs centering and flex expansion */
  .page-lprospekt #overlay {
    flex: 1;
    justify-content: center;
  }

  /* Hero */
  .hero {
    margin-bottom: 0;
    margin-top: 20px;
    height: auto;
  }

  #photo {
    max-width: 280px;
    margin: 0 auto 20px;
  }

  /* Music links */
  .music-links {
    position: static;
    margin: 0 auto 8px;
    max-width: 280px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .music-link {
    font-size: 0.9em;
    text-align: center;
    line-height: 1.2;
    opacity: 1;
    animation: none;
    padding: 0.45em 10px;
    min-height: auto;
  }

  /* Video section */
  .video-section {
    margin: 24px auto 20px;
  }

  .video-title {
    font-size: 1.2em;
    margin: 0 0 16px 0;
    opacity: 1;
    animation: none;
  }

  .video-wrapper {
    max-width: 280px;
    opacity: 1;
    animation: none;
  }

  /* Footer */
  .site-footer {
    position: static;
    margin-top: auto;
    padding-top: 32px;
    padding-bottom: 44px;
  }

  .footer-copy {
    font-size: 0.65em;
  }

  /* Page-specific mobile */
  .page-lprospekt .header-block {
    padding-top: 24px;
    margin-bottom: 0;
  }

  .page-lprospekt h1 {
    margin: 0 auto 6px;
  }

  .page-lprospekt .hero {
    margin-bottom: 16px;
  }

  .page-lprospekt .site-footer {
    padding-top: 0;
    padding-bottom: 36px;
  }
  
  /* L PROSPEKT nav to photo spacing */
  .page-lprospekt .nav-projects {
    margin: 4px auto 20px;
  }

  /* SEPIIA and MOVEL mobile - tight spacing */
  .page-sepiia .hero {
    margin-top: 65px;
    margin-bottom: 0;
  }
  
  .page-movel .hero {
    margin-top: 40px;
    margin-bottom: 0;
  }

  .page-sepiia #photo,
  .page-movel #photo {
    margin-bottom: 20px;
  }

  .page-sepiia .music-links {
    margin-top: 20px;
  }
  
  .page-movel .music-links {
    margin-top: 115px;
  }
  
  /* Push footer to bottom on tall screens - FIX для скролла */
  body.page-sepiia,
  body.page-movel {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* ВАЖНО - разрешаем скролл! */
  }
  
  body.page-sepiia .site-footer,
  body.page-movel .site-footer {
    margin-top: auto;
  }

  /* MOVEL light theme mobile */
  .page-movel {
    background: #fff;
    color: #333;
  }

  .page-movel h1 {
    color: #666;
    text-shadow: 0 0 2px #666;
    font-weight: 1000;
  }

  .page-movel .nav-projects a,
  .page-movel .music-link,
  .page-movel .footer-email a,
  .page-movel .footer-copy {
    color: #666;
  }

  .page-movel .nav-projects a:hover,
  .page-movel .music-link:hover {
    color: #000;
    text-shadow: 0 1px 2px #666;
  }
}

/* ============================================
   MOBILE - SMALL SCREENS (iPhone SE)
   ============================================ */

@media (max-width: 380px) and (max-height: 700px) {
  body.page-movel,
  body.page-sepiia {
    overflow-y: auto;
  }

  .page-movel #overlay,
  .page-sepiia #overlay {
    flex: 0 0 auto;
    justify-content: flex-start;
    padding-bottom: 4px;
  }

  .page-movel .site-footer,
  .page-sepiia .site-footer {
    position: static;
    width: 100%;
    margin: 16px auto 12px;
  }
}

/* ============================================
   MOBILE - LARGE SCREENS (Fix for iPhone 16 Pro Max and similar)
   ============================================ */

@media (max-width: 768px) and (min-height: 900px) {
  body.page-sepiia {
    overflow-y: auto;
  }

  .page-sepiia #overlay {
    min-height: auto;
    justify-content: flex-start;
    padding-top: 0;
  }
}