/* ==========================================================
   PAGE: Kontakt
   Kontaktpersonen, Kontaktformular und Modal
   ========================================================== */

/* ----------------------------------------------------------
   SEO-/Einleitungsbereich
   ---------------------------------------------------------- */

main > .intro#kontakt,
#kontakt.intro {
  width: 96vw;
  max-width: none;
  margin: 0 auto;
  padding: clamp(2.6rem, 4.6vw, 4.4rem) 0 clamp(2.4rem, 3.6vw, 3.2rem);

  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  column-gap: clamp(1.4rem, 2.4vw, 2.6rem);
  row-gap: clamp(1.15rem, 2.2vw, 1.8rem);
  align-items: start;
}

#kontakt h1 {
  grid-column: 1 / 4;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  justify-self: center;
  font-size: clamp(2.7rem, 3.7vw, 4.2rem);
  line-height: 1.03;
  letter-spacing: -0.055em;
  color: #172033;
}

#kontakt > p {
  grid-column: 4 / 7;
  max-width: 1150px;
  margin: 0;
  text-align: left;
  color: #506174;
  font-size: clamp(1.02rem, 1.12vw, 1.18rem);
  line-height: 1.72;
}

#kontakt > p + p {
  margin-top: clamp(0.65rem, 1vw, 0.95rem);
}

#kontakt h2 {
  grid-column: 1 / -1;
  position: relative;
  box-sizing: border-box;
  margin: clamp(2rem, 3.4vw, 2.8rem) 0 0;
  padding-top: clamp(1.2rem, 1.8vw, 1.55rem);
  padding-right: 50%;
  text-align: center;
  font-size: clamp(1.65rem, 2.2vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #172033;
}

#kontakt h2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #d8aa2d 0%,
    rgba(216, 170, 45, 0.42) 38%,
    rgba(23, 32, 51, 0.08) 100%
  );
}

/* Drei gleich große Karten nebeneinander, statisch leicht abgestuft */
#kontakt > .kontakt-person:nth-of-type(1) {
  grid-column: 1 / 3;
  justify-self: end;
  width: min(100%, 520px);
  margin-top: 0;
}

#kontakt > .kontakt-person:nth-of-type(2) {
  grid-column: 3 / 5;
  justify-self: center;
  width: min(100%, 520px);
  margin-top: 0.85rem;
}

#kontakt > .kontakt-person:nth-of-type(3) {
  grid-column: 5 / 7;
  justify-self: start;
  width: min(100%, 520px);
  margin-top: 1.7rem;
}

/* Breite Desktop-Ansicht: Inhalt nutzt den Bildschirm deutlich stärker */
@media (min-width: 1280px) {
  #kontakt > .kontakt-person:nth-of-type(1),
  #kontakt > .kontakt-person:nth-of-type(2),
  #kontakt > .kontakt-person:nth-of-type(3) {
    min-width: 0;
    width: min(100%, 720px);
  }
}

/* ----------------------------------------------------------
   Ansprechpartner-Karten
   ---------------------------------------------------------- */

.kontakt-person {
  position: relative;
  grid-column: auto;
  align-self: start;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(1.15rem, 1.7vw, 1.75rem);

  width: 100%;
  max-width: none;
  min-height: 220px;
  margin: 0;
  padding: clamp(1.35rem, 1.8vw, 1.85rem);

  text-align: left;
  overflow: hidden;
  border: 1px solid rgba(23, 32, 51, 0.10);
  border-radius: clamp(1.15rem, 1.8vw, 1.55rem);
  background:
    radial-gradient(circle at right bottom, rgba(244, 211, 94, 0.19), transparent 36%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
  box-shadow:
    0 18px 44px rgba(23, 32, 51, 0.10),
    0 1px 0 rgba(255, 255, 255, 0.86) inset;
  transition:
    box-shadow 0.22s ease,
    border-color 0.22s ease,
    background 0.22s ease;
}

.kontakt-person::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #f0d36b, #d8aa2d);
  opacity: 0.95;
}

