.hero-section-public {
    min-height: 60vh;
    display: flex;
    align-items: center;
}

.min-vh-50 {
    min-height: 38vh;
}

/* Button hover transitions */
.hero-section-public .btn {
    transition: all 0.3s ease;
}

.hero-section-public .btn:hover {
    transform: translateY(-2px);
}

/* Reserve stable text/action space to reduce hero CLS */
.public-hero-islamic .public-hero-content {
    min-height: clamp(160px, 21vw, 205px);
}

.public-hero-islamic .public-hero-actions {
    min-height: 2.6rem;
    margin-top: .15rem;
}

.public-hero-islamic .public-hero-ayah {
    min-height: 2.2rem;
}

/* Hover effects (scoped) */
.public-hover-card {
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.public-hover-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px rgba(0,0,0,0.12) !important;
}

.public-endorsement-card {
    backdrop-filter: blur(1px);
    border: 1px solid rgba(25, 135, 84, 0.14) !important;
}

.public-endorsement-logo-wrap {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(25, 135, 84, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(25, 135, 84, 0.1), rgba(255, 255, 255, 0.8));
}

.public-endorsement-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Native Android acquisition sits directly below the public conversion CTAs.
   The QR is an ordinary static asset: no tracking script or third-party image
   request is needed before a visitor chooses to open Google Play. */
.public-android-app-section {
    background: linear-gradient(135deg, #edf8f4, #f7fbff);
    border-block: 1px solid rgba(20, 107, 94, .14);
}

.public-android-app-card {
    max-width: 940px;
    margin: 0 auto;
    padding: clamp(1.25rem, 3vw, 2rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(1.25rem, 5vw, 4rem);
    color: #123a34;
}

.public-android-app-copy {
    max-width: 610px;
}

.public-android-app-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: #0b6b5d;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.public-android-app-copy h2 {
    margin: .35rem 0 .55rem;
    font-size: clamp(1.45rem, 3.2vw, 2.15rem);
    font-weight: 800;
}

.public-android-app-copy p {
    margin-bottom: 1rem;
    color: #41635d;
    font-size: 1.03rem;
}

.public-google-play-button {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    min-height: 48px;
    padding-inline: 1rem;
    border: 1px solid #123a34;
    background: #123a34;
}

.public-google-play-button:hover,
.public-google-play-button:focus-visible {
    background: #0b6b5d;
    border-color: #0b6b5d;
}

.public-android-qr {
    flex: 0 0 auto;
    padding: .55rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    color: #123a34;
    font-size: .8rem;
    font-weight: 700;
    text-decoration: none;
}

.public-android-qr img {
    width: clamp(112px, 15vw, 160px);
    height: auto;
    display: block;
    border: 7px solid #f8f3ea;
    border-radius: .6rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .32);
}

[data-theme="dark"] .public-android-app-section {
    background: linear-gradient(135deg, rgba(11, 15, 23, .98), rgba(35, 45, 61, .98));
    border-color: rgba(214, 184, 92, .18);
}

[data-theme="dark"] .public-android-app-card,
[data-theme="dark"] .public-android-qr {
    color: #fff;
}

[data-theme="dark"] .public-android-app-eyebrow {
    color: #d6b85c;
}

[data-theme="dark"] .public-android-app-copy p {
    color: rgba(255, 255, 255, .82);
}

[data-theme="dark"] .public-google-play-button {
    background: #000;
    border-color: rgba(255, 255, 255, .7);
}

[data-theme="dark"] .public-google-play-button:hover,
[data-theme="dark"] .public-google-play-button:focus-visible {
    background: #171717;
    border-color: #fff;
}

.public-android-qr:hover span,
.public-android-qr:focus-visible span {
    text-decoration: underline;
    text-underline-offset: .2rem;
}

/* Keep hero carousel indicators compact across devices */
.public-hero-islamic .public-hero-carousel .carousel-indicators {
    gap: .38rem;
    margin-bottom: .45rem;
}

.public-hero-islamic .public-hero-carousel .carousel-indicators [data-bs-target] {
    all: unset;
    box-sizing: border-box;
    width: .58rem !important;
    height: .58rem !important;
    min-width: .58rem !important;
    min-height: .58rem !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.52) !important;
    border: 1px solid rgba(255, 255, 255, 0.75) !important;
    opacity: .9 !important;
    cursor: pointer;
}

.public-hero-islamic .public-hero-carousel .carousel-indicators .active {
    width: .64rem !important;
    height: .64rem !important;
    background: #ffffff !important;
    border-color: #ffffff !important;
    opacity: 1 !important;
}

