/* =========================================================
   Ratgeber-Inhalte - gilt auf der Website (.rg-content) und im Block-Editor (.editor-styles-wrapper)

   Hinweis: Ohne theme.json legt WordPress auf der Website in Gruppen-Blöcken eine zusätzliche
   Hülle (.wp-block-group__inner-container) um den Inhalt, im Editor nicht. Die Regeln der
   Bausteine greifen deshalb über Nachfahren-Selektoren statt direkter Kind-Selektoren.
   ========================================================= */

:is(.rg-content, .editor-styles-wrapper) {
  --b-navy: #2C3E50;
  --b-navy-dark: #1A252F;
  --b-text: #3a4650;
  --b-muted: #5a6570;
  --b-label: #6c7a89;
  --b-border: #e3e8ec;
  --b-tint: #F0F4F8;
  --b-radius: 4px;
  /* Ausgeschrieben, weil diese Datei auch im Editor ohne style.css läuft */
  --b-font-body: 'Inter', 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  --b-font-heading: var(--b-font-body);
}

/* Nur im Editor: Grundschrift und Breite der weißen Inhaltskarte */
.editor-styles-wrapper {
  background-color: #fff;
  font-family: var(--b-font-body);
  color: var(--b-text);
}

.editor-styles-wrapper .is-root-container,
.editor-styles-wrapper .editor-visual-editor__post-title-wrapper {
  max-width: 860px;
  margin-inline: auto;
}

.editor-styles-wrapper .wp-block-post-title {
  font-family: var(--b-font-heading);
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--b-navy-dark);
}

/* Text */
:is(.rg-content, .editor-styles-wrapper) :is(p, li) {
  font-family: var(--b-font-body);
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--b-text);
}

:is(.rg-content, .editor-styles-wrapper) p {
  max-width: 72ch;
  margin: 0 0 1.5rem;
}

:is(.rg-content, .editor-styles-wrapper) :is(h2, h3, h4) {
  font-family: var(--b-font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--b-navy-dark);
  text-wrap: balance;
}

:is(.rg-content, .editor-styles-wrapper) h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.6rem;
  scroll-margin-top: 7rem;
}

:is(.rg-content, .editor-styles-wrapper) h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.25rem;
}

:is(.rg-content, .editor-styles-wrapper) h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.1rem;
}

:is(.rg-content, .editor-styles-wrapper) :is(ul, ol) {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
}

:is(.rg-content, .editor-styles-wrapper) li {
  margin-bottom: 0.35rem;
}

:is(.rg-content, .editor-styles-wrapper) li::marker {
  color: var(--b-navy);
}

:is(.rg-content, .editor-styles-wrapper) a:not(.wp-block-button__link) {
  color: var(--b-navy);
  text-decoration: underline;
  text-decoration-color: rgba(44, 62, 80, 0.4);
  text-underline-offset: 3px;
}

:is(.rg-content, .editor-styles-wrapper) a:not(.wp-block-button__link):hover {
  text-decoration-color: currentColor;
}

:is(.rg-content, .editor-styles-wrapper) strong {
  font-weight: 600;
  color: var(--b-navy-dark);
}

.rg-content > :first-child {
  margin-top: 0;
}

.rg-content > :last-child {
  margin-bottom: 0;
}

/* Leere Felder aus dem Gerüst oder den Bausteinen nicht auf der Website zeigen */
.rg-content :is(p, h2, h3, h4, li):empty {
  display: none;
}

/* Bilder */
:is(.rg-content, .editor-styles-wrapper) .wp-block-image {
  margin: 2rem 0;
}

:is(.rg-content, .editor-styles-wrapper) .wp-block-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--b-radius);
}

:is(.rg-content, .editor-styles-wrapper) .wp-block-image figcaption {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: left;
  color: var(--b-label);
}

.rg-content .wp-block-image:has(> img:not([src])),
.rg-content .wp-block-image:has(> img[src=""]) {
  display: none;
}

/* Buttons */
:is(.rg-content, .editor-styles-wrapper) .wp-block-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.75rem 0;
}

:is(.rg-content, .editor-styles-wrapper) .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.4rem;
  border: 1px solid var(--b-navy);
  border-radius: var(--b-radius);
  background-color: var(--b-navy);
  font-family: var(--b-font-heading);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.rg-content .wp-block-button__link:hover,
.rg-content .wp-block-button__link:focus-visible {
  border-color: var(--b-navy-dark);
  background-color: var(--b-navy-dark);
  color: #fff;
}

.rg-content .wp-block-button__link:focus-visible {
  outline: 2px solid var(--b-navy);
  outline-offset: 3px;
}

/* Baustein: Tipp-Box - erster Absatz ist die Beschriftung ("Unser Tipp") */
:is(.rg-content, .editor-styles-wrapper) .tip-box {
  margin: 2rem 0;
  padding: 1.2rem 1.4rem;
  border-radius: var(--b-radius);
  background-color: var(--b-tint);
}

:is(.rg-content, .editor-styles-wrapper) .tip-box p {
  max-width: none;
  margin: 0;
}

:is(.rg-content, .editor-styles-wrapper) .tip-box p:first-child {
  margin-bottom: 0.3rem;
  font-family: var(--b-font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--b-navy-dark);
}

