/* Schriftarten laden */
@font-face {
  font-family: 'DINOT';
  src: url("/static/DINOT.otf");
}
@font-face {
  font-family: 'DINOT-Bold';
  src: url("/static/DINOT-Bold.otf");
}

/* Globale Variablen (Light/Dark-Mode gesteuert) */
:root {
  color-scheme: light dark;

  /* Deine Original-Farben */
  --main-background: light-dark(#ffffff, #111111);
  --text: light-dark(#000000, #ffffff);
  --text-inv: light-dark(#ffffff, #000000);
  --header: light-dark(#dddddd, #222222);
  --header-button: light-dark(#eeeeee, #222222);
  --header-button-hover: light-dark(#e6e6e6, #1c1c1c);
  --dot: light-dark(#dddddd, #222222);
  --dot-hover: light-dark(#cccccc, #454545);

  /* Akzentfarben */
  --accent: light-dark(#28825e, #40b386);
  --accent-hover: light-dark(#1c5c43, #5cd6a4);

  /* Struktur */
  --border-color: light-dark(#d2d2d2, #2e2e2e);
  --card-bg: var(--border-color);

  /* Footer-spezifische Farben */
  --footer-bg: var(--header);
  --footer-text: var(--text);
  --footer-text-hover: var(--accent);
  --footer-border: var(--dot-hover);
}

/* Globales Design */
body {
  background-color: var(--main-background);
  color: var(--text);
  font-family: 'DINOT', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  margin-bottom: 3rem;
}

/* Überschriften-Ränder global stark reduzieren */
h1, h2, h3, h4, h5, h6, .logo {
  font-family: 'DINOT-Bold', system-ui, -apple-system, sans-serif;
  margin: 0.5rem 0;
}

/* Header */
header {
  width: 100%;
  background-color: var(--header);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ==========================================================================
 *  LAYOUT-BREITEN & RESPONSIVENESS (Standardmäßig bis 1600px Viewport)
 *  ========================================================================== */

/* Die Hauptcontainer fangen kompakt bei max 1200px (Startseite) bzw. 1140px (Detailseite) an */
.header-container,
.filter-row,
.portfolio-grid,
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.project-detail-container {
  margin: 1.5rem auto;
  padding: 0 2rem;
  max-width: 1200px; /* Kompakte Breite vor dem Sprung */
  width: 100%;
  box-sizing: border-box;
}

.header-container {
  padding: .5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-row {
  margin: 1.5rem auto 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  padding: 1.5rem 2rem 2rem 2rem;
}

.footer-container {
  padding: 0 1.5rem;
}

/* Suchleisten-Breitenabstufungen vor dem Sprung */
.search-form {
  width: calc((100% - 2 * 2rem) / 3);
}

@media (max-width: 1087px) {
  .search-form {
    width: calc((100% - 1 * 2rem) / 2);
  }
}

@media (max-width: 735px) {
  .search-form {
    width: 100%;
  }
}

/* ==========================================================================
 *  DER "SPRUNG" (Ab exakt 1600px Viewport-Breite für alle Ansichten)
 *  ========================================================================== */
@media (min-width: 1600px) {
  .header-container,
  .filter-row,
  .portfolio-grid,
  .footer-container {
    max-width: 1500px; /* Startseite springt auf maximale Breite */
  }

  .project-detail-container {
    max-width: 1500px; /* Detailseite springt synchron auf maximale Breite */
  }

  .search-form {
    width: calc((100% - 3 * 2rem) / 4); /* Suchleiste wechselt ins 4-Spalten-Format */
  }
}

/* ==========================================================================
 *  ELEMENT-STYLINGS & GEOSPRING KOMPONENTEN
 *  ========================================================================== */

.logo a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.logo-text {
  text-decoration: none;
  transition: .6s;
  color: var(--text);
  font-size: 1.6rem;
  margin-right: 20px;
}

.logo svg {
  height: 1.4rem;
  width: auto;
  display: block;
  fill: var(--accent);
  transition: .6s;
}

.logo a:hover svg {
  fill: var(--accent-hover);
  transition: .25s;
}

.logo a:hover .logo-text {
  color: var(--accent-hover);
  transition: .25s;
}

/* Suchleisten-Input */
.search-form input {
  background: var(--main-background);
  border: 3px solid var(--border-color);
  color: var(--text);
  font-family: 'DINOT', sans-serif;
  font-size: 11pt;
  padding: 0.6rem 15px;
  border-radius: 12px;
  outline: none;
  transition: 0.2s;
  width: calc(100% - 2 * 15px);
}

.search-form input:focus {
  border-color: var(--accent);
}

/* Tags & Filter */
.tag-cloud {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  justify-content: flex-start;
  text-align: left;
  margin-right: auto;
}

.tag-btn {
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 12px;
  font-family: 'DINOT', sans-serif;
  background: var(--header);
  color: var(--text);
  font-size: 12pt;
  transition: 0.2s ease-in-out;
  border: 1px solid transparent;
  cursor: pointer;
}

.tag-btn:hover {
  background: var(--header-button-hover);
}

.tag-btn.active {
  background: var(--accent);
  color: var(--text-inv);
}

.tag-btn.active:hover {
  background: var(--accent-hover);
}

/* Sortier-Dropdown */
.sort-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-icon {
  width: 20px;
  height: 20px;
  color: var(--text);
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sort-select {
  padding: 8px 16px;
  border-radius: 12px;
  border: 3px solid var(--border-color);
  background-color: var(--header);
  color: var(--text);
  cursor: pointer;
  font-family: 'DINOT', sans-serif;
  font-size: 12pt;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sort-select:focus, .sort-select:hover {
  border-color: var(--accent);
}

/* Projekt-Karten */
.project-card {
  background: var(--card-bg);
  border: 3px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  will-change: transform;
}

.project-card:hover {
  transform: translateY(-5.5px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 10px 20px rgba(40, 131, 96, 0.4);
}

.card-image {
  width: 100%;
  aspect-ratio: 5 / 3;
  background-size: cover;
  background-position: center;
  background-color: var(--header);
}
.project-card:hover .card-image{

}

.card-image.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.card-info {
  padding: 1.25rem;
}

.category {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 1px;
  font-weight: bold;
  display: block;
  margin-bottom: 0.35rem;
}

.card-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.3rem;
  line-height: 1.2;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.detail-tags{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Detailseite Spezifika */
.back-nav {
  margin-bottom: 1.5rem;
}

.back-link {
  color: var(--text);
  text-decoration: none;
  font-size: 12pt;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent);
}

.project-header h1 {
  font-size: 2.5rem;
  margin: 0.25rem 0 0.5rem 0;
  line-height: 1.15;
}

/* Intelligentes Seitenverhältnis-Layout */
.project-flexible-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 1.5rem;
}

.project-flexible-layout .gallery-wrapper {
  width: 100%;
}

@media (min-width: 1100px) {
  .project-flexible-layout {
    display: grid;
    grid-template-columns: minmax(500px, 60%) 1fr;
    gap: 3.5rem;
    align-items: flex-start;
  }

  .project-flexible-layout .gallery-wrapper {
    position: sticky;
    top: 2rem;
  }
}

.rendered-markdown p {
  line-height: 1.7;
  font-size: 1.1rem;
}

.download-btn-container{
  display: flex;
  gap: .8rem;
}

.download-btn {
  display: inline-flex;
  background: var(--accent);
  color: var(--text-inv);
  font-family: 'DINOT-Bold', sans-serif;
  text-decoration: none;
  padding: 0.8rem 1rem 0.8rem .9rem;
  border-radius: 10px;
  transition: background 0.2s;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.btn-icon {
  width: 1.2em;
  height: 1.2em;
  flex-shrink: 0;
}

.download-btn:hover {
  background: var(--accent-hover);
}

/* Minimalistische Dynamische Galerie */
.gallery-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.media-display-box {
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  background: var(--header);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.gallery-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-slide img, .gallery-slide video {
  width: 100%;
  height: 100%;
  display: block;
  max-height: 62vh;
  object-fit: contain;
}

/* Steuerungselemente Galerie */
.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
  padding: 0.5rem 0;
}

.ctrl-arrow {
  background: var(--header-button);
  border: 1px solid var(--border-color);
  color: var(--text);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

.ctrl-arrow:hover {
  background: var(--header-button-hover);
  transform: scale(1.05);
}

.ctrl-arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ctrl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

.ctrl-dot:hover {
  background: var(--dot-hover);
}

.ctrl-dot.active {
  background: var(--accent);
  transform: scale(1.2);
}

/* Immersive Lightbox */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(10, 10, 10, 0.98);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.lightbox-overlay.ui-hidden {
  cursor: none;
}

.lightbox-overlay.ui-hidden .lightbox-btn,
.lightbox-overlay.ui-hidden .lightbox-x {
  opacity: 0;
  pointer-events: none;
}

.lightbox-inner {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lb-media-target {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}

#lb-media-target img,
#lb-media-target video {
max-width: 100vw;
max-height: 100vh;
width: auto;
height: auto;
object-fit: contain;
border-radius: 0;
box-shadow: none;
}

.lightbox-x {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000;
  transition: opacity 0.3s ease, background-color 0.2s, transform 0.2s;
}

.lightbox-x:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.05);
}

.lightbox-x svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
}

.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000;
  transition: opacity 0.3s ease, background-color 0.2s, transform 0.2s;
}

.lightbox-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-50%) scale(1.05);
}

.lightbox-btn.prev { left: 1.5rem; }
.lightbox-btn.next { right: 1.5rem; }

.lightbox-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox-counter {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 1.1rem;
  font-family: sans-serif;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 14px;
  border-radius: 20px;
  z-index: 100;
  pointer-events: none;
}

.lightbox-inner .gallery-track {
  width: 100%;
  height: 100%;
}

.lightbox-inner .gallery-slide {
  width: 100vw;
  height: 100vh;
  flex: 0 0 100vw;
}

.lightbox-inner .gallery-slide img,
.lightbox-inner .gallery-slide video {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}

/* Kategorie Pills */
.category-pills {
  display: flex;
  gap: 12px;
  padding-top: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.pill-btn {
  background-color: var(--card-bg, #f3f4f6);
  color: var(--text, #1f2937);
  border: 1px solid var(--border-color, #e5e7eb);
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none !important;
  user-select: none;
  transition: all 0.2s ease-in-out;
}

.pill-btn:hover {
  background-color: var(--border-color, #e5e7eb);
}

.pill-btn.active {
  background-color: var(--accent, #007bff) !important;
  color: #ffffff !important;
  border-color: var(--accent, #007bff) !important;
}

/* Linksbündige Überschriften */
.category-group {
  margin-bottom: 3rem;
}

.portfolio-grid-header {
  margin: 0 auto 1rem auto;
  padding: 0;
  width: 100%;
}

.category-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--text);
  text-align: left;
  line-height: 1.2;
}

.grid-section-title {
  grid-column: 1 / -1;
  font-size: 1.8rem;
  font-weight: 700;
  margin: 25px 0 8px 0;
  color: var(--text);
  text-align: left;
  line-height: 1.2;
}

.project-date {
  color: var(--text);
  opacity: 0.6;
  font-size: 0.9rem;
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}

.tag-badge {
  font-size: 10pt;
  background: var(--header);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
  display: inline-block;
}

a.tag-badge:hover, .clickable-tag:hover {
  background: var(--accent);
  color: var(--text-inv);
}

.clickable-tag {
  cursor: pointer;
}

/* Site Footer */
.site-footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  padding: 1.5rem 0 1.5rem 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border-top: 1px solid var(--footer-border);
  margin-top: auto;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  bottom: 0;
}

.footer-top {
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--footer-text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease, transform 0.2s ease;
  display: inline-block;
}

.footer-links a:hover {
  color: var(--footer-text-hover);
  transform: translateY(-1px);
}

.footer-divider {
  border: 0;
  height: 1px;
  background-color: var(--footer-border);
  margin: 1.5rem 0 1rem 0;
  transition: background-color 0.3s ease;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
}

.footer-copy {
  margin: 0;
  opacity: 0.8;
}

.footer-legal-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.5rem;
}

.footer-legal-links a {
  color: var(--footer-text);
  text-decoration: none;
  opacity: 0.8;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.footer-legal-links a:hover {
  color: var(--footer-text-hover);
  opacity: 1;
}

@media (max-width: 600px) {
  .footer-links {
    gap: 1.25rem;
  }

  .footer-bottom {
    flex-direction: column-reverse;
    text-align: center;
    gap: 0.75rem;
  }

  .footer-legal-links {
    justify-content: center;
  }
}
