/**
 * Public legal / content_pages layout.
 * @author Kaido Mägi
 * @copyright 2026
 */

/* Logged-in app: use full main column width (same idea as settings/team pages). Narrow + margin:auto on .mekry-content looked like a floating strip in the middle. */
body.mekry-app.page-legal .mekry-content {
    max-width: none;
    width: 100%;
}

/* Main column: full width for legal hub (single premium panel). */
body.mekry-app.page-legal .legal-page-inner,
body:not(.mekry-app).page-legal .legal-page-inner {
    max-width: none;
    width: 100%;
    padding: 0.5rem 0.5rem 1.5rem;
    box-sizing: border-box;
}

/* Guest / topbar-only */
body:not(.mekry-app).page-legal .legal-page {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0 0.75rem;
    box-sizing: border-box;
}

.legal-page-inner {
    padding: 0 0 2rem;
}

.legal-page-header {
    margin-bottom: 1.25rem;
}

.legal-page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0 0 0.5rem;
}

.legal-page-lead {
    margin: 0;
    color: #94a3b8;
    line-height: 1.55;
}

.legal-page-updated {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
    color: #64748b;
}

.legal-terms-note {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid #334155;
    background: rgba(15, 23, 42, 0.5);
    color: #cbd5e1;
    font-size: 0.9375rem;
}

.legal-empty-notice {
    margin: 0;
    color: #94a3b8;
}

.mekry-legal-article-body {
    color: #cbd5e1;
    line-height: 1.65;
    font-size: 0.9375rem;
}

.mekry-legal-article-body h2,
.mekry-legal-article-body h3 {
    color: #e2e8f0;
    margin: 1.25rem 0 0.5rem;
    font-weight: 600;
}

.mekry-legal-article-body h2:first-child,
.mekry-legal-article-body h3:first-child {
    margin-top: 0;
}

.mekry-legal-article-body p {
    margin: 0 0 0.75rem;
}

.mekry-legal-article-body ul,
.mekry-legal-article-body ol {
    margin: 0 0 0.75rem 1.1rem;
    padding: 0;
}

.mekry-legal-article-body a {
    color: #6ee7b7;
    text-decoration: underline;
}

.mekry-legal-article-body a:hover {
    color: #a7f3d0;
}

/* Legal — single premium panel (hub + document tabs; skipPageWindow removes outer card) */
body.page-legal.legal-hub-layout .legal-hub-shell {
    width: 100%;
    padding: 0 0 2rem;
    box-sizing: border-box;
}