.kontakt-person:hover {
  border-color: rgba(216, 170, 45, 0.42);
  box-shadow:
    0 24px 58px rgba(23, 32, 51, 0.15),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.kontakt-text {
  min-width: 0;
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(0.95rem, 1.6vw, 1.35rem);
}

.kontakt-person img {
  width: clamp(130px, 7.2vw, 170px);
  height: clamp(130px, 7.2vw, 170px);
  margin: 0;
  border-radius: 20px;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 16px 28px rgba(23, 32, 51, 0.20),
    0 0 0 1px rgba(23, 32, 51, 0.08);
  background: #fff;
}

.kontakt-person h3,
.kontakt-person p {
  margin: 0;
}

.kontakt-person h3 {
  color: #172033;
  font-size: clamp(1.08rem, 1.35vw, 1.28rem);
  line-height: 1.24;
  letter-spacing: -0.015em;
}

.kontakt-person a {
  color: #6c520c;
  text-decoration: none;
}

.kontakt-person a:hover {
  text-decoration: underline;
}

.kontakt-btn,
.kontakt-form button[type="submit"] {
  appearance: none;
  border: 1px solid rgba(242, 212, 107, 0.26);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff8dc;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 34%),
    linear-gradient(135deg, #172033 0%, #101827 100%);
  box-shadow:
    0 12px 24px rgba(23, 32, 51, 0.26),
    0 1px 0 rgba(255, 255, 255, 0.16) inset;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.kontakt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.72rem 1.2rem;
  margin-top: auto;
  white-space: nowrap;
}

.kontakt-btn::after {
  content: "›";
  display: inline-block;
  margin-left: 0.45rem;
  color: #f0d36b;
  font-size: 1.05em;
  line-height: 1;
  transform: translateY(-0.02em);
}

.kontakt-btn:hover,
.kontakt-form button[type="submit"]:hover {
  transform: translateY(-2px);
  border-color: rgba(242, 212, 107, 0.5);
  background:
    linear-gradient(135deg, rgba(242, 212, 107, 0.18), transparent 36%),
    linear-gradient(135deg, #202b42 0%, #111827 100%);
  box-shadow:
    0 16px 32px rgba(23, 32, 51, 0.34),
    0 1px 0 rgba(255, 255, 255, 0.18) inset;
}

.kontakt-btn:focus-visible,
.kontakt-close:focus-visible,
.kontakt-form input:focus-visible,
.kontakt-form textarea:focus-visible,
.kontakt-form button[type="submit"]:focus-visible {
  outline: 3px solid rgba(242, 212, 107, 0.72);
  outline-offset: 3px;
}

.kontakt-spacer {
  height: clamp(2.2rem, 5vw, 4rem);
}

.kontakt-hidden {
  display: none;
}

/* ----------------------------------------------------------
   Overlay / Modal
   ---------------------------------------------------------- */

.kontakt-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(9, 14, 24, 0.64);
  z-index: 9999;
  overflow-y: auto;
  overscroll-behavior: contain;
  backdrop-filter: blur(4px);
}

.kontakt-modal.is-open {
  display: flex;
}

.kontakt-dialog {
  width: min(760px, calc(100vw - 2rem));
  max-height: calc(var(--kontakt-vh, 100dvh) - 2rem);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  overflow: hidden;
  transform: translateY(6px);
  display: flex;
  flex-direction: column;
}

.kontakt-dialog-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: clamp(1rem, 2vw, 1.2rem);
  border-bottom: 1px solid rgba(23, 32, 51, 0.10);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.kontakt-dialog-header h2 {
  margin: 0;
  font-size: clamp(1.18rem, 2vw, 1.35rem);
  line-height: 1.2;
  color: #172033;
}

.kontakt-close {
  flex: 0 0 auto;
  border: 0;
  background: rgba(23, 32, 51, 0.06);
  color: #172033;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.55rem;
  border-radius: 12px;
}

.kontakt-close:hover {
  background: rgba(23, 32, 51, 0.11);
}

.kontakt-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: clamp(1rem, 2vw, 1.25rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.kontakt-hinweis {
  margin: 0 0 0.75rem;
  color: #506174;
}

/* ----------------------------------------------------------
   Formular
   ---------------------------------------------------------- */

.kontakt-form label {
  display: block;
  margin: 0.8rem 0 0.35rem;
  font-weight: 700;
  color: #172033;
}

.kontakt-form input,
.kontakt-form textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(23, 32, 51, 0.18);
  background: #fff;
  color: #172033;
  font: inherit;
  font-size: 16px;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.kontakt-form textarea {
  min-height: 8rem;
  max-height: 34dvh;
  resize: vertical;
}

.kontakt-form input[type="file"] {
  padding: 0.65rem;
  cursor: pointer;
}

.kontakt-form input[type="file"]::file-selector-button {
  appearance: none;
  margin-right: 0.8rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(242, 212, 107, 0.34);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  color: #fff8dc;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 34%),
    linear-gradient(135deg, #172033 0%, #101827 100%);
}

.kontakt-form input[type="file"]::file-selector-button:hover {
  border-color: rgba(242, 212, 107, 0.5);
  background:
    linear-gradient(135deg, rgba(242, 212, 107, 0.18), transparent 36%),
    linear-gradient(135deg, #202b42 0%, #111827 100%);
}

.kontakt-upload-hinweis {
  margin: 0.4rem 0 0.45rem;
  color: #586678;
  font-size: 0.9rem;
  line-height: 1.42;
}

.kontakt-upload-list {
  display: grid;
  gap: 0.35rem;
  margin: 0.35rem 0 0.4rem;
  font-size: 0.88rem;
  line-height: 1.35;
  color: #506174;
}

.kontakt-upload-list p {
  margin: 0;
}

.kontakt-upload-list .is-error {
  color: #9f1239;
  font-weight: 800;
}

.kontakt-upload-list .is-ok {
  color: #14532d;
  font-weight: 700;
}

.kontakt-form input:focus,
.kontakt-form textarea:focus {
  border-color: rgba(216, 170, 45, 0.72);
  box-shadow: 0 0 0 4px rgba(242, 212, 107, 0.22);
  background-color: #fffdf6;
}

.kontakt-form button[type="submit"] {
  margin-top: 1rem;
  padding: 0.85rem 1.2rem;
}

.kontakt-success {
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: rgba(34, 134, 75, 0.10);
  border: 1px solid rgba(34, 134, 75, 0.26);
  color: #14532d;
  font-weight: 700;
}

.datenschutz-hinweis {
  margin: 0.8rem 0 1rem;
  font-size: 0.92rem;
  line-height: 1.48;
  color: #586678;
}

.datenschutz-hinweis a {
  color: #6c520c;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/*
   Honeypot-Feld gegen Formularbots.
   Für echte Besucher unsichtbar und nicht bedienbar.
*/
.kontakt-honeypot {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  tab-size: 0;
}

/* ----------------------------------------------------------
   Große Monitore
   ---------------------------------------------------------- */

@media (min-width: 1500px) {
  main > .intro#kontakt,
  #kontakt.intro {
    width: 96vw;
  }
}

/* ----------------------------------------------------------
   Tablet
   ---------------------------------------------------------- */

@media (max-width: 1120px) {
  main > .intro#kontakt,
  #kontakt.intro {
    width: min(940px, calc(100% - (var(--site-gutter, 1.5rem) * 2)));
    grid-template-columns: 1fr;
    row-gap: 1rem;
  }

  #kontakt h1,
  #kontakt > p {
    grid-column: 1 / -1;
    max-width: 920px;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  #kontakt h2 {
    text-align: center;
  }

  #kontakt h2::before {
    left: 50%;
    transform: translateX(-50%);
  }

  .kontakt-person {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #kontakt > .kontakt-person:nth-of-type(1),
  #kontakt > .kontakt-person:nth-of-type(2),
  #kontakt > .kontakt-person:nth-of-type(3) {
    grid-column: 1 / -1;
    margin-top: 0;
  }
}

@media (max-width: 900px) {
  main > .intro#kontakt,
  #kontakt.intro {
    width: calc(100% - 1.5rem);
  }

  .kontakt-person {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }

  .kontakt-text {
    align-items: center;
  }

  .kontakt-person img {
    order: -1;
    width: 112px;
    height: 112px;
    border-radius: 22px;
  }
}

