/* JexMac — terms of service page */

.legal-page {
    position: relative;
    z-index: 0;
    overflow-x: clip;
}

.legal-page .btn-secondary {
    background: transparent;
    color: var(--neon-blue);
    border: 1px solid rgba(0, 240, 255, 0.45);
}

.legal-page .btn-secondary:hover {
    background: rgba(0, 240, 255, 0.08);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.25);
}

.legal-page section {
    padding: 0;
}

/* Compact header band — must beat .legal-page section { padding: 0 } */
.legal-page section.legal-header {
    position: relative;
    overflow: hidden;
    padding: calc(var(--header-height) + 52px) 0 48px;
}

.legal-header__glow {
    position: absolute;
    top: 0;
    right: 10%;
    width: 520px;
    height: 320px;
    background: radial-gradient(ellipse, rgba(138, 43, 226, 0.12) 0%, rgba(0, 240, 255, 0.06) 50%, transparent 72%);
    filter: blur(60px);
    pointer-events: none;
}

.legal-header-inner {
    position: relative;
    max-width: 820px;
}

.legal-crumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.legal-crumb a {
    color: rgba(0, 240, 255, 0.75);
    transition: color 0.25s;
}

.legal-crumb a:hover {
    color: var(--neon-blue);
}

.legal-crumb-current {
    color: rgba(255, 255, 255, 0.55);
}

.legal-kicker {
    display: inline-block;
    margin-bottom: 16px;
    padding: 5px 12px;
    border-radius: 4px;
    border: 1px solid rgba(0, 240, 255, 0.25);
    background: rgba(0, 240, 255, 0.05);
    font-family: var(--font-tech);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--neon-blue);
}

.legal-header h1 {
    font-family: var(--font-tech);
    font-size: clamp(1.85rem, 3.2vw, 2.75rem);
    font-weight: 800;
    line-height: 1.22;
    color: #fff;
    letter-spacing: 0.3px;
    margin-bottom: 14px;
}

.legal-header-sub {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.7;
    max-width: 640px;
    margin-bottom: 22px;
}

.legal-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    font-size: 0.875rem;
    color: rgba(148, 163, 184, 0.95);
}

.legal-meta-row a {
    color: var(--neon-blue);
}

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

.legal-meta-divider {
    color: rgba(148, 163, 184, 0.35);
}

/* Three-pillar summary (informational, not jump links) */
.legal-principles {
    padding: 0 0 56px;
}

.legal-principles-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

.legal-principle-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    padding: 22px 22px 20px;
    border-radius: 12px;
    border: 1px solid rgba(0, 240, 255, 0.14);
    background: linear-gradient(165deg, rgba(13, 19, 36, 0.75), rgba(5, 9, 20, 0.85));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.legal-principle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-bottom: 14px;
    border-radius: 8px;
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.2);
    color: var(--neon-blue);
}

.legal-principle-card h3 {
    font-family: var(--font-tech);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
    margin-bottom: 8px;
}

.legal-principle-card p {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--text-muted);
}

/* Reading progress */
.legal-progress {
    position: sticky;
    top: var(--header-height);
    z-index: 50;
    height: 3px;
    background: rgba(0, 240, 255, 0.08);
}

.legal-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple));
    transition: width 0.12s linear;
}

/* Main layout — TOC left, content right */
.legal-body {
    padding-bottom: 80px;
}

.legal-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: clamp(28px, 4vw, 56px);
    align-items: start;
}

.legal-toc {
    position: sticky;
    top: calc(var(--header-height) + 24px);
    max-height: calc(100vh - var(--header-height) - 48px);
    overflow-y: auto;
    padding: 18px 0 18px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 240, 255, 0.25) transparent;
}

.legal-toc-title {
    margin-bottom: 14px;
    padding-left: 14px;
    font-family: var(--font-tech);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.85);
}

.legal-toc-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 1px solid rgba(0, 240, 255, 0.12);
}

.legal-toc-link {
    display: block;
    padding: 8px 14px;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: rgba(148, 163, 184, 0.9);
    border-left: 2px solid transparent;
    margin-left: -1px;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.legal-toc-link:hover {
    color: var(--neon-blue);
    background: rgba(0, 240, 255, 0.04);
}

.legal-toc-link.is-active {
    color: var(--neon-blue);
    border-left-color: var(--neon-blue);
    background: rgba(0, 240, 255, 0.06);
}

/* Article blocks */
.legal-main {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.legal-article {
    padding: 28px 30px;
    border-radius: 14px;
    border: 1px solid rgba(0, 240, 255, 0.12);
    background: rgba(13, 19, 36, 0.45);
    scroll-margin-top: calc(var(--header-height) + 28px);
    min-width: 0;
}

.legal-article-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
}

.legal-article-num {
    flex-shrink: 0;
    font-family: var(--font-code);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--neon-blue);
    opacity: 0.85;
}

.legal-article h2 {
    flex: 1 1 12rem;
    min-width: 0;
    font-family: var(--font-tech);
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
    line-height: 1.35;
}

.legal-article h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.95);
    margin: 22px 0 10px;
}

.legal-article-head + h3 {
    margin-top: 4px;
}

.legal-article-head + .legal-facts {
    margin-top: 0;
}

.legal-article p {
    font-size: 0.9375rem;
    line-height: 1.78;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.legal-article > :last-child,
.legal-list:last-child,
.legal-facts:last-child,
.legal-ban-grid:last-child,
.legal-notice:last-child,
.legal-contact-grid:last-child {
    margin-bottom: 0;
}

.legal-facts + h3 {
    margin-top: 20px;
}

.legal-article a {
    color: var(--neon-blue);
}

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

.legal-article strong {
    color: rgba(226, 232, 240, 0.95);
    font-weight: 600;
}

.legal-list {
    margin: 12px 0 16px;
    padding-left: 0;
    list-style: none;
}

.legal-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.legal-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.62em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--neon-blue);
    opacity: 0.55;
}