/* Keep login button text perfectly centered with icon */
.public-hero-islamic .public-hero-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: .42rem;
    line-height: 1.1 !important;
    text-align: center;
}

.public-hero-islamic .public-hero-btn i {
    margin: 0 !important;
    line-height: 1 !important;
    transform: translateY(0);
}

[data-theme="dark"] .public-endorsement-card {
    border-color: rgba(212, 175, 55, 0.35) !important;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35) !important;
}

[data-theme="dark"] .public-endorsement-logo-wrap {
    border-color: rgba(212, 175, 55, 0.5);
    background: linear-gradient(145deg, rgba(212, 175, 55, 0.16), rgba(255, 255, 255, 0.06));
}

[data-theme="dark"] .public-endorsement-card .text-muted {
    color: rgba(233, 236, 239, 0.82) !important;
}

[data-theme="dark"] .public-endorsement-card .btn-outline-primary {
    border-color: rgba(212, 175, 55, 0.6);
    color: #f3d88c;
}

[data-theme="dark"] .public-endorsement-card .btn-outline-primary:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: rgba(212, 175, 55, 0.8);
    color: #ffe7a9;
}

/* Mobile UX tuning: tighter hero and easier tap targets */
@media (max-width: 991.98px) {
    body.public-home main#main-content {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    body.public-home .hero-section-public.public-hero-islamic.public-hero-fullbleed {
        min-height: 46vh !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
        padding-bottom: .5rem !important;
    }

    body.public-home .hero-section-public.public-hero-islamic .container-lg,
    body.public-home .hero-section-public.public-hero-islamic .row {
        min-height: 36vh !important;
    }

    body.public-home .hero-section-public.public-hero-islamic .row {
        align-items: center !important;
    }

    .hero-section-public {
        min-height: auto;
        padding-top: 0 !important;
        padding-bottom: .5rem !important;
    }

    .min-vh-50 {
        min-height: 36vh;
    }

    /* Ensure first hero image stays visible even before JS theme swap */
    body.public-home .public-hero-islamic .public-hero-carousel-img {
        opacity: 1 !important;
        min-height: 46vh !important;
        object-fit: cover !important;
        filter: none !important;
    }

    body.public-home .public-hero-islamic .public-hero-carousel-picture,
    body.public-home .public-hero-islamic .public-hero-carousel .carousel-item {
        min-height: 46vh !important;
    }

    /* Keep image identity visible on mobile */
    .public-hero-islamic .public-hero-media::before {
        background: transparent !important;
    }

    .public-hero-islamic .public-hero-media::after {
        background: linear-gradient(
            180deg,
            rgba(8, 14, 28, 0.08) 0%,
            rgba(8, 14, 28, 0.2) 55%,
            rgba(8, 14, 28, 0.34) 100%
        ) !important;
    }

    .public-hero-islamic .public-hero-content {
        min-height: auto !important;
        padding: .2rem .35rem;
        margin-top: 0 !important;
        padding-bottom: .3rem !important;
    }

    .public-hero-islamic .public-hero-title {
        font-size: clamp(1.08rem, 4.7vw, 1.34rem);
        line-height: 1.12;
        margin-bottom: .1rem !important;
    }

    .public-hero-islamic .public-hero-subtitle,
    .public-hero-islamic .public-hero-desc {
        font-size: clamp(.73rem, 2.85vw, .86rem);
        line-height: 1.18;
        margin-bottom: .08rem !important;
    }

    .public-hero-islamic .public-hero-btn {
        min-height: 35px;
        font-size: .84rem;
        padding-top: .28rem !important;
        padding-bottom: .28rem !important;
        padding-inline: .95rem !important;
        line-height: 1.15 !important;
    }

    body.public-home .public-hero-islamic .public-hero-carousel .carousel-indicators {
        bottom: .25rem !important;
        margin-bottom: 0 !important;
        z-index: 16 !important;
    }

    body.public-home .public-hero-islamic .public-hero-ayah {
        display: block !important;
        opacity: 1 !important;
        transform: none !important;
        z-index: 17 !important;
        inset-inline: .65rem !important;
        bottom: clamp(2.25rem, 6.5vw, 2.95rem) !important;
        overflow: visible !important;
    }

    body.public-home .public-hero-islamic .public-hero-ayah-text {
        font-size: clamp(.72rem, 2.6vw, .88rem) !important;
        line-height: 1.42 !important;
        padding: .55rem .6rem .4rem !important;
        background: rgba(5, 12, 24, 0.28) !important;
        border-radius: .4rem;
        display: block;
    }
}

