/**
 * Base styles: CSS variables, reset, and typography
 */

/* CSS Variables — Wireframe Design System (grey palette) */
:root {
    /* Primary colors */
    --color-primary: #878E9F;
    --color-primary-dark: #727680;
    --color-primary-light: #A0A6B4;
    --color-secondary: #EFF1F5;
    --color-accent: #878E9F;
    --color-accent-light: #A0A6B4;
    --color-text: #424753;
    --color-text-muted: #9A9A9A;
    --color-complete-tag: #B8B8B8;
    --color-white: #FFFFFF;
    --color-error: #c0392b;
    --color-error-light: #f8d7da;

    /* Wireframe-specific tokens */
    --color-bg-page: #EFF1F5;
    --color-bg-screen: #FFFFFF;
    --color-bg-menu: #434852;
    --color-border: #D5D8DE;
    --color-border-light: #E2E4E9;
    --chip-bg: #EDEDED;
    --chip-active: #878E9F;
    /* Plan week cards (overview stack) */
    --week-card-bg: #EDEDED;
    --week-card-bg-current: #E6E8ED;
    --week-card-bg-complete: #E1E4EA;
    --week-card-bg-hover: #E4E6EB;
    --user-bubble: #EDEDED;
    --input-border: #D9D9D9;
    /* Scale / assessment (health step, radio options) */
    --scale-bg: #F2F2F2;
    --scale-active: #878E9F;
    /* Chip / tag picker dot states */
    --chip-dot-unselected: #DADADA;
    --chip-dot-selected: rgba(255, 255, 255, 0.4);
    /* Focus ring (primary tint) */
    --focus-ring-primary: rgba(135, 142, 159, 0.2);
    /* Modal overlay, goal/option selected states */
    --overlay-bg: rgba(0, 0, 0, 0.35);
    --goal-active-ring: rgba(255, 255, 255, 0.5);
    --goal-active-handle: rgba(255, 255, 255, 0.7);
    --shadow-option-selected: 0 4px 12px rgba(135, 142, 159, 0.35);
    --color-error-dark: #a93226;
    /* Avatar, slider, nav (design alignment) */
    --avatar-bg: #DADADA;
    --avatar-ring: #878E9F;
    --slider-fill: #878E9F;
    --gate-btn: #878E9F;
    --nav-border: #EAEAEA;
    --card-bg: #FCFCFC;
    --icon-gray: #A0A7BA;
    --light-bg: #F0F0F0;
    --bg-loading: #878E9F;

    /* Typography */
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --font-size-base: 18px;
    --font-size-sm: 0.875rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --line-height-base: 1.6;
    --line-height-tight: 1.3;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border radius (design-aligned) */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-btn: 10px;
    --radius-card: 8px;
    --radius-chip: 20px;
    --radius-chip-pill: 100px;
    --radius-lg: 12px;
    --radius-xl: 24px;
    --radius-input: 25px;
    --radius-full: 9999px;

    /* Shadows (design-aligned) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-card: 0px 4px 4px 0px rgba(0, 0, 0, 0.05);
    --shadow-btn: 0px 14px 44px 0px rgba(0, 0, 0, 0.2);
    --shadow-modal: 0px 15px 45px 0px rgba(0, 0, 0, 0.3);
    --shadow-subtle: 0px 2px 4px 0px rgba(0, 0, 0, 0.2);
    --shadow-bottom-bar: 0px -12px 4px 0px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;

    /* Touch targets */
    --min-touch-target: 44px;
}

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

html {
    font-size: var(--font-size-base);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: var(--line-height-base);
    color: var(--color-text);
    background-color: var(--color-bg-page);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    line-height: var(--line-height-tight);
    font-weight: 600;
}

h1 {
    font-size: var(--font-size-2xl);
}

h2 {
    font-size: var(--font-size-xl);
}

h3 {
    font-size: var(--font-size-lg);
}

p {
    margin-bottom: var(--spacing-md);
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--color-primary);
    text-decoration: underline;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
}

a:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Accessibility */
.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;
}

.hidden {
    display: none !important;
}

/* Focus styles */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
