/* GuDeMa Boxen-Layout 1.2.0
 * Unterseiten folgen dem nativen Kartenbild der Startseite.
 * Über uns und Partner werden durch die PHP-Scope-Klasse ausgeschlossen.
 */

body.gdm-box-layout-enabled:not(.home) .gdm-grid,
body.gdm-box-layout-enabled:not(.home) .gdm-steps,
body.gdm-box-layout-enabled:not(.home) .gdm-block-why-row,
.editor-styles-wrapper .gdm-grid,
.editor-styles-wrapper .gdm-steps,
.editor-styles-wrapper .gdm-block-why-row {
  align-items: stretch !important;
}

body.gdm-box-layout-enabled:not(.home) .gdm-grid > .wp-block-column,
.editor-styles-wrapper .gdm-grid > .wp-block-column {
  display: flex;
  min-width: 0;
}

.gdm-box-layout-enabled .gdm-unified-card-v12,
.editor-styles-wrapper .gdm-unified-card-v12 {
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--gdm-line, #ded7d2);
  border-radius: var(--gdm-radius, 18px);
  background: #fff;
  box-shadow: var(--gdm-shadow, 0 12px 32px rgba(38,18,13,.08));
  text-align: center !important;
}

.gdm-box-layout-enabled .gdm-unified-card-v12 .gdm-card-body,
.editor-styles-wrapper .gdm-unified-card-v12 .gdm-card-body {
  box-sizing: border-box;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  padding: 20px !important;
  text-align: center !important;
}

/* Einheitliches 16:9-Bild wie auf der Startseite. */
.gdm-box-layout-enabled .gdm-unified-card-v12 > .wp-block-image:first-child,
.gdm-box-layout-enabled .gdm-unified-card-v12 > .wp-block-cover:first-child,
.gdm-box-layout-enabled .gdm-unified-card-v12 > .gdm-card-media:first-child,
.gdm-box-layout-enabled .gdm-unified-card-v12 > .gdm-block-card-image:first-child,
.editor-styles-wrapper .gdm-unified-card-v12 > .wp-block-image:first-child,
.editor-styles-wrapper .gdm-unified-card-v12 > .wp-block-cover:first-child,
.editor-styles-wrapper .gdm-unified-card-v12 > .gdm-card-media:first-child,
.editor-styles-wrapper .gdm-unified-card-v12 > .gdm-block-card-image:first-child {
  position: relative;
  display: block;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  aspect-ratio: 16 / 9 !important;
  margin: 0 !important;
  overflow: hidden;
  border-radius: 0 !important;
  background: #eee9e4;
}

/* Einige ältere Karten haben das Bild noch im Body. Optisch sitzt es trotzdem
   exakt an derselben Stelle, Gutenberg-seitig bleibt es ganz normal editierbar. */
.gdm-box-layout-enabled .gdm-unified-card-v12 .gdm-card-body > .wp-block-image:first-child,
.editor-styles-wrapper .gdm-unified-card-v12 .gdm-card-body > .wp-block-image:first-child {
  position: relative;
  display: block;
  width: calc(100% + 40px) !important;
  max-width: none !important;
  height: auto !important;
  aspect-ratio: 16 / 9 !important;
  margin: -20px -20px 20px !important;
  overflow: hidden;
  border-radius: 0 !important;
  background: #eee9e4;
}

.gdm-box-layout-enabled .gdm-unified-card-v12 > .wp-block-image:first-child img,
.gdm-box-layout-enabled .gdm-unified-card-v12 > .wp-block-cover:first-child img,
.gdm-box-layout-enabled .gdm-unified-card-v12 > .gdm-card-media:first-child img,
.gdm-box-layout-enabled .gdm-unified-card-v12 > .gdm-block-card-image:first-child img,
.gdm-box-layout-enabled .gdm-unified-card-v12 .gdm-card-body > .wp-block-image:first-child img,
.editor-styles-wrapper .gdm-unified-card-v12 > .wp-block-image:first-child img,
.editor-styles-wrapper .gdm-unified-card-v12 > .wp-block-cover:first-child img,
.editor-styles-wrapper .gdm-unified-card-v12 > .gdm-card-media:first-child img,
.editor-styles-wrapper .gdm-unified-card-v12 > .gdm-block-card-image:first-child img,
.editor-styles-wrapper .gdm-unified-card-v12 .gdm-card-body > .wp-block-image:first-child img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover !important;
  object-position: center;
}

