html {
    scroll-padding-top: 70px;
    overflow-x: hidden;
}

@media (min-width: 769px) {
    html {
        scroll-behavior: smooth;
    }
}

@media (max-width: 1024px) {
    html {
        scroll-padding-top: 64px;
    }
}

:root {
    --primary-color: #3b82f6;
    --secondary-color: #2dd4bf;
    --accent-color: #2dd4bf;
    --accent-hover: #14b8a6;
    --text-color: #334155;
    --text-muted: #64748b;
    --light-bg: #ffffff;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --error-color: #ef4444;
    --darker-color: #0f172a;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--primary-color);
    margin-top: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    margin-top: 0.75rem;
    margin-bottom: -0.75rem;
    padding: 2rem;
    flex: 1 0 auto;
    box-sizing: border-box;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #000;
    color: #fff;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.1s;
}

.btn:hover {
    background: #111111;
    color: #fff;
    transform: translateY(-1px);
}

.btn-block {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--secondary-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--secondary-color);
}

.text-center {
    text-align: center;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.d-flex {
    display: flex;
}

.gap-1 {
    gap: 0.5rem;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.social-link {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 1rem;
    background: #f8fafc;
    text-decoration: none;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease,
        transform 0.25s ease, box-shadow 0.25s ease;
}

.social-link:hover {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    border-color: transparent;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.social-links {
    display: flex;
    gap: 0.75rem;
}

.category-tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border-color, #e2e8f0);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

a.category-tag:hover {
    background: var(--accent, #3b82f6);
    color: #fff;
    border-color: var(--accent, #3b82f6);
}

.alert-success {
    background: #d4edda;
    color: #155724;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.dr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    box-sizing: border-box;
}

.dr-modal {
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 16px;
    padding: 1.75rem;
    width: min(460px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
}

.dr-modal h4 {
    margin: 0 0 5px;
    font-size: 18px;
    font-weight: 800;
    color: #1e293b;
    -webkit-text-fill-color: #1e293b;
    background: none;
    border-bottom: none;
}

.dr-modal h4::after {
    display: none;
}

.dr-info {
    font-size: 13px;
    color: var(--text-muted, #64748b);
    margin-bottom: 18px;
    line-height: 1.6;
}

.dr-modal .form-group {
    margin-bottom: 12px;
}

.dr-modal label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 5px;
}

.dr-modal .form-control {
    width: 100%;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 10px 13px;
    font-size: 13.5px;
    color: #1e293b;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dr-modal .form-control:focus {
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.dr-modal textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

/* CV modal – download section */
.cv-modal-download {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.cv-modal-download .dr-info {
    margin: 0;
    font-weight: 600;
    color: #166534;
}

.cv-modal-download-btn {
    border-color: #16a34a !important;
    color: #16a34a !important;
    border-radius: 999px !important;
    padding: 8px 18px !important;
    font-size: 13.5px !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.cv-modal-download-btn:hover {
    background: rgba(22, 163, 74, 0.06) !important;
    border-color: #15803d !important;
    color: #15803d !important;
}

.cv-modal-divider {
    position: relative;
    text-align: center;
    margin: 0.25rem 0 1rem;
}

.cv-modal-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color, #e2e8f0);
}

.cv-modal-divider span {
    position: relative;
    background: #fff;
    padding: 0 0.75rem;
    font-size: 12px;
    color: var(--text-muted, #64748b);
    font-weight: 500;
}

[data-theme="dark"] .cv-modal-download {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.25);
}

[data-theme="dark"] .cv-modal-download .dr-info {
    color: #86efac;
}

[data-theme="dark"] .cv-modal-divider span {
    background: var(--card-bg);
}

/* CV modal – mobile sizing */
@media (max-width: 600px) {
    #cv-request-modal .dr-modal {
        padding: 1.25rem 1rem;
        max-height: 88vh;
        width: min(400px, 95vw);
    }

    #cv-request-modal .dr-modal h4 {
        font-size: 16px;
        margin-bottom: 3px;
    }

    #cv-request-modal .dr-info {
        font-size: 12px;
        margin-bottom: 12px;
    }

    #cv-request-modal .form-group {
        margin-bottom: 8px;
    }

    #cv-request-modal .dr-modal label {
        font-size: 12px;
        margin-bottom: 3px;
    }

    #cv-request-modal .dr-modal .form-control {
        padding: 8px 10px;
        font-size: 13px;
    }

    #cv-request-modal .dr-modal textarea.form-control {
        min-height: 60px;
    }

    #cv-request-modal .cv-modal-download {
        padding: 0.75rem 1rem;
        margin-bottom: 0.75rem;
        gap: 0.4rem;
    }

    #cv-request-modal .cv-modal-divider {
        margin: 0.15rem 0 0.75rem;
    }

    #cv-request-modal .cv-modal-divider span {
        font-size: 11px;
    }

    #cv-request-modal .dr-actions {
        margin-top: 10px;
        gap: 8px;
    }
}

