/* base.css — reset, CSS custom properties, typography */

/* =========================================================
   CSS Custom Properties
   ========================================================= */
:root {
  /* Core colors */
  --color-bg:           #FAFAF8;
  --color-surface:      #FFFFFF;
  --color-border:       #E8E8E4;
  --color-border-strong: #D4D4CE;

  /* Text scale */
  --color-text:         #1a1a1a;
  --color-text-2:       #3a3a38;
  --color-text-muted:   #6a6a66;
  --color-text-faint:   #9a9a94;

  /* Accent (teal) */
  --color-accent:       #0D9488;
  --color-accent-ink:   #0B7A70;
  --color-accent-tint:  #E6F5F3;
  --color-accent-tint-2: #F4FAF9;

  /* Semantic status colors */
  --color-blue:         #0d6efd;
  --color-green:        #198754;
  --color-gold:         #ffc107;
  --color-red:          #dc3545;

  /* Ad slot */
  --color-ad:           #CFCFC9;

  /* Category color pairs (13 design tokens) */
  /* Badge text dark variants — WCAG AA contrast against tint backgrounds */
  --cat-corp-badge:       #7c2d12;
  --cat-fixed-badge:      #065f46;
  --cat-personal-badge:   #92400e;
  --cat-realestate-badge: #134e4a;
  --cat-crypto-badge:     #9a3412;
  --cat-valuation:        #4F46E5; --cat-valuation-tint:    #EEF0FE;
  --cat-fundamentals:     #0891B2; --cat-fundamentals-tint: #E2F3F8;
  --cat-technical:        #7C3AED; --cat-technical-tint:    #F0EAFE;
  --cat-corp:             #B45309; --cat-corp-tint:         #FBF1E3;
  --cat-fixed:            #059669; --cat-fixed-tint:        #E7F5EF;
  --cat-options:          #DB2777; --cat-options-tint:      #FBE8F2;
  --cat-macro:            #1F2937; --cat-macro-tint:        #ECEEF2;
  --cat-personal:         #D97706; --cat-personal-tint:     #FCEFDC;
  --cat-retire:           #065F46; --cat-retire-tint:       #DCEFE6;
  --cat-tax:              #9333EA; --cat-tax-tint:          #F3E8FF;
  --cat-crypto:           #C2410C; --cat-crypto-tint:       #FBE4D5;
  --cat-realestate:       #0F766E; --cat-realestate-tint:   #D8EDEB;
  --cat-risk:             #B91C1C; --cat-risk-tint:         #FBEAEA;

  /* Typography */
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
  --font-size-base: 1rem;       /* 16px */
  --font-size-sm:   0.875rem;   /* 14px */
  --font-size-xs:   0.75rem;    /* 12px */
  --font-size-lg:   1.125rem;   /* 18px */
  --font-size-xl:   1.25rem;    /* 20px */
  --font-size-2xl:  1.5rem;     /* 24px */
  --font-size-3xl:  1.875rem;   /* 30px */
  --font-size-4xl:  2.25rem;    /* 36px */
  --font-size-5xl:  3.75rem;    /* 60px */
  --line-height-body:    1.7;
  --line-height-heading: 1.15;
  --line-height-tight:   1.04;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Layout */
  --container-max: 1200px;
  --content-max:   760px;

  /* Border radius scale */
  --radius-sm: 0.375rem;  /* 6px */
  --radius:    0.5rem;    /* 8px */
  --radius-md: 0.625rem;  /* 10px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 0.875rem;  /* 14px */
  --radius-2xl: 1rem;     /* 16px */

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(20, 20, 15, 0.04);
  --shadow-md: 0 4px 14px rgba(20, 20, 15, 0.06), 0 1px 2px rgba(20, 20, 15, 0.04);
  --shadow-lg: 0 10px 32px -12px rgba(20, 20, 15, 0.08), 0 1px 2px rgba(20, 20, 15, 0.04);

  /* Focus ring */
  --focus-ring: 0 0 0 3px rgba(13, 148, 136, 0.22);

  /* Transitions */
  --transition-fast: 150ms ease;
}

/* =========================================================
   Reset
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

@supports not (scrollbar-gutter: stable) {
  html {
    overflow-y: scroll;
  }
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: var(--space-4);
  line-height: var(--line-height-heading);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }

p {
  margin-top: 0;
  margin-bottom: var(--space-4);
}

a {
  color: var(--color-accent-ink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

ol, ul {
  margin-top: 0;
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

li {
  margin-bottom: var(--space-1);
}

code, pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

img {
  max-width: 100%;
  height: auto;
}

/* =========================================================
   Utility
   ========================================================= */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-accent);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  text-decoration: none;
  z-index: 9999;
}

.skip-link:focus {
  top: var(--space-4);
}
