/* ==========================================================================
   MyCareFriend design system
   --------------------------------------------------------------------------
   The register is institutional publishing, not premium SaaS. The people this
   site has to convince are a hospital executive and a federal program officer.
   Between them they spend their working lives in board packets, CMS Care
   Compare, the Federal Register and USWDS-built properties. What reads as
   credible there is a warm paper ground, one deep blue doing all the work,
   hairline rules instead of drop shadows, and numbers that carry a
   denominator. What reads as a startup is a blue-white ground with a
   saturated blue accent, which is the signature of every B2B site built since
   2019.

   Three rules hold the whole thing together:

     1. Ink on paper. Elevation comes from material and rules, not blur.
     2. Nothing below --ink-450 may hold text. That single line retires the
        entire low-contrast failure class the old stylesheet had.
     3. Colour never carries meaning alone. Every status also has a word.

   The brand blue is not being discarded. #1a6fc4 has been deepened one step
   and desaturated to #0E4C7A. Anyone who knows the old mark reads the new one
   as the same brand, older.
   ========================================================================== */

:root {
  /* ── Ground ────────────────────────────────────────────────────────── */
  --paper:        #FBFAF7;
  --surface:      #FFFFFF;
  --band:         #F4F2ED;
  --ink-panel:    #101720;
  --ink-panel-2:  #18212C;

  /* ── Ink ramp. Ratios are against --paper and were computed, not eyed. */
  --ink-900: #12161C;  /* 17.39  display                                  */
  --ink-800: #1B222B;  /* 15.35  headings                                 */
  --ink-700: #2C3540;  /* 11.90  body                                     */
  --ink-600: #465361;  /*  7.53  secondary                                */
  --ink-500: #5A6675;  /*  5.60  metadata                                 */
  --ink-450: #66717F;  /*  4.75  the floor for any text                   */
  --ink-400: #767F8C;  /*  3.88  placeholder only, never text             */
  --ink-200: #C3C9D1;

  /* ── Bureau Blue ──────────────────────────────────────────────────── */
  --blue-900: #062B4C;
  --blue-800: #0A3D62;
  --blue-700: #0E4C7A;  /* action fill, white label at 9.00:1 (AAA)       */
  --blue-600: #125A8F;
  --blue-500: #1A6FAF;  /* focus ring                                     */
  --blue-400: #3E8FD0;
  --blue-300: #7FB6E3;  /* link on an ink panel, 8.33:1                   */
  --blue-100: #E4EFF9;
  --blue-050: #F2F7FC;

  /* ── Seal. A brass accent, used the way a seal is used: to mark, never
        to shout. Hairlines above eyebrows, attestation marks. Never a CTA. */
  --seal-800: #5E4715;
  --seal-700: #75591C;
  --seal-600: #8A6B24;
  --seal-500: #A6842F;
  --seal-300: #D9BE86;

  /* ── Status. Every one clears AAA for normal text, and every one is
        required to appear alongside a word, never as colour alone.        */
  --pos-700:  #1A5C41;  --pos-tint:  #E8F1EC;
  --caut-700: #7A4E08;  --caut-tint: #F6EEDF;
  --adv-700:  #96201F;  --adv-tint:  #F7E9E8;
  --info-700: #0E4C7A;  --info-tint: #E9F1F8;

  /* ── Rules. Three tokens, three jobs. --field-border is mandatory on
        every form control: at 3.58:1 it clears WCAG 1.4.11, and an input
        with a visible edge is most of why a form looks built rather than
        sketched.                                                          */
  --rule-hair:    #E7E4DD;
  --rule:         #D5D1C8;
  --rule-emph:    #A9A296;
  --field-border: #8C877B;

  /* ── Type. Source Serif for display, because the serif is what moves the
        register from software to publication. System sans for everything
        functional. Tabular figures wherever a number appears in a column. */
  --font-display: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-sans:    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* ── Spacing, on a 4px base.                                            */
  --s1: 4px;   --s2: 8px;   --s3: 12px;  --s4: 16px;
  --s5: 24px;  --s6: 32px;  --s7: 48px;  --s8: 64px;
  --s9: 96px;  --s10: 128px;

  --radius-sm: 3px;
  --radius:    5px;
  --radius-lg: 8px;

  --measure: 68ch;     /* body copy never runs wider than this */
  --container: 1180px;
}

