/* ══════════════════════════════════════
   Design System — CSS Variables
   ══════════════════════════════════════ */
:root {
    --ls-bg: #f8f6f0;
    --ls-bg-canvas: #ffffff;
    --ls-surface: rgba(255, 255, 255, 0.88);
    --ls-surface-hover: rgba(255, 255, 255, 0.96);
    --ls-text: #0a2647;
    --ls-text-sub: rgba(10, 38, 71, 0.7);
    --ls-text-muted: rgba(10, 38, 71, 0.45);
    --ls-gold: #c9a03e;
    --ls-gold-soft: rgba(201, 160, 62, 0.12);
    --ls-gold-glow: rgba(201, 160, 62, 0.25);
    --ls-border: rgba(201, 160, 62, 0.22);
    --ls-border-hover: rgba(201, 160, 62, 0.5);
    --ls-shadow-sm: 0 2px 8px rgba(10, 38, 71, 0.05);
    --ls-shadow: 0 4px 20px rgba(10, 38, 71, 0.07);
    --ls-shadow-hover: 0 12px 36px rgba(10, 38, 71, 0.13);
    --ls-font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
    --ls-radius: 16px;
    --ls-radius-sm: 10px;
    --ls-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ls-speed: 0.3s;
}



/* ══════════════════════════════════════
   الحاوية الرئيسية
   ══════════════════════════════════════ */
.hero-legal-scene {
    position: relative;
    width: 100%;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--ls-bg);
    font-family: var(--ls-font);
}

/* ══════════════════════════════════════
   الخلفية — بديل CSS (يعمل دائماً)
   ══════════════════════════════════════ */
.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-bg-fallback {
    position: absolute;
    inset: 0;
    background: var(--ls-bg);
    z-index: 0;
    overflow: hidden;
}

.hero-bg-fallback span {
    position: absolute;
    border-radius: 50%;
    background: var(--ls-gold);
    opacity: 0.06;
    filter: blur(70px);
    will-change: transform;
}

.hero-bg-fallback span:nth-child(1) {
    width: 420px;
    height: 420px;
    top: -12%;
    right: -6%;
    animation: ls-float 22s ease-in-out infinite;
}

.hero-bg-fallback span:nth-child(2) {
    width: 300px;
    height: 300px;
    bottom: 5%;
    left: -4%;
    animation: ls-float 18s ease-in-out infinite reverse;
}

.hero-bg-fallback span:nth-child(3) {
    width: 220px;
    height: 220px;
    top: 38%;
    left: 45%;
    animation: ls-float 26s ease-in-out infinite -8s;
}

@keyframes ls-float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(25px, -30px) scale(1.08);
    }

    66% {
        transform: translate(-20px, 15px) scale(0.94);
    }
}

/* Three.js Canvas — مخفي على الموبايل */
#bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

@media (max-width: 767px) {
    #bg-canvas {
        display: none;
    }
}

/* ══════════════════════════════════════
   المحتوى
   ══════════════════════════════════════ */
.hero-content {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 1160px;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.8rem;
}

/* ══════════════════════════════════════
   زر الاستشارة (CTA)
   ══════════════════════════════════════ */
.hero-cta-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.6rem;
    border: 2px solid var(--ls-gold);
    border-radius: 999px;
    background: var(--ls-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--ls-text);
    font-family: var(--ls-font);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--ls-speed) var(--ls-ease);
    box-shadow: var(--ls-shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    z-index: 20;
    line-height: 1.4;
}

.hero-cta-btn:hover {
    background: var(--ls-gold);
    color: #fff;
    border-color: var(--ls-gold);
    box-shadow: 0 4px 28px var(--ls-gold-glow);
    transform: translateY(-2px);
}

.hero-cta-btn:focus-visible {
    outline: 2px solid var(--ls-gold);
    outline-offset: 3px;
}

/* حلقة النبض */
.hero-cta-btn__ring {
    position: absolute;
    inset: -4px;
    border-radius: 999px;
    border: 2px solid var(--ls-gold);
    opacity: 0;
    animation: ls-pulse 2.8s ease-out infinite;
    pointer-events: none;
}

