@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap');

:root {
    --landing-bg: #08111f;
    --landing-panel: #0d1527;
    --landing-panel-strong: #121c31;
    --landing-border: rgba(148, 163, 184, 0.12);
    --landing-text: #f8fafc;
    --landing-muted: #94a3b8;
    --landing-accent: #5b8cff;
    --landing-header-height: 96px;
    --landing-header-x: 24px;
}

html {
    scroll-behavior: smooth;
    background: var(--landing-bg);
    margin: 0;
    padding: 0;
    height: 100%;
}

html.landing-active-root {
    background: 
        radial-gradient(circle at 50% 0%, rgba(91, 140, 255, 0.15), transparent 40rem),
        var(--landing-bg) !important;
}

section[id] {
    scroll-margin-top: calc(var(--landing-header-height) + 64px);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background: var(--landing-bg);
    color: var(--landing-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.modal-open {
    overflow: hidden !important;
}

#landingPage.landing-page {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: clip;
    color: var(--landing-text);
    opacity: 1 !important;
    visibility: visible !important;
}

body.landing-active {
    background: 
        radial-gradient(circle at 50% 0%, rgba(91, 140, 255, 0.15), transparent 40rem),
        var(--landing-bg) !important;
    background-attachment: fixed;
}

#landingPage h1,
#landingPage h2,
#landingPage h3 {
    letter-spacing: 0 !important;
}

#landingPage img {
    max-width: 100%;
}

.glass {
    background: rgba(13, 21, 39, 0.74);
    border: 1px solid var(--landing-border);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.text-gradient {
    background: linear-gradient(90deg, #f8fafc 0%, #cbd5e1 52%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

summary::-webkit-details-marker {
    display: none;
}

summary {
    list-style: none;
}

.nav-link {
    position: relative;
}

.nav-link::after {
    position: absolute;
    bottom: -8px;
    left: 50%;
    width: 0;
    height: 2px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    content: '';
    transform: translateX(-50%);
    transition: width 180ms ease;
}

.nav-link.text-white::after {
    width: 12px;
}

/* Stable landing header. Geometry never changes during scroll. */
.landing-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 50;
    display: flex;
    height: auto;
    min-height: var(--landing-header-height);
    align-items: flex-start;
    justify-content: center;
    padding: env(safe-area-inset-top, 0px) var(--landing-header-x) 0;
    pointer-events: none;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    contain: layout paint style;
}

.landing-header-inner {
    display: flex;
    width: 100%;
    max-width: 100%;
    height: var(--landing-header-height);
    align-items: center;
    justify-content: space-between;
    margin: 0 auto;
    padding: 0 32px;
    border: none;
    border-radius: 24px;
    background: transparent;
    box-shadow: none;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
    transition:
        max-width 600ms ease-in-out,
        height 400ms cubic-bezier(0.4, 0, 0.2, 1),
        padding 400ms cubic-bezier(0.4, 0, 0.2, 1),
        background-color 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
    will-change: max-width, height, padding, background-color, border-color, box-shadow;
}

#mainHeader.is-scrolled {
    padding-top: 12px;
}

#mainHeader.is-scrolled #headerInner {
    max-width: 1240px;
    height: 68px;
    padding: 0 24px;
    background: rgba(8, 17, 31, 0.3);
    box-shadow: none;
    -webkit-backdrop-filter: blur(32px);
    backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#headerInner > .flex-1 {
    min-width: 0;
}

#headerInner a,
#headerInner button {
    -webkit-tap-highlight-color: transparent;
}

.header-login-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    min-height: 40px;
}

/* Auth overlay integration */
#authOverlay.active {
    display: flex !important;
}

