/* =====================================================================
   SMART Health Check-in — design tokens
   Adapted from the SMART Health IT design system (smarthealthit.org).
   Sans: Inter · Editorial serif: Source Serif 4 · Mono: JetBrains Mono.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* SMART spectrum — the 6-petal palette (categorical only) */
  --smart-red:    #E5443B;
  --smart-orange: #F09623;
  --smart-yellow: #F1C42E;
  --smart-green:  #6FB43F;
  --smart-teal:   #1FA88E;
  --smart-blue:   #3DA9DC;
  --smart-purple: #6E4FA2;

  /* Brand accent */
  --brand:        #0E6FB8;   /* deep SMART blue, AAA on white */
  --brand-ink:    #094D80;   /* hover / pressed */
  --brand-bright: #3DA9DC;   /* original logo cyan, fills */
  --brand-wash:   #D6EAF7;   /* tint background */

  /* Neutrals */
  --gray-0:   #FFFFFF;
  --gray-50:  #F6F8FA;
  --gray-100: #EEF1F4;
  --gray-200: #E4E7EB;
  --gray-300: #CBD2D9;
  --gray-400: #9AA5B1;
  --gray-500: #7B8794;
  --gray-600: #6F7178;   /* SMART wordmark gray */
  --gray-700: #4B5563;
  --gray-800: #323F4B;
  --gray-900: #1F2933;
  --gray-950: #11161D;

  /* Semantic surfaces */
  --bg:           var(--gray-0);
  --bg-alt:       var(--gray-50);
  --surface:      var(--gray-0);
  --surface-alt:  var(--gray-50);
  --fg-1:         var(--gray-900);
  --fg-2:         var(--gray-700);
  --fg-3:         var(--gray-500);
  --fg-mark:      var(--gray-600);
  --border:        var(--gray-200);
  --border-strong: var(--gray-300);
  --border-subtle: var(--gray-100);

  /* Status */
  --success:      #1FA88E;  --success-wash: #E5F5F1;
  --warning:      #F09623;  --warning-wash: #FCEFD9;
  --danger:       #E5443B;  --danger-wash:  #FBE4E2;
  --info:         #3DA9DC;  --info-wash:    #E8F4FB;

  /* Type */
  --font-sans:  'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --font-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --fs-xs:   12px;
  --fs-sm:   14px;
  --fs-base: 16px;
  --fs-md:   18px;
  --fs-lg:   20px;
  --fs-xl:   24px;
  --fs-2xl:  30px;
  --fs-3xl:  36px;
  --fs-4xl:  48px;
  --fs-5xl:  60px;

  --lh-tight:   1.15;
  --lh-snug:    1.3;
  --lh-normal:  1.5;
  --lh-relaxed: 1.65;

  --tracking-tight: -0.02em;
  --tracking-snug:  -0.01em;
  --tracking-caps:   0.08em;

  /* Spacing — 8pt scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Radii */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-pill: 9999px;

  /* Shadows — neutral, low-alpha */
  --shadow-xs: 0 1px 1px rgba(17, 22, 29, 0.04);
  --shadow-sm: 0 1px 2px rgba(17, 22, 29, 0.06), 0 1px 3px rgba(17, 22, 29, 0.04);
  --shadow-md: 0 2px 4px rgba(17, 22, 29, 0.06), 0 4px 8px rgba(17, 22, 29, 0.06);
  --shadow-lg: 0 4px 8px rgba(17, 22, 29, 0.06), 0 12px 24px rgba(17, 22, 29, 0.08);
  --shadow-focus: 0 0 0 3px rgba(14, 111, 184, 0.45);

  /* Layout */
  --container-narrow: 760px;
  --container:       1080px;
  --container-wide:  1280px;
  --nav-height:        72px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur:      200ms;
}

::selection { background: var(--brand); color: #fff; }

/* ---------- Spectrum stripe — the brand signature ------------------- */
.smart-spectrum {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  height: 3px;
  width: 100%;
}
.smart-spectrum > i {
  display: block;
}
.smart-spectrum > i:nth-child(1) { background: var(--smart-red); }
.smart-spectrum > i:nth-child(2) { background: var(--smart-orange); }
.smart-spectrum > i:nth-child(3) { background: var(--smart-green); }
.smart-spectrum > i:nth-child(4) { background: var(--smart-teal); }
.smart-spectrum > i:nth-child(5) { background: var(--smart-blue); }
.smart-spectrum > i:nth-child(6) { background: var(--smart-purple); }

/* ---------- Sticky topbar with mark + crumbs ------------------------ */
.smart-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.smart-topbar-inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: var(--fs-sm);
}
.smart-mark-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-bottom: 0;
  color: var(--fg-1);
  flex-shrink: 0;
}
.smart-mark-link:hover { color: var(--fg-1); }
.smart-mark-link svg { display: block; }
.smart-mark-link .smart-mark-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.05;
}
.smart-mark-link .smart-mark-eyebrow {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-mark);
}
.smart-mark-link .smart-mark-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-1);
  letter-spacing: -0.005em;
  margin-top: 2px;
}
.smart-topbar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: center;
  margin-left: auto;
}
.smart-topbar-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border-bottom: 0;
  color: var(--fg-2);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.smart-topbar-nav a:hover {
  color: var(--brand-ink);
  background: var(--brand-wash);
}
.smart-topbar-nav a[aria-current="page"] {
  color: var(--brand-ink);
  background: var(--brand-wash);
}
.smart-topbar-nav .sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

