/* Medace Legal Pages - Modern light-only redesign */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;0,800&family=Noto+Sans+Arabic:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f5f7fb;
    --bg-soft: #eef2f8;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --surface-muted: #f8fafc;
    --border: #dbe2ee;
    --border-strong: #c8d3e3;
    --text: #101828;
    --text-muted: #4b5565;
    --text-soft: #6b7280;
    --heading: #0f172a;
    --primary: #0f172a;
    --primary-soft: #334155;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.12);
    --success: #0f766e;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 24px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 70px rgba(15, 23, 42, 0.12);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 28px;
    --radius-full: 9999px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-ar: 'Noto Sans Arabic', 'Segoe UI', sans-serif;
    --container: 1120px;
    --content: 820px;
    --toc: 360px;
    --gap-1: 4px;
    --gap-2: 8px;
    --gap-3: 12px;
    --gap-4: 16px;
    --gap-5: 20px;
    --gap-6: 24px;
    --gap-8: 32px;
    --gap-10: 40px;
    --gap-12: 48px;
    --gap-16: 64px;
    --transition: 180ms ease;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.65;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28%),
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.08), transparent 26%),
        linear-gradient(180deg, #ffffff 0%, var(--bg) 36%, var(--bg-soft) 100%);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.16), transparent 45%);
    opacity: 0.45;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition), background-color var(--transition), border-color var(--transition), transform var(--transition);
}

a:hover {
    color: #1d4ed8;
}

strong {
    color: var(--heading);
    font-weight: 700;
}

em {
    font-style: italic;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.95em;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.12em 0.35em;
}

::selection {
    background: rgba(37, 99, 235, 0.16);
}

.container {
    width: min(var(--container), calc(100% - 24px));
    margin: 24px auto 40px;
    display: grid;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.container > * {
    grid-column: 1 / -1;
}

.page-header,
.table-of-contents,
.legal-content,
.content-footer,
.language-selector,
.about-section,
.doc-card,
.hero-panel,
.hero-side,
.doc-feature,
.summary-card {
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-sm);
}

.page-header {
    border-radius: var(--radius-xl);
    padding: clamp(24px, 4vw, 40px);
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    inset: -20% auto auto -6%;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.09), transparent 68%);
    pointer-events: none;
}

.page-header::after {
    content: '';
    position: absolute;
    right: -2%;
    bottom: -20%;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.08), transparent 68%);
    pointer-events: none;
}

.logo-section {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    max-width: 640px;
}

.header-logo {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(219, 226, 238, 0.9);
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
    object-fit: contain;
}

.page-title {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3.2rem);
    line-height: 1.05;
    letter-spacing: -0.05em;
    color: var(--heading);
    font-weight: 800;
}

.last-updated {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 0;
    width: fit-content;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(219, 226, 238, 0.9);
    color: var(--text-muted);
    font-size: 0.92rem;
}

.table-of-contents {
    border-radius: var(--radius-xl);
    padding: 22px;
    z-index: 4;
}

.toc-title {
    margin: 0 0 14px;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-soft);
    font-weight: 700;
}

