/* ==========================================================================
   Bioscope Patient Intake — shared theme
   Helix design system (MIR-179): token values sourced from the Claude Design
   project "Helix — Bioscope AI Design System" (colors_and_type.css), matching
   the Bioscope web apps. Inter only; cool steel/teal palette on soft neutral
   surfaces. LIGHT ONLY — dark mode was removed with the rebrand and can be
   reintroduced later from the Helix dark token set.
   Existing token names are kept as the page interface; only values
   changed (cream→bg-page, paper→panel, ink→fg, accent→brand teal).
   ========================================================================== */

/* Self-hosted fonts (no external CDN). Files + this stylesheet are generated by
   scripts/vendor-fonts.mjs (npm run vendor-fonts) and live in the Amplify deploy. */
@import url('/assets/fonts/fonts.css');

:root {
  color-scheme: light;

  /* Surfaces */
  --cream:      #f3f1f0;   /* Helix --bg-page  — page background */
  --paper:      #ffffff;   /* Helix --bg-panel — cards, popovers, headers */
  --paper-2:    #f5f7f9;   /* Helix --bg-canvas — sunken/inset surfaces */
  --paper-3:    #eef0f4;   /* Helix --bg-field / --bg-chip */
  --paper-4:    #d8dee6;   /* Helix --brd-tile as a strong fill */

  /* Warm→cool canvas tint (Helix --bg-page-tint) for full-bleed page bodies. */
  --page-tint:  linear-gradient(105deg, #d6ecec 0%, #e2ece4 30%, #eeecde 65%, #f2ebda 100%);

  --rule:        #d8dee6;              /* Helix --brd-tile */
  --rule-soft:   rgba(0,0,0,0.06);     /* Helix --brd-subtle */
  --rule-strong: rgba(0,0,0,0.20);     /* Helix --brd-strong */

  /* Text */
  --ink:        #0b121d;   /* Helix --fg / --foreground */
  --ink-soft:   #4a5568;   /* Helix --fg-dim */
  --ink-mute:   #718096;   /* Helix --fg-sub */
  --ink-faint:  rgba(0,0,0,0.25);      /* Helix --fg-ghost — decorative only */
  --ink-invert: #ffffff;

  /* Brand teal */
  --accent:         #3FA4C3;
  --accent-hover:   #2D8AA8;
  --accent-pressed: #257087;
  --accent-soft:    #EAF4F7;   /* steel-50 */
  --accent-rule:    #AECBDB;   /* steel-200 */
  --accent-ink:     #fafafa;   /* Helix --primary-foreground */

  /* Branded initials avatar (Helix avatar fallback: steel-300 → steel-700) */
  --avatar-grad: linear-gradient(135deg, #8FBECC, #1E4050);

  /* Bioscope steel ramp */
  --steel-50:  #EAF4F7;
  --steel-100: #CADEEA;
  --steel-200: #AECBDB;
  --steel-300: #8FBECC;
  --steel-400: #6A9EAF;
  --steel-500: #4A7D8E;
  --steel-600: #325E6C;
  --steel-700: #1E4050;
  --steel-800: #0F2534;
  --steel-900: #071318;

  /* Status */
  --success:      #2d9f2d;
  --success-soft: #e7f5e7;
  --warn:         #e68900;
  --warn-soft:    #fdf1de;
  --danger:       #c4302b;   /* Helix --fg-flag — AA text on its soft bg */
  --danger-soft:  #f9edec;

  --focus-ring: 0 0 0 3px rgba(0,122,191,0.5);   /* Helix --ring #007abf @ 50% */

  --wash-1: rgba(15,20,25,0.04);
  --wash-2: rgba(15,20,25,0.07);
  --wash-3: rgba(15,20,25,0.12);

  /* Type — Inter is the sole family (Helix has no serif and no monospace). */
  --font-display: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-sans:    'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --fs-micro: 12px;
  --fs-0:     13px;
  --fs-1:     14px;
  --fs-2:     16px;
  --fs-3:     18px;
  --fs-4:     24px;
  --fs-5:     32px;
  --fs-6:     40px;

  --lh-tight: 1.2; --lh-heading: 1.2; --lh-snug: 1.35; --lh-normal: 1.5; --lh-body: 1.5; --lh-prose: 1.65;
  --tracking-tight: -0.02em; --tracking-snug: -0.01em; --tracking-wide: 0.04em; --tracking-caps: 0.12em;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;

  --rad-xs: 6px; --rad-sm: 8px; --rad-md: 10px; --rad-lg: 12px; --rad-xl: 14px; --rad-2xl: 16px; --rad-full: 999px;

  --shadow-xs: 0 1px 2px rgba(15,20,25,0.06);
  --shadow-sm: 0 1px 2px rgba(15,20,25,0.06);
  --shadow-md: 0 4px 16px rgba(15,20,25,0.06), 0 1px 2px rgba(15,20,25,0.04);
  --shadow-lg: 0 12px 32px rgba(15,20,25,0.10), 0 2px 4px rgba(15,20,25,0.05);
  --shadow-xl: 0 12px 40px rgba(15,20,25,0.15);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;
}

/* ── Base ──────────────────────────────────────────────────────────────── */
/* i18n: hide content until strings are localized (non-English only), to avoid
   a flash of English. The page script removes .i18n-cloak after I18N.apply(). */
html.i18n-cloak body { visibility: hidden; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-1);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-snug);
  color: var(--ink);
  margin: 0;
}
h1 { font-size: var(--fs-6); line-height: var(--lh-tight); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--fs-5); letter-spacing: var(--tracking-tight); }
h3 { font-size: var(--fs-4); }
h4 { font-size: var(--fs-3); font-weight: 500; }
h6 { font-size: var(--fs-micro); font-weight: 500; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-mute); }
a { color: var(--ink); text-decoration-color: var(--rule-strong); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--accent); }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--rad-sm); }
/* Tabular figures for doses, dates, counts (Helix .tabular helper). */
.tabular, [data-tabular] { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ── Buttons (Helix) ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 11px 18px; min-height: 40px;
  font: 500 var(--fs-1)/1 var(--font-sans); letter-spacing: -0.005em;
  border: 1px solid var(--rule); border-radius: var(--rad-md);
  cursor: pointer; white-space: nowrap; user-select: none; text-decoration: none;
  color: var(--ink); background: var(--paper);
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.btn:hover { background: var(--paper-2); border-color: var(--rule-strong); }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: transparent; }
.btn-ghost:hover { background: var(--wash-1); color: var(--ink); }
