/* ========================================
   Qalaat Alnubalaa — Systems Portal
   Theme: Deep Navy + Purple Gradient
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-deep: #060b18;
    --bg-navy: #0c1428;
    --bg-card-dark: #111a33;
    --bg-card-light: #ffffff;
    --purple: #7c3aed;
    --purple-light: #a78bfa;
    --purple-glow: rgba(124, 58, 237, 0.4);
    --blue: #3b82f6;
    --blue-glow: rgba(59, 130, 246, 0.3);
    --orange: #f59e0b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-dark: #1e293b;
    --text-dark-sub: #64748b;
    --border-subtle: rgba(148, 163, 184, 0.08);
    --glass: rgba(255, 255, 255, 0.03);
    --radius: 20px;
    --radius-sm: 14px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ===== Canvas Background ===== */
#bgCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== Blueprint Grid Overlay ===== */
.blueprint-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(124, 58, 237, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridPulse 8s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ===== Page Loader ===== */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-deep);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-logo {
    text-align: center;
}

.loader-logo img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 24px;
    animation: loaderSpin 1.5s ease-in-out infinite;
}

@keyframes loaderSpin {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.loader-bar {
    width: 200px;
    height: 3px;
    background: var(--bg-card-dark);
    border-radius: 4px;
    overflow: hidden;
}

.loader-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--purple), var(--blue));
    border-radius: 4px;
    animation: loaderFill 1.8s ease-in-out forwards;
}

@keyframes loaderFill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ===== Page Wrapper ===== */
.page-wrapper {
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.page-wrapper.visible {
    opacity: 1;
}

/* ===== Hero / Header ===== */
.hero-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    position: relative;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.logo-badge {
    width: 180px;
    height: 180px;
    border-radius: 28px;
    background: linear-gradient(135deg, #fff8f0, #faf5eb);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 1px rgba(124, 58, 237, 0.1),
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 80px rgba(124, 58, 237, 0.1);
    margin-bottom: 10px;
    margin-top: -40px;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.logo-badge:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow:
        0 0 0 1px rgba(124, 58, 237, 0.4),
        0 30px 80px rgba(0, 0, 0, 0.6),
        0 0 120px rgba(124, 58, 237, 0.25);
}

.logo-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    filter: brightness(0.9);
}

.brand-name {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand-letter {
    display: inline-block;
    animation: letterFloat 3s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.08s);
}

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

.brand-spacer {
    display: inline-block;
    width: 18px;
}

.brand-sub {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--purple-light);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.divider-line {
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--purple), var(--blue), transparent);
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.divider-line.animate-active {
    width: 280px;
}

.portal-label {
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.3s;
}

.scroll-indicator:hover {
    color: var(--purple-light);
}

.scroll-indicator i {
    animation: bounceDown 2s ease-in-out infinite;
}

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

/* ===== Sections ===== */
.systems-section {
    padding: 100px 0;
    position: relative;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.section-sub {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* ===== Cards Grid ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.cards-center {
    grid-template-columns: 1fr;
    max-width: 480px;
}

/* ===== System Card (base) ===== */
.system-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 44px 32px 36px;
    border-radius: var(--radius);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
    cursor: pointer;
}

.system-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: border-color 0.4s ease;
    pointer-events: none;
}

.system-card:hover {
    transform: translateY(-8px);
}

.system-card:hover::after {
    border-color: var(--purple);
}

/* Light Card */
.card-light {
    background: var(--bg-card-light);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25);
}

.card-light h3 {
    color: var(--text-dark);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 20px 0 10px;
}

.card-light p {
    color: var(--text-dark-sub);
    font-size: 0.92rem;
    line-height: 1.6;
    flex: 1;
}

.card-light:hover {
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.2);
}

.card-light .card-action {
    color: var(--purple);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: gap 0.3s;
}

.card-light:hover .card-action {
    gap: 14px;
}

