/* Gallery layout styles for horizontal scrolling */

/* Minimalistic Header and Navigation */
header[role="banner"] {
  background: transparent;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: var(--spacing-lg);
}

nav[role="navigation"] {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--spacing-sm);
}

.nav-list {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  padding: var(--spacing-xs) 0;
  border-radius: 0;
  transition: all 0.2s ease;
  font-weight: 700;
  font-size: var(--font-size-lg);
  color: var(--text-primary);
  text-decoration: none;
  position: relative;
}

.nav-link:hover {
  background: transparent;
  color: var(--text-primary);
  text-decoration: none;
  text-transform: uppercase;
}

.nav-link.active {
  background: transparent;
  color: var(--text-primary);
  font-weight: 700;
  text-transform: uppercase;
}

.nav-link.active::before {
  content: '■ ';
  color: var(--text-primary);
}

.nav-toggle {
  display: none;
}

/* Minimalistic page title */
.gallery-title,
.page-title {
  color: var(--text-primary);
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* Main content area */
main[role="main"] {
  padding: 0 var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

/* Gallery Container */
.gallery-container {
  margin: var(--spacing-xl) 0;
  position: relative;
  width: 100%;
  height: 80vh;
  /* Take 80% of viewport height */
  display: flex;
  flex-direction: column;

  /* Disable text selection and context menu */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Gallery scroll container - horizontal scrolling */
.gallery-scroll {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--spacing-md);

  /* Horizontal scrolling setup */
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;

  /* Hide scrollbar but keep functionality */
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* Internet Explorer 10+ */

  /* Fill the 80vh container */
  flex: 1;
  width: 100%;
  height: 100%;
  padding: var(--spacing-md) 0;
}

/* Hide scrollbar for webkit browsers */
.gallery-scroll::-webkit-scrollbar {
  display: none;
}

/* Gallery image containers */
.gallery-image-container {
  flex: 0 0 auto;
  /* Don't grow or shrink, keep natural size */
  position: relative;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;

  /* Fill 80% of viewport height minus padding */
  height: calc(80vh - 2 * var(--spacing-md));

  /* Constrain width to prevent overly wide images */
  min-width: 200px;
  max-width: calc(80vw - 2 * var(--spacing-md));

  /* Let width adjust based on aspect ratio */
  width: auto;
}

.gallery-image-container:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.gallery-image-container:focus {
  outline: none;
  box-shadow: var(--focus-shadow);
}

/* Keyboard navigation focus indicator */
.gallery-image-container.keyboard-focused {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-color), 0 0 15px rgba(129, 199, 132, 0.4);
  transform: translateY(-2px);
  z-index: 10;
  position: relative;
}

.gallery-image-container.keyboard-focused .gallery-image {
  transform: scale(1.02);
}

/* Gallery images */
.gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Cover the container while maintaining aspect ratio */
  object-position: center;
  /* Center the image within the container */
  transition: all 0.3s ease;
  display: block;

  /* Disable image selection and context menu */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: none;
  /* Disable direct interaction with image */
}

/* Alternative mode to show full image */
.gallery-image.contain-mode {
  object-fit: contain;
  /* Show full image within container */
  background: var(--bg-secondary);
  /* Background for letterboxing */
}

.gallery-image-container:hover .gallery-image {
  transform: scale(1.05);
}

/* Loading states */
.gallery-image-container:not(.loaded) {
  background: var(--bg-tertiary);
  animation: pulse 2s infinite;
}

.gallery-image-container.loaded {
  background: transparent;
}

.gallery-image-container.error {
  background: var(--bg-tertiary);
  border: 2px solid var(--error);
}

.gallery-image-container.error .gallery-image {
  opacity: 0.5;
}

/* Pulse animation for loading */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* Loading indicator */
.gallery-loading {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
  font-size: var(--font-size-lg);
}

/* Empty gallery message */
.gallery-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg);
  margin: var(--spacing-lg) 0;
}

.gallery-empty p {
  margin-bottom: var(--spacing-sm);
}

/* Gallery error messages */
.gallery-error {
  text-align: center;
  padding: var(--spacing-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--error);
  border-radius: var(--border-radius-lg);
  color: var(--text-primary);
}

.retry-button {
  margin-top: var(--spacing-md);
  background: var(--accent-primary);
  border: none;
  color: var(--bg-primary);
}

/* Gallery info and controls */
.gallery-info {
  text-align: center;
  margin-top: var(--spacing-lg);
  color: var(--text-muted);
}

.gallery-instructions {
  font-size: var(--font-size-xs);
  margin-bottom: var(--spacing-sm);
}

.gallery-controls {
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.control-hint {
  background: var(--bg-tertiary);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* Footer */
footer[role="contentinfo"] {
  background: var(--bg-secondary);
  text-align: center;
  padding: var(--spacing-lg);
  border-top: 1px solid var(--bg-tertiary);
  margin-top: var(--spacing-xl);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* Impressum page specific styles */
.impressum-content {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

.legal-section {
  margin-bottom: var(--spacing-xl);
  background: var(--bg-secondary);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-lg);
}

.contact-info,
.contact-methods {
  margin-bottom: var(--spacing-lg);
}

.contact-name {
  font-weight: 600;
  font-size: var(--font-size-lg);
  color: var(--text-primary);
}

.contact-address {
  color: var(--text-secondary);
  white-space: pre-line;
  /* Preserve line breaks */
}

.email-link {
  font-weight: 500;
}

.back-navigation {
  text-align: center;
  margin-top: var(--spacing-xl);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: var(--bg-tertiary);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
}

.back-link:hover {
  background: var(--accent-primary);
  color: var(--bg-primary);
  text-decoration: none;
  transform: translateX(-2px);
}

/* Lightbox styles */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(10px);
  animation: lightbox-fade-in 0.3s ease;
  cursor: pointer;

  /* Disable selection and context menu */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: default;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7);
  transition: transform 0.3s ease;

  /* Disable image selection and context menu in lightbox */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: none;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-primary);
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 1001;
}

.lightbox-close:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

.lightbox-info {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-primary);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius);
  font-size: var(--font-size-xs);
  text-align: center;
  backdrop-filter: blur(10px);
}

/* Lightbox animations */
@keyframes lightbox-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes lightbox-fade-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.lightbox.closing {
  animation: lightbox-fade-out 0.3s ease;
}

/* Mobile lightbox adjustments */

@media screen and (max-width: 768px) {
  .lightbox-close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .lightbox-info {
    bottom: 10px;
    left: 10px;
    right: 10px;
    transform: none;
    font-size: var(--font-size-xs);
  }

  .lightbox-content {
    max-width: 98vw;
    max-height: 98vh;
  }

  /* Gallery mobile centering: always center one image, show 5% of prev/next */

  .gallery-scroll {
    justify-content: center;
    scroll-snap-type: x mandatory;
    padding-left: 10vw;
    padding-right: 10vw;
    gap: 0;
  }

  .gallery-image-container {
    scroll-snap-align: center;
    min-width: 80vw;
    max-width: 80vw;
    margin-left: 0;
    margin-right: 0;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .lightbox-close {
    width: 48px;
    height: 48px;
  }
}
