/*--------------------------------------------------------------
# Blog
# Nur auf blog.html, blog-en.html und den Beitragsseiten geladen
# (blog-vorlage.html, blog-template-en.html und ihre Kopien).
#
# main.css und die SCSS-Dateien bleiben unberuehrt (siehe CLAUDE.md:
# ob main.css direkt bearbeitet wurde, ist ungeklaert). Die Werte fuer
# Rundung, Rahmen, Schatten und Kontaktbox sind von projektkultur.html
# uebernommen; die Kontaktbox-Regeln haengen in main.css an .services
# und sind deshalb hier fuer .blog-contact nachgezogen.
--------------------------------------------------------------*/

:root {
  /* Fester Header: 83 px am Desktop, 78 px mobil, plus Luft */
  --blog-header-offset: 104px;
  --blog-line: color-mix(in srgb, var(--default-color), transparent 90%);
  --blog-muted: color-mix(in srgb, var(--default-color), transparent 35%);
}

@media (max-width: 1199.98px) {
  :root {
    --blog-header-offset: 96px;
  }
}

/*--------------------------------------------------------------
# Kopfbereich (Beitrag und Uebersicht)
# Der Keil im Hintergrund ist derselbe wie im Hero von projektkultur.html.
--------------------------------------------------------------*/
.blog-hero {
  position: relative;
  padding: 150px 0 64px;
}

.blog-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-color) 10%, var(--accent-color) 45%, transparent 45%, transparent 100%);
  opacity: 0.05;
  pointer-events: none;
}

.blog-hero .container {
  position: relative;
}

.blog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-bottom: 1.25rem;
  font-size: 14px;
  line-height: 1.4;
  color: var(--blog-muted);
}

.blog-meta i {
  margin-right: 4px;
}

.blog-meta-sep {
  color: color-mix(in srgb, var(--default-color), transparent 70%);
}

.blog-category {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-color), transparent 90%);
  color: var(--accent-color);
  font-family: var(--heading-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.blog-title {
  max-width: 60rem;
  margin: 0 0 1.25rem;
  font-size: clamp(2rem, 1.25rem + 2.5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: break-word;
}

.blog-lead {
  max-width: 42rem;
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.6;
  color: color-mix(in srgb, var(--default-color), transparent 25%);
}

/* Titelbild: volle Containerbreite, breiter als Text und Seitenleiste */
.blog-cover {
  margin: 3rem 0 0;
}

.blog-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  border-radius: 1rem;
  box-shadow: 0 20px 40px color-mix(in srgb, var(--default-color), transparent 85%);
}

/* Uebersicht: Seitentitel wie die Seitentitel der uebrigen Seiten */
.blog-hero--index {
  padding-bottom: 56px;
}

.blog-index-title {
  margin: 0 0 20px;
  font-size: 56px;
  font-weight: 700;
  line-height: 1.2;
}

.blog-index-title span {
  position: relative;
  color: var(--accent-color);
}

.blog-index-title span::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--accent-color);
  opacity: 0.3;
}

/*--------------------------------------------------------------
# Beitrag: Text links, Seitenleiste rechts
# Mobil eine Spalte: Inhaltsverzeichnis ueber dem Text, Kontaktbox darunter.
# Dafuer loest sich .blog-sidebar mobil auf (display: contents), und das
# Inhaltsverzeichnis rueckt per order nach vorn. Im Quelltext bleibt die
# Reihenfolge Text > Seitenleiste.
--------------------------------------------------------------*/
.blog-body {
  padding: 64px 0 96px;
}

.blog-layout {
  display: flex;
  flex-direction: column;
}

.blog-sidebar {
  display: contents;
}

.blog-toc {
  order: -1;
  margin-bottom: 2rem;
}

.blog-contact {
  margin-top: 3.5rem;
}

