:root {
    /* Brand Colors */
    --primary: #00d2ff;
    --secondary: #9d50bb;
    --accent-glow: rgba(0, 210, 255, 0.3);

    /* Dark Theme (Default) */
    --bg-main: #020617;
    --bg-secondary: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --nav-bg: rgba(2, 6, 23, 0.8);
    --border-color: #1e293b;

    /* Logo colors */
    --logo-text: #ffffff;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-main: #f8fafc;
        --bg-secondary: #f1f5f9;
        --bg-card: #ffffff;
        --text-main: #0f172a;
        --text-muted: #475569;
        --glass-bg: rgba(255, 255, 255, 0.7);
        --glass-border: rgba(0, 0, 0, 0.1);
        --nav-bg: rgba(248, 250, 252, 0.8);
        --border-color: #e2e8f0;
        --accent-glow: rgba(0, 210, 255, 0.1);

        --logo-text: #0f172a;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Glassmorphism Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* Navigation */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.5rem 0;
    transition: all 0.4s ease;
    /* Default to white text over hero */
    --nav-text: #ffffff;
    --logo-color: #ffffff;
}

#main-nav.scrolled {
    padding: 0.75rem 0;
    background: var(--nav-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--glass-border);
    /* Switch to theme text color when scrolled */
    --nav-text: var(--text-main);
    --logo-color: var(--logo-text);
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    height: 50px;
    transition: height 0.4s ease;
}

/* Ensure children use the dynamic nav-color */
.nav-logo,
.nav-logo * {
    --logo-text: var(--logo-color);
}

#main-nav.scrolled .nav-logo {
    height: 40px;
}

.links .btn {
    color: var(--nav-text) !important;
    /* Ensure it stays white over hero regardless of theme */
    margin-left: 1rem;
}

/* Back to Top */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    background: var(--bg-card);
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    background: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 210, 255, 0.2);
}

.footer-logo {
    height: 40px;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    padding: 60px 0;
}

.segmented-section {
    display: none !important;
    opacity: 0;
}

.segmented-section.active {
    display: block !important;
    opacity: 1;
    animation: fadeIn 0.5s ease forwards;
}

.tab-link {
    position: relative;
    opacity: 0.7;
}

.tab-link.active {
    opacity: 1 !important;
    font-weight: 800;
}

.tab-link::after {
    content: '';
    position: absolute;
    bottom: 0px;
    left: 1.5rem;
    right: 1.5rem;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 10px;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.tab-link.active::after {
    transform: scaleX(1);
}

/* Fix for Hero button not needing the underline */
.btn-primary.tab-link::after {
    display: none;
}

/* Hero Section */
#hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    background: radial-gradient(circle at top right, rgba(0, 210, 255, 0.1), transparent),
        radial-gradient(circle at bottom left, rgba(157, 80, 187, 0.1), transparent);
    background-image: url('ncsystems_hero_bg.png');
    background-size: cover;
    background-position: center;
    /* Force white text in hero regardless of theme */
    color: white;
}

#hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--bg-main));
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 800px;
}

.hero-content h1 {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 600px;
}

#hero .hero-content p {
    color: rgba(255, 255, 255, 0.8);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 210, 255, 0.3);
}

/* Service Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--bg-secondary);
    padding: 2.5rem;
    transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    border: 1px solid var(--glass-border);
}

.card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    background: var(--bg-card);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.card p {
    color: var(--text-muted);
}

.site-footer {
    padding: 4rem 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate {
    animation: fadeIn 1s ease forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }
}