/*
 * netzmal Designsystem: Rechtliche Dokumente
 * ------------------------------------------
 * Ruhige Leseflächen für Impressum, Datenschutz und Vertragsbedingungen.
 */

.nm-legal-intro {
    max-width: 1050px;
}

.nm-legal-document {
    max-width: 1050px;
    padding-bottom: clamp(90px, 10vw, 150px);
}

.nm-legal-document.nm-prose-wide {
    max-width: none;
}

/* Kompakte Folge eigenständiger, textbasierter Hauptkapitel */
.nm-text-chapters > .nm-section {
    margin-block: clamp(var(--nm-space-xl), 5vw, 64px);
}

.nm-legal-story > * + * {
    margin-top: clamp(70px, 9vw, 120px);
}

.nm-legal-chapter-head {
    max-width: 900px;
    margin-bottom: var(--nm-space-xl);
}

.nm-legal-chapter-head .nm-heading {
    max-width: 820px;
    margin-top: var(--nm-space-sm);
}

.nm-legal-chapter > .nm-legal-section {
    max-width: 900px;
}

.nm-legal-chapter > .nm-legal-section + .nm-legal-section {
    margin-top: var(--nm-space-xl);
}

.nm-legal-section {
    scroll-margin-top: 120px;
}

.nm-legal-imprint-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(var(--nm-space-lg), 6vw, 90px);
    align-items: start;
}

.nm-legal-imprint-intro + .nm-legal-imprint-grid {
    margin-top: var(--nm-space-lg);
}

.nm-legal-imprint-grid > div > * {
    margin-block: 0;
}

.nm-legal-imprint-grid > div > * + * {
    margin-top: var(--nm-space-md);
}

.nm-legal-imprint-divider {
    position: relative;
    width: 100%;
    height: 3px;
    margin-top: 0;
    background: linear-gradient(
        to right,
        transparent 0,
        color-mix(in srgb, var(--nm-color-imprint-divider) 45%, transparent) 7%,
        var(--nm-color-imprint-divider) 18%,
        var(--nm-color-imprint-divider) 82%,
        color-mix(in srgb, var(--nm-color-imprint-divider) 45%, transparent) 93%,
        transparent 100%
    );
}

.nm-legal-imprint-divider::after {
    position: absolute;
    top: 3px;
    right: 0;
    left: 0;
    height: 18px;
    background: radial-gradient(
        ellipse 70% 100% at 50% 0,
        color-mix(in srgb, var(--nm-color-imprint-divider) 45%, transparent) 0,
        color-mix(in srgb, var(--nm-color-imprint-divider) 20%, transparent) 48%,
        transparent 100%
    );
    content: '';
    pointer-events: none;
}

.nm-legal-imprint-visual {
    width: min(680px, 100%);
    margin: calc(var(--nm-space-xl) + var(--nm-space-lg)) auto 0;
}

.nm-legal-imprint-visual img {
    display: block;
    width: 100%;
    height: auto;
}

@media (max-width: 760px) {
    .nm-legal-imprint-grid {
        grid-template-columns: 1fr;
    }
}

.nm-legal-section > * {
    margin-block: 0;
}

.nm-legal-section > * + * {
    margin-top: var(--nm-space-md);
}

.nm-legal-section div > * {
    margin-block: 0;
}

.nm-legal-section div > * + *,
.nm-legal-view > * + * {
    margin-top: var(--nm-space-md);
}

.nm-legal-section .nm-legal-imprint-grid > div {
    margin-top: 0;
}