@media (min-width: 992px) {
  .blog-layout {
    display: grid;
    grid-template-columns: minmax(0, 42rem) 18.75rem;
    justify-content: space-between;
    align-items: start;
    column-gap: 3rem;
  }

  .blog-sidebar {
    display: block;
    position: sticky;
    top: var(--blog-header-offset);
    max-height: calc(100vh - var(--blog-header-offset) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .blog-toc {
    margin-bottom: 2.5rem;
  }

  .blog-contact {
    margin-top: 0;
  }
}

/* Bei niedrigem Fenster passt die Seitenleiste mit Foto nicht ganz ins Bild */
@media (min-width: 992px) and (max-height: 900px) {
  .blog-contact .highlight-image {
    display: none;
  }
}

/*--------------------------------------------------------------
# Inhaltsverzeichnis (wird von assets/js/blog.js gefuellt;
# ohne JavaScript bleibt es per hidden ausgeblendet)
--------------------------------------------------------------*/
.blog-toc-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  cursor: pointer;
  font-family: var(--heading-font);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--heading-color);
}

.blog-toc-details > summary::-webkit-details-marker {
  display: none;
}

.blog-toc-details > summary i {
  font-size: 14px;
  color: var(--accent-color);
  transition: transform 0.2s ease;
}

.blog-toc-details[open] > summary i {
  transform: rotate(180deg);
}

.blog-toc-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--blog-line);
}

.blog-toc-list a {
  display: block;
  margin-left: -1px;
  padding: 6px 0 6px 16px;
  border-left: 2px solid transparent;
  font-size: 15px;
  line-height: 1.4;
  color: color-mix(in srgb, var(--default-color), transparent 30%);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.blog-toc-list a:hover {
  color: var(--accent-color);
}

.blog-toc-list a[aria-current="true"] {
  border-left-color: var(--accent-color);
  color: var(--accent-color);
}

@media (max-width: 991.98px) {
  .blog-toc {
    padding: 14px 18px;
    border: 1px solid var(--blog-line);
    background: var(--surface-color);
  }

  .blog-toc-details > summary {
    min-height: 28px;
  }

  .blog-toc-list {
    margin-bottom: 4px;
  }
}

@media (min-width: 992px) {
  .blog-toc-details > summary {
    cursor: default;
  }

  .blog-toc-details > summary i {
    display: none;
  }
}

/*--------------------------------------------------------------
# Beitragstext
--------------------------------------------------------------*/
.blog-content {
  font-size: 1.125rem;
  line-height: 1.75;
  color: color-mix(in srgb, var(--default-color), transparent 15%);
}

.blog-content > :first-child {
  margin-top: 0;
}

.blog-content p {
  margin: 0 0 1.5rem;
}

.blog-content h2 {
  margin: 3.5rem 0 1rem;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  scroll-margin-top: var(--blog-header-offset);
}

.blog-content h3 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.35;
  scroll-margin-top: var(--blog-header-offset);
}

.blog-content a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent-color), transparent 50%);
}

.blog-content a:hover {
  color: var(--accent-color);
  text-decoration-color: currentColor;
}

.blog-content strong {
  font-weight: 700;
  color: var(--default-color);
}

.blog-content ul,
.blog-content ol {
  margin: 0 0 1.75rem;
  padding-left: 1.5rem;
}

.blog-content li {
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}

.blog-content li::marker {
  color: var(--accent-color);
}

.blog-content ol > li::marker {
  font-family: var(--heading-font);
  font-weight: 700;
}

/* Zitat mit Quelle */
.blog-quote {
  margin: 3rem 0;
  padding-left: 1.75rem;
  border-left: 3px solid var(--accent-color);
}

.blog-quote blockquote {
  margin: 0;
  font-family: var(--heading-font);
  font-size: 1.5rem;
  line-height: 1.45;
  color: var(--heading-color);
}

.blog-quote blockquote p {
  margin: 0;
}

.blog-quote figcaption {
  margin-top: 1rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--blog-muted);
}

/* Bild mit Bildunterschrift */
.blog-figure {
  margin: 2.5rem 0;
}

.blog-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1rem;
}

.blog-figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--blog-muted);
}

/*--------------------------------------------------------------
# Kontaktbox (Werte wie .services .service-highlight in main.css)
--------------------------------------------------------------*/
.blog-contact {
  overflow: hidden;
  border: 1px solid var(--blog-line);
  background: var(--surface-color);
}

.blog-contact .highlight-image img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.blog-contact .highlight-content {
  padding: 30px;
}

.blog-contact .blog-contact-title {
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: 600;
  color: var(--heading-color);
}

.blog-contact .highlight-content p {
  margin-bottom: 25px;
  font-size: 14px;
  line-height: 1.6;
  color: color-mix(in srgb, var(--default-color), transparent 20%);
}

