/* Reset and Base Styles */
:root {
    /* Color system */
    --bg: #f7f9fc;
    --text: #111827; /* slate-900 */
    --muted: #64748b; /* slate-500 */
    --surface: #ffffff;
    --surface-2: #f8fafc; /* slate-50 */
    --border: #e5e7eb; /* gray-200 */
    --primary: #2563eb; /* blue-600 */
    --primary-600: #1d4ed8; /* blue-700 */
    --hero-start: #667eea;
    --hero-end: #764ba2;
    /* Brand wordmark */
    --brand-from: #2563eb; /* blue-600 */
    --brand-to: #7c3aed;   /* violet-600 */
    --brand-glow: rgba(37,99,235,0.35);

    /* Layout + effects */
    --radius: 12px;
    --shadow-1: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-2: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-3: 0 8px 30px rgba(0,0,0,0.12);
    --container: 1200px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0f19;
        --text: #e5e7eb;
        --muted: #9ca3af;
        --surface: #0f172a;
        --surface-2: #0b0f19;
        --border: #1f2937;
        --hero-start: #1f2937;
        --hero-end: #0b0f19;
        --brand-from: #93c5fd; /* blue-300 */
        --brand-to: #c4b5fd;   /* violet-300 */
        --brand-glow: rgba(147,197,253,0.35);
    }
}

/* Manual theme override (takes precedence over system) */
html[data-theme="light"] {
    --bg: #ffffff;
    --text: #111827;
    --muted: #64748b;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e5e7eb;
    --hero-start: #667eea;
    --hero-end: #764ba2;
    --brand-from: #2563eb;
    --brand-to: #7c3aed;
    --brand-glow: rgba(37,99,235,0.35);
}

html[data-theme="dark"] {
    --bg: #0b0f19;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --surface: #0f172a;
    --surface-2: #0b0f19;
    --border: #1f2937;
    --hero-start: #1f2937;
    --hero-end: #0b0f19;
    --brand-from: #93c5fd;
    --brand-to: #c4b5fd;
    --brand-glow: rgba(147,197,253,0.35);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

/* Accessible focus styles */
:where(a, button, [role="button"], input, select, textarea):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Header and Navigation */
header {
    background-color: var(--surface);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
}

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

.logo h1 { margin: 0; }

.logo .brand > a {
    display: inline-block;
    text-decoration: none;
    font-size: 1.9rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1;
    background-image: linear-gradient(90deg, var(--brand-from), var(--brand-to));
    background-size: 200% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 8px 24px var(--brand-glow);
    transition: background-position 0.5s ease, transform 0.2s ease, text-shadow 0.3s ease;
}

.logo .brand > a:hover {
    background-position: 100% 50%;
    transform: translateY(-1px);
    text-shadow: 0 1px 0 rgba(0,0,0,0.08), 0 10px 28px var(--brand-glow);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center; /* keep items vertically centered */
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: color 0.3s ease, background-size 0.25s ease;
    background-image: linear-gradient(currentColor, currentColor);
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    /* Add a small gap between text and underline */
    padding-bottom: 3px;
}

.nav-links a:hover { color: var(--primary); background-size: 100% 2px; }

/* Ensure nav button aligns vertically within header */
.nav-links .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: 36px;
    padding: 0 16px;
    background-image: none;
    background-size: 0 0;
    padding-bottom: 0;
}

/* Keep text visible and disable underline fill on hover in nav */
.nav-links .btn-secondary:hover {
    color: #ffffff;
    background-color: var(--primary);
    background-image: none;
    background-size: 0 0;
}

/* Theme toggle button */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    /* Stabilize vertical metrics to avoid header height jitter */
    line-height: 1;
    padding: 0;
    font-size: 18px;
}

/* Ensure nav list items align their content without affecting height */
.nav-links > li { display: flex; align-items: center; line-height: 1; }
.nav-links button { margin: 0; }

.theme-toggle:hover { box-shadow: var(--shadow-1); }
.theme-toggle:active { transform: translateY(1px); }

