/* ============================================================================
   PAWSCHECK Design System v1
   Source of truth: /DESIGN.md at repo root.
   Direction: clinical-editorial. Medical-grade calm, not consumer hype.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,500&family=Geist:wght@300;400;500;600;700&display=swap');

/* ---- TOKENS ------------------------------------------------------------- */

:root {
  /* Primary — clinical teal-blue (the only colour signal) */
  --primary:        #2A6F97;
  --primary-hover:  #245F84;
  --primary-active: #1F5472;
  --primary-tint:   #E9F1F6;

  /* Warm counterpoint — terracotta, USE SPARINGLY (≤ 1 per screen) */
  --accent:         #C97E59;
  --accent-hover:   #B36A47;
  --accent-tint:    #FAF1EB;

  /* Surfaces — warm, not cool blue-gray */
  --surface:        #FAFAF7;
  --surface-card:   #FFFFFF;
  --surface-sunk:   #F3F2EC;

  /* Text — high contrast, warm */
  --text:           #1A1A1A;
  --text-muted:     #6B6B65;
  --text-soft:      #9A9A93;
  --text-on-primary:#FFFFFF;

  /* Border — warm gray */
  --border:         #E5E3DC;
  --border-strong:  #C9C6BC;

  /* Semantic — desaturated, medical */
  --success:        #2E8B6B;
  --success-tint:   #E8F2EE;
  --warning:        #C69214;
  --warning-tint:   #FBF4E1;
  --danger:         #B23A48;
  --danger-tint:    #F7E6E8;
  --info:           #2A6F97;

  /* Score scale (vet 0–5) */
  --score-0: #2E8B6B;
  --score-1: #6BA572;
  --score-2: #C69214;
  --score-3: #C97E59;
  --score-4: #A45A48;
  --score-5: #B23A48;

  /* Shadows — calm, medical (NOT marketing) */
  --shadow-sm: 0 1px 2px rgba(20, 20, 20, 0.04);
  --shadow-md: 0 4px 12px rgba(20, 20, 20, 0.06);
  --shadow-lg: 0 12px 28px rgba(20, 20, 20, 0.08);

  /* Radius — hierarchical, not uniform */
  --r-input:  6px;
  --r-button: 8px;
  --r-card:   12px;
  --r-hero:   16px;
  --r-pill:   9999px;

  /* Spacing scale, 4px base */
  --space-2xs: 2px;
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  12px;
  --space-lg:  16px;
  --space-xl:  24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --space-4xl: 64px;
  --space-5xl: 96px;

  /* Type families */
  --serif: 'Fraunces', ui-serif, Georgia, 'Times New Roman', serif;
  --sans:  'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:  'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Easing + duration */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:   cubic-bezier(0.4, 0, 1, 1);
  --ease-move: cubic-bezier(0.4, 0, 0.2, 1);
  --t-micro:  80ms;
  --t-short:  160ms;
  --t-medium: 240ms;
  --t-long:   400ms;
}

/* ---- RESET + BASE ------------------------------------------------------- */

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

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

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--t-short) var(--ease-out);
}
a:hover { color: var(--primary-hover); text-decoration: underline; }

img, svg, video { display: block; max-width: 100%; }

/* ---- TYPOGRAPHY --------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  letter-spacing: -0.01em;
  color: var(--text);
  font-weight: 500;
}

h1 { font-size: 36px; line-height: 1.2; }
h2 { font-size: 28px; line-height: 1.25; }
h3 { font-size: 22px; line-height: 1.3; font-weight: 600; }
h4 { font-family: var(--sans); font-size: 18px; line-height: 1.3; font-weight: 600; }

.ps-display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 48px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.ps-body-sm  { font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.ps-caption  { font-size: 12px; font-weight: 500; letter-spacing: 0.02em; color: var(--text-soft); }
.ps-eyebrow  { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-soft); }
.ps-tabular  { font-variant-numeric: tabular-nums; }
.ps-score    { font-family: var(--sans); font-weight: 600; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }

.ps-serif-italic { font-style: italic; color: var(--accent); }

/* ---- LAYOUT ------------------------------------------------------------- */

.ps-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}
@media (min-width: 1024px) {
  .ps-container { padding: 0 var(--space-2xl); }
}

/* ---- HEADER ------------------------------------------------------------- */

.ps-header {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.ps-header .ps-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ps-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.ps-brand img { height: 40px; width: auto; }

/* ---- CARDS -------------------------------------------------------------- */

.ps-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
}
.ps-card-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  margin-bottom: var(--space-xs);
}
.ps-card-meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- BUTTONS ------------------------------------------------------------ */

