/* Basis-Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background: #1e1e1e;
  color: #e0e0e0;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Blaues geometrisches Muster als Hintergrund */
  background-image:
    repeating-linear-gradient(135deg, rgba(97,218,251,0.08) 0px, rgba(97,218,251,0.08) 2px, transparent 2px, transparent 32px),
    repeating-linear-gradient(45deg, rgba(97,218,251,0.06) 0px, rgba(97,218,251,0.06) 1.5px, transparent 1.5px, transparent 24px);
  background-size: 32px 32px, 24px 24px;
}
a { color: #61dafb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header & Navigation */
header {
  position: fixed; top: 0; right: 0; left: 0; height: 60px;
  display: flex; justify-content: flex-end; align-items: center;
  background: rgba(30,30,30,0.9); padding: 0 20px; z-index: 1100;
}

/* Burger Menu ohne blaues Aufblinken */
.burger {
  width: 24px; height: 18px; display: flex; flex-direction: column;
  justify-content: space-between; cursor: pointer;
  -webkit-tap-highlight-color: transparent; /* Entfernt blaues Aufblinken auf Mobile */
}
.burger:focus {
  outline: none; /* Entfernt Fokus-Rahmen */
}
.burger div {
  width: 100%; height: 3px; background: #e0e0e0; border-radius: 2px;
  transition: transform .3s cubic-bezier(.2,.9,.2,1), opacity .18s ease;
}

nav {
  position: fixed; top: 60px; right: 20px; width: min(360px, 86vw);
  background: linear-gradient(180deg, rgba(30,30,30,0.78), rgba(26,28,33,0.88));
  height: calc(100% - 80px);
  transition: transform .36s cubic-bezier(.2,.9,.2,1), opacity .28s ease;
  transform: translateX(120%);
  z-index: 1105; pointer-events: auto; padding: 22px; border-radius: 18px;
  box-shadow: 0 18px 50px rgba(3,10,22,0.6);
  backdrop-filter: blur(6px) saturate(120%);
}
nav.open { transform: translateX(0); }

/* Overlay that blurs and dims the rest of the page when menu is open */
.nav-overlay {
  position: fixed; inset: 0; z-index: 1100; background: rgba(6,10,14,0.35);
  backdrop-filter: blur(6px) saturate(120%); opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

nav ul { list-style: none; padding: 8px 0; }
nav li { margin: 10px 0; }
nav a {
  display: block; padding: 12px 14px; border-radius: 10px; color: #e9f9ff;
  font-weight: 600; letter-spacing: 0.2px; transition: background .18s, transform .18s;
  background: linear-gradient(90deg, rgba(255,255,255,0.02), transparent);
  -webkit-tap-highlight-color: transparent; /* Entfernt blaues Aufblinken auf Mobile */
}
nav a:hover { background: rgba(255,255,255,0.03); transform: translateX(6px); }

/* small pulsing accent on first link for attention */
nav li:first-child a { box-shadow: inset 0 -2px 0 rgba(97,218,251,0.12); }

/* Active link styling */
nav a.active {
  background: linear-gradient(90deg, rgba(97,218,251,0.12), rgba(97,218,251,0.06));
  color: #bfefff;
  transform: translateX(8px);
  box-shadow: 0 6px 18px rgba(3,10,22,0.45);
}

/* Fixed clear close-control for menu (always on top, not blurred) */
#navClose {
  position: fixed; top: 14px; right: 14px; z-index: 1120; display: none;
  width:44px; height:44px; border-radius:10px; background: rgba(3,10,22,0.9);
  color:#fff; border:none; font-size:20px; align-items:center; justify-content:center;
  box-shadow: 0 8px 26px rgba(3,10,22,0.6); cursor:pointer;
  -webkit-tap-highlight-color: transparent; /* Entfernt blaues Aufblinken */
}
#navClose.open { display:flex; }

/* Main Content */
main { flex: 1; margin-top: 60px; }
section { padding: 60px 20px; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Quiz */
.quiz-question { margin-bottom: 20px; }
.quiz-options button { 
  display: block; 
  margin: 8px 0; 
  padding: 10px; 
  border: none; 
  border-radius: 4px; 
  cursor: pointer; 
  background: #3e3e3e; 
  color: #e0e0e0; 
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.quiz-options button:hover { 
  background: #505050; 
  transform: translateY(-3px); 
  box-shadow: 0 8px 18px rgba(0,0,0,.45); 
}
.quiz-options button:active { 
  transform: translateY(1px) scale(.995); 
}

/* Footer */
footer { 
  background: #121212; 
  text-align: center; 
  padding: 10px 0; 
  font-size: 0.9rem; 
}
footer a { 
  margin: 0 10px; 
  -webkit-tap-highlight-color: transparent; /* Entfernt blaues Aufblinken */
}

/* Scroll-Reveal Animation für Abschnitte und wichtige Elemente */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px) scale(.98);
  transition: opacity .7s cubic-bezier(.2,.9,.2,1), transform .7s cubic-bezier(.2,.9,.2,1);
  will-change: opacity, transform;
}
.reveal-on-scroll.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Substack Newsletter Box Animation & Gradient */
.newsletter-box {
  max-width:320px; 
  margin:18px 0; 
  border-radius:12px; 
  overflow:hidden;
  box-shadow:0 2px 16px rgba(0,0,0,0.25);
  background: linear-gradient(135deg,#23272b 0%,#2b3140 60%,#61dafb 100%);
  border:1px solid #333;
  animation: fadeInSubstack 1.2s cubic-bezier(.2,.9,.2,1);
  transition: box-shadow .3s, transform .3s;
}
.newsletter-box:hover {
  box-shadow:0 6px 32px 0 #61dafb88,0 2px 16px rgba(0,0,0,0.25);
  transform: scale(1.03);
}
@keyframes fadeInSubstack {
  from { opacity:0; transform: translateY(20px) scale(.98); }
  to { opacity:1; transform: translateY(0) scale(1); }
}

/* --- Additional animations (non-intrusive) --- */
/* Animated underline for links */
a { position: relative; }
a::after {
  content: '';
  position: absolute; left: 0; bottom: -2px; height: 2px; width: 100%;
  background: linear-gradient(90deg,#61dafb,#8be6ff);
  transform: scaleX(0); transform-origin: left; transition: transform .25s ease;
  opacity: .9;
}
a:hover::after { transform: scaleX(1); }

/* Subtle entrance for headings */
h1,h2,h3 { 
  opacity: 0; 
  transform: translateY(8px) scale(.99); 
  transition: all .6s cubic-bezier(.2,.9,.2,1); 
}
h1.in-view,h2.in-view,h3.in-view { 
  opacity: 1; 
  transform: translateY(0) scale(1); 
}

/* Buttons with subtle lift */
button { 
  transition: transform .18s ease, box-shadow .18s ease; 
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: translateY(1px) scale(.995); }
button:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,.45); }

/* Animated burger --> cross */
.burger { 
  transition: transform .3s cubic-bezier(.2,.9,.2,1); 
  position: relative; 
  z-index: 1110; 
  pointer-events: auto; 
}
.burger.open { transform: none; }
.burger.open div:nth-child(1) { transform: translateY(7.5px) rotate(45deg); transform-origin: center; }
.burger.open div:nth-child(2) { opacity: 0; transform: translateX(12px); }
.burger.open div:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); transform-origin: center; }

