/**
 * CodiCraft CMS - Default Public Theme
 *
 * Das Standard-Theme definiert die grundlegende Frontend-Darstellung ohne
 * Framework-Abhängigkeit. Builder-Inhalte verwenden die semantischen Tokens
 * des Theme-Presentation-Vertrags statt gespeicherter Inline-Designwerte.
 */

/* ========================================================================== */
/* 1. DESIGN TOKENS                                                           */
/* ========================================================================== */

:root {
    --primary: #0f172a;
    --primary-soft: #1e293b;
    --primary-muted: #334155;

    --accent: #4f46e5;
    --accent-strong: #4338ca;
    --accent-soft: #eef2ff;

    --text-main: #334155;
    --text-strong: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #f8fafc;

    --bg-light: #f8fafc;
    --bg-soft: #f1f5f9;
    --white: #ffffff;
    --surface: #ffffff;
    --surface-raised: rgba(255, 255, 255, 0.92);

    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --success: #10b981;
    --danger: #ef4444;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 6px 18px rgba(15, 23, 42, 0.05);
    --shadow:
        0 12px 32px rgba(15, 23, 42, 0.08);
    --shadow-lg:
        0 24px 60px rgba(15, 23, 42, 0.12);

    --radius-sm: 0.65rem;
    --radius-md: 0.9rem;
    --radius-lg: 1.25rem;
    --radius-xl: 1.75rem;
    --radius-pill: 999px;

    --space-2xs: 0.25rem;
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 7rem;

    --content-width: 820px;
    --wide-width: 1200px;
    --site-gutter: clamp(1rem, 4vw, 2.5rem);

    --transition-fast: 160ms ease;
    --transition: 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ========================================================================== */
/* 2. RESET & BASIS                                                           */
/* ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    color-scheme: light;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-main);
    background:
        linear-gradient(
            180deg,
            #ffffff 0,
            var(--bg-light) 34rem,
            var(--bg-light) 100%
        );

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img,
svg,
video {
    display: block;
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: var(--accent);
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--accent-strong);
}

::selection {
    color: var(--text-inverse);
    background: var(--accent);
}

:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.35);
    outline-offset: 3px;
}

.container {
    width: min(100%, calc(var(--wide-width) + (2 * var(--site-gutter))));
    margin-inline: auto;
    padding-inline: var(--site-gutter);
}

/* ========================================================================== */
/* 3. HEADER & NAVIGATION                                                     */
/* ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;

    padding-block: 0.85rem;

    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid rgba(226, 232, 240, 0.82);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);

    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(1rem, 3vw, 2.5rem);
}

.header-brand {
    flex: 0 0 auto;
}

.site-title {
    margin: 0;

    font-size: clamp(1.45rem, 2.2vw, 1.9rem);
    font-weight: 850;
    line-height: 1;
    letter-spacing: -0.045em;

    color: var(--text-strong);
}

.site-tagline {
    margin-top: 0.35rem;

    font-size: 0.69rem;
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: 0.14em;
    text-transform: uppercase;

    color: var(--text-muted);
}

.nav-wrapper {
    flex: 1 1 auto;
    min-width: 0;
}

.nav-list {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;

    margin: 0;
    padding: 0;

    list-style: none;
}

.nav-list > li {
    position: relative;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;

    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-pill);

    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;

    color: var(--text-main);

    transition:
        color var(--transition-fast),
        background-color var(--transition-fast),
        transform var(--transition-fast);
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--text-strong);
    background: var(--bg-soft);
}

.nav-list > li.has-dropdown > .nav-link::after {
    content: "";
    width: 0.42rem;
    height: 0.42rem;
    margin-left: 0.45rem;

    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;

    transform: rotate(45deg) translateY(-0.12rem);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 50%;
    z-index: 20;

    min-width: 13rem;
    margin: 0;
    padding: 0.45rem;

    list-style: none;

    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);

    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -0.35rem);

    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast),
        visibility var(--transition-fast);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.dropdown-menu .nav-link {
    width: 100%;
    justify-content: flex-start;
    border-radius: calc(var(--radius-md) - 0.2rem);
}

.has-dropdown:hover > .dropdown-menu,
.has-dropdown:focus-within > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.header-auth {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.9rem;
}

.mobile-navigation {
    display: none;
}

/* ========================================================================== */
/* 4. MAIN CONTENT                                                            */
/* ========================================================================== */

.main-content-area {
    flex: 1 0 auto;
    width: 100%;
    min-width: 0;
}

.page-wrapper {
    width: 100%;
    min-width: 0;
}

.page-header {
    margin-bottom: var(--space-md);
}

.welcome-header {
    margin-bottom: var(--space-md);
}

.display-title {
    margin: 0 0 var(--space-sm);

    font-size: clamp(2.75rem, 7vw, 5rem);
    font-weight: 900;
    line-height: 0.98;
    letter-spacing: -0.065em;
    text-wrap: balance;

    color: var(--text-strong);
}

.subtitle {
    max-width: 800px;

    font-size: clamp(1.08rem, 2vw, 1.35rem);
    font-weight: 450;
    line-height: 1.65;

    color: var(--text-muted);
}

.highlight {
    color: var(--accent);
    font-weight: 850;
}

.feature-intro {
    max-width: 700px;
    margin-bottom: var(--space-lg);
}

.intro-text {
    font-size: 1.18rem;
    color: var(--text-main);
}

/* ========================================================================== */
/* 5. CARDS & GENERIC GRIDS                                                   */
/* ========================================================================== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, 280px), 1fr)
    );
    gap: clamp(1rem, 2vw, 1.5rem);

    margin-bottom: var(--space-lg);
}

.stat-card,
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    display: flex;
    flex-direction: column;

    min-height: 220px;
    padding: clamp(1.5rem, 3vw, 2.25rem);

    color: inherit;
    text-decoration: none;

    transition:
        transform var(--transition),
        border-color var(--transition),
        box-shadow var(--transition);
}

.interactive-card:hover {
    transform: translateY(-6px);
    border-color: rgba(79, 70, 229, 0.35);
    box-shadow: var(--shadow-lg);
}

.stat-label {
    display: block;
    margin-bottom: 1.15rem;

    font-size: 0.71rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;

    color: var(--text-muted);
}

.stat-value {
    font-size: clamp(1.8rem, 3vw, 2.25rem);
    font-weight: 850;
    line-height: 1.15;
    letter-spacing: -0.035em;

    color: var(--text-strong);
}

.card-desc {
    margin-top: 1rem;

    font-size: 0.95rem;
    color: var(--text-muted);
}

.stat-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    margin-top: auto;
    padding-top: 1.5rem;

    border-top: 1px solid var(--border);

    font-size: 0.82rem;
    font-weight: 700;
}

.highlight-card {
    color: var(--text-inverse);
    background:
        radial-gradient(
            circle at top right,
            rgba(99, 102, 241, 0.28),
            transparent 42%
        ),
        var(--primary);
    border-color: transparent;
}

.highlight-card .stat-label {
    color: rgba(248, 250, 252, 0.58);
}

.highlight-card .card-desc {
    color: rgba(248, 250, 252, 0.76);
}

.highlight-card .stat-value {
    color: var(--white);
}

.stat-status {
    display: flex;
    align-items: center;
    gap: 0.8rem;

    font-size: 1.25rem;
    font-weight: 750;
}

.pulse-dot,
.status-dot {
    flex: 0 0 auto;
    border-radius: 50%;
}

.pulse-dot {
    position: relative;
    width: 0.8rem;
    height: 0.8rem;
    background: var(--success);
}

.pulse-dot::after {
    content: "";
    position: absolute;
    inset: 0;

    border-radius: inherit;
    background: inherit;

    animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.72;
    }

    100% {
        transform: scale(3.2);
        opacity: 0;
    }
}

/* ========================================================================== */
/* 6. BUTTONS                                                                 */
/* ========================================================================== */

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;

    margin-top: var(--space-md);
}