.auth-tab.active {
    background: var(--landing-accent);
    color: #ffffff;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

/* Multiselect / instrument selector */
.custom-multiselect {
    position: relative;
    width: 100%;
}

.multiselect-trigger {
    display: flex;
    min-height: 52px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.65rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 1rem;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.multiselect-trigger:hover {
    border-color: rgba(91, 140, 255, 0.5);
    background: rgba(0, 0, 0, 0.3);
}

.multiselect-badges {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.multiselect-badge {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(91, 140, 255, 0.2);
    color: var(--landing-accent);
    font-size: 0.75rem;
    font-weight: 700;
}

.multiselect-arrow {
    padding-top: 0.2rem;
    color: #64748b;
    font-size: 0.8rem;
}

.multiselect-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    z-index: 200;
    display: none;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 1rem;
    background: var(--landing-panel);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.multiselect-menu.show {
    display: block;
}

.multiselect-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease;
}

.multiselect-option:hover {
    background: rgba(91, 140, 255, 0.1);
    color: #ffffff;
}

.multiselect-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.multiselect-option-indicator {
    display: flex;
    width: 1.1rem;
    height: 1.1rem;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.35rem;
    background: rgba(0, 0, 0, 0.2);
}

.multiselect-option input[type="checkbox"]:checked + .multiselect-option-indicator {
    border-color: var(--landing-accent);
    background: var(--landing-accent);
}

.multiselect-option input[type="checkbox"]:checked + .multiselect-option-indicator::after {
    color: #ffffff;
    content: '✓';
    font-size: 0.7rem;
    font-weight: 700;
}

.multiselect-option-label {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Validation feedback */
.is-warning {
    color: #ef4444 !important;
}

.is-success {
    color: #4ade80 !important;
}

/* -------------------------------------------------------------------------- */
/* GLOBAL CARD HOVER SYSTEM                                                   */
/* -------------------------------------------------------------------------- */

.capability-card, 
.feature-block, 
.edge-card, 
.profi-feature-item {
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.capability-card:hover, 
.feature-block:hover, 
.edge-card:hover, 
.profi-feature-item:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(91, 140, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.capability-card::before,
.feature-block::before,
.edge-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(91, 140, 255, 0.08), transparent 40%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    z-index: 0;
}

.capability-card:hover::before,
.feature-block:hover::before,
.edge-card:hover::before {
    opacity: 1;
}

.feature-img-wrapper {
    position: relative;
    border-radius: 2rem;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.05) 100%);
}

.feature-img-wrapper img {
    border-radius: calc(2rem - 1px);
}

.text-gradient {
    background: linear-gradient(135deg, #FFFFFF 0%, #CBD5E1 50%, #94A3B8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    padding-bottom: 0.15em;
    margin-bottom: -0.15em;
}

.glow-mesh {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(at 0% 0%, rgba(91, 140, 255, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* -------------------------------------------------------------------------- */
/* REFINED LANDING STYLES                                                     */
/* -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    :root {
        --landing-header-height: 72px;
        --landing-header-x: 12px;
    }

    main > section {
        padding-top: 5rem !important;
        padding-bottom: 5rem !important;
    }

    .landing-header-inner {
        height: 56px;
        min-height: 56px;
        padding: 0 14px;
        border-radius: 18px;
    }

    #mainHeader.is-scrolled #headerInner {
        background: rgba(8, 17, 31, 0.65);
        backdrop-filter: blur(24px);
    }

    #hero h1 {
        font-size: 2.75rem !important;
        line-height: 1.1 !important;
    }

    #hero p {
        font-size: 1.1rem !important;
        margin-bottom: 2.5rem !important;
    }

    .capability-card {
        padding: 1.5rem !important;
    }
}

/* Ensure smooth reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Carousel Optimization */
.animate-loop-scroll {
    display: flex;
    width: fit-content;
    animation: loop-scroll 40s linear infinite;
}

@keyframes loop-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@media (max-width: 768px) {
    .animate-loop-scroll {
        animation-duration: 25s;
    }
}

/* -------------------------------------------------------------------------- */
/* GLOBAL MOBILE & TABLET OVERRIDES                                           */
/* -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .header-register-btn { display: none !important; }
}

@media (max-width: 768px) {
    :root {
        --landing-header-height: 64px;
        --landing-header-x: 16px;
    }

    .landing-header {
        display: flex !important;
        padding-top: env(safe-area-inset-top, 0px);
    }

    .landing-header-inner {
        background: transparent !important;
        border: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        padding: 0 12px !important;
        height: 64px !important;
    }

    #mainHeader.is-scrolled {
        padding-top: 8px;
    }

    #mainHeader.is-scrolled #headerInner {
        height: 60px !important;
        background: rgba(8, 17, 31, 0.45) !important;
        backdrop-filter: blur(24px) !important;
        -webkit-backdrop-filter: blur(24px) !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
        box-shadow: none !important;
    }

    /* Revert to original logo/button proportions but ensure they fit */
    .landing-header-inner img:first-child { height: 34px !important; }
    .header-login-btn { 
        min-height: 36px !important; 
        font-size: 10px !important;
        background: rgba(255, 255, 255, 0.04) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        color: white !important;
    }

    #hero {
        padding-top: 8rem !important;
    }

    #landingPage h1 { font-size: 2rem !important; line-height: 1.1 !important; }
    #landingPage h2 { font-size: 1.5rem !important; line-height: 1.2 !important; }
    #landingPage h3 { font-size: 1.2rem !important; }
    #landingPage p { font-size: 0.85rem !important; opacity: 0.8; }

    .py-32, .py-24 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
    
    .hero-btn { 
        width: 100% !important; 
        padding: 0.75rem 1rem !important; 
        font-size: 0.9rem !important;
        border-radius: 1rem !important;
    }

    /* Ultra Compact Carousel */
    .animate-loop-scroll > div { width: 65vw !important; padding: 0 0.25rem !important; }
    .animate-loop-scroll img { height: 240px !important; border-radius: 1rem !important; }
    .animate-loop-scroll .absolute.inset-0.p-8 { padding: 1.25rem !important; }
    .animate-loop-scroll .text-accent-secondary { font-size: 8px !important; margin-bottom: 0.25rem !important; }
    .animate-loop-scroll .text-3xl, .animate-loop-scroll .text-4xl { font-size: 1.25rem !important; line-height: 1.1 !important; }
    .animate-loop-scroll .absolute.bottom-10 { bottom: 1.5rem !important; padding: 0 1rem !important; }

    /* Ultra Compact Feature Hub */
    .feature-hub-container {
        height: 280px !important;
        max-width: 280px !important;
        margin-bottom: 3rem !important;
    }
    .feature-hub-container .w-32 { width: 5rem !important; height: 5rem !important; }
    .feature-hub-container .hub-item .p-4 { padding: 0.5rem !important; border-radius: 0.75rem !important; }
    .feature-hub-container .hub-item i { width: 1rem !important; height: 1rem !important; }

    /* Ultra Compact CTA Area */
    section#reasons .mt-32 {
        margin-top: 2rem !important;
        padding: 1.5rem 1rem !important;
        border-radius: 1.5rem !important;
    }
    section#reasons .mt-32 h2 { font-size: 1.4rem !important; margin-bottom: 0.5rem !important; }
    section#reasons .mt-32 p { font-size: 0.75rem !important; margin-bottom: 1rem !important; }
    section#reasons .mt-32 button { padding: 0.65rem 1.25rem !important; font-size: 0.8rem !important; }

    /* Cards */
    .feature-block, .capability-card, .edge-card, .profi-feature-item {
        padding: 1rem !important;
        border-radius: 1rem !important;
    }

    /* Keyboard Optimization for Auth Overlay */
    #authOverlay {
        align-items: flex-start !important;
        padding-top: max(2rem, env(safe-area-inset-top) + 1rem) !important;
        overflow-y: auto !important;
    }

    .auth-white-card {
        margin-top: 0 !important;
        max-height: none !important;
        height: auto !important;
        margin-bottom: 5rem !important; /* Space for keyboard */
    }

    .auth-form-container {
        max-height: 60vh !important;
        min-height: 320px !important;
    }
}

/* -------------------------------------------------------------------------- */
/* HUB ORBITAL ANIMATION                                                      */
/* -------------------------------------------------------------------------- */

/* Hub Rotation System (Handled by JS for stability) */
.hub-orbital-wrapper, .hub-item > div {
    transition: transform 0.1s linear;
}

/* Pause on hover (JS will handle this, but keeping classes for now) */
.hub-item:hover {
    scale: 1.15;
    z-index: 50;
}

.hub-item {
    pointer-events: auto;
    transition: scale 0.3s ease;
}

.hub-item:hover {
    scale: 1.15;
    z-index: 50;
}

/* Hub Tooltip System */
.hub-tooltip {
    position: absolute;
    top: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(13, 21, 39, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    padding: 0.75rem 1.25rem;
    border-radius: 1rem;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

/* Smart Positioning: Avoid the center logo */
.tooltip-left .hub-tooltip {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(10px);
}

.tooltip-right .hub-tooltip {
    left: 0;
    transform: translateX(0) translateY(10px);
}

.hub-item:hover .hub-tooltip,
.hub-item.active-tooltip .hub-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.tooltip-left:hover .hub-tooltip,
.tooltip-left.active-tooltip .hub-tooltip {
    transform: translateX(0) translateY(0);
}

.tooltip-right:hover .hub-tooltip,
.tooltip-right.active-tooltip .hub-tooltip {
    transform: translateX(0) translateY(0);
}
