/* Choicery legal pages (privacy policy, terms, etc.) */

/* Honeypot field: visually hidden from humans and assistive tech, but present
   in the DOM so naive spam bots fill it. A non-empty value is treated as a bot
   server-side. Not display:none alone, since some bots skip display:none. */
.legal-hp {
    position: absolute !important;
    left: -9999px !important;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

body.legal-page main.container {
    max-width: 100%;
    padding: 0;
}

.legal-public-page {
    min-height: 100vh;
    margin: 0;
    background: #f8fafc;
    color: var(--text-default, #1f2937);
}

.legal-public-main {
    width: 100%;
}

.legal-shell {
    box-sizing: border-box;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: var(--space-8) clamp(20px, 4vw, 36px) var(--space-10);
    font-family: 'Inter', sans-serif;
    color: var(--text-default);
    background: #fff;
    min-height: 100vh;
}

.legal-public-alerts {
    box-sizing: border-box;
    width: min(100% - 32px, 748px);
    margin: 20px auto 0;
}

.legal-public-alert {
    padding: 12px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a8a;
    font: 500 0.9rem/1.45 'Inter', sans-serif;
}

.legal-public-alert-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.legal-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-7);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-default);
}

.legal-wordmark {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    color: var(--text-default);
    text-decoration: none;
}