.btn,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    min-height: 2.8rem;
    padding: 0.78rem 1.25rem;

    border: 1px solid transparent;
    border-radius: var(--radius-md);

    font-size: 0.84rem;
    font-weight: 750;
    line-height: 1;
    letter-spacing: 0.015em;
    text-align: center;
    text-decoration: none;

    cursor: pointer;

    transition:
        transform var(--transition-fast),
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.btn:hover,
.button:hover {
    transform: translateY(-1px);
}

.button-small {
    min-height: 2.35rem;
    padding: 0.6rem 0.9rem;
    font-size: 0.76rem;
    border-radius: var(--radius-sm);
}

.button-large {
    min-height: 3.2rem;
    padding: 0.95rem 1.6rem;
    font-size: 0.92rem;
}

.btn-primary,
.button-primary {
    color: var(--white);
    background: var(--primary);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
}

.btn-primary:hover,
.button-primary:hover {
    color: var(--white);
    background: var(--accent);
    box-shadow: 0 10px 28px rgba(79, 70, 229, 0.24);
}

.btn-secondary,
.button-outline {
    color: var(--text-strong);
    background: var(--surface);
    border-color: var(--border-strong);
}

.btn-secondary:hover,
.button-outline:hover {
    color: var(--text-strong);
    background: var(--bg-soft);
    border-color: #94a3b8;
}

/* ========================================================================== */
/* 7. FOOTER                                                                  */
/* ========================================================================== */

.site-footer {
    margin-top: auto;
    padding-block: clamp(2.5rem, 5vw, 4rem);

    color: rgba(248, 250, 252, 0.82);
    background:
        radial-gradient(
            circle at 15% 0,
            rgba(79, 70, 229, 0.25),
            transparent 30rem
        ),
        var(--primary);
}

.footer-flex,
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-inner {
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;

    padding: 0.65rem 0.9rem;

    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-pill);

    color: rgba(248, 250, 252, 0.76);
    background: rgba(255, 255, 255, 0.045);
}

.status-dot {
    width: 0.55rem;
    height: 0.55rem;
    background: #818cf8;
}

.copyright-notice {
    font-size: 0.84rem;
    opacity: 0.68;
}

