/* =========================================================================
   PROSPENSITY DESIGN SYSTEM — Foundations
   Colors, Type, Space, Radii, Shadows, Motion
   ========================================================================= */

/* ----- Webfonts (Google Fonts at runtime; consider self-hosting in prod) --- */
@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700&family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;1,6..72,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* =====================================================================
     COLOR TOKENS — Muted, pastel, blue-dominant
     Primary "Tide" — a soft slate-blue. Adjacent accents:
        Mist (dusty periwinkle, hue-shifted toward indigo)
        Sage (muted sage-teal, hue-shifted toward green)
     Neutrals are warm: paper-like off-whites, ink near-black.
     ===================================================================== */

  /* Primary — Tide (slate blue) */
  --tide-50:  #f1f5fa;
  --tide-100: #e2ecf5;
  --tide-200: #c5d6e8;
  --tide-300: #9bb7d2;
  --tide-400: #7194b8;
  --tide-500: #527aa1;
  --tide-600: #3f6388;
  --tide-700: #344e6c;
  --tide-800: #2a3e54;
  --tide-900: #1d2a3a;

  /* Accent A — Mist (dusty periwinkle / lilac) */
  --mist-50:  #f4f3fb;
  --mist-100: #e9e7f5;
  --mist-200: #d3cfeb;
  --mist-300: #b3acd9;
  --mist-400: #948bc4;
  --mist-500: #786dad;
  --mist-600: #61578f;
  --mist-700: #4d4774;
  --mist-800: #3c385a;
  --mist-900: #29263d;

  /* Accent B — Sage (muted sage-teal) */
  --sage-50:  #eef5f2;
  --sage-100: #dceae5;
  --sage-200: #b8d4cb;
  --sage-300: #8fb9ac;
  --sage-400: #6a9c8e;
  --sage-500: #517f72;
  --sage-600: #40655a;
  --sage-700: #345146;
  --sage-800: #293f37;
  --sage-900: #1c2b25;

  /* Neutrals — Paper & Ink (warm-leaning) */
  --paper:     #f8f5f0;   /* canvas / page */
  --paper-2:   #f1ece4;   /* card on paper, subtle elevation */
  --paper-3:   #e8e1d6;   /* recessed surfaces */
  --bone:      #ddd5c6;
  --stone-300: #c2bbac;
  --stone-500: #8a8273;
  --stone-700: #5a5345;
  --ink-700:   #3a352b;
  --ink-800:   #28241c;
  --ink-900:   #1a1813;   /* near-black, warm */
  --pure-white:#ffffff;

  /* Semantic — kept low-saturation to fit muted palette */
  --success:   #4f8a6a;
  --warning:   #b88a3e;
  --danger:    #b85c4f;
  --info:      var(--tide-600);

  /* =====================================================================
     SEMANTIC COLOR ROLES — use these in components
     ===================================================================== */
  --bg:           var(--paper);
  --bg-elev-1:    var(--paper-2);
  --bg-elev-2:    var(--pure-white);
  --bg-recess:    var(--paper-3);
  --bg-inverse:   var(--ink-900);

  --fg:           var(--ink-900);
  --fg-muted:     var(--stone-700);
  --fg-subtle:    var(--stone-500);
  --fg-faint:     var(--stone-300);
  --fg-inverse:   var(--paper);

  --border:       #e2dccf;            /* warm hairline */
  --border-strong:#cdc4b1;
  --border-focus: var(--tide-500);

  --accent:       var(--tide-600);
  --accent-fg:    var(--paper);
  --accent-bg:    var(--tide-50);

  --link:         var(--tide-700);
  --link-hover:   var(--tide-800);
  --selection:    color-mix(in oklab, var(--tide-300) 60%, var(--paper));

  /* =====================================================================
     TYPOGRAPHY — Figtree (humanist sans), Newsreader (editorial serif),
                  JetBrains Mono (code)
     ===================================================================== */
  --font-sans:   'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif:  'Newsreader', ui-serif, Georgia, 'Times New Roman', serif;
  --font-mono:   'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Type scale — modular, ~1.2 ratio with editorial jumps at the top */
  --text-2xs:  11px;
  --text-xs:   12px;
  --text-sm:   14px;
  --text-base: 16px;
  --text-md:   18px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  30px;
  --text-3xl:  38px;
  --text-4xl:  48px;
  --text-5xl:  64px;
  --text-6xl:  84px;

  /* Weights */
  --w-light: 300;
  --w-regular: 400;
  --w-medium: 500;
  --w-semibold: 600;
  --w-bold: 700;

  /* Line heights */
  --lh-tight:  1.08;
  --lh-snug:   1.2;
  --lh-normal: 1.45;
  --lh-relaxed:1.6;
  --lh-loose:  1.75;

  /* Letter spacing */
  --tr-tight:  -0.02em;
  --tr-snug:   -0.01em;
  --tr-normal: 0em;
  --tr-wide:   0.02em;
  --tr-wider:  0.08em;
  --tr-caps:   0.12em;

  /* =====================================================================
     SPACING — 4px base, named tokens
     ===================================================================== */
  --s-0:   0;
  --s-px:  1px;
  --s-1:   4px;
  --s-2:   8px;
  --s-3:   12px;
  --s-4:   16px;
  --s-5:   20px;
  --s-6:   24px;
  --s-7:   32px;
  --s-8:   40px;
  --s-9:   56px;
  --s-10:  72px;
  --s-11:  96px;
  --s-12:  128px;

  /* =====================================================================
     RADII — generous but never pill-by-default. Cards use lg.
     ===================================================================== */
  --r-xs:  4px;
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-2xl: 28px;
  --r-pill:999px;

  /* =====================================================================
     SHADOWS — soft, warm, low-saturation. Two systems: outer + inner.
     ===================================================================== */
  --shadow-xs:  0 1px 2px rgba(40, 36, 28, 0.05);
  --shadow-sm:  0 2px 4px rgba(40, 36, 28, 0.06), 0 1px 2px rgba(40, 36, 28, 0.04);
  --shadow-md:  0 6px 14px -4px rgba(40, 36, 28, 0.10), 0 2px 4px rgba(40, 36, 28, 0.05);
  --shadow-lg:  0 18px 36px -12px rgba(40, 36, 28, 0.16), 0 4px 8px rgba(40, 36, 28, 0.05);
  --shadow-xl:  0 36px 72px -20px rgba(40, 36, 28, 0.22), 0 8px 16px rgba(40, 36, 28, 0.06);

  --inner-soft: inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(40,36,28,0.04);
  --inner-deep: inset 0 2px 4px rgba(40,36,28,0.08);

  /* =====================================================================
     MOTION — slow-ish, soft easing. No bounces.
     ===================================================================== */
  --ease-out:    cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-soft:   cubic-bezier(0.4, 0, 0.2, 1);

  --dur-fast:   140ms;
  --dur-base:   220ms;
  --dur-slow:   420ms;
  --dur-slower: 700ms;

  /* =====================================================================
     LAYOUT
     ===================================================================== */
  --container-sm: 640px;
  --container-md: 880px;
  --container-lg: 1120px;
  --container-xl: 1320px;
  --container-2xl: 1480px;

  --gutter:    24px;
  --gutter-lg: 48px;
}

