/* css/base.css — variables, reset, body, dark mode */

:root {
    /* IMI Brand Colors */
    --imi-blue: #042847;
    --imi-yellow: #ffd502;
    --imi-dark-gray: #231f20;

    /* Neutral palette */
    --white: #ffffff;
    --light-gray: #f5f5f5;
    --medium-gray: #e0e0e0;
    --text-gray: #666666;
    --text-muted: #888888;
    --bg-light: #fafafa;
    --imi-blue-light: rgba(4, 40, 71, 0.1);

    /* Status colors */
    --success-green: #16a34a;
    --error-red: #dc2626;
    --warning-orange: #f59e0b;
    --info-blue: #0284c7;

    /* Status backgrounds */
    --success-green-bg: #f0fdf4;
    --error-red-bg: #fef2f2;
    --warning-orange-bg: #fffbeb;
    --info-blue-bg: #f0f9ff;

    /* Spacing scale */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 22px;
    --font-size-xxl: 28px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(4, 40, 71, 0.08);
    --shadow-md: 0 4px 8px rgba(4, 40, 71, 0.12);
    --shadow-lg: 0 8px 16px rgba(4, 40, 71, 0.18);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;

    /* Semantic surface tokens — switch in dark mode */
    --bg-page: var(--light-gray);
    --bg-surface: var(--white);
    --bg-surface-2: var(--bg-light);
    --text-primary: var(--imi-dark-gray);
    --text-secondary: var(--text-gray);
    --border-default: var(--medium-gray);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-page: #0f1419;
        --bg-surface: #1a1f26;
        --bg-surface-2: #232932;
        --text-primary: #e8eaed;
        --text-secondary: #9aa0a6;
        --border-default: #3c4148;
        --imi-blue-light: rgba(255, 213, 2, 0.1);
        /* Status backgrounds in dark mode — muted */
        --success-green-bg: rgba(22, 163, 74, 0.12);
        --error-red-bg: rgba(220, 38, 38, 0.12);
        --warning-orange-bg: rgba(245, 158, 11, 0.12);
        --info-blue-bg: rgba(2, 132, 199, 0.12);
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-page);
    /* 100dvh = dynamic viewport height — adapts to iOS URL bar showing/hiding.
       100vh is the fallback for browsers without dvh support. */
    min-height: 100vh;
    min-height: 100dvh;
    /* No safe-area padding here — applied per-element below, so `.app` with
       min-height: 100dvh doesn't overflow body's content area. */
}

/* Headings */
h1, h2, h3 {
    color: var(--text-primary);
    line-height: 1.25;
}

h1 { font-size: var(--font-size-xxl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }

/* Links */
a {
    color: var(--imi-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

@media (prefers-color-scheme: dark) {
    a {
        color: var(--imi-yellow);
    }
}

/* Utility classes */
.muted {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

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