/* ==========================================================================
   home-premium.css
   Home-only premium UI foundations.
   Loaded ONLY by Views/Home/Index.cshtml — safe to add page-only rules here
   without affecting the rest of the site.

   Conventions:
   - Brand tokens: --moe-navy / --moe-gold (mirrors style-new.css palette).
   - Animate ONLY transform & opacity.
   - Wrap hover-only effects in @media (hover: hover) and (pointer: fine).
   - Wrap continuous animations in @media (prefers-reduced-motion: no-preference).
   - This Phase 1 file ships ONLY the foundations: tokens, reveal classes,
     fluid type helpers, and reduced-motion guards. Visual styling per section
     is added in later phases.
   ========================================================================== */

:root {
    --moe-navy:        #14254A;
    --moe-navy-2:      #0b1530;
    --moe-gold:        #FFCD35;
    --moe-gold-soft:   rgba(255, 205, 53, 0.18);
    --moe-line:        rgba(20, 37, 74, 0.10);

    /* Fluid type scale (used by later phases). */
    --fs-eyebrow: clamp(0.78rem, 0.2vw + 0.72rem, 0.92rem);
    --fs-h2:      clamp(1.4rem, 1.2vw + 1rem, 2.25rem);
    --fs-h3:      clamp(1.1rem, 0.6vw + 0.95rem, 1.5rem);
    --fs-body:    clamp(0.95rem, 0.15vw + 0.9rem, 1.05rem);

    /* Motion tokens. */
    --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
    --rev-distance: 24px;
    --rev-duration: 700ms;
}

/* ==========================================================================
   Reveal-on-scroll utility
   Used by home-reveal.js — element starts hidden, gets .is-in-view when it
   enters the viewport. Stagger child reveals with --i.
   ========================================================================== */

.reveal {
    opacity: 0;
    transform: translate3d(0, var(--rev-distance), 0);
    will-change: transform, opacity;
    transition:
        opacity   var(--rev-duration) var(--ease-out-quint),
        transform var(--rev-duration) var(--ease-out-quint);
    transition-delay: calc(var(--i, 0) * 80ms);
}

.reveal.is-in-view {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.reveal-left { transform: translate3d(calc(var(--rev-distance) * -1), 0, 0); }
.reveal-right { transform: translate3d(var(--rev-distance), 0, 0); }
.reveal-fade { transform: none; }

.reveal-left.is-in-view,
.reveal-right.is-in-view,
.reveal-fade.is-in-view {
    transform: translate3d(0, 0, 0);
}

/* When JS hasn't run yet (no-js or async-load failure), show content. */
.no-js .reveal,
html:not(.has-reveal) .reveal {
    opacity: 1;
    transform: none;
}

/* ==========================================================================
   Counter helper
   The JS counter looks for [data-counter-target] and animates from 0.
   ========================================================================== */

[data-counter-target] {
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Magnetic CTA helper (desktop only — JS guards this too)
   ========================================================================== */

@media (hover: hover) and (pointer: fine) {
    .magnetic {
        transition: transform 320ms var(--ease-out-quint);
        will-change: transform;
    }
}

/* ==========================================================================
   Reduced-motion guard — kills all premium motion on user request.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-fade {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .magnetic {
        transform: none !important;
    }
}

/* ==========================================================================
   Phase 3 — Services tabs (#home-services)
   Replaces the inline <style> block that previously lived in
   _HomeServicesTabs.cshtml + adds card-grid polish.
   ========================================================================== */

/* Section heading: fluid type, balanced wrap. */
.home-services-premium .sec-title2 {
    font-size: clamp(1.25rem, 1vw + 1rem, 1.85rem);
    line-height: 1.25;
    text-wrap: balance;
}

/* Sparkle title icons — lifted from the inline <style>. */
.home-services-premium .title-icon {
    font-size: 1.5rem;
    color: var(--moe-gold);
    vertical-align: middle;
    display: inline-block;
    text-shadow: 0 0 8px rgba(255, 205, 53, 0.35);
    animation: moeStarFloat 3.2s ease-in-out infinite;
}

.home-services-premium .title-icon-end {
    animation-delay: 1.6s;
}

@keyframes moeStarFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* Card column: relative so .stretched-link inside fills the whole card. */
.home-services-premium .service-col {
    position: relative;
}

/* Make the entire card surface the click target (replaces onclick=...).
   The <a class="stretched-link"> covers the card; the visible "عرض التفاصيل"
   row below is now a <span> for visual continuity only. */
.home-services-premium .signle-service-item {
    position: relative;
    transition:
        transform 360ms var(--ease-out-quint),
        box-shadow 360ms var(--ease-out-quint);
    cursor: pointer;
}

.home-services-premium .service-card__link {
    /* Don't let the link's own focus outline sit awkwardly on the title text;
       we move the visible focus ring onto the whole card below. */
    text-decoration: none;
    color: inherit;
}

@media (hover: hover) and (pointer: fine) {
    .home-services-premium .service-col:hover .signle-service-item {
        transform: translate3d(0, -4px, 0);
        box-shadow: 0 18px 40px -22px rgba(20, 37, 74, 0.35);
    }
}

/* Keyboard accessibility: visible focus ring on the entire card surface
   (the stretched <a> is what receives focus, but its highlight is invisible). */
.home-services-premium .service-col:focus-within .signle-service-item {
    outline: 2px solid var(--moe-gold);
    outline-offset: 4px;
}

/* The "عرض التفاصيل" pill is now decorative (a <span>); preserve the look but
   don't let it intercept clicks above the stretched link. */
.home-services-premium .infu-btn {
    pointer-events: none;
}

/* Reduced motion: kill the sparkle bob & card lift. */
@media (prefers-reduced-motion: reduce) {
    .home-services-premium .title-icon { animation: none; }
    .home-services-premium .service-col:hover .signle-service-item {
        transform: none;
        box-shadow: none;
    }
}

/* ========================================================================== 
   Home news showcase
   One main article on the right + four supporting articles on the left.
   ========================================================================== */

.home-news-showcase {
    direction: rtl;
}

.home-news-lazy {
    background: #fff;
}

.home-news-lazy.lazy-host {
    min-height: 0;
}

.home-news-lazy > .home-news-showcase {
    background: #fff;
}

.home-section-separator {
    position: relative;
    overflow: hidden;
}

.home-section-separator::before,
.home-section-separator::after {
    content: "";
    position: absolute;
    left: 0;
    display: block;
    width: 100%;
    height: 28px;
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center center;
    z-index: 9;
    pointer-events: none;
}

.home-section-separator::before {
    top: -1px;
    background-image: url("/assets/img/new-image/image-1.svg");
}

.home-section-separator::after {
    bottom: -1px;
    background-image: url("/assets/img/new-image/image-2.svg");
}

.home-news-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr);
    grid-template-areas: "hero small";
    gap: 18px;
    align-items: stretch;
}

