﻿.projects__intro {
  max-width: 720px;
  margin-bottom: 3rem;
}

.tag-filter {
  margin-bottom: 2rem;
  padding: 1rem 0;
  position: relative;
  z-index: 2;
}

.tag-filter__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.tag-filter__buttons-wrapper {
  position: relative;
  isolation: isolate;
}

.tag-filter__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

.tag-filter__buttons-wrapper--collapsed .tag-filter__buttons {
  max-height: 2.5rem; /* Etwa eine Zeile */
  mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
}

.tag-filter__buttons-wrapper--expanded .tag-filter__buttons {
  max-height: 1000px; /* Genug Platz für alle Tags */
  mask-image: none;
  -webkit-mask-image: none;
}

.tag-filter__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  border-radius: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: none;
  position: relative;
  z-index: 1;
}

.tag-filter__toggle:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.tag-filter__toggle-icon {
  transition: transform 0.3s ease;
}

.tag-filter__buttons-wrapper--expanded .tag-filter__toggle-icon {
  transform: rotate(180deg);
}

.tag-filter__button {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  border-radius: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tag-filter__button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.tag-filter__button--active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.tag-filter__button--active:hover {
  background: var(--accent);
  opacity: 0.9;
}

.timeline {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 1rem 0;
}

.timeline-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  min-height: 300px;
}

.timeline-loading__spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.timeline-loading__text {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  transform: translateX(-50%);
}

.timeline__item {
  position: relative;
  width: calc(50% - 1.5rem);
  margin-bottom: -4rem;
  padding: 1.5rem;
  border-radius: 1.25rem;
  background: var(--bg-alt);
  border: 3px solid transparent;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  /* GPU-Beschleunigung für bessere Performance */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.timeline__item--hidden {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  /* GPU-beschleunigte Eigenschaften */
  will-change: transform, opacity;
}

.timeline__item--visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode - dunklerer Rahmen beim Hover */

@keyframes border-glow-light {
  0% {
    border-color: rgba(17, 17, 20, 0.15);
  }
  20% {
    border-color: rgba(17, 17, 20, 0.2);
  }
  40% {
    border-color: rgba(17, 17, 20, 0.25);
  }
  60% {
    border-color: rgba(17, 17, 20, 0.3);
  }
  80% {
    border-color: rgba(17, 17, 20, 0.2);
  }
  100% {
    border-color: rgba(17, 17, 20, 0.15);
  }
}


@keyframes border-glow-dark {
  0% {
    border-color: rgba(150, 150, 150, 0.15);
  }
  20% {
    border-color: rgba(160, 160, 160, 0.2);
  }
  40% {
    border-color: rgba(170, 170, 170, 0.25);
  }
  60% {
    border-color: rgba(180, 180, 180, 0.3);
  }
  80% {
    border-color: rgba(160, 160, 160, 0.2);
  }
  100% {
    border-color: rgba(150, 150, 150, 0.15);
  }
}

.timeline__item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  animation: border-glow-light 6s ease-in-out infinite;
}

:root[data-theme="dark"] .timeline__item:hover {
  animation: border-glow-dark 6s ease-in-out infinite;
}

.timeline__item:nth-child(odd) {
  margin-left: auto;
  margin-right: 0;
  padding-left: 2.5rem;
  padding-right: 1.5rem;
}

.timeline__item:nth-child(even) {
  margin-right: auto;
  margin-left: 0;
  padding-right: 2.5rem;
  padding-left: 1.5rem;
}

.timeline__item::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid var(--bg);
  top: 1.5rem;
  z-index: 2;
  box-shadow: 0 0 0 4px var(--border);
  transition: box-shadow 0.3s ease;
}

.timeline__item:hover::before {
  animation: pulse-ring 2s ease-in-out infinite;
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 4px var(--border), 0 0 0 0px var(--accent-soft);
  }
  50% {
    box-shadow: 0 0 0 4px var(--border), 0 0 0 20px var(--accent-soft);
  }
  100% {
    box-shadow: 0 0 0 4px var(--border), 0 0 0 0px var(--accent-soft);
  }
}

.timeline__item:nth-child(odd)::before {
  left: -0.75rem;
}

.timeline__item:nth-child(even)::before {
  right: -0.75rem;
}

