/* Forma Health Patient Portal — design tokens & base styles
 * Adapted from Claude Design handoff (2026-04-26)
 * All classes prefixed with `fh-` to avoid collisions with the rest of the site.
 */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Brand palette */
  --cream:        #F5F0EB;
  --cream-2:      #EFE8DF;
  --cream-3:      #FBF7F2;
  --paper:        #FFFFFF;
  --terra:        #C4714A;
  --terra-dark:   #9C5535;
  --terra-soft:   #E8C9B6;
  --ink:          #1C1C1E;
  --ink-2:        #3A3A3D;
  --muted:        #6B6660;
  --muted-2:      #8E8880;
  --divider:      #E5DDD3;
  --divider-2:    #DCD2C5;

  /* Status colors — muted earth tones */
  --sage:         #7A8B6F;
  --sage-bg:      #E5EADC;
  --sand:         #B5A079;
  --sand-bg:      #EFE6D2;
  --clay:         #B8694F;
  --clay-bg:      #F0D9CD;

  /* Typography */
  --serif: 'Playfair Display', 'Iowan Old Style', 'Apple Garamond', Georgia, serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono:  'SF Mono', ui-monospace, Menlo, monospace;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Shadows — very subtle, premium */
  --shadow-1: 0 1px 2px rgba(28, 18, 10, 0.04), 0 0 0 0.5px rgba(28, 18, 10, 0.04);
  --shadow-2: 0 1px 3px rgba(28, 18, 10, 0.06), 0 4px 12px rgba(28, 18, 10, 0.05);
  --shadow-3: 0 2px 6px rgba(28, 18, 10, 0.08), 0 12px 32px rgba(28, 18, 10, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* App shell — fills the viewport on mobile, max-width on desktop */
.fh-app {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  margin: 0 auto;
  max-width: 480px;
  box-shadow: 0 0 0 0.5px rgba(28,18,10,0.06);
}

/* Desktop: card-style framing */
@media (min-width: 481px) {
  body {
    background: var(--cream-2);
    padding: 24px 16px;
  }
  .fh-app {
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(28,18,10,0.08), 0 0 0 0.5px rgba(28,18,10,0.06);
    min-height: calc(100vh - 48px);
    min-height: calc(100dvh - 48px);
  }
}

/* Scrollable content body — accounts for tab bar at bottom */
.fh-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 110px; /* tab bar + safe area */
  scrollbar-width: none;
}
.fh-scroll::-webkit-scrollbar { display: none; }

/* Top bar */
.fh-topbar {
  padding: 12px 20px 10px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--cream);
  position: relative;
  z-index: 5;
}
.fh-topbar.with-back { padding-left: 8px; }

.fh-logo {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
}
.fh-logo .dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--terra);
  border-radius: 50%;
  vertical-align: super;
  margin-left: 1px;
  transform: translateY(-4px);
}

.fh-topbar-title {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.005em;
  color: var(--ink-2);
}

.fh-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: background 120ms ease;
}
.fh-icon-btn:active { background: var(--divider); }

/* Card primitive */
.fh-card {
  background: var(--paper);
  border-radius: var(--r-md);
  border: 0.5px solid var(--divider);
  padding: 18px;
  box-shadow: var(--shadow-1);
}
.fh-card-flat {
  background: var(--cream-3);
  border-radius: var(--r-md);
  border: 0.5px solid var(--divider);
  padding: 18px;
}

.fh-section-title {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 4px 10px;
}

.fh-h-display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
}
.fh-h-display em {
  font-style: italic;
  font-weight: 500;
}

.fh-h-large {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0;
}
.fh-h-large em { font-style: italic; }

.fh-h-med {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.fh-h-med em { font-style: italic; }

.fh-eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--terra);
}

.fh-body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0;
  text-wrap: pretty;
}
.fh-body-sm {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
}
.fh-body-lg {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
  text-wrap: pretty;
}