.dr-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.dr-actions .btn {
    background: linear-gradient(135deg, var(--primary-color, #3b82f6), var(--accent-color, #2dd4bf));
    color: #fff;
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: filter 0.2s, transform 0.2s;
}

.dr-actions .btn:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
    color: #fff;
}

.dr-actions .btn-secondary {
    background: #f8fafc;
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border-color, #e2e8f0);
}

.dr-actions .btn-secondary:hover {
    background: var(--border-color, #e2e8f0);
    filter: none;
    transform: none;
    color: #1e293b;
}

[dir="rtl"] .dr-actions {
    flex-direction: row-reverse;
}

.is-hidden {
    display: none !important;
}

.modal-feedback {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.feedback-ok {
    color: var(--success-color);
}

.feedback-error {
    color: var(--error-color);
}

.feedback-info {
    color: var(--text-muted);
}

.question-modal-error {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.prose-content {
    max-width: 760px;
    margin: 0 auto;
    line-height: 1.8;
    color: var(--text-color);
}

.prose-content h2,
.prose-content h3,
.prose-content h4 {
    margin-top: 2rem;
}

.prose-content h4 {
    font-size: 1rem;
}

.prose-content p,
.prose-content ul,
.prose-content ol {
    margin-bottom: 1rem;
}

.prose-content p {
    text-align: justify;
}

.prose-content ul,
.prose-content ol {
    padding-left: 1.5rem;
}

.unsubscribe-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 4rem 1rem;
}

.unsubscribe-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 3rem 2.5rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.unsubscribe-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.unsubscribe-icon--done {
    color: #22a06b;
}

.unsubscribe-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.75rem;
}

.unsubscribe-text {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 1.75rem;
}

.unsubscribe-not-found {
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    color: #c0392b;
    border-radius: 6px;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    text-align: left;
    word-break: break-all;
}

.unsubscribe-email-input {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.unsubscribe-email-input:focus {
    border-color: var(--primary-color);
}

.unsubscribe-form {
    margin-bottom: 1rem;
}

.unsubscribe-confirm-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.unsubscribe-confirm-btn:hover {
    background: #a93226;
}

.unsubscribe-home-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #000;
    color: #fff;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.unsubscribe-home-btn:hover {
    background: #333;
}

.unsubscribe-cancel-link {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: underline;
    text-decoration-style: dotted;
}

.unsubscribe-cancel-link:hover {
    color: var(--text-color);
}

@media (max-width: 1024px) {
    .container {
        padding: 1.5rem;
    }
}

@media (max-width: 992px) {
    .hero-container .social-links {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }

    .unsubscribe-card {
        padding: 2rem 1.25rem;
    }
}

/* ── Dark mode ────────────────────────────────────────────────────────────── */
/* CSS-only fallback: applies when system prefers dark and JS hasn't set data-theme yet */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary-color: #60a5fa;
        --secondary-color: #2dd4bf;
        --accent-color: #2dd4bf;
        --accent-hover: #5eead4;
        --text-color: #e2e8f0;
        --text-muted: #94a3b8;
        --light-bg: #0f172a;
        --card-bg: #1e293b;
        --border-color: #334155;
        --success-color: #34d399;
        --error-color: #f87171;
        --darker-color: #f1f5f9;
    }
}

[data-theme="dark"] {
    --primary-color: #60a5fa;
    --secondary-color: #2dd4bf;
    --accent-color: #2dd4bf;
    --accent-hover: #5eead4;
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    --light-bg: #0f172a;
    --card-bg: #1e293b;
    --border-color: #334155;
    --success-color: #34d399;
    --error-color: #f87171;
    --darker-color: #f1f5f9;
}

[data-theme="dark"] .table {
    background: var(--card-bg);
}

[data-theme="dark"] .table th {
    background: #162032;
    color: var(--secondary-color);
}

