/* ═══════════════════════════════════════════════════
   mAI Coach - Shared Design System
   Matches DesignTokens.swift / Android theme tokens
   ═══════════════════════════════════════════════════ */

/* ─── RESET ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ─── PAGE TRANSITIONS ─── */
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
body {
    animation: pageFadeIn 0.3s ease-out;
}
body.page-exit {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}
@media (prefers-reduced-motion: reduce) {
    body { animation: none; }
    body.page-exit {
        transform: none;
        transition: opacity 0.1s ease;
    }
}

/* ─── DESIGN TOKENS ─── */
:root {
    /* Brand */
    --accent: #c9a30a;
    --accent-bright: #d4ad0d;
    --accent-dark: #ad8c04;
    --accent-text: #c9a30a;
    --accent-muted: rgba(201,163,10,0.15);
    --accent-muted-border: rgba(201,163,10,0.25);

    /* Backgrounds */
    --bg: #0A0A0F;
    --bg-card: #141420;
    --bg-elevated: #1A1A28;
    --bg-tertiary: #1E1E2C;

    /* Text */
    --text: #F0F0F0;
    --text-dim: #8A8A8A;
    --text-faint: #555555;

    /* Borders */
    --border: #2A2A34;
    --divider: #1E1E28;

    /* Semantic */
    --success: #34C759;
    --warning: #FF9F0A;
    --error: #FF453A;

    /* Macros */
    --protein: #4DB6AC;
    --carbs: #FFB74D;
    --fat: #F06292;

    /* Spacing (4pt grid) */
    --sp-xs: 4px;
    --sp-sm: 8px;
    --sp-md: 12px;
    --sp-lg: 16px;
    --sp-xl: 24px;
    --sp-xxl: 32px;
    --sp-xxxl: 48px;

    /* Radii */
    --radius-card: 16px;
    --radius-button: 16px;
    --radius-big: 24px;
    --radius-pill: 100px;

    /* Sizing */
    --nav-height: 64px;
    --max-width: 1200px;
    --max-width-narrow: 800px;
}

/* ─── BASE ─── */
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-bright); }

img { max-width: 100%; height: auto; display: block; }

/* ─── SKIP TO CONTENT (Accessibility) ─── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    background: var(--accent);
    color: #000;
    padding: 8px 16px;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 9999;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
    color: #000;
}

/* ─── AMBIENT BACKGROUND GLOW ─── */
.bg-glow {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 20% 30%, rgba(201,163,10,0.04) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 80% 70%, rgba(201,163,10,0.03) 0%, transparent 70%);
}

/* ─── NAVIGATION ─── */
.site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-xl);
    background: rgba(10,10,15,0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s, background 0.3s;
}
.site-nav.scrolled {
    border-bottom-color: var(--border);
    background: rgba(10,10,15,0.95);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 1.1rem;
}
.nav-brand img {
    width: 32px; height: 32px;
    border-radius: 8px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--sp-xl);
    list-style: none;
}
.nav-links a {
    color: var(--text-dim);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
    letter-spacing: 0.01em;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
}

.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: var(--accent);
    color: #000 !important;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: var(--radius-button);
    transition: filter 0.2s, transform 0.2s;
}
.nav-cta:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    color: #000 !important;
}

/* Mobile hamburger */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

.nav-mobile-menu {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0; bottom: 0;
    background: rgba(10,10,15,0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 99;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-xxl);
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-menu a {
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
}

/* ─── FOOTER ─── */
.site-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    padding: var(--sp-xxxl) var(--sp-xl) var(--sp-xxl);
}
.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--sp-xxl);
}
.footer-brand {
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
}
.footer-brand img { width: 36px; height: 36px; border-radius: 8px; }
.footer-brand p { color: var(--text-dim); font-size: 0.85rem; max-width: 280px; line-height: 1.6; }

.footer-col h4 {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: var(--sp-lg);
}
.footer-col a {
    display: block;
    color: var(--text-dim);
    font-size: 0.85rem;
    padding: 4px 0;
    transition: color 0.2s;
}
.footer-col a:hover { color: var(--text); }

.footer-bottom {
    max-width: var(--max-width);
    margin: var(--sp-xxl) auto 0;
    padding-top: var(--sp-xl);
    border-top: 1px solid var(--divider);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-faint);
}
.footer-bottom a { color: var(--text-faint); text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom a:hover { color: var(--text-dim); }

/* ─── COMMON COMPONENTS ─── */

/* Section wrapper */
.section {
    position: relative;
    z-index: 1;
    padding: 80px var(--sp-xl);
}
.section-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}
.section-narrow {
    max-width: var(--max-width-narrow);
    margin: 0 auto;
}

/* Section headers */
.section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--sp-lg);
}
.section-label .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.section-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: var(--sp-lg);
}
.section-title em {
    font-style: normal;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 1.05rem;
    color: var(--text-dim);
    line-height: 1.7;
    max-width: 600px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: var(--sp-xl);
    transition: transform 0.3s, border-color 0.3s;
}
.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-muted-border);
}

/* Pills / tags */
.pill {
    display: inline-flex;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    color: var(--text-dim);
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-button);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s;
    font-family: inherit;
}
.btn-primary {
    background: var(--accent);
    color: #000;
}
.btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    color: #000;
}
.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}
.btn-outline:hover {
    background: var(--accent-muted);
    color: var(--accent);
}
.btn-ghost {
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
}

/* Feature icon circle */
.feature-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--accent-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: var(--sp-lg);
    flex-shrink: 0;
}

/* Screenshot container */
.screenshot {
    border-radius: var(--radius-card);
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--bg-card);
}
.screenshot img {
    width: 100%;
    display: block;
}

/* Gold highlight text */
.gold { color: var(--accent); }

/* ─── PAGE HEADER (for inner pages) ─── */
.page-header {
    padding: calc(var(--nav-height) + 60px) var(--sp-xl) 60px;
    text-align: center;
    position: relative;
    z-index: 1;
}
.page-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    margin-bottom: var(--sp-md);
}
.page-header p {
    color: var(--text-dim);
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ─── LEGAL PAGE CONTENT ─── */
.legal-content {
    max-width: var(--max-width-narrow);
    margin: 0 auto;
    padding: 0 var(--sp-xl) 80px;
    position: relative;
    z-index: 1;
}
.legal-content h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: var(--sp-xxl) 0 var(--sp-md);
    color: var(--text);
}
.legal-content h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: var(--sp-xl) 0 var(--sp-sm);
    color: var(--text);
}
.legal-content p,
.legal-content li {
    color: var(--text-dim);
    font-size: 0.92rem;
    line-height: 1.8;
    margin-bottom: var(--sp-md);
}
.legal-content ul, .legal-content ol {
    padding-left: var(--sp-xl);
    margin-bottom: var(--sp-lg);
}
.legal-content a { color: var(--accent); }
.legal-content strong { color: var(--text); font-weight: 600; }

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
    .nav-links { display: none; }
    .nav-hamburger { display: block; }

    .footer-inner {
        grid-template-columns: 1fr 1fr;
        gap: var(--sp-xl);
    }
    .footer-brand { grid-column: 1 / -1; }

    .section { padding: 60px var(--sp-lg); }
}

@media (max-width: 600px) {
    .footer-inner { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; gap: var(--sp-sm); text-align: center; }
    .section { padding: 48px var(--sp-lg); }
}
