/* East Quabbin Health — design tokens
   Warm community health aesthetic: sage + clay + cream, grounded serif for display
   Inspired by the reference's pastel/rounded feel but reworked for a rural health org
*/

:root {
  /* Palette — Sage (default) */
  --eq-bg: #F4F1EA;         /* warm cream */
  --eq-surface: #FFFFFF;
  --eq-surface-2: #FAF7F1;  /* card tint */
  --eq-ink: #1C2620;        /* deep forest-ink */
  --eq-ink-2: #475049;
  --eq-muted: #8A9088;
  --eq-line: #E4DFD3;

  --eq-sage: #B8C9B4;       /* primary soft */
  --eq-sage-deep: #5C7A5C;  /* primary deep */
  --eq-clay: #D9A384;       /* accent warm */
  --eq-sky: #B8C9D4;        /* accent cool */
  --eq-butter: #E8D5A3;     /* highlight */
  --eq-berry: #C58A9B;      /* accent rose */

  --eq-ok: #5C7A5C;
  --eq-warn: #C17B4A;

  /* Type */
  --eq-serif: 'Fraunces', 'Source Serif Pro', Georgia, serif;
  --eq-sans: 'Figtree', 'Inter', -apple-system, system-ui, sans-serif;
  --eq-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Radii & shadows */
  --eq-r-sm: 10px;
  --eq-r-md: 16px;
  --eq-r-lg: 24px;
  --eq-r-xl: 32px;
  --eq-r-pill: 999px;

  --eq-shadow-card: 0 1px 2px rgba(28,38,32,0.04), 0 8px 24px rgba(28,38,32,0.06);
  --eq-shadow-pop: 0 2px 4px rgba(28,38,32,0.06), 0 18px 40px rgba(28,38,32,0.10);

  /* Density */
  --eq-gap: 14px;
  --eq-pad: 20px;
  --eq-field-h: 54px;
  --eq-type-body: 17px;
  --eq-type-label: 13px;
}

[data-palette="clinical"] {
  --eq-bg: #F4F7F9;
  --eq-surface: #FFFFFF;
  --eq-surface-2: #F0F4F7;
  --eq-ink: #0F2030;
  --eq-ink-2: #3E5566;
  --eq-muted: #7B8A96;
  --eq-line: #DDE5EB;
  --eq-sage: #BDD3E0;
  --eq-sage-deep: #2F5D7A;
  --eq-clay: #E0A080;
  --eq-sky: #B4CADC;
  --eq-butter: #E6DDA8;
  --eq-berry: #B88798;
  --eq-ok: #2F7A58;
}

[data-palette="earthy"] {
  --eq-bg: #EDE6D6;
  --eq-surface: #F7F2E4;
  --eq-surface-2: #E5DCC5;
  --eq-ink: #2B1F14;
  --eq-ink-2: #4F3E2C;
  --eq-muted: #8E7D65;
  --eq-line: #D3C6A8;
  --eq-sage: #C3BE8A;
  --eq-sage-deep: #6B6A2E;
  --eq-clay: #C57748;
  --eq-sky: #A9B89A;
  --eq-butter: #E0B968;
  --eq-berry: #A35C54;
}

[data-density="compact"] {
  --eq-gap: 10px;
  --eq-pad: 16px;
  --eq-field-h: 46px;
  --eq-type-body: 15px;
}

[data-density="roomy"] {
  --eq-gap: 18px;
  --eq-pad: 24px;
  --eq-field-h: 60px;
  --eq-type-body: 18px;
}