@keyframes ls-pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.18);
        opacity: 0;
    }
}

.hero-cta-btn .bi {
    font-size: 1.1rem;
    color: var(--ls-gold);
    transition: color var(--ls-speed) var(--ls-ease);
}

.hero-cta-btn:hover .bi {
    color: #fff;
}

/* ══════════════════════════════════════
   الشبكة — Mobile: Scroll أفقي
   ══════════════════════════════════════ */
.hero-grid {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.hero-grid__row {
    display: flex;
    overflow-x: auto;
    gap: 0.9rem;
    padding: 0.5rem 1.2rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-padding-inline: 1.2rem;
    scrollbar-width: none;
    /* تدرج التلاشي عند الحواف */
    -webkit-mask-image: linear-gradient(to left, transparent, black 20px, black calc(100% - 20px), transparent);
    mask-image: linear-gradient(to left, transparent, black 20px, black calc(100% - 20px), transparent);
}

.hero-grid__row::-webkit-scrollbar {
    display: none;
}

/* ══════════════════════════════════════
   البطاقة
   ══════════════════════════════════════ */
.hero-card {
    flex: 0 0 240px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    padding: 1.2rem 1rem 1rem;
    border-radius: var(--ls-radius);
    background: var(--ls-surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--ls-border);
    box-shadow: var(--ls-shadow-sm);
    transition: all var(--ls-speed) var(--ls-ease);
    position: relative;
    overflow: hidden;
}

/* شريط ذهبي علوي عند التمرير */
.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--ls-gold), transparent);
    opacity: 0;
    transition: opacity var(--ls-speed) var(--ls-ease);
}

.hero-card:hover,
.hero-card:focus-visible {
    transform: translateY(-6px);
    background: var(--ls-surface-hover);
    border-color: var(--ls-border-hover);
    box-shadow: var(--ls-shadow-hover);
}

.hero-card:hover::before,
.hero-card:focus-visible::before {
    opacity: 1;
}

.hero-card:focus-visible {
    outline: 2px solid var(--ls-gold);
    outline-offset: 2px;
}

/* الأيقونة */
.hero-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 13px;
    background: var(--ls-gold-soft);
    margin-bottom: 0.7rem;
    flex-shrink: 0;
    transition: all var(--ls-speed) var(--ls-ease);
}

.hero-card__icon .bi {
    font-size: 1.4rem;
    color: var(--ls-gold);
    transition: all var(--ls-speed) var(--ls-ease);
}

.hero-card:hover .hero-card__icon {
    background: var(--ls-gold);
    box-shadow: 0 4px 16px var(--ls-gold-glow);
}

.hero-card:hover .hero-card__icon .bi {
    color: #fff;
    transform: scale(1.1);
}

/* العنوان */
.hero-card__title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ls-text);
    margin: 0 0 0.3rem;
    line-height: 1.45;
}

