/* ==========================================================
   Haflinger-Website – bereinigtes Stylesheet
   Farben, Layout, Navigation, Bilder, Tabellen und responsive
   ========================================================== */

:root {
  --cream: #f4eddf;
  --paper: #fffaf0;
  --ink: #352a20;
  --brown: #5b4028;
  --gold: #a78245;
  --line: #d7c5a4;
  --muted: #756858;

  /* Aliase für ältere Galerie-/Lightbox-Regeln */
  --text-main: var(--ink);
  --accent: var(--gold);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  width: 100%;
  color: var(--ink);
  background: var(--cream);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
  overflow-x: clip;
}

img {
  max-width: 100%;
}

a {
  color: #765329;
  text-decoration: none;
}

a:hover {
  color: #382719;
}

/* Kopfbereich */
.site-header {
  background: var(--brown);
  color: var(--paper);
  text-align: center;
  padding: 2.2rem 1rem 1.6rem;
  border-bottom: 5px solid var(--gold);
}

.site-header h1 {
  margin: .2rem 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: normal;
  line-height: 1.15;
}

.site-header .years,
.years {
  margin: .35rem 0 0;
  letter-spacing: .2em;
  color: #e4d2af;
}

/* Navigation */
.nav-wrap {
  background: #e7dac2;
  border-bottom: 1px solid var(--line);
}

.nav-wrap nav,
nav {
  max-width: 1120px;
  margin: 0 auto;
  padding: .6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.2rem;
  justify-content: center;
  align-items: center;
}

.nav-wrap nav a,
.nav-wrap nav summary,
nav a {
  color: var(--brown);
  font-family: inherit;
  font-weight: bold;
  font-size: .95rem;
  text-decoration: none;
  cursor: pointer;
  padding: .25rem .1rem;
}

nav a[aria-current="page"] {
  border-bottom: 2px solid var(--gold);
}

nav-link {
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  font-weight: inherit;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown summary {
  cursor: pointer;
  list-style: none;
}

.dropdown summary::-webkit-details-marker {
  display: none;
}

.dropdown summary::after {
  content: " ▼";
  font-size: .7em;
  margin-left: 6px;
}

.dropdown[open] summary::after {
  content: " ▲";
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: #eee3cc;
  z-index: 1000;
  box-shadow: 0 5px 12px rgba(0,0,0,.25);
  border: 1px solid #a58b65;
}

.dropdown:hover .dropdown-content,
.dropdown[open] .dropdown-content {
  display: block;
}

.dropdown-content a {
  display: block;
  padding: 12px 16px;
  color: #49351f;
  border-bottom: 1px solid #c7b594;
  white-space: normal;
}

.dropdown-content a:last-child {
  border-bottom: none;
}

.dropdown-content a:hover {
  background: #cbb58f;
  color: #2d2013;
}

/* Hauptbereich */
main {
  width: 100%;
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem 2.5rem;
}

.hero {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 2rem;
  box-shadow: 0 4px 15px rgba(91, 64, 40, .05);
}

.hero-container {
  max-width: 1350px;
  margin: 0 auto;
}

.hero h2,
h2 {
  color: var(--brown);
  font-size: 2rem;
  font-weight: normal;
  border-bottom: 1px solid var(--line);
  padding-bottom: .35rem;
  margin-top: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.5fr);
  gap: 25px;
  align-items: start;
}

.hero-content,
.welcome-text,
.content-column {
  min-width: 0;
}

.welcome-text {
  font-size: 17px;
  line-height: 1.7;
  overflow-wrap: break-word;
}

.welcome-text h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.3;
}

.content-column {
  width: 100%;
  max-width: 1100px;
  margin-top: 20px;
}

.text-block {
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Seitliche Fotos */
.side-photos {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 12px;
  border: 3px solid #8b7355;
  border-radius: 8px;
  background: #f5f0e6;
}

.side-photos img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border: 1px solid #c5b69d;
}

/* Nachzuchttabelle */
.nachzucht-tabelle {
  margin-top: 25px;
  width: 100%;
  overflow-x: auto;
}

.nachzucht-tabelle table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.nachzucht-tabelle th {
  background: #8b7048;
  color: #fff;
  padding: 12px;
  text-align: left;
  font-weight: bold;
}

