/* ============================================================
   Gestaltung der CMS-Seiteninhalte

   Diese Regeln lagen früher als <style>-Block direkt in
   modules/pages/cms.php. Damit konnte der Editor sie nicht laden, und die
   Vorschau im Backend zeigte deshalb etwas anderes als die fertige Seite.

   Jetzt ist es eine Datei, die beide laden: die öffentliche Seite und die
   Vorschau in /admin/pages. Erst dadurch stimmt "was du siehst, ist was du
   bekommst" überhaupt.

   Wer hier etwas ändert, ändert es an beiden Stellen zugleich. Genau so ist
   es gemeint.
   ============================================================ */

.cms-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--gwr-dark);
    text-align: left;
    hyphens: none;
    word-break: keep-all;
}

.cms-content h1,
.cms-content h2,
.cms-content h3,
.cms-content h4 {
    font-family: var(--gwr-font-heading);
    color: var(--gwr-primary);
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: .75rem;
    scroll-margin-top: 90px; /* Abstand zur klebenden Navigation bei Ankern */
}
.cms-content > h1:first-child,
.cms-content > h2:first-child { margin-top: 0; }

.cms-content h1 { font-size: 1.7rem; }
.cms-content h2 {
    font-size: 1.35rem;
    padding-bottom: .4rem;
    border-bottom: 2px solid var(--gwr-soft);
}
.cms-content h3 { font-size: 1.1rem; }
.cms-content h4 { font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; }

.cms-content p { margin-bottom: 1rem; }
.cms-content strong { color: var(--gwr-primary); font-weight: 600; }

.cms-content ul,
.cms-content ol { margin: 0 0 1rem; padding-left: 1.2rem; }
.cms-content ul li,
.cms-content ol li { margin-bottom: .35rem; line-height: 1.6; }

/* Listen ohne Punkte: die meisten Listen hier sind Kontaktangaben */
.cms-content ul { list-style: none; padding-left: 0; }
.cms-content ul li { padding: .15rem 0; padding-left: 0; }
.cms-content ol { padding-left: 1.5rem; }

.cms-content hr { border: 0; border-top: 1px solid var(--gwr-sand); margin: 2.5rem 0; }

.cms-content code {
    background: var(--gwr-sand);
    color: var(--gwr-primary);
    padding: .1em .35em;
    border-radius: 4px;
    font-size: .9em;
}

.cms-content blockquote {
    border-left: 4px solid var(--gwr-primary);
    background: var(--gwr-sand);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    font-style: italic;
    border-radius: 0 8px 8px 0;
}

.cms-content img { max-width: 100%; height: auto; border-radius: 8px; }

.cms-content .cms-table { margin: 1.25rem 0 1.75rem; font-size: .92rem; }
.cms-content .cms-table th {
    background: var(--gwr-sand);
    color: var(--gwr-primary);
    font-weight: 600;
    border-bottom: 2px solid var(--gwr-soft);
}
.cms-content .cms-table td,
.cms-content .cms-table th { vertical-align: top; padding: .55rem .75rem; }

.cms-content a {
    color: var(--gwr-primary);
    border-bottom: 1px dashed transparent;
}
.cms-content a:hover {
    color: var(--gwr-dark);
    border-bottom-color: currentColor;
}

/* ============================================================
   Inhaltsverzeichnis am Rand
   Gehört zur Seite, nicht zum Inhalt, wird deshalb in der Vorschau
   nicht mitgezeichnet.
   ============================================================ */
