/* =====================================================================
   Noor-e-Ilm Institute — Legal document pages (Terms, Privacy Policy)
   Shared stylesheet: compact header, TOC, white legal card, responsive.
   Palette: Navy #0B1F4D | Teal #06B6B4 | Gold #F5B400 | Desc #64748B
   ===================================================================== */

.legal-page {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    background: #f4f6f9;
    color: #334155;
    overflow-x: hidden;
}

.legal-page h1,
.legal-page h2,
.legal-page h3,
.legal-page h4 {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
}

/* ---------------------------------------------------------------
   Compact page header (no hero, no banner image)
--------------------------------------------------------------- */
.legal-header {
    background: #ffffff;
    border-top: 4px solid #06b6b4;
    border-bottom: 1px solid #e2e8f0;
    padding: 46px 0 40px;
}

.legal-header .legal-header-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

.legal-header h1 {
    margin: 0 0 10px;
    font-size: 2.35rem;
    font-weight: 700;
    line-height: 1.25;
    color: #0b1f4d;
    letter-spacing: -0.5px;
}

.legal-header .legal-lead {
    margin: 0 0 18px;
    max-width: 760px;
    font-size: 1.04rem;
    line-height: 1.65;
    color: #64748b;
}

.legal-header .legal-updated {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    border: 1px solid rgba(6, 182, 180, 0.25);
    border-radius: 999px;
    background: #e6f7f7;
    color: #0e8f8d;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ---------------------------------------------------------------
   Layout container
--------------------------------------------------------------- */
.legal-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 44px 24px 64px;
}

/* Default: TOC is a top box above content */
.legal-layout--top > .legal-toc {
    margin-bottom: 28px;
}

/* Desktop: sticky sidebar TOC + content (used by Terms page) */
.legal-layout--sidebar > .legal-toc { position: static; }

@media (min-width: 992px) {
    .legal-layout--sidebar {
        display: grid;
        grid-template-columns: 280px minmax(0, 1fr);
        gap: 34px;
        align-items: start;
    }

    .legal-layout--sidebar > .legal-toc {
        position: sticky;
        top: 20px;
        align-self: start;
    }
}

/* ---------------------------------------------------------------
   TOC ("On this page")
--------------------------------------------------------------- */
.legal-toc {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    padding: 20px 18px;
}

.legal-toc-title {
    margin: 0 0 12px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: #0b1f4d;
}

.legal-toc ol,
.legal-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.legal-toc li {
    margin-bottom: 4px;
}

.legal-toc li:last-child {
    margin-bottom: 0;
}

.legal-toc a {
    display: flex;
    align-items: baseline;
    gap: 9px;
    padding: 6px 10px;
    border-radius: 8px;
    color: #475569;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
}

.legal-toc a .legal-toc-num {
    min-width: 18px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #06b6b4;
}

.legal-toc a:hover,
.legal-toc a:focus-visible {
    background: #e6f7f7;
    color: #0e8f8d;
}

/* ---------------------------------------------------------------
   Legal document card
--------------------------------------------------------------- */
.legal-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(2, 8, 23, 0.05);
    padding: 44px 48px;
}

.legal-card a {
    color: #0e8f8d;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-card a:hover {
    color: #0b1f4d;
}

.legal-card a:focus-visible {
    outline: 3px solid rgba(6, 182, 180, 0.55);
    outline-offset: 2px;
    border-radius: 4px;
}

.legal-section {
    scroll-margin-top: 24px;
}

.legal-card h2 {
    margin: 44px 0 16px;
    padding-left: 16px;
    position: relative;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.35;
    color: #0b1f4d;
    letter-spacing: -0.3px;
}

.legal-card h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.24em;
    width: 4px;
    height: 1.02em;
    border-radius: 4px;
    background: #06b6b4;
}

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

.legal-card h3 {
    margin: 28px 0 10px;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    color: #0b1f4d;
}

.legal-card h4 {
    margin: 22px 0 8px;
    font-size: 0.98rem;
    font-weight: 600;
    color: #0b1f4d;
}

.legal-card p,
.legal-card li {
    font-size: 1rem;
    line-height: 1.78;
    color: #334155;
    overflow-wrap: anywhere;
}

.legal-card p {
    margin-bottom: 16px;
    overflow-wrap: break-word;
}

.legal-card a {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.legal-card ul,
.legal-card ol {
    margin: 0 0 18px;
    padding-left: 24px;
}

.legal-card li {
    margin-bottom: 8px;
}

.legal-card strong {
    color: #0b1f4d;
    font-weight: 600;
}

.legal-card .legal-quote {
    margin: 4px 0 20px;
    padding: 16px 20px;
    border-left: 4px solid #06b6b4;
    border-radius: 0 10px 10px 0;
    background: #f8fafc;
    font-style: normal;
}

.legal-card .legal-quote p {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------
   Accessibility: visible global focus
--------------------------------------------------------------- */
.legal-page a:focus-visible {
    outline: 3px solid rgba(6, 182, 180, 0.55);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------------------------------------------------------------
   Responsive
--------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .legal-layout {
        display: block;
    }

    .legal-layout--sidebar > .legal-toc {
        position: static;
        margin-bottom: 30px;
    }

    .legal-card {
        padding: 34px 28px;
    }
}

@media (max-width: 767.98px) {
    .legal-header {
        padding: 34px 0 28px;
    }

    .legal-header h1 {
        font-size: 1.85rem;
    }

    .legal-container {
        padding: 30px 18px 48px;
    }

    .legal-card {
        padding: 26px 20px;
        border-radius: 14px;
    }

    .legal-card h2 {
        font-size: 1.22rem;
        margin-top: 36px;
    }

    .legal-card p,
    .legal-card li {
        font-size: 0.97rem;
        line-height: 1.72;
    }
}

@media (max-width: 479.98px) {
    .legal-header h1 {
        font-size: 1.6rem;
    }

    .legal-header .legal-lead {
        font-size: 0.97rem;
    }

    .legal-toc {
        padding: 16px 12px;
    }

    .legal-card {
        padding: 22px 16px;
    }
}