/*
Theme Name: KJHV Arbeit & Beschäftigung – Lovable exakt 4.0 – Download-Verwaltung
Theme URI: https://kjhv-kiel-gaarden.de
Author: KJHV/GSHN/KJSH-Stiftung
Description: Eigenständiges WordPress-Theme für den Bereich Arbeit und Beschäftigung der KJHV/GSHN/KJSH-Stiftung. Minimalistisch, barrierearm, mit Custom Post Type „Projekt".
Version: 4.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPL v2 or later
Text Domain: kjhv-arbeit
*/

/* ============================================================
   Design-Tokens (1:1 aus der Lovable-Seite übernommen)
   ============================================================ */
:root {
  --background: 38 60% 92%;
  --foreground: 190 45% 12%;
  --card: 0 0% 100%;
  --card-foreground: 190 45% 12%;
  --primary: 186 55% 28%;
  --primary-foreground: 38 40% 97%;
  --secondary: 340 65% 86%;
  --secondary-foreground: 340 50% 28%;
  --muted: 38 45% 88%;
  --muted-foreground: 190 20% 32%;
  --accent: 38 85% 55%;
  --border: 190 20% 82%;
  --hero-bg: 186 55% 84%;
  --section-alt: 340 55% 88%;
  --radius: 0.75rem;
  --container-width: 1100px;
  --container-padding: 1.5rem;
}

/* ============================================================
   Reset & Basis
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  font-size: 1.125rem;
  line-height: 1.75;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}
img { max-width: 100%; height: auto; display: block; }
a { color: hsl(var(--primary)); }
a:hover { text-decoration: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  line-height: 1.2;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
p, ul, ol { margin: 0 0 1em; }
ul, ol { padding-left: 1.25rem; }

:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

a, button {
  min-height: 44px;
  min-width: 44px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.5rem 1rem;
  z-index: 100;
  border-radius: 4px;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ============================================================
   Layout-Bausteine
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.section {
  padding: 2.5rem 0;
  border-bottom: 1px solid hsl(var(--border));
}
.section--alt { background: hsl(var(--section-alt)); }
.section--muted { background: hsl(var(--muted)); }

.hero {
  position: relative;
  overflow: hidden;
  background: hsl(var(--hero-bg));
  border-bottom: 1px solid hsl(var(--border));
}
.hero__bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  filter: saturate(1.3) contrast(1.05);
}
.hero__overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.8);
}
.hero__inner {
  position: relative;
  padding: 2.5rem 0 3rem;
}

.grid { display: grid; gap: 1.5rem; }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid--2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .grid--3 { grid-template-columns: 1fr 1fr 1fr; }
}

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: 2px solid hsl(var(--primary));
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-size: 1rem;
}
.btn:hover { background: hsl(186 55% 22%); border-color: hsl(186 55% 22%); }
.btn--outline {
  background: transparent;
  color: hsl(var(--primary));
}
.btn--outline:hover { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.muted { color: hsl(var(--muted-foreground)); }
.lead { font-size: 1.125rem; max-width: 50rem; }
.whitespace-pre { white-space: pre-line; }

/* ============================================================
   Header & Navigation
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: hsl(var(--card));
  border-bottom: 1px solid hsl(var(--border));
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
}
.site-logo img {
  height: 80px;
  width: auto;
  mix-blend-mode: multiply;
  object-fit: scale-down;
}
@media (min-width: 768px) {
  .site-logo img { height: 128px; }
}

.main-nav { display: none; }
@media (min-width: 768px) {
  .main-nav { display: flex; gap: 0.25rem; }
}
.main-nav a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: hsl(var(--foreground));
  font-weight: 600;
}
.main-nav a:hover { background: hsl(var(--muted)); }
.main-nav .current-menu-item a,
.main-nav .current_page_item a {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.menu-toggle {
  display: inline-flex;
  background: transparent;
  border: none;
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  color: hsl(var(--foreground));
}
@media (min-width: 768px) { .menu-toggle { display: none; } }
.menu-toggle:hover { background: hsl(var(--muted)); }

.mobile-nav {
  display: none;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card));
}
.mobile-nav.is-open { display: block; }
.mobile-nav ul { list-style: none; padding: 0.75rem 0; margin: 0; }
.mobile-nav li { padding: 0; }
.mobile-nav a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: hsl(var(--foreground));
  font-weight: 600;
}
.mobile-nav a:hover { background: hsl(var(--muted)); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  padding: 2rem 0;
  font-size: 0.95rem;
}
.site-footer h3 { font-size: 1.125rem; margin-bottom: 0.5rem; }
.site-footer .grid { gap: 1.5rem; }
.site-footer__legal {
  text-align: center;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  margin-top: 1.5rem;
}
.site-footer a { color: hsl(var(--muted-foreground)); }
.site-footer a:hover { color: hsl(var(--primary)); }

/* ============================================================
   Projekt-Karten (Übersicht)
   ============================================================ */
