/* ========================================
   MEDFLOW DESIGN SYSTEM — TOKENS
   ======================================== */
:root {
    /* COLORS */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #0ea5e9;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;
    --color-bg-page: #eef4ff;
    --color-bg-soft: #f8fafc;
    --color-bg-card: #ffffff;
    --color-text: #1e293b;
    --color-text-strong: #0f172a;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;

    /* BRAND SCALE (compat + gradients) */
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-200: #bfdbfe;
    --blue-300: #93c5fd;
    --blue-400: #60a5fa;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --blue-800: #1e40af;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --green-500: #22c55e;
    --green-100: #dcfce7;
    --orange-500: #f97316;
    --orange-100: #ffedd5;

    /* SPACING SCALE */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* RADIUS */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* SHADOWS */
    --shadow-light: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-medium: 0 6px 20px rgba(15,23,42,0.08);
    --shadow-strong: 0 16px 48px rgba(15,23,42,0.12);
    --shadow-sm: var(--shadow-light);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.1);
    --shadow-blue: 0 8px 32px rgba(59,130,246,0.18);

    /* MOTION */
    --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-premium: cubic-bezier(0.22, 1, 0.36, 1);
    --transition-fast: 0.18s var(--ease-standard);
    --transition-normal: 0.3s var(--ease-standard);
    --transition-smooth: 0.45s var(--ease-premium);
    --transition: var(--transition-normal);
    --transition-slow: 0.6s var(--ease-standard);

    /* TYPOGRAPHY */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-h1: clamp(2rem, 4vw, 2.8rem);
    --font-size-h2: clamp(1.6rem, 2.8vw, 2.1rem);
    --font-size-h3: 1.25rem;
    --font-size-body: 1rem;
    --font-size-small: 0.875rem;
    --font-size-label: 0.78rem;
    --line-height-tight: 1.2;
    --line-height-body: 1.6;
    --line-height-relaxed: 1.7;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    /* PAGE RHYTHM */
    --container-max: 1200px;
    --section-padding-y: 100px;
    --section-gap: 64px;

    /* EXISTING SURFACE TOKENS */
    --page-surface-bg:
        radial-gradient(120% 82% at 50% 16%, #ffffff 0%, #f7fbff 42%, #edf6ff 72%, #e7f1ff 100%),
        linear-gradient(180deg, #f3f9ff 0%, #f8fcff 44%, #ffffff 100%);
    --page-surface-fallback: var(--color-bg-page);
    --hero-shared-bg: var(--page-surface-bg);
    --public-nav-offset: 120px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--public-nav-offset) + 6px);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--page-surface-bg);
    background-color: var(--page-surface-fallback);
    background-attachment: fixed;
    min-height: 100%;
}

body {
    font-family: var(--font-family-base);
    color: var(--gray-800);
    background: transparent;
    line-height: var(--line-height-body);
    overflow-x: hidden;
    min-height: 100%;
}

body.nav-mobile-open {
    overflow: hidden;
    touch-action: none;
}

main {
    background: transparent;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* RHYTHM / LAYOUT UTILITIES */
.flow > * + * { margin-top: var(--space-4); }
.flow-lg > * + * { margin-top: var(--space-6); }
.stack-2 { display: grid; gap: var(--space-2); }
.stack-3 { display: grid; gap: var(--space-3); }
.stack-4 { display: grid; gap: var(--space-4); }
.stack-6 { display: grid; gap: var(--space-6); }

/* TYPOGRAPHY SCALE */
h1, .h1 {
    font-size: var(--font-size-h1);
    line-height: var(--line-height-tight);
    font-weight: var(--font-weight-extrabold);
    color: var(--color-text-strong);
    letter-spacing: -0.03em;
}
h2, .h2 {
    font-size: var(--font-size-h2);
    line-height: 1.25;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-strong);
    letter-spacing: -0.02em;
}
h3, .h3 {
    font-size: var(--font-size-h3);
    line-height: 1.35;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-strong);
}
p, .text-body {
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
    color: var(--color-text-muted);
}
.text-small { font-size: var(--font-size-small); line-height: 1.5; color: var(--color-text-muted); }
.text-label {
    font-size: var(--font-size-label);
    line-height: 1.4;
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
}

.nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(15, 23, 42, 0.14);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.38s;
}

.nav-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s var(--transition), transform 0.7s var(--transition);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 900px) {
    html { background-attachment: scroll; }
    :root { --public-nav-offset: calc(env(safe-area-inset-top, 0px) + 64px); }
}

@media (max-width: 768px) {
    :root { --public-nav-offset: calc(env(safe-area-inset-top, 0px) + 66px); }
    .container { padding: 0 clamp(16px, 4.5vw, 24px); }
}

@media (max-width: 480px) {
    :root { --public-nav-offset: calc(env(safe-area-inset-top, 0px) + 64px); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .reveal { opacity: 1; transform: none; }
}
