/* ============================================
   WAGERWIT — BASE.CSS
   Design system tokens + reset + typography
   Apple App Store aesthetic
   ============================================ */

/* ============================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================ */
:root {
  /* Colors — Core */
  --color-bg:           #fbfbfd;
  --color-bg-secondary: #f2f2f4;
  --color-bg-tertiary:  #f8f8fa;
  --color-surface:      #fdfdff;

  /* Colors — Text */
  --color-text-primary:   #1a1a1c;
  --color-text-secondary: #86868b;
  --color-text-tertiary:  #aeaeb2;

  /* Colors — Border */
  --color-border:         rgba(0, 0, 0, 0.08);
  --color-border-strong:  rgba(0, 0, 0, 0.15);

  /* Colors — Accent */
  --color-accent:         #0066cc;
  --color-accent-hover:   #0077ed;
  --color-accent-light:   rgba(0, 102, 204, 0.08);
  --color-accent-medium:  rgba(0, 102, 204, 0.15);

  /* Colors — Semantic */
  --color-success:        #1a7f1a;
  --color-success-bg:     #e8f5e8;
  --color-warning:        #b35a00;
  --color-warning-bg:     #fff3e0;
  --color-info:           #1a5fcc;
  --color-info-bg:        #e8f0fe;
  --color-rating:         #ff9f0a;

  /* Colors — Score gradient */
  --color-score-high:     #1a7f1a;
  --color-score-mid:      #b35a00;
  --color-score-low:      #c0392b;

  /* Typography */
  --font-display: -apple-system, "SF Pro Display", "Inter", "Helvetica Neue", sans-serif;
  --font-body:    -apple-system, "SF Pro Text", "Inter", "Helvetica Neue", sans-serif;
  --font-mono:    "SF Mono", "Fira Code", monospace;

  /* Font sizes */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   22px;
  --text-xl:   28px;
  --text-2xl:  36px;
  --text-3xl:  48px;
  --text-4xl:  64px;

  /* Font weights */
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* Letter spacing — Apple style */
  --tracking-tight:   -0.04em;
  --tracking-tighter: -0.03em;
  --tracking-normal:  -0.02em;
  --tracking-wide:    0.04em;
  --tracking-wider:   0.08em;

  /* Line heights */
  --leading-none:    1;
  --leading-tight:   1.15;
  --leading-snug:    1.3;
  --leading-normal:  1.5;
  --leading-relaxed: 1.65;

  /* Spacing scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Border radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-2xl:  28px;
  --radius-full: 980px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:   0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg:   0 8px 24px rgba(0, 0, 0, 0.10), 0 4px 8px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 0 0.5px rgba(0, 0, 0, 0.08);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   200ms ease;
  --transition-slow:   300ms ease;
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --container-max:    1200px;
  --container-narrow: 800px;
  --container-wide:   1400px;
  --container-pad:    clamp(16px, 4vw, 48px);

  /* Header */
  --header-height: 52px;
}

/* ============================================
   2. RESET
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
}

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

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

a:hover {
  color: var(--color-accent-hover);
}

ul, ol {
  list-style: none;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: var(--text-base);
}

/* ============================================
   3. TYPOGRAPHY SCALE
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
}

h1 { font-size: clamp(var(--text-2xl), 5vw, var(--text-4xl));  letter-spacing: var(--tracking-tight); }
h2 { font-size: clamp(var(--text-xl), 3vw, var(--text-2xl));   letter-spacing: var(--tracking-tighter); }
h3 { font-size: clamp(var(--text-lg), 2.5vw, var(--text-xl));  letter-spacing: var(--tracking-normal); }
h4 { font-size: var(--text-lg);   letter-spacing: var(--tracking-normal); }
h5 { font-size: var(--text-md);   letter-spacing: -0.01em; }
h6 { font-size: var(--text-base); letter-spacing: -0.01em; }

p {
  line-height: var(--leading-relaxed);
  color: var(--color-text-primary);
}

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

strong {
  font-weight: var(--weight-semibold);
}

small {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* ============================================
   4. LAYOUT UTILITIES
   ============================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: var(--container-wide);
}

/* ============================================
   5. SECTION SPACING
   ============================================ */
.section {
  padding-block: var(--space-16);
}

.section--sm {
  padding-block: var(--space-8);
}

.section--lg {
  padding-block: var(--space-24);
}

/* ============================================
   6. SECTION HEADER (App Store style)
   ============================================ */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.section-header__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tighter);
  color: var(--color-text-primary);
}

.section-header__link {
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: var(--weight-regular);
  transition: opacity var(--transition-fast);
}

.section-header__link:hover {
  opacity: 0.75;
}

/* ============================================
   7. SCREEN READER 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-width: 0;
}

/* ============================================
   8. FOCUS STYLES (accessibility)
   ============================================ */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
