/* ==========================================================================
   Liberty Design System — v1 (APP-1002, Epic APP-1000)
   Brand tokens from liberty-healthcare.com (APP-1001) · contrast contract locked
   with Daniel (APP-1006). Navy + system-ui body + open-serif (Lora) headings.

   Self-contained and self-hosting: no CDN, no Adobe — works behind Entra auth and
   offline. Drop this file + ../fonts/ into an app's wwwroot and link it after any
   reset. Every token is a CSS custom property so a reskin is presentation-only.
   ========================================================================== */

/* ---- Self-hosted heading font (Lora, variable, latin) -------------------- */
/* Open-serif stand-in for ITC Giovanni's warm humanist character (Jay's call:
   reserve Giovanni for the public marketing site). Swap --lib-font-heading to
   license Giovanni later without touching components. */
@font-face {
  font-family: "Lora";
  src: url("../fonts/lora-latin-var.woff2") format("woff2-variations");
  font-weight: 400 700;          /* variable range */
  font-style: normal;
  font-display: swap;            /* system serif shows immediately, no FOIT */
}

:root {
  /* ---- Brand color ------------------------------------------------------- */
  --lib-navy:         #0033a0;   /* primary — header, buttons, headings (10.60:1 on white) */
  --lib-navy-700:     #002a85;   /* hover */
  --lib-navy-900:     #001f63;   /* active/pressed */
  --lib-link:         #0a5cd6;   /* AA-safe interactive blue on white (5.97:1) */
  --lib-blue:         #006cff;   /* large/UI ONLY — 4.58:1, never body text on white */
  --lib-blue-pale:    #afe0fc;   /* on-dark ONLY (7.52:1 on navy; 1.3:1 on white = unusable) */
  --lib-teal:         #144648;   /* optional Senior-Living sub-brand accent (10.50:1 on white) */

  /* ---- Neutrals ---------------------------------------------------------- */
  --lib-ink:          #303133;   /* body text (≈13:1 on white) */
  --lib-black:        #000000;
  --lib-white:        #ffffff;   /* canvas / on-navy text */
  --lib-surface:      #f7f7f7;   /* subtle alternating section */
  --lib-surface-dark: #141618;   /* dark section */
  --lib-gray-muted:   #72777c;   /* secondary text ONLY (4.52:1 — borderline AA) */
  --lib-border:       #d4d9de;   /* hairline borders (non-text, visible) */

  /* ---- Functional (not brand — AA-verified on white) --------------------- */
  --lib-danger:       #b3261e;   /* 6.54:1 */
  --lib-success:      #1e6b3a;   /* 6.52:1 */
  --lib-warning-fg:   #8a5a00;   /* 5.93:1 — amber as TEXT (raw amber fails on white) */
  --lib-danger-bg:    #fdeceb;
  --lib-success-bg:   #eaf5ee;
  --lib-warning-bg:   #fdf6e6;

  /* ---- Type -------------------------------------------------------------- */
  --lib-font-heading: "Lora", Georgia, "Times New Roman", serif;
  --lib-font-body:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                      Helvetica, Arial, sans-serif;
  --lib-fs-h1: 2.25rem;     /* 36 */
  --lib-fs-h2: 1.8125rem;   /* 29 */
  --lib-fs-h3: 1.375rem;    /* 22 */
  --lib-fs-h4: 1.125rem;    /* 18 */
  --lib-fs-body: 1.0625rem; /* 17 — matches the site */
  --lib-fs-sm: 0.875rem;    /* 14 */
  --lib-lh-tight: 1.2;
  --lib-lh-body: 1.6;
  --lib-fw-heading: 600;

  /* ---- Spacing (4/8 scale) ----------------------------------------------- */
  --lib-space-1: 0.25rem;  --lib-space-2: 0.5rem;  --lib-space-3: 0.75rem;
  --lib-space-4: 1rem;     --lib-space-5: 1.5rem;  --lib-space-6: 2rem;
  --lib-space-7: 3rem;     --lib-space-8: 4rem;

  /* ---- Shape & elevation ------------------------------------------------- */
  --lib-radius-sm:   6px;
  --lib-radius:      10px;
  --lib-radius-pill: 999px;     /* brand button signature */
  --lib-shadow-sm: 0 1px 2px rgba(20,22,24,.08), 0 1px 3px rgba(20,22,24,.06);
  --lib-shadow:    0 4px 12px rgba(20,22,24,.10);
  --lib-container: 1200px;
  --lib-transition: 150ms ease;
}

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

