/**
 * ============================================================================
 * Q-INFINITY DESIGN THEME v3.0.0
 * ============================================================================
 *
 * Futuristic Corporate Minimalist — the enterprise-facing QENEX identity.
 * Replaces sovereign-v31.css as the active production theme.
 *
 * Design principles:
 *   1. Clean elevation, no neon glow
 *   2. Hairline borders (rgba white-alpha)
 *   3. Frosted glass (blur 8px, not 20px)
 *   4. Subtle gradient shifts, not radial nebulas
 *   5. Typography with 0.01em letter-spacing crispness
 *   6. translateY(-2px) hover lift, no glow pulse
 *
 * Load AFTER tokens.css and any site-specific CSS.
 *
 * (c) 2026 QENEX LTD. All Rights Reserved.
 */

/* ============================================================================
   Q-INFINITY SURFACES
   ============================================================================ */

body {
    background-color: var(--qi-surface-base, #05050A);
    letter-spacing: var(--tracking-qi, 0.01em);
}

/* Frosted glass navigation */
.nav {
    background: var(--qi-surface-frosted);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border-bottom: 1px solid var(--border-muted);
}

/* ============================================================================
   Q-INFINITY CARDS — Clean elevation, no glow
   ============================================================================ */

.card,
.acq-card {
    background: var(--surface-raised);
    border: 1px solid var(--border-muted);
    border-radius: var(--card-radius);
    box-shadow: var(--qi-shadow-elevated);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover,
.acq-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--qi-shadow-corporate);
    border-color: var(--border-subtle);
}

/* Glass card — reduced blur */
.card-glass {
    background: var(--qi-surface-frosted);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border: 1px solid var(--border-muted);
}

/* Product card — clean, no holographic sweep */
.card-product {
    background: var(--surface-raised);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--border-muted);
    box-shadow: var(--qi-shadow-elevated);
}

.card-product::before {
    background: var(--gradient-brand);
}

.card-product::after {
    background: linear-gradient(90deg, transparent, rgba(74, 67, 209, 0.04), transparent);
}

.card-product:hover {
    transform: translateY(-2px);
    border-color: var(--border-default);
    box-shadow: var(--qi-shadow-corporate);
}

/* ============================================================================
   Q-INFINITY BUTTONS — Solid with subtle transition
   ============================================================================ */

.btn-primary {
    background: var(--gradient-button);
    box-shadow: var(--qi-shadow-elevated);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--qi-shadow-corporate);
}

.btn-secondary:hover {
    box-shadow: var(--qi-shadow-elevated);
}

.btn-ghost:hover {
    background: var(--brand-accent-subtle);
}

/* Navigation CTA */
.nav-cta {
    box-shadow: var(--qi-shadow-elevated);
}

.nav-cta:hover {
    box-shadow: var(--qi-shadow-corporate);
}

.nav-logo-icon {
    box-shadow: var(--qi-shadow-elevated);
}

/* ============================================================================
   Q-INFINITY BADGES — Compact, no glow
   ============================================================================ */

.badge {
    border-radius: var(--radius-sm);
}

.badge-premium {
    box-shadow: none;
}

/* ============================================================================
   Q-INFINITY MODAL — Corporate depth
   ============================================================================ */

.modal {
    box-shadow: var(--qi-shadow-corporate);
}

.modal-title {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================================================
   Q-INFINITY HERO — Subtle depth
   ============================================================================ */

.hero::before {
    background:
        radial-gradient(circle at 30% 20%, rgba(74, 67, 209, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 70% 80%, rgba(6, 182, 212, 0.04) 0%, transparent 40%);
}

.hero-badge {
    background: var(--brand-accent-subtle);
    border: 1px solid var(--border-default);
    box-shadow: var(--qi-shadow-elevated);
}

/* ============================================================================
   Q-INFINITY TRUST BADGE — Clean, professional
   ============================================================================ */

.trust-badge-bar {
    display: flex;
    justify-content: center;
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-8);
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-6);
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-full);
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--text-sm);
    color: var(--color-success);
    box-shadow: var(--qi-shadow-elevated);
    animation: none;
}

/* ============================================================================
   Q-INFINITY HERO TITLE
   ============================================================================ */

.hero-qenex-title {
    background: var(--gradient-text);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================================================
   Q-INFINITY KPI CARDS
   ============================================================================ */

.kpi-card {
    border: 1px solid var(--border-muted);
    box-shadow: var(--qi-shadow-elevated);
}

/* ============================================================================
   Q-INFINITY TABLE — Corporate terminal
   ============================================================================ */

.table-terminal th {
    color: var(--brand-accent);
}

/* ============================================================================
   Q-INFINITY HOVER — Clean lift, no glow
   ============================================================================ */

.hover-glow:hover {
    box-shadow: var(--qi-shadow-elevated);
}

.hover-glow-intense:hover {
    box-shadow: var(--qi-shadow-corporate);
}

.hover-border-glow:hover {
    border-color: var(--brand-accent);
    box-shadow: var(--qi-shadow-elevated);
}

/* ============================================================================
   Q-INFINITY SCROLLBAR
   ============================================================================ */

::-webkit-scrollbar-thumb {
    background: var(--brand-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-tertiary);
}

/* ============================================================================
   NEBULA BACKGROUND → SUBTLE GRADIENT
   ============================================================================ */

.nebula-bg {
    background: var(--gradient-surface);
}

.nebula-bg::before {
    background-image:
        radial-gradient(circle at 20% 30%, rgba(74, 67, 209, 0.03) 0%, transparent 25%),
        radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.02) 0%, transparent 25%);
    animation: none;
}

