/* ==========================================================
   1) Schrift & Grundfarben
   ========================================================== */
@font-face {
  font-family: 'Quintessential-Regular';
  src: url('../fonts/Quintessential-Regular.woff2') format('woff2'),
       url('../fonts/Quintessential-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

:root {
  --color-text: #38322e;
  --color-accent: #b57b2e;
  --color-bg: #f5f1e9;
  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-shadow: 0 6px 28px rgba(0,0,0,0.12);
  --radius-lg: 14px;
  --radius-md: 10px;
  --nav-height: 70px;
  --section-top-gap: clamp(1.25rem, 2vw, 2.25rem);
  --gallery-panel-bg: rgba(255, 255, 255, 0.82);
  --gallery-anchor-width: 220px;
  --gallery-anchor-gap: clamp(0.6rem, 1.6vw, 1.6rem);
}

/* ==========================================================
   2) Grundlayout
   ========================================================== */
html {
  height: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
}

html, body {
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 2rem;
  padding-top: 70px;
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: var(--color-text);
  background-color: var(--color-bg);
  text-align: left;
  position: relative;
}

.sources {
  list-style-type: none; /* Entfernt Aufzählungszeichen */
  padding-left: 0;       /* Entfernt die linke Einrückung */
  margin-left: 0;        /* Optional: sorgt dafür, dass kein zusätzlicher Außenabstand links entsteht */
}
address {
  text-align: center;
}
/* ==========================================================
   3) Hintergrundbild
   ========================================================== */
.bg-fixed {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("/assets/images/gebaeude_watercolor.webp") center top / cover no-repeat;
  will-change: transform;
  transform: translateZ(0);
}

@media (max-width: 768px) {
  .bg-fixed {
    background-image: url("/assets/images/gebaeude_watercolor_mobil.webp");
  }
}

/* ==========================================================
   4) Typografie & Grundelemente
   ========================================================== */
h1, h2, h3 {
  color: var(--color-text);
  line-height: 1.25;
  margin: 0.4em 0 0.3em 0;
  hyphens: none;
  -webkit-hyphens: none;
  word-break: keep-all;
}

h1, h2 {
  font-family: 'Quintessential-Regular', serif;
}
h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 400;
  text-align: center;
}

body.home .home-title {
  hyphens: none;
  -webkit-hyphens: none;
  word-break: keep-all;
}

body.home .home-title__line {
  display: inline;
  margin-right: 0.35em;
  white-space: nowrap;
}

body.home .home-title__line:last-child {
  margin-right: 0;
}

@media (max-width: 768px) {
  body.home .home-title__line {
    display: block;
    margin-right: 0;
  }
}

h2 {
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  font-weight: 600;
}

.custom-title {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 1.6rem;                              /* Individuell kleiner als h1 und h2 */
  font-weight: 400;                               /* Nicht fett wie h2 */
  color: var(--color-text);                       /* Gleich wie h1/h2 */
  margin: 0.4em 0 0.3em 0;                        /* Wie global */
  line-height: 1.25;                              /* Wie global */
}

p {
  line-height: 1.6;
  margin: 0.6rem 0;
}

a {
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--color-accent);
}

/* ==========================================================
   5) Navigation
   ========================================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 250, 235, 0.85);
  border-bottom: 1px solid rgba(181, 123, 46, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.nav-inner {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.8rem 1rem;
  flex-wrap: wrap;
}

.nav-inner a {
  color: #8b3a00;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}

.nav-inner a:hover {
  color: #b57b2e;
  border-bottom: 2px solid #b57b2e;
}

.nav-inner a.active {
  color: #b57b2e;
  cursor: default;
  position: relative;
}

.nav-inner a.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.2rem;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #b57b2e 0%, #d49b56 100%);
  border-radius: 1px;
  opacity: 0.8;
}

/* ==========================================================
   6) Footer (nicht fixiert, volle Breite)
   ========================================================== */
/* Footer-Bereich an Navigation anpassen */
.footer {
  background: rgba(255, 250, 235, 0.85);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.03);
  padding: 0.8rem 1rem;
  text-align: center;
  position: relative;
  z-index: 10;
  color: var(--color-text);
  font-family: "Helvetica Neue", Arial, sans-serif;
}

.footer-inner {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 0;
}

.footer-links a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.footer-links a:hover,
.footer-links a.active {
  color: var(--color-accent);
}

/* Optional: Gleiche Schriftgröße und Abstände wie Navigation */
.footer-links a {
  font-size: 1rem;
  padding: 0.2rem 0.5rem;
}

/* ==========================================================
   7) Weihnachtsmarkt-Hinweis (Announcement)
   ========================================================== */
@keyframes boxGlow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(181,123,46,0.5),
                0 0 20px rgba(214,153,56,0.4);
  }
  50% {
    box-shadow: 0 0 25px rgba(181,123,46,0.8),
                0 0 40px rgba(247,225,181,0.5);
  }
}