.blog-contact .contact-info {
  margin-bottom: 25px;
}

.blog-contact .contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--default-color);
}

.blog-contact a.contact-item:hover {
  color: var(--accent-color);
}

.blog-contact .contact-item i {
  width: 18px;
  font-size: 16px;
  color: var(--accent-color);
}

.blog-contact .btn {
  --bs-btn-color: var(--contrast-color);
  --bs-btn-bg: var(--accent-color);
  --bs-btn-hover-color: var(--contrast-color);
  --bs-btn-hover-bg: color-mix(in srgb, var(--accent-color), black 15%);
  --bs-btn-active-color: var(--contrast-color);
  --bs-btn-active-bg: color-mix(in srgb, var(--accent-color), black 15%);
  --bs-btn-focus-shadow-rgb: 44, 72, 152;
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  background: var(--accent-color);
  color: var(--contrast-color);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease-in-out;
}

.blog-contact .btn:hover {
  background: color-mix(in srgb, var(--accent-color), black 15%);
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .blog-contact .highlight-content {
    padding: 25px 20px;
  }
}

/*--------------------------------------------------------------
# Beitragskarte (Uebersicht und "Weitere Beitraege")
# Rundung, Rahmen und Hover-Schatten wie die Karten auf projektkultur.html.
# Die ganze Karte ist klickbar: Der Link sitzt am Titel und wird per ::after
# ueber die Karte gezogen. "Weiterlesen" ist nur Anzeige, kein zweiter Link.
--------------------------------------------------------------*/
.blog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

.blog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--blog-line);
  border-radius: 1rem;
  background: var(--surface-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-0.5rem);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.1);
}

.blog-card:has(:focus-visible) {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
}

.blog-card-image {
  overflow: hidden;
  background: color-mix(in srgb, var(--accent-color), transparent 92%);
}

.blog-card-image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.blog-card:hover .blog-card-image img {
  transform: scale(1.03);
}

.blog-card-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 1.75rem 2rem 2rem;
}

.blog-card .blog-meta {
  margin-bottom: 1rem;
  font-size: 13px;
}

.blog-card-title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: break-word;
}

.blog-card-title a {
  color: var(--heading-color);
}

.blog-card-title a:hover {
  color: var(--heading-color);
}

.blog-card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.blog-card-title a:focus-visible {
  outline: none;
}

.blog-card-teaser {
  margin: 0 0 1.5rem;
  font-size: 15px;
  line-height: 1.6;
  color: color-mix(in srgb, var(--default-color), transparent 20%);
}

.blog-card-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-color);
}

