/* ============================================
   BASE STYLES - Shared across all apps
   Theme system, layout, navigation, and footer
   ============================================ */

:root {
    color-scheme: dark;

    /* Typography */
    --font-display: 'Outfit', 'Space Grotesk', sans-serif;
    --font-body: 'Plus Jakarta Sans', 'Inter', sans-serif;
    --font-code: 'JetBrains Mono', monospace;

    /* Radius + spacing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 999px;
    --nav-height: 68px;

    /* Night palette (default) */
    --color-bg-deep: #070f1f;
    --color-bg-surface: #111d33;
    --color-bg-elevated: #182744;
    --color-bg-elevated-strong: #203357;
    --color-surface-2: var(--color-bg-elevated);

    --color-accent: #7eb4ff;
    --color-accent-hover: #a2c9ff;

    --color-text-heading: #f3f7ff;
    --color-text-main: #d1dcf3;
    --color-text-muted: #8ea4ca;
    --color-text: var(--color-text-main);

    --color-border: #2a3f63;
    --color-border-soft: rgba(142, 164, 202, 0.24);
    --color-border-subtle: rgba(142, 164, 202, 0.14);

    --color-overlay-heavy: rgba(255, 255, 255, 0.2);
    --color-overlay-strong: rgba(255, 255, 255, 0.12);
    --color-overlay-medium: rgba(255, 255, 255, 0.1);
    --color-overlay-soft: rgba(255, 255, 255, 0.08);
    --color-overlay-subtle: rgba(255, 255, 255, 0.06);
    --color-overlay-faint: rgba(255, 255, 255, 0.04);

    --color-success: #4caf50;
    --color-success-strong: #4ade80;
    --color-danger: #f87171;
    --color-danger-strong: #ff6b6b;
    --color-warning: #ff9800;
    --color-info: #2196f3;
    --color-violet: #9c27b0;

    --color-chart-grid: rgba(255, 255, 255, 0.12);
    --color-chart-tick: #8ea4ca;

    --shadow-soft: 0 10px 28px rgba(3, 8, 20, 0.25);
    --shadow-card: 0 16px 38px rgba(3, 8, 20, 0.35);
}

html[data-theme='light'] {
    color-scheme: light;

    --color-bg-deep: #edf3ff;
    --color-bg-surface: #ffffff;
    --color-bg-elevated: #f3f7ff;
    --color-bg-elevated-strong: #e5edfb;
    --color-surface-2: var(--color-bg-elevated);

    --color-accent: #1e63d6;
    --color-accent-hover: #2f76eb;

    --color-text-heading: #0f1f3a;
    --color-text-main: #253654;
    --color-text-muted: #5d7297;
    --color-text: var(--color-text-main);

    --color-border: #d4dff2;
    --color-border-soft: rgba(42, 63, 99, 0.2);
    --color-border-subtle: rgba(42, 63, 99, 0.12);

    --color-overlay-heavy: rgba(28, 45, 75, 0.2);
    --color-overlay-strong: rgba(28, 45, 75, 0.14);
    --color-overlay-medium: rgba(28, 45, 75, 0.12);
    --color-overlay-soft: rgba(28, 45, 75, 0.1);
    --color-overlay-subtle: rgba(28, 45, 75, 0.08);
    --color-overlay-faint: rgba(28, 45, 75, 0.05);

    --color-chart-grid: rgba(42, 63, 99, 0.16);
    --color-chart-tick: #5d7297;

    --shadow-soft: 0 10px 24px rgba(31, 53, 94, 0.1);
    --shadow-card: 0 16px 36px rgba(31, 53, 94, 0.16);
}

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

html,
body {
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at 90% -10%, rgba(126, 180, 255, 0.18), transparent 38%),
        radial-gradient(circle at 0% 0%, rgba(126, 180, 255, 0.12), transparent 44%),
        var(--color-bg-deep);
    color: var(--color-text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    padding-top: calc(var(--nav-height) + 2px);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: clip;
}