.cms-toc {
    position: sticky;
    top: 90px;
    padding: 1.25rem 1rem 1.25rem 1.25rem;
    border-left: 3px solid var(--gwr-soft);
    background: linear-gradient(180deg, rgba(var(--gwr-primary-rgb), .03), transparent);
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}
.cms-toc-title {
    font-family: var(--gwr-font-heading);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--gwr-muted);
    margin-bottom: .9rem;
    font-weight: 600;
}
.cms-toc ol { list-style: none; padding: 0; margin: 0; counter-reset: tocnum; }
.cms-toc li {
    counter-increment: tocnum;
    margin-bottom: .55rem;
    line-height: 1.4;
    position: relative;
    padding-left: 1.6em;
}
.cms-toc li::before {
    content: counter(tocnum, decimal-leading-zero);
    position: absolute;
    left: 0; top: 0;
    font-size: .72rem;
    font-weight: 600;
    color: var(--gwr-muted);
    opacity: .7;
    font-family: var(--gwr-font-heading);
}
.cms-toc a {
    color: var(--gwr-dark);
    font-size: .88rem;
    text-decoration: none !important;
    border-bottom: 1px dashed transparent;
    transition: color .2s, border-color .2s;
    display: inline-block;
}
.cms-toc a:hover,
.cms-toc a.active {
    color: var(--gwr-primary);
    border-bottom-color: var(--gwr-primary);
    background: transparent;
}
@media (max-width: 991.98px) {
    .cms-toc { display: none; }
}

/* ============================================================
   Bausteine

   Diese Regeln gelten für die öffentliche Seite und für die Vorschau im
   Editor gleichermassen, weil beide dieselbe Datei laden und derselbe
   PHP-Code das HTML erzeugt.
   ============================================================ */

.pb { margin-bottom: 1.75rem; }
.pb:last-child { margin-bottom: 0; }