body {
  margin: 0;
  font-family: var(--lib-font-body);
  font-size: var(--lib-fs-body);
  line-height: var(--lib-lh-body);
  color: var(--lib-ink);
  background: var(--lib-white);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--lib-font-heading);
  font-weight: var(--lib-fw-heading);
  line-height: var(--lib-lh-tight);
  color: var(--lib-navy);
  margin: 0 0 var(--lib-space-4);
}
h1 { font-size: var(--lib-fs-h1); }
h2 { font-size: var(--lib-fs-h2); }
h3 { font-size: var(--lib-fs-h3); }
h4 { font-size: var(--lib-fs-h4); }

p { margin: 0 0 var(--lib-space-4); }

a { color: var(--lib-link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--lib-navy-700); }

/* Accessible focus — double ring is visible on BOTH light and dark grounds
   (white halo + blue ring), each ≥3:1 against its ground (APP-1006 contract).
   The transparent outline is invisible normally but, in Windows High-Contrast /
   forced-colors mode (where box-shadow is dropped), the system replaces it with a
   visible system color — so focus stays visible there too (Daniel's APP-1006 fix). */
:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--lib-white), 0 0 0 5px var(--lib-blue);
  border-radius: var(--lib-radius-sm);
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Screen-reader-only utility + skip link */
.lib-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;
}
.lib-skip-link {
  position: absolute; left: var(--lib-space-3); top: -3rem;
  background: var(--lib-navy); color: var(--lib-white);
  padding: var(--lib-space-2) var(--lib-space-4); border-radius: var(--lib-radius-sm);
  transition: top var(--lib-transition); z-index: 100;
}
.lib-skip-link:focus { top: var(--lib-space-3); color: var(--lib-white); }

.lib-container { max-width: var(--lib-container); margin: 0 auto; padding: 0 var(--lib-space-5); }

/* ==========================================================================
   Header / nav
   ========================================================================== */
.lib-header {
  background: var(--lib-navy);
  color: var(--lib-white);
}
.lib-header .lib-container {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: var(--lib-space-5);
}
.lib-header__brand {
  display: inline-flex; align-items: center; gap: var(--lib-space-3);
  font-family: var(--lib-font-heading); font-size: 1.25rem; font-weight: 600;
  color: var(--lib-white); text-decoration: none;
}
.lib-header__brand img { height: 34px; width: auto; display: block; }
.lib-nav { display: flex; gap: var(--lib-space-5); align-items: center; }
.lib-nav a {
  color: var(--lib-white); text-decoration: none; font-weight: 600;
  font-size: var(--lib-fs-sm); text-transform: uppercase; letter-spacing: .02em;
  padding: var(--lib-space-2) 0; border-bottom: 2px solid transparent;
}
.lib-nav a:hover, .lib-nav a[aria-current="page"] {
  color: var(--lib-blue-pale); border-bottom-color: var(--lib-blue-pale);
}

/* ==========================================================================
   Buttons — pill, navy fill (brand signature)
   ========================================================================== */
.lib-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--lib-space-2);
  font-family: var(--lib-font-body); font-weight: 600; font-size: var(--lib-fs-sm);
  line-height: 1; padding: var(--lib-space-3) var(--lib-space-6);
  border: 2px solid transparent; border-radius: var(--lib-radius-pill);
  cursor: pointer; text-decoration: none; transition: background var(--lib-transition), color var(--lib-transition);
}
.lib-btn--primary { background: var(--lib-navy); color: var(--lib-white); }
.lib-btn--primary:hover { background: var(--lib-navy-700); color: var(--lib-white); }
.lib-btn--primary:active { background: var(--lib-navy-900); }
.lib-btn--secondary { background: transparent; color: var(--lib-navy); border-color: var(--lib-navy); }
.lib-btn--secondary:hover { background: var(--lib-navy); color: var(--lib-white); }
.lib-btn--danger { background: var(--lib-danger); color: var(--lib-white); }
.lib-btn:disabled, .lib-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* ==========================================================================
   Forms
   ========================================================================== */