.toc-list,
.doc-links,
.footer-links,
.lang-btn-group {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.toc-list li,
.doc-links li,
.footer-links li {
    margin: 0;
}

.toc-list a {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.88);
    border: 1px solid transparent;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

.toc-list a:hover {
    background: #ffffff;
    border-color: var(--border);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.toc-number {
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
}

.legal-content {
    border-radius: var(--radius-xl);
    padding: clamp(20px, 3vw, 34px);
    display: grid;
    gap: 16px;
}

.content-section {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: clamp(20px, 3vw, 30px);
    scroll-margin-top: 28px;
}

.section-title {
    margin: 0 0 16px;
    color: var(--heading);
    font-size: clamp(1.1rem, 1.6vw, 1.4rem);
    line-height: 1.25;
    letter-spacing: -0.03em;
    font-weight: 800;
}

.subsection-title {
    margin: 22px 0 10px;
    color: var(--heading);
    font-size: 1rem;
    line-height: 1.35;
    font-weight: 700;
}

.body-text {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.8;
}

.body-text:last-child {
    margin-bottom: 0;
}

.list-item {
    margin: 12px 0 16px;
    padding-inline-start: 1.35rem;
    color: var(--text-muted);
}

.list-item li {
    margin: 0 0 10px;
    line-height: 1.75;
}

.list-item li:last-child {
    margin-bottom: 0;
}

.content-footer {
    border-radius: var(--radius-xl);
    padding: 22px 24px;
    text-align: center;
}

.footer-divider {
    display: none;
}

.footer-text {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.95rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.footer-links a,
.lang-btn,
.doc-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    color: var(--heading);
    font-weight: 600;
    font-size: 0.93rem;
}

.footer-links a:hover,
.lang-btn:hover,
.doc-link:hover {
    border-color: var(--border-strong);
    background: #ffffff;
    color: var(--accent);
    transform: translateY(-1px);
    text-decoration: none;
}

.separator {
    display: none;
}

.language-selector {
    border-radius: var(--radius-xl);
    padding: 24px;
    text-align: center;
}

.lang-label {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.lang-btn-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.doc-card {
    border-radius: var(--radius-lg);
    padding: 22px;
    display: grid;
    gap: 14px;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.doc-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.doc-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 1.2rem;
}

.doc-card-title {
    margin: 0;
    color: var(--heading);
    font-size: 1.1rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
    font-weight: 800;
}

.doc-card-desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.96rem;
    line-height: 1.7;
}

.doc-card-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 6px;
}

.about-section {
    border-radius: var(--radius-xl);
    padding: 24px;
    color: var(--text-muted);
}

.hero-panel,
.hero-side,
.summary-card,
.doc-feature {
    border-radius: var(--radius-xl);
    padding: 24px;
}

.site-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
    gap: 16px;
}

.hero-panel {
    padding: 32px;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9)),
        linear-gradient(135deg, rgba(37, 99, 235, 0.06), transparent 45%);
}

.hero-panel::before {
    content: '';
    position: absolute;
    inset: auto -12% -24% auto;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.12), transparent 66%);
    pointer-events: none;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
}

.hero-title {
    margin: 16px 0 12px;
    font-size: clamp(2.2rem, 4vw, 4.2rem);
    line-height: 0.98;
    letter-spacing: -0.06em;
    color: var(--heading);
    font-weight: 800;
    position: relative;
    z-index: 1;
}

.hero-copy {
    margin: 0;
    max-width: 60ch;
    color: var(--text-muted);
    font-size: 1.03rem;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
    position: relative;
    z-index: 1;
}

.hero-side {
    display: grid;
    gap: 16px;
    align-content: start;
    background: rgba(255, 255, 255, 0.96);
}

.summary-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
}

.summary-card h2,
.hero-side h2,
.doc-feature h2 {
    margin: 0 0 10px;
    font-size: 0.84rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.summary-card p,
.hero-side p,
.doc-feature p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.7;
}

.hero-points {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.hero-point {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.hero-point:first-child {
    border-top: 0;
    padding-top: 0;
}

.hero-point-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    flex-shrink: 0;
}

.hero-point strong {
    display: block;
    margin-bottom: 2px;
}

.hero-point span {
    color: var(--text-muted);
    line-height: 1.65;
}

.section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    color: var(--text-soft);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.doc-feature {
    display: grid;
    gap: 12px;
}

.doc-feature-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.doc-feature-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}

.doc-feature-list li::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    flex-shrink: 0;
}

.site-grid {
    display: grid;
    gap: 16px;
}