/* ========================================================================== */
/* 8. CODICRAFT BUILDER - FOUNDATION                                          */
/* ========================================================================== */

.builder-page {
    width: 100%;
    min-width: 0;
    padding-bottom: var(--space-lg);
}

.builder-page-header {
    width: min(
        calc(100% - (2 * var(--site-gutter))),
        var(--content-width)
    );
    margin-inline: auto;
    padding-top: var(--space-lg);
}

.builder-output {
    width: 100%;
    min-width: 0;
    overflow: clip;
}

/*
 * Native Builder-Inhalt nutzt die verfügbare Seitenbreite. Sections sowie
 * wide/full Width dürfen nicht durch einen generischen Content-Wrapper
 * künstlich begrenzt werden.
 */
.builder-output > .cc-section,
.builder-output > .cc-container,
.builder-output > .cc-columns,
.builder-output > .cc-block {
    max-width: none;
}

.cc-block {
    min-width: 0;
}

.cc-section {
    position: relative;
    width: 100%;

    padding-block:
        var(
            --cc-section-space,
            clamp(2.75rem, 7vw, 6rem)
        );
}

.cc-container {
    width: min(
        calc(100% - (2 * var(--site-gutter))),
        var(--wide-width)
    );
    margin-inline: auto;
}

.cc-column {
    min-width: 0;
}

.cc-columns {
    display: grid;
    align-items: start;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    width: min(
        calc(100% - (2 * var(--site-gutter))),
        var(--wide-width)
    );
    margin-inline: auto;
}

/* ========================================================================== */
/* 9. BUILDER - SPACING TOKENS                                                */
/* ========================================================================== */

.cc-spacing--none {
    --cc-space: 0;
}

.cc-spacing--small {
    --cc-space: var(--space-sm);
}

.cc-spacing--normal {
    --cc-space: var(--space-md);
}

.cc-spacing--large {
    --cc-space: var(--space-lg);
}

/*
 * Strukturblöcke nutzen Spacing primär als Innenabstand.
 * Inhaltsblöcke nutzen es als vertikalen Rhythmus.
 */
.cc-section.cc-spacing--none {
    --cc-section-space: 0;
}

.cc-section.cc-spacing--small {
    --cc-section-space: clamp(1.1rem, 2.5vw, 1.75rem);
}

.cc-section.cc-spacing--normal {
    --cc-section-space: clamp(2rem, 4vw, 3.4rem);
}

.cc-section.cc-spacing--large {
    --cc-section-space: clamp(3.25rem, 6vw, 5.25rem);
}

.cc-container.cc-spacing--none,
.cc-column.cc-spacing--none {
    padding-block: 0;
}

.cc-container.cc-spacing--small,
.cc-column.cc-spacing--small {
    padding-block: 0.75rem;
}

.cc-container.cc-spacing--normal,
.cc-column.cc-spacing--normal {
    padding-block: 1.25rem;
}

.cc-container.cc-spacing--large,
.cc-column.cc-spacing--large {
    padding-block: 2.25rem;
}

:is(
    .cc-heading,
    .cc-richtext,
    .cc-image,
    .cc-button,
    .cc-divider,
    .cc-columns
).cc-spacing--none {
    margin-block: 0;
}

:is(
    .cc-heading,
    .cc-richtext,
    .cc-image,
    .cc-button,
    .cc-divider,
    .cc-columns
).cc-spacing--small {
    margin-block: var(--space-sm);
}

:is(
    .cc-heading,
    .cc-richtext,
    .cc-image,
    .cc-button,
    .cc-divider,
    .cc-columns
).cc-spacing--normal {
    margin-block: var(--space-md);
}

:is(
    .cc-heading,
    .cc-richtext,
    .cc-image,
    .cc-button,
    .cc-divider,
    .cc-columns
).cc-spacing--large {
    margin-block: var(--space-lg);
}

/* ========================================================================== */
/* 10. BUILDER - WIDTH TOKENS                                                 */
/* ========================================================================== */

/*
 * Content-Blöcke erhalten ohne explizites width-Setting definierte
 * Standardbreiten. Die cc-width-* Klassen überschreiben diese Defaults.
 */
.cc-heading,
.cc-richtext,
.cc-image,
.cc-divider {
    width: min(
        calc(100% - (2 * var(--site-gutter))),
        var(--content-width)
    );
    margin-inline: auto;
}

.cc-columns {
    width: min(
        calc(100% - (2 * var(--site-gutter))),
        var(--wide-width)
    );
}

.cc-width--default {
    width: min(
        calc(100% - (2 * var(--site-gutter))),
        var(--content-width)
    );
    margin-inline: auto;
}

.cc-width--wide {
    width: min(
        calc(100% - (2 * var(--site-gutter))),
        var(--wide-width)
    );
    margin-inline: auto;
}