.lib-field { margin-bottom: var(--lib-space-5); }
.lib-label { display: block; font-weight: 600; margin-bottom: var(--lib-space-2); color: var(--lib-ink); }
.lib-input, .lib-select, .lib-textarea {
  width: 100%; font: inherit; color: var(--lib-ink);
  padding: var(--lib-space-3) var(--lib-space-4);
  border: 1px solid var(--lib-gray-muted); border-radius: var(--lib-radius-sm);
  background: var(--lib-white);
}
.lib-input::placeholder { color: var(--lib-gray-muted); }
.lib-input:focus-visible, .lib-select:focus-visible, .lib-textarea:focus-visible {
  border-color: var(--lib-navy);
}
.lib-input[aria-invalid="true"] { border-color: var(--lib-danger); }
.lib-field__error { color: var(--lib-danger); font-size: var(--lib-fs-sm); margin-top: var(--lib-space-2); }
.lib-field__hint  { color: var(--lib-gray-muted); font-size: var(--lib-fs-sm); margin-top: var(--lib-space-2); }

/* ==========================================================================
   Tables
   ========================================================================== */
.lib-table { width: 100%; border-collapse: collapse; font-size: var(--lib-fs-body); }
.lib-table caption { text-align: left; font-weight: 600; color: var(--lib-navy); margin-bottom: var(--lib-space-3); }
.lib-table th {
  text-align: left; background: var(--lib-navy); color: var(--lib-white);
  font-weight: 600; padding: var(--lib-space-3) var(--lib-space-4);
}
.lib-table td { padding: var(--lib-space-3) var(--lib-space-4); border-bottom: 1px solid var(--lib-border); }
.lib-table tbody tr:nth-child(even) { background: var(--lib-surface); }
.lib-table tbody tr:hover { background: #eef2fb; }   /* pale navy tint */

/* ==========================================================================
   Cards
   ========================================================================== */
.lib-card {
  background: var(--lib-white); border: 1px solid var(--lib-border);
  border-radius: var(--lib-radius); box-shadow: var(--lib-shadow-sm);
  padding: var(--lib-space-5);
}
.lib-card__title { margin-top: 0; }

/* ==========================================================================
   Badges / alerts
   ========================================================================== */
.lib-badge {
  display: inline-block; font-size: var(--lib-fs-sm); font-weight: 600;
  padding: 0.125rem var(--lib-space-3); border-radius: var(--lib-radius-pill);
  background: var(--lib-navy); color: var(--lib-white);
}
.lib-alert { padding: var(--lib-space-4); border-radius: var(--lib-radius-sm); border: 1px solid transparent; }
.lib-alert--danger  { background: var(--lib-danger-bg);  color: var(--lib-danger);     border-color: var(--lib-danger); }
.lib-alert--success { background: var(--lib-success-bg); color: var(--lib-success);    border-color: var(--lib-success); }
.lib-alert--warning { background: var(--lib-warning-bg); color: var(--lib-warning-fg); border-color: var(--lib-warning-fg); }

/* ==========================================================================
   Footer
   ========================================================================== */
.lib-footer {
  background: var(--lib-navy); color: var(--lib-white);   /* navy to match the header (bookend) */
  padding: var(--lib-space-7) 0; margin-top: var(--lib-space-8);
}
.lib-footer a { color: var(--lib-blue-pale); }   /* pale blue is AA on navy (7.52:1) */
.lib-footer__meta { color: #b9bcc0; font-size: var(--lib-fs-sm); }   /* ~5.5:1 on navy = AA */
