/*
 * Next Commerce — Colors & Type (consolidated)
 *
 * This file bundles the four token files in tokens/ into a single drop-in stylesheet.
 * Load this ONCE in an HTML artifact and you get the full docs-channel design language:
 *   - Brand + semantic color scales
 *   - Layout, radius, shadow, spacing tokens
 *   - Dark mode (default) + Light mode (via [data-theme="light"])
 *   - Typography stacks and scale
 *   - Semantic element styles for prose (h1-h6, p, code, small, etc.)
 *
 * Loads Inter + JetBrains Mono from Google Fonts.
 * For production, prefer per-repo font loading (next/font/google, etc.).
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
 * BASE — mode-independent tokens
 * ============================================================ */
:root {
  /* Brand */
  --ds-primary: #3c7dff;
  --ds-primary-light: #79a5ff;
  --ds-primary-foreground: #ffffff;

  /* Sellmore (internal agency brand; cooler) */
  --ds-sellmore-primary: #3366ff;
  --ds-sellmore-primary-light: #6080ff;

  /* Semantic */
  --ds-green: #22c55e;
  --ds-yellow: #f59e0b;
  --ds-red: #f87171;
  --ds-orange: #fb923c;

  /* Layout */
  --ds-layout-max: 1600px;
  --ds-sidebar-w: 320px;
  --ds-toc-w: 320px;
  --ds-content-max: 880px;
  --ds-topbar-h: 60px;

  /* Radius */
  --ds-radius-sm: 0.375rem;  /* 6px */
  --ds-radius-md: 0.5rem;    /* 8px */
  --ds-radius-lg: 0.75rem;   /* 12px */
  --ds-radius-full: 9999px;

  /* Shadows — flat aesthetic */
  --ds-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --ds-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);

  /* Spacing (4px base) */
  --ds-space-2xs: 2px;
  --ds-space-xs: 4px;
  --ds-space-sm: 8px;
  --ds-space-md: 12px;
  --ds-space-base: 16px;
  --ds-space-lg: 24px;
  --ds-space-xl: 32px;
  --ds-space-2xl: 48px;
  --ds-space-3xl: 64px;

  --ds-num-spacing: -0.02em;

  /* Type */
  --ds-font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --ds-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --ds-text-4xl: 48px;
  --ds-text-3xl: 36px;
  --ds-text-2xl: 30px;
  --ds-text-xl: 24px;
  --ds-text-lg: 19px;
  --ds-text-base: 16px;
  --ds-text-md: 15px;
  --ds-text-sm: 14px;
  --ds-text-xs: 13px;
  --ds-text-2xs: 12px;
  --ds-text-3xs: 11px;
  --ds-text-4xs: 10.5px;

  --ds-leading-tight: 1.15;
  --ds-leading-snug: 1.3;
  --ds-leading-normal: 1.5;
  --ds-leading-relaxed: 1.7;
  --ds-leading-loose: 1.75;

  --ds-weight-normal: 400;
  --ds-weight-medium: 500;
  --ds-weight-semibold: 600;
  --ds-weight-bold: 700;
  --ds-weight-extrabold: 800;
}

/* ============================================================
 * DARK MODE (default — dark-first)
 * ============================================================ */
:root {
  color-scheme: dark;

  --ds-bg: #09090b;
  --ds-bg-2: rgba(255, 255, 255, 0.03);
  --ds-bg-3: rgba(255, 255, 255, 0.055);
  --ds-bg-hover: rgba(255, 255, 255, 0.07);
  --ds-bg-elevated: rgba(255, 255, 255, 0.045);

  --ds-border: rgba(255, 255, 255, 0.08);
  --ds-border-2: rgba(255, 255, 255, 0.14);

  --ds-txt: #fafafa;
  --ds-txt-2: #d4d4d8;
  --ds-txt-3: #a1a1aa;
  --ds-txt-4: #71717a;

  --ds-primary-muted: rgba(60, 125, 255, 0.12);
  --ds-primary-border: rgba(60, 125, 255, 0.26);
  --ds-primary-ring: rgba(60, 125, 255, 0.32);

  --ds-yellow-bg: rgba(245, 158, 11, 0.12);
  --ds-yellow-border: rgba(245, 158, 11, 0.28);
  --ds-green-bg: rgba(34, 197, 94, 0.12);
  --ds-green-border: rgba(34, 197, 94, 0.28);
  --ds-red-bg: rgba(248, 113, 113, 0.12);
  --ds-red-border: rgba(248, 113, 113, 0.28);
  --ds-orange-bg: rgba(251, 146, 60, 0.12);
  --ds-orange-border: rgba(251, 146, 60, 0.28);
}

