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

/* CSS Variables — Alignd Design System (see https://marcom.fta.care/) */
:root {
    /* Base palette (named tokens, mirrors marketing site) */
    --white: #FFFFFF;
    --light-grey: #EFEFEF;
    --secondary-grey: #9F9F9F;
    --prime-grey: #5A5A5A;
    --dark-grey: #3B3F46;
    --midnight: #1B263E;
    --spring-leaf: #669D5B;
    --forest: color-mix(in srgb, #669D5B 55%, #1B263E);
    --pollen: #F3C27D;
    --roman-coffee: #7A5848;
    --red: #D54848;
    --perry-blue: #8FABD8;
    --dusk-blue: #4D5D81;
    --light-beige: #FEFAF7;
    --pale-beige: #FCF6F1;
    --taupe-beige: #F8F2ED;
    --base-beige: #FFF3E9;
    --heavy-beige: #F4E8DC;
    --almond-beige: #ECD8C8;
    --blush: #FEEEEE;
    --alert-red: #B82626;

    /* Primary colors */
    --color-primary: var(--spring-leaf);
    --color-primary-dark: color-mix(in srgb, var(--spring-leaf) 85%, var(--midnight));
    --color-primary-light: color-mix(in srgb, var(--spring-leaf) 70%, var(--white));
    --color-secondary: var(--heavy-beige);
    --color-accent: var(--spring-leaf);
    --color-accent-light: color-mix(in srgb, var(--spring-leaf) 70%, var(--white));
    --color-heading: var(--dark-grey);
    --color-text: var(--prime-grey);
    --color-text-muted: var(--secondary-grey);
    --color-complete-tag: var(--secondary-grey);
    /* Success / positive status (tasks, confirmations) */
    --color-success: var(--spring-leaf);
    --color-white: var(--white);
    --color-error: var(--red);
    --color-error-light: var(--blush);
    /* Status pill (warm: e.g. "2 of 5 complete") */
    --color-status-bg: var(--base-beige);
    --color-status-text: var(--roman-coffee);

    /* Surface tokens */
    --color-bg-page: var(--light-beige);
    --color-bg-screen: #FFFFFF;
    /* V8 / wireframe naming (selection chips, HTML prototype) */
    --bg-screen: var(--color-bg-screen);
    --text-primary: var(--color-text);
    --color-bg-menu: var(--midnight);
    --color-border: var(--almond-beige);
    --color-border-light: var(--heavy-beige);
    --chip-bg: var(--heavy-beige);
    --chip-active: var(--spring-leaf);
    /* Plan week cards (overview stack) */
    --week-card-bg: var(--heavy-beige);
    --week-card-bg-current: var(--heavy-beige);
    --week-card-bg-complete: var(--taupe-beige);
    --week-card-bg-hover: var(--spring-leaf);
    --user-bubble: var(--heavy-beige);
    --input-border: var(--almond-beige);
    /* Scale / assessment (health step, radio options) */
    --scale-bg: var(--taupe-beige);
    --scale-active: var(--spring-leaf);
    /* Chip / tag picker dot states */
    --chip-dot-unselected: var(--almond-beige);
    --chip-dot-selected: rgba(255, 255, 255, 0.4);
    /* Focus ring (primary tint) */
    --focus-ring-primary: rgba(102, 157, 91, 0.25);
    /* Modal overlay, goal/option selected states */
    --overlay-bg: rgba(27, 38, 62, 0.4);
    --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(102, 157, 91, 0.35);
    --color-error-dark: color-mix(in srgb, var(--red) 80%, var(--midnight));
    /* Avatar, slider, nav (design alignment) */
    --avatar-bg: var(--heavy-beige);
    --avatar-ring: var(--spring-leaf);
    --slider-fill: var(--spring-leaf);
    --gate-btn: var(--spring-leaf);
    --nav-border: var(--heavy-beige);
    --card-bg: var(--light-beige);
    --icon-gray: var(--secondary-grey);
    --light-bg: var(--taupe-beige);
    /* Full-screen dark chrome (plan loading, welcome menu, design-system dark previews). Use this token — not --color-primary-dark (hover/pressed UI). */
    --bg-loading: var(--midnight);

    /* Typography */
    --font-family: 'Figtree', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
    --font-heading: 'Lora', Georgia, serif;
    --weight-heading: 500;
    --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-pill: 9999px;
    --radius-card: 12px;
    /* V8 prototype: pill selection chips (--radius-chip in HTML-Prototype-V8) */
    --radius-chip: 100px;
    --radius-chip-pill: 100px;
    --radius-lg: 12px;
    --radius-xl: 24px;
    --radius-input: 25px;
    --radius-full: 9999px;

    /* Shadows (warm, low-alpha — shadow color from brand midnight/coffee) */
    --shadow-sm: 0 1px 2px rgba(122, 88, 72, 0.06);
    --shadow-md: 0 4px 6px rgba(27, 38, 62, 0.1);
    --shadow-card: 0px 3px 5px 0px rgba(122, 88, 72, 0.08);
    --shadow-btn: 0px 8px 24px 0px rgba(80, 36, 18, 0.18);
    --shadow-modal: 0px 15px 45px 0px rgba(27, 38, 62, 0.3);
    --shadow-subtle: 0px 2px 4px 0px rgba(27, 38, 62, 0.15);
    --shadow-bottom-bar: 0px -12px 4px 0px rgba(122, 88, 72, 0.05);
    --shadow-lg: 0 10px 15px rgba(27, 38, 62, 0.1);

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

    /* Motion system (see FTA App Motion strategy). Durations + named curves
       for screen transitions and micro-interactions. --transition-fast/base
       above remain valid aliases for existing call sites. */
    --motion-fast: 150ms;   /* micro-interactions: chips, inputs, hover bumps */
    --motion-base: 240ms;   /* question -> question (Pattern A) */
    --motion-slow: 360ms;   /* step -> step (Pattern B), view drills (Pattern D) */
    --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);  /* starts & settles */
    --ease-decel:    cubic-bezier(0, 0, 0.2, 1);     /* enters — arrive & soften */
    --ease-accel:    cubic-bezier(0.4, 0, 1, 1);     /* exits — leave with intent */
    --motion-shift: 16px;   /* enter/exit travel for A & B */
    --motion-nudge: 3px;    /* directional hover bump */

    /* 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 — headings use the serif brand font (Lora) */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--weight-heading, 500);
    line-height: var(--line-height-tight);
    color: var(--color-heading);
}

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;
    }
}