/* Mobil + Smartphone quer */
@media (max-width: 768px), (max-height: 520px) and (max-width: 950px) {
  main > .intro#kontakt,
  #kontakt.intro {
    padding-top: clamp(2.2rem, 8vw, 3.2rem);
  }

  #kontakt h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  #kontakt > p {
    font-size: 1rem;
    line-height: 1.65;
  }

  .kontakt-person {
    padding: 1.25rem;
  }

  .kontakt-spacer {
    height: 42px;
  }

  /*
     Auf Smartphones als Vollbild-Dialog.
     So wird nichts abgeschnitten und das Formular bleibt sauber scrollbar.
  */
  .kontakt-modal {
    display: none;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    overflow: hidden;
  }

  .kontakt-modal.is-open {
    display: block;
  }

  .kontakt-dialog {
    width: 100%;
    height: var(--kontakt-vh, 100dvh);
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .kontakt-dialog-header {
    flex: 0 0 auto;
    padding: 0.75rem 0.85rem;
    background: #fff;
  }

  .kontakt-dialog-header h2 {
    font-size: 1.05rem;
  }

  .kontakt-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 0.85rem calc(1rem + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }

  .kontakt-form label {
    margin: 0.55rem 0 0.25rem;
  }

  .kontakt-form input,
  .kontakt-form textarea {
    padding: 0.62rem 0.7rem;
    font-size: 16px;
  }

  .kontakt-form textarea {
    min-height: 5.8rem;
    max-height: 9rem;
    resize: vertical;
  }

  .datenschutz-hinweis {
    font-size: 0.86rem;
    line-height: 1.38;
  }

  .kontakt-form button[type="submit"] {
    position: static;
    width: 100%;
    margin-top: 0.8rem;
    padding: 0.8rem 1rem;
    box-shadow: none;
  }
}

/* Sehr niedrige Displays, z. B. Smartphone quer */
@media (max-height: 520px) and (max-width: 950px) {
  .kontakt-dialog-header {
    padding: 0.5rem 0.75rem;
  }

  .kontakt-dialog-body {
    padding: 0.5rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
  }

  .kontakt-form label {
    margin: 0.38rem 0 0.18rem;
  }

  .kontakt-form input,
  .kontakt-form textarea {
    padding: 0.48rem 0.65rem;
  }

  .kontakt-form textarea {
    min-height: 3.8rem;
    max-height: 5.5rem;
  }

  .datenschutz-hinweis {
    margin: 0.5rem 0 0.65rem;
    font-size: 0.82rem;
    line-height: 1.32;
  }

  .kontakt-form button[type="submit"] {
    margin-top: 0.55rem;
    padding: 0.62rem 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kontakt-person,
  .kontakt-btn,
  .kontakt-form button[type="submit"],
  .kontakt-form input,
  .kontakt-form textarea {
    transition: none;
  }

  .kontakt-person:hover,
  .kontakt-btn:hover,
  .kontakt-form button[type="submit"]:hover {
    transform: none;
  }
}