/* Base */
html, body {
  height: 100%;
  overflow: hidden;
  background-color: #000;
}

body {
  margin: 0;
  cursor: url('icons/cursor.png'), auto;
  animation: fade-in-black 2s ease forwards;
}

@keyframes fade-in-black {
  from { opacity: 0; }
  to { opacity: 1; }
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.04;
  pointer-events: none;
  z-index: 999;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.75) 100%);
  pointer-events: none;
  z-index: 998;
}

/* Background video */
.bg-video {
  position: fixed;
  top: -10vh;
  left: 0;
  width: 100vw;
  height: 120vh;
  object-fit: cover;
  z-index: -1;
  opacity: 0;
  transition: opacity 1s ease;
}

.bg-video.active {
  opacity: 0.99;
}

.bg-video[data-src="background-video/bgvideo-1.mp4"].active,
.bg-video[data-src="background-video/bgvideo-2.mp4"].active {
  opacity: 0.9;
}

/* Header */
header {
  position: fixed;
  top: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  color: #f2e0ab;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.4rem;
  font-style: italic;
  letter-spacing: 0.25em;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(232, 217, 181, 0.25);
}

/* Sound toggle */
.sound-toggle {
  position: fixed;
  top: 2.1rem;
  right: 30vw;
  background: none;
  color: #d4af6a;
  border-color: rgba(212, 175, 106, 0.6);
  width: 48px;
  height: 48px;
  font-size: 1.3rem;
  border-radius: 50%;
  cursor: pointer;
  transition: opacity 0.4s ease;
  z-index: 10;
}

.sound-toggle:hover {
  opacity: 1;
}

.sound-toggle.muted::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 18%;
  width: 64%;
  height: 2px;
  background: currentColor;
  transform: translateY(-50%) rotate(-45deg);
  pointer-events: none;
}

/* Painting sections */
html {
  scroll-snap-type: y mandatory;
}

main {
  height: 100vh;
  overflow-y: scroll;
}

.painting-section {
  position: relative;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  scroll-snap-align: start;
}

.painting-frame {
  overflow: visible;
  position: relative;
  display: inline-block;
  padding: 18px;
  background: linear-gradient(135deg, #8a6a2f, #d4af6a 25%, #6b4e1f 50%, #d4af6a 75%, #8a6a2f);
  box-shadow:
    inset 0 0 0 3px #3d2b0f,
    inset 0 0 0 6px #d4af6a,
    inset 0 0 15px 4px rgba(0,0,0,0.6),
    0 15px 40px rgba(0,0,0,0.7),
    0 0 80px 20px rgba(255, 200, 100, 0.08);
  border-radius: 2px;
  transition: box-shadow 0.4s ease, transform 0.4s ease;
}

.painting-frame::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px solid #3d2b0f;
  pointer-events: none;
}

.painting-frame .painting {
  display: block;
  max-width: 55vw;
  max-height: 55vh;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.painting-frame:hover {
  box-shadow:
    inset 0 0 0 3px #3d2b0f,
    inset 0 0 0 6px #e8c468,
    inset 0 0 20px 6px rgba(255, 200, 100, 0.4),
    0 0 30px 8px rgba(255, 200, 100, 0.25),
    0 15px 40px rgba(0,0,0,0.7);
  transform: scale(1.02);
}

/* Scroll hints */
.scroll-hint,
.scroll-hint-up {
  position: absolute;
  left: 50%;
  width: 12px;
  height: 12px;
  border-right: 1px solid #e0bd76;
  border-bottom: 1px solid #e0bd76;
  animation: glow-hint 2s ease-in-out infinite;
}

.scroll-hint {
  bottom: -50px;
  transform: translateX(-50%) rotate(45deg);
  opacity: 0.5;
}

.scroll-hint-up {
  top: -50px;
  transform: translateX(-50%) rotate(-135deg);
  opacity: 0.4;
}

@keyframes glow-hint {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.7; }
}

/* Footer */
footer {
  position: fixed;
  text-align: center;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.footer-credit {
  display: block;
  color: #f2e0ab;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.9rem;
  font-style: normal;
  font-variant: small-caps;
  letter-spacing: 0.25em;
  opacity: 0.5;
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(232, 217, 181, 0.25);
}

footer a {
  color: #f2e0ab;
  text-decoration: none;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.2rem;
  font-style: italic;
  letter-spacing: 0.15em;
  opacity: 0.5;
  padding: 0.4rem 1rem;
  transition: opacity 0.4s ease, letter-spacing 0.4s ease;
}

footer a:hover {
  opacity: 1;
  letter-spacing: 0.25em;
}

/* Lightning flash */
.lightning-flash {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
}

/* Mobile */
@media (max-width: 600px) {
  html, body, main {
    height: 100dvh;
  }

  .painting-section {
    height: 100dvh;
  }

  header {
    top: 2.3rem;
    font-size: 1.3rem;
    letter-spacing: 0.15em;
    max-width: 70vw;
    text-align: center;
  }

  .sound-toggle {
    top: 3rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .painting-frame {
    padding: 10px;
  }

  .painting-frame .painting {
    max-width: 82vw;
    max-height: 45vh;
  }

  footer {
    bottom: 1.9rem;
  }

  .footer-credit {
    font-size: 0.75rem;
  }

  footer a {
    font-size: 1.15rem;
  }
}