/* ============================================================
 * LIGHT MODE — opt in via [data-theme="light"]
 * ============================================================ */
[data-theme="light"] {
  color-scheme: light;

  --ds-bg: #ffffff;
  --ds-bg-2: #fafafa;
  --ds-bg-3: #f4f4f5;
  --ds-bg-hover: #f4f7fb;
  --ds-bg-elevated: rgba(255, 255, 255, 0.96);

  --ds-border: #e4e4e7;
  --ds-border-2: #d4d4d8;

  --ds-txt: #09090b;
  --ds-txt-2: #27272a;
  --ds-txt-3: #71717a;
  --ds-txt-4: #a1a1aa;

  --ds-primary-muted: rgba(60, 125, 255, 0.08);
  --ds-primary-border: rgba(60, 125, 255, 0.2);
  --ds-primary-ring: rgba(60, 125, 255, 0.16);

  --ds-yellow-bg: rgba(245, 158, 11, 0.08);
  --ds-green-bg: rgba(34, 197, 94, 0.08);
  --ds-red-bg: rgba(248, 113, 113, 0.08);
  --ds-orange-bg: rgba(251, 146, 60, 0.08);
}

/* ============================================================
 * SEMANTIC ELEMENT STYLES
 * Use these by setting font-family: var(--ds-font-sans) on body,
 * then native h1/h2/p/code/etc. inherit reasonable defaults.
 * ============================================================ */
html, body {
  background: var(--ds-bg);
  color: var(--ds-txt);
  font-family: var(--ds-font-sans);
  font-size: var(--ds-text-base);
  line-height: var(--ds-leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--ds-txt);
  font-family: var(--ds-font-sans);
  line-height: var(--ds-leading-tight);
  text-wrap: balance;
  margin: 0;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--ds-text-3xl); font-weight: var(--ds-weight-bold); letter-spacing: -0.02em; }
h2 { font-size: var(--ds-text-2xl); font-weight: var(--ds-weight-bold); }
h3 { font-size: var(--ds-text-xl); font-weight: var(--ds-weight-semibold); }
h4 { font-size: var(--ds-text-lg); font-weight: var(--ds-weight-semibold); }
h5 { font-size: var(--ds-text-base); font-weight: var(--ds-weight-semibold); }
h6 { font-size: var(--ds-text-sm); font-weight: var(--ds-weight-semibold); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ds-txt-3); }

p {
  color: var(--ds-txt-2);
  margin: 0;
  text-wrap: pretty;
}

small, .ds-caption {
  font-size: var(--ds-text-xs);
  color: var(--ds-txt-3);
}

code, kbd, samp, pre {
  font-family: var(--ds-font-mono);
  font-size: 0.9em;
}

code {
  background: var(--ds-bg-3);
  border: 1px solid var(--ds-border);
  padding: 0.1em 0.35em;
  border-radius: var(--ds-radius-sm);
  font-size: var(--ds-text-xs);
  color: var(--ds-txt);
}

a {
  color: var(--ds-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--ds-primary-light); }

hr {
  border: 0;
  border-top: 1px solid var(--ds-border);
  margin: var(--ds-space-xl) 0;
}

::selection { background: var(--ds-primary-muted); }

:focus-visible {
  outline: 2px solid var(--ds-primary);
  outline-offset: 2px;
  border-radius: var(--ds-radius-sm);
}

/* Tabular numerics */
.ds-nums,
[data-nums],
td.num, th.num {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