/* Footer social icons placed above links, centered */
.footer-social { text-align: center; margin-bottom: 8px; }
.footer-social a { display: inline-block; margin: 0 8px; width: 26px; height: 26px; vertical-align: middle; }
.footer-social svg { width: 26px; height: 26px; fill: #777; transition: fill .18s ease, transform .18s ease; }
.footer-social i { font-size: 26px; line-height: 26px; color: #777; display: inline-block; transition: color .18s ease, transform .18s ease; }
.footer-social a:hover svg, .footer-social a:hover i { fill: #aaa; color: #aaa; transform: translateY(-2px); }

/* Floating animation for game target */
@keyframes floaty { 0% { transform: translateY(0); } 50% { transform: translateY(-6px); } 100% { transform: translateY(0); } }
#target { transition: left .25s ease, top .25s ease; animation: floaty 3s ease-in-out infinite; }

/* Reveal-on-scroll helper (for sections) */
main section { opacity: 0; transform: translateY(10px); transition: opacity .6s ease, transform .6s ease; }
main section.revealed { opacity: 1; transform: translateY(0); }

/* Small decorative pulse for score */
@keyframes pulseScore { 0% { transform: scale(1); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
#score.pulse { animation: pulseScore .4s ease; }

/* Form Styles */
input, textarea {
  -webkit-tap-highlight-color: transparent;
}
input:focus, textarea:focus {
  outline: 2px solid #61dafb;
  outline-offset: 2px;
}

/* ==========================================================================
   GALERIE & LIGHTBOX (ÜBERARBEITET)
   ========================================================================== */

#onedrive-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-item {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  user-drag: none; /* Verhindert Ziehen im Browser */
}

.gallery-item:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

/* Lightbox Grundgerüst */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  touch-action: none; /* Wichtig für mobiles Zoomen */
}
#lightbox.open { display: flex; }

/* Das Bild in der Lightbox */
#lightboxImg {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 4px;
  transition: transform 0.1s ease-out;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}

/* --- LIGHTBOX STEUERUNG (KREUZ & PFEILE) --- */

/* --- LIGHTBOX STEUERUNG FIX (Bleibt an Ort und Stelle) --- */

#lb-close, #lb-prev, #lb-next {
  position: fixed;
  color: white !important;
  cursor: pointer;
  z-index: 10005;
  background: rgba(40, 40, 40, 0.6);
  display: flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  /* Nur Hintergrund und Größe animieren, NICHT die Position */
  transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
  font-family: Arial, sans-serif;
  user-select: none;
}

/* Kreuz oben rechts */
#lb-close {
  top: 25px;
  right: 25px;
  width: 50px;
  height: 50px;
  font-size: 30px;
}