body.page-legal.legal-hub-layout .legal-hub-panel {
    position: relative;
    overflow: hidden;
    width: 100%;
    margin: 0;
    padding: 1.75rem 1.75rem 1.75rem;
    border: 1px solid #243447;
    border-radius: 12px;
    background:
        radial-gradient(circle at 92% 8%, rgba(110, 231, 183, 0.08), transparent 32%),
        radial-gradient(circle at 12% 0%, rgba(95, 180, 245, 0.1), transparent 30%),
        linear-gradient(165deg, #182637 0%, #0f172a 100%);
    box-shadow:
        0 18px 48px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.page-legal.legal-hub-layout .legal-hub-panel::after {
    content: "";
    position: absolute;
    right: 10%;
    bottom: -120px;
    width: 260px;
    height: 260px;
    border-radius: 999px;
    background: rgba(110, 231, 183, 0.06);
    filter: blur(48px);
    pointer-events: none;
}

body.page-legal.legal-hub-layout .legal-hub-tabs {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    align-items: center;
    padding: 0 0 0.25rem;
    margin: 0 0 0.25rem;
    border-bottom: 1px solid #334155;
}

body.page-legal.legal-hub-layout .legal-hub-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    margin-bottom: -1px;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.2;
    color: #94a3b8;
    text-decoration: none;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 6px;
    transition: color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

body.page-legal.legal-hub-layout .legal-hub-tab:hover {
    color: #e2e8f0;
}

body.page-legal.legal-hub-layout .legal-hub-tab.is-active {
    color: #6ee7b7;
    border-bottom-color: #6ee7b7;
}

body.page-legal.legal-hub-layout .legal-hub-header {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
    gap: 1.75rem;
    align-items: start;
    padding: 1.75rem 0 1.5rem;
}

body.page-legal.legal-hub-layout .legal-hub-title {
    margin: 0;
    font-size: clamp(1.5rem, 2.2vw, 2.125rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: #e2e8f0;
}

body.page-legal.legal-hub-layout .legal-hub-subtitle {
    margin: 0.75rem 0 0;
    max-width: 38rem;
    font-size: 1rem;
    line-height: 1.6;
    color: #94a3b8;
}

body.page-legal.legal-hub-layout .legal-hub-info {
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 1.1rem 1.15rem;
    border: 1px solid #334155;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.page-legal.legal-hub-layout .legal-hub-info-icon {
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(110, 231, 183, 0.45);
    color: #6ee7b7;
    box-shadow: 0 0 18px rgba(110, 231, 183, 0.12);
}

body.page-legal.legal-hub-layout .legal-hub-info-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

body.page-legal.legal-hub-layout .legal-hub-info-icon svg circle,
body.page-legal.legal-hub-layout .legal-hub-info-icon svg path {
    stroke: currentColor;
    fill: none;
}

body.page-legal.legal-hub-layout .legal-hub-info p {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.55;
    color: #cbd5e1;
}

body.page-legal.legal-hub-layout .legal-hub-content {
    position: relative;
    z-index: 1;
    width: 100%;
    padding-top: 0.25rem;
}

body.page-legal.legal-hub-layout .legal-document-surface {
    min-height: 12rem;
    padding: 1.25rem 1.25rem 1.35rem;
    border: 1px solid rgba(51, 65, 85, 0.85);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(24, 38, 55, 0.55), rgba(15, 23, 42, 0.42));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.page-legal.legal-hub-layout .legal-terms-note--in-panel {
    margin: 0 0 1rem;
}

body.page-legal.legal-hub-layout .legal-document-updated {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

body.page-legal.legal-hub-layout .legal-document-empty {
    display: flex;
    gap: 1.1rem;
    align-items: flex-start;
    max-width: 46rem;
}

body.page-legal.legal-hub-layout .legal-document-empty-icon {
    display: inline-flex;
    width: 3.25rem;
    height: 3.25rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(110, 231, 183, 0.28);
    color: #6ee7b7;
    background: rgba(110, 231, 183, 0.06);
}

body.page-legal.legal-hub-layout .legal-document-empty-icon svg {
    width: 1.6rem;
    height: 1.6rem;
}

body.page-legal.legal-hub-layout .legal-document-empty-icon svg path {
    stroke: currentColor;
    fill: none;
}

body.page-legal.legal-hub-layout .legal-document-empty-message {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #94a3b8;
}

body.page-legal.legal-hub-layout .legal-hub-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

body.page-legal.legal-hub-layout .legal-hub-doc-card {
    display: flex;
    min-height: 17rem;
    flex-direction: column;
    padding: 1.35rem 1.2rem 1.15rem;
    border: 1px solid #243447;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(24, 38, 55, 0.95), rgba(15, 23, 42, 0.88));
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

body.page-legal.legal-hub-layout .legal-hub-doc-card:hover {
    transform: translateY(-2px);
    border-color: rgba(110, 231, 183, 0.35);
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.28),
        0 0 0 1px rgba(110, 231, 183, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.page-legal.legal-hub-layout .legal-hub-doc-icon {
    display: inline-flex;
    width: 4.25rem;
    height: 4.25rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border-radius: 999px;
    border: 1px solid rgba(110, 231, 183, 0.28);
    color: #6ee7b7;
    background: rgba(110, 231, 183, 0.06);
    box-shadow: inset 0 0 0 8px rgba(148, 163, 184, 0.04);
}

body.page-legal.legal-hub-layout .legal-hub-doc-icon svg {
    width: 2.25rem;
    height: 2.25rem;
}

body.page-legal.legal-hub-layout .legal-hub-doc-icon svg path {
    stroke: currentColor;
    fill: none;
}

body.page-legal.legal-hub-layout .legal-hub-doc-card-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.25;
    color: #e2e8f0;
}

body.page-legal.legal-hub-layout .legal-hub-doc-card-desc {
    flex: 1 1 auto;
    margin: 0.65rem 0 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #94a3b8;
}

body.page-legal.legal-hub-layout .legal-hub-doc-card-footer {
    margin-top: auto;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(51, 65, 85, 0.65);
}

body.page-legal.legal-hub-layout .legal-hub-open-btn {
    box-sizing: border-box;
    display: inline-flex;
    width: 100%;
    min-height: 2.75rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid #4ade80;
    background: transparent;
    color: #6ee7b7;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

body.page-legal.legal-hub-layout .legal-hub-open-btn:hover {
    background: rgba(110, 231, 183, 0.12);
    border-color: #6ee7b7;
    color: #a7f3d0;
    transform: translateY(-1px);
}

body.page-legal.legal-hub-layout .legal-hub-open-btn:focus-visible {
    outline: 2px solid #5fb4f5;
    outline-offset: 2px;
}

body.page-legal.legal-hub-layout .legal-hub-open-btn-arrow {
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.9;
}

body.page-legal.legal-hub-layout .legal-hub-trust {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 0.85rem;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(51, 65, 85, 0.55);
    color: #94a3b8;
    font-size: 0.9375rem;
    line-height: 1.5;
    text-align: center;
}

body.page-legal.legal-hub-layout .legal-hub-trust-icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: #6ee7b7;
}

body.page-legal.legal-hub-layout .legal-hub-trust-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

body.page-legal.legal-hub-layout .legal-hub-trust-icon svg path {
    stroke: currentColor;
    fill: none;
}

body.page-legal.legal-hub-layout .legal-hub-trust-text {
    max-width: 36rem;
}

@media (max-width: 1280px) {
    body.page-legal.legal-hub-layout .legal-hub-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.page-legal.legal-hub-layout .legal-hub-doc-card {
        min-height: 15rem;
    }
}

@media (max-width: 900px) {
    body.page-legal.legal-hub-layout .legal-hub-panel {
        padding: 1.25rem 1.1rem 1.35rem;
    }

    body.page-legal.legal-hub-layout .legal-hub-header {
        grid-template-columns: 1fr;
        padding: 1.25rem 0 1.25rem;
    }

    body.page-legal.legal-hub-layout .legal-hub-grid {
        grid-template-columns: 1fr;
    }

    body.page-legal.legal-hub-layout .legal-hub-doc-card {
        min-height: 0;
    }

    body.page-legal.legal-hub-layout .legal-hub-tabs {
        flex-wrap: nowrap;
        gap: 0.15rem;
        overflow-x: auto;
        padding-bottom: 0.35rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    body.page-legal.legal-hub-layout .legal-hub-tab {
        flex: 0 0 auto;
    }

    body.page-legal.legal-hub-layout .legal-document-surface {
        padding: 1rem 0.9rem;
    }

    body.page-legal.legal-hub-layout .legal-document-empty {
        flex-direction: column;
    }
}