.announcement {
  background: linear-gradient(135deg, #fdf6e3 0%, #f7e1b5 100%);
  border: 2px solid #b57b2e;
  border-radius: 12px;
  padding: 1.2rem 2rem;
  max-width: 900px;
  margin: 0 auto 1rem auto;
  font-family: 'Quintessential-Regular', Georgia, serif;
  font-size: 1.4rem;
  color: #840202;
  line-height: 1.45;
  letter-spacing: 0.02em;
  animation: boxGlow 8s ease-in-out infinite;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(2px);
  text-align: center;
}
/* Auf kleinen Bildschirmen (max. 768px Breite) */
@media (max-width: 768px) {
  .announcement {
    font-size: 0.95rem;  /* Kleinere Schrift */
    padding: 0.6rem;     /* Weniger Padding */
  }
}
/* ==========================================================
   8) Content-Box (Milchglas)
   ========================================================== */
.content-box {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  max-width: min(1000px, 94vw);
  margin: 2rem auto;
  padding: clamp(1rem, 2vw, 2rem);
  hyphens: auto;                   /* Automatische Silbentrennung */
  -webkit-hyphens: auto;           /* Für Safari */
  -ms-hyphens: auto;               /* Für alte IE */
  word-wrap: break-word;           /* Wortumbruch */
}
/* Bilder zentriert auf Desktop */
.content-box img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  height: auto;
}

body.geschichte .content-box img,
body.kontakt .content-box img {
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* Mobile Ansicht für responsive Bilder */
@media (max-width: 768px) {
  .content-box img {
    max-width: 100%; /* volle Breite im Container */
    height: auto;
    border-radius: 15px; /* Radius kannst du anpassen, z.B. 8px, 12px */
    display: block;
    margin: 0 auto;
  }
}

/* Damit alle figcaption im Content zentriert sind */
.content-box figcaption {
  text-align: center;
  font-style: italic; /* Optional, nur für optischen Effekt */
  color: var(--color-text);
  margin-top: 0.3rem;
  font-size: 0.9rem;
}


/* ==========================================================
   9) Galerie – Layout, Sidebar, Grid
   ========================================================== */
.gallery-layout {
  position: relative;
  padding: 0 2rem;
  margin: var(--section-top-gap) auto var(--section-top-gap);
  max-width: min(1100px, 96vw);
  width: 100%;
}

.gallery-anchor-bar {
  position: fixed;
  top: calc(var(--nav-height) + var(--section-top-gap));
  left: max(0.8rem, calc((100vw - 1100px) / 2 - var(--gallery-anchor-gap) - var(--gallery-anchor-width)));
  width: var(--gallery-anchor-width);
  padding: 1rem 1.25rem;
  background: var(--gallery-panel-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(8px);
  z-index: 950;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.gallery-anchor-bar h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  color: var(--color-accent);
}

.gallery-anchor-bar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.gallery-content {
  width: 100%;
  max-width: 100%;
  padding: clamp(1rem, 2vw, 2rem);
  background: var(--gallery-panel-bg);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  min-width: 0; /* verhindert Überlaufen in Grid/Flex-Layouts */
}

@media (min-width: 1025px) {
  .gallery-content {
    margin-left: calc(var(--gallery-anchor-width) + var(--gallery-anchor-gap));
    max-width: calc(100% - var(--gallery-anchor-width) - var(--gallery-anchor-gap));
  }
}


.gallery-box {
  margin-top: 1.5rem;
}

.gallery {
  column-count: 3;
  column-gap: 1.2rem;
  margin-top: 1rem;
}

.gallery > a {
  display: inline-block;
  width: 100%;
  margin: 0 0 1.2rem;
  break-inside: avoid;
}

.gallery figure {
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery figure:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.gallery img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery figcaption {
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  color: var(--color-text);
  background: rgba(255, 250, 235, 0.8);
  border-top: 1px solid rgba(181, 123, 46, 0.3);
}

/* ==========================================================
   Galerie: Scroll-Offset & Aktive Section-Markierung
   ========================================================== */

/* Offset für Anker-Links (damit Überschrift sichtbar bleibt) */
article[id] {
  scroll-margin-top: calc(var(--nav-height) + 20px);
}

/* Aktiver Link in der Anchor-Bar */
.gallery-anchor-bar a.active {
  color: var(--color-accent);
  font-weight: 600;
  border-left: 3px solid var(--color-accent);
  padding-left: 0.8rem;
  margin-left: -0.8rem;
}

/* Hover-Effekt für Anchor-Bar-Links */
.gallery-anchor-bar a {
  display: block;
  padding: 0.5rem 0;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.gallery-anchor-bar a:hover {
  color: var(--color-accent);
  padding-left: 0.5rem;
}

/* ==========================================================
   10b) Darkmode-Override – immer helle Glasflächen erzwingen
   ========================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: light;
  }

  html,
  body {
    background-color: var(--color-bg) !important;
    color: var(--color-text) !important;
    -webkit-text-fill-color: var(--color-text); /* verhindert Safari-Dunkelmodus-Invertierung */
  }

  h1, h2, h3,
  p, li, figcaption,
  address,
  .nav-inner a,
  .footer-links a {
    color: var(--color-text) !important;
    -webkit-text-fill-color: var(--color-text);
  }

  .bg-fixed {
    filter: none;
    background-image: url("/assets/images/gebaeude_watercolor.webp");
  }

  .announcement,
  .navbar,
  .footer,
  .content-box,
  .gallery-anchor-bar,
  .gallery-content,
  .gallery figure,
  .gallery-mobile-controls,
  .gallery-dropdown {
    background: var(--glass-bg) !important;
    color: var(--color-text) !important;
    box-shadow: var(--glass-shadow);
  }
}

@media (max-width: 1024px) {
  .gallery-anchor-bar {
    display: none;
  }
}

@media (prefers-color-scheme: dark) and (max-width: 768px) {
  .bg-fixed {
    background-image: url("/assets/images/gebaeude_watercolor_mobil.webp");
  }
}

/* ==========================================================
   Mobile Dropdown: Sticky beim Scrollen
   ========================================================== */

.gallery-mobile-controls {
  display: none;
}

@media (max-width: 768px) {
  html, body {
    overflow-x: visible;
  }

  article[id] {
    scroll-margin-top: calc(var(--nav-height) + 150px);
  }

  .gallery-mobile-controls {
    display: block;
    position: sticky;
    top: 70px; /* Navbar-Höhe */
    z-index: 100;
    background: var(--color-bg);
    padding: 0.5rem;
    margin: 0 0 1.5rem 0;
    /* Leichter Schatten für bessere Sichtbarkeit */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }
  
  .gallery-dropdown {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 2px solid rgba(181, 123, 46, 0.3);
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color 0.3s ease;
  }
  
  .gallery-dropdown:focus {
    outline: none;
    border-color: var(--color-accent);
  }
}

/* ==========================================================
   Lightbox - Moderne JS-gesteuerte Lightbox
   ========================================================== */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
  justify-content: center;
  align-items: center;
}

/* Lightbox Content Container */
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  transition: transform 0.3s ease;
}