.ps-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border: 1px solid transparent;
  border-radius: var(--r-button);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background var(--t-short) var(--ease-out),
              color var(--t-short) var(--ease-out),
              border-color var(--t-short) var(--ease-out);
  text-decoration: none;
}
.ps-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ps-btn-sm  { padding: var(--space-sm) var(--space-md); font-size: 13px; }
.ps-btn-lg  { padding: var(--space-lg) var(--space-2xl); font-size: 15px; }
.ps-btn-block { width: 100%; }

.ps-btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
}
.ps-btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: var(--text-on-primary); text-decoration: none; }

.ps-btn-secondary {
  background: var(--surface-card);
  color: var(--text);
  border-color: var(--border-strong);
}
.ps-btn-secondary:hover:not(:disabled) { background: var(--surface-sunk); text-decoration: none; }

.ps-btn-ghost {
  background: transparent;
  color: var(--primary);
}
.ps-btn-ghost:hover:not(:disabled) { background: var(--primary-tint); text-decoration: none; }

.ps-btn-accent {
  background: var(--accent);
  color: var(--text-on-primary);
}
.ps-btn-accent:hover:not(:disabled) { background: var(--accent-hover); color: var(--text-on-primary); text-decoration: none; }

.ps-btn-destructive {
  background: var(--danger);
  color: var(--text-on-primary);
}
.ps-btn-destructive:hover:not(:disabled) { background: #9B3340; color: var(--text-on-primary); text-decoration: none; }

/* ---- INPUTS ------------------------------------------------------------- */

.ps-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}
.ps-input-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ps-input-group .ps-help {
  font-size: 13px;
  color: var(--text-muted);
}

.ps-input,
.ps-select,
.ps-textarea {
  width: 100%;
  height: 40px;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-input);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  transition: border-color var(--t-short) var(--ease-out),
              box-shadow var(--t-short) var(--ease-out);
}
.ps-textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}
.ps-input:focus,
.ps-select:focus,
.ps-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}
.ps-input.is-error,
.ps-select.is-error,
.ps-textarea.is-error {
  border-color: var(--danger);
}

/* ---- CHIPS / SCORE / TAGS ---------------------------------------------- */

.ps-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface-sunk);
  color: var(--text-muted);
}
.ps-chip-success { background: var(--success-tint); color: var(--success); }
.ps-chip-warning { background: var(--warning-tint); color: var(--warning); }
.ps-chip-accent  { background: var(--accent-tint);  color: var(--accent); }
.ps-chip-danger  { background: var(--danger-tint);  color: var(--danger); }
.ps-chip-primary { background: var(--primary-tint); color: var(--primary); }

.ps-tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-sunk);
  color: var(--text-muted);
}

/* ---- ALERTS ------------------------------------------------------------- */

.ps-alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--r-input);
  font-size: 14px;
  margin-bottom: var(--space-lg);
}
.ps-alert-success { background: var(--success-tint); color: var(--success); }
.ps-alert-warning { background: var(--warning-tint); color: var(--warning); }
.ps-alert-danger  { background: var(--danger-tint);  color: var(--danger); }
.ps-alert-info    { background: var(--primary-tint); color: var(--primary); }

/* ---- INFO BOX (recessed surface) --------------------------------------- */

.ps-info-box {
  background: var(--surface-sunk);
  border-radius: var(--r-input);
  padding: var(--space-lg);
  font-size: 14px;
  color: var(--text-muted);
}
.ps-info-box strong { color: var(--text); }

/* ---- SPINNER (calm) ---------------------------------------------------- */

.ps-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ps-spin 800ms linear infinite;
}
@keyframes ps-spin { to { transform: rotate(360deg); } }

/* ---- AUTH CARD (login, signup, subscribe) ------------------------------ */

.ps-auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  background: var(--surface);
}
.ps-auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--space-3xl);
  box-shadow: var(--shadow-md);
}
.ps-auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-xl);
}
.ps-auth-brand img { height: 56px; width: auto; }
.ps-auth-h {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
  text-align: center;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-xs);
}
.ps-auth-sub {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: var(--space-xl);
}

/* ---- SCOUT (mascot) ---------------------------------------------------- */

.ps-scout {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  width: 140px;
  height: 140px;
  border-radius: var(--r-pill);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #000;
  z-index: 50;
}
.ps-scout video,
.ps-scout img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---- UTILITIES --------------------------------------------------------- */

.ps-hidden { display: none !important; }
.ps-text-muted { color: var(--text-muted); }
.ps-text-soft  { color: var(--text-soft); }
.ps-text-center { text-align: center; }

/* ---- RESPONSIVE -------------------------------------------------------- */

@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 30px; }
  h2 { font-size: 24px; }
  .ps-display { font-size: 36px; }
  .ps-auth-card { padding: var(--space-2xl); }
  .ps-container { padding: 0 var(--space-lg); }
  .ps-scout { width: 100px; height: 100px; bottom: var(--space-md); right: var(--space-md); }
}
