:root {
    --bg: #060913;
    --bg-soft: #0f1730;
    --surface: rgba(22, 31, 58, 0.78);
    --surface-strong: rgba(18, 25, 48, 0.95);
    --border: rgba(148, 171, 224, 0.3);
    --text: #eff3ff;
    --text-muted: #c7d2f3;
    --brand: #d6b163;
    --brand-2: #7f66ff;
    --accent: #20e3ce;
    --success: #42d89a;
    --danger: #ff6f88;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    --radius: 18px;
    --header-h: 88px;
    --footer-space: 0px;
    --progress: 0%;
    --theme: dark;
}

/* Light theme variables */
body[data-theme="light"] {
    --bg: #f8f9fb;
    --bg-soft: #f0f2f7;
    --surface: rgba(240, 242, 247, 0.85);
    --surface-strong: rgba(232, 236, 245, 0.98);
    --border: rgba(100, 120, 180, 0.25);
    --text: #1a2048;
    --text-muted: #4a5578;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background: radial-gradient(1200px 760px at 90% -140px, rgba(127, 102, 255, 0.24), transparent),
                radial-gradient(900px 680px at -160px 5%, rgba(214, 177, 99, 0.2), transparent),
                radial-gradient(900px 700px at 50% 110%, rgba(32, 227, 206, 0.12), transparent),
                var(--bg);
    line-height: 1.72;
    padding-top: calc(var(--header-h) + 10px);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body[data-theme="light"] {
    background: radial-gradient(1200px 760px at 90% -140px, rgba(127, 102, 255, 0.08), transparent),
                radial-gradient(900px 680px at -160px 5%, rgba(214, 177, 99, 0.08), transparent),
                radial-gradient(900px 700px at 50% 110%, rgba(32, 227, 206, 0.06), transparent),
                var(--bg);
}

body[data-lang="ar"] {
    font-family: "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, sans-serif;
}

a { color: var(--text); text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.container { width: min(1160px, calc(100% - 32px)); margin: 0 auto; }

.skip-link {
    position: fixed;
    left: 14px;
    top: -50px;
    z-index: 999;
    background: var(--brand);
    color: #1d1204;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 800;
}

.skip-link:focus { top: 14px; }

.site-header {
    position: fixed;
    inset-inline: 0;
    top: 0;
    height: var(--header-h);
    z-index: 250;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(7, 11, 22, 0.95), rgba(7, 11, 22, 0.8));
    transition: background .35s ease, backdrop-filter .35s ease, border-color .35s ease, box-shadow .35s ease, transform .35s ease;
}

body.landing-page {
    padding-top: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.landing-page .site-header {
    position: absolute;
    border-bottom-color: transparent;
    background: linear-gradient(180deg, rgba(5, 8, 16, 0.22), rgba(5, 8, 16, 0));
    backdrop-filter: blur(0px);
    box-shadow: none;
}

body.landing-page.header-scrolled .site-header {
    position: fixed;
    border-bottom-color: var(--border);
    background: linear-gradient(180deg, rgba(7, 11, 22, 0.96), rgba(7, 11, 22, 0.82));
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(2, 4, 10, 0.35);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--header-h);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    animation: glowPulse 3.2s infinite;
    transition: transform 0.3s ease;
}

.brand:hover { transform: scale(1.02); }

.brand img { width: 44px; height: 44px; }

.brand small {
    display: block;
    color: var(--text-muted);
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: none;
    font-weight: 600;
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--text);
    background: transparent;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-toggle:hover {
    border-color: var(--brand);
    transform: rotate(90deg);
}

.site-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: .25s ease;
    font-weight: 700;
    font-size: .93rem;
    position: relative;
}

.site-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--brand);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
    width: 80%;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--text);
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.header-actions { display: inline-flex; align-items: center; gap: 10px; }

.lang-toggle {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-weight: 800;
    padding: 10px 12px;
    min-width: 60px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.05);
}