.rg-content .tip-box:not(:has(p:nth-of-type(2):not(:empty))) {
  display: none;
}

/* Baustein: Vergleich zweier Lösungen (auch ältere Variante direkt auf den Spalten) */
:is(.rg-content, .editor-styles-wrapper) .comparison-table {
  margin: 1.75rem 0 2.25rem;
}

:is(.rg-content, .editor-styles-wrapper) :is(.comparison-table .wp-block-columns, .wp-block-columns.comparison-table) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
}

:is(.rg-content, .editor-styles-wrapper) .comparison-table .wp-block-column {
  padding: 1.15rem 1.25rem 1.25rem;
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius);
  background-color: #fff;
}

:is(.rg-content, .editor-styles-wrapper) .comparison-table h3 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
}

:is(.rg-content, .editor-styles-wrapper) .comparison-table .wp-block-image {
  margin: 0 0 1rem;
}

:is(.rg-content, .editor-styles-wrapper) .comparison-table .wp-block-image img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

:is(.rg-content, .editor-styles-wrapper) .comparison-table ul {
  margin: 0;
}

:is(.rg-content, .editor-styles-wrapper) .comparison-table li {
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Kurzantwort direkt nach der Einleitung (Absatz mit Klasse "rg-answer") - für Google-Snippets und KI-Suchen */
:is(.rg-content, .editor-styles-wrapper) p.rg-answer {
  margin: 1.5rem 0 2rem;
  padding: 1.1rem 1.35rem;
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius);
  background-color: #fff;
  line-height: 1.7;
}

/* Tabelle (core/table): Vergleiche auf einen Blick - ruhig, feine Linien, erste Spalte als Merkmal */
:is(.rg-content, .editor-styles-wrapper) .wp-block-table {
  margin: 1.75rem 0 2.25rem;
  overflow-x: auto;
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius);
  background-color: #fff;
}

:is(.rg-content, .editor-styles-wrapper) .wp-block-table table {
  width: 100%;
  min-width: 34rem;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.55;
}

:is(.rg-content, .editor-styles-wrapper) .wp-block-table :is(th, td) {
  padding: 0.75rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--b-border);
  text-align: left;
  vertical-align: top;
}

:is(.rg-content, .editor-styles-wrapper) .wp-block-table tbody tr:last-child td {
  border-bottom: 0;
}

:is(.rg-content, .editor-styles-wrapper) .wp-block-table thead th {
  background-color: #f3f5f7;
  font-family: var(--b-font-heading);
  font-weight: 600;
  color: var(--b-navy-dark);
}

:is(.rg-content, .editor-styles-wrapper) .wp-block-table tbody td:first-child {
  width: 26%;
  font-weight: 600;
  color: var(--b-navy-dark);
}

/* WordPress setzt unter den Tabellenkopf eine 3px-Linie */
:is(.rg-content, .editor-styles-wrapper) .wp-block-table thead {
  border-bottom: 1px solid var(--b-border);
}

/* Schmal: Merkmal als eigene Zeile, darunter die zwei Lösungen nebeneinander - kein seitliches Scrollen */
@media (max-width: 575.98px) {
  .rg-content .wp-block-table table {
    min-width: 0;
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .rg-content .wp-block-table :is(thead, tbody) tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rg-content .wp-block-table thead th:first-child {
    display: none;
  }

  .rg-content .wp-block-table tbody td:first-child {
    grid-column: 1 / -1;
    width: auto;
    padding-bottom: 0.2rem;
    border-bottom: 0;
  }

  .rg-content .wp-block-table :is(th, td) {
    padding: 0.6rem 0.85rem;
  }
}

/* Baustein: Beratungs-Box - Text links, Button rechts */
:is(.rg-content, .editor-styles-wrapper) .advice-box {
  margin: 2.25rem 0;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius);
  background-color: #fff;
}

/* Raster auf der Box selbst (Editor) oder auf der inneren Hülle (Website) */
:is(.rg-content, .editor-styles-wrapper) :is(.advice-box:not(:has(> .wp-block-group__inner-container)), .advice-box > .wp-block-group__inner-container) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.3rem 2rem;
}

:is(.rg-content, .editor-styles-wrapper) .advice-box h3 {
  grid-column: 1;
  margin: 0;
  font-size: 1.15rem;
}

:is(.rg-content, .editor-styles-wrapper) .advice-box p {
  grid-column: 1;
  max-width: none;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--b-muted);
}

:is(.rg-content, .editor-styles-wrapper) .advice-box .wp-block-buttons {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
}

/* Häufige Fragen (Details-Blöcke): assets/css/faq.css - gilt auch für Seiten und Produkte */

@media (max-width: 575.98px) {
  .rg-content :is(.comparison-table .wp-block-columns, .wp-block-columns.comparison-table) {
    grid-template-columns: 1fr;
  }

  .rg-content :is(.advice-box:not(:has(> .wp-block-group__inner-container)), .advice-box > .wp-block-group__inner-container) {
    grid-template-columns: 1fr;
  }

  .rg-content .advice-box .wp-block-buttons {
    grid-column: 1;
    grid-row: auto;
    margin-top: 0.85rem;
  }

  .rg-content .advice-box .wp-block-button,
  .rg-content .advice-box .wp-block-button__link {
    width: 100%;
  }
}