.nachzucht-tabelle td {
  padding: 8px 12px;
  border: 1px solid #ddd;
  vertical-align: top;
  width: 50%;
  text-align: left;
}

.nachzucht-tabelle td p {
  margin: 0;
  padding: 0;
  line-height: 1.3;
}

/* Fotoeinträge */
.photo-entry img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #fff;
}

.photo-text {
  margin-top: 12px;
  font-size: .95rem;
  line-height: 1.4;
  color: var(--ink);
}

/* Listen mit Links und Bildern */
.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #c7b594;
}

.link-list li a {
  display: block;
  margin-bottom: 12px;
  font-weight: bold;
}

.link-list img {
  display: block;
  width: 280px;
  max-width: 100%;
  height: auto;
  border-radius: 5px;
}

/* Stammfoto-Bereich */
.stammfoto-bereich {
  max-width: 1100px;
  margin: 0 auto 40px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.stammfoto-bild {
  flex: 0 0 330px;
  height: 465px;
  border: 3px solid #8b7355;
  padding: 4px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.stammfoto-bild img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stammfoto-text {
  flex: 1;
  min-width: 0;
  text-align: left;
  line-height: 1.7;
}

/* Einzelnes Foto mit Beschreibung */
.einzelfoto-bereich {
  width: 100%;
  max-width: 700px;
  margin: 0 auto 40px;
  text-align: center;
}

.einzelfoto-bild {
  width: 100%;
  height: 450px;
  border: 3px solid #8b7355;
  padding: 4px;
  background: #fff;
  margin: 0 auto 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.einzelfoto-bild img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.einzelfoto-text {
  text-align: left;
  line-height: 1.6;
}

/* Fotogalerie */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  width: 100%;
}

.photo-item {
  display: block;
  min-width: 0;
  overflow: hidden;
}

.photo-item img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: transform .3s ease;
}

.photo-item:hover img {
  transform: scale(1.03);
}

/* Pferdegalerie */
.horse-gallery {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 15px;
  margin: 30px 0;
}

.horse-gallery img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: #f5f5f5;
  cursor: pointer;
  transition: transform .3s ease;
}

.horse-gallery img:hover {
  transform: scale(1.03);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .92);
}

.lightbox.open {
  display: flex;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 82vw;
  max-height: 88vh;
}

.lightbox img {
  display: block;
  max-width: 95%;
  max-height: 72vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}

.lightbox-caption-box {
  width: 100%;
  max-width: 680px;
  margin-top: 1rem;
  padding: .85rem 1.4rem;
  background: rgba(255,255,255,.95);
  color: var(--text-main);
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

.lightbox-counter {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: .25rem;
}

.lightbox-caption {
  font-size: .98rem;
  margin-bottom: 0;
  line-height: 1.45;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: var(--text-main);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: background .2s ease, transform .15s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--accent);
  color: #fff;
}

.lightbox-close {
  top: 1.25rem;
  right: 1.5rem;
}

.lightbox-prev {
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev:hover,
.lightbox-next:hover {
  transform: translateY(-50%) scale(1.06);
}

/* CSS-Modal über #foto-... */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.7);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay:target {
  display: flex;
}

.bild-rahmen {
  max-width: 90%;
  max-height: 90%;
  padding: 20px;
  background: #fff;
  border: 5px solid #d4af37;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,.3);
  text-align: center;
  overflow: auto;
}

.bild-rahmen img {
  display: block;
  width: 100%;
  max-width: 500px;
  max-height: 75vh;
  height: auto;
  object-fit: contain;
  border: 1px solid #ccc;
}

.schliessen {
  display: block;
  text-align: right;
  font-size: 24px;
  text-decoration: none;
  color: #333;
  font-weight: bold;
  margin-bottom: 5px;
}

.schliessen:hover {
  color: #f00;
}

/* Fußbereich */
.site-footer {
  background: var(--brown);
  color: #e8dbc6;
  text-align: center;
  padding: 1.4rem 1rem;
  font-size: .9rem;
  margin-top: 3rem;
}

.site-footer a {
  color: #f2d9a9;
}

