/* ---------------------------------- */
/* 1. Core Reset & Variables          */
/* ---------------------------------- */

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

:root {
    /* Light Theme (Default) */
    --primary: #0066cc;
    --primary-dark: #004499;
    --secondary: #7c3aed;
    --accent: #009933;
    --dark: #f8fafc;
    --darker: #f1f5f9;
    --light: #0f172a;
    --gray: #64748b;
    --panel: rgba(255, 255, 255, 0.9);
    --glass: rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --transition: cubic-bezier(0.4, 0, 0.2, 1);
    --text: #0f172a;
    --muted: #475569;
    --bg: #ffffff;
    --error-color: #ff6b6b;
    /* Ripple Effect */
    --ripple-bg: #f1f5f9;
    --ripple-sm: rgba(0, 102, 204, 0.65);
    --ripple-md: rgba(124, 58, 237, 0.35);
    --ripple-lg: rgba(0, 153, 51, 0.4);  
}

/* Dark theme override */
.theme-dark {
    --primary: #00d4ff;
    --primary-dark: #0099cc;
    --secondary: #7c3aed;
    --accent: #00ff88;
    --dark: #0a0a1a;
    --darker: #050511;
    --light: #f0f8ff;
    --gray: #a0aec0;
    --panel: rgba(15, 23, 42, 0.9);
    --glass: rgba(255, 255, 255, 0.05);
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.3);
    --text: #f0f8ff;
    --muted: #cbd5e1;
    --bg: #0a0a1a;
    --error-color: #ff6b6b;
    /* Ripple Effects */
    --ripple-bg: rgb(15, 23, 42);
    --ripple-sm: rgba(0, 212, 255, 0.4);
    --ripple-md: rgba(124, 58, 237, 0.3);
    --ripple-lg: rgba(0, 255, 136, 0.25);
}

/* Theme transition helper */
* { 
    transition: background-color .28s var(--transition), 
                color .28s var(--transition), 
                border-color .28s var(--transition),
                box-shadow .28s var(--transition);
}

/* Theme toggle button (small pill) */
.theme-toggle {
    display:flex;
    flex-direction: column;
    align-items:center;
    gap:8px;
    margin-left: auto;
    padding:6px 10px;
    border-radius:999px;
    border:1px solid var(--glass);
    background:transparent;
    cursor:pointer;
    color:var(--muted);
    font-weight:700;
}
.theme-toggle svg { 
    width:16px; 
    height:16px; 
    display:block;
}
.theme-toggle[aria-pressed="true"] {
    color: var(--text);
    background: linear-gradient(90deg, var(--accent), var(--primary));
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

/* ---------------------------------- */
/* 2. Base Page & Typography          */
/* ---------------------------------- */

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-fallback);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.theme-dark body {
    background: 
        radial-gradient(1200px 400px at 10% 10%, rgba(0, 212, 255, 0.02), transparent),
        linear-gradient(180deg, var(--darker) 0%, var(--dark) 100%);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text);
    font-family: var(--font-secondary);
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }

p { margin-bottom: 1rem; }

a {
    color: var(--muted);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--text);
}

/* ---------------------------------- */
/* 3. Layout & Structure              */
/* ---------------------------------- */

/* Global Content Wrapper */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Main Application Container */
main#app {
    padding-top: 100px;
    min-height: calc(100vh - 160px);
}

/* Utility Padding */
.section-padding {
    padding: 3rem 0;
}

/* Section Title */
.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    text-align: center;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-secondary);
}

.section-subtitle {
    font-size: 1.25rem;
    color: var(--muted);
    margin-top: -3rem; /* To counter the section-title margin when they both exist*/
    margin-bottom: 40px;
    text-align: center;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--muted);
    margin-bottom: 10px;
    text-align: center;
}

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

/* ---------------------------------- */
/* 4. Navigation                      */
/* ---------------------------------- */

.navbar {
    position: fixed;
    top: 10px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--panel);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-lg);
    z-index: 1200;
    border: 1px solid var(--glass);
}

.nav-logo a {
    color: var(--text);
    font-weight: 700;
    letter-spacing: .2px;
    font-family: var(--font-secondary);
}