/* ---------- Topbar dropdown ---------------------------------------- */
.smart-topbar-nav .dropdown {
  position: relative;
}
.smart-topbar-nav .dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--fg-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.smart-topbar-nav .dropdown-trigger:hover {
  color: var(--brand-ink);
  background: var(--brand-wash);
}
.smart-topbar-nav .dropdown[data-active="true"] > .dropdown-trigger {
  color: var(--brand-ink);
  background: var(--brand-wash);
}
.smart-topbar-nav .dropdown .dd-caret {
  transition: transform var(--dur) var(--ease-out);
}
.smart-topbar-nav .dropdown[data-open="true"] .dd-caret {
  transform: rotate(180deg);
}
.smart-topbar-nav .dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 70;
}
.smart-topbar-nav .dropdown[data-open="true"] > .dropdown-menu {
  display: block;
}
.smart-topbar-nav .dropdown-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-bottom: 0;
  color: var(--fg-1);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  line-height: 1.35;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.smart-topbar-nav .dropdown-menu a:hover {
  background: var(--bg-alt);
  color: var(--brand-ink);
  border-bottom: 0;
}
.smart-topbar-nav .dropdown-menu a[aria-current="page"] {
  background: var(--brand-wash);
  color: var(--brand-ink);
}
.smart-topbar-nav .dropdown-menu .dd-label {
  display: block;
  font-weight: 600;
}
.smart-topbar-nav .dropdown-menu .dd-note {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--fg-3);
  font-weight: 400;
}
.smart-topbar-nav .dropdown-menu a:hover .dd-note,
.smart-topbar-nav .dropdown-menu a[aria-current="page"] .dd-note {
  color: var(--brand-ink);
  opacity: 0.7;
}

@media (max-width: 720px) {
  .smart-topbar-nav .dropdown-menu {
    left: auto;
    right: 0;
    min-width: 240px;
  }
}

/* ---------- LLM-friendly docs bundle widget (in topbar) ------------- */
.llm-widget {
  display: inline-flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-left: 4px;
  overflow: visible;
}
.llm-widget .llm-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-2);
  cursor: pointer;
  white-space: nowrap;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.llm-widget .llm-primary:hover {
  background: var(--bg-alt);
  color: var(--brand-ink);
}
.llm-widget .llm-primary svg { width: 14px; height: 14px; }
.llm-widget .llm-secondary {
  border-left: 1px solid var(--border);
}
.llm-widget .llm-secondary .dropdown-trigger {
  padding: 6px 8px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--fg-2);
}
.llm-widget .llm-secondary .dropdown-menu {
  left: auto;
  right: 0;
  min-width: 220px;
}

/* ---------- Footer with spectrum top stripe ------------------------- */
.smart-footer {
  position: relative;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 40px 0 28px;
  margin-top: 48px;
  font-size: var(--fs-sm);
  color: var(--fg-2);
}
.smart-footer .smart-spectrum {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}
.smart-footer-inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}
.smart-footer-meta {
  flex: 2 1 320px;
  min-width: 0;
}
.smart-footer-meta .smart-mark-link { margin-bottom: 12px; }
.smart-footer-meta p {
  margin: 0;
  color: var(--fg-2);
  max-width: 56ch;
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}
.smart-footer-links {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: flex-end;
}
.smart-footer-links a {
  color: var(--fg-2);
  border-bottom: 1px solid transparent;
  font-weight: 600;
}
.smart-footer-links a:hover {
  color: var(--brand-ink);
  border-bottom-color: currentColor;
}
.smart-footer-fine {
  max-width: var(--container-wide);
  margin: 24px auto 0;
  padding: 16px 24px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--fs-xs);
  color: var(--fg-3);
}
.smart-footer-fine .spacer { flex: 1; }

@media (max-width: 720px) {
  .smart-topbar-inner { padding: 10px 18px; gap: 12px; }
  .smart-topbar-nav { width: 100%; margin-left: 0; }
  .smart-footer-inner { flex-direction: column; }
  .smart-footer-links { justify-content: flex-start; }
}