.nebula-bg::after {
    background-image:
        linear-gradient(rgba(74, 67, 209, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 67, 209, 0.015) 1px, transparent 1px);
}

/* ============================================================================
   Q-INFINITY ELITE — Ultra-Refined Visual Layer v4.0
   Purely visual refinement layered on top of Q-Infinity base.
   ============================================================================ */

/* Elite card surfaces — ultra-deep with frosted backdrop */
.card,
.acq-card,
.capability-card,
.offering-card {
    background: var(--qi-elite-surface-ultra, #03030A);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Elite hover — prestige shadow */
.card:hover,
.acq-card:hover,
.capability-card:hover,
.offering-card:hover {
    box-shadow: var(--qi-elite-shadow-prestige);
}

/* Elite button refinement — platinum gradient terminus */
.btn-primary {
    background: var(--qi-elite-gradient-platinum);
}

/* Elite typography — tighter letter-spacing */
body {
    letter-spacing: var(--font-letter-spacing-qi-elite, 0.005em);
}

/* Elite hero text — platinum white endpoint */
.hero-qenex-title,
.lab-title {
    background: var(--qi-elite-gradient-hero-text);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Elite KPI cards — platinum accent border on hover */
.kpi-card:hover,
.metric-card:hover {
    border-color: var(--qi-elite-accent-platinum);
    box-shadow: var(--qi-elite-shadow-prestige);
}

/* ============================================================================
   Q-INFINITY STRUCTURAL ENGINE (merged from fluid-sovereign.css)
   Single source of truth — layout, typography, canvases, interactions
   ============================================================================ */

/* Fluid Typography Variables */
:root {
    --fluid-hero: clamp(2.5rem, 5vw + 1rem, 7rem);
    --fluid-h2: clamp(1.5rem, 2.5vw + 0.5rem, 3rem);
    --fluid-h3: clamp(1.15rem, 1.5vw + 0.4rem, 1.75rem);
    --fluid-body: clamp(0.875rem, 0.8vw + 0.5rem, 1.125rem);
    --fluid-sm: clamp(0.75rem, 0.6vw + 0.4rem, 0.875rem);
    --fluid-xs: clamp(0.65rem, 0.5vw + 0.35rem, 0.75rem);
    --fluid-section-pad: clamp(3rem, 6vw, 6rem);
    --fluid-gap: clamp(1rem, 2vw, 2rem);
}

.hero-qenex-title {
    font-size: var(--fluid-hero);
}

.section-title {
    font-size: var(--fluid-h2);
}

.hero-subtitle,
.section-description {
    font-size: var(--fluid-body);
}

.page-section {
    padding: var(--fluid-section-pad) var(--space-6);
}

/* Particle Canvas — Full-bleed background */
.particle-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.particle-container canvas {
    display: block;
    width: 100%; height: 100%;
    pointer-events: auto;
}

.hero-qenex {
    position: relative;
    z-index: 1;
    isolation: isolate;
}

.hero-qenex > *:not(.particle-container) {
    position: relative;
    z-index: 2;
}

/* Q-Lang Terminal — Desktop sidebar / Mobile bottom-sheet */
.qlang-terminal {
    position: fixed;
    z-index: 50;
    background: rgba(5, 5, 10, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(74, 67, 209, 0.2);
    font-family: 'JetBrains Mono', monospace;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease;
    will-change: transform, opacity;
    overflow: hidden;
}

@media (min-width: 769px) {
    .qlang-terminal {
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        width: clamp(280px, 22vw, 420px);
        max-height: 70vh;
        border-radius: 12px;
        box-shadow: 0 0 40px rgba(74, 67, 209, 0.15);
    }
}

@media (max-width: 768px) {
    .qlang-terminal {
        left: 0; right: 0; bottom: 0;
        max-height: 35vh;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
        opacity: 0.85;
    }
    .qlang-terminal.collapsed {
        transform: translateY(calc(100% - 40px));
    }
}

.qlang-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(74, 67, 209, 0.08);
    border-bottom: 1px solid rgba(74, 67, 209, 0.15);
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
}

.qlang-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(74, 67, 209, 0.5);
}
.qlang-dot:first-child { background: rgba(239, 68, 68, 0.6); }
.qlang-dot:nth-child(2) { background: rgba(245, 158, 11, 0.6); }
.qlang-dot:nth-child(3) { background: rgba(16, 185, 129, 0.6); }

.qlang-title {
    flex: 1;
    font-size: 0.7rem;
    color: #8B5CF6;
    margin-left: 8px;
    letter-spacing: 0.05em;
}

.qlang-batch-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    color: #555;
}

.qlang-nav-btn {
    background: rgba(74, 67, 209, 0.15);
    border: 1px solid rgba(74, 67, 209, 0.25);
    color: #8B5CF6;
    width: 24px; height: 24px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    min-width: 32px; min-height: 32px;
}

.qlang-nav-btn:hover,
.qlang-nav-btn:active {
    background: rgba(74, 67, 209, 0.3);
}

.qlang-code {
    padding: 14px;
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.6;
    color: #06B6D4;
    overflow-x: auto; overflow-y: auto;
    max-height: calc(70vh - 50px);
    white-space: pre;
    scrollbar-width: thin;
    scrollbar-color: rgba(74, 67, 209, 0.3) transparent;
}

@media (max-width: 768px) {
    .qlang-code {
        max-height: calc(35vh - 50px);
        font-size: 0.65rem;
    }
}

.qlang-cursor {
    color: #4A43D1;
    animation: cursorBlink 1s step-end infinite;
}

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

/* Radial Mobile Nav — Floating action button */
.radial-nav { display: none; }

@media (max-width: 768px) {
    .radial-nav {
        display: block;
        position: fixed;
        bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
        right: 1rem;
        z-index: 90;
    }
    .radial-trigger {
        width: 52px; height: 52px;
        border-radius: 50%;
        background: linear-gradient(135deg, #4A43D1, #8B5CF6);
        border: none;
        color: #fff;
        font-family: 'JetBrains Mono', monospace;
        font-size: 1.2rem;
        font-weight: 700;
        cursor: pointer;
        box-shadow: 0 4px 20px rgba(74, 67, 209, 0.4);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                    box-shadow 0.3s ease;
        will-change: transform;
        min-width: 48px; min-height: 48px;
    }
    .radial-trigger:active { transform: scale(0.92); }
    .radial-trigger[aria-expanded="true"] {
        transform: rotate(45deg);
        box-shadow: 0 4px 30px rgba(74, 67, 209, 0.6);
    }
    .radial-items {
        position: absolute;
        bottom: 64px; right: 2px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        opacity: 0;
        pointer-events: none;
        transform: translateY(10px) scale(0.9);
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        will-change: transform, opacity;
    }
    .radial-trigger[aria-expanded="true"] + .radial-items {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }
    .radial-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 14px;
        background: rgba(5, 5, 10, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(74, 67, 209, 0.25);
        border-radius: 8px;
        color: #E0E0E0;
        text-decoration: none;
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.7rem;
        white-space: nowrap;
        min-height: 44px;
        transition: border-color 0.15s ease, background 0.15s ease;
    }
    .radial-item:hover,
    .radial-item:active {
        border-color: #4A43D1;
        background: rgba(74, 67, 209, 0.12);
    }
    .radial-icon {
        width: 24px; height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(74, 67, 209, 0.2);
        border-radius: 6px;
        font-size: 0.8rem;
    }
}

/* Canvas Containers — Singularity, Sovereign Core, Nebula, ZKP, Glassmorphic */
.singularity-container,
.sovereign-core-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.singularity-container canvas,
.sovereign-core-container canvas {
    display: block;
    width: 100%; height: 100%;
    pointer-events: auto;
}

.nebula-section {
    position: relative;
    min-height: 500px;
    overflow: hidden;
}

.nebula-container {
    position: relative;
    width: 100%;
    height: clamp(400px, 50vh, 700px);
}

.nebula-container canvas {
    display: block;
    width: 100%; height: 100%;
    cursor: default;
}

.nebula-count {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: rgba(74, 67, 209, 0.5);
    letter-spacing: 0.1em;
    pointer-events: none;
}

.zkp-seal-section {
    position: relative;
    overflow: hidden;
}

.zkp-seal-container {
    position: relative;
    width: 100%;
    height: clamp(250px, 30vh, 400px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zkp-seal-container canvas {
    display: block;
    width: 100%; height: 100%;
}

.glassmorphic-section {
    position: relative;
}

/* GPU Acceleration — Hardware compositing */
.hover-lift,
.card-glass,
.kpi-card,
.offering-card,
.nebula-container,
.zkp-seal-container,
.sovereign-core-container,
.singularity-container,
.gn-card {
    will-change: transform;
}

/* Section reveal on scroll */
.reveal-section {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-section.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Touch Targets — 48px minimum per WCAG 2.2 */
@media (pointer: coarse) {
    .btn,
    .nav-link,
    .nav-cta,
    .qlang-nav-btn,
    .radial-item {
        min-height: 48px;
        min-width: 48px;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    .stat-item {
        min-height: 48px;
        padding: 12px 8px;
    }
}

/* Safe Area Insets — Notch-aware */
body {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

.footer {
    padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
}

/* Reduced Motion — Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .particle-container,
    .neural-orb,
    .data-stream,
    .stream-line,
    .sovereign-core-container,
    .singularity-container {
        display: none !important;
    }
    .reveal-section {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .qlang-cursor {
        animation: none;
    }
}

/* Print Styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    .no-print { display: none !important; }
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
    h1, h2, h3 { page-break-after: avoid; }
    img { max-width: 100% !important; page-break-inside: avoid; }
}