/* --- Hinweis --- */
.pb-hinweis {
    display: flex; gap: .85rem;
    padding: 1rem 1.15rem;
    border-radius: 10px;
    border-left: 4px solid;
    font-size: .95rem;
}
.pb-hinweis-symbol { font-size: 1.15rem; line-height: 1.4; flex: none; }
.pb-hinweis-titel { display: block; margin-bottom: .2rem; }
.pb-hinweis-inhalt > :last-child { margin-bottom: 0; }
.pb-hinweis-gruen { background: rgba(var(--gwr-primary-rgb), .07); border-color: var(--gwr-primary); }
.pb-hinweis-gruen .pb-hinweis-symbol, .pb-hinweis-gruen .pb-hinweis-titel { color: var(--gwr-primary); }
.pb-hinweis-gelb  { background: #fdf6e3; border-color: #c9962b; }
.pb-hinweis-gelb  .pb-hinweis-symbol, .pb-hinweis-gelb .pb-hinweis-titel { color: #8a6516; }
.pb-hinweis-rot   { background: #fdf0ef; border-color: #b0413e; }
.pb-hinweis-rot   .pb-hinweis-symbol, .pb-hinweis-rot .pb-hinweis-titel { color: #8a2f2d; }
.pb-hinweis-grau  { background: #f6f7f8; border-color: #c9ccd0; }
.pb-hinweis-grau  .pb-hinweis-symbol, .pb-hinweis-grau .pb-hinweis-titel { color: var(--gwr-muted); }

/* --- Kacheln --- */
.pb-kachel {
    display: flex; flex-direction: column; height: 100%;
    background: #fff; border: 1px solid #e9ecef; border-radius: 12px;
    overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.03);
    transition: transform .15s, box-shadow .15s, border-color .15s;
    color: var(--gwr-dark); text-decoration: none;
}
a.pb-kachel-link:hover {
    transform: translateY(-2px); border-color: var(--gwr-primary);
    box-shadow: 0 8px 20px rgba(0,0,0,.08); text-decoration: none;
}
.pb-kachel-bild {
    display: flex; align-items: center; justify-content: center;
    min-height: 150px; padding: 1rem; background: #fff;
    border-bottom: 1px solid #f1f3f5;
}
.pb-kachel-bild img { max-width: 100%; max-height: 130px; width: auto; object-fit: contain; }
.pb-kachel-symbol {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin: 1.1rem 1.25rem 0;
    border-radius: 10px; font-size: 1.4rem;
    background: rgba(var(--gwr-primary-rgb), .1); color: var(--gwr-primary);
}
.pb-kachel-text { padding: 1.1rem 1.25rem 1.25rem; }
.pb-kachel-titel {
    color: var(--gwr-primary); font-size: 1.05rem; font-weight: 700;
    margin: 0 0 .35rem; border: 0; padding: 0;
}
.pb-kachel-inhalt { font-size: .9rem; line-height: 1.55; margin-bottom: .5rem; }
.pb-kachel-mehr { font-size: .85rem; font-weight: 600; color: var(--gwr-primary); }

/* --- Bild --- */
.pb-bild { margin-left: 0; margin-right: 0; }
.pb-bild img { width: 100%; height: auto; border-radius: 10px; display: block; }
.pb-bild figcaption { font-size: .85rem; color: var(--gwr-muted); margin-top: .5rem; }
.pb-bild-halb { max-width: 55%; }
@media (max-width: 575.98px) { .pb-bild-halb { max-width: 100%; } }

/* --- Bild und Text --- */
.pb-bt-bild img { width: 100%; height: auto; border-radius: 10px; display: block; }
.pb-bt-text h3 { color: var(--gwr-primary); font-size: 1.2rem; margin: 0 0 .6rem; }
.pb-bt-text > :last-child { margin-bottom: 0; }

/* --- Knopf --- */
.pb-knopf-mittig { text-align: center; }

/* --- Ausklapper --- */
.pb-ak-eintrag { border-bottom: 1px solid #eef0f2; }
.pb-ak-eintrag summary {
    display: flex; align-items: center; gap: .6rem;
    padding: .85rem 0; cursor: pointer; font-weight: 600;
    color: var(--gwr-dark); list-style: none;
}
.pb-ak-eintrag summary::-webkit-details-marker { display: none; }
.pb-ak-eintrag summary i { margin-left: auto; color: var(--gwr-muted); transition: transform .2s; }
.pb-ak-eintrag[open] summary { color: var(--gwr-primary); }
.pb-ak-eintrag[open] summary i { transform: rotate(180deg); }
.pb-ak-antwort { padding: 0 0 1rem; font-size: .95rem; }
.pb-ak-antwort > :last-child { margin-bottom: 0; }

/* --- Kursliste --- */
.pb-kursliste-titel { color: var(--gwr-primary); font-size: 1.2rem; margin: 0 0 .85rem; }
.pb-kurse { border: 1px solid #e9ecef; border-radius: 12px; overflow: hidden; }
.pb-kurs {
    display: flex; align-items: center; gap: .75rem;
    padding: .85rem 1rem; border-bottom: 1px solid #f1f3f5;
    text-decoration: none; color: var(--gwr-dark); transition: background .15s;
}
.pb-kurs:last-child { border-bottom: 0; }
.pb-kurs:hover { background: rgba(var(--gwr-primary-rgb), .04); text-decoration: none; }
.pb-kurs-name { flex: 1; font-weight: 600; font-size: .95rem; }
.pb-kurs-meta { font-size: .82rem; color: var(--gwr-muted); white-space: nowrap; }
.pb-kurs-pfeil { color: var(--gwr-muted); font-size: .85rem; }
.pb-leer { color: var(--gwr-muted); font-style: italic; }
@media (max-width: 575.98px) {
    .pb-kurs { flex-wrap: wrap; }
    .pb-kurs-name { flex: 1 1 100%; }
    .pb-kurs-pfeil { display: none; }
}

/* --- Personen --- */
.pb-person { text-align: center; }
.pb-person-foto {
    width: 100%; aspect-ratio: 1; object-fit: cover;
    border-radius: 12px; margin-bottom: .5rem; display: block;
}
.pb-person-ph {
    display: flex; align-items: center; justify-content: center;
    background: #f1f3f5; color: #c9ccd0; font-size: 2rem;
}
.pb-person-name { display: block; font-size: .92rem; }
.pb-person-rolle { display: block; font-size: .8rem; color: var(--gwr-muted); }

/* --- Trenner --- */
.pb-trenner { border: 0; border-top: 1px solid var(--gwr-sand); margin: 2.5rem 0; }
.pb-abstand { height: 2.5rem; }