/* =========================================================================
   SEMANTIC TYPE STYLES — apply these classes/elements directly
   ========================================================================= */

html { font-family: var(--font-sans); color: var(--fg); background: var(--bg); }
body { font-family: var(--font-sans); font-size: var(--text-base); line-height: var(--lh-normal); color: var(--fg); -webkit-font-smoothing: antialiased; }

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

.h-display, .h-display-1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(48px, 8vw, var(--text-6xl));
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-tight);
  color: var(--ink-900);
  font-variation-settings: "opsz" 60;
}
.h-display-2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(36px, 5vw, var(--text-5xl));
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-tight);
  font-variation-settings: "opsz" 48;
}

h1, .h1 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-4xl);
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-tight);
  color: var(--ink-900);
}
h2, .h2 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-3xl);
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-snug);
  color: var(--ink-900);
}
h3, .h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-2xl);
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-snug);
}
h4, .h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-xl);
  line-height: var(--lh-snug);
}
h5, .h5 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--text-lg);
  line-height: var(--lh-normal);
}

.eyebrow, .overline {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--text-xs);
  letter-spacing: var(--tr-caps);
  text-transform: uppercase;
  color: var(--fg-muted);
}

.lead {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--text-lg);
  line-height: var(--lh-relaxed);
  color: var(--fg-muted);
  text-wrap: pretty;
}

p, .p {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-relaxed);
  color: var(--fg);
  text-wrap: pretty;
}

.small, small {
  font-size: var(--text-sm);
  line-height: var(--lh-normal);
  color: var(--fg-muted);
}

.caption {
  font-size: var(--text-xs);
  line-height: var(--lh-normal);
  color: var(--fg-subtle);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in oklab, currentColor 30%, transparent);
  transition: color var(--dur-fast) var(--ease-out), text-decoration-color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }

code, .code, kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-weight: 500;
  background: var(--paper-3);
  color: var(--ink-800);
  padding: 0.12em 0.36em;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  background: var(--ink-900);
  color: var(--paper);
  padding: var(--s-6);
  border-radius: var(--r-lg);
  overflow-x: auto;
}
pre code { background: transparent; border: 0; padding: 0; color: inherit; }

blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--text-xl);
  line-height: var(--lh-relaxed);
  color: var(--ink-800);
  border-left: 2px solid var(--tide-400);
  padding-left: var(--s-5);
  margin: var(--s-7) 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--s-7) 0;
}

/* Utility: serif italic moment for editorial flourish */
.flourish {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-variation-settings: "opsz" 36;
}

/* Focus ring — used everywhere */
:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
