/* =============================
GRUNDEINSTELLUNGEN
============================= */
html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #ffffff;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  cursor: none !important; /* Benutzerdefinierter Cursor */
}

* {
  box-sizing: border-box;
  cursor: none !important; /* Benutzerdefinierter Cursor */
}

/* -----------------------------
Header (Cursor im Header sichtbar)
------------------------------ */
.fixed-header,
.fixed-header * {
  cursor: auto !important;
}

body.show-cursor,
body.show-cursor * {
  cursor: auto !important;
}

/* =============================
FESTSTEHENDER KOPF (HEADER)
============================= */
.fixed-header {
  position: fixed;
  top: 20px;
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 9999;
}

/* HEADER HINTERGRUND BLEIBT IMMER SCHWARZ
   -> KEINE Farbänderung im Red/Dark Mode. */
.header-content {
  display: inline-flex;
  align-items: center;
  background-color: #000;  /* Immer schwarz */
  color: #fff;
  width: fit-content;
  height: 40px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  transition: all 0.4s ease;
  position: relative;
}

.spacer {
  width: 40px;
  flex-shrink: 0;
}

/* =============================
KATEGORIE, NAME, THEME-TOGGLES
============================= */
.category-toggle {
  font-weight: 600;
  font-size: 0.85rem;
  color: #ddd;
  cursor: pointer !important;
  transition: transform 0.3s ease;
}

.category-toggle:hover {
  transform: scale(1.1);
}

.name-toggle {
  font-weight: 400;
  font-size: 0.85rem;
  color: #fff;
  cursor: pointer !important;
  transition: transform 0.3s ease;
  text-align: center;
}

.name-toggle:hover {
  transform: scale(1.1);
}

/* Theme-Kreise */
.theme-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-mode {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  cursor: pointer !important;
  transition: transform 0.3s ease;
}

.theme-mode:hover {
  transform: scale(1.2);
}

.theme-mode-white {
  background-color: #ddd;
}

.theme-mode-dark {
  background-color: #000;
  border: 1px solid #fff;
}

.theme-mode-red {
  background-color: #ff4444;
}

/* =============================
GRID-CONTAINER & GRID-ITEMS
============================= */
.grid-container {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  grid-auto-rows: auto;
  gap: 60px;
  padding: 60px;
  max-width: 90vw;
  margin: 90px auto 0 auto;
  position: relative;
  background-color: transparent;
  cursor: none !important; /* Benutzerdefinierter Cursor */
}

.grid-container * {
  cursor: none !important; /* Benutzerdefinierter Cursor */
}

/* Mobile: 2er-Grid */
@media (max-width: 768px) {
  .grid-container {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 20px;
    padding: 20px;
    margin-top: 80px;
  }
}

.grid-container .dummy {
  pointer-events: none;
  visibility: hidden;
}

.grid-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: visible;
  background-size: cover;
  background-position: center;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: none !important; /* Benutzerdefinierter Cursor */
}

.grid-item:hover {
  transform: scale(1.1);
}

.grid-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
  /* Standard: Weißer Verlauf */
  background: linear-gradient(to bottom, #ffffff, transparent),
              linear-gradient(to top, #ffffff, transparent),
              linear-gradient(to right, #ffffff, transparent),
              linear-gradient(to left, #ffffff, transparent);
  background-size: 100% 30%, 100% 30%, 30% 100%, 30% 100%;
  background-position: top, bottom, left, right;
  background-repeat: no-repeat;
  transition: transform 0.6s ease, opacity 0.6s ease;
  opacity: 1;
}

.grid-item:hover::before {
  transform: scale(1.3);
  opacity: 0;
}

.grid-item::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  border: 1px solid white;
  z-index: 2;
}

.grid-item video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: transparent;
  z-index: 0;
}

/* =============================
MODAL (Detailansicht)
============================= */
/*
  Ziel: Apple-ähnliche, langsame Zoom/Fade-Animation
  beim Öffnen (active) & Schließen (closing).
*/

/* Standard: unsichtbar */
.modal {
  position: fixed;
  top: 0; left: 0;
  right: 0; bottom: 0;
  display: none;
  z-index: 10000;
  cursor: pointer;
}

/*
  Hintergrund- und Zoom-Effekte beim Öffnen (active).
  "smartFadeIn" und "smartZoomIn" laufen parallel ~0.7s
*/
.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: smartFadeIn 0.7s ease forwards;
}
.modal.active .modal-content {
  animation: smartZoomIn 0.7s ease forwards;
}

/*
  Schließen (closing) - ~0.7s FadeOut + ZoomOut
*/
.modal.closing {
  display: flex; /* Bleibt sichtbar, bis Animation fertig ist */
  align-items: center;
  justify-content: center;
  animation: smartFadeOut 0.7s ease forwards;
}
.modal.closing .modal-content {
  animation: smartZoomOut 0.7s ease forwards;
}