.cc-width--full {
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

/*
 * Ein full-width Textblock bekommt weiterhin einen sicheren Lesepuffer.
 */
:is(.cc-heading, .cc-richtext).cc-width--full {
    padding-inline: var(--site-gutter);
}

/* ========================================================================== */
/* 11. BUILDER - BACKGROUND TOKENS                                            */
/* ========================================================================== */

.cc-bg--default {
    background: transparent;
}

.cc-bg--light {
    background:
        linear-gradient(
            180deg,
            rgba(248, 250, 252, 0.98),
            rgba(241, 245, 249, 0.92)
        );
}

.cc-bg--dark {
    color: rgba(248, 250, 252, 0.86);
    background:
        radial-gradient(
            circle at top right,
            rgba(99, 102, 241, 0.2),
            transparent 38%
        ),
        var(--primary);
}

.cc-bg--accent {
    color: var(--white);
    background:
        linear-gradient(
            135deg,
            var(--accent) 0%,
            #7c3aed 100%
        );
}

:is(.cc-column, .cc-container).cc-bg--light,
:is(.cc-column, .cc-container).cc-bg--dark,
:is(.cc-column, .cc-container).cc-bg--accent {
    /*
     * Hintergrundrollen dürfen das semantische spacing nicht überschreiben.
     * Horizontaler Innenraum gehört zur Surface, vertikaler Innenraum
     * bleibt Aufgabe von cc-spacing--*.
     */
    padding-inline:
        clamp(1.25rem, 3vw, 2rem);
    border-radius: var(--radius-lg);
}

/*
 * Nur wenn spacing auf "Vom Theme übernehmen" steht, liefert das
 * Default-Theme selbst einen vertikalen Fallback.
 */
:is(.cc-column, .cc-container):is(
    .cc-bg--light,
    .cc-bg--dark,
    .cc-bg--accent
):not(.cc-spacing--none):not(.cc-spacing--small):not(.cc-spacing--normal):not(.cc-spacing--large) {
    padding-block:
        clamp(1.25rem, 3vw, 2rem);
}

.cc-bg--light {
    border-color: var(--border);
}

:is(.cc-bg--dark, .cc-bg--accent)
:is(h1, h2, h3, h4, h5, h6) {
    color: var(--white);
}

:is(.cc-bg--dark, .cc-bg--accent)
:is(p, li, blockquote) {
    color: inherit;
}

:is(.cc-bg--dark, .cc-bg--accent)
.cc-richtext a:not(.cc-button) {
    color: #c7d2fe;
}

/* ========================================================================== */
/* 12. BUILDER - COLUMNS                                                      */
/* ========================================================================== */

.cc-columns--50-50 {
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr);
}

.cc-columns--33-67 {
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 2fr);
}

.cc-columns--67-33 {
    grid-template-columns:
        minmax(0, 2fr)
        minmax(0, 1fr);
}

.cc-columns--25-75 {
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 3fr);
}

.cc-columns--75-25 {
    grid-template-columns:
        minmax(0, 3fr)
        minmax(0, 1fr);
}

.cc-columns--33-33-33 {
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
}

.cc-columns--25-25-25-25 {
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
}

.cc-gap--none {
    gap: 0;
}

.cc-gap--small {
    gap: var(--space-sm);
}

.cc-gap--normal {
    gap: var(--space-md);
}

.cc-gap--large {
    gap: clamp(2rem, 4vw, 3.5rem);
}

/* ========================================================================== */
/* 13. BUILDER - HEADINGS                                                     */
/* ========================================================================== */

.cc-heading {
    color: var(--text-strong);
    text-wrap: balance;
}

h1.cc-heading {
    font-size: clamp(2.65rem, 7vw, 5.4rem);
    font-weight: 900;
    line-height: 0.98;
    letter-spacing: -0.065em;
}

h2.cc-heading {
    font-size: clamp(2rem, 4.5vw, 3.35rem);
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: -0.045em;
}

h3.cc-heading {
    font-size: clamp(1.55rem, 3vw, 2.25rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.03em;
}

h4.cc-heading {
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    font-weight: 780;
    line-height: 1.2;
}

h5.cc-heading,
h6.cc-heading {
    font-weight: 760;
    line-height: 1.3;
}

/* ========================================================================== */
/* 14. BUILDER - RICHTEXT                                                     */
/* ========================================================================== */

.cc-richtext {
    font-size: clamp(1rem, 1.1vw, 1.075rem);
    color: var(--text-main);
}

.cc-richtext > :first-child {
    margin-top: 0;
}

.cc-richtext > :last-child {
    margin-bottom: 0;
}

.cc-richtext p {
    margin: 0 0 1.15em;
}

.cc-richtext h2,
.cc-richtext h3,
.cc-richtext h4 {
    margin:
        1.4em 0
        0.55em;

    line-height: 1.15;
    letter-spacing: -0.025em;
    text-wrap: balance;

    color: var(--text-strong);
}

.cc-richtext h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.65rem);
}

.cc-richtext h3 {
    font-size: clamp(1.45rem, 2.7vw, 2rem);
}

.cc-richtext h4 {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
}

.cc-richtext ul,
.cc-richtext ol {
    margin: 0 0 1.25em;
    padding-left: 1.45rem;
}

.cc-richtext li + li {
    margin-top: 0.4rem;
}

.cc-richtext li > ul,
.cc-richtext li > ol {
    margin-top: 0.45rem;
    margin-bottom: 0;
}