body::before,
body::after {
    content: '';
    position: fixed;
    pointer-events: none;
    z-index: -1;
    filter: blur(4px);
}

body::before {
    width: 46vw;
    height: 46vw;
    max-width: 620px;
    max-height: 620px;
    top: -22vh;
    left: -14vw;
    background: radial-gradient(circle, rgba(126, 180, 255, 0.26) 0%, rgba(126, 180, 255, 0) 68%);
    animation: ambientFloatA 20s ease-in-out infinite;
}

body::after {
    width: 40vw;
    height: 40vw;
    max-width: 560px;
    max-height: 560px;
    right: -14vw;
    bottom: -24vh;
    background: radial-gradient(circle, rgba(68, 128, 231, 0.2) 0%, rgba(68, 128, 231, 0) 70%);
    animation: ambientFloatB 22s ease-in-out infinite;
}

a {
    color: inherit;
}

main {
    padding: clamp(1.25rem, 2.4vw, 2rem) clamp(1rem, 3vw, 2.5rem) 3rem;
}

.ad-container {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-surface);
    min-height: 64px;
    margin: 1rem auto;
    padding: 0.4rem !important;
    overflow: hidden;
    text-align: center;
}

.adsbygoogle {
    background: transparent !important;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.adsbygoogle[data-ad-status='filled'] {
    opacity: 1;
}

.adsbygoogle[data-ad-status='unfilled'] {
    display: none !important;
}

.ad-container:has(.adsbygoogle[data-ad-status='unfilled']) {
    display: none !important;
}

.ad-container--pending {
    display: none !important;
}

.ad-container--hidden {
    display: none !important;
}

/* ============================================
   NAVIGATION
   ============================================ */

.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.nav-container {
    max-width: 1240px;
    margin: 0 auto;
    height: var(--nav-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    padding: 0 1.25rem;
}

.logo {
    font-family: var(--font-display);
    font-size: clamp(1.125rem, 1.2vw, 1.35rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--color-text-heading);
    text-decoration: none;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    flex: 1;
    min-width: 0;
}

.nav-links a {
    color: var(--color-text-main);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    padding: 0.45rem 0.78rem;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--color-text-heading);
    background: var(--color-overlay-faint);
}

.nav-links a.nav-active {
    color: var(--color-accent);
    background: var(--color-overlay-subtle);
}

.nav-profile-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.theme-toggle {
    border: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    color: var(--color-text-main);
    border-radius: var(--radius-pill);
    padding: 0.44rem 0.72rem;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.005em;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-overlay-faint);
}

.theme-toggle:focus-visible,
.nav-links a:focus-visible,
.auth-link:focus-visible,
.cta-button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-link {
    color: var(--color-text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: color 0.2s ease, background 0.2s ease;
    border-radius: var(--radius-pill);
}

.auth-link:hover {
    color: var(--color-accent);
}

.auth-link.user-name {
    color: var(--color-accent);
    padding: 0.35rem 0.15rem;
}

.auth-link.login-btn,
.profile-link {
    background: var(--color-accent);
    color: #ffffff;
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-pill);
}

.auth-link.login-btn:hover,
.profile-link:hover {
    background: var(--color-accent-hover);
    color: #ffffff;
}