.blog-card-more i {
  transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-more i {
  transform: translateX(3px);
}

/* Uebersicht: zwei Spalten, die erste (neueste) Karte liegt quer ueber beide.
   Bleibt am Ende eine Karte allein (gerade Anzahl), liegt sie ebenfalls quer,
   aber in normaler Titelgroesse. Wer oben eine neue Karte eintraegt, bekommt
   beides automatisch. */
.blog-list {
  padding: 64px 0 96px;
}

@media (min-width: 768px) {
  .blog-grid--index {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem 2rem;
  }

  .blog-grid--index > .blog-card:first-child,
  .blog-grid--index > .blog-card:nth-child(even):last-child {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .blog-grid--index > .blog-card:first-child .blog-card-image,
  .blog-grid--index > .blog-card:nth-child(even):last-child .blog-card-image {
    position: relative;
    flex: 0 0 50%;
    min-height: 20rem;
  }

  .blog-grid--index > .blog-card:first-child .blog-card-image img,
  .blog-grid--index > .blog-card:nth-child(even):last-child .blog-card-image img {
    position: absolute;
    inset: 0;
    height: 100%;
    aspect-ratio: auto;
  }

  .blog-grid--index > .blog-card:first-child .blog-card-body,
  .blog-grid--index > .blog-card:nth-child(even):last-child .blog-card-body {
    justify-content: center;
    padding: 2.5rem;
  }

  .blog-grid--index > .blog-card:first-child .blog-card-more,
  .blog-grid--index > .blog-card:nth-child(even):last-child .blog-card-more {
    margin-top: 0;
  }

  .blog-grid--index > .blog-card:first-child .blog-card-title {
    font-size: 1.75rem;
    line-height: 1.25;
  }

  .blog-grid--index > .blog-card:first-child .blog-card-teaser {
    font-size: 16px;
  }
}

@media (min-width: 992px) {
  .blog-grid--index > .blog-card:first-child .blog-card-image {
    flex-basis: 58%;
    min-height: 24rem;
  }

  .blog-grid--index > .blog-card:first-child .blog-card-body {
    padding: 3rem;
  }
}

/* Liste und "Weitere Beitraege" haben dieselbe Flaeche wie der Footer;
   die Haarlinie haelt beide auseinander. */
.footer {
  border-top: 1px solid var(--blog-line);
}

/* "Weitere Beitraege": zwei oder drei nebeneinander, am Tablet quer gestapelt */
.blog-related {
  padding: 80px 0 96px;
}

.blog-related .section-title {
  padding-bottom: 48px;
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .blog-grid--related > .blog-card {
    flex-direction: row;
  }

  .blog-grid--related > .blog-card .blog-card-image {
    position: relative;
    flex: 0 0 40%;
    min-height: 13rem;
  }

  .blog-grid--related > .blog-card .blog-card-image img {
    position: absolute;
    inset: 0;
    height: 100%;
    aspect-ratio: auto;
  }

  .blog-grid--related > .blog-card .blog-card-body {
    justify-content: center;
    padding: 1.5rem 1.75rem;
  }

  .blog-grid--related > .blog-card .blog-card-more {
    margin-top: 0;
  }
}

@media (min-width: 992px) {
  .blog-grid--related {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Nur zwei Karten: zwei Spalten statt einer Luecke rechts */
  .blog-grid--related:has(> .blog-card:nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/*--------------------------------------------------------------
# Schmale Bildschirme
--------------------------------------------------------------*/
@media (max-width: 991.98px) {
  .blog-hero {
    padding-top: 130px;
  }
}

@media (max-width: 768px) {
  .blog-index-title {
    font-size: 40px;
  }
}

@media (max-width: 767.98px) {
  .blog-cover {
    margin-top: 2rem;
  }

  .blog-cover img {
    aspect-ratio: 16 / 10;
  }
}

@media (max-width: 575.98px) {
  .blog-hero {
    padding: 116px 0 40px;
  }

  .blog-index-title {
    font-size: 32px;
  }

  .blog-lead {
    font-size: 1.125rem;
  }

  .blog-body {
    padding: 40px 0 64px;
  }

  .blog-content {
    font-size: 1.0625rem;
  }

  .blog-content h2 {
    margin-top: 2.75rem;
    font-size: 1.625rem;
  }

  .blog-content h3 {
    font-size: 1.25rem;
  }

  .blog-quote {
    padding-left: 1.25rem;
  }

  .blog-quote blockquote {
    font-size: 1.25rem;
  }

  .blog-card-body {
    padding: 1.5rem;
  }

  .blog-list,
  .blog-related {
    padding: 48px 0 64px;
  }

  /* Trennpunkte fallen weg, sonst bleibt beim Umbruch einer am Zeilenende haengen */
  .blog-meta {
    column-gap: 14px;
  }

  .blog-meta-sep {
    display: none;
  }

  /* Lange zusammengesetzte Woerter nur hier trennen, nicht am Desktop,
     und nur ab 12 Zeichen: "Implementierungsprojekte" (32 px) ist breiter
     als die Spalte, "Ueberschrift" passt in die naechste Zeile. */
  .blog-title,
  .blog-content h2,
  .blog-content h3,
  .blog-card-title {
    hyphens: auto;
    -webkit-hyphenate-limit-before: 5;
    -webkit-hyphenate-limit-after: 5;
    hyphenate-limit-chars: 12 5 5;
  }
}

/*--------------------------------------------------------------
# Weniger Bewegung
--------------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
  :root {
    scroll-behavior: auto;
  }

  .blog-card,
  .blog-card-image img,
  .blog-card-more i,
  .blog-toc-list a,
  .blog-toc-details > summary i,
  .blog-contact .btn {
    transition: none;
  }

  .blog-card:hover,
  .blog-card:hover .blog-card-image img,
  .blog-card:hover .blog-card-more i,
  .blog-contact .btn:hover {
    transform: none;
  }
}
