/* =====================================================================
   theme.css - the Calm Teal design tokens, fonts and Bootstrap overrides.
   Everything colour-related is a CSS variable here; other CSS files only use the variables.
   Light is the default; [data-theme="dark"] on <html> switches to dark (see theme-init.js).
   ===================================================================== */

/* ---- Inter (self-hosted variable font, two unicode ranges) ---- */
@font-face {
    font-family: 'Inter Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
    font-family: 'Inter Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* ---- Light tokens (default) ---- */
:root {
    --tm-font: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --tm-bg: #F6F9F9;
    --tm-surface: #FFFFFF;
    --tm-surface-2: #F0F5F5;
    --tm-border: #E2EAEA;
    --tm-text: #0F1F1E;
    --tm-muted: #5B6F6D;

    --tm-primary: #0F766E;
    --tm-primary-hover: #0B5F58;
    --tm-primary-soft: #E3F3F1;
    --tm-on-primary: #FFFFFF;

    --tm-success: #15803D;  --tm-success-soft: #E3F5E9;
    --tm-warning: #B45309;  --tm-warning-soft: #FDF1DC;
    --tm-danger:  #B91C1C;  --tm-danger-soft:  #FCE6E6;
    --tm-info:    #1D4ED8;  --tm-info-soft:    #E4ECFD;

    --tm-radius: 12px;
    --tm-radius-sm: 8px;
    --tm-shadow: 0 1px 2px rgba(15, 31, 30, .06), 0 4px 14px rgba(15, 31, 30, .05);
    --tm-shadow-lift: 0 2px 4px rgba(15, 31, 30, .08), 0 10px 24px rgba(15, 31, 30, .09);
    --tm-focus: 0 0 0 3px rgba(15, 118, 110, .35);

    --tm-ease: cubic-bezier(.2, .7, .2, 1);
    --tm-fast: 150ms;
    --tm-med: 250ms;
}

/* ---- Dark tokens ---- */
:root[data-theme="dark"] {
    --tm-bg: #0B1514;
    --tm-surface: #112221;
    --tm-surface-2: #172B2A;
    --tm-border: #234040;
    --tm-text: #E6F1EF;
    --tm-muted: #8DA9A5;

    --tm-primary: #2DD4BF;
    --tm-primary-hover: #5EE3D1;
    --tm-primary-soft: #12332F;
    --tm-on-primary: #04211D;

    --tm-success: #4ADE80;  --tm-success-soft: #12301D;
    --tm-warning: #FBBF24;  --tm-warning-soft: #3A2B0C;
    --tm-danger:  #F87171;  --tm-danger-soft:  #3B1616;
    --tm-info:    #7DA2FF;  --tm-info-soft:    #172545;

    --tm-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
    --tm-shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 10px 24px rgba(0, 0, 0, .4);
    --tm-focus: 0 0 0 3px rgba(45, 212, 191, .4);
}

/* ---- Bootstrap variable overrides (so Bootstrap components follow the theme) ---- */
:root, :root[data-bs-theme="dark"] {
    --bs-body-font-family: var(--tm-font);
    --bs-body-bg: var(--tm-bg);
    --bs-body-color: var(--tm-text);
    --bs-secondary-color: var(--tm-muted);
    --bs-border-color: var(--tm-border);
    --bs-primary: var(--tm-primary);
    --bs-link-color: var(--tm-primary);
    --bs-link-hover-color: var(--tm-primary-hover);
    --bs-link-color-rgb: 15, 118, 110;
    --bs-border-radius: var(--tm-radius-sm);
    --bs-border-radius-lg: var(--tm-radius);
}
:root[data-theme="dark"] { --bs-link-color-rgb: 45, 212, 191; }

body {
    font-family: var(--tm-font);
    background: var(--tm-bg);
    color: var(--tm-text);
    font-feature-settings: 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
}

/* ---- Primary button uses the tokens ---- */
.btn-primary {
    --bs-btn-bg: var(--tm-primary);
    --bs-btn-border-color: var(--tm-primary);
    --bs-btn-color: var(--tm-on-primary);
    --bs-btn-hover-bg: var(--tm-primary-hover);
    --bs-btn-hover-border-color: var(--tm-primary-hover);
    --bs-btn-hover-color: var(--tm-on-primary);
    --bs-btn-active-bg: var(--tm-primary-hover);
    --bs-btn-active-border-color: var(--tm-primary-hover);
    --bs-btn-active-color: var(--tm-on-primary);
    --bs-btn-focus-shadow-rgb: 15, 118, 110;
}
.btn-outline-secondary {
    --bs-btn-color: var(--tm-text);
    --bs-btn-border-color: var(--tm-border);
    --bs-btn-hover-bg: var(--tm-surface-2);
    --bs-btn-hover-color: var(--tm-text);
    --bs-btn-hover-border-color: var(--tm-border);
}

/* ---- Forms ---- */
.form-control, .form-select {
    background-color: var(--tm-surface);
    border-color: var(--tm-border);
    color: var(--tm-text);
}
.form-control:focus, .form-select:focus {
    border-color: var(--tm-primary);
    box-shadow: var(--tm-focus);
    background-color: var(--tm-surface);
    color: var(--tm-text);
}

/* ---- Visible keyboard focus everywhere ---- */
:focus-visible { outline: 2px solid var(--tm-primary); outline-offset: 2px; }

/* ---- Respect the OS "reduce motion" setting: no animation or smooth scroll ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