/* The site commits to its light palette. A clinician app that runs for eight
   hours needs a dark theme; a public page read for ninety seconds does not,
   and a half-built one is worse than none. The ink panel is how this design
   gets its dark passages. */

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-700);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
}

/* Anyone who has asked their system to stop animating things means it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* One focus treatment, applied once, never removed. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* A keyboard user should reach the content without walking the whole nav. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--blue-700);
  color: #fff;
  padding: var(--s3) var(--s5);
  z-index: 999;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   Type
   ========================================================================== */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink-900);
  font-weight: 600;
  letter-spacing: -0.011em;
  line-height: 1.18;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(2.35rem, 1.6rem + 2.9vw, 3.75rem); letter-spacing: -0.021em; }
h2 { font-size: clamp(1.75rem, 1.3rem + 1.7vw, 2.5rem);  letter-spacing: -0.016em; }
h3 { font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.4rem);  color: var(--ink-800); }
h4 { font-size: 1.03rem; font-family: var(--font-sans); font-weight: 650; color: var(--ink-800); }

p { margin: 0 0 var(--s4); max-width: var(--measure); text-wrap: pretty; }

.lede {
  font-size: clamp(1.1rem, 1rem + 0.45vw, 1.32rem);
  line-height: 1.55;
  color: var(--ink-600);
  max-width: 60ch;
}

a { color: var(--blue-700); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--blue-800); }

strong { color: var(--ink-800); font-weight: 650; }

/* The eyebrow, with its brass hairline. This is where the seal colour earns
   its place: one 2px rule, at the top of a section, and nowhere else. */
.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.735rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--seal-700);
  padding-top: var(--s3);
  border-top: 2px solid var(--seal-500);
  display: inline-block;
  margin-bottom: var(--s3);
}

/* Numbers in columns line up or they are not worth printing. */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s5);
}

.section    { padding-block: clamp(var(--s8), 7vw, var(--s10)); }
.section-sm { padding-block: clamp(var(--s7), 5vw, var(--s9)); }

.band       { background: var(--band); border-block: 1px solid var(--rule-hair); }
.panel-dark { background: var(--ink-panel); color: #D9DEE5; }
.panel-dark h1, .panel-dark h2, .panel-dark h3 { color: #FFFFFF; }
.panel-dark a { color: var(--blue-300); }
.panel-dark .eyebrow { color: var(--seal-300); border-top-color: var(--seal-500); }
.panel-dark .lede { color: #B7C0CB; }

.grid { display: grid; gap: var(--s5); }
@media (min-width: 720px)  { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 940px)  { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 940px)  { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 940px)  { .grid-sidebar { grid-template-columns: 1.15fr 0.85fr; gap: var(--s8); } }

.stack > * + * { margin-top: var(--s4); }

/* ==========================================================================
   Components
   ========================================================================== */

/* A card here is paper with an edge, not a floating tile. The only shadow in
   the system is on an actual overlay. */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s5);
}
.card-quiet { background: transparent; border: 0; border-top: 1px solid var(--rule); border-radius: 0; padding: var(--s5) 0 0; }
.card h4 { margin-bottom: var(--s2); }
.card p:last-child { margin-bottom: 0; }

/* The measure component. This is the load-bearing piece of the whole system,
   because the reader this site is built for does not trust a rate without a
   denominator, a period and a source. Anywhere a percentage appears, it
   appears in this shape or it does not appear. */
.measure {
  border: 1px solid var(--rule);
  border-top: 3px solid var(--blue-700);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--s5);
}
.measure-label { font-size: 0.82rem; font-weight: 650; color: var(--ink-600); letter-spacing: 0.01em; }
.measure-value {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 1.6vw, 2.8rem);
  font-variant-numeric: tabular-nums;
  color: var(--ink-900);
  line-height: 1.05;
  margin-block: var(--s2) var(--s1);
}
.measure-meta { font-size: 0.8rem; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.measure-source {
  font-size: 0.75rem;
  color: var(--ink-500);
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--rule-hair);
}