/* Pfeile exakt mittig fixiert */
#lb-prev, #lb-next {
  top: 50%;
  width: 60px;
  height: 60px;
  font-size: 35px;
}

#lb-prev { left: 25px; transform: translateY(-50%); }
#lb-next { right: 25px; transform: translateY(-50%); }

/* Hover-Effekt: Dezent größer werden ohne zu hüpfen */
#lb-close:hover, #lb-prev:hover, #lb-next:hover {
  background: rgba(97, 218, 251, 0.9);
  box-shadow: 0 0 15px rgba(97, 218, 251, 0.6);
}

/* Wichtig: transform muss hier das translateY(-50%) beibehalten! */
#lb-prev:hover { transform: translateY(-50%) scale(1.1); }
#lb-next:hover { transform: translateY(-50%) scale(1.1); }
#lb-close:hover { transform: scale(1.1); }

@media (max-width: 768px) {
  #lb-prev, #lb-next { width: 45px; height: 45px; font-size: 25px; }
  #lb-close { width: 45px; height: 45px; }
}

/* --- FIX FÜR MOBILE ANSICHT --- */
@media (max-width: 768px) {
  #onedrive-gallery {
    /* Statt 4 Spalten auf dem Handy nur 2 Spalten nutzen */
    grid-template-columns: repeat(2, 1fr) !important; 
    gap: 10px !important;
    padding: 10px !important;
  }
  
  .gallery-item {
    height: 180px !important; /* Etwas niedriger für bessere Proportionen */
  }
}

/* --- SPEED-OPTIMIERUNG --- */
.gallery-item {
  background: #2a2a2a; /* Dunkler Platzhalter, solange das Bild lädt */
  content-visibility: auto; /* Browser optimiert das Rendern beim Scrollen */
}