/*
 * Long-form legal / policy pages (privacy, terms, authorized reseller policy,
 * shipping-policy, return-policy).
 * Loaded via @push('styles') from shared/pages/partials/_legal-page.blade.php.
 *
 * Shared + brand-aware: every accent uses the --brand-* tokens
 * (resources/css/{eb,mm}/brand.css) so EB renders pink and MM gold with no
 * per-brand duplication. Never hardcode a brand hex here.
 *
 * IMPORTANT: all body-copy rules are scoped under .legal-body (or .legal-page)
 * so styling the raw block HTML never leaks into global element selectors.
 */

/* =================================================================
   1. PAGE SHELL + HEADER
   ================================================================= */
.legal-page {
    max-width: 820px; /* ~72ch reading measure at the base body size */
    margin: 0 auto;
    padding: 3rem 0 4rem;
}

.legal-page__header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e5e5e5;
}

/* h1 is intentionally attribute-free (exact-match page tests) — style by descent. */
.legal-page__header h1 {
    margin: 0;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 900;
    line-height: 1.15;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #212529;
}

.legal-page__header h1::after {
    content: "";
    display: block;
    width: 56px;
    height: 3px;
    margin-top: 0.85rem;
    background: var(--brand-primary, #ff10a4);
}

/* =================================================================
   2. TABLE OF CONTENTS (long docs only — >= 4 <h2> sections)
   ================================================================= */
.legal-toc {
    margin-bottom: 3rem;
    padding: 1.5rem 1.75rem;
    background: #f8f8f8;
    border: 1px solid #ececec;
    border-left: 3px solid var(--brand-primary, #ff10a4);
    border-radius: 2px;
}

.legal-toc__title {
    margin: 0 0 1rem;
    font-size: 0.8125rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #212529;
}

.legal-toc__list {
    margin: 0;
    padding: 0;
    list-style: none;
    columns: 2;
    column-gap: 2.5rem;
}

.legal-toc__item {
    margin-bottom: 0.5rem;
    break-inside: avoid;
}

.legal-toc__link {
    color: #444;
    text-decoration: none;
    font-size: 0.9375rem;
    line-height: 1.4;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.legal-toc__link:hover,
.legal-toc__link:focus-visible {
    color: var(--brand-accent-text, var(--brand-primary));
    border-bottom-color: currentColor;
}

/* =================================================================
   3. BODY COPY — scoped wrapper for the raw block HTML
   ================================================================= */
.legal-body {
    max-width: 72ch;
    color: #333;
    font-size: 1rem;
    line-height: 1.75;
}

.legal-body > *:first-child {
    margin-top: 0;
}

.legal-body p {
    margin: 0 0 1.15rem;
}

.legal-body h2,
.legal-body h3,
.legal-body h4 {
    color: #212529;
    font-weight: 900;
    line-height: 1.25;
    scroll-margin-top: 100px; /* clears any sticky header on anchor-jump */
}

.legal-body h2 {
    margin: 2.75rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    font-size: 1.375rem;
    text-transform: uppercase;
    letter-spacing: 0.01em;
}

.legal-body h2:first-child,
.legal-body > h2:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.legal-body h3 {
    margin: 2rem 0 0.75rem;
    font-size: 1.125rem;
}

.legal-body h4 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Links inside the injected copy */
.legal-body a {
    color: var(--brand-link, #c4161c);
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: break-word;
}

.legal-body a:hover,
.legal-body a:focus-visible {
    color: var(--brand-link-hover, #9b1117);
}

/* Lists */
.legal-body ul,
.legal-body ol {
    margin: 0 0 1.25rem;
    padding-left: 1.5rem;
}

.legal-body li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.legal-body li::marker {
    color: var(--brand-primary, #ff10a4);
}

.legal-body ul ul,
.legal-body ol ol,
.legal-body ul ol,
.legal-body ol ul {
    margin: 0.5rem 0 0.5rem;
}

/* Emphasis */
.legal-body strong,
.legal-body b {
    font-weight: 700;
    color: #212529;
}

/* Blockquotes (defensive — not always present) */
.legal-body blockquote {
    margin: 1.5rem 0;
    padding: 0.5rem 0 0.5rem 1.25rem;
    border-left: 3px solid var(--brand-primary, #ff10a4);
    color: #555;
    font-style: italic;
}

/* Media */
.legal-body img {
    max-width: 100%;
    height: auto;
}

/* Horizontal rule */
.legal-body hr {
    margin: 2.5rem 0;
    border: 0;
    border-top: 1px solid #e5e5e5;
}

/* =================================================================
   4. TABLES (e.g. the privacy "categories of data" table)
   ================================================================= */
.legal-body__table-scroll,
.legal-body .table-responsive {
    overflow-x: auto;
}

.legal-body table {
    width: 100%;
    margin: 1.5rem 0 2rem;
    border-collapse: collapse;
    font-size: 0.9375rem;
    line-height: 1.55;
}

.legal-body th,
.legal-body td {
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    text-align: left;
    vertical-align: top;
}

.legal-body thead th,
.legal-body thead td {
    background: #f4f4f4;
    font-weight: 700;
    color: #212529;
}

/* The privacy table has no <thead>; its first row carries <strong> labels. */
.legal-body table tr:first-child td {
    background: #f4f4f4;
}

.legal-body table p {
    margin: 0;
}

.legal-body table p + p {
    margin-top: 0.5rem;
}

/* =================================================================
   5. RESPONSIVE
   ================================================================= */
@media (max-width: 767.98px) {
    .legal-page {
        padding: 2rem 0 3rem;
    }

    .legal-page__header {
        margin-bottom: 1.75rem;
    }

    .legal-toc {
        padding: 1.25rem 1.25rem;
        margin-bottom: 2rem;
    }

    .legal-toc__list {
        columns: 1;
    }

    .legal-body {
        font-size: 0.9375rem;
        line-height: 1.7;
    }

    .legal-body h2 {
        font-size: 1.1875rem;
        margin-top: 2.25rem;
    }

    .legal-body th,
    .legal-body td {
        padding: 0.6rem 0.7rem;
    }
}

/* =================================================================
   6. PRINT — legal pages get printed; keep it clean and inked
   ================================================================= */
@media print {
    .legal-page {
        max-width: none;
        padding: 0;
    }

    .legal-toc {
        display: none;
    }

    .legal-body {
        max-width: none;
        color: #000;
        font-size: 11pt;
        line-height: 1.5;
    }

    .legal-page__header h1::after {
        background: #000;
    }

    .legal-body a {
        color: #000;
        text-decoration: underline;
    }

    .legal-body h2 {
        break-after: avoid;
    }
}
