/* ==========================================================================
   Jez Technologies, Inc. — Design System
   --------------------------------------------------------------------------
   A small, Tailwind-flavoured token system built on CSS custom properties.
   Brand: trust-blue + growth-green, with a teal accent for the care platform.
   Dark mode is driven entirely by [data-theme="dark"] on <html>.
   ========================================================================== */

/* ---------- 1. Design tokens (light theme = default) ---------- */
:root {
    /* Brand */
    --color-blue: #1763d6;
    --color-blue-dark: #0f4fb0;
    --color-blue-light: #3b82f6;
    --color-blue-50: #eaf2ff;
    --color-blue-100: #d6e6ff;

    --color-green: #16a34a;
    --color-green-dark: #15803d;
    --color-green-light: #22c55e;
    --color-green-50: #e8f7ee;

    --color-teal: #0d9488;
    --color-teal-light: #14b8a6;
    --color-teal-50: #e6f7f5;

    /* Surfaces (light) */
    --bg: #ffffff;
    --bg-subtle: #f6f9fc;
    --bg-muted: #eef3f9;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --hero-bg: #0a1a33;
    --hero-bg-2: #0e2a4d;

    /* Text (light) */
    --text: #0f1b2d;
    --text-muted: #475569;
    --text-soft: #64748b;
    --text-on-brand: #ffffff;
    --heading: #0b1426;

    /* Lines */
    --border: #e2e8f2;
    --border-strong: #cbd6e6;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 27, 45, .06), 0 1px 3px rgba(15, 27, 45, .05);
    --shadow-md: 0 4px 12px rgba(15, 27, 45, .08), 0 2px 4px rgba(15, 27, 45, .04);
    --shadow-lg: 0 18px 40px -12px rgba(15, 27, 45, .18), 0 6px 12px rgba(15, 27, 45, .06);
    --shadow-brand: 0 12px 28px -8px rgba(23, 99, 214, .45);

    /* Radii */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-xl: 26px;
    --radius-pill: 999px;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-8: 3rem;
    --space-10: 4rem;
    --space-12: 6rem;
    --space-16: 8rem;

    /* Layout */
    --container: 1200px;
    --container-narrow: 820px;
    --header-h: 72px;

    /* Type */
    --font-sans: 'Inter', 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
    --font-display: 'Inter', 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;

    /* Motion */
    --ease: cubic-bezier(.22, 1, .36, 1);
    --dur: .35s;

    --grad-brand: linear-gradient(135deg, var(--color-blue) 0%, var(--color-blue-dark) 100%);
    --grad-green: linear-gradient(135deg, var(--color-green-light) 0%, var(--color-green) 100%);
    --grad-hero: radial-gradient(1200px 600px at 80% -10%, rgba(23, 99, 214, .55), transparent 60%),
                 radial-gradient(900px 500px at 0% 20%, rgba(22, 163, 74, .35), transparent 55%),
                 linear-gradient(180deg, #0a1a33 0%, #0e2a4d 100%);
}

/* ---------- Dark theme overrides ---------- */
[data-theme="dark"] {
    --color-blue-50: #13284a;
    --color-blue-100: #1b355f;
    --color-green-50: #0f3324;

    --bg: #0b1220;
    --bg-subtle: #0f1830;
    --bg-muted: #131f3a;
    --surface: #121c30;
    --surface-raised: #15213a;
    --hero-bg: #07101f;
    --hero-bg-2: #0c1a33;

    --text: #e6edf7;
    --text-muted: #9fb0c9;
    --text-soft: #7f93b0;
    --text-on-brand: #ffffff;
    --heading: #f4f8ff;

    --border: #1f2c47;
    --border-strong: #2c3d5e;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, .35);
    --shadow-lg: 0 22px 50px -16px rgba(0, 0, 0, .6);
    --shadow-brand: 0 14px 32px -8px rgba(23, 99, 214, .55);

    --grad-hero: radial-gradient(1200px 600px at 80% -10%, rgba(23, 99, 214, .5), transparent 60%),
                 radial-gradient(900px 500px at 0% 20%, rgba(22, 163, 74, .28), transparent 55%),
                 linear-gradient(180deg, #07101f 0%, #0c1a33 100%);
}

/* Respect OS preference when the user hasn't chosen explicitly */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        /* mirror dark tokens by re-applying — keep in sync with [data-theme="dark"] */
        --bg: #0b1220;
        --bg-subtle: #0f1830;
        --bg-muted: #131f3a;
        --surface: #121c30;
        --surface-raised: #15213a;
        --text: #e6edf7;
        --text-muted: #9fb0c9;
        --text-soft: #7f93b0;
        --heading: #f4f8ff;
        --border: #1f2c47;
        --border-strong: #2c3d5e;
    }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    color: var(--heading);
    line-height: 1.15;
    letter-spacing: -.02em;
    margin: 0 0 var(--space-4);
    font-weight: 700;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
h3 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); }
p { margin: 0 0 var(--space-4); }