/* Status carries a word as well as a colour, always. */
.status { display: inline-flex; align-items: center; gap: var(--s2); font-size: 0.8rem; font-weight: 650; padding: 3px 10px; border-radius: 100px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.status-pos  { color: var(--pos-700);  background: var(--pos-tint); }
.status-caut { color: var(--caut-700); background: var(--caut-tint); }
.status-adv  { color: var(--adv-700);  background: var(--adv-tint); }
.status-info { color: var(--info-700); background: var(--info-tint); }

/* The stage mark. This site describes a product that is partly built, and the
   only way that reads as competence rather than evasion is if the labelling
   is consistent, visible and used without flinching. */
.stage {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: var(--radius-sm);
  border: 1px solid currentColor;
}
.stage-live    { color: var(--pos-700); }
.stage-build   { color: var(--caut-700); }
.stage-planned { color: var(--ink-500); }

/* Buttons. The fill is blue-700, whose white label sits at 9.00:1. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font-family: var(--font-sans); font-size: 0.97rem; font-weight: 650;
  padding: 13px 26px; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; text-align: center;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-800); color: #fff; }
.btn-secondary { background: transparent; color: var(--blue-700); border-color: var(--rule-emph); }
.btn-secondary:hover { background: var(--blue-050); border-color: var(--blue-700); color: var(--blue-800); }
.panel-dark .btn-secondary { color: #fff; border-color: #4A5766; }
.panel-dark .btn-secondary:hover { background: var(--ink-panel-2); color: #fff; border-color: #6C7A8A; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }

/* Tables, because this reader reads tables. */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule-emph); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.data caption { text-align: left; padding: var(--s4) var(--s5); font-size: 0.85rem; color: var(--ink-600); border-bottom: 1px solid var(--rule); }
table.data th {
  text-align: left; font-weight: 650; color: var(--ink-800);
  padding: var(--s3) var(--s4); border-bottom: 2px solid var(--rule-emph);
  font-size: 0.83rem; letter-spacing: 0.02em;
}
table.data td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule-hair); vertical-align: top; color: var(--ink-700); }
table.data tbody tr:nth-child(even) { background: var(--paper); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Form controls get a visible edge. Non-negotiable. */
.field { display: block; margin-bottom: var(--s4); }
.field label { display: block; font-size: 0.88rem; font-weight: 650; color: var(--ink-800); margin-bottom: var(--s2); }
.field .hint { font-size: 0.8rem; color: var(--ink-500); margin-top: var(--s1); }
.field input, .field select, .field textarea {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--ink-800);
  background: var(--surface);
  border: 1px solid var(--field-border); border-radius: var(--radius);
  padding: 11px 13px;
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-400); }
.field textarea { min-height: 130px; resize: vertical; }

/* A short definition list, for the "what this is / what it is not" pattern
   that does most of the honest work on this site. */
.deflist { border-top: 1px solid var(--rule); }
.deflist > div { display: grid; gap: var(--s2); padding: var(--s4) 0; border-bottom: 1px solid var(--rule-hair); }
@media (min-width: 720px) { .deflist > div { grid-template-columns: 210px 1fr; gap: var(--s5); } }
.deflist dt { font-weight: 650; color: var(--ink-800); font-size: 0.95rem; }
.deflist dd { margin: 0; color: var(--ink-600); }

/* Footnote row under any figure that came from somewhere. */
.note { font-size: 0.8rem; color: var(--ink-500); max-width: 74ch; }
.note-rule { border-top: 1px solid var(--rule-hair); padding-top: var(--s3); margin-top: var(--s5); }

/* ==========================================================================
   Print. A program officer prints things.
   ========================================================================== */
@media print {
  body { background: #fff; font-size: 11pt; }
  .btn, .skip-link, nav, footer { display: none !important; }
  .card, .measure, .table-wrap { break-inside: avoid; border-color: #999; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
}