/* Dark Card */
.card-dark {
    background: linear-gradient(145deg, #151d35, #1a2340);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
}

.card-dark h3 {
    color: var(--text-primary);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 20px 0 10px;
}

.card-dark p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
    flex: 1;
}

.card-dark:hover {
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.25);
}

.card-dark .card-action {
    color: var(--purple-light);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: gap 0.3s;
}

.card-dark:hover .card-action {
    gap: 14px;
}

/* Gradient Card (PazoSystems) */
.card-gradient {
    background: linear-gradient(135deg, #1e1145 0%, #1a2550 50%, #0f1d3d 100%);
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(124, 58, 237, 0.15);
}

.card-gradient h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 24px 0 12px;
}

.card-gradient p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    flex: 1;
}

.card-gradient:hover {
    box-shadow:
        0 20px 60px rgba(124, 58, 237, 0.3),
        0 0 80px rgba(124, 58, 237, 0.1);
}

.card-gradient .card-action {
    color: var(--purple-light);
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--purple);
    color: #fff;
    border-radius: 30px;
    transition: background 0.3s, gap 0.3s, box-shadow 0.3s;
}

.card-gradient:hover .card-action {
    gap: 14px;
    background: #6d28d9;
    box-shadow: 0 4px 20px var(--purple-glow);
}

/* ===== Icon Wraps ===== */
.card-icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.system-card:hover .card-icon-wrap {
    transform: scale(1.1) rotate(-5deg);
}

.icon-orange {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.25);
}

.icon-purple {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    color: #fff;
    box-shadow: 0 6px 20px var(--purple-glow);
}

.icon-blue {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.2);
}

.icon-gradient {
    background: linear-gradient(135deg, var(--purple), var(--blue));
    color: #fff;
    box-shadow: 0 6px 20px var(--purple-glow);
    width: 70px;
    height: 70px;
    font-size: 1.7rem;
}

/* ===== Section Divider ===== */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    position: relative;
}

.section-divider::before,
.section-divider::after {
    content: '';
    height: 1px;
    flex: 1;
    max-width: 200px;
    background: linear-gradient(90deg, transparent, var(--border-subtle));
}

.section-divider::after {
    background: linear-gradient(90deg, var(--border-subtle), transparent);
}

.divider-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-card-dark);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--purple-light);
    font-size: 1.1rem;
    margin: 0 20px;
    animation: dividerRotate 10s linear infinite;
}

@keyframes dividerRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Footer ===== */
.site-footer {
    padding: 60px 20px 40px;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
    margin-top: 40px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    opacity: 0.5;
    margin-bottom: 4px;
}

.footer-brand {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.footer-copy {
    font-size: 0.82rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ===== Scroll-triggered Animations ===== */
[data-animate] {
    opacity: 0;
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-animate="fade-up"] {
    transform: translateY(40px);
}

[data-animate="scale-in"] {
    transform: scale(0.85);
}

[data-animate="expand"] {
    /* handled by class */
}

[data-animate].animate-active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ===== Tilt Shine Effect on Cards ===== */
.system-card .shine-layer {
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
    background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(124, 58, 237, 0.12), transparent 40%);
}

.system-card:hover .shine-layer {
    opacity: 1;
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .brand-name {
        font-size: 2.2rem;
        letter-spacing: 4px;
    }
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
        max-width: 420px;
    }
    .brand-name {
        font-size: 1.8rem;
        letter-spacing: 3px;
    }
    .section-title {
        font-size: 2.2rem;
    }
    .hero-section {
        min-height: 90vh;
    }
    .logo-badge {
        width: 140px;
        height: 140px;
    }
    .logo-img {
        width: 90px;
        height: 90px;
    }
}

@media (max-width: 480px) {
    .brand-name {
        font-size: 1.4rem;
        letter-spacing: 2px;
    }
    .system-card {
        padding: 32px 24px 28px;
    }
    .section-title {
        font-size: 1.8rem;
    }
}