/* Progress bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    width: var(--progress);
    z-index: 9999;
    transition: width 0.1s linear;
    box-shadow: 0 0 12px rgba(214, 177, 99, 0.6);
}

/* Theme toggle button */
.theme-toggle {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: rotate(20deg);
}

main {
    flex: 1;
    min-height: 0;
}

.hero {
    padding: 46px 0 28px;
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    gap: 24px;
    align-items: center;
}

body.landing-page .hero {
    min-height: 100vh;
    padding-top: calc(var(--header-h) + 24px);
}

.hero h1 {
    margin: 0 0 14px;
    font-size: clamp(2rem, 4.8vw, 3.9rem);
    line-height: 1.14;
    animation: revealUp .9s ease both;
}

.hero p {
    margin: 0 0 14px;
    color: var(--text-muted);
    max-width: 66ch;
    animation: revealUp 1.2s ease both;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-radius: 999px;
    border: 1px solid rgba(214, 177, 99, 0.35);
    background: rgba(214, 177, 99, 0.13);
    color: #ffe9b9;
    padding: 8px 14px;
    font-weight: 800;
    margin-bottom: 16px;
    animation: energyWave 2.8s infinite;
}

.hero-media,
.feature,
.panel,
.notice,
.stat,
.app-card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface), var(--surface-strong));
    box-shadow: var(--shadow);
}

.hero-media {
    padding: 16px;
    animation: floatCard 5s ease-in-out infinite;
}

.hero-media img { width: 100%; border-radius: 12px; }

body.landing-page .hero-media img {
    transform: translate3d(0, var(--hero-parallax, 0px), 0);
    transition: transform .1s linear;
    will-change: transform;
}

.section { padding: 24px 0 46px; }
.section h2 { font-size: clamp(1.45rem, 3vw, 2.3rem); margin: 0 0 12px; animation: slideInDown 0.8s ease both; }
.section p.section-intro { color: var(--text-muted); max-width: 76ch; margin-top: 0; animation: slideInUp 1s ease both; }

body.landing-page .section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.feature, .panel, .notice, .stat, .app-card {
    padding: 20px;
    transition: transform .3s ease, box-shadow .3s ease;
    animation: revealUp .9s ease both;
}

.feature:nth-child(2) { animation-delay: 0.1s; }
.feature:nth-child(3) { animation-delay: 0.2s; }
.feature:nth-child(4) { animation-delay: 0.3s; }
.panel:nth-child(2) { animation-delay: 0.1s; }
.panel:nth-child(3) { animation-delay: 0.2s; }
.app-card:nth-child(2) { animation-delay: 0.15s; }

.feature:hover,
.panel:hover,
.notice:hover,
.stat:hover,
.app-card:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5), 0 0 28px rgba(127, 102, 255, 0.2);
}

.feature h3, .panel h3, .notice h3, .stat h3, .app-card h3 { margin-top: 0; margin-bottom: 10px; }

.feature p, .panel p, .notice p, .stat p, .app-card p,
.feature li, .panel li, .notice li {
    color: var(--text-muted);
    margin-top: 0;
}

.feature ul, .panel ul, .notice ul { margin: 0; padding-inline-start: 20px; }

.stat strong {
    display: block;
    color: #f9deb4;
    font-size: 1.9rem;
    line-height: 1.1;
    margin-bottom: 8px;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.btn {
    border: 1px solid var(--border);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    font-weight: 800;
    transition: .25s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.4s ease;
    z-index: 0;
}

.btn:hover::before { left: 100%; }

.btn-primary {
    color: #20160a;
    border-color: #d2af60;
    background: linear-gradient(130deg, #f0d79c, #c8a34d);
    z-index: 1;
}

.btn-secondary {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    z-index: 1;
}

.btn:hover { transform: translateY(-2px) scale(1.02); }

.app-card .app-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    margin-bottom: 12px;
    border: 1px solid rgba(214, 177, 99, 0.45);
    animation: shimmer 2s infinite;
}

.notice.success { border-left: 4px solid var(--success); }
.notice.alert { border-left: 4px solid var(--danger); }

.table-wrap {
    overflow: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; min-width: 640px; background: var(--surface-strong); }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: start; }
