/*
Theme Name: AL OBOUR PROJECTS RTL
Description: Front-end RTL corrections for the Arabic-first AL OBOUR PROJECTS experience.
*/

/* =========================================================
   Global direction
   ========================================================= */
html[dir="rtl"],
html[dir="rtl"] body {
    direction: rtl;
}

html[dir="rtl"] body {
    text-align: right;
}

html[dir="rtl"] .aop-main,
html[dir="rtl"] .aop-site-header,
html[dir="rtl"] .aop-site-footer,
html[dir="rtl"] .aop-section,
html[dir="rtl"] .aop-archive-hero,
html[dir="rtl"] .aop-guide-hero,
html[dir="rtl"] .aop-search-hero,
html[dir="rtl"] .aop-contact-hero,
html[dir="rtl"] .aop-entity-hero,
html[dir="rtl"] .aop-article-hero {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] p,
html[dir="rtl"] li,
html[dir="rtl"] label,
html[dir="rtl"] summary {
    text-align: right;
}

html[dir="rtl"] .aop-kicker,
html[dir="rtl"] .aop-meta-line,
html[dir="rtl"] .aop-article-meta,
html[dir="rtl"] .aop-breadcrumbs {
    direction: rtl;
}

/* Keep mixed LTR data readable inside Arabic UI. */
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="url"] {
    direction: ltr;
    text-align: left;
}

html[dir="rtl"] .aop-topbar__contacts a[href^="mailto:"],
html[dir="rtl"] .aop-topbar__contacts a[href^="tel:"],
html[dir="rtl"] .aop-contact-list a[href^="tel:"],
html[dir="rtl"] .aop-contact-info__item a[href^="tel:"],
html[dir="rtl"] .aop-contact-info__item a[href^="mailto:"] {
    direction: ltr;
    unicode-bidi: isolate;
}

html[dir="rtl"] .aop-project-summary__price strong,
html[dir="rtl"] .aop-project-card__price,
html[dir="rtl"] .aop-fact strong {
    unicode-bidi: plaintext;
}

/* =========================================================
   Header / navigation
   ========================================================= */
html[dir="rtl"] .aop-topbar__inner,
html[dir="rtl"] .aop-header-main,
html[dir="rtl"] .aop-brand,
html[dir="rtl"] .aop-header-actions,
html[dir="rtl"] .aop-nav ul {
    direction: rtl;
}

html[dir="rtl"] .aop-brand-wrap {
    justify-self: start;
}

html[dir="rtl"] .aop-header-actions {
    justify-self: end;
}

html[dir="rtl"] .aop-nav ul {
    padding-right: 0;
    padding-left: 0;
}

html[dir="rtl"] .aop-nav a,
html[dir="rtl"] .aop-menu a {
    text-align: right;
}

html[dir="rtl"] .aop-custom-logo,
html[dir="rtl"] .aop-custom-logo .custom-logo-link {
    justify-content: flex-start;
}

/* =========================================================
   Hero + homepage search
   ========================================================= */
html[dir="rtl"] .aop-home-hero__overlay {
    background: linear-gradient(
        270deg,
        rgba(11,31,51,.94) 0%,
        rgba(11,31,51,.78) 48%,
        rgba(11,31,51,.28) 100%
    );
}