@media (max-width: 575.98px) {
    .public-android-app-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .public-google-play-button {
        justify-content: center;
    }

    .public-hero-islamic .public-hero-content {
        border-radius: 1rem;
        background: linear-gradient(
            to bottom,
            rgba(6, 10, 20, 0.88) 0%,
            rgba(6, 10, 20, 0.62) 62%,
            rgba(6, 10, 20, 0.24) 82%,
            transparent 100%
        ) !important;
        -webkit-backdrop-filter: blur(1px);
        backdrop-filter: blur(1px);
        max-width: min(93vw, 520px);
        margin-inline: auto;
        padding-bottom: .45rem !important;
    }

    .public-hero-islamic .public-hero-actions {
        min-height: 2.2rem;
        margin-top: 0 !important;
    }

    .public-hero-islamic .public-hero-content .d-flex {
        width: 100%;
        gap: .45rem !important;
        justify-content: center;
    }

    .public-hero-islamic .public-hero-content .public-hero-btn {
        width: auto;
        min-width: min(44vw, 180px);
        justify-content: center;
        padding-inline: .8rem !important;
        flex: 0 1 auto;
    }

    .public-hero-islamic .public-hero-title {
        font-size: clamp(1.1rem, 5.1vw, 1.42rem);
        line-height: 1.18;
        margin-bottom: .5rem !important;
    }

    .public-hero-islamic .public-hero-subtitle,
    .public-hero-islamic .public-hero-desc {
        font-size: clamp(.76rem, 3.05vw, .9rem);
        line-height: 1.24;
    }

    /* Keep only hero title on phones */
    .public-hero-islamic .public-hero-subtitle,
    .public-hero-islamic .public-hero-desc {
        display: none !important;
    }

    body.public-home .public-hero-islamic .public-hero-carousel .carousel-indicators {
        bottom: .18rem !important;
    }

    body.public-home .public-hero-islamic .public-hero-ayah {
        bottom: clamp(2.5rem, 8.4vw, 3.2rem) !important;
    }

    body.public-home .public-hero-islamic .public-hero-ayah-text {
        font-size: clamp(.68rem, 2.9vw, .8rem) !important;
        padding: .5rem .55rem .38rem !important;
    }

    .public-hero-islamic .public-hero-carousel .carousel-control-prev,
    .public-hero-islamic .public-hero-carousel .carousel-control-next {
        width: 2.25rem;
        height: 2.25rem;
    }
}

/* Tablet and split-screen tuning for statistics cards */
@media (min-width: 576px) and (max-width: 1024px) {
    .stats-section .card .card-body {
        padding: 1.15rem !important;
    }

    .stats-section .display-4 {
        font-size: clamp(1.35rem, 3.3vw, 2.05rem);
        line-height: 1.1;
    }

    .stats-section .islamic-icon-badge {
        transform: scale(.9);
        margin-bottom: .65rem !important;
    }

    .stats-section .text-muted.fs-5 {
        font-size: .98rem !important;
    }
}

/* Mobile layout tuning: keep a clean 2-column grid */
@media (max-width: 991.98px) {
    .stats-section .container-lg {
        padding-inline: .55rem;
    }

    .stats-section .row {
        --bs-gutter-x: .9rem;
        --bs-gutter-y: .9rem;
    }

    .stats-section .stats-col {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .stats-section .card .card-body {
        padding: 1rem .85rem !important;
    }

    .stats-section .text-muted.fs-5 {
        font-size: .95rem !important;
    }
}

/* Enforce single-column cards on very narrow phones */
@media (max-width: 430px) {
    .stats-section .stats-col {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .stats-section .row {
        --bs-gutter-x: .65rem;
        --bs-gutter-y: .75rem;
    }
}

/* Mobile perf: remove decorative background pattern on small screens */
@media (max-width: 991.98px) {
    body.public-home::before {
        background-image: none !important;
        content: none !important;
    }

    /* Compact homepage sections for phone/tablet */
    body.public-home section.py-5 {
        padding-top: 1.6rem !important;
        padding-bottom: 1.6rem !important;
        margin-bottom: .7rem !important;
    }

    body.public-home .stats-section .mb-5,
    body.public-home .features-section .mb-5,
    body.public-home .public-endorsements-section .mb-5 {
        margin-bottom: 1.15rem !important;
    }

    body.public-home .cta-section-public.public-cta {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
        margin-bottom: .8rem !important;
    }

    body.public-home .hero-section-public.public-hero-islamic.public-hero-fullbleed {
        min-height: 46vh !important;
    }

    body.public-home .public-hero-islamic .public-hero-carousel-img,
    body.public-home .public-hero-islamic .public-hero-carousel-picture,
    body.public-home .public-hero-islamic .public-hero-carousel .carousel-item {
        min-height: 46vh !important;
    }
}
