/*
 * Shared layout for Autovena legal pages.
 * Loaded after style.css by every page under /en/ and /tr/.
 * Reuses the legal-* blocks already defined in style.css and adds the
 * table of contents and print rules.
 */

/* Anchor targets must clear the fixed 68px navbar. */
.legal-content h2,
.legal-content h3 {
    scroll-margin-top: 96px;
}

/* ---------- Sidebar ---------- */

.legal-aside {
    position: sticky;
    top: 96px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.legal-aside .legal-summary {
    position: static;
    top: auto;
}

/* ---------- Table of contents ---------- */

.legal-toc {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    padding: 20px 22px;
}

.legal-toc > summary {
    color: var(--primary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    list-style: none;
    text-transform: uppercase;
}

.legal-toc > summary::-webkit-details-marker {
    display: none;
}

.legal-toc > summary::after {
    content: "▾";
    float: right;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.legal-toc[open] > summary::after {
    transform: rotate(180deg);
}

.legal-toc ol {
    counter-reset: toc;
    list-style: none;
    margin: 16px 0 0;
    max-height: min(58vh, 620px);
    overflow-y: auto;
    padding: 0;
}

.legal-toc li {
    counter-increment: toc;
    margin: 0;
}

.legal-toc a {
    border-left: 2px solid transparent;
    color: var(--text-light);
    display: block;
    font-size: 0.88rem;
    line-height: 1.4;
    padding: 7px 10px 7px 12px;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.legal-toc a::before {
    color: var(--muted);
    content: counter(toc) ".";
    display: inline-block;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    margin-right: 8px;
    min-width: 18px;
}

.legal-toc a:hover {
    background: rgba(0, 180, 216, 0.06);
    color: var(--primary);
}

.legal-toc a.is-active {
    background: rgba(0, 180, 216, 0.08);
    border-left-color: var(--accent);
    color: var(--primary);
    font-weight: 600;
}

.legal-toc a.is-active::before {
    color: var(--accent-dark);
}

/* ---------- Content extras ---------- */

.legal-content h3 {
    color: var(--primary);
    font-size: 1.05rem;
    margin: 28px 0 10px;
}

.legal-content h2 + h3 {
    margin-top: 18px;
}

/* Not inline-flex: the literal space before <time> is the only gap wanted. */
.legal-updated {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.95rem;
}

.legal-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.legal-print-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 10px;
    color: var(--white);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    padding: 9px 16px;
    transition: background 0.2s ease;
}

.legal-print-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Callout used for store/regulatory highlights. */
.legal-callout {
    background: rgba(0, 180, 216, 0.07);
    border: 1px solid rgba(0, 180, 216, 0.24);
    border-radius: 14px;
    margin: 22px 0;
    padding: 18px 20px;
}

.legal-callout strong {
    color: var(--primary);
    display: block;
    margin-bottom: 6px;
}

.legal-callout p:last-child {
    margin-bottom: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .legal-aside {
        position: static;
        top: auto;
    }

    .legal-toc ol {
        max-height: none;
    }
}

/* ---------- Print ---------- */

@media print {
    .navbar,
    footer,
    .legal-aside,
    .legal-hero__actions,
    .legal-print-btn {
        display: none !important;
    }

    html {
        scroll-behavior: auto;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 11pt;
    }

    .legal-hero {
        background: none !important;
        color: #000;
        margin-top: 0;
        padding: 0 0 18pt;
    }

    .legal-hero h1 {
        color: #000;
        font-size: 20pt;
    }

    .legal-hero p,
    .legal-updated {
        color: #333;
    }

    .legal-hero .section__tag {
        display: none;
    }

    .legal-section {
        background: none;
        padding: 0;
    }

    .legal-layout {
        display: block;
    }

    .legal-content {
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    .legal-content h2 {
        break-after: avoid;
        page-break-after: avoid;
    }

    .legal-content p,
    .legal-list li,
    .legal-table {
        break-inside: avoid;
        page-break-inside: avoid;
    }

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

    /* Reveal destinations of external links on paper. */
    .legal-content a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        word-break: break-all;
    }

    .legal-table th,
    .legal-table td {
        border: 1px solid #999;
    }
}
