/* ============================================================
   GLOBAL PAGE STYLES
   These affect the entire page layout and default appearance.
   ============================================================ */
body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  background-color: #181818;
}

/* ============================================================
   HEADER SECTION
   ============================================================ */
header {
  margin-top: 3em;
  text-align: center;
  color: rgb(0, 0, 0);
}

header h1 {
  font-size: 2em;
  font-weight: 900;
}

/* ============================================================
   FULLSCREEN 3D CANVAS
   ============================================================ */
#container3D canvas {
  width: 100vw !important;
  height: 100vh !important;
  position: absolute;
  top: 0;
  left: 0;

  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================================
   CORNER BUTTONS (DEFAULT STYLE)
   ============================================================ */
.corner-btn {
  position: fixed;
  z-index: 10;
  padding: 20px 20px;
  border-radius: 1000px;
  border: 5px solid #000000;
  background: rgba(155, 27, 27, 0.7);
  color: #000000;
  font-family: inherit;
  font-size: 2rem;
  cursor: pointer;

  user-select: none;
  -webkit-user-select: none;

  transition:
    background 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

/* ============================================================
   SPECIAL CASE: PURE IMAGE BUTTON (TOP RIGHT)
   ============================================================ */
#btnTopRight {
  background-image: url("../images/moon-icon.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;

  width: 60px;
  height: 60px;

  background-color: transparent;
  border: none;
  padding: 0;
  cursor: pointer;

  position: fixed;
  top: 10px;
  left: 200px;
  z-index: 10;
}

/* No hover movement / weird pan for the PNG button */
#btnTopRight:hover {
  background: transparent;
  transform: none;
  box-shadow: none;
}

/* ============================================================
   CORNER POSITIONS (OTHER BUTTONS)
   ============================================================ */
.corner-tl { top: 10px; left: 50px; }
.corner-bl { top: 10px; left: 350px; }
.corner-br { top: 10px; left: 500px; }

/* ============================================================
   HOVER EFFECT FOR NORMAL BUTTONS (EXCLUDE TOP RIGHT)
   ============================================================ */
.corner-btn:not(#btnTopRight):hover {
  background: rgba(0, 0, 0, 0);
  transform: translateY(-2px);
}

/* ============================================================
   MUSIC ACTIVE ANIMATION
   ============================================================ */
@keyframes musicPulse {
  0% {
    box-shadow: 0 0 0px rgba(0, 255, 127, 0.0);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 28px rgba(0, 255, 127, 0.75);
    transform: scale(1.05);
  }
  100% {
    box-shadow: 0 0 0px rgba(0, 255, 127, 0.0);
    transform: scale(1);
  }
}

#btnBottomRight.active {
  background: rgba(0, 255, 127, 0.9);
  color: #000000;
  border-color: #000000;
  animation: musicPulse 1.6s ease-in-out infinite;
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

#loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#loading-spinner img {
  width: 150px;
  height: auto;
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

#loading-bar-wrap {
  width: 260px;
  height: 8px;
  background: #222;
  border-radius: 999px;
  overflow: hidden;
}

#loading-bar {
  width: 0%;
  height: 100%;
  background: #f5f5f5;
  transform-origin: left center;
}

#loading-text {
  color: #f5f5f5;
  font-family: sans-serif;
  font-size: 14px;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   ENTER TEXT
   ============================================================ */
#enter-text {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 40px;
  text-align: center;
  color: #ffffff;
  font-family: sans-serif;
  letter-spacing: 0.08em;
  font-size: 14px;
  z-index: 9998;
}

/* ============================================================
   SCREEN FADE
   ============================================================ */
#screen-fade {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: black;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 99999;
}

/* ============================================================
   PROJECT OVERLAY (SCROLLABLE PANEL)
   ============================================================ */

/* Full-screen dark overlay behind the panel */
#project-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;                 /* hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 100000;               /* above everything else */
}

/* When JS adds .visible, the overlay appears */
#project-overlay.visible {
  display: flex;
}

/* The actual panel that floats in front of the scene */
#project-panel {
  background: #111111;
  border-radius: 18px;
  border: 3px solid #000000;

  width: min(800px, 90vw);
  height: min(520px, 80vh);

  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.85),
    0 0 0 2px rgba(255, 255, 255, 0.03);

  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Scrollable content area where we inject your <article> HTML */
#project-content {
  padding: 20px 24px 24px 24px;
  overflow-y: auto;
  color: #f5f5f5;
  font-family: "Montserrat", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* Optional typography inside the panel */
#project-content h1,
#project-content h2,
#project-content h3 {
  margin-top: 0;
  margin-bottom: 0.5em;
  font-weight: 800;
}

#project-content h2 {
  font-size: 1.4rem;
}

#project-content h3 {
  font-size: 1.1rem;
}

#project-content p {
  margin: 0 0 0.75em 0;
}

/* The X close button */
#project-close {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 32px;
  height: 32px;

  border-radius: 999px;
  border: 2px solid #ffffff;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 18px;
  font-weight: 700;
  cursor: pointer;

  transition:
    background 0.15s ease,
    transform 0.1s ease,
    box-shadow 0.15s ease;
}

#project-close:hover {
  background: #ffffff;
  color: #000000;
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

#project-close:active {
  transform: translateY(1px) scale(0.96);
  box-shadow: none;
}

/* Small scrollbar styling (optional) */
#project-content::-webkit-scrollbar {
  width: 8px;
}

#project-content::-webkit-scrollbar-track {
  background: #181818;
}

#project-content::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

#project-content::-webkit-scrollbar-thumb:hover {
  background: #666;
}