html[dir="rtl"] .aop-home-hero__content,
html[dir="rtl"] .aop-home-hero__copy,
html[dir="rtl"] .aop-hero-feature,
html[dir="rtl"] .aop-project-actions {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .aop-project-actions {
    justify-content: flex-start;
}

html[dir="rtl"] .aop-home-search-card,
html[dir="rtl"] .aop-home-search-title,
html[dir="rtl"] .aop-search {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .aop-search label > span,
html[dir="rtl"] .aop-field label,
html[dir="rtl"] .aop-field > span {
    text-align: right;
}

html[dir="rtl"] .aop-search input[type="search"],
html[dir="rtl"] .aop-search select,
html[dir="rtl"] .aop-field select,
html[dir="rtl"] .aop-field textarea,
html[dir="rtl"] .aop-field input[type="text"],
html[dir="rtl"] .aop-field input[type="search"] {
    direction: rtl;
    text-align: right;
}

/* =========================================================
   Section headers / grids / cards
   ========================================================= */
html[dir="rtl"] .aop-section-head,
html[dir="rtl"] .aop-grid,
html[dir="rtl"] .aop-area-showcase,
html[dir="rtl"] .aop-area-tile__content,
html[dir="rtl"] .aop-home-why__grid,
html[dir="rtl"] .aop-why-list,
html[dir="rtl"] .aop-opportunity__grid,
html[dir="rtl"] .aop-opportunity__facts,
html[dir="rtl"] .aop-contact-grid,
html[dir="rtl"] .aop-final-cta__inner,
html[dir="rtl"] .aop-guide-featured,
html[dir="rtl"] .aop-guide-cta__inner,
html[dir="rtl"] .aop-contact-layout,
html[dir="rtl"] .aop-contact-whatsapp__inner {
    direction: rtl;
}

html[dir="rtl"] .aop-section-head > div,
html[dir="rtl"] .aop-project-card__body,
html[dir="rtl"] .aop-article-card__body,
html[dir="rtl"] .aop-term-card__body,
html[dir="rtl"] .aop-guide-featured__content,
html[dir="rtl"] .aop-contact-card,
html[dir="rtl"] .aop-lead-form-wrap {
    text-align: right;
}

html[dir="rtl"] .aop-card-actions,
html[dir="rtl"] .aop-topic-chips,
html[dir="rtl"] .aop-social {
    direction: rtl;
    justify-content: flex-start;
}

/* =========================================================
   Project detail
   ========================================================= */
html[dir="rtl"] .aop-project-gallery-top,
html[dir="rtl"] .aop-project-summary,
html[dir="rtl"] .aop-content-layout,
html[dir="rtl"] .aop-facts,
html[dir="rtl"] .aop-facts--project,
html[dir="rtl"] .aop-project-actions,
html[dir="rtl"] .aop-results-heading,
html[dir="rtl"] .aop-entity-hero__grid,
html[dir="rtl"] .aop-entity-title-row {
    direction: rtl;
}

html[dir="rtl"] .aop-project-summary,
html[dir="rtl"] .aop-content,
html[dir="rtl"] .aop-sidebar-card,
html[dir="rtl"] .aop-fact,
html[dir="rtl"] .aop-project-price-notes,
html[dir="rtl"] .aop-entity-description {
    text-align: right;
}

html[dir="rtl"] .aop-project-summary__price {
    border-inline-start: 1px solid var(--aop-border);
    padding-inline-start: 30px;
    padding-inline-end: 0;
}

/* =========================================================
   Breadcrumbs / pagination / utility UI
   ========================================================= */
html[dir="rtl"] .aop-breadcrumbs,
html[dir="rtl"] .aop-pagination,
html[dir="rtl"] .aop-meta-line,
html[dir="rtl"] .aop-article-meta {
    direction: rtl;
}

html[dir="rtl"] .aop-pagination {
    flex-direction: row;
}

/* =========================================================
   Footer
   ========================================================= */
html[dir="rtl"] .aop-footer-main,
html[dir="rtl"] .aop-footer-bottom__inner,
html[dir="rtl"] .aop-footer-brand,
html[dir="rtl"] .aop-footer-main ul {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .aop-footer-main ul {
    padding-right: 0;
    padding-left: 0;
}

/* =========================================================
   Mobile
   ========================================================= */
@media (max-width: 768px) {
    html[dir="rtl"] .aop-header-main {
        direction: rtl;
    }

    html[dir="rtl"] .aop-nav,
    html[dir="rtl"] .aop-nav ul,
    html[dir="rtl"] .aop-nav li,
    html[dir="rtl"] .aop-nav a {
        direction: rtl;
        text-align: right;
    }

    html[dir="rtl"] .aop-nav a {
        padding-inline-start: 4px;
        padding-inline-end: 4px;
    }

    html[dir="rtl"] .aop-home-search-title,
    html[dir="rtl"] .aop-section-head,
    html[dir="rtl"] .aop-final-cta__inner,
    html[dir="rtl"] .aop-guide-cta__inner,
    html[dir="rtl"] .aop-contact-whatsapp__inner {
        text-align: right;
    }

    html[dir="rtl"] .aop-sticky-mobile-cta {
        direction: rtl;
    }
}


/* =========================================================
   RTL hardening pass 2.0.3
   ========================================================= */

/* Use logical positioning and prevent accidental horizontal overflow. */
html[dir="rtl"] body {
    overflow-x: clip;
}
html[dir="rtl"] .container,
html[dir="rtl"] .aop-main {
    min-width: 0;
}

/* Header: brand stays on the visual right, actions on the left. */
@media (min-width: 769px) {
    html[dir="rtl"] .aop-header-main {
        grid-template-columns: auto minmax(0, 1fr) auto;
        direction: rtl;
    }
    html[dir="rtl"] .aop-brand-wrap {
        grid-column: 1;
        justify-self: start;
    }
    html[dir="rtl"] .aop-nav {
        grid-column: 2;
        justify-self: center;
    }
    html[dir="rtl"] .aop-header-actions {
        grid-column: 3;
        justify-self: end;
    }
    html[dir="rtl"] .aop-nav ul {
        flex-direction: row;
    }
}

/* Hero: Arabic copy occupies the visual right and selected project the left. */
@media (min-width: 901px) {
    html[dir="rtl"] .aop-home-hero__content {
        grid-template-columns: minmax(0, 1fr) 360px;
        direction: rtl;
    }
    html[dir="rtl"] .aop-home-hero__copy {
        grid-column: 1;
        justify-self: stretch;
    }
    html[dir="rtl"] .aop-hero-feature {
        grid-column: 2;
        justify-self: stretch;
    }
}

/* Search dock: title on the right, controls flow right-to-left. */
@media (min-width: 1101px) {
    html[dir="rtl"] .aop-home-search-card {
        grid-template-columns: 210px minmax(0, 1fr);
        direction: rtl;
    }
    html[dir="rtl"] .aop-home-search-title {
        grid-column: 1;
    }
    html[dir="rtl"] .aop-home-search-card .aop-search {
        grid-column: 2;
    }
}
html[dir="rtl"] .aop-search {
    direction: rtl;
}
html[dir="rtl"] .aop-search > label,
html[dir="rtl"] .aop-search > button {
    min-width: 0;
}
html[dir="rtl"] .aop-search select {
    background-position: left 12px center;
    padding-inline: 14px 34px;
}
html[dir="rtl"] .aop-search input[type="search"] {
    padding-inline: 14px;
}

/* Cards and factual values. */
html[dir="rtl"] .aop-card-eyebrow,
html[dir="rtl"] .aop-spec-grid,
html[dir="rtl"] .aop-card-actions {
    direction: rtl;
}
html[dir="rtl"] .aop-card-eyebrow {
    justify-content: flex-start;
}
html[dir="rtl"] .aop-spec-grid > div,
html[dir="rtl"] .aop-project-card__title,
html[dir="rtl"] .aop-project-card__body {
    text-align: right;
}
html[dir="rtl"] .aop-spec-grid strong,
html[dir="rtl"] .aop-project-card__price,
html[dir="rtl"] .aop-fact strong,
html[dir="rtl"] .aop-hero-feature b {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: right;
}
html[dir="rtl"] .aop-card-eyebrow a,
html[dir="rtl"] .aop-card-eyebrow span,
html[dir="rtl"] .aop-area-tile__content strong,
html[dir="rtl"] .aop-area-tile__content span {
    unicode-bidi: isolate;
}

/* Area tiles: name starts from the right, count/meta stays opposite. */
html[dir="rtl"] .aop-area-tile__content {
    flex-direction: row;
    direction: rtl;
}
html[dir="rtl"] .aop-area-tile__content > :first-child {
    margin-inline-end: 0;
}

/* Why section keeps heading at the visual right and numbered facts after it. */
@media (min-width: 901px) {
    html[dir="rtl"] .aop-home-why__grid {
        grid-template-columns: .82fr 1.18fr;
        direction: rtl;
    }
}
html[dir="rtl"] .aop-why-list > div {
    direction: rtl;
    text-align: right;
}
html[dir="rtl"] .aop-why-list b {
    unicode-bidi: isolate;
}

/* Forms: Arabic text RTL; technical values remain LTR and readable. */
html[dir="rtl"] .aop-form {
    direction: rtl;
}
html[dir="rtl"] .aop-field input[type="email"],
html[dir="rtl"] .aop-field input[type="tel"],
html[dir="rtl"] .aop-field input[type="url"] {
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}
html[dir="rtl"] .aop-field input[type="email"]::placeholder,
html[dir="rtl"] .aop-field input[type="tel"]::placeholder,
html[dir="rtl"] .aop-field input[type="url"]::placeholder {
    direction: rtl;
    text-align: right;
}

/* Contact values / domains / social labels should not reorder punctuation. */
html[dir="rtl"] a[href^="tel:"],
html[dir="rtl"] a[href^="mailto:"],
html[dir="rtl"] .aop-footer-bottom__inner span:last-child {
    unicode-bidi: isolate;
}

/* Footer grid reads right-to-left in the same order as the PHP markup. */
@media (min-width: 901px) {
    html[dir="rtl"] .aop-footer-main {
        direction: rtl;
        grid-template-columns: 1.3fr repeat(3, 1fr);
    }
    html[dir="rtl"] .aop-footer-main > * {
        text-align: right;
        min-width: 0;
    }
}
html[dir="rtl"] .aop-footer-bottom__inner {
    direction: rtl;
}

/* Breadcrumb and pagination flow. */
html[dir="rtl"] .aop-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
}
html[dir="rtl"] .aop-pagination {
    justify-content: flex-start;
}

/* Mobile navigation / sticky CTA. */
@media (max-width: 768px) {
    html[dir="rtl"] .aop-header-main {
        grid-template-columns: minmax(0, 1fr) auto auto;
        direction: rtl;
    }
    html[dir="rtl"] .aop-brand-wrap {
        justify-self: start;
    }
    html[dir="rtl"] .aop-header-actions {
        justify-self: end;
    }
    html[dir="rtl"] .aop-nav {
        inset-inline: 0;
    }
    html[dir="rtl"] .aop-nav ul {
        direction: rtl;
    }
    html[dir="rtl"] .aop-nav a {
        text-align: right;
        padding-inline: 4px 12px;
    }
    html[dir="rtl"] .aop-sticky-mobile-cta {
        direction: rtl;
        grid-auto-flow: column;
    }
}

/* Avoid duplicate home/footer fragments if a plugin or legacy template invokes them twice. */
body.home .aop-final-cta ~ .aop-final-cta,
.aop-site-footer ~ .aop-site-footer {
    display: none !important;
}


/* =========================================================
   RTL alignment for visual refinement 2.1.0
   ========================================================= */
@media (min-width: 901px) {
    html[dir="rtl"] .aop-home-hero__content {
        grid-template-columns: minmax(0, 1fr) 390px;
    }
}
@media (min-width: 1101px) {
    html[dir="rtl"] .aop-home-search-card {
        grid-template-columns: 240px minmax(0, 1fr);
    }
}
html[dir="rtl"] .aop-project-summary__price {
    border: 1px solid var(--aop-border);
    padding: 28px;
}
html[dir="rtl"] .aop-area-tile__content strong,
html[dir="rtl"] .aop-card-eyebrow span {
    unicode-bidi: plaintext;
}
@media (min-width: 901px) {
    html[dir="rtl"] .aop-footer-main {
        grid-template-columns: 1.35fr repeat(3, 1fr);
    }
}
@media (max-width: 1180px) and (min-width: 769px) {
    html[dir="rtl"] .aop-home-hero__content {
        grid-template-columns: minmax(0, 1fr) 330px;
    }
    html[dir="rtl"] .aop-home-search-card {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    html[dir="rtl"] .aop-project-summary__price {
        padding: 22px;
    }
}