a { color: var(--color-blue); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--color-blue-dark); }

img { max-width: 100%; height: auto; display: block; }

::selection { background: var(--color-blue); color: #fff; }

/* Accessibility helpers */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: -999px; top: 0; z-index: 2000;
    background: var(--color-blue); color: #fff; padding: var(--space-3) var(--space-4);
    border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--color-blue-light); outline-offset: 2px; border-radius: 4px; }

/* ---------- 3. Layout utilities ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--space-5); }
.container-narrow { max-width: var(--container-narrow); }

.section { padding-block: clamp(3.5rem, 8vw, var(--space-16)); }
.section-sm { padding-block: clamp(2.5rem, 5vw, var(--space-10)); }
.section-tight { padding-block: var(--space-8); }

.bg-subtle { background-color: var(--bg-subtle); }
.bg-muted { background-color: var(--bg-muted); }
.bg-brand { background: var(--grad-brand); color: var(--text-on-brand); }
.bg-hero { background: var(--grad-hero); color: #fff; }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-brand { color: var(--color-blue); }
.text-green { color: var(--color-green); }
.text-white { color: #fff; }

.lead { font-size: 1.15rem; color: var(--text-muted); line-height: 1.7; }
.eyebrow {
    display: inline-flex; align-items: center; gap: .5rem;
    text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700;
    color: var(--color-blue);
}
.eyebrow.green { color: var(--color-green); }
.eyebrow.teal { color: var(--color-teal); }
.on-dark .eyebrow, .bg-hero .eyebrow, .bg-brand .eyebrow { color: var(--color-green-light); }

.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.flex-wrap { flex-wrap: wrap; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0; }

@media (max-width: 900px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- 4. Buttons ---------- */
.btn {
    --btn-bg: var(--color-blue);
    --btn-fg: #fff;
    display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
    font-family: var(--font-sans); font-weight: 600; font-size: .98rem;
    line-height: 1; padding: .8rem 1.4rem; border-radius: var(--radius-pill);
    border: 1.5px solid transparent; cursor: pointer; text-decoration: none;
    transition: transform .18s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease);
    white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn .bi, .btn svg { font-size: 1.1em; }