[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .form-control {
    background: #162032;
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .btn-outline {
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .btn-outline:hover {
    background: var(--card-bg);
}

[data-theme="dark"] .dr-modal {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .dr-modal h4,
[data-theme="dark"] .dr-modal label {
    color: var(--text-color);
    -webkit-text-fill-color: var(--text-color);
}

[data-theme="dark"] .dr-modal .form-control {
    background: #0f172a;
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .dr-actions .btn-secondary {
    background: #334155;
    color: var(--text-muted);
    border-color: var(--border-color);
}

[data-theme="dark"] .dr-actions .btn-secondary:hover {
    background: #475569;
    color: var(--text-color);
}

[data-theme="dark"] .unsubscribe-card {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .unsubscribe-email-input {
    background: #0f172a;
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] .alert-success {
    background: #064e3b;
    color: #6ee7b7;
}

[data-theme="dark"] .alert-error {
    background: #7f1d1d;
    color: #fca5a5;
}

[dir="rtl"] body {
    font-family: 'Cairo', 'Noto Naskh Arabic', Arial, sans-serif;
}

[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6 {
    letter-spacing: 0;
}

[dir="rtl"] .prose-content ul,
[dir="rtl"] .prose-content ol {
    padding-left: 0;
    padding-right: 1.5rem;
}

/* ── Scroll-reveal animations ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        transform: translateY(32px);
        transition: opacity 0.7s ease, transform 0.7s ease;
    }

    .reveal.is-visible {
        opacity: 1;
        transform: translateY(0);
    }

    .reveal-delay-1 { transition-delay: 0.12s; }
    .reveal-delay-2 { transition-delay: 0.24s; }
    .reveal-delay-3 { transition-delay: 0.36s; }
    .reveal-delay-4 { transition-delay: 0.48s; }
}

/* ── Shared section headers (used on every homepage section) ───────────────── */
.sec-header {
    text-align: center !important;
    margin-bottom: 2.5rem !important;
    display: block !important;
}

.sec-eyebrow {
    display: block;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 1px !important;
    color: #06b6d4 !important;
    text-transform: uppercase !important;
    margin: 0 0 8px !important;
    font-family: inherit !important;
}

.sec-title {
    display: block;
    font-size: 38px !important;
    font-weight: 800 !important;
    color: var(--primary-color) !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    text-align: center !important;
}

.sec-title::after {
    content: "" !important;
    display: block !important;
    width: 50px !important;
    height: 3px !important;
    background: linear-gradient(135deg, #06b6d4, #3b82f6) !important;
    border-radius: 2px !important;
    margin: 8px auto 0 !important;
}

/* Arabic text has taller descenders — give the underline more breathing room */
[dir="rtl"] .sec-title::after {
    margin-top: 16px !important;
}

@media (max-width: 576px) {
    .sec-title { font-size: 28px !important; }
}

@media (max-width: 480px) {
    .sec-title { font-size: 24px !important; }
}

[data-theme="dark"] .sec-title {
    color: #e2e8f0 !important;
}

/* ── Section dividers ──────────────────────────────────────────────────────── */
.section-divider {
    width: 50px;
    height: 3px;
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    border-radius: 2px;
    margin: 8px auto 0;
}

@media (min-width: 1440px) {
    html {
        font-size: 18px;
    }

    .container {
        max-width: 1380px;
    }
}

@media (min-width: 1920px) {
    html {
        font-size: 20px;
    }

    .container {
        max-width: 1700px;
    }
}

/* ── Mobile: disable all transitions, animations & the loader ───────────────── */
@media (max-width: 768px) {
    /* Kill every transition and animation — animation: none is the correct      */
    /* override; animation-duration alone leaves backwards fill-mode active      */
    /* (cards with animation-delay still hold opacity:0 during the delay).       */
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
    /* Ensure elements that start hidden (opacity:0) are immediately visible     */
    /* so the user never sees blank sections while JS loads.                     */
    .reveal,
    .timeline-content,
    .search-container p {
        opacity: 1 !important;
        transform: none !important;
    }
    /* Allow the loader to display on mobile — JS handles its dismiss timing.    */
    .loader-wrapper {
        transition: none !important;
    }
    /* The loader ring, dots, and progress bar need their animations to work.    */
    .loader-ring {
        animation: loaderSpin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite !important;
    }
    .loader-dots span {
        animation: loaderDotFade 1.4s ease-in-out infinite !important;
    }
    .loader-dots span:nth-child(2) { animation-delay: 0.2s !important; }
    .loader-dots span:nth-child(3) { animation-delay: 0.4s !important; }
    .loader-bar-fill {
        transition: width 0.3s ease !important;
    }
}

@media (min-width: 2560px) {
    html {
        font-size: 22px;
    }

    .container {
        max-width: 2200px;
    }
}