.cc-richtext a {
    font-weight: 650;
    text-decoration-thickness: 0.08em;
    text-decoration-color: rgba(79, 70, 229, 0.4);

    transition:
        color var(--transition-fast),
        text-decoration-color var(--transition-fast);
}

.cc-richtext a:hover {
    text-decoration-color: currentColor;
}

.cc-richtext blockquote,
blockquote {
    position: relative;

    margin: 1.75rem 0;
    padding: 1.2rem 1.35rem 1.2rem 1.5rem;

    color: var(--primary-soft);
    background: var(--accent-soft);
    border: 1px solid #dfe3ff;
    border-left: 4px solid var(--accent);
    border-radius:
        0
        var(--radius-md)
        var(--radius-md)
        0;

    font-style: normal;
}

.cc-richtext blockquote p:last-child,
blockquote p:last-child {
    margin-bottom: 0;
}

blockquote cite {
    display: block;
    margin-top: 0.65rem;

    font-size: 0.84rem;
    font-weight: 700;
    font-style: normal;

    color: var(--text-muted);
}

/*
 * Farbkontext für RichText in dunklen Builder-Flächen.
 *
 * Die Basisregel von .cc-richtext setzt bewusst eine normale Textfarbe.
 * Innerhalb von dark/accent muss sie jedoch den Farbkontext des
 * Strukturblocks erben. Diese Regeln stehen deshalb nach den
 * RichText-Basisregeln.
 */
:is(.cc-bg--dark, .cc-bg--accent) .cc-richtext {
    color: inherit;
}

:is(.cc-bg--dark, .cc-bg--accent)
.cc-richtext :is(h2, h3, h4) {
    color: var(--white);
}

:is(.cc-bg--dark, .cc-bg--accent)
.cc-richtext a {
    color: #e0e7ff;
    text-decoration-color: rgba(224, 231, 255, 0.5);
}

:is(.cc-bg--dark, .cc-bg--accent)
.cc-richtext a:hover {
    color: var(--white);
    text-decoration-color: currentColor;
}

:is(.cc-bg--dark, .cc-bg--accent)
.cc-richtext blockquote {
    color: inherit;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    border-left-color: rgba(255, 255, 255, 0.72);
}

:is(.cc-bg--dark, .cc-bg--accent)
.cc-richtext blockquote :is(p, li) {
    color: inherit;
}

/* ========================================================================== */
/* 15. BUILDER - IMAGE                                                        */
/* ========================================================================== */

.cc-image {
    margin-block: var(--space-md);
}

.cc-image img {
    width: 100%;
    height: auto;

    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);

    object-fit: cover;
}

.cc-image figcaption {
    width: min(100%, 48rem);
    margin: 0.75rem auto 0;

    font-size: 0.84rem;
    line-height: 1.55;
    text-align: center;

    color: var(--text-muted);
}

.cc-image.cc-width--full img {
    border-radius: 0;
    box-shadow: none;
}

/*
 * Optionaler Bild-Link.
 *
 * Der Anchor ist nur ein semantischer Wrapper um das Bild und darf die
 * bestehende Bildbreite nicht verändern.
 */
.cc-image-link {
    display: block;
    width: 100%;
    color: inherit;
    text-decoration: none;
}

.cc-image-link:focus-visible {
    outline: 3px solid
        color-mix(
            in srgb,
            var(--accent) 42%,
            transparent
        );
    outline-offset: 4px;
    border-radius: var(--radius-lg);
}

/* ========================================================================== */
/* 16. BUILDER - BUTTON                                                       */
/* ========================================================================== */

.cc-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    min-height: 3rem;
    padding: 0.82rem 1.25rem;

    color: var(--white);
    background:
        linear-gradient(
            135deg,
            var(--accent),
            #6d5dfc
        );

    border: 1px solid rgba(67, 56, 202, 0.15);
    border-radius: var(--radius-md);
    box-shadow:
        0 8px 20px rgba(79, 70, 229, 0.2);

    font-size: 0.9rem;
    font-weight: 760;
    line-height: 1;
    text-decoration: none;

    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast),
        filter var(--transition-fast);
}

.cc-button:hover {
    color: var(--white);
    transform: translateY(-2px);
    box-shadow:
        0 12px 28px rgba(79, 70, 229, 0.28);
    filter: saturate(1.08);
}

/* ========================================================================== */
/* 17. BUILDER - DIVIDER                                                      */
/* ========================================================================== */

.cc-divider {
    height: 1px;
    margin-block: var(--space-md);

    border: 0;
    background:
        linear-gradient(
            90deg,
            transparent,
            var(--border-strong) 12%,
            var(--border-strong) 88%,
            transparent
        );
}

/* ========================================================================== */
/* 18. UTILITIES                                                              */
/* ========================================================================== */

.content-fade {
    animation:
        fadeIn 620ms
        cubic-bezier(0.22, 1, 0.36, 1)
        both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-pulse {
    animation: softPulse 2.2s ease-in-out infinite;
}

@keyframes softPulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.45;
    }
}

.h4 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-strong);
}

