/* ==========================================================================
   Frederick Healthcare — design system foundations
   Tokens, reset, typography, layout primitives, motion.
   ========================================================================== */

:root {
    /* ---- brand blue ramp (built around the existing #0058b0) ---- */
    --brand-50: #eff6fd;
    --brand-100: #d9e9fa;
    --brand-200: #b6d4f4;
    --brand-300: #7fb3ea;
    --brand-500: #1877cc;
    --brand-600: #0058b0;
    --brand-700: #00448c;
    --brand-800: #00336b;

    /* ---- navy / ink ---- */
    --navy-900: #0b1f3f;
    --navy-800: #102a52;
    --navy-700: #1d3a63;
    --ink-700: #33465f;
    --ink-600: #4a5c75;
    --ink-500: #64748b;
    --ink-400: #8493a8;

    /* ---- surfaces & lines ---- */
    --bg: #ffffff;
    --bg-subtle: #f5f8fc;
    --bg-brand-subtle: #eff6fd;
    --line: #e3e9f1;
    --line-strong: #cfdae8;

    /* ---- accents ---- */
    --teal-700: #035f83;
    --danger: #d92d20;
    --focus: #0058b0;

    /* ---- typography ---- */
    --font-heading: "Montserrat", system-ui, -apple-system, sans-serif;
    --font-body: "Public Sans", system-ui, -apple-system, sans-serif;

    --text-overline: 0.75rem;   /* 12 */
    --text-caption: 0.8125rem;  /* 13 */
    --text-sm: 0.875rem;        /* 14 */
    --text-base: 1rem;          /* 16 */
    --text-lg: 1.125rem;        /* 18 */
    --text-xl: 1.25rem;         /* 20 */
    --text-2xl: 1.5rem;         /* 24 */
    --text-3xl: 1.875rem;       /* 30 */
    --text-4xl: 2.25rem;        /* 36 */
    --text-5xl: 2.75rem;        /* 44 */
    --text-6xl: 3.5rem;         /* 56 */

    /* ---- spacing (8px base) ---- */
    --space-1: 0.25rem;  --space-2: 0.5rem;  --space-3: 0.75rem;
    --space-4: 1rem;     --space-5: 1.25rem; --space-6: 1.5rem;
    --space-7: 1.75rem;
    --space-8: 2rem;     --space-10: 2.5rem; --space-12: 3rem;
    --space-16: 4rem;    --space-20: 5rem;   --space-24: 6rem;

    /* ---- radii ---- */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* ---- elevation (low, blue-tinted) ---- */
    --shadow-xs: 0 1px 2px rgba(11, 31, 63, .06);
    --shadow-sm: 0 2px 8px rgba(11, 31, 63, .07);
    --shadow-md: 0 8px 24px rgba(11, 31, 63, .09);
    --shadow-lg: 0 20px 48px rgba(11, 31, 63, .14);

    /* ---- layout ---- */
    --container: 1240px;
    --container-narrow: 880px;
    --gutter: 1.5rem;
    --header-h: 80px;

    --ease: cubic-bezier(.2, .7, .3, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink-700);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.65;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4, h5, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
::selection { background: rgba(0, 88, 176, .16); }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- typography ---------- */
h1, h2, h3, h4, .h1, .h2, .h3, .h4 {
    font-family: var(--font-heading);
    color: var(--navy-900);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.015em;
}
.h1, h1 { font-size: clamp(2.125rem, 1.4rem + 2.6vw, var(--text-5xl)); }
.h2, h2 { font-size: clamp(1.75rem, 1.25rem + 1.7vw, var(--text-4xl)); }
.h3, h3 { font-size: clamp(1.375rem, 1.15rem + 0.7vw, var(--text-2xl)); letter-spacing: -0.01em; }
.h4, h4 { font-size: var(--text-xl); letter-spacing: -0.005em; line-height: 1.3; }

.overline {
    font-family: var(--font-body);
    font-size: var(--text-overline);
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--brand-600);
}
.lead { font-size: var(--text-lg); color: var(--ink-600); line-height: 1.65; }
.muted { color: var(--ink-500); }
.small { font-size: var(--text-sm); }
.caption { font-size: var(--text-caption); color: var(--ink-500); }
.strong { font-weight: 700; color: var(--navy-800); }
.text-brand { color: var(--brand-600); }
.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }
.measure { max-width: 62ch; }
.measure-sm { max-width: 48ch; }

/* ---------- layout primitives ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-narrow); }

.section { padding-block: clamp(3.5rem, 2rem + 5vw, 6rem); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 3vw, 4rem); }
.section--subtle { background: var(--bg-subtle); }
.section--brand-subtle { background: var(--bg-brand-subtle); }
.section--brand { background: var(--brand-600); color: #fff; }
.section--brand h1, .section--brand h2, .section--brand h3 { color: #fff; }
.section--line-top { border-top: 1px solid var(--line); }

/* full-bleed dark section: used sparingly to break the white rhythm */
.section--dark { position: relative; background: var(--navy-900); color: rgba(255, 255, 255, .76); overflow: hidden; }
.section--dark::before {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(900px 420px at 12% -10%, rgba(0, 88, 176, .45), transparent 62%),
                radial-gradient(700px 380px at 100% 110%, rgba(3, 95, 131, .35), transparent 60%);
    pointer-events: none;
}
.section--dark > * { position: relative; z-index: 1; }
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: #fff; }
.section--dark .lead { color: rgba(255, 255, 255, .72); }
.section--dark .overline { color: var(--brand-300); }
.section--dark .muted, .section--dark .caption { color: rgba(255, 255, 255, .6); }

/* section header block: overline + title + optional lead */
.section-head { max-width: 62ch; }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head > * + * { margin-top: var(--space-3); }
.section-head .lead { margin-top: var(--space-4); }

.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-6); }

.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--gap-lg { gap: var(--space-8); }

.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.cluster--between { justify-content: space-between; }

.split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(2rem, 1rem + 4vw, 4.5rem);
    align-items: center;
}
.split--wide-left { grid-template-columns: 1.15fr 0.85fr; }
.split--wide-right { grid-template-columns: 0.85fr 1.15fr; }

.divider { height: 1px; background: var(--line); border: 0; }

@media (max-width: 960px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split, .split--wide-left, .split--wide-right { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    :root { --gutter: 1.25rem; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- restrained motion ---------- */
.js .reveal { opacity: 0; transform: translateY(10px); }
.js .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: opacity .5s var(--ease), transform .5s var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .js .reveal { opacity: 1; transform: none; transition: none; }
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.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: var(--space-4); top: -100px; z-index: 200;
    background: #fff; color: var(--brand-700); font-weight: 700;
    padding: var(--space-3) var(--space-5); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    transition: top .2s var(--ease);
}
.skip-link:focus { top: var(--space-4); }
