/*
 * LANDING PAGE CSS
 *
 * This file styles the public landing page.
 *
 * Theme Implementation Note:
 * The landing page uses system-preference-based dark mode (no user selection)
 * because it's for non-authenticated users who don't have UserSettings.
 *
 * This is implemented using CSS @media (prefers-color-scheme: dark) queries,
 * which automatically detect the user's operating system theme preference.
 *
 * Contrast with components.css:
 *   - components.css uses [data-theme="dark"] attribute selector for user-controlled themes
 *   - landing.css uses @media queries for automatic system-based theming
 */

:root {
    /*
     * Theme-Agnostic Brand Colors
     * These remain the SAME in both light and dark modes.
     */
    --primary-sage: #728c69;
    --primary-light: #8fa886;
    --primary-dark: #5a704f;
    --success-sage: #9eb594;
    --warning-terracotta: #d4a574;
    --error-brick: #b86565;

    /*
     * Neutral Color Palette
     * Base colors used to create semantic theme variables.
     */
    --neutral-50: #faf9f6;
    --neutral-100: #f5f4f0;
    --neutral-200: #e8e6df;
    --neutral-300: #d4d0c4;
    --neutral-400: #b8b2a5;
    --neutral-500: #9a9285;
    --neutral-600: #7d7568;
    --neutral-700: #5f584e;
    --neutral-800: #453f38;
    --neutral-900: #2e2a25;
    --neutral-950: #1a1815;

    /*
     * Light Theme (default) - Semantic Variables
     * Applied when user's OS preference is light mode or not specified.
     */
    --bg-primary: var(--neutral-50);
    --bg-secondary: white;
    --bg-tertiary: #f0ede5;
    --text-primary: var(--neutral-800);
    --text-secondary: var(--neutral-600);
    --border-primary: var(--neutral-200);
    --shadow-light: 0 2px 20px rgba(0,0,0,0.05);
    --shadow-medium: 0 15px 40px rgba(0,0,0,0.1);
}

/*
 * Dark Theme - System Preference Only
 *
 * Uses CSS media query to automatically detect OS dark mode preference.
 * This approach is used because the landing page serves unauthenticated users
 * who don't have UserSettings to store their theme preference.
 *
 * To manually test: Change your OS appearance setting to "Dark"
 *
 * Note: The authenticated application (components.css) uses [data-theme="dark"]
 * attribute selector instead, allowing users to override system preference.
 */
@media (prefers-color-scheme: dark) {
    :root {
        /* Background Colors - Dark Theme */
        --bg-primary: var(--neutral-900);
        --bg-secondary: var(--neutral-800);
        --bg-tertiary: var(--neutral-700);

        /* Text Colors - Dark Theme */
        --text-primary: var(--neutral-100);
        --text-secondary: var(--neutral-300);

        /* Border Colors - Dark Theme */
        --border-primary: var(--neutral-600);

        /* Shadows - Dark Theme (higher opacity for visibility) */
        --shadow-light: 0 2px 20px rgba(0,0,0,0.3);
        --shadow-medium: 0 15px 40px rgba(0,0,0,0.5);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
    overflow-x: hidden;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    z-index: 1000;
    box-shadow: var(--shadow-light);
}

/* Dark mode navigation background override */
@media (prefers-color-scheme: dark) {
    nav {
        background: rgba(69, 63, 56, 0.95); /* --neutral-800 with opacity */
    }
}

.nav-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-sage);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
    font-size: 0.9rem;
}

.nav-links a:hover {
    color: var(--primary-sage);
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-sage);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(114, 140, 105, 0.3);
}

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

.btn-secondary:hover {
    background: var(--primary-sage);
    color: white;
}

/* Hero Section */
.hero {
    margin-top: 60px;
    padding: 2rem 1.5rem;
    min-height: 70vh;
    display: flex;
    align-items: center;
    position: relative;
}

.hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23728c69' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}

.hero-container {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero-content .accent {
    color: var(--primary-sage);
}

.hero-content p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.hero-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

/* Dark mode hero stats background override */
@media (prefers-color-scheme: dark) {
    .hero-stats {
        background: rgba(69, 63, 56, 0.8); /* --neutral-800 with opacity */
    }
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-sage);
    display: block;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Hero Visual */
.hero-visual {
    position: relative;
    height: 400px;
}

.money-flow-demo {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow-medium);
    position: relative;
    height: 100%;
    overflow: hidden;
}

.demo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--neutral-200);
}

.demo-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.demo-entity {
    background: var(--primary-sage);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 15px;
    font-size: 0.75rem;
}

/* Money Flow Animation */
.flow-container {
    position: relative;
    height: 300px;
    margin-top: 1.5rem;
}

.flow-lines-svg {
    position: absolute;
    top: 80px;
    left: 0;
    width: 100%;
    height: 150px;
    z-index: 1;
}

.flow-source {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--success-sage) 0%, var(--primary-sage) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 6px 20px rgba(114, 140, 105, 0.3);
    z-index: 10;
}

.flow-source-amount {
    display: block;
    font-size: 0.8rem;
    opacity: 0.9;
}

.flow-categories {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.flow-category {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
    padding: 0.75rem;
    border-radius: 10px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.flow-category::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, var(--primary-light), transparent);
    animation: rotate 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.flow-category:hover::before {
    opacity: 0.1;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

.category-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    font-size: 0.85rem;
}

.category-amount {
    color: var(--primary-sage);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Features Section */
.features {
    padding: 4rem 1.5rem;
    background: var(--bg-secondary);
}

.features-container {
    max-width: 1000px;
    margin: 0 auto;
}

.features h2 {
    text-align: center;
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

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

.feature-card {
    text-align: center;
    padding: 1.5rem;
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.feature-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-sage) 0%, var(--primary-light) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.2rem;
    color: white;
}

.feature-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.feature-description {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.9rem;
}

/* CTA Section */
.cta {
    padding: 4rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-sage) 0%, var(--primary-dark) 100%);
    color: white;
    text-align: center;
}

.cta h2 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.cta p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.cta .btn {
    background: white;
    color: var(--primary-sage);
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
}

.cta .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* Footer */
footer {
    background: var(--neutral-900);
    color: var(--neutral-300);
    padding: 2rem 1.5rem 1rem;
}

/* Dark mode footer - even darker for visual separation */
@media (prefers-color-scheme: dark) {
    footer {
        background: var(--neutral-950);
        color: var(--neutral-400);
    }
}

.footer-container {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.footer-section h3 {
    color: white;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

/* Dark mode footer heading - slightly darker than pure white */
@media (prefers-color-scheme: dark) {
    .footer-section h3 {
        color: var(--neutral-100);
    }
}

.footer-section a {
    color: var(--neutral-400);
    text-decoration: none;
    display: block;
    margin-bottom: 0.4rem;
    transition: color 0.3s ease;
    font-size: 0.85rem;
}

/* Dark mode footer links - lighter for better visibility */
@media (prefers-color-scheme: dark) {
    .footer-section a {
        color: var(--neutral-500);
    }
}

.footer-section a:hover {
    color: var(--primary-sage);
}

.footer-bottom {
    border-top: 1px solid var(--neutral-700);
    padding-top: 1.5rem;
    text-align: center;
    color: var(--neutral-500);
    font-size: 0.85rem;
}

/* Dark mode footer bottom border and text */
@media (prefers-color-scheme: dark) {
    .footer-bottom {
        border-top-color: var(--neutral-800);
        color: var(--neutral-600);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .hero-visual {
        height: 300px;
    }

    .flow-categories {
        grid-template-columns: 1fr;
    }

    .features h2 {
        font-size: 1.5rem;
    }
}