.auth-link.logout-btn {
    color: var(--color-text-muted);
    padding: 0.35rem 0.15rem;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero-section {
    text-align: center;
    padding: clamp(3rem, 6.8vw, 4.4rem) clamp(1rem, 3vw, 2rem) clamp(2rem, 3.5vw, 2.8rem);
    background:
        linear-gradient(145deg, var(--color-bg-deep) 0%, var(--color-bg-surface) 56%, var(--color-bg-elevated) 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin: 0 auto;
    max-width: 1240px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-text-heading);
    margin-bottom: 0.85rem;
    line-height: 1.16;
}

.hero-subtitle {
    font-size: clamp(1.02rem, 2.2vw, 1.25rem);
    font-weight: 500;
    color: var(--color-text-main);
    margin: 0 auto 1.5rem;
    max-width: 760px;
}

.hero-buttons {
    display: flex;
    gap: 0.85rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */

.cta-button {
    background: var(--color-accent);
    color: #ffffff;
    padding: 0.82rem 1.4rem;
    border-radius: var(--radius-pill);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.005em;
    font-size: 0.95rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    display: inline-block;
}

.cta-button:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(66, 130, 218, 0.3);
}

.cta-secondary {
    background: transparent;
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
}

.cta-secondary:hover {
    background: var(--color-accent);
    color: #ffffff;
}

/* ============================================
   FEATURE CARDS
   ============================================ */

.features-section {
    padding: clamp(1.8rem, 3.5vw, 3rem) 0 0;
    max-width: 1240px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.15rem;
    margin-top: 1.35rem;
}

.features-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
}

.feature-card {
    background: var(--color-bg-surface);
    padding: 1.28rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card-link {
    text-decoration: none;
    display: block;
    color: inherit;
}

.feature-card-link:hover .feature-card,
.feature-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.feature-icon {
    width: 42px;
    height: 42px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.9rem;
    font-size: 1.3rem;
}

.feature-title {
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--color-text-heading);
    margin-bottom: 0.45rem;
}

.feature-description {
    color: var(--color-text-main);
    line-height: 1.55;
}

.feature-cta {
    display: inline-block;
    margin-top: 0.85rem;
    color: var(--color-accent);
    font-weight: 700;
    font-size: 0.84rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-text-heading);
    text-align: center;
    margin-bottom: 0.35rem;
}

.section-subtitle {
    color: var(--color-text-main);
    text-align: center;
    font-size: 1rem;
    max-width: 680px;
    margin: 0 auto;
}

/* ============================================
   FOOTER
   ============================================ */

.main-footer {
    background: var(--color-bg-surface);
    border-top: 1px solid var(--color-border);
    padding: 2.2rem 1rem 1.6rem;
    margin-top: 2.5rem;
}

.footer-content {
    max-width: 1240px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.4rem;
    margin-bottom: 1rem;
}

.footer-section h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-heading);
    margin-bottom: 0.65rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.35rem;
}

.footer-section ul li a {
    color: var(--color-text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-section ul li a:hover {
    color: var(--color-accent);
}

.footer-bottom {
    border-top: 1px solid var(--color-border-subtle);
    padding-top: 0.95rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.84rem;
}

/* ============================================
   ANIMATIONS + SHARED UTILS
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes ambientFloatA {
    0%, 100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(2vw, 3vh, 0) scale(1.08);
    }
}

@keyframes ambientFloatB {
    0%, 100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(-2vw, -2.5vh, 0) scale(1.06);
    }
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(126, 180, 255, 0.35);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    vertical-align: middle;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 960px) {
    .nav-links {
        gap: 0.18rem;
    }

    .nav-links a {
        padding: 0.4rem 0.6rem;
        font-size: 0.82rem;
    }

    .logo {
        font-size: 1.04rem;
    }

    .theme-toggle {
        padding: 0.42rem 0.6rem;
        font-size: 0.72rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 0;
    }

    .main-nav {
        position: static;
    }

    .nav-container {
        height: auto;
        padding: 0.9rem 0.95rem;
        flex-wrap: wrap;
        gap: 0.6rem;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .nav-profile-section {
        width: 100%;
        justify-content: center;
        gap: 0.6rem;
    }

    main {
        padding: 1rem 0.8rem 2.6rem;
    }

    .features-grid-2 {
        grid-template-columns: 1fr;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .cta-button {
        width: 100%;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    body::before,
    body::after {
        animation: none;
    }
}