.site-grid.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.site-grid.three-up {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.screen-reader-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.content-section:target {
    outline: 2px solid rgba(37, 99, 235, 0.24);
}

html[dir='rtl'] body {
    direction: rtl;
    font-family: var(--font-ar);
}

html[dir='rtl'] .logo-section,
html[dir='rtl'] .page-header,
html[dir='rtl'] .table-of-contents,
html[dir='rtl'] .legal-content,
html[dir='rtl'] .content-footer,
html[dir='rtl'] .language-selector,
html[dir='rtl'] .about-section,
html[dir='rtl'] .doc-card,
html[dir='rtl'] .hero-panel,
html[dir='rtl'] .hero-side,
html[dir='rtl'] .summary-card,
html[dir='rtl'] .doc-feature {
    text-align: right;
}

html[dir='rtl'] .toc-list a,
html[dir='rtl'] .toc-number,
html[dir='rtl'] .doc-card-icon,
html[dir='rtl'] .hero-point-icon {
    direction: ltr;
}

html[dir='rtl'] .list-item {
    padding-inline-start: 0;
    padding-inline-end: 1.35rem;
}

html[dir='rtl'] .hero-actions,
html[dir='rtl'] .footer-links,
html[dir='rtl'] .lang-btn-group,
html[dir='rtl'] .doc-card-links {
    justify-content: flex-end;
}

@media (min-width: 1100px) {
    .container {
        width: min(var(--container), calc(100% - 48px));
        grid-template-columns: minmax(0, 1fr) minmax(300px, var(--toc));
        align-items: start;
    }

    .page-header,
    .site-hero,
    .language-selector,
    .about-section,
    .content-footer {
        grid-column: 1 / -1;
    }

    .table-of-contents {
        grid-column: 2;
        grid-row: 2 / span 999;
        position: sticky;
        top: 16px;
    }

    .legal-content {
        grid-column: 1;
    }
}

@media (max-width: 1099px) {
    .site-hero {
        grid-template-columns: 1fr;
    }

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

    .table-of-contents {
        position: static;
    }
}

@media (max-width: 780px) {
    .container {
        width: min(100% - 16px, var(--container));
        margin: 16px auto 24px;
        gap: 12px;
    }

    .page-header,
    .table-of-contents,
    .legal-content,
    .content-footer,
    .language-selector,
    .about-section,
    .doc-card,
    .hero-panel,
    .hero-side,
    .summary-card,
    .doc-feature {
        border-radius: 20px;
    }

    .header-logo {
        width: 68px;
        height: 68px;
    }

    .page-title {
        font-size: 1.9rem;
    }

    .legal-content,
    .table-of-contents,
    .page-header,
    .content-footer,
    .hero-panel,
    .hero-side,
    .summary-card,
    .doc-feature {
        padding: 18px;
    }

    .content-section {
        padding: 18px;
    }

    .toc-list,
    .documents-grid,
    .site-grid.two-up,
    .site-grid.three-up {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .hero-copy,
    .body-text,
    .doc-card-desc {
        font-size: 0.98rem;
    }

    .footer-links,
    .hero-actions,
    .lang-btn-group,
    .doc-card-links {
        justify-content: flex-start;
    }
}

@media print {
    @page {
        margin: 14mm;
    }

    body {
        background: #ffffff !important;
        color: #000000;
    }

    body::before {
        display: none;
    }

    .container {
        width: 100%;
        margin: 0;
        gap: 14px;
    }

    .page-header,
    .table-of-contents,
    .legal-content,
    .content-footer,
    .language-selector,
    .about-section,
    .doc-card,
    .hero-panel,
    .hero-side,
    .summary-card,
    .doc-feature,
    .content-section {
        box-shadow: none !important;
        background: #ffffff !important;
        border-color: #d1d5db !important;
    }

    .table-of-contents {
        position: static !important;
        page-break-after: always;
    }

    a,
    a:visited {
        color: #000000 !important;
        text-decoration: underline;
    }

    .hero-actions,
    .footer-links,
    .lang-btn-group,
    .doc-card-links {
        display: none !important;
    }

    .content-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