.text-small {
    font-size: 0.85rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.d-block {
    display: block;
}

.d-inline-block {
    display: inline-block;
}

.bg-lightest {
    background-color: var(--white);
}

.border {
    border: 1px solid var(--border);
}

.border-bottom {
    border-bottom: 1px solid var(--border);
}

.rounded {
    border-radius: var(--radius-lg);
}

.p-medium {
    padding: var(--space-md);
}

.pb-small {
    padding-bottom: var(--space-sm);
}

.m-0 {
    margin: 0 !important;
}

.mt-large {
    margin-top: var(--space-lg);
}

.mb-tiny {
    margin-bottom: var(--space-xs);
}

.mb-small {
    margin-bottom: var(--space-sm);
}

.mb-medium {
    margin-bottom: var(--space-md);
}

.css-grid {
    display: grid;
}

.grid-2 {
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(min(100%, 300px), 1fr)
        );
}

.gap-medium {
    gap: var(--space-md);
}

.error-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-sm);

    margin-top: var(--space-lg);
}

/* ========================================================================== */
/* 19. RESPONSIVE                                                             */
/* ========================================================================== */

@media (max-width: 900px) {
    .header-container {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .nav-wrapper {
        order: 3;
        flex-basis: 100%;
    }

    .nav-list {
        justify-content: flex-start;
    }

    .dropdown-menu {
        left: 0;
        transform: translate(0, -0.35rem);
    }

    .has-dropdown:hover > .dropdown-menu,
    .has-dropdown:focus-within > .dropdown-menu {
        transform: translate(0, 0);
    }

    .cc-columns--50-50,
    .cc-columns--33-67,
    .cc-columns--67-33,
    .cc-columns--25-75,
    .cc-columns--75-25,
    .cc-columns--33-33-33,
    .cc-columns--25-25-25-25 {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 768px) {
    .desktop-navigation {
        display: none;
    }

    .mobile-navigation {
        display: block;
        order: 3;
        flex: 1 0 100%;
        width: 100%;
    }

    .mobile-navigation__toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 2.75rem;
        padding: 0.65rem 0.85rem;
        cursor: pointer;
        list-style: none;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        background: var(--surface);
        color: var(--text-strong);
        font-size: 0.9rem;
        font-weight: 750;
        user-select: none;
    }

    .mobile-navigation__toggle::-webkit-details-marker {
        display: none;
    }

    .mobile-navigation__toggle::after {
        content: "";
        width: 0.48rem;
        height: 0.48rem;
        margin-left: 0.75rem;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg) translateY(-0.12rem);
        transition: transform var(--transition-fast);
    }

    .mobile-navigation[open] > .mobile-navigation__toggle::after {
        transform: rotate(225deg) translate(-0.1rem, -0.1rem);
    }

    .mobile-navigation__panel {
        margin-top: 0.45rem;
        padding: 0.45rem;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        background: var(--surface-raised);
        box-shadow: var(--shadow-sm);
    }

    .mobile-nav-list,
    .mobile-subnav-list {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .mobile-nav-list {
        display: grid;
        gap: 0.15rem;
    }

    .mobile-subnav-list {
        margin: 0.15rem 0 0.35rem 0.85rem;
        padding-left: 0.65rem;
        border-left: 2px solid var(--border);
    }

    .mobile-nav-link {
        display: flex;
        align-items: center;
        min-height: 2.6rem;
        padding: 0.55rem 0.7rem;
        border-radius: calc(var(--radius-md) - 0.2rem);
        color: var(--text-main);
        font-size: 0.92rem;
        font-weight: 700;
        line-height: 1.25;
        text-decoration: none;
    }

    .mobile-nav-link:hover,
    .mobile-nav-link:focus-visible {
        color: var(--text-strong);
        background: var(--bg-soft);
    }

    .mobile-nav-link--child {
        min-height: 2.4rem;
        font-size: 0.86rem;
        font-weight: 650;
    }
    :root {
        --site-gutter: 1rem;
        --space-lg: 3rem;
        --space-xl: 5rem;
    }

    .site-header {
        position: relative;
    }

    .header-container {
        align-items: center;
    }

    .site-tagline {
        max-width: 18rem;
    }

    .header-auth {
        text-align: right;
    }

    .footer-flex,
    .footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .error-actions {
        flex-direction: column;
    }

    .error-actions .button,
    .error-actions .btn {
        width: 100%;
    }

    .cc-section {
        padding-block:
            var(
                --cc-section-space,
                clamp(2.25rem, 10vw, 4rem)
            );
    }
}

@media (max-width: 600px) {
    .header-container {
        align-items: flex-start;
    }

    .header-auth {
        width: 100%;
        justify-content: space-between;
        text-align: left;
    }

    .nav-list {
        gap: 0.15rem;
    }

    .nav-link {
        min-height: 2.35rem;
        padding: 0.5rem 0.7rem;
    }

    .dropdown-menu {
        position: static;

        display: none;
        width: 100%;
        margin-top: 0.2rem;

        box-shadow: none;

        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .has-dropdown:hover > .dropdown-menu,
    .has-dropdown:focus-within > .dropdown-menu {
        display: block;
        transform: none;
    }

    .cc-gap--large {
        gap: var(--space-md);
    }

}

/* ========================================================================== */
/* 20. ACCESSIBILITY / REDUCED MOTION                                         */
/* ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ==========================================================================
   PRESENTATION CONTRACT v1
   Semantische Builder-Rollen - keine Designwerte im builder_json.
   ========================================================================== */

/* Ausrichtung ------------------------------------------------------------- */

.cc-align--left {
    text-align: left;
}

.cc-align--center {
    text-align: center;
}

.cc-align--right {
    text-align: right;
}

/*
 * Ein Button ist ein Inline-Flex-Element. Für die Blockausrichtung wird er
 * bei expliziter alignment-Rolle auf Inhaltsbreite als Flexbox behandelt.
 */
.cc-button.cc-align--left,
.cc-button.cc-align--center,
.cc-button.cc-align--right {
    display: flex;
    width: max-content;
    max-width: 100%;
}

.cc-button.cc-align--left {
    margin-right: auto;
}

.cc-button.cc-align--center {
    margin-inline: auto;
}

.cc-button.cc-align--right {
    margin-left: auto;
}

/* Semantische Textfarben -------------------------------------------------- */

/*
 * Kein text_color-Setting bedeutet weiterhin "Theme-Standard".
 * Die folgenden Klassen werden nur bei einer expliziten Benutzerwahl
 * ausgegeben.
 */
.cc-text--default {
    color: var(--text-main);
}

.cc-text--muted {
    color: var(--text-muted);
}

.cc-text--accent {
    color: var(--accent);
}

.cc-text--light {
    color: var(--text-inverse);
}

.cc-text--dark {
    color: var(--text-strong);
}

/*
 * RichText-interne H2-H4 besitzen im Default-Theme eine eigene Farbe.
 * Bei einer expliziten semantischen Textfarbe folgt auch die Überschrift
 * innerhalb des RichText-Blocks dieser Rolle.
 */
.cc-richtext.cc-text--default :is(h2, h3, h4),
.cc-richtext.cc-text--muted :is(h2, h3, h4),
.cc-richtext.cc-text--accent :is(h2, h3, h4),
.cc-richtext.cc-text--light :is(h2, h3, h4),
.cc-richtext.cc-text--dark :is(h2, h3, h4) {
    color: inherit;
}

/* Button-Varianten -------------------------------------------------------- */

/*
 * Ohne explizite Variante verwendet .cc-button den Primary-Stil. Neue
 * Builder-Dokumente speichern `primary` explizit.
 */
.cc-button--primary {
    color: var(--white);
    background:
        linear-gradient(
            135deg,
            var(--accent),
            #6d5dfc
        );
    border-color: rgba(67, 56, 202, 0.15);
}

.cc-button--secondary {
    color: var(--white);
    background: var(--primary);
    border-color: var(--primary);
    box-shadow:
        0 8px 20px rgba(15, 23, 42, 0.18);
}

.cc-button--secondary:hover {
    color: var(--white);
    background: var(--primary-soft);
    border-color: var(--primary-soft);
    box-shadow:
        0 12px 28px rgba(15, 23, 42, 0.24);
}

.cc-button--outline {
    color: var(--accent);
    background: transparent;
    border-color: var(--accent);
    box-shadow: none;
}

.cc-button--outline:hover {
    color: var(--accent-strong);
    background: var(--accent-soft);
    border-color: var(--accent-strong);
    box-shadow: none;
    filter: none;
}


/* ==========================================================================
   PRESENTATION CONTRACT - Heading-Farben
   ========================================================================== */

/*
 * Für core.heading wird die semantische Textfarbe explizit an den
 * Blocktyp gekoppelt. Zwei Klassen schlagen dadurch zuverlässig die
 * Default-Headingregel und bleiben zugleich vollständig theme-semantisch.
 */
.cc-heading.cc-text--default {
    color: var(--text-main);
}

.cc-heading.cc-text--muted {
    color: var(--text-muted);
}

.cc-heading.cc-text--accent {
    color: var(--accent);
}

.cc-heading.cc-text--light {
    color: var(--text-inverse);
}

.cc-heading.cc-text--dark {
    color: var(--text-strong);
}


/* ==========================================================================
   PRESENTATION CONTRACT - Frontend-Integration
   ========================================================================== */

.cc-heading.cc-align--left,
.cc-richtext.cc-align--left {
    text-align: left;
}

.cc-heading.cc-align--center,
.cc-richtext.cc-align--center {
    text-align: center;
}

.cc-heading.cc-align--right,
.cc-richtext.cc-align--right {
    text-align: right;
}

/*
 * Explizite RichText-Farben gewinnen auch innerhalb dark/accent Parents.
 * Ohne text_color bleibt weiterhin der Parent-Farbkontext aktiv.
 */
.cc-richtext.cc-text--default {
    color: var(--text-main);
}

.cc-richtext.cc-text--muted {
    color: var(--text-muted);
}

.cc-richtext.cc-text--accent {
    color: var(--accent);
}

.cc-richtext.cc-text--light {
    color: var(--text-inverse);
}

.cc-richtext.cc-text--dark {
    color: var(--text-strong);
}

.cc-richtext.cc-text--default :is(h2, h3, h4),
.cc-richtext.cc-text--muted :is(h2, h3, h4),
.cc-richtext.cc-text--accent :is(h2, h3, h4),
.cc-richtext.cc-text--light :is(h2, h3, h4),
.cc-richtext.cc-text--dark :is(h2, h3, h4) {
    color: inherit;
}

/*
 * Beide Inline-Margins werden bei Buttons vollständig gesetzt.
 * So kann keine allgemeinere Theme-Regel die Position teilweise überlagern.
 */
.cc-button.cc-align--left {
    margin-left: 0;
    margin-right: auto;
}

.cc-button.cc-align--center {
    margin-left: auto;
    margin-right: auto;
}

.cc-button.cc-align--right {
    margin-left: auto;
    margin-right: 0;
}


/* ========================================================================== */
/* Default theme release refresh                                               */
/* ========================================================================== */

.header-brand {
    display: inline-flex;
    flex-direction: column;
    text-decoration: none;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    line-height: 1.25;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.header-user strong {
    overflow-wrap: anywhere;
    color: var(--text-strong);
    font-size: 0.86rem;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-brand,
.copyright-notice {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.default-home {
    padding: clamp(4rem, 8vw, 8rem) 0;
}

.default-home__inner { max-width: 1180px; }
.default-home__hero { max-width: 820px; margin-bottom: 3rem; }
.default-home__kicker {
    margin: 0 0 0.8rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.default-home__hero h1 {
    margin: 0;
    color: var(--text-strong);
    font-size: clamp(2.8rem, 7vw, 5.8rem);
    line-height: 0.98;
    letter-spacing: -0.06em;
}
.default-home__hero > p:last-child {
    max-width: 700px;
    margin: 1.5rem 0 0;
    color: var(--text-muted);
    font-size: clamp(1rem, 2vw, 1.2rem);
}
.default-home__panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    box-shadow: var(--shadow-sm);
}
.default-home__panel-copy { max-width: 620px; }
.default-home__panel h2 { margin: 0 0 0.45rem; color: var(--text-strong); font-size: 1.4rem; }
.default-home__panel p { margin: 0; color: var(--text-muted); }
.default-home__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.75rem; }
.default-home__features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.default-home__feature { padding: 1.75rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.default-home__feature-index { display: block; margin-bottom: 1.2rem; color: var(--accent); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.1em; }
.default-home__feature h2 { margin: 0 0 0.6rem; color: var(--text-strong); font-size: 1.05rem; }
.default-home__feature p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

.public-error { padding: clamp(4rem, 10vw, 8rem) 0; }
.public-error__card { max-width: 680px; margin: 0 auto; padding: clamp(2rem, 5vw, 4rem); text-align: center; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.public-error__code { margin: 0 0 0.5rem; color: var(--accent); font-size: 0.82rem; font-weight: 800; letter-spacing: 0.16em; }
.public-error__card h1 { margin: 0 0 0.75rem; color: var(--text-strong); font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -0.04em; }
.public-error__card > p:not(.public-error__code) { color: var(--text-muted); }
.public-error__details { margin: 1.5rem 0 0; padding: 1rem 1.2rem; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-light); }
.public-error__details strong, .public-error__details span { display: block; }
.public-error__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 2rem; }

@media (max-width: 800px) {
    .default-home__features { grid-template-columns: 1fr; }
    .default-home__panel { align-items: flex-start; flex-direction: column; }
    .default-home__actions { justify-content: flex-start; }
    .footer-inner { align-items: flex-start; flex-direction: column; }
}

/* PB-R1.6: Core-Datei-/Download-Block */
.cc-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
    border-radius: 0.75rem;
}

.cc-file-content {
    min-width: 0;
}

.cc-file-title,
.cc-file-description,
.cc-file-meta {
    display: block;
}

.cc-file-description,
.cc-file-meta {
    margin: 0.35rem 0 0;
}

.cc-file-meta {
    opacity: 0.72;
    font-size: 0.9em;
}

.cc-file-download {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.6rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid currentColor;
    border-radius: 0.55rem;
    color: inherit;
    text-decoration: none;
    font-weight: 700;
}

.cc-file-download:hover {
    text-decoration: none;
}

@media (max-width: 620px) {
    .cc-file {
        align-items: stretch;
        flex-direction: column;
    }

    .cc-file-download {
        width: 100%;
    }
}


/* EXT-P8.11: Plugin notifications ----------------------------------------- */
.plugin-notification-stack {
    display: grid;
    gap: 0.75rem;
    padding-top: 1rem;
}

.plugin-notification {
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-left-width: 0.35rem;
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.plugin-notification p {
    margin: 0;
}

.plugin-notification--info {
    border-left-color: #2563eb;
}

.plugin-notification--success {
    border-left-color: var(--success);
}

.plugin-notification--warning {
    border-left-color: #d97706;
}

.plugin-notification--error {
    border-left-color: var(--danger);
}