.btn-primary { background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { color: #fff; box-shadow: 0 16px 36px -8px rgba(23, 99, 214, .6); }

.btn-green { background: var(--grad-green); color: #fff; box-shadow: 0 12px 28px -8px rgba(22, 163, 74, .45); }
.btn-green:hover { color: #fff; box-shadow: 0 16px 36px -8px rgba(22, 163, 74, .6); }

.btn-light { background: #fff; color: var(--color-blue-dark); box-shadow: var(--shadow-md); }
.btn-light:hover { color: var(--color-blue-dark); box-shadow: var(--shadow-lg); }

.btn-ghost-light {
    background: rgba(255, 255, 255, .08); color: #fff;
    border-color: rgba(255, 255, 255, .35); backdrop-filter: blur(6px);
}
.btn-ghost-light:hover { background: rgba(255, 255, 255, .16); color: #fff; }

.btn-outline { background: transparent; color: var(--color-blue); border-color: var(--color-blue); }
.btn-outline:hover { background: var(--color-blue); color: #fff; }

.btn-outline-muted { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-outline-muted:hover { border-color: var(--color-blue); color: var(--color-blue); }

.btn-lg { padding: 1rem 1.8rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ---------- 5. Badges & pills ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .3rem .7rem; border-radius: var(--radius-pill);
    font-size: .76rem; font-weight: 700; letter-spacing: .03em;
    background: var(--color-blue-50); color: var(--color-blue-dark);
}
.badge.green { background: var(--color-green-50); color: var(--color-green-dark); }
.badge.teal { background: var(--color-teal-50); color: var(--color-teal); }
.badge.neutral { background: var(--bg-muted); color: var(--text-muted); }
.badge.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- 6. Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card.hover-lift:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--color-blue-100); }

.card-icon {
    width: 52px; height: 52px; border-radius: var(--radius);
    display: grid; place-items: center; font-size: 1.5rem; margin-bottom: var(--space-4);
    background: var(--color-blue-50); color: var(--color-blue);
}
.card-icon.green { background: var(--color-green-50); color: var(--color-green); }
.card-icon.teal { background: var(--color-teal-50); color: var(--color-teal); }
.card-icon.gradient { background: var(--grad-brand); color: #fff; }
.card-icon.green-gradient { background: var(--grad-green); color: #fff; }

.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
.feature-list li { display: flex; gap: .65rem; align-items: flex-start; color: var(--text-muted); }
.feature-list .check {
    flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
    background: var(--color-green-50); color: var(--color-green-dark);
    display: grid; place-items: center; font-size: .8rem; margin-top: 2px;
}
[data-theme="dark"] .feature-list .check { background: rgba(22, 163, 74, .15); }

/* ---------- 7. Section heading ---------- */
.section-head { max-width: 720px; margin-inline: auto; margin-bottom: var(--space-8); }
.section-head.text-left { margin-inline: 0; }
.section-head p { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 0; }

/* ---------- 8. Header / nav ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color .25s var(--ease), background-color .25s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.header-inner {
    height: var(--header-h); max-width: var(--container); margin-inline: auto;
    padding-inline: var(--space-5); display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.15rem; color: var(--heading); letter-spacing: -.02em; }
.brand:hover { color: var(--heading); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; background: var(--grad-brand); box-shadow: var(--shadow-brand); flex: 0 0 auto; }
.brand-name b { color: var(--color-blue); }
.brand-name span { color: var(--text-soft); font-weight: 600; font-size: .7rem; display: block; letter-spacing: .12em; text-transform: uppercase; }

.nav-links { display: flex; align-items: center; gap: .25rem; }
.nav-link {
    position: relative; color: var(--text-muted); font-weight: 600; font-size: .95rem;
    padding: .55rem .85rem; border-radius: var(--radius-sm); transition: color .2s var(--ease), background-color .2s var(--ease);
}
.nav-link:hover { color: var(--heading); background: var(--bg-muted); }
.nav-link.active { color: var(--color-blue); }
.nav-link.active::after {
    content: ""; position: absolute; left: .85rem; right: .85rem; bottom: .25rem; height: 2px;
    background: var(--grad-brand); border-radius: 2px;
}

.header-actions { display: flex; align-items: center; gap: .6rem; }

.nav-toggle {
    display: none; width: 44px; height: 44px; border: 1px solid var(--border);
    background: var(--surface); border-radius: var(--radius-sm); cursor: pointer;
    color: var(--heading); place-items: center;
}
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after {
    content: ""; display: block; width: 20px; height: 2px; background: currentColor; position: relative; transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.nav-toggle .bars::before { position: absolute; top: -6px; }
.nav-toggle .bars::after { position: absolute; top: 6px; }
[aria-expanded="true"] .bars { background: transparent; }
[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }

/* Mobile drawer */
.mobile-nav {
    display: none; position: fixed; inset: var(--header-h) 0 0 0;
    background: var(--bg); z-index: 99; padding: var(--space-5);
    flex-direction: column; gap: .25rem; overflow-y: auto;
}
.mobile-nav .nav-link { font-size: 1.05rem; padding: .9rem .5rem; border-radius: var(--radius); border-bottom: 1px solid var(--border); }
.mobile-nav .nav-link.active::after { display: none; }
.mobile-nav.open { display: flex; }

@media (max-width: 980px) {
    .nav-links, .header-actions .btn-desktop { display: none; }
    .nav-toggle { display: grid; }
}

/* Theme toggle */
.theme-toggle {
    width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--heading); cursor: pointer; display: grid; place-items: center;
    font-size: 1.1rem; transition: border-color .2s var(--ease), color .2s var(--ease);
}
.theme-toggle:hover { border-color: var(--color-blue); color: var(--color-blue); }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ---------- 9. Forms (contact) ---------- */
.form-grid { display: grid; gap: var(--space-4); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 620px) { .form-row { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-weight: 600; font-size: .9rem; color: var(--heading); }
.field label .req { color: var(--color-blue); }
.input, .textarea, .select {
    font-family: var(--font-sans); font-size: 1rem; color: var(--text);
    background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: .8rem 1rem; width: 100%; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-soft); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--color-blue); box-shadow: 0 0 0 4px rgba(23, 99, 214, .15); outline: none; }
.textarea { min-height: 140px; resize: vertical; }

.validation-message { color: #e11d48; font-size: .85rem; margin-top: .25rem; font-weight: 500; }
.input.invalid, .textarea.invalid { border-color: #e11d48; }
.form-success {
    background: var(--color-green-50); color: var(--color-green-dark); border: 1px solid color-mix(in srgb, var(--color-green) 30%, transparent);
    border-radius: var(--radius); padding: var(--space-4) var(--space-5); font-weight: 600; display: flex; gap: .6rem; align-items: center;
}

/* ---------- 10. Footer ---------- */
.site-footer { background: var(--hero-bg); color: #c7d3e8; padding-block: var(--space-10) var(--space-6); margin-top: 0; }
[data-theme="dark"] .site-footer { background: #060c18; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: var(--space-6); }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { color: #fff; font-size: .95rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: var(--space-4); }
.site-footer a { color: #aab8d0; }
.site-footer a:hover { color: #fff; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; font-size: .92rem; }
.footer-about p { color: #9fb0c9; max-width: 36ch; }
.footer-contact li { display: flex; gap: .6rem; align-items: flex-start; color: #c7d3e8; font-size: .92rem; }
.footer-contact .bi { color: var(--color-green-light); margin-top: 3px; }
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .1); margin-top: var(--space-8); padding-top: var(--space-5);
    display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; font-size: .85rem; color: #8a99b8;
}
.footer-brand-mark { background: var(--grad-brand); }
.site-footer .brand { color: #fff; }
.site-footer .brand-name span { color: #7f93b0; }

/* ---------- 11. Animations (scroll reveal) ---------- */
[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; }
    [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
    .btn:hover { transform: none; }
}
.fade-up { animation: fadeUp .7s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- 11b. CTA band ---------- */
.cta-band {
    background: var(--grad-hero);
    border-radius: var(--radius-xl);
    margin: var(--space-10) auto;
    max-width: calc(var(--container) + 80px);
    width: calc(100% - var(--space-6));
    border: 1px solid rgba(255, 255, 255, .06);
}
.cta-band h2 { color: #fff; }
@media (max-width: 620px) { .cta-band { margin-block: var(--space-8); } }

/* ---------- 11c. Legal prose ---------- */
.legal-prose h2 { font-size: 1.2rem; margin-top: var(--space-6); margin-bottom: .5rem; }
.legal-prose h2:first-child { margin-top: 0; }
.legal-prose p { color: var(--text-muted); margin-bottom: .5rem; }
.legal-prose a { font-weight: 600; }

/* ---------- 12. Misc helpers ---------- */
.divider { height: 1px; background: var(--border); border: 0; margin-block: var(--space-6); }
.rounded { border-radius: var(--radius-lg); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.full-bleed { width: 100vw; margin-left: calc(50% - 50vw); }
.aside-note { font-size: .85rem; color: var(--text-soft); }

/* Platform accent helpers (ILS.LIVE = blue/green, VSM.CARE = teal/green) */
.platform-ils { --p: var(--color-blue); --p-50: var(--color-blue-50); }
.platform-vsm { --p: var(--color-teal); --p-50: var(--color-teal-50); }

/* ---------- 13. Blazor error UI (kept from template, restyled) ---------- */
#blazor-error-ui { display: none; }
.blazor-error-boundary { background: #b32121; color: #fff; padding: 1rem; border-radius: var(--radius); }
.validation-message { color: #e11d48; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--color-green); }
.invalid { outline: 1px solid #e11d48; }