.home-news-card {
    position: relative;
    display: block;
    min-height: 260px;
    overflow: hidden;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    background: var(--moe-navy-2);
    box-shadow: 0 22px 50px -30px rgba(11, 21, 48, 0.55);
    isolation: isolate;
}

.home-news-card--hero {
    grid-area: hero;
    min-height: 540px;
}

.home-news-grid {
    grid-area: small;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.home-news-card--small {
    min-height: 261px;
}

.home-news-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.01);
    transition: transform 520ms var(--ease-out-quint), filter 520ms var(--ease-out-quint);
    z-index: -2;
}

.home-news-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(11, 21, 48, 0.08) 10%, rgba(11, 21, 48, 0.54) 54%, rgba(11, 21, 48, 0.94) 100%);
    transition: background 320ms ease, opacity 320ms ease;
    z-index: -1;
}

.home-news-card__content {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
    padding: 24px;
}

.home-news-card--small .home-news-card__content {
    gap: 7px;
    padding: 18px;
}

.home-news-card__title {
    display: block;
    color: #fff;
    font-size: clamp(1.05rem, 0.65vw + 0.95rem, 1.42rem);
    font-weight: 800;
    line-height: 1.42;
    text-decoration: none;
    transition: color 220ms ease;
}

.home-news-card--small .home-news-card__title {
    display: -webkit-box;
    overflow: hidden;
    font-size: clamp(0.88rem, 0.25vw + 0.82rem, 1.02rem);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.home-news-card__text {
    display: -webkit-box;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.65;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.home-news-card--small .home-news-card__text {
    font-size: 0.84rem;
    line-height: 1.55;
    -webkit-line-clamp: 2;
}

.home-news-empty {
    padding: 2rem;
    border: 1px dashed var(--moe-line);
    border-radius: 8px;
    background: #fff;
    color: var(--moe-navy);
    text-align: center;
    font-weight: 700;
}

@media (hover: hover) and (pointer: fine) {
    .home-news-card:hover .home-news-card__image,
    .home-news-card:focus-visible .home-news-card__image {
        transform: scale(1.08);
        filter: saturate(1.08) contrast(1.04);
    }

    .home-news-card:hover .home-news-card__overlay,
    .home-news-card:focus-visible .home-news-card__overlay {
        background: linear-gradient(180deg, rgba(11, 21, 48, 0.14) 8%, rgba(11, 21, 48, 0.66) 52%, rgba(11, 21, 48, 0.98) 100%);
    }

    .home-news-card:hover .home-news-card__title,
    .home-news-card:focus-visible .home-news-card__title {
        color: var(--moe-gold);
    }
}

.home-news-card:focus-visible {
    outline: 3px solid var(--moe-gold);
    outline-offset: 4px;
}

@media (max-width: 1199.98px) {
    .home-news-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "hero"
            "small";
    }

    .home-news-card--hero {
        min-height: 440px;
    }
}

@media (max-width: 767.98px) {
    .home-section-separator::before {
        height: 19px;
    }

    .home-section-separator::after {
        height: 20px;
    }

    .home-news-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .home-news-layout {
        gap: 14px;
    }

    .home-news-card,
    .home-news-card--hero,
    .home-news-card--small {
        min-height: 320px;
    }

    .home-news-card__content,
    .home-news-card--small .home-news-card__content {
        padding: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-news-card__image,
    .home-news-card__overlay,
    .home-news-card__title {
        transition: none;
    }

    .home-news-card:hover .home-news-card__image,
    .home-news-card:focus-visible .home-news-card__image {
        transform: scale(1.01);
    }
}
