/* ==========================================================================
   BASE STYLES & VARIABLE SYSTEM
   Phase 3: Variable Normalization
   ========================================================================== */

:root {
    /* Backgrounds */
    --bg-primary: #f6f5f0;
    --bg-secondary: #eceae2;
    --surface-primary: #ffffff;
    --surface-secondary: #fdfcf8;

    /* Text */
    --text-primary: #1a1a18;
    --text-secondary: #5f5e5a;
    --text-muted: #888780;

    /* Borders */
    --border-primary: rgba(44, 44, 42, 0.1);
    --border-secondary: rgba(44, 44, 42, 0.2);

    /* Brand: Teal */
    --teal-50: #e1f5ee;
    --teal-100: #9fe1cb;
    --teal-400: #1d9e75;
    --teal-500: #158b68; /* Calculated midpoint */
    --teal-600: #0f6e56;

    /* Status */
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #22c55e;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.06);

    /* Typography */
    --font-body: 'Outfit', sans-serif;
    --font-mono: 'DM Mono', monospace;
    --font-display: 'Outfit', sans-serif;

    /* Legacy compatibility for extracted styles */
    --gray-50: var(--bg-primary);
    --gray-100: var(--bg-secondary);
    --gray-400: var(--text-muted);
    --gray-900: var(--text-primary);

    /* Safe Areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ==========================================================================
   RESET LAYER
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    min-height: 100vh;
}

img, svg, video, canvas, audio, iframe, embed, object {
    display: block;
    vertical-align: middle;
    max-width: 100%;
    height: auto;
}

button, input, optgroup, select, textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: inherit;
    color: inherit;
    border: none;
    background: none;
    outline: none;
}

a {
    color: inherit;
    text-decoration: inherit;
}

ul, ol {
    list-style: none;
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.hidden { display: none !important; }
.relative { position: relative !important; }
.absolute { position: absolute !important; }
.flex { display: flex !important; }
.grid { display: grid !important; }

/* Stacking Contexts */
.z-background { z-index: -1; }
.z-content { z-index: 1; }
.z-navbar { z-index: 100; }
.z-modal-backdrop { z-index: 1000; }
.z-modal { z-index: 1001; }
.z-toast { z-index: 2000; }
.z-loading-overlay { z-index: 3000; }