/* Hintergrundfarbe (Weiß/Schwarz/Rot) */
.modal {
  background-color: #ffffff; /* Standard: Weiß */
}
body.dark-mode .modal {
  background-color: #000;    /* Schwarz im Dark Mode */
}
body.red-mode .modal {
  background-color: #ff0000; /* Rot im Red Mode */
}

/* Inhalt des Modals */
.modal-content {
  position: relative;
  max-width: 75vw;
  max-height: 75vh;
  width: 100%;
  height: 100%;
  background-color: transparent;

  /*
    WICHTIG: pointer-events: none,
    damit Klick durchgeht an modal-Hintergrund,
    falls man NICHT direkt auf dem Medien-Element klickt
  */
  pointer-events: none;
}

/* Nur die Medien selbst sollen klickbar sein (Videos steuern, etc.) */
.modal-media,
.modal-title {
  pointer-events: auto;
}

.modal-media {
  margin-top: 10px;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-media img,
.modal-media video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Titel im Rotmodus (unten, zentriert & symmetrisch) */
.modal-title {
  margin: 20px auto 0 auto;   /* oben 20px, links/rechts auto => zentriert */
  text-align: center;
  font-size: 1rem;
  color: #fff;
  max-width: 80%;             /* links/rechts gleicher Abstand */
  display: block;             /* damit margin:auto korrekt wirkt */
}

/* =============================
CUSTOM CURSOR (nur im Modal sichtbar)
============================= */
#custom-cursor {
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  filter: blur(2px);
  pointer-events: none;
  z-index: 100000;
  display: none;
  transform: translate(-50%, -50%);
}

/* =============================
ANIMATIONEN
============================= */

/* Hintergrund-Fade-In/Out (Modal) */
@keyframes smartFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes smartFadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Zoom-In / Zoom-Out (Modal-Inhalt) */
@keyframes smartZoomIn {
  0% {
    transform: perspective(1200px) scale(0.6);
    opacity: 0.3;
  }
  100% {
    transform: perspective(1200px) scale(1);
    opacity: 1;
  }
}
@keyframes smartZoomOut {
  0% {
    transform: perspective(1200px) scale(1);
    opacity: 1;
  }
  100% {
    transform: perspective(1200px) scale(0.6);
    opacity: 0.3;
  }
}

/* Kategoriewechsel-Animation */
@keyframes categorySwitch {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(100%) scale(0.8);
    opacity: 0.3;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
.animate-category {
  animation: categorySwitch 0.4s ease;
}

/* =============================
MODI (DARK MODE & RED MODE)
============================= */

/* DARK MODE */
body.dark-mode {
  background-color: #000;
  color: #fff;
}
body.dark-mode .name,
body.dark-mode .portfolio,
body.dark-mode .category-label,
body.dark-mode .category-toggle,
body.dark-mode .social-link,
body.dark-mode .social-separator {
  color: #fff;
}
body.dark-mode .grid-item::before {
  /* Schwarzer Verlauf */
  background: linear-gradient(to bottom, #000000, transparent),
              linear-gradient(to top, #000000, transparent),
              linear-gradient(to right, #000000, transparent),
              linear-gradient(to left, #000000, transparent);
  background-size: 100% 30%, 100% 30%, 30% 100%, 30% 100%;
  background-position: top, bottom, left, right;
  background-repeat: no-repeat;
  opacity: 1;
}
body.dark-mode .grid-item::after {
  border-color: #000; /* Schwarzer Rahmen */
}

/* RED MODE */
body.red-mode {
  background-color: #ff0000;
  color: #fff;
}
body.red-mode .name,
body.red-mode .portfolio,
body.red-mode .category-label,
body.red-mode .category-toggle,
body.red-mode .social-link,
body.red-mode .social-separator {
  color: #fff;
}
body.red-mode .grid-item::before {
  /* Roter Verlauf */
  background: linear-gradient(to bottom, #ff0000, transparent),
              linear-gradient(to top, #ff0000, transparent),
              linear-gradient(to right, #ff0000, transparent),
              linear-gradient(to left, #ff0000, transparent);
  background-size: 100% 30%, 100% 30%, 30% 100%, 30% 100%;
  background-position: top, bottom, left, right;
  background-repeat: no-repeat;
  opacity: 1;
}
body.red-mode .grid-item::after {
  border-color: #ff0000; /* Roter Rahmen */
}

/* =============================
GRID-ITEM TITEL POSITIONIERUNG
============================= */
.grid-title {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 5px;
  font-size: 0.8rem;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
  z-index: 3;
  transition: opacity 0.3s ease;
}

/* Titel im Roten Modus sichtbar beim Hover */
body.red-mode .grid-item:hover .grid-title {
  opacity: 1;
}

/* =============================
CURSOR-VISIBILITY
============================= */
document.addEventListener("mousemove", function(e) {
  if (e.clientY < 150) {
    document.body.classList.add("show-cursor");
  } else {
    document.body.classList.remove("show-cursor");
  }
});