/* ============================================
   BRAHIM & IKRAME — VALENTINE'S GALLERY
   A love story in memories
   ============================================ */

/* CSS Variables */
:root {
  --color-gold: #e8a4b8;
  --color-gold-light: #ffb6c1;
  --color-cream: #fff0f3;
  --color-deep-blue: #1a0a10;
  --color-turquoise: #ff6b8a;
  --color-warm-white: #fff5f7;
  --color-rose: #ff4d6d;
  --color-rose-light: #ff8fa3;
  --color-rose-dark: #c9184a;
  --font-display: "Cinzel", serif;
  --font-body: "Cormorant Garamond", serif;
  --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--color-deep-blue);
  color: var(--color-cream);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Scene Container */
#scene-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#scene-container canvas {
  display: block;
}

/* Loading Screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--color-deep-blue) 0%, #080c14 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition:
    opacity 0.8s ease,
    visibility 0.8s ease;
}

#loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
}

.loading-ornament {
  font-size: 3rem;
  color: var(--color-gold);
  margin-bottom: 1rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.loading-content h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--color-gold-light);
  letter-spacing: 0.3em;
  margin-bottom: 2rem;
}

.loading-bar {
  width: 240px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin: 0 auto 1rem;
  overflow: hidden;
}

.loading-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-turquoise), var(--color-gold));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.loading-text {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}

/* Entry Overlay */
#entry-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    rgba(14, 21, 37, 0.85) 0%,
    rgba(8, 12, 20, 0.95) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(5px);
  transition: var(--transition-smooth);
}

#entry-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.entry-content {
  text-align: center;
  max-width: 500px;
  padding: 3rem;
}

.ornament-top {
  font-size: 2rem;
  color: var(--color-gold);
  margin-bottom: 1.5rem;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 20px var(--color-gold);
  }
}

.entry-content h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 400;
  color: var(--color-cream);
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.2rem;
  font-style: italic;
  color: var(--color-gold-light);
  margin-bottom: 1.5rem;
}

.divider {
  color: var(--color-gold);
  margin-bottom: 2rem;
  font-size: 1rem;
  letter-spacing: 0.2em;
}

#enter-button {
  background: linear-gradient(
    135deg,
    var(--color-gold) 0%,
    var(--color-gold-light) 50%,
    var(--color-gold) 100%
  );
  border: none;
  padding: 1rem 3rem;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--color-deep-blue);
  cursor: pointer;
  border-radius: 4px;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

#enter-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

#enter-button:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 40px rgba(212, 168, 83, 0.4);
}

#enter-button:hover::before {
  left: 100%;
}

.controls-hint {
  margin-top: 2.5rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
}

.controls-hint p {
  margin-bottom: 0.5rem;
}

.key {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.8rem;
  margin: 0 0.1rem;
}

/* Crosshair */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

#crosshair.visible {
  opacity: 1;
}

#crosshair.highlight {
  border-color: var(--color-gold);
  box-shadow: 0 0 8px rgba(212, 168, 83, 0.6);
}

/* Caption Display */
#caption-display {
  position: fixed;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(
    135deg,
    rgba(14, 21, 37, 0.9) 0%,
    rgba(8, 12, 20, 0.95) 100%
  );
  padding: 1.5rem 3rem;
  border-radius: 8px;
  border: 1px solid rgba(212, 168, 83, 0.3);
  text-align: center;
  z-index: 50;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-width: 600px;
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

#caption-display.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

.caption-ornament,
.caption-ornament-bottom {
  color: var(--color-gold);
  font-size: 1rem;
}

.caption-ornament {
  margin-bottom: 0.5rem;
}

.caption-ornament-bottom {
  margin-top: 0.5rem;
  transform: rotate(180deg);
  display: inline-block;
}

#caption-text {
  font-family: var(--font-body);
  font-size: 1.3rem;
  font-style: italic;
  color: var(--color-cream);
  line-height: 1.6;
}

/* Pause Menu */
#pause-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 12, 20, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  transition: var(--transition-smooth);
}

#pause-menu.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pause-content {
  text-align: center;
}

