/* ================================================================
   NOIR ATMOSPHERE — Visuelle Atmosphäre & Stimmung
   Bei.Gretel Luxury Wellness Hotel

   Subtile Effekte die "Ruhe" und "Premium" visuell kommunizieren.
   Alle Selektoren unter body.noir, nutzt design-system.css Tokens.
   ================================================================ */

/* --------------------------------------------------------
   1. PAGE ENTRANCE — Elegantes Fade-in beim Seitenaufruf
   -------------------------------------------------------- */
@keyframes pageEntrance {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body.noir {
  animation: pageEntrance 1.2s var(--ease-out) forwards;
}

/* --------------------------------------------------------
   2. FILM GRAIN OVERLAY — Organische Wärme
   Ultra-subtil, kaum sichtbar, nimmt dem Digitalen die Sterilität
   -------------------------------------------------------- */
body.noir::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.028;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
}

/* --------------------------------------------------------
   3. CUSTOM SCROLLBAR — Dünne gold/dark Scrollbar
   -------------------------------------------------------- */

/* Webkit (Chrome, Safari, Edge) */
body.noir::-webkit-scrollbar {
  width: 6px;
}

body.noir::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

body.noir::-webkit-scrollbar-thumb {
  background: rgba(201, 168, 76, 0.4);
  border-radius: 3px;
}

body.noir::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 168, 76, 0.65);
}

/* Firefox */
body.noir {
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 168, 76, 0.4) var(--bg-deep);
}

/* --------------------------------------------------------
   4. TEXT SELECTION — Warmes Gold
   -------------------------------------------------------- */
body.noir ::selection {
  background: rgba(201, 168, 76, 0.3);
  color: var(--text-primary);
}

body.noir ::-moz-selection {
  background: rgba(201, 168, 76, 0.3);
  color: var(--text-primary);
}

/* --------------------------------------------------------
   5. BREATHING PULSE — Sanftes Atmen für Highlights
   Verwenden auf Elementen mit class="glow-pulse"
   -------------------------------------------------------- */
@keyframes breathe {
  0%, 100% {
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.08),
                0 0 60px rgba(201, 168, 76, 0.04);
  }
  50% {
    box-shadow: 0 0 30px rgba(201, 168, 76, 0.18),
                0 0 80px rgba(201, 168, 76, 0.08);
  }
}

body.noir .glow-pulse {
  animation: breathe 4s ease-in-out infinite;
}

/* Breathing auf CTA-Buttons */
@keyframes btnBreathe {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(201, 168, 76, 0);
  }
  50% {
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.15);
  }
}

body.noir .btn-gold {
  animation: btnBreathe 5s ease-in-out infinite;
}

body.noir .btn-gold:hover {
  animation: none;
  box-shadow: 0 0 30px rgba(201, 168, 76, 0.25);
}

/* --------------------------------------------------------
   6. WARM SECTION GLOWS — Sanfte Lichtflecken
   Radiale Gradienten die wie Lichteinfall wirken
   -------------------------------------------------------- */