.gdm-card-image-placeholder-v1 {
  box-sizing: border-box;
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(213,74,61,.09), transparent 58%),
    repeating-linear-gradient(45deg, #f4efeb 0, #f4efeb 16px, #eee7e1 16px, #eee7e1 32px);
  color: #8b756b;
  font: 750 .82rem/1.2 Inter, system-ui, sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.gdm-card-image-editor-v1 {
  display: grid;
  gap: 8px;
}
.gdm-card-image-editor-v1 > img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Direkte Inhalte erhalten denselben Innenabstand wie ein normaler gdm-card-body. */
.gdm-box-layout-enabled .gdm-unified-card-v12 > h2,
.gdm-box-layout-enabled .gdm-unified-card-v12 > h3,
.gdm-box-layout-enabled .gdm-unified-card-v12 > h4,
.gdm-box-layout-enabled .gdm-unified-card-v12 > p,
.editor-styles-wrapper .gdm-unified-card-v12 > h2,
.editor-styles-wrapper .gdm-unified-card-v12 > h3,
.editor-styles-wrapper .gdm-unified-card-v12 > h4,
.editor-styles-wrapper .gdm-unified-card-v12 > p {
  margin-left: 20px !important;
  margin-right: 20px !important;
}

.gdm-box-layout-enabled .gdm-unified-card-v12 h2,
.gdm-box-layout-enabled .gdm-unified-card-v12 h3,
.gdm-box-layout-enabled .gdm-unified-card-v12 h4,
.editor-styles-wrapper .gdm-unified-card-v12 h2,
.editor-styles-wrapper .gdm-unified-card-v12 h3,
.editor-styles-wrapper .gdm-unified-card-v12 h4 {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 2.4em;
  margin-top: 20px !important;
  margin-bottom: 12px !important;
  font-size: clamp(1.15rem, 1.45vw, 1.38rem) !important;
  line-height: 1.13 !important;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-align: center !important;
}

.gdm-box-layout-enabled .gdm-unified-card-v12 .gdm-card-body > h2:first-of-type,
.gdm-box-layout-enabled .gdm-unified-card-v12 .gdm-card-body > h3:first-of-type,
.gdm-box-layout-enabled .gdm-unified-card-v12 .gdm-card-body > h4:first-of-type,
.editor-styles-wrapper .gdm-unified-card-v12 .gdm-card-body > h2:first-of-type,
.editor-styles-wrapper .gdm-unified-card-v12 .gdm-card-body > h3:first-of-type,
.editor-styles-wrapper .gdm-unified-card-v12 .gdm-card-body > h4:first-of-type {
  margin-top: 0 !important;
}

.gdm-box-layout-enabled .gdm-unified-card-v12 p,
.editor-styles-wrapper .gdm-unified-card-v12 p {
  color: #5d514c;
  font-size: .98rem;
  line-height: 1.55;
  text-align: center !important;
}

.gdm-box-layout-enabled .gdm-unified-card-v12 > p:last-of-type,
.gdm-box-layout-enabled .gdm-unified-card-v12 .gdm-card-body > p:last-of-type,
.editor-styles-wrapper .gdm-unified-card-v12 > p:last-of-type,
.editor-styles-wrapper .gdm-unified-card-v12 .gdm-card-body > p:last-of-type {
  flex: 1 0 auto;
  margin-bottom: 20px !important;
}

/* Zwei gleich große CTA oben, der erhaltene Hauptlink bzw. Vorbereitung unten. */
.gdm-box-layout-enabled .gdm-unified-card-actions-v1,
.editor-styles-wrapper .gdm-unified-card-actions-v1 {
  box-sizing: border-box;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 9px !important;
  width: 100% !important;
  margin: auto 0 0 !important;
  padding: 0 !important;
}

.gdm-box-layout-enabled .gdm-unified-card-v12 > .gdm-unified-card-actions-v1,
.editor-styles-wrapper .gdm-unified-card-v12 > .gdm-unified-card-actions-v1 {
  width: calc(100% - 40px) !important;
  margin: auto 20px 20px !important;
}

.gdm-box-layout-enabled .gdm-unified-card-actions-v1 .wp-block-button,
.gdm-box-layout-enabled .gdm-unified-card-actions-v1 .wp-block-button__link,
.editor-styles-wrapper .gdm-unified-card-actions-v1 .wp-block-button,
.editor-styles-wrapper .gdm-unified-card-actions-v1 .wp-block-button__link {
  width: 100% !important;
}

.gdm-box-layout-enabled .gdm-unified-card-actions-v1 .wp-block-button__link,
.editor-styles-wrapper .gdm-unified-card-actions-v1 .wp-block-button__link {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 0 !important;
  border-radius: 10px !important;
  background: linear-gradient(90deg, #f5685e 0%, var(--gdm-red, #d54a3d) 100%) !important;
  color: #fff !important;
  font-size: .9rem;
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
}

.gdm-box-layout-enabled .gdm-unified-card-actions-v1 .gdm-primary-action-v12,
.editor-styles-wrapper .gdm-unified-card-actions-v1 .gdm-primary-action-v12 {
  grid-column: 1 / -1;
}

.gdm-box-layout-enabled .gdm-preparation-button-v1 .wp-block-button__link,
.editor-styles-wrapper .gdm-preparation-button-v1 .wp-block-button__link {
  cursor: default;
}

/* Abschlussbereich: bewusst kompakte Textboxen – niemals Bild oder CTA. */
.gdm-box-layout-enabled .gdm-project-footer-info-v11,
.editor-styles-wrapper .gdm-project-footer-info-v11 {
  margin-bottom: 0 !important;
}
.gdm-box-layout-enabled .gdm-project-footer-info-v11 .gdm-info-card-v11,
.editor-styles-wrapper .gdm-project-footer-info-v11 .gdm-info-card-v11 {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 220px;
  padding: 22px !important;
  border: 1px solid var(--gdm-line, #ded7d2);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(38,18,13,.06);
  text-align: left;
}
.gdm-box-layout-enabled .gdm-project-footer-info-v11 .gdm-info-card-v11 h3,
.editor-styles-wrapper .gdm-project-footer-info-v11 .gdm-info-card-v11 h3 {
  min-height: 2.2em;
  margin: 0 0 18px !important;
  font-size: clamp(1.18rem, 1.5vw, 1.42rem) !important;
  line-height: 1.08;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.gdm-box-layout-enabled .gdm-project-footer-info-v11 .gdm-info-card-v11 p,
.editor-styles-wrapper .gdm-project-footer-info-v11 .gdm-info-card-v11 p {
  margin: 0 !important;
  color: #5d514c;
  line-height: 1.55;
}

/* Sicherheitsnetz für alte, fehlerhafte Abschlussgruppen bis zur Migration. */
.gdm-box-layout-enabled .gdm-project-footer-cards-v1 .gdm-card-image-placeholder-v1,
.gdm-box-layout-enabled .gdm-project-footer-cards-v1 .gdm-unified-card-actions-v1,
.editor-styles-wrapper .gdm-project-footer-cards-v1 .gdm-card-image-placeholder-v1,
.editor-styles-wrapper .gdm-project-footer-cards-v1 .gdm-unified-card-actions-v1 {
  display: none !important;
}
.gdm-box-layout-enabled .gdm-project-footer-grid-v1 > .wp-block-column,
.editor-styles-wrapper .gdm-project-footer-grid-v1 > .wp-block-column {
  display: flex;
}

@media (max-width: 980px) {
  .gdm-box-layout-enabled .gdm-project-footer-grid-v1,
  .editor-styles-wrapper .gdm-project-footer-grid-v1 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  .gdm-box-layout-enabled .gdm-project-footer-grid-v1,
  .editor-styles-wrapper .gdm-project-footer-grid-v1 {
    grid-template-columns: 1fr !important;
  }
  .gdm-box-layout-enabled .gdm-unified-card-v12 h2,
  .gdm-box-layout-enabled .gdm-unified-card-v12 h3,
  .gdm-box-layout-enabled .gdm-unified-card-v12 h4,
  .editor-styles-wrapper .gdm-unified-card-v12 h2,
  .editor-styles-wrapper .gdm-unified-card-v12 h3,
  .editor-styles-wrapper .gdm-unified-card-v12 h4,
  .gdm-box-layout-enabled .gdm-project-footer-info-v11 .gdm-info-card-v11,
  .gdm-box-layout-enabled .gdm-project-footer-info-v11 .gdm-info-card-v11 h3,
  .editor-styles-wrapper .gdm-project-footer-info-v11 .gdm-info-card-v11,
  .editor-styles-wrapper .gdm-project-footer-info-v11 .gdm-info-card-v11 h3 {
    min-height: 0;
  }
}