.navbar > div:last-child {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-menu {
    display: flex;
    gap: 18px;
    align-items: center;
}

.nav-link {
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 8px;
    transition: var(--transition);
    font-family: var(--font-fallback);
}

.nav-link.active {
    color: var(--primary);
    font-weight: 700;
    background: var(--glass);
}

.nav-link:hover {
    color: var(--text);
    background: var(--glass);
}

/* Mobile / Responsive Nav */
.nav-toggle {
    display: flex;
    flex-direction: column;
    background:transparent;
    border:0;
    padding:8px;
    border-radius:8px;
    cursor:pointer;
}
.nav-toggle .bar {
    display:block;
    width:22px;
    height:2px;
    background:var(--muted);
    margin:4px 0;
    border-radius:2px;
    transition: transform .22s ease, opacity .22s ease;
}

/* Mobile layout */
@media (max-width:980px) {
    .nav-menu {
        position:fixed;
        top:72px;
        right:20px;
        left:20px;
        background:var(--panel);
        border-radius:12px;
        padding:12px;
        display:flex;
        flex-direction:column;
        gap:8px;
        box-shadow:var(--shadow-lg);
        transform-origin: top right;
        transform: scaleY(0);
        opacity:0;
        pointer-events:none;
        transition: transform .28s var(--transition), opacity .22s var(--transition);
        z-index:1200;
        border: 1px solid var(--glass);
    }
    .nav-menu.active {
        transform: scaleY(1);
        opacity:1;
        pointer-events:auto;
    }
    .nav-link {
        padding:10px 12px;
        display:block;
    }

    .nav-menu:not(.active) {
        transform: scaleY(0);
        opacity:0;
        pointer-events:none;
    }

    .nav-toggle {
        display:inline-flex;
    }
    
    .navbar > div:last-child {
        gap: 12px;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(10px) rotate(45deg);
    }
    .nav-toggle.active .bar:nth-child(2) {
        opacity:0; transform: scaleX(0);
    }
    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-10px) rotate(-45deg);
    }
}

@media (min-width:981px) {
   .nav-menu {
        position: static;
        transform: none;
        opacity: 1;
        pointer-events: auto;
        background: transparent;
        padding: 0;
        gap: 18px;
        flex-direction: row;
        box-shadow: none;
   }
   .nav-toggle {
        display: none;
   }
}

/* ---------------------------------- */
/* 5. Buttons                         */
/* ---------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s var(--transition);
    cursor: pointer;
    border: none;
    font-family: var(--font-fallback);
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--glass);
}

.btn-ghost:hover {
    background: var(--glass);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--glass);
    border-color: var(--primary-dark);
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ---------------------------------- */
/* 6. Cards & Elements                */
/* ---------------------------------- */

.card {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--glass);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

/* ---------------------------------- */
/* 8. Animations & Loaders            */
/* ---------------------------------- */

/* Spinner/Loading */
.spinner-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 6px solid var(--glass);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 900ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-label {
    color: var(--muted);
    font-size: .9rem;
    margin-left: 10px;
}

.spinner-fade-out {
    opacity: 0;
    transition: opacity .35s ease;
}

/* Reveal Animations (for scroll-based effects) */
.will-reveal, .will-reveal-left, .will-reveal-right {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s var(--transition), transform .6s var(--transition);
    will-change: transform, opacity;
}
.will-reveal-left { transform: translateX(-28px); }
.will-reveal-right { transform: translateX(28px); }

.will-reveal.in-view,
.will-reveal-left.in-view,
.will-reveal-right.in-view {
    opacity: 1;
    transform: translateX(0) translateY(0);
}

/* Page Transitions */
#app.page-enter { transform: translateX(12px); opacity: 0; }
#app.page-enter.page-enter-active {
    transform: none;
    opacity: 1;
    transition: all .42s var(--transition);
}
#app.page-exit { transform: none; opacity: 1; }
#app.page-exit.page-exit-active {
    transform: translateX(-12px);
    opacity: 0;
    transition: all .36s var(--transition);
}

/* ---------------------------------- */
/* 9. 404 Not Found Page              */
/* ---------------------------------- */

.not-found-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.error-box {
    max-width: 500px;
    margin-bottom: 20px;
}

.error-code {
    font-family: var(--font-mono);
    font-size: clamp(3rem, 10vw, 5rem);
    font-weight: 800;
    color: var(--error-color);
    margin-bottom: 5px;
    letter-spacing: 5px;
}

.error-icon {
    width: 100px;
    height: 100px;
    margin: 20px 0 0;
    stroke: var(--error-color);
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.8; transform: scale(1); }
    to { opacity: 1; transform: scale(1.03); }
}

.error-box h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 700;
    color: var(--text);
    margin: 0 0 10px;
}

/* ---------------------------------- */
/* 10. Service Worker Update Bar   */
/* ---------------------------------- */

#sw-update-bar {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-90%) translateY(-40px);
    background: var(--ripple-bg);
    color: var(--text);
    padding: 12px 22px;
    border-radius: 8px;
    opacity: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    z-index: 9999;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: slideIn 0.3s forwards;
    min-width: 300px;
}

/* Show animation (slide down) */
#sw-update-bar.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    animation: ripple-border 1s infinite;
}

/* Ripple effect using border-color from CSS vars */
@keyframes ripple-border {
    0%, 100% { border-color: var(--ripple-sm); }
    25% { border-color: var(--ripple-md); }
    50% { border-color: var(--ripple-lg); }
    75% { border-color: var(--ripple-md); }
}

/* Slide up on hide */
#sw-update-bar.hide {
    transform: translateX(-50%) translateY(-40px);
    opacity: 0;
}

/* ---------------------------------- */
/* 11. Footer                         */
/* ---------------------------------- */

.footer {
    padding: 36px 0;
    color: var(--muted);
    background: var(--darker);
    border-top: 1px solid var(--glass);
}

.footer .footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}

.footer .social-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