/* Forest Sections: sanftes grünes Glühen oben rechts */
body.noir .section-forest::after {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(45, 90, 63, 0.2) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Crimson Sections: warmes Glühen links */
body.noir .section-crimson::after {
  content: "";
  position: absolute;
  bottom: -10%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 34, 50, 0.15) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Noir Sections: sanftes gold Licht Mitte oben */
body.noir .section-noir::after {
  content: "";
  position: absolute;
  top: -15%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(201, 168, 76, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body.noir .section-noir {
  position: relative;
  overflow: hidden;
}

/* Ensure content is above glow layers */
body.noir .section-inner,
body.noir .section .stats-bar {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------
   7. SMOOTH FOCUS STATES — Accessibility + Premium
   -------------------------------------------------------- */
body.noir *:focus-visible {
  outline: 2px solid rgba(201, 168, 76, 0.6);
  outline-offset: 3px;
  border-radius: 4px;
}

body.noir .btn-gold:focus-visible,
body.noir .btn-ghost:focus-visible {
  outline-offset: 4px;
}

/* --------------------------------------------------------
   8. GOLD LINK UNDERLINES — Elegante animierte Unterstreichung
   -------------------------------------------------------- */
body.noir .room-description a,
body.noir .ce a:not(.btn-gold):not(.btn-ghost):not(.button),
body.noir .text a:not(.btn-gold):not(.btn-ghost):not(.button) {
  color: var(--gold);
  text-decoration: none;
  background-image: linear-gradient(var(--gold), var(--gold));
  background-size: 0% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;
  transition: background-size var(--dur-base) var(--ease-out);
  padding-bottom: 1px;
}

body.noir .room-description a:hover,
body.noir .ce a:not(.btn-gold):not(.btn-ghost):not(.button):hover,
body.noir .text a:not(.btn-gold):not(.btn-ghost):not(.button):hover {
  background-size: 100% 1px;
}

/* --------------------------------------------------------
   9. SCROLL PROGRESS BAR (CSS container for JS)
   -------------------------------------------------------- */
#noir-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  z-index: 10001;
  pointer-events: none;
  transition: none;
  will-change: width;
}

/* --------------------------------------------------------
   10. CURSOR WARM GLOW (CSS container for JS)
   -------------------------------------------------------- */
#noir-cursor-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transform: translate(-50%, -50%);
  will-change: left, top;
  transition: opacity 0.5s ease;
  opacity: 0;
}

#noir-cursor-glow.active {
  opacity: 1;
}

/* --------------------------------------------------------
   11. ENHANCED IMAGE TRANSITIONS
   Smooth crossfade für Bild-Wechsel in Galerien
   -------------------------------------------------------- */
body.noir .room-hero-image > img {
  transition: opacity 0.6s ease;
}

body.noir .room-hero-image > img.fading {
  opacity: 0.3;
}

/* --------------------------------------------------------
   12. BUTTON HOVER ENHANCEMENTS
   -------------------------------------------------------- */
body.noir .btn-gold {
  transition: all var(--dur-base) var(--ease-out);
  will-change: transform;
}

body.noir .btn-ghost {
  transition: all var(--dur-base) var(--ease-out);
  will-change: transform;
}

/* Magnetic offset (wird von JS gesetzt via CSS custom properties) */
body.noir .btn-gold,
body.noir .btn-ghost {
  --mag-x: 0px;
  --mag-y: 0px;
  transform: translate(var(--mag-x), var(--mag-y));
}

/* --------------------------------------------------------
   13. SMOOTH SCROLL
   -------------------------------------------------------- */
body.noir {
  scroll-behavior: smooth;
}

/* --------------------------------------------------------
   14. IMAGE CROSSFADE REVEAL — Luxury Lazy Loading
   Bilder faden sanft ein statt abrupt zu erscheinen
   -------------------------------------------------------- */
body.noir img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.6s ease;
}

body.noir img[loading="lazy"].img-loaded {
  opacity: 1;
}

/* --------------------------------------------------------
   15. BACK-TO-TOP BUTTON — Gold Scroll Indicator
   -------------------------------------------------------- */
#backToTop {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  color: var(--gold);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease, background 0.3s ease, border-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#backToTop.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#backToTop:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--text-dark);
  box-shadow: var(--shadow-glow);
}

@media only screen and (max-width: 30rem) {
  #backToTop {
    bottom: 1rem;
    right: 1rem;
  }
}

/* --------------------------------------------------------
   16. PREFERS-REDUCED-MOTION — Alle Animationen deaktivieren
   -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  body.noir {
    animation: none !important;
    scroll-behavior: auto !important;
  }

  body.noir::after {
    display: none;
  }

  body.noir .glow-pulse,
  body.noir .btn-gold {
    animation: none !important;
  }

  body.noir .room-hero-image > img {
    transition: none !important;
  }

  #noir-scroll-progress,
  #noir-cursor-glow,
  #backToTop {
    display: none !important;
  }

  body.noir img[loading="lazy"] {
    opacity: 1 !important;
    transition: none !important;
  }

  html.js-reveal body.noir .reveal {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --------------------------------------------------------
   15. MOBILE OPTIMIERUNGEN
   -------------------------------------------------------- */
@media only screen and (max-width: 48rem) {
  /* Reduziere Glow-Größen auf Mobile */
  body.noir .section-forest::after,
  body.noir .section-crimson::after {
    width: 300px;
    height: 300px;
  }

  body.noir .section-noir::after {
    width: 350px;
    height: 250px;
  }

  /* Film Grain etwas reduzieren für Performance */
  body.noir::after {
    opacity: 0.015;
  }

  /* Kein Cursor Glow auf Touch */
  #noir-cursor-glow {
    display: none;
  }
}