/* ==========================================================
   Tablet
   ========================================================== */
@media (max-width: 1000px) {
  .side-photos {
    width: 100%;
  }

  .horse-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ==========================================================
   Smartphone / Tablet schmal
   ========================================================== */
@media (max-width: 768px) {
  .site-header {
    padding: 20px 12px;
  }

  .site-header h1 {
    font-size: clamp(1.5rem, 5vw, 25px);
  }

  .years {
    font-size: 1rem;
  }

  .nav-wrap nav {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px;
  }

  .nav-wrap nav > a,
  .nav-wrap nav summary {
    display: block;
    text-align: center;
    padding: 12px;
  }

  .dropdown-content {
    position: static;
    width: 100%;
    min-width: 0;
    box-shadow: none;
  }

  main {
    margin: 1rem auto;
    padding: 12px;
  }

  .hero {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 1rem;
  }

  .side-photos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
  }

  .side-photos img {
    width: 100%;
    height: auto;
  }

  .hero-content {
    width: 100%;
  }

  .welcome-text {
    font-size: 16px;
    line-height: 1.65;
  }

  .welcome-text h2 {
    font-size: 23px;
  }

  .photo-grid,
  .horse-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
  }

  .photo-item {
    width: 100%;
    min-width: 0;
  }

  .photo-item img,
  .horse-gallery img {
    width: 100%;
    height: auto;
    max-height: 260px;
    object-fit: contain;
  }

  .photo-entry img {
    height: auto;
    max-height: 300px;
  }

  .stammfoto-bereich {
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 0 10px;
  }

  .stammfoto-bild {
    flex: none;
    width: 230px;
    max-width: 100%;
    height: 325px;
  }

  .stammfoto-text {
    width: 100%;
    min-width: 0;
  }

  .einzelfoto-bereich {
    width: 100%;
    max-width: 100%;
    padding: 0 12px;
  }

  .einzelfoto-bild {
    width: 100%;
    max-width: 350px;
    height: auto;
    aspect-ratio: 3 / 2;
  }

  .einzelfoto-bild img {
    object-fit: contain;
  }

  .site-footer {
    padding: 20px 12px;
    text-align: center;
    font-size: 14px;
  }

  .nachzucht-tabelle {
    overflow-x: auto;
  }

  .nachzucht-tabelle table {
    min-width: 500px;
  }

  .lightbox-content {
    max-width: 94vw;
  }

  .lightbox img {
    max-height: 68vh;
  }

  .lightbox-prev {
    left: .6rem;
    width: 40px;
    height: 40px;
  }

  .lightbox-next {
    right: .6rem;
    width: 40px;
    height: 40px;
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
  }
}

/* Sehr kleine Smartphones */
@media (max-width: 400px) {
  .site-header h1 {
    font-size: 21px;
  }

  .side-photos,
 .photo-grid,
  .horse-gallery {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 15px;
    width: 100%;
  }

  .photo-item {
    width: 100%;
    min-width: 0;
  }

  .photo-item img,
  .horse-gallery img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
  }
}
/* ==========================================================
   NACHKOMMEN-FOTOS – Smartphone: eine Spalte
   ========================================================== */
@media screen and (max-width: 768px) {

  .nachkommen-fotos {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    gap: 25px !important;
  }

  .nachkommen-fotos .foto-karte {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-column: 1 / -1 !important;
  }

  .nachkommen-fotos .foto-rahmen {
    width: 100% !important;
    max-width: 100% !important;
  }

  .nachkommen-fotos .foto-rahmen img {
    display: block;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
  }
}
/* Nachkommen-Galerie – PC */
.nachkommen-galerie {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

/* Bilderrahmen */
.nachkommen-galerie .foto-rahmen {
  width: 100%;
  height: auto;
  border: 2px solid #8b7355;
  padding: 3px;
  background-color: #fff;
  margin-bottom: 12px;
  box-sizing: border-box;
  overflow: hidden;
}

/* Bilder */
.nachkommen-galerie img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Smartphone */
@media (max-width: 768px) {
  .nachkommen-galerie {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .nachkommen-galerie .foto-rahmen {
    height: auto;
    aspect-ratio: 3 / 2;
  }
}