.pause-content h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--color-gold-light);
  margin-bottom: 1rem;
  letter-spacing: 0.2em;
}

.pause-content p {
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}

/* Utility */
.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
  .entry-content h1 {
    font-size: 1.6rem;
  }
  .loading-content h1 {
    font-size: 1.8rem;
    letter-spacing: 0.15em;
  }
  #caption-display {
    padding: 1rem 1.5rem;
    max-width: 90%;
  }
  #caption-text {
    font-size: 1.1rem;
  }
  .frame-overlay-content {
    padding: 1.5rem;
  }
  #frame-overlay-title {
    font-size: 1.3rem;
  }
}

/* ============================================
   VALENTINE'S SPECIAL STYLES
   ============================================ */

/* Loading date */
.loading-date {
  font-size: 1.1rem;
  color: var(--color-rose-light);
  font-style: italic;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  letter-spacing: 0.1em;
}

/* Floating hearts container */
.hearts-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.floating-heart {
  position: absolute;
  font-size: 2rem;
  animation: floatHeart 6s ease-in-out infinite;
  opacity: 0.6;
}

.floating-heart:nth-child(1) {
  left: 10%;
  animation-delay: 0s;
}

.floating-heart:nth-child(2) {
  left: 50%;
  animation-delay: 2s;
}

.floating-heart:nth-child(3) {
  left: 85%;
  animation-delay: 4s;
}

@keyframes floatHeart {
  0%,
  100% {
    transform: translateY(100vh) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 0.7;
  }
  50% {
    opacity: 0.8;
    transform: translateY(50vh) scale(1) rotate(10deg);
  }
  90% {
    opacity: 0.5;
  }
  100% {
    transform: translateY(-20vh) scale(0.8) rotate(-10deg);
    opacity: 0;
  }
}

/* Love message */
.love-message {
  font-size: 1.1rem;
  color: rgba(255, 182, 193, 0.9);
  font-style: italic;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

/* Signature */
.signature {
  margin-top: 2rem;
  font-size: 1rem;
  color: var(--color-rose-light);
  font-style: italic;
  letter-spacing: 0.1em;
}

/* Pause menu Valentine's */
.pause-heart {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%,
  100% {
    transform: scale(1);
  }
  14% {
    transform: scale(1.15);
  }
  28% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.15);
  }
  56% {
    transform: scale(1);
  }
}

.pause-love {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--color-rose-light);
  letter-spacing: 0.15em;
}

/* Enhanced button for Valentine's */
#enter-button {
  background: linear-gradient(
    135deg,
    var(--color-rose) 0%,
    var(--color-rose-light) 50%,
    var(--color-rose) 100%
  );
  box-shadow: 0 4px 20px rgba(255, 77, 109, 0.3);
}

#enter-button:hover {
  box-shadow: 0 10px 40px rgba(255, 77, 109, 0.5);
}

/* Rose gradient for loading bar */
.loading-progress {
  background: linear-gradient(
    90deg,
    var(--color-rose),
    var(--color-rose-light)
  ) !important;
}

/* Volume Control in Pause Menu */
.volume-control {
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.volume-control label {
  font-size: 0.95rem;
  color: var(--color-rose-light);
  letter-spacing: 0.1em;
}

#volume-slider {
  width: 180px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--color-rose);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 77, 109, 0.4);
  transition: transform 0.2s ease;
}

#volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

#volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--color-rose);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 77, 109, 0.4);
}

#volume-value {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  font-family: monospace;
}

/* ============================================
   ROTATE DEVICE OVERLAY
   Forces landscape on mobile/tablet
   ============================================ */

#rotate-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--color-deep-blue) 0%, #080c14 100%);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.rotate-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.rotate-icon {
  font-size: 4rem;
  animation: rotateDevice 2s ease-in-out infinite;
}

@keyframes rotateDevice {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-30deg);
  }
  75% {
    transform: rotate(90deg);
  }
}

.rotate-arrow {
  font-size: 3rem;
  color: var(--color-rose-light);
  animation: pulse 2s ease-in-out infinite;
}

.rotate-content p {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--color-cream);
  letter-spacing: 0.1em;
}