/* Main Content */
main {
    margin-top: 70px;
}

/* Hero Section */
.hero {
    background: radial-gradient(1200px 600px at 50% -20%, rgba(255,255,255,0.15), transparent 60%),
                linear-gradient(135deg, var(--hero-start) 0%, var(--hero-end) 100%);
    color: white;
    padding: 100px 0;
    text-align: center;
}

.hero h2 {
    font-size: clamp(2rem, 3.5vw + 1rem, 3rem);
    margin-bottom: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: clamp(1rem, 0.5vw + 0.9rem, 1.2rem);
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* Apps Section */
.apps-section {
    padding: 80px 0;
    background-color: var(--surface-2);
}

.apps-section h2 {
    text-align: center;
    font-size: clamp(1.8rem, 2.5vw + 1rem, 2.5rem);
    margin-bottom: 60px;
    color: var(--text);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
}

.app-card {
    background: var(--surface);
    padding: 36px 32px 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.app-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-3);
}

/* App icon-forward layout */
.app-media {
    display: grid;
    place-items: center;
    margin-bottom: 18px;
}

.app-icon-wrap {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.04), rgba(0,0,0,0.08));
    border: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.06);
    overflow: hidden;
}

.app-icon-img {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    display: block;
}

.app-icon-fallback {
    background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
    color: #fff;
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: -0.02em;
}

.app-card h3, .app-title {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: var(--text);
}

.app-platform {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 15px;
}

.app-card p, .app-summary {
    margin-bottom: 25px;
    color: var(--muted);
}

.app-links {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: nowrap;
}

.btn, .btn-secondary {
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    white-space: nowrap; /* keep label on one line */
}

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

.btn:hover { background-color: var(--primary-600); }

/* Light theme polish */
html[data-theme="light"] body {
    background-image:
        radial-gradient(600px 200px at 10% -10%, rgba(37,99,235,0.06), transparent 60%),
        radial-gradient(800px 300px at 90% -10%, rgba(124,58,237,0.05), transparent 60%);
    background-attachment: fixed, fixed;
}

html[data-theme="light"] .app-card {
    background-image: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,1));
}

html[data-theme="light"] .app-card:hover {
    border-color: #dbeafe; /* blue-100 */
}

html[data-theme="light"] .btn {
    background-image: linear-gradient(180deg, #2a67ee, #1f56e6);
}

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

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

.coming-soon {
    opacity: 0.7;
}

.coming-soon .app-links {
    display: none;
}

/* About Section */
.about-section {
    padding: 80px 0;
    text-align: center;
}

.about-section h2 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: var(--text);
}

.about-section p {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
    color: var(--muted);
}

/* Contact Section */
.contact-section {
    padding: 80px 0;
    background-color: var(--surface-2);
    text-align: center;
}

.contact-section h2 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: var(--text);
}

.contact-section p {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--muted);
}

.contact-section a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.contact-section a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    background-color: #1e293b;
    color: white;
    padding: 30px 0;
    text-align: center;
}

footer p {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-links { gap: 20px; }
    .hero h2 { font-size: clamp(1.8rem, 3vw + 1rem, 2.2rem); }
    .hero p { font-size: 1rem; }

    .apps-section h2,
    .about-section h2,
    .contact-section h2 { font-size: clamp(1.5rem, 2.5vw + 0.8rem, 2rem); }

    /* Keep app buttons on one line on mobile */
    .app-links {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 10px;
        flex-wrap: nowrap;
    }
    .btn, .btn-secondary {
        width: auto;
        max-width: none;
        padding: 10px 16px;
        font-size: 0.95rem;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 15px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .hero {
        padding: 60px 0;
    }
    
    .apps-section,
    .about-section,
    .contact-section {
        padding: 60px 0;
    }
    
    .app-card {
        padding: 30px;
    }

    /* Tighter buttons on very small screens */
    .app-links { gap: 8px; }
    .btn, .btn-secondary { padding: 10px 14px; font-size: 0.9rem; }
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