/* Fact strip (replaces pill row) */
.legal-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 8px;
    align-items: stretch;
}

.legal-fact {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 76px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid rgba(0, 240, 255, 0.15);
    background: rgba(0, 0, 0, 0.22);
    text-align: center;
}

.legal-fact-value {
    display: block;
    font-family: var(--font-tech);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--neon-blue);
    margin-bottom: 4px;
}

.legal-fact-label {
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.9);
    line-height: 1.4;
    word-break: break-word;
}

/* Prohibited grid */
.legal-ban-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0 18px;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.22);
    background: rgba(239, 68, 68, 0.05);
    align-items: stretch;
}

.legal-ban-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    height: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.14);
    background: rgba(0, 0, 0, 0.18);
    font-size: 0.875rem;
    line-height: 1.55;
    color: rgba(226, 232, 240, 0.88);
}

.legal-ban-item svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: rgba(248, 113, 113, 0.9);
}

/* Notice blocks */
.legal-notice {
    display: flex;
    gap: 14px;
    margin: 18px 0 4px;
    padding: 16px 18px;
    border-radius: 10px;
    font-size: 0.875rem;
    line-height: 1.65;
}

.legal-notice svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.legal-notice--warn {
    border: 1px solid rgba(251, 191, 36, 0.25);
    background: rgba(251, 191, 36, 0.06);
    color: rgba(253, 230, 138, 0.92);
}

.legal-notice--warn svg {
    color: rgba(251, 191, 36, 0.9);
}

.legal-notice--info {
    border: 1px solid rgba(0, 240, 255, 0.2);
    background: rgba(0, 240, 255, 0.05);
    color: rgba(186, 230, 253, 0.92);
}

.legal-notice--info svg {
    color: var(--neon-blue);
}

.legal-notice p {
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

.legal-notice a {
    color: var(--neon-blue);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-notice--warn a {
    color: #fde68a;
}

/* Contact grid */
.legal-contact-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
    align-items: stretch;
}

.legal-contact-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
    min-height: 148px;
    padding: 18px 16px;
    border-radius: 10px;
    border: 1px solid rgba(0, 240, 255, 0.14);
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.legal-contact-cell svg {
    display: block;
    margin: 0 auto 10px;
    color: var(--neon-blue);
}

.legal-contact-cell strong {
    display: block;
    font-size: 0.8125rem;
    color: rgba(226, 232, 240, 0.95);
    margin-bottom: 2px;
}

.legal-contact-detail,
.legal-contact-cell > a {
    display: block;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.legal-contact-cell a {
    color: var(--neon-blue);
}

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

/* Related docs strip */
.legal-related {
    padding: 48px 0 100px;
}

.legal-related-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 28px;
    border-radius: 14px;
    border: 1px solid rgba(0, 240, 255, 0.16);
    background: linear-gradient(135deg, rgba(13, 19, 36, 0.8), rgba(5, 9, 20, 0.9));
}

.legal-related-copy h2 {
    font-family: var(--font-tech);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.legal-related-copy p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.legal-related-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    text-align: center;
}

.legal-related-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 0;
    max-width: 100%;
    line-height: 1.35;
}

/* Tablet: 2-column principle cards */
@media (max-width: 1100px) and (min-width: 601px) {
    .legal-principles-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobile: horizontal TOC + stacked layout */
@media (max-width: 960px) {
    .legal-progress {
        display: none;
    }

    .legal-principles-grid {
        grid-template-columns: 1fr;
    }

    .legal-layout {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .legal-article {
        scroll-margin-top: calc(var(--header-height) + 64px);
    }

    .legal-toc {
        position: sticky;
        top: var(--header-height);
        z-index: 40;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        touch-action: pan-x;
        scrollbar-width: none;
        padding: 12px 0;
        margin: 0;
        background: rgba(5, 9, 20, 0.92);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(0, 240, 255, 0.1);
    }

    .legal-toc::-webkit-scrollbar {
        display: none;
    }

    .legal-toc-title {
        display: none;
    }

    .legal-toc-list {
        flex-direction: row;
        gap: 8px;
        border-left: none;
        width: max-content;
        min-width: 100%;
        padding: 0 24px 4px;
        box-sizing: border-box;
    }

    .legal-toc-link {
        white-space: nowrap;
        padding: 8px 14px;
        border-radius: 999px;
        border: 1px solid rgba(0, 240, 255, 0.15);
        border-left: 1px solid rgba(0, 240, 255, 0.15);
        margin-left: 0;
        background: rgba(0, 0, 0, 0.25);
    }

    .legal-toc-link.is-active {
        border-color: var(--neon-blue);
        background: rgba(0, 240, 255, 0.1);
    }

    .legal-article {
        padding: 22px 20px;
    }

    .legal-facts,
    .legal-ban-grid,
    .legal-contact-grid {
        grid-template-columns: 1fr;
    }

    .legal-ban-grid {
        padding: 12px;
    }

    .legal-contact-cell {
        min-height: 0;
    }

    .legal-notice {
        flex-direction: column;
        gap: 10px;
    }

    .legal-related-panel {
        flex-direction: column;
        align-items: flex-start;
    }

    .legal-related-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .legal-related-actions .btn {
        width: 100%;
        letter-spacing: 0.04em;
        padding: 12px 16px;
    }
}

@media (max-width: 600px) {
    .legal-page section.legal-header {
        padding-top: calc(var(--header-height) + 40px);
    }
}