.projekt-list { display: flex; flex-direction: column; gap: 1.5rem; }
.projekt-card {
  position: relative;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.projekt-card__inner { position: relative; max-width: 50rem; }
.projekt-card h2 { color: hsl(var(--primary)); margin-bottom: 0.5rem; }
.projekt-card p { margin-bottom: 1rem; }

/* ============================================================
   Projekt-Detail
   ============================================================ */
.projekt-detail { padding: 2.5rem 0; }
.projekt-detail h2 { margin-top: 1.5rem; }
.projekt-detail .info-block {
  display: flex; gap: 0.75rem; align-items: flex-start;
  margin-bottom: 1.25rem;
}
.projekt-detail .info-block strong { display: block; }
.projekt-detail .bilder {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .projekt-detail .bilder { grid-template-columns: 1fr 1fr; }
}
.projekt-detail .bilder img {
  width: 100%; height: 14rem; object-fit: cover;
  border-radius: var(--radius); border: 1px solid hsl(var(--border));
}
.kontakt-grid { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .kontakt-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .kontakt-grid { grid-template-columns: 1fr 1fr 1fr; } }
.kontakt-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem;
}
.kontakt-card p { margin: 0 0 0.25rem; }
.box-alt {
  background: hsl(var(--section-alt));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

/* ============================================================
   Formular
   ============================================================ */
.form-grid { display: grid; gap: 1rem; }
.form-field { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field label { font-weight: 600; }
.form-field input,
.form-field textarea {
  font: inherit;
  padding: 0.625rem 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
}
.form-field textarea { min-height: 8rem; resize: vertical; }
@media (min-width: 640px) {
  .form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
}

/* ============================================================
   Utilities
   ============================================================ */
hr { border: none; border-top: 1px solid hsl(var(--border)); margin: 1.5rem 0; }
.text-primary { color: hsl(var(--primary)); }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* Kontakt-Karten: Icons mit Text */
.kjhv-icon-line { display:flex; align-items:flex-start; gap:.5rem; margin:.25rem 0; }
.kjhv-icon-line .kjhv-icon { color: hsl(var(--primary, 186 55% 40%)); flex-shrink:0; margin-top:.15rem; }
.kjhv-icon-line span, .kjhv-icon-line a { line-height:1.4; }


/* ============================================================
   3.1 – Layoutgleichheit, Icons, Projektbilder & Mobile
   ============================================================ */
.container {
  width: min(100%, var(--container-width)) !important;
  margin-inline: auto !important;
  padding-inline: clamp(1.25rem, 4vw, 2rem) !important;
}
.hero__inner,
.section > .container,
.projekt-detail {
  padding-left: clamp(1.25rem, 4vw, 2rem) !important;
  padding-right: clamp(1.25rem, 4vw, 2rem) !important;
}
.section-heading {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.section-heading h2 { margin: 0; }
.section-heading__icon {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  object-fit: contain;
}
.projekt-detail h2 {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.projekt-detail h2 .kjhv-heading-icon {
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 1.7rem;
  object-fit: contain;
}
.projekt-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.projekt-gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
}
.site-header__inner { min-height: 74px; }
.site-logo img { height: 56px; }
@media (min-width: 1100px) {
  .site-logo img { height: 76px; }
}
@media (max-width: 1099px) {
  .main-nav { display: none !important; }
  .menu-toggle { display: inline-flex !important; position: relative; z-index: 52; }
  .mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 50;
    padding-top: 78px;
    background: rgba(255,255,255,.98);
    overflow-y: auto;
    border: 0;
  }
  .mobile-nav.is-open { display: block; }
  .mobile-nav .container { max-width: none; padding: 1rem 1.25rem 2rem !important; }
  .mobile-nav ul { display: flex !important; flex-direction: column; gap: .5rem; padding: 0; }
  .mobile-nav a {
    padding: .9rem 1rem;
    font-size: 1.05rem;
    border-radius: .5rem;
  }
  .mobile-nav .current-menu-item a,
  .mobile-nav .current_page_item a { background: hsl(var(--secondary)); }
  body.kjhv-menu-open { overflow: hidden; }
}
@media (min-width: 1100px) {
  .main-nav { display: flex; }
  .menu-toggle, .mobile-nav { display: none !important; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; line-height: 1.65; }
  h1 { font-size: clamp(2rem, 10vw, 2.65rem); }
  h2 { font-size: clamp(1.65rem, 8vw, 2rem); }
  h3 { font-size: 1.3rem; }
  .hero__inner { padding-top: 2rem !important; padding-bottom: 2.25rem !important; }
  .section { padding: 2rem 0; }
  .card { padding: 1.15rem; }
  .grid { gap: 1rem; }
  .projekt-gallery { grid-template-columns: 1fr; }
  .projekt-detail { padding-top: 2rem !important; padding-bottom: 2rem !important; }
  .btn { width: auto; max-width: 100%; white-space: normal; }
}

/* ============================================================
   3.2 – Lovable-Mobile-Menü und einheitliche Linien-Icons
   ============================================================ */
.section-heading .kjhv-icon,
.projekt-detail h2 .kjhv-icon,
.projekt-detail > .info-block > .kjhv-icon,
.kooperation-line > .kjhv-icon,
.projekt-meta-line > .kjhv-icon {
  color: hsl(var(--primary));
  flex: 0 0 auto;
}
.section-heading .kjhv-icon { width: 1.45rem; height: 1.45rem; }
.projekt-detail h2 .kjhv-icon { width: 1.35rem; height: 1.35rem; }
.projekt-detail .info-block { gap: .55rem; }
.projekt-detail .info-block > .kjhv-icon { margin-top: .12rem; width: 1rem; height: 1rem; }
.projekt-meta-line,
.kooperation-line {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.projekt-meta-line > .kjhv-icon,
.kooperation-line > .kjhv-icon { margin-top: .18rem; width: 1rem; height: 1rem; }
.kooperation-line { margin-top: 1.5rem; font-style: italic; }

@media (max-width: 1099px) {
  .site-header { position: sticky; top: 0; }
  .site-header__inner { position: relative; z-index: 2; background: hsl(var(--card)); }
  .mobile-nav,
  .mobile-nav.is-open {
    position: static;
    inset: auto;
    z-index: auto;
    padding-top: 0;
    width: 100%;
    max-height: 0;
    display: block;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    background: hsl(var(--card));
    border-top: 1px solid hsl(var(--border));
    transition: max-height .24s ease, opacity .18s ease, visibility .18s ease;
  }
  .mobile-nav.is-open {
    max-height: 24rem;
    visibility: visible;
    opacity: 1;
    border-bottom: 1px solid hsl(var(--border));
    box-shadow: 0 8px 18px rgba(0,0,0,.08);
  }
  .mobile-nav .container {
    max-width: none;
    padding: .75rem 1.25rem 1rem !important;
  }
  .mobile-nav ul { gap: .25rem; }
  .mobile-nav a {
    padding: .72rem .85rem;
    font-size: .98rem;
  }
  body.kjhv-menu-open { overflow: auto; }
}


/* ============================================================
   3.3 – Detailangleichung an Lovable
   ============================================================ */
html { scrollbar-gutter: stable; }
.site-header {
  width: 100%;
  transform: none !important;
  transition: none !important;
}
.site-header__inner {
  min-height: 86px;
  height: 86px;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  transition: none !important;
}
.site-logo,
.site-logo img { display: block; transition: none !important; }
.site-logo img { height: 58px; max-height: 58px; }
@media (min-width: 1100px) {
  .site-header__inner { min-height: 92px; height: 92px; }
  .site-logo img { height: 66px; max-height: 66px; }
}

/* Navigation wie Lovable: ruhige rosa Zustände ohne Größen-/Positionssprung */
.main-nav a,
.mobile-nav a,
.btn { transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease; }
.main-nav a:hover,
.main-nav a:focus-visible,
.mobile-nav a:hover,
.mobile-nav a:focus-visible {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  text-decoration: none;
  outline: none;
}
.main-nav .current-menu-item a,
.main-nav .current_page_item a,
.main-nav .current-menu-ancestor a,
.mobile-nav .current-menu-item a,
.mobile-nav .current_page_item a,
.mobile-nav .current-menu-ancestor a {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

/* Zurück-Button: Lovable-ähnlicher Outline-Hover ohne Bewegung */
.hero .btn--outline {
  background: rgba(255,255,255,.72);
  border: 1px solid hsl(var(--primary));
  color: hsl(var(--foreground));
  box-shadow: none;
  transform: none !important;
}
.hero .btn--outline:hover,
.hero .btn--outline:focus-visible {
  background: hsl(var(--secondary));
  border-color: hsl(var(--primary));
  color: hsl(var(--foreground));
  box-shadow: 0 0 0 2px rgba(28,111,119,.10);
  transform: none !important;
}

/* Icons etwas größer und exakt an Text-Baseline ausgerichtet */
.section-heading { align-items: center; }
.section-heading .kjhv-icon { width: 1.65rem; height: 1.65rem; }
.projekt-detail h2 { align-items: center; line-height: 1.2; }
.projekt-detail h2 .kjhv-icon { width: 1.55rem; height: 1.55rem; flex-basis: 1.55rem; }
.projekt-detail .info-block { align-items: flex-start; gap: .65rem; }
.projekt-detail .info-block > .kjhv-icon {
  width: 1.18rem;
  height: 1.18rem;
  margin-top: .08rem;
}
.projekt-meta-line,
.kooperation-line { align-items: center; }
.projekt-meta-line > .kjhv-icon,
.kooperation-line > .kjhv-icon {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0;
}

/* Streetwork-Kontaktbereich entsprechend Lovable */
.streetwork-contact-title { margin-top: 1.4rem; margin-bottom: .75rem; }
.streetwork-contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
  margin-bottom: 1.25rem;
}
.streetwork-contact-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem;
}
.streetwork-contact-card .kjhv-icon-line { margin: .2rem 0; }
.streetwork-contact-card .kjhv-icon { width: 1.05rem; height: 1.05rem; }
@media (max-width: 700px) {
  .streetwork-contact-grid { grid-template-columns: 1fr; }
  .site-header__inner { min-height: 74px; height: 74px; }
  .site-logo img { height: 52px; max-height: 52px; }
}

/* Externe Linkliste der Ganztagsschulen */
.project-link-list a { text-decoration: underline; text-underline-offset: 2px; }
.project-link-list a:hover,
.project-link-list a:focus-visible { color: hsl(var(--primary)); text-decoration-thickness: 2px; }

.single-projekt .main-nav a[href*="/projekte/"],
.single-projekt .mobile-nav a[href*="/projekte/"] {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}
@media (min-width: 783px) { .admin-bar .site-header { top: 32px; } }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }


/* ============================================================
   3.4 – Mobile Hero-Überschriften
   ============================================================ */
@media (max-width: 640px) {
  .hero--home .hero__title,
  .hero--complaints .hero__title {
    width: 100%;
    max-width: 20ch;
    margin-right: auto;
    line-height: 1.08;
    letter-spacing: -0.02em;
  }

  .hero--home .hero__title {
    font-size: clamp(1.95rem, 8.6vw, 2.3rem);
    max-width: 17ch;
  }

  .hero--complaints .hero__title {
    font-size: clamp(1.85rem, 8vw, 2.2rem);
    max-width: 100%;
    overflow-wrap: anywhere;
    hyphens: auto;
  }
}

@media (max-width: 390px) {
  .hero--home .hero__title {
    font-size: clamp(1.8rem, 8.3vw, 2.05rem);
  }

  .hero--complaints .hero__title {
    font-size: clamp(1.7rem, 7.8vw, 1.95rem);
  }
}