/* الوصف */
.hero-card__desc {
    font-size: 0.78rem;
    color: var(--ls-text-sub);
    margin: 0;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* سهم الإشارة */
.hero-card__arrow {
    margin-top: auto;
    padding-top: 0.6rem;
    opacity: 0;
    transform: translateX(8px);
    transition: all var(--ls-speed) var(--ls-ease);
}

.hero-card__arrow .bi {
    font-size: 1rem;
    color: var(--ls-gold);
}

.hero-card:hover .hero-card__arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ══════════════════════════════════════
   Desktop — Grid 4 أعمدة
   ══════════════════════════════════════ */
@media (min-width: 1024px) {
    .hero-legal-scene {
        min-height: 72vh;
    }

    .hero-content {
        padding: 2.5rem 1.5rem;
        gap: 2rem;
    }

    .hero-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 1.2rem;
    }

    /* إخفاء غلاف الصفوف — البطاقات تصبح أبناء مباشرين للـ grid */
    .hero-grid__row {
        display: contents;
        overflow: visible;
        padding: 0;
        scroll-snap-type: none;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .hero-card {
        flex: unset;
        min-height: 210px;
        scroll-snap-align: unset;
    }

    /* ظهور متتالي */
    .hero-card {
        animation: ls-card-in 0.5s var(--ls-ease) both;
    }

    .hero-grid__row:nth-child(1) .hero-card:nth-child(1) {
        animation-delay: .06s
    }

    .hero-grid__row:nth-child(1) .hero-card:nth-child(2) {
        animation-delay: .12s
    }

    .hero-grid__row:nth-child(1) .hero-card:nth-child(3) {
        animation-delay: .18s
    }

    .hero-grid__row:nth-child(1) .hero-card:nth-child(4) {
        animation-delay: .24s
    }

    .hero-grid__row:nth-child(2) .hero-card:nth-child(1) {
        animation-delay: .30s
    }

    .hero-grid__row:nth-child(2) .hero-card:nth-child(2) {
        animation-delay: .36s
    }

    .hero-grid__row:nth-child(2) .hero-card:nth-child(3) {
        animation-delay: .42s
    }

    .hero-grid__row:nth-child(2) .hero-card:nth-child(4) {
        animation-delay: .48s
    }

    .hero-grid__row:nth-child(3) .hero-card:nth-child(1) {
        animation-delay: .54s
    }

    .hero-grid__row:nth-child(3) .hero-card:nth-child(2) {
        animation-delay: .60s
    }

    .hero-grid__row:nth-child(3) .hero-card:nth-child(3) {
        animation-delay: .66s
    }

    .hero-grid__row:nth-child(3) .hero-card:nth-child(4) {
        animation-delay: .72s
    }

    @keyframes ls-card-in {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* ══════════════════════════════════════
   Tablet
   ══════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023px) {
    .hero-card {
        flex: 0 0 220px;
    }
}

/* ══════════════════════════════════════
   Mobile
   ══════════════════════════════════════ */
@media (max-width: 767px) {
    .hero-legal-scene {
        min-height: 42vh;
    }

    .hero-content {
        padding: 1rem 0 0.5rem;
        gap: 1rem;
    }

    .hero-cta-btn {
        font-size: 0.82rem;
        padding: 0.55rem 1.2rem;
        gap: 0.35rem;
    }

    .hero-cta-btn__ring {
        display: none;
    }

    .hero-grid {
        gap: 0.5rem;
    }

    .hero-grid__row {
        gap: 0.7rem;
        padding: 0.4rem 1rem;
        -webkit-mask-image: linear-gradient(to left, transparent, black 12px, black calc(100% - 12px), transparent);
        mask-image: linear-gradient(to left, transparent, black 12px, black calc(100% - 12px), transparent);
    }

    .hero-card {
        flex: 0 0 170px;
        padding: 0.85rem 0.7rem 0.75rem;
        border-radius: var(--ls-radius-sm);
    }

    .hero-card__icon {
        width: 42px;
        height: 42px;
        border-radius: 10px;
        margin-bottom: 0.5rem;
    }

    .hero-card__icon .bi {
        font-size: 1.15rem;
    }

    .hero-card__title {
        font-size: 0.82rem;
    }

    .hero-card__desc {
        font-size: 0.7rem;
        line-height: 1.45;
        -webkit-line-clamp: 2;
    }

    .hero-card__arrow {
        display: none;
    }

    .hero-card:hover {
        transform: translateY(-3px);
    }
}

/* شاشات صغيرة جداً */
@media (max-width: 380px) {
    .hero-card {
        flex: 0 0 155px;
        padding: 0.7rem 0.55rem 0.6rem;
    }

    .hero-card__icon {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .hero-card__icon .bi {
        font-size: 1rem;
    }

    .hero-card__title {
        font-size: 0.76rem;
    }

    .hero-card__desc {
        font-size: 0.66rem;
    }
}

/* ══════════════════════════════════════
   Reduced Motion
   ══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .hero-bg-fallback span {
        animation: none;
    }

    .hero-cta-btn__ring {
        animation: none;
        display: none;
    }

    .hero-card {
        animation: none !important;
    }

    .hero-card,
    .hero-cta-btn,
    .hero-card__icon,
    .hero-card__arrow {
        transition-duration: 0.01ms !important;
    }
}