* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

/* Container für die Projektliste mit adaptiver Positionierung */
.container {
  margin-top: 0%;
  display: flex;
  flex-direction: column;
  width: 100%;
  /* min-height: 100vh; - ENTFERNT für Top-Positionierung */
  padding: 0;
  position: relative;
  z-index: 999;
  /* Neue Eigenschaften für Top-Positionierung */
  justify-content: flex-start;
  align-items: stretch;
}

/* Neue Klasse für Top-Positionierung */
.container.top-aligned {
  justify-content: flex-start !important;
  align-items: flex-start !important;
  min-height: auto !important;
}

/* Star in top right corner */
.top-star {
  position: fixed;
  top: 2%;
  right: 3%;
  font-family: "M PLUS 1p", sans-serif;
  font-weight: 500;
  font-size: 4rem;
  z-index: 10000;
  cursor: pointer !important;
  transition: transform 0.3s ease, color 0.3s ease, text-shadow 0.3s ease;
  display: inline-block;
  pointer-events: auto !important;
}

.top-star a {
  text-decoration: none;
  color: inherit;
  cursor: pointer !important;
  transition: transform 0.3s ease, color 0.3s ease, text-shadow 0.3s ease;
  display: inline-block;
  pointer-events: auto !important;
}

.top-star:hover,
.top-star a:hover {
  transform: rotate(72deg) scale(1.2) !important;
  text-shadow: 0 0 20px rgba(64, 255, 0, 0.7) !important;
}

.project-list {
  margin-top: 3vh;
  width: 100%;
  max-width: 2000px;
  padding: 0 4%;
}

/* Wenn die Liste zu lang ist, wird sie einfach mit Abständen angezeigt */
.project-list.long-list {
  margin: 0;
  padding-top: 3vh;
  padding-bottom: calc(10vh + 150px);
}

.project {
  margin-left: 3%;
  padding: 0.5rem 0;
  cursor: pointer;
}

.project-header {
  display: grid;
  grid-template-columns: 3fr 2fr 1fr;
  gap: 0.5rem;
  align-items: center;
}

.project-header span {
  font-size: 1.1rem;
  font-family: monospace;
  font-weight: 300;
  text-transform: uppercase;
}

.project.open .project-details {
  display: block;
}

.project-details {
  display: none;
  text-align: left;
  padding-top: 0.5rem;
  margin-bottom: 3%;
  position: relative; /* Added for close button positioning */
}

.project-details .content-container {
  display: flex;
  flex-direction: column;
  position: relative; /* Added for proper layout */
  padding-bottom: 60px; /* Add space for the close button */
}

.project.open .project-details {
  display: block;
}

/* Image grid container */
.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
  order: 1;
  margin-bottom: 1rem;
}

/* Images in the grid */
.image-grid img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  margin-bottom: 0%;
}

/* Remove the old styling for individual images */
.project-details img {
  display: block;
  width: 100%;
  max-width: 100%; /* Override the previous 50% max-width */
  margin-top: 0;
}

/* Include iframes in the grid */
.project-details iframe {
  width: 100%;
  height: 315px; /* Standard YouTube height */
  border: none;
  display: block;
}

/* Make iframe cell span full grid width */
.iframe-container {
  grid-column: 1 / -1; /* Span all columns */
  margin-top: 1.5rem;
  width: 100%;
}

.iframe-wrapper.single-video {
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
}

.iframe-wrapper.single-video iframe {
    width: 100%;
    height: 500px;
}
/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .image-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on tablets */
    gap: 0.8rem;
  }
}

@media screen and (max-width: 480px) {
  .image-grid {
    grid-template-columns: 1fr; /* 1 column on mobile */
    gap: 0.6rem;
  }
}

.project-details h1 {
  justify-content: left;
  font-size: large;
  font-family: monospace;
  font-weight: 400;
  order: 2;
  text-transform: uppercase;
}

.project-details ul {
  font-family: monospace;
  list-style-type: none;
  order: 3;
}

.project-details ul li {
  text-align: left;
  padding: 0;
  margin: 0;
  text-indent: 0;
  display: block;
}

.project-details ul li h1 {
  text-align: left;
  padding: 0;
  margin: 0;
  text-indent: 0;
  display: block;
}

/* Falls die Liste verschachtelte Elemente oder spezielle Formatierungen enthält */
.project-details ul li * {
  text-align: left;
}

@media screen and (max-width: 768px) {
  .project-details h1 {
    justify-content: left;
    font-size: 0.5rem;
    font-family: monospace;
    font-weight: 300;
    order: 2;
    text-transform: uppercase;
  }

  .project-details ul {
    font-family: monospace;
    list-style-type: none;
    font-size: 0.5rem;
    order: 3;
  }

  .project-details ul li {
    text-align: left;
    font-size: 0.5rem;
    padding: 0;
    margin: 0;
    text-indent: 0;
    display: block;
  }

  .project-details ul li h1 {
    text-align: left;
    font-size: 0.5rem;
    padding: 0;
    margin: 0;
    text-indent: 0;
    display: block;
  }
}

/* JavaScript wird diese Klasse hinzufügen, wenn die Liste zu groß für Zentrierung ist */
.content-overflow .project-list {
  margin-top: 10vh;
  margin-bottom: 0;
}

/* Spezielle Behandlung für Top-Alignment bei Overflow */
.container.top-aligned.content-overflow .project-list {
  margin-top: 3vh; /* Konsistenter Top-Abstand auch bei Overflow */
}