.rotate-sub {
  font-family: var(--font-body) !important;
  font-size: 0.95rem !important;
  color: rgba(255, 255, 255, 0.5) !important;
  font-style: italic;
}

/* Show rotate overlay only on mobile/tablet in portrait */
@media (max-width: 1024px) and (orientation: portrait) {
  #rotate-overlay {
    display: flex !important;
  }
}

/* ============================================
   VIRTUAL JOYSTICK CONTROLS
   ============================================ */

#touch-controls {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#touch-controls.visible {
  opacity: 1;
}

.joystick-zone {
  position: absolute;
  bottom: 20px;
  width: 160px;
  height: 160px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.joystick-left {
  left: 24px;
}

.joystick-right {
  right: 24px;
}

.joystick-base {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 77, 109, 0.08) 0%,
    rgba(255, 77, 109, 0.15) 60%,
    rgba(255, 77, 109, 0.05) 100%
  );
  border: 2px solid rgba(255, 182, 193, 0.25);
  box-shadow:
    0 0 20px rgba(255, 77, 109, 0.1),
    inset 0 0 15px rgba(255, 77, 109, 0.05);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.joystick-base.active {
  border-color: rgba(255, 182, 193, 0.5);
  box-shadow:
    0 0 30px rgba(255, 77, 109, 0.25),
    inset 0 0 20px rgba(255, 77, 109, 0.1);
}

.joystick-thumb {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 182, 193, 0.6) 0%,
    rgba(255, 77, 109, 0.4) 100%
  );
  border: 2px solid rgba(255, 182, 193, 0.5);
  box-shadow: 0 2px 10px rgba(255, 77, 109, 0.3);
  transition: box-shadow 0.2s ease;
}

.joystick-base.active .joystick-thumb {
  box-shadow: 0 2px 15px rgba(255, 77, 109, 0.5);
  background: radial-gradient(
    circle,
    rgba(255, 182, 193, 0.8) 0%,
    rgba(255, 77, 109, 0.6) 100%
  );
}

.joystick-label {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: rgba(255, 182, 193, 0.4);
  text-align: center;
  pointer-events: none;
}

/* ============================================
   MOBILE / DESKTOP VISIBILITY HELPERS
   ============================================ */

.mobile-only {
  display: none;
}

.desktop-only {
  display: block;
}

body.is-mobile .mobile-only {
  display: block;
}

body.is-mobile .desktop-only {
  display: none;
}

/* Hide crosshair on mobile */
body.is-mobile #crosshair {
  display: none;
}

/* Mobile Pause Button */
#mobile-pause-btn {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 70;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 182, 193, 0.3);
  background: rgba(26, 10, 16, 0.6);
  color: var(--color-cream);
  font-size: 1.2rem;
  cursor: pointer;
  backdrop-filter: blur(5px);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

body.is-mobile #mobile-pause-btn {
  display: block;
}

/* ============================================
   MOBILE RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
  .entry-content {
    padding: 1.5rem;
    max-width: 80%;
  }

  .entry-content h1 {
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
  }

  .subtitle {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .love-message {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  .divider {
    margin-bottom: 0.8rem;
  }

  #enter-button {
    padding: 0.7rem 2rem;
    font-size: 0.85rem;
  }

  .ornament-top {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .signature {
    margin-top: 0.8rem;
    font-size: 0.85rem;
  }

  .controls-hint {
    margin-top: 1rem;
  }

  .hearts-container {
    display: none;
  }

  /* Joystick sizing for small screens */
  .joystick-zone {
    width: 130px;
    height: 130px;
    bottom: 10px;
  }

  .joystick-left {
    left: 16px;
  }

  .joystick-right {
    right: 16px;
  }

  .joystick-base {
    width: 100px;
    height: 100px;
  }

  .joystick-thumb {
    width: 36px;
    height: 36px;
  }

  #caption-display {
    bottom: 25%;
  }
}

/* Larger tablets in landscape */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
  .joystick-zone {
    bottom: 24px;
  }

  .joystick-left {
    left: 32px;
  }

  .joystick-right {
    right: 32px;
  }
}
