/* Lex & Legacy — helpers on top of Tailwind CDN design system */

html {
    scroll-behavior: smooth;
}

body {
    font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
}

.font-display-lg,
.font-headline-lg,
.font-headline-md,
.heading-serif {
    font-family: Amiri, "Noto Naskh Arabic", serif;
}

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    vertical-align: middle;
}

.material-symbols-outlined.fill {
    font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}

/* Mobile nav */
#mainNav.open {
    display: flex !important;
}

#navOverlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

body.nav-open {
    overflow: hidden;
}

/* Page loader */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loader .loader-scale {
    color: #775a19;
    font-size: 2rem;
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.92); }
    50% { opacity: 1; transform: scale(1); }
}

/* WhatsApp float */
.whatsapp-float {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 40;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 9999px;
    background: #25d366;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
    transition: transform 0.2s ease;
}

.whatsapp-float:hover {
    transform: scale(1.06);
    color: #fff;
}

html.is-ltr .whatsapp-float {
    left: auto;
    right: 1.5rem;
}

/* Back to top */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 40;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.125rem;
    background: #041627;
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    cursor: pointer;
}

.back-to-top.is-visible,
.back-to-top.show {
    opacity: 1;
    pointer-events: auto;
}

html.is-ltr .back-to-top {
    right: auto;
    left: 1.5rem;
}

/* Flash */
.page-alert {
    max-width: 1280px;
    margin: 1rem auto 0;
    padding: 0 20px;
}

@media (min-width: 768px) {
    .page-alert {
        padding: 0 64px;
    }
}

.alert-success {
    background: #edeeef;
    border: 1px solid #c4c6cd;
    color: #041627;
    padding: 0.875rem 1rem;
    border-radius: 0.125rem;
    font-size: 0.925rem;
}

.error-msg {
    display: block;
    color: #ba1a1a;
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

.reveal-up {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-up.is-visible,
.reveal-left.is-visible,
.reveal-right.is-visible {
    opacity: 1;
    transform: none;
}

.reveal-left,
.reveal-right {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.faq-item.is-open .faq-question .material-symbols-outlined {
    transform: rotate(45deg);
}

.faq-question .material-symbols-outlined {
    transition: transform 0.2s ease;
}

/* Footer accordion — mobile collapsed */
.footer-accordion__btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: transparent;
    border: none;
    padding: 0;
    cursor: default;
    text-align: inherit;
    color: inherit;
}

.footer-accordion__icon {
    display: none;
    transition: transform 0.25s ease;
}

.footer-accordion__panel {
    display: block;
    margin-top: 1rem;
}

@media (max-width: 767px) {
    .site-footer-brand {
        align-items: center;
        text-align: center;
    }

    .site-footer-brand .max-w-xs {
        max-width: none;
    }

    .site-footer-social {
        justify-content: center;
        margin-bottom: 0.5rem;
    }

    .footer-accordion {
        border-bottom: 1px solid rgba(129, 146, 167, 0.25);
        text-align: start;
    }

    .footer-accordion:last-of-type {
        border-bottom: none;
    }

    .footer-accordion__btn {
        cursor: pointer;
        padding: 1rem 0;
        justify-content: space-between;
        width: 100%;
    }

    .footer-accordion__icon {
        display: inline-block;
        flex-shrink: 0;
        opacity: 0.85;
    }

    .footer-accordion.is-open .footer-accordion__icon {
        transform: rotate(180deg);
    }

    .footer-accordion__panel {
        display: none;
        margin-top: 0;
        padding: 0 0 1rem;
        text-align: center;
    }

    .footer-accordion.is-open .footer-accordion__panel {
        display: block;
    }

    .footer-accordion__panel nav {
        align-items: center;
        gap: 0.65rem;
    }

    .footer-accordion__panel > div {
        align-items: center;
        gap: 0.5rem;
    }
}

/* Keep old consultation / news pages readable under new tokens */
.legacy-page .section-title,
.legacy-page h1,
.legacy-page h2 {
    font-family: Amiri, serif;
    color: #041627;
}