th { background: rgba(255, 255, 255, 0.06); }

.site-footer {
    position: relative;
    z-index: 10;
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(6, 10, 18, 0.95), rgba(6, 10, 18, 0.98));
    backdrop-filter: blur(8px);
    margin-top: auto;
}

.footer-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: 1.2fr 1fr 1fr;
    padding: 40px 0 22px;
}

.site-footer h3 { margin-top: 0; margin-bottom: 10px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 10px; transition: all 0.3s ease; }
.site-footer a { transition: all 0.3s ease; }
.site-footer li:hover { transform: translateX(4px); }
.site-footer a:hover { color: var(--brand); }

.copy {
    border-top: 1px solid var(--border);
    padding: 16px 0 20px;
    color: var(--text-muted);
    font-size: .92rem;
}

.footer-social {
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(18, 28, 50, 0.75), rgba(12, 18, 34, 0.9));
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.social-link {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    font-weight: 800;
    font-size: .86rem;
    letter-spacing: .02em;
    transition: transform .25s ease, background .25s ease, border-color .25s ease;
}

.social-link:hover {
    transform: translateY(-2px);
    border-color: rgba(214, 177, 99, 0.55);
    background: rgba(214, 177, 99, 0.16);
}

[data-lang-content] [data-lang="ar"] { display: none; }
body[data-lang="ar"] [data-lang-content] [data-lang="en"] { display: none; }
body[data-lang="ar"] [data-lang-content] [data-lang="ar"] { display: inline; }
body[data-lang="ar"] [data-lang-content].block [data-lang="ar"] { display: block; }
body[data-lang="ar"] [data-lang-content].inline-flex [data-lang="ar"] { display: inline-flex; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@keyframes revealUp {
    0% { opacity: 0; transform: translateY(26px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideInDown {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideUpIn {
    0% { transform: translateY(100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes glowPulse {
    0%, 100% { filter: drop-shadow(0 0 0 rgba(214, 177, 99, 0)); }
    50% { filter: drop-shadow(0 0 16px rgba(214, 177, 99, 0.35)); }
}

@keyframes energyWave {
    0%, 100% { box-shadow: 0 0 0 rgba(214, 177, 99, 0); transform: translateY(0); }
    50% { box-shadow: 0 0 26px rgba(214, 177, 99, 0.35); transform: translateY(-2px); }
}

@keyframes floatCard {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes shimmer {
    0%, 100% { box-shadow: inset 0 0 0 rgba(32, 227, 206, 0); }
    50% { box-shadow: inset 0 0 12px rgba(32, 227, 206, 0.3); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.pulse { animation: pulse 2s infinite; }
.bounce { animation: bounce 1.2s infinite; }

/* Intersection Observer animations - for scroll-triggered reveals */
.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animations for child elements */
.scroll-reveal-stagger > * {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease 0.1s,
                transform 0.6s ease 0.1s;
}

.scroll-reveal-stagger.in-view > *:nth-child(1) { 
    opacity: 1; 
    transform: translateY(0); 
    transition-delay: 0.1s;
}

.scroll-reveal-stagger.in-view > *:nth-child(2) { 
    opacity: 1; 
    transform: translateY(0); 
    transition-delay: 0.15s;
}

.scroll-reveal-stagger.in-view > *:nth-child(3) { 
    opacity: 1; 
    transform: translateY(0); 
    transition-delay: 0.2s;
}

.scroll-reveal-stagger.in-view > *:nth-child(4) { 
    opacity: 1; 
    transform: translateY(0); 
    transition-delay: 0.25s;
}

.scroll-reveal-stagger.in-view > *:nth-child(5) { 
    opacity: 1; 
    transform: translateY(0); 
    transition-delay: 0.3s;
}

/* Scale animation variant */
.scroll-scale {
    opacity: 0;
    transform: scale(0.92) translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.scroll-scale.in-view {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Slide-in from left variant */
.scroll-slide-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-slide-left.in-view {
    opacity: 1;
    transform: translateX(0);
}

/* Slide-in from right variant */
.scroll-slide-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-slide-right.in-view {
    opacity: 1;
    transform: translateX(0);
}

/* Section progress indicators */
.section-progress {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.progress-dot:hover,
.progress-dot.active {
    background: var(--brand);
    border-color: var(--brand);
    transform: scale(1.3);
    box-shadow: 0 0 12px rgba(214, 177, 99, 0.5);
}

@media (max-width: 1024px) {
    .section-progress { display: none; }
}

@media (max-width: 1024px) {
    .hero { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.landing-page .hero,
    body.landing-page .section {
        min-height: 88vh;
    }
}

@media (max-width: 860px) {
    :root { --header-h: 82px; }
    
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    
    .site-nav {
        width: 100%;
        display: none;
        padding-bottom: 12px;
        animation: slideInDown 0.3s ease;
    }
    
    .site-nav.open { display: block; }
    .site-nav ul { flex-direction: column; gap: 6px; }
    .site-nav a { width: 100%; }
    .site-nav a::after { display: none; }
    
    .grid-3, .grid-2, .footer-grid, .grid-4 { grid-template-columns: 1fr; }
    
    .header-actions { margin-inline-start: auto; }
    
    .footer-grid { grid-template-columns: 1fr; gap: 20px; padding: 28px 0 18px; }
    
    .hero { padding: 32px 0 24px; }
    .hero h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }
    
    .section { padding: 20px 0 36px; }
    body.landing-page .section { min-height: auto; }
    
    .cta-row { flex-direction: column; width: 100%; }
    .btn { width: 100%; }
}

@media (max-width: 640px) {
    :root { --header-h: 76px; }
    
    .container { width: min(100%, calc(100% - 20px)); }
    
    .brand small { font-size: 0.65rem; }
    
    .hero { gap: 16px; }
    
    .section h2 { font-size: clamp(1.3rem, 4vw, 1.8rem); }
    
    .footer-grid { gap: 20px; }
    
    table { min-width: auto; font-size: 0.9rem; }
    th, td { padding: 10px; }
    
    .badge { font-size: 0.85rem; padding: 6px 12px; }
    
    .app-card .app-icon { width: 48px; height: 48px; }
}

@media (max-width: 480px) {
    body { padding-top: calc(var(--header-h) + 8px); }
    body.landing-page { padding-top: 0; }
    body, body.landing-page { min-height: 100vh; }
    
    .site-header { height: var(--header-h); }
    .topbar { gap: 8px; }
    
    .brand { gap: 8px; }
    .brand img { width: 38px; height: 38px; }
    
    .hero h1 { font-size: clamp(1.4rem, 4.5vw, 2rem); margin-bottom: 12px; }
    .hero p { font-size: 0.95rem; }
    
    .section h2 { font-size: clamp(1.2rem, 4vw, 1.6rem); }
    
    .feature, .panel, .notice, .stat, .app-card { padding: 16px; }
    
    .grid-2, .grid-3, .grid-4 { gap: 12px; }
    
    .btn { min-height: 44px; padding: 0 14px; font-size: 0.95rem; }
    
    .site-footer { padding: 0; }
    .footer-grid { padding: 18px 0 10px; gap: 16px; }
    .copy { padding: 10px 0 12px; }
    
    .site-footer h3 { margin-bottom: 8px; }
    .site-footer li { margin-bottom: 8px; }
}