.legal-wordmark .dot {
    color: var(--accent-teal-500, #2bb39a);
}

.legal-eyebrow {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.legal-prose {
    font-size: 0.95rem;
    line-height: 1.65;
    color: #2a322f;
}

.legal-prose h1,
.legal-prose h2,
.legal-prose h3 {
    color: var(--text-default);
    font-weight: 700;
    line-height: 1.25;
    margin: 2rem 0 0.75rem;
    scroll-margin-top: 1rem;
}

.legal-prose > h1:first-child {
    margin-top: 0;
}

.legal-prose h1 {
    font-size: 1.6rem;
}

.legal-prose h2 {
    font-size: 1.2rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-default);
}

.legal-prose h3 {
    font-size: 1.02rem;
}

.legal-prose p,
.legal-prose ul,
.legal-prose ol {
    margin: 0 0 1rem;
}

.legal-prose ul,
.legal-prose ol {
    padding-left: 1.4rem;
}

.legal-prose li {
    margin-bottom: 0.35rem;
}

.legal-document-prose p,
.legal-document-prose li {
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

.legal-prose a {
    color: var(--accent-teal-600, #1f8c79);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}

.legal-prose a:hover {
    text-decoration-thickness: 2px;
}

.legal-prose code {
    padding: 0 4px;
    background: #faf7ee;
    border: 1px solid #f1ede3;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    color: #4a544f;
    /* Long file and column names must not push the page sideways on phones. */
    overflow-wrap: anywhere;
    /* A break inside code must not add a hyphen ("Bea-rer" reads as part of the value). */
    hyphens: none;
}

/* Code examples (the Power Query block of the export format register) keep
   their lines and scroll on their own, so a phone never scrolls the page. */
.legal-prose pre {
    max-width: 100%;
    margin: 1rem 0 1.4rem;
    padding: 0.6rem 0.8rem;
    overflow-x: auto;
    background: #faf7ee;
    border: 1px solid #f1ede3;
    border-radius: 6px;
}

.legal-prose pre code {
    padding: 0;
    background: none;
    border: 0;
    white-space: pre;
    overflow-wrap: normal;
}

.legal-prose blockquote {
    margin: 1rem 0;
    padding: 0.6rem 0.9rem;
    background: #faf7ee;
    border-left: 3px solid var(--accent-teal-500, #2bb39a);
    border-radius: 0 6px 6px 0;
    color: #4a544f;
    font-size: 0.92rem;
}

.legal-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 1.4rem;
    font-size: 0.88rem;
}

.legal-prose thead th {
    text-align: left;
    background: #faf7ee;
    border-bottom: 1px solid var(--border-default);
    padding: 0.55rem 0.7rem;
    font-weight: 600;
}

.legal-prose tbody td {
    border-bottom: 1px solid #f1ede3;
    padding: 0.55rem 0.7rem;
    vertical-align: top;
}

/* Set around every table by _wrap_legal_tables() (routes/main.py). A table
   wider than the text column scrolls on its own instead of the whole page.
   Hyphenation (the page carries lang="de"/"en") keeps long compound words
   from forcing that width where the browser supports it. */
.legal-table-scroll {
    overflow-x: auto;
    margin: 1rem 0 1.4rem;
    max-width: 100%;
}

.legal-table-scroll > table {
    margin: 0;
}

.legal-prose th,
.legal-prose td {
    -webkit-hyphens: auto;
    hyphens: auto;
}

.legal-prose hr {
    border: 0;
    border-top: 1px solid var(--border-default);
    margin: 2rem 0;
}

.legal-foot {
    margin-top: var(--space-8);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-default);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.legal-foot a {
    color: var(--accent-teal-600, #1f8c79);
    text-decoration: none;
}

.legal-foot a:hover {
    text-decoration: underline;
}

.legal-foot-sep {
    margin: 0 0.5rem;
    color: var(--border-default);
}

.legal-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.legal-field {
    display: grid;
    gap: 6px;
}

.legal-field label,
.legal-check {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-default);
}

.legal-field input,
.legal-field textarea,
.legal-field select {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text-default);
    background: #fff;
}

.legal-field textarea {
    resize: vertical;
    min-height: 160px;
}

.legal-field small {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.legal-check {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    align-items: start;
    font-weight: 500;
    line-height: 1.45;
}

.legal-check input {
    margin-top: 3px;
}

/* Compact free-text field next to the short identity inputs; the tall default
   is meant for the notice form, not for a one-line note. */
.legal-field textarea.legal-textarea-compact {
    min-height: 84px;
}

/* Section 312k(2) inputs (type of cancellation, requested end date). They are
   pre-selected with the ordinary case and folded away so the visible form
   stays short. A closed <details> still submits its inputs, so this needs no
   JavaScript and stays within the strict CSP. */
.legal-advanced {
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 12px 14px;
}

.legal-advanced > summary {
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-default);
}

.legal-advanced[open] > summary {
    margin-bottom: 14px;
}

.legal-advanced-body {
    display: grid;
    gap: 14px;
}

/* Indent the date input so it lines up under the radio label it belongs to
   (18px radio column + 10px gap of .legal-check). */
.legal-advanced .legal-fieldset .legal-field {
    margin-left: 28px;
}

.legal-submit {
    justify-self: start;
    border: 0;
    border-radius: 6px;
    padding: 10px 16px;
    background: var(--accent-teal-600, #1f8c79);
    color: #fff;
    font-weight: 700;
}

.legal-submit:hover {
    background: var(--accent-teal-700, #176f61);
}

/* Language switcher (Deutsch | English) below the page head. The active
   language is plain text, the other one a link. */
.legal-lang-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: calc(-1 * var(--space-4)) 0 var(--space-6);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.legal-lang-switch a {
    color: var(--accent-teal-600, #1f8c79);
    text-decoration: none;
}

.legal-lang-switch a:hover {
    text-decoration: underline;
}

.legal-lang-current {
    font-weight: 600;
    color: var(--text-default);
}

.legal-lang-sep {
    color: var(--border-default);
}

/* Precedence notice on contract documents (German version is binding). */
.legal-binding-note {
    margin: 0 0 var(--space-6);
    padding: 0.6rem 0.9rem;
    border-left: 3px solid var(--accent-teal-500, #2bb39a);
    border-radius: 0 6px 6px 0;
    background: #faf7ee;
    color: #4a544f;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Short information box (e.g. the Art. 13 notice above the contact form). */
.legal-info-box {
    margin: var(--space-6) 0 0;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: #f8fafc;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #2a322f;
}

.legal-info-box-title {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-default);
}

.legal-info-box ul {
    margin: 0 0 0.6rem;
    padding-left: 1.2rem;
}

.legal-info-box li {
    margin-bottom: 0.25rem;
}

.legal-info-box p {
    margin: 0;
}

.legal-info-box a {
    color: var(--accent-teal-600, #1f8c79);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Grouped optional fields inside a legal form (DMCA-only fields). */
.legal-fieldset {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 14px 16px 16px;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    min-width: 0;
}

.legal-fieldset legend {
    padding: 0 6px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-default);
}

/* Legal hub: one row per document with description, version and both languages. */
.legal-hub-list {
    list-style: none;
    margin: var(--space-6) 0 0;
    padding: 0;
    display: grid;
    gap: 14px;
}

.legal-hub-item {
    padding: 14px 16px;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: #fff;
}

.legal-hub-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 1.02rem;
    font-weight: 700;
}

.legal-hub-title a {
    color: var(--text-default);
    text-decoration: none;
}

.legal-hub-title a:hover {
    color: var(--accent-teal-600, #1f8c79);
    text-decoration: underline;
}

.legal-hub-badge {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    border: 1px solid var(--border-default);
    border-radius: 999px;
    padding: 1px 8px;
}

.legal-hub-desc {
    margin: 0.35rem 0 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #4a544f;
}

.legal-hub-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.legal-hub-links {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
}

.legal-hub-links a {
    color: var(--accent-teal-600, #1f8c79);
    text-decoration: none;
}

.legal-hub-links a:hover {
    text-decoration: underline;
}

/* Receipt pages of the cancellation/withdrawal flows: the declaration
   snapshot as a printable definition list plus the email delivery status. */
.legal-receipt {
    display: grid;
    gap: 10px;
    margin: 0 0 1.5rem;
    padding: 0;
}

.legal-receipt-row {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr;
    gap: 4px 16px;
}

.legal-receipt dt {
    margin: 0;
    font-weight: 600;
    color: var(--text-default);
}

.legal-receipt dd {
    margin: 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.legal-intake-status {
    padding: 10px 12px;
    border: 1px solid var(--border-default);
    border-radius: 6px;
}

.legal-intake-status.is-warning {
    border-color: #b7791f;
}

@media print {
    .legal-lang-switch,
    .legal-foot,
    .legal-public-alerts {
        display: none;
    }

    .legal-table-scroll {
        overflow: visible;
    }
}

@media (max-width: 640px) {
    .legal-shell {
        padding: 22px 16px 32px;
    }

    .legal-hub-links {
        margin-left: 0;
        width: 100%;
    }

    .legal-receipt-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .legal-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .legal-prose h1 {
        font-size: 1.35rem;
    }

    .legal-prose h2 {
        font-size: 1.1rem;
    }

    /* Stacked tables: 5-7 columns in 390px left 70-85px per column. Each row
       becomes a bordered block; every cell shows its column header from the
       data-label that _wrap_legal_tables() (routes/main.py) copies onto it.
       The header row stays in the markup for screen readers only. */
    .legal-prose table,
    .legal-prose tbody,
    .legal-prose tr,
    .legal-prose td {
        display: block;
        width: 100%;
    }

    .legal-prose thead {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }

    .legal-prose tr {
        box-sizing: border-box;
        margin: 0 0 0.75rem;
        padding: 0.35rem 0.8rem;
        border: 1px solid var(--border-default);
        border-radius: 8px;
    }

    .legal-prose tr:last-child {
        margin-bottom: 0;
    }

    .legal-prose tbody td {
        box-sizing: border-box;
        padding: 0.45rem 0;
    }

    .legal-prose tbody td:last-child {
        border-bottom: 0;
    }

    .legal-prose tbody td:empty {
        display: none;
    }

    .legal-prose td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--text-muted);
    }

    .legal-prose tbody td:first-child {
        font-weight: 600;
        color: var(--text-default);
    }
}