/* Base */
html, body { margin: 0; padding: 0; background: #E8E2D5; }
body {
  font-family: var(--eq-sans);
  color: var(--eq-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }

button { font-family: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* --- EQ primitives ---------------------------------------- */

.eq-app {
  background: var(--eq-bg);
  color: var(--eq-ink);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  font-size: var(--eq-type-body);
}

.eq-display {
  font-family: var(--eq-serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.eq-card {
  background: var(--eq-surface);
  border-radius: var(--eq-r-lg);
  box-shadow: var(--eq-shadow-card);
}

.eq-field {
  background: var(--eq-surface);
  border: 1.5px solid var(--eq-line);
  border-radius: var(--eq-r-md);
  height: var(--eq-field-h);
  padding: 0 18px;
  width: 100%;
  font-size: var(--eq-type-body);
  color: var(--eq-ink);
  outline: none;
  transition: border-color 140ms, background 140ms;
}
.eq-field:focus {
  border-color: var(--eq-sage-deep);
  background: var(--eq-surface);
}
textarea.eq-field {
  height: auto;
  padding: 14px 18px;
  min-height: 96px;
  resize: none;
  line-height: 1.45;
}
.eq-field::placeholder { color: var(--eq-muted); }

.eq-label {
  display: block;
  font-size: var(--eq-type-label);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--eq-ink-2);
  margin-bottom: 8px;
}

.eq-btn {
  height: var(--eq-field-h);
  padding: 0 28px;
  border-radius: var(--eq-r-pill);
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 100ms, background 140ms, box-shadow 140ms;
  white-space: nowrap;
}
.eq-btn:active { transform: scale(0.98); }
.eq-btn-primary {
  background: var(--eq-ink);
  color: var(--eq-surface);
}
.eq-btn-primary:hover { background: var(--eq-sage-deep); }
.eq-btn-ghost {
  background: transparent;
  color: var(--eq-ink-2);
}
.eq-btn-soft {
  background: var(--eq-surface-2);
  color: var(--eq-ink);
  border: 1.5px solid var(--eq-line);
}

.eq-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--eq-r-pill);
  background: var(--eq-surface-2);
  border: 1.5px solid var(--eq-line);
  font-size: 13px;
  color: var(--eq-ink-2);
  font-weight: 500;
}
.eq-chip[data-on="true"] {
  background: var(--eq-ink);
  color: var(--eq-surface);
  border-color: var(--eq-ink);
}

.eq-option {
  background: var(--eq-surface);
  border: 1.5px solid var(--eq-line);
  border-radius: var(--eq-r-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 140ms, background 140ms, transform 120ms;
  text-align: left;
  width: 100%;
  font-size: 16px;
  color: var(--eq-ink);
}
.eq-option:hover { border-color: var(--eq-muted); }
.eq-option[data-on="true"] {
  border-color: var(--eq-ink);
  background: var(--eq-surface-2);
}
.eq-option-check {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--eq-line);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.eq-option[data-on="true"] .eq-option-check {
  background: var(--eq-ink);
  border-color: var(--eq-ink);
  color: var(--eq-surface);
}
.eq-option-radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--eq-line);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.eq-option[data-on="true"] .eq-option-radio::after {
  content: '';
  width: 10px; height: 10px;
  background: var(--eq-ink);
  border-radius: 50%;
}

.eq-progress-track {
  height: 6px;
  background: var(--eq-line);
  border-radius: 999px;
  overflow: hidden;
}
.eq-progress-fill {
  height: 100%;
  background: var(--eq-sage-deep);
  border-radius: 999px;
  transition: width 360ms cubic-bezier(.22,1,.36,1);
}

.eq-divider {
  height: 1px;
  background: var(--eq-line);
  width: 100%;
}

/* Abstract illustration placeholders (warm, organic) */
.eq-blob {
  border-radius: 50%;
  filter: blur(0.2px);
}
.eq-sticker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 52px; height: 52px;
  font-family: var(--eq-serif);
  font-weight: 400;
}

/* slide transitions */
.eq-slide-enter { opacity: 0; transform: translateY(8px); }
.eq-slide-enter-active { opacity: 1; transform: translateY(0); transition: opacity 300ms ease, transform 300ms cubic-bezier(.22,1,.36,1); }

/* keyboard hints pulse */
@keyframes eq-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.9; }
}

/* scrollbar inside frames */
.eq-scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--eq-line) transparent; }
.eq-scroll::-webkit-scrollbar { width: 6px; }
.eq-scroll::-webkit-scrollbar-thumb { background: var(--eq-line); border-radius: 999px; }

/* Signature pad */
.eq-sig {
  background: var(--eq-surface);
  border: 1.5px dashed var(--eq-line);
  border-radius: var(--eq-r-md);
  touch-action: none;
  display: block;
  width: 100%;
}

/* Tweak panel */
.eq-tweaks {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 300px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.18);
  padding: 16px 18px;
  font-size: 13px;
  font-family: var(--eq-sans);
  z-index: 1000;
  color: #1C2620;
}
.eq-tweaks h4 {
  margin: 0 0 4px 0;
  font-family: var(--eq-serif);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.eq-tweaks .eq-tweak-row {
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.eq-tweaks .eq-tweak-row > .lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #475049;
}
.eq-tweaks .eq-tweak-row > .seg {
  display: flex;
  gap: 4px;
  background: #EFEAE0;
  border-radius: 999px;
  padding: 3px;
}
.eq-tweaks .eq-tweak-row > .seg button {
  flex: 1;
  height: 28px;
  border-radius: 999px;
  font-size: 12px;
  color: #475049;
  font-weight: 500;
}
.eq-tweaks .eq-tweak-row > .seg button[data-on="true"] {
  background: #1C2620;
  color: #fff;
}