.nm-legal-section h2,
.nm-legal-document > h2 {
    color: var(--nm-color-heading);
    font-size: clamp(2rem, 4vw, 3.8rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.nm-legal-section h3,
.nm-legal-document > h3,
.nm-legal-view h2,
.nm-legal-view h3 {
    color: var(--nm-color-heading);
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    line-height: 1.25;
}

.nm-legal-section div > h3 + *,
.nm-legal-section div > p + h3 {
    margin-top: var(--nm-space-lg);
}

.nm-legal-section h4 {
    margin-top: var(--nm-space-lg);
    color: var(--nm-color-heading);
    font-size: var(--nm-font-size-text);
    line-height: 1.35;
}

.nm-legal-section p,
.nm-legal-section li,
.nm-legal-document > p,
.nm-legal-view p,
.nm-legal-view li {
    color: var(--nm-color-text-muted);
    font-size: var(--nm-font-size-text);
    line-height: 1.65;
}

.nm-legal-section ul,
.nm-legal-view ul {
    padding-left: 1.25rem;
}

.nm-legal-section a,
.nm-legal-view a {
    overflow-wrap: anywhere;
    color: var(--nm-color-primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.nm-legal-version {
    display: flex;
    flex-wrap: wrap;
    gap: var(--nm-space-sm) var(--nm-space-lg);
    align-items: center;
    justify-content: center;
    color: var(--nm-color-text-muted);
}

.nm-legal-version a {
    color: var(--nm-color-primary);
    font-weight: 700;
    text-decoration: none;
}

.nm-legal-version a:hover,
.nm-legal-version a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.nm-legal-notice {
    padding: var(--nm-space-md);
    border-left: 3px solid var(--nm-color-primary);
    border-radius: var(--nm-radius);
    background: var(--nm-color-primary-soft);
}

.nm-legal-signature {
    text-align: right;
    font-style: italic;
}

.nm-legal-view[hidden] {
    display: none;
}

.nm-legal-view > * {
    margin-block: 0;
}

/* AGB: lange Vertragsinhalte als ruhige, fortlaufende Story-Kapitel */
.nm-legal-document-agb .nm-legal-view {
    width: 100%;
}

.nm-legal-document-agb .nm-legal-lead {
    margin-bottom: clamp(var(--nm-space-xl), 7vw, 92px);
    color: var(--nm-color-text);
    font-size: clamp(1.08rem, 1.6vw, 1.3rem);
    line-height: 1.7;
}

.nm-legal-document-agb .nm-legal-view > h2 {
    margin-top: clamp(58px, 7vw, 92px);
    color: var(--nm-color-heading);
    font-size: clamp(1.55rem, 3vw, 2.35rem);
    line-height: 1.18;
    letter-spacing: -0.02em;
}

.nm-legal-document-agb .nm-legal-view > h2::before {
    display: block;
    width: 30px;
    height: 3px;
    margin-bottom: var(--nm-space-sm);
    border-radius: var(--nm-radius);
    background: var(--nm-color-primary);
    content: '';
}

.nm-legal-document-agb .nm-legal-view > h2 + p,
.nm-legal-document-agb .nm-legal-view > h2 + div,
.nm-legal-document-agb .nm-legal-view > h2 + ul {
    margin-top: var(--nm-space-lg);
}

.nm-legal-document-agb .nm-legal-view > p,
.nm-legal-document-agb .nm-legal-view > div,
.nm-legal-document-agb .nm-legal-view > ul {
    width: 100%;
    max-width: none;
}

.nm-legal-document-agb .nm-legal-view > .nm-legal-notice {
    width: 100%;
    max-width: none;
}

.nm-legal-document-agb .nm-legal-signature {
    margin-top: var(--nm-space-xl);
}

.nm-legal-version-agb {
    flex-direction: column;
    gap: var(--nm-space-sm);
    margin-top: var(--nm-space-lg);
}

.nm-legal-version-switch {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    color: var(--nm-color-text-muted) !important;
    font-size: 0.82rem;
    text-decoration: none !important;
}

.nm-legal-switch-track {
    position: relative;
    display: inline-flex;
    width: 46px;
    height: 26px;
    padding: 3px;
    border-radius: 999px;
    background: var(--nm-color-secondary);
    transition: background-color 180ms ease;
}

.nm-legal-switch-track > span {
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--nm-color-surface);
    box-shadow: var(--nm-shadow-control);
    transition: transform 180ms ease;
}

.nm-legal-version-switch[aria-checked='true'] .nm-legal-switch-track {
    background: var(--nm-color-success);
}

.nm-legal-version-switch[aria-checked='false'] .nm-legal-switch-track {
    background: var(--nm-color-danger);
}

.nm-legal-version-switch[aria-checked='false'] .nm-legal-switch-track > span {
    transform: translateX(20px);
}

.nm-legal-version-switch:focus-visible {
    border-radius: var(--nm-radius);
    outline: 3px solid var(--nm-color-primary);
    outline-offset: 4px;
}

@media (max-width: 640px) {
    .nm-legal-document-agb .nm-legal-view > h2 {
        margin-top: var(--nm-space-xl);
    }
}

.nm-legal-view-archive {
    text-decoration: none;
}

body.plain .nm-legal-intro {
    margin-top: var(--nm-space-lg);
}