.timeline__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.timeline__link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.timeline__link span {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.9em;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.timeline__link:hover span {
  opacity: 1;
  transform: translate(2px, -2px);
}

.timeline__no-link {
  display: inline-block;
  margin-left: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
  padding: 0.25rem 0.5rem;
  background: var(--accent-soft);
  border-radius: 0.375rem;
  opacity: 0.8;
}

.timeline__images-wrapper {
  margin-top: 1.5rem;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  overflow: hidden;
}

.timeline__images {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: auto;
  scrollbar-color: var(--border) var(--bg-alt);
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0;
}

.timeline__images::-webkit-scrollbar {
  height: 12px;
}

.timeline__images::-webkit-scrollbar-track {
  background: var(--bg-alt);
  border-radius: 2px;
}

.timeline__images::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.timeline__images::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.timeline__image {
  flex: 0 0 auto;
  width: 300px;
  height: auto;
  border-radius: 0.75rem;
  object-fit: cover;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
  cursor: pointer;
}

.timeline__image--lazy {
  opacity: 0.6;
  background: var(--bg-alt);
  filter: blur(2px);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.timeline__image--lazy.loaded {
  opacity: 1;
  filter: blur(0);
}

.timeline__image:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.timeline__media-item {
  position: relative;
  flex: 0 0 auto;
  width: 300px;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.timeline__media-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.timeline__media-thumbnail {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.timeline__media-thumbnail.timeline__image--lazy {
  opacity: 0.6;
  filter: blur(2px);
}

.timeline__media-thumbnail.timeline__image--lazy.loaded {
  opacity: 1;
  filter: blur(0);
}

.timeline__video-preview {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
}

.timeline__play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.9);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  z-index: 1;
}

.timeline__play-button:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translate(-50%, -50%) scale(1.1);
  border-color: white;
}

.timeline__play-button svg {
  width: 32px;
  height: 32px;
  margin-left: 4px; /* Optische Zentrierung für Play-Icon */
}

/* Image Modal */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-modal--open {
  opacity: 1;
  visibility: visible;
}

.image-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
}

.image-modal__content {
  position: relative;
  z-index: 1001;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  width: 100%;
}

.image-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 1002;
  padding: 0;
}

.image-modal__nav:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.image-modal__nav:active {
  transform: translateY(-50%) scale(0.95);
}

.image-modal__nav--prev {
  left: 1rem;
}

.image-modal__nav--next {
  right: 1rem;
}

.image-modal__nav svg {
  width: 24px;
  height: 24px;
}

.image-modal__image,
.image-modal__video {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.image-modal__close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  color: white;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 1003;
  padding: 0;
}

.image-modal__close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.image-modal__close:active {
  transform: scale(0.95);
}

.image-modal__close span {
  display: block;
  line-height: 1;
  font-weight: 300;
}

.image-modal__index {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1003;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  text-align: center;
}

/* Video Modal */
.video-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-modal--open {
  opacity: 1;
  visibility: visible;
}

.video-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
}

.video-modal__content {
  position: relative;
  z-index: 1001;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.video-modal__video {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  background: #000;
}

.video-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  color: white;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 1002;
  padding: 0;
}

.video-modal__close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.video-modal__close:active {
  transform: scale(0.95);
}

.video-modal__close span {
  display: block;
  line-height: 1;
  font-weight: 300;
}

@media (max-width: 768px) {
  .tag-filter {
    margin-bottom: 1.5rem;
  }

  .tag-filter__label {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
  }

  .tag-filter__buttons {
    gap: 0.5rem;
  }

  .tag-filter__buttons-wrapper--collapsed .tag-filter__buttons {
    max-height: 2rem;
  }

  .tag-filter__button {
    padding: 0.4rem 0.875rem;
    font-size: 0.8rem;
  }

  .timeline::before {
    left: 1.5rem;
  }

  .timeline__item {
    width: calc(100% - 4rem);
    margin-left: 4rem !important;
    margin-right: 0 !important;
    margin-bottom: 0.5rem !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
  }

  .timeline__item--hidden {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }

  .timeline-loading {
    min-height: 200px;
    padding: 3rem 1rem;
  }

  .timeline-loading__spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
  }

  .timeline__item::before {
    left: -2.5rem !important;
    right: auto !important;
  }

  .timeline__image {
    width: 250px;
  }

  .timeline__media-item {
    width: 250px;
  }

  .video-modal__content {
    padding: 1rem;
    max-width: 95vw;
    max-height: 95vh;
  }

  .video-modal__close {
    top: 0.5rem;
    right: 0.5rem;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .image-modal__content {
    padding: 1rem;
    max-width: 95vw;
    max-height: 95vh;
  }

  .image-modal__close {
    top: 0.5rem;
    right: 0.5rem;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .image-modal__nav {
    width: 40px;
    height: 40px;
  }

  .image-modal__nav--prev {
    left: 0.5rem;
  }

  .image-modal__nav--next {
    right: 0.5rem;
  }

  .image-modal__nav svg {
    width: 20px;
    height: 20px;
  }
}