/* Caption unter dem Bild */
.lightbox-caption {
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-text);
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  max-width: 600px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Close Button */
.lightbox-close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-text);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 2rem;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 2001;
}

.lightbox-close:hover {
  background: var(--color-accent);
  color: white;
  transform: rotate(90deg) scale(1.1);
}

/* Navigation Buttons */
.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-text);
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 2.5rem;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 2001;
}

.lightbox-prev {
  left: 2rem;
}

.lightbox-next {
  right: 2rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--color-accent);
  color: white;
  transform: translateY(-50%) scale(1.1);
}

/* Counter (z.B. "3 / 12") */
.lightbox-counter {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-text);
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 2001;
}

/* ==========================================================
   Mobile Optimierungen
   ========================================================== */

@media (max-width: 768px) {
  .lightbox-close {
    width: 44px;
    height: 44px;
    font-size: 1.8rem;
    top: 1rem;
    right: 1rem;
  }

  .lightbox-prev,
  .lightbox-next {
    width: 48px;
    height: 48px;
    font-size: 2rem;
  }

  .lightbox-prev {
    left: 1rem;
  }

  .lightbox-next {
    right: 1rem;
  }

  .lightbox-content img {
    max-width: 95vw;
    max-height: 75vh;
  }

  .lightbox-caption {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    max-width: 90vw;
  }

  .lightbox-counter {
    bottom: 1rem;
    font-size: 0.85rem;
  }
}

/* Touch-optimierung: größere Touch-Bereiche */
@media (hover: none) and (pointer: coarse) {
  .lightbox-prev,
  .lightbox-next {
    width: 60px;
    height: 60px;
  }
}

/* ==========================================================
   11) Responsive
   ========================================================== */
@media (max-width: 1024px) {
  .gallery {
    column-count: 2;
  }
}

@media (max-width: 768px) {
  .gallery-layout {
    max-width: 100%;
    width: 100%;
    margin: 1.5rem auto;
    padding: 0 0.5rem;
  }
  .gallery-content {
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    box-sizing: border-box;
  }
  .gallery {
    column-count: 1;
  }
}

/* ==========================================================
   12) Seitenspezifisch
   ========================================================== */
body.galerie h3 {
  font-family: 'Quintessential-Regular', serif;
  font-weight: 400;
  font-size: 1.4rem;
  color: #8b3a00;
}

/* ==========================================================
   12) Startseite – Logo-Größe & Darkmode-Anpassung (final)
   ========================================================== */
body.home .logo-home {
  display: block;
  margin: 1rem auto 1.5rem auto;
  width: 45%;
  max-width: 220px;
  height: auto;
}

@media (max-width: 768px) {
  .custom-title {
    font-size: 1.3rem;
    text-align: center; 
  }
}