/* Close Button Styling - UPDATED */
.close-button {
  position: absolute; /* Changed from fixed to absolute */
  margin: auto;
  bottom: 0;
  left: 0;
  background-color: transparent;
  border: none;
  font-size: medium;
  font-family: "M PLUS 1p", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  width: 40px;
  height: 40px;
  line-height: 36px;
  cursor: pointer;
  z-index: 1000;
  display: none;
}

/* Zeige den Close-Button nur bei geöffneten Projekten */
.project.open .close-button {
  display: block;
}

/* Pointer-Cursor für klickbare Elemente */
.project-header {
  cursor: pointer;
}

/* Entfernt den Cursor: pointer vom gesamten Project-Element */
.project {
  cursor: default;
}

/* Neue Stile für Kategorieüberschriften */
.category-header {
  font-family: "M PLUS 1p", sans-serif;
  font-weight: 600;
  font-size: 1.4rem;
  margin: 1rem 0 0.5rem 0;
  padding-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.6em;
}

/* Erstes Kategorie-Header hat keinen oberen Abstand */
.category-header:first-child {
  margin-top: 0;
}

/* Container für Projekte einer Kategorie */
.category-container {
  margin-bottom: 1.5rem;
}

/* Letzter Kategorie-Container hat keinen unteren Abstand */
.category-container:last-child {
  margin-bottom: 0;
}

.name-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  font-family: "M PLUS 1p", sans-serif;
  font-weight: 500;
  font-size: 5rem;
  background-color: transparent;
  padding: 10px 0;
  z-index: 9999; /* Erhöhter z-index, damit es über allem liegt */
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  overflow: visible; /* Von hidden zu visible geändert */
  pointer-events: none; /* Stellt sicher, dass Maus-Events registriert werden */
}

/* Jeder Buchstabe kann individuell angepasst werden */
.name-banner span {
  display: inline-block;
}

/* Stil für den Leerzeichen-Span */
.name-banner .space {
  min-width: 5%; /* Minimale Breite für das Leerzeichen */
}

/* Anpassung für die Projektliste - Abstand nach unten hinzufügen */
.container {
  margin-bottom: 100px; /* Ausreichend Platz für den Namen unten */
}

/* Responsive Anpassungen für mobile Geräte */
@media screen and (max-width: 768px) {
  /* Projektliste auf Mobilgeräten */
  .project-header {
    flex-wrap: wrap;
    padding: 0.6rem 0.8rem; /* Kleinere Polsterung auf kleinen Bildschirmen */
  }
  
  /* Kategorie auf Mobilgeräten ausblenden */
  .project-header .project-category {
    display: block !important;
    text-align: right;
    font-size: 0.6rem !important;
  }
  
  /* Titel und Jahr neu anordnen - KORRIGIERT mit höherer Spezifität */
  .project-header .project-title {
    width: 75% !important; /* Größerer Anteil für den Titel */
    font-size: 0.6rem !important; /* Etwas kleinere Schrift */
  }
  
  .project-header .project-year {
    display: none;
  }
  
  /* Kategorieüberschriften kleiner */
  .category-header {
    font-size: 0.8rem;
    margin: 1.5rem 0 0.8rem 0;
  }
  
  /* Kleinerer Abstand zwischen Projekten */
  .category-container {
    margin-bottom: 1rem;
  }
  
  /* Name-Banner auf Mobilgeräten anpassen */
  .name-banner {
    font-size: 2.5rem; /* Kleinere Schriftgröße */
    padding: 5px 0;
  }
  
  /* Container-Anpassungen */
  .container {
    margin: 1rem;
    margin-bottom: 80px; /* Weniger Abstand zum Footer auf Mobilgeräten */
  }
  
  /* Projektdetails */
  .project.open .project-details {
    padding: 0.8rem;
  }
}

/* Zusätzliche Anpassung für sehr kleine Bildschirme (Smartphones) */
@media screen and (max-width: 480px) {
  .project-header .project-title {
    font-size: 0.5rem !important; /* Noch kleinere Schrift für Smartphones */
  }
  
  .project-header .project-category {
    font-size: 0.5rem !important; /* Noch kleinere Schrift für Smartphones */
  }
  
  .category-header {
    font-size: 0.7rem; /* Auch Category Header noch kleiner */
  }
  
  /* Kleinerer Abstand zwischen Projekten auf Smartphones */
  .project {
    padding: 0.01rem 0; /* Noch weiter reduziert für kompaktere Darstellung */
  }
  
  .category-container {
    margin-bottom: 0.4rem; /* Noch weiter reduziert von 0.6rem */
  }
  
  /* Vergrößerter Abstand zwischen Titel und Jahr auf Smartphones */
  .project-header {
    grid-template-columns: 2fr 1fr; /* Angepasste Spaltenaufteilung */
    gap: 1rem; /* Vergrößerter Abstand zwischen den Spalten */
    padding: 0.3rem 0.8rem; /* Etwas weniger Polsterung */
  }
  
  /* Container Anpassungen für Smartphones */
  .container {
    margin-top: 15% !important; /* Mehr Abstand vom oberen Rand */
    margin-bottom: 100px !important; /* Platz für Name-Banner */
  }
  
  /* Name-Banner auf Smartphones begrenzen */
  .name-banner {
    font-size: 2rem !important; /* Noch kleinere Schrift */
    padding: 8px 5px; /* Weniger Padding oben/unten, seitlich auch */
    overflow: hidden; /* Verhindert das Herausragen */
    white-space: nowrap; /* Verhindert Zeilenumbruch */
  }
  
  /* Buchstaben-Spacing für Smartphones anpassen */
  .name-banner span {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  .name-banner .space {
    min-width: 3% !important; /* Kleineres Leerzeichen */
  }
}

/* Sugar Daddy – Bilder im Grid auf 16:9 croppen */
.sugardaddy-img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
}