/*
 * MHE Buyer Portal — Design Tokens
 * Extracted from pulse.matthewhoult.com main CSS bundle (index-Bp7LOm1E.css).
 * Kept variable names identical so anyone familiar with pulse feels at home.
 * Deviations from pulse are explicit and commented.
 */

:root,
:root[data-theme="light"] {
  color-scheme: light;

  /* Surface */
  --bg: #f4f1eb;
  --bg-card: #faf8f4;
  --bg-sidebar: #faf8f4;
  --bg-card-hover: #f0ede6;
  --hover: #f0ede6;
  --surface: #faf8f4;

  /* Ink (text) */
  --ink: #3b3228;
  --ink-mid: #a89f8e;   /* pulse uses this for secondary in dark;
                            in light, secondary is #6e6758 — see below */
  --ink-secondary: #6e6758;
  --ink-faint: #948b7a;

  /* Borders */
  --border: #ddd8ce;
  --border-light: #ccc7bb;

  /* Accents */
  --accent: #6b8f8b;
  --accent-light: #82a8a4;
  --accent-bg: #6b8f8b1f;
  --accent-rgb: 107, 143, 139;

  --amber: #c49a3c;
  --amber-bg: #c49a3c1f;
  --amber-text: #7d5f1e;

  --green: #8a9a7b;
  --green-bg: #8a9a7b1f;

  --red: #b5674a;
  --red-bg: #b5674a1f;
  --red-text: #8f4a30;

  --blue: #6b8e8e;
  --blue-bg: #6b8e8e1f;

  /* Shadows */
  --shadow: 0 1px 3px #00000014;
  --shadow-lg: 0 4px 12px #0000001a;
  --focus-ring: 0 0 0 2px var(--accent);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #1a1814;
  --bg-card: #242118;
  --bg-sidebar: #1e1b15;
  --bg-card-hover: #2c2920;
  --hover: #2c2920;
  --surface: #242118;

  --ink: #e8e2d6;
  --ink-mid: #a89f8e;
  --ink-secondary: #a89f8e;
  --ink-faint: #756b5b;

  --border: #3a352a;
  --border-light: #4a4438;

  --accent: #5a7b77;
  --accent-light: #6b8f8b;
  --accent-bg: #5a7b7714;
  --accent-rgb: 90, 123, 119;

  --amber: #a47e2e;
  --amber-bg: #a47e2e14;
  --amber-text: #d9a94f;

  --green: #6e7f5e;
  --green-bg: #6e7f5e14;

  --red: #9e5539;
  --red-bg: #9e55390f;
  --red-text: #cd7d5f;

  --blue: #5a7b7b;
  --blue-bg: #5a7b7b14;

  --shadow: 0 1px 3px #0000004d;
  --shadow-lg: 0 4px 12px #0006;
  --focus-ring: 0 0 0 2px var(--accent);
}

/* Default to dark when the user's OS says so and no explicit override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #1a1814;
    --bg-card: #242118;
    --bg-sidebar: #1e1b15;
    --bg-card-hover: #2c2920;
    --hover: #2c2920;
    --surface: #242118;

    --ink: #e8e2d6;
    --ink-mid: #a89f8e;
    --ink-secondary: #a89f8e;
    --ink-faint: #756b5b;

    --border: #3a352a;
    --border-light: #4a4438;

    --accent: #5a7b77;
    --accent-light: #6b8f8b;
    --accent-bg: #5a7b7714;
    --accent-rgb: 90, 123, 119;

    --amber: #a47e2e;
    --amber-bg: #a47e2e14;
    --amber-text: #d9a94f;

    --green: #6e7f5e;
    --green-bg: #6e7f5e14;

    --red: #9e5539;
    --red-bg: #9e55390f;
    --red-text: #cd7d5f;

    --blue: #5a7b7b;
    --blue-bg: #5a7b7b14;

    --shadow: 0 1px 3px #0000004d;
    --shadow-lg: 0 4px 12px #0006;
  }
}

:root {
  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "Fira Code", ui-monospace, Menlo, monospace;
  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;

  /* DEVIATION FROM PULSE: bump base for client-facing readability */
  --text-xs: 0.75rem;      /* 12 */
  --text-sm: 0.8125rem;    /* 13 */
  --text-base: 0.9375rem;  /* 15 (pulse: .875 / 14) */
  --text-md: 1rem;         /* 16 */
  --text-lg: 1.125rem;     /* 18 */
  --text-xl: 1.25rem;      /* 20 */
  --text-2xl: 1.5rem;      /* 24 */
  --text-3xl: 1.875rem;    /* 30 — for hero address */

  /* Spacing scale (px-based, keep it small) */
  --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;

  /* Radius */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  /* Motion */
  --t-fast: 0.12s;
  --t-med: 0.24s;
  --t-slow: 0.4s;
  --transition: 0.15s ease;
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --container-max: 1200px;
  --touch-min: 44px;

  /* Status colors (see UX spec § status) */
  --status-active: var(--ink);
  --status-backup: var(--amber);
  --status-pending: var(--red);
  --status-sold: var(--ink);
  --delta-up: var(--green);
  --delta-down: var(--red);
}

/* Base reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

@media (max-width: 768px) {
  body {
    font-size: var(--text-md);
  }
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

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

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