/* Status pills */
.fh-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
  white-space: nowrap;
}
.fh-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.fh-pill--optimal { background: var(--sage-bg); color: #4F5E45; }
.fh-pill--optimal .dot { background: var(--sage); }
.fh-pill--inrange { background: var(--sand-bg); color: #6E5D3D; }
.fh-pill--inrange .dot { background: var(--sand); }
.fh-pill--low,
.fh-pill--high { background: var(--clay-bg); color: #7A3A24; }
.fh-pill--low .dot,
.fh-pill--high .dot { background: var(--clay); }

/* Buttons */
.fh-btn {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.005em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}
.fh-btn:active { transform: scale(0.985); }
.fh-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.fh-btn--primary { background: var(--ink); color: var(--cream); }
.fh-btn--primary:active { background: #000; }
.fh-btn--terra { background: var(--terra); color: var(--cream-3); }
.fh-btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 0.5px solid var(--divider-2);
}
.fh-btn--text {
  background: transparent;
  color: var(--terra-dark);
  height: auto;
  padding: 4px 0;
  width: auto;
  text-decoration: underline;
  text-decoration-color: rgba(196, 113, 74, 0.35);
  text-underline-offset: 3px;
  border: none;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Inputs */
.fh-input {
  width: 100%;
  height: 52px;
  padding: 0 18px;
  border-radius: 12px;
  border: 0.5px solid var(--divider-2);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.fh-input::placeholder { color: var(--muted-2); }
.fh-input:focus {
  border-color: var(--terra);
  box-shadow: 0 0 0 3px rgba(196, 113, 74, 0.12);
}
.fh-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  display: block;
}

/* Tab bar */
.fh-tabbar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(245, 240, 235, 0.86);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-top: 0.5px solid var(--divider);
  display: flex;
  padding: 8px 0 calc(28px + env(safe-area-inset-bottom));
  z-index: 10;
  margin-top: auto;
}
.fh-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted-2);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 140ms ease;
  min-height: 44px;
}
.fh-tab[aria-current="page"] {
  color: var(--ink);
}
.fh-tab svg { display: block; }

/* List rows */
.fh-list {
  background: var(--paper);
  border-radius: var(--r-md);
  border: 0.5px solid var(--divider);
  overflow: hidden;
}
.fh-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  min-height: 52px;
  border-bottom: 0.5px solid var(--divider);
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  color: var(--ink);
  font-size: 15px;
}
.fh-row:last-child { border-bottom: none; }
.fh-row:active { background: var(--cream-2); }
.fh-row-label { flex: 1; }
.fh-row-value { color: var(--muted); font-size: 14px; }
.fh-chev { color: var(--muted-2); flex-shrink: 0; display: inline-flex; }

/* Divider */
.fh-hr {
  height: 0.5px;
  background: var(--divider);
  margin: 0;
  border: none;
}

/* Photo placeholder */
.fh-photo {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(196, 113, 74, 0.12) 0,
      rgba(196, 113, 74, 0.12) 1px,
      transparent 1px,
      transparent 12px
    ),
    linear-gradient(135deg, var(--cream-2), var(--terra-soft));
  display: flex;
  align-items: center;
  justify-content: center;
}
.fh-photo .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: rgba(28,28,30,0.55);
  text-transform: uppercase;
  background: rgba(245,240,235,0.7);
  padding: 4px 8px;
  border-radius: 6px;
}

/* Skeleton shimmer */
@keyframes fh-shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.fh-skeleton {
  background: linear-gradient(90deg, var(--divider) 0%, var(--cream-2) 50%, var(--divider) 100%);
  background-size: 400px 100%;
  animation: fh-shimmer 1.6s linear infinite;
  border-radius: 6px;
}

/* Page transitions */
@keyframes fh-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fh-screen {
  animation: fh-fade-up 280ms cubic-bezier(0.2, 0.7, 0.3, 1);
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Sub-hairline divider in cards */
.fh-card-divider {
  height: 0.5px;
  background: var(--divider);
  margin: 14px -18px;
}

/* Numeric tabular */
.tnum { font-variant-numeric: tabular-nums; }

/* Forma platform-mark */
.fh-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fh-mark--terra { background: var(--terra); color: #fff; }
.fh-mark--cream {
  background: var(--cream-2);
  color: var(--ink);
  border: 0.5px solid var(--divider-2);
}

/* Demo banner — shows during Step 1 before real backend wired up */
.fh-demo-banner {
  background: var(--terra);
  color: #fff;
  text-align: center;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  text-transform: uppercase;
}

/* Lab row inside category cards */
.fh-lab-row {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 0.5px solid var(--divider);
  width: 100%;
}
.fh-lab-row:last-child { border-bottom: none; }
.fh-lab-row-name {
  flex: 1;
  min-width: 0;
}
.fh-lab-row-name-text {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 2px;
}
.fh-lab-row-meta {
  font-size: 12px;
  color: var(--muted);
}
.fh-lab-row-value {
  font-weight: 500;
  color: var(--ink-2);
  margin-right: 4px;
}
