/* ==========================================================================
   McIntyre MedSys - Base + shared components
   ========================================================================== */

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 { line-height: var(--lh-tight); font-weight: var(--fw-bold); letter-spacing: -.02em; }
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }

::selection { background: var(--brand-200); color: var(--brand-900); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-6); }
.container-wide { max-width: 1360px; }

/* ---- Utility ------------------------------------------------------- */
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.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; }

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-1 { gap: var(--sp-1);} .gap-2{gap:var(--sp-2);} .gap-3{gap:var(--sp-3);}
.gap-4 { gap: var(--sp-4);} .gap-6{gap:var(--sp-6);} .gap-8{gap:var(--sp-8);}
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }

/* ---- Buttons ------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px 18px; border-radius: var(--r-md); border: 1px solid transparent;
  font-weight: var(--fw-semi); font-size: var(--fs-base); line-height: 1;
  background: var(--surface-2); color: var(--text);
  transition: transform var(--dur-fast) var(--ease), background var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
  white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  color: #fff; box-shadow: var(--sh-sm), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { box-shadow: var(--sh-md), inset 0 1px 0 rgba(255,255,255,.24); }

.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }

.btn-subtle { background: var(--surface-2); border-color: var(--border); }
.btn-subtle:hover { background: var(--surface-3); }

.btn-danger { background: var(--risk-red-600); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-lg { padding: 14px 26px; font-size: var(--fs-lg); }
.btn-block { width: 100%; }

/* ---- Cards --------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
}
.card-pad { padding: var(--sp-6); }

/* ---- Badges / pills ------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: var(--fw-semi); line-height: 1.5;
  background: var(--surface-3); color: var(--text-muted);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.red   { background: var(--risk-red-100);   color: var(--risk-red-600); }
.badge.amber { background: var(--risk-amber-100); color: var(--risk-amber-600); }
.badge.green { background: var(--risk-green-100); color: var(--risk-green-600); }
.badge.blue  { background: var(--risk-blue-100);  color: var(--risk-blue-600); }
.badge.accent{ background: var(--accent-100);     color: var(--accent-600); }

/* ---- Eyebrow ------------------------------------------------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: .14em; font-size: var(--fs-xs);
  font-weight: var(--fw-bold); color: var(--primary);
}

/* ---- Brand mark ---------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: var(--fw-bold); letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name { font-size: var(--fs-lg); }
.brand-name b { color: var(--primary); }

/* ---- Theme toggle -------------------------------------------------- */
.theme-toggle {
  width: 38px; height: 38px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* ---- Animations ---------------------------------------------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes shimmer { to { background-position: 200% 0; } }
.reveal { opacity: 0; animation: fadeUp .7s var(--ease-out) forwards; }
.reveal.d1 { animation-delay: .08s; } .reveal.d2 { animation-delay: .16s; }
.reveal.d3 { animation-delay: .24s; } .reveal.d4 { animation-delay: .32s; }
.reveal.d5 { animation-delay: .40s; } .reveal.d6 { animation-delay: .48s; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--risk-red-600); animation: pulse 1.4s var(--ease) infinite; }
