/**
 * Burkett Investments - design tokens + component primitives
 * SSOT: 4. Marketing & Branding/Brand System/burkett-tokens.css
 * Sync into apps via _System/toolkit/sync_brand_tokens.sh
 *
 * Cybertruck / Cursor shell: black + steel + grey + gold ignition.
 * --navy* kept as aliases to black/steel for legacy selectors.
 */

:root {
  /* Surfaces - Cybertruck black / steel */
  --ink: #000000;
  --steel: #141414;
  --steel-2: #1c1c1c;
  --line: #2a2a2a;

  /* Deprecated navy aliases (map to black/steel) */
  --navy: var(--ink);
  --navy-2: var(--steel);

  /* Neutrals - cool grey family (no cream paper default) */
  --bone: #f5f5f5;
  --paper: #0a0a0a;
  --white: #ffffff;
  --mute: #8a8a8a;
  --grey: #8a8a8a;
  --grey-light: #b3b3b3;
  --line-light: #2a2a2a;
  --ink-600: #8a8a8a;

  /* Secondary brand - gold (~15-25% chromatic chrome) */
  --gold: #ead4a2;
  --gold-deep: #b6a57e;
  --gold-soft: #eddcb0;
  --gold-wash: rgba(234, 212, 162, 0.14);
  --gold-light: #eddcb0;

  /* Semantic accents (never replace gold on CTAs / nav chrome) */
  --bk-red: #e31937;
  --bk-blue: #3e6ae1;

  /* Status (data only) */
  --ok: #2f6b4f;
  --review: var(--bk-blue);
  --err: var(--bk-red);

  /* Cross-app aliases */
  --navy-mid: var(--steel);
  --navy-soft: var(--line);
  --cream: var(--bone);
  --cream-dark: var(--steel-2);
  --text-dark: var(--bone);
  --text-mid: var(--grey-light);
  --text-light: var(--mute);
  --ok-col: var(--ok);
  --surface-elevated: var(--steel);
  --border: var(--line);
  --muted: var(--mute);

  /* Type - Apple system stack (SF Pro on Apple, system UI elsewhere) */
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Geometry - soft product chrome (user direction 2026-08-03) */
  --radius: 0.5rem;      /* 8px buttons, inputs, chips */
  --radius-sm: 0.375rem; /* 6px compact */
  --radius-lg: 0.75rem;  /* 12px panels, sheets, cards */

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

  /* Type scale (dense product chrome, 2026-08-03s) */
  --text-xs: 0.64rem;
  --text-sm: 0.78rem;
  --text-base: 0.875rem;
  --text-md: 0.95rem;
  --text-lg: 1.1rem;
  --text-xl: 1.35rem;
  --text-2xl: clamp(1.5rem, 2.8vw, 2.1rem);
  --text-3xl: clamp(1.85rem, 4vw, 2.75rem);

  /* OS motion scale (aligned with os-shell) */
  --duration-micro: 140ms;
  --duration-control: 200ms;
  --duration-panel: 280ms;
  --duration-reveal: 500ms;
  --duration-line: 550ms;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  /* Legacy transitions.dev names (kept for older selectors) */
  --duration-stagger: 40ms;
  --duration-quick: var(--duration-control);
  --duration-fast: var(--duration-panel);
  --duration-medium: 350ms;
  --duration-slow: 400ms;
  --duration-very-slow: var(--duration-reveal);
  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: ease-in-out;
  --ease-out: ease-out;
  --ease-linear: linear;
  --ease-bounce: cubic-bezier(0.34, 1.36, 0.64, 1);
  --ease-bounce-strong: cubic-bezier(0.34, 3.85, 0.64, 1);
  --distance-micro: 4px;
  --distance-small: 6px;
  --distance-base: 8px;
  --distance-medium: 12px;
  --distance-large: 30px;
  --scale-large: 0.96;
  --scale-medium: 0.97;
  --scale-small: 0.98;
  --scale-tiny: 0.99;
  --blur-small: 2px;
  --blur-medium: 3px;
  --blur-large: 8px;

  /* Menu dropdown */
  --dropdown-open-dur: 250ms;
  --dropdown-close-dur: 150ms;
  --dropdown-pre-scale: 0.97;
  --dropdown-closing-scale: 0.99;
  --dropdown-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Texts reveal */
  --stagger-dur: 500ms;
  --stagger-distance: 12px;
  --stagger-stagger: 40ms;
  --stagger-blur: 3px;
  --stagger-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Accordion expand */
  --acc-expand: 250ms;
  --acc-collapse: 250ms;
  --acc-chevron: 250ms;
  --acc-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Emil aliases: press/micro, fast=control, med=panel */
  --motion-press: var(--duration-micro);
  --motion-fast: var(--duration-control);
  --motion-med: var(--duration-panel);
  --motion-slow: var(--duration-medium);
  --ease-drawer: var(--ease-out-expo);
  --ease: var(--ease-out-expo);

  /* Layout - Cursor-density shell */
  --sidebar-w: 260px;
  --topbar-h: 2.75rem;
  --content-max: 1120px;
  --narrow-max: 760px;

  /* Cool shell neutrals */
  --chrome-cool: #1c1c1c;
  --hairline-cool: #2a2a2a;

  /* Logo CSS vars (themeable SVG wordmarks) */
  --logo-primary: #ffffff;
  --logo-accent: #ead4a2;

  /* Semantic theme - dark Cybertruck default */
  --bg: var(--ink);
  --bg-elevated: var(--steel);
  --fg: var(--bone);
  --fg-muted: var(--mute);
  --chrome: var(--ink);
  --chrome-fg: var(--bone);
  --chrome-muted: var(--mute);
  --hairline: rgba(255, 255, 255, 0.12);
  --nav-hover: rgba(255, 255, 255, 0.06);
  --nav-active: var(--gold);
  --accent-bar: var(--gold);
  --input-bg: var(--steel);
  --code-bg: var(--steel-2);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elevated: #f4f4f4;
  --fg: #000000;
  --fg-muted: #5c5c5c;
  --chrome: #000000;
  --chrome-fg: #ffffff;
  --chrome-muted: #8a8a8a;
  --hairline: rgba(0, 0, 0, 0.12);
  --nav-hover: rgba(0, 0, 0, 0.06);
  --nav-active: var(--gold);
  --accent-bar: var(--gold);
  --input-bg: #ffffff;
  --code-bg: #f4f4f4;
  --logo-primary: #000000;
  --logo-accent: #b6a57e;
  --text-dark: #000000;
  --text-mid: #5c5c5c;
  --text-light: #8a8a8a;
  --surface-elevated: #f4f4f4;
  --border: #e5e5e5;
  --paper: #ffffff;
  --bone: #000000;
  --ink: #000000;
  --steel: #f4f4f4;
  --steel-2: #ebebeb;
  --line: #e5e5e5;
  --mute: #5c5c5c;
  --grey: #5c5c5c;
  --grey-light: #3a3a3a;
  --line-light: #e5e5e5;
  --ink-600: #5c5c5c;
  --cream: #000000;
  --cream-dark: #ebebeb;
}

html[data-theme="dark"],
:root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #000000;
  --bg-elevated: #141414;
  --fg: #ffffff;
  --fg-muted: #8a8a8a;
  --chrome: #000000;
  --chrome-fg: #ffffff;
  --chrome-muted: #8a8a8a;
  --hairline: rgba(255, 255, 255, 0.12);
  --nav-hover: rgba(255, 255, 255, 0.06);
  --nav-active: var(--gold);
  --accent-bar: var(--gold);
  --input-bg: #141414;
  --code-bg: #1c1c1c;
  --text-dark: #ffffff;
  --text-mid: #b3b3b3;
  --text-light: #8a8a8a;
  --surface-elevated: #141414;
  --border: #2a2a2a;
  --paper: #000000;
  --bone: #ffffff;
  --ink: #000000;
  --steel: #141414;
  --steel-2: #1c1c1c;
  --line: #2a2a2a;
  --mute: #8a8a8a;
  --grey: #8a8a8a;
  --grey-light: #b3b3b3;
}

/* -- Utilities -- */
.bk-sharp { border-radius: 0 !important; }

.bk-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--gold);
  margin: 0 0 var(--space-3);
}

.bk-divider {
  width: 48px;
  height: 1px;
  background: var(--gold);
  border: none;
  margin: 0 0 var(--space-5);
}

.bk-h1 {
  font-family: var(--font-sans);
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--bone);
  line-height: 1.1;
  margin: 0 0 var(--space-4);
}

.bk-h1.on-dark { color: var(--bone); }

/* -- Buttons --
   Compact, rounded, system type. Soft gold primary (never solid gold + black). */
.bk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: -0.01em;
  text-transform: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 1.5rem; /* 24px denser default */
  padding: 0.2rem 0.55rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateZ(0);
  transition:
    background var(--motion-fast) var(--ease-smooth-out),
    color var(--motion-fast) var(--ease-smooth-out),
    border-color var(--motion-fast) var(--ease-smooth-out),
    transform var(--motion-press) var(--ease-smooth-out);
}

/* Quiet chrome: Close, secondary row actions */
.bk-btn-sm {
  min-height: 1.35rem;
  padding: 0.12rem 0.4rem;
  font-size: 0.7rem;
  border-radius: var(--radius-sm);
  gap: 0.2rem;
}

/* Rare larger control */
.bk-btn-lg {
  min-height: 2rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.8125rem;
  border-radius: var(--radius);
}

.bk-btn:disabled,
.bk-btn.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.bk-btn:active:not(:disabled):not(.is-disabled) {
  transform: scale(0.98);
}

.bk-btn:focus-visible {
  outline: 2px solid var(--bk-blue);
  outline-offset: 2px;
}

/* Primary: soft gold wash + gold text (never solid gold slab + black type) */
.bk-btn-primary {
  background: color-mix(in srgb, var(--gold) 16%, var(--bg));
  color: var(--gold-deep);
  border-color: color-mix(in srgb, var(--gold) 45%, var(--line));
}

/* Ghost / outline: white (page bg) + gold type + gold edge */
.bk-btn-ghost {
  background: var(--bg);
  color: var(--gold-deep);
  border-color: color-mix(in srgb, var(--gold) 50%, var(--line));
}

.bk-btn-ink {
  background: var(--steel);
  color: var(--fg);
  border-color: var(--line);
}

html[data-theme="dark"] .bk-btn-primary,
:root:not([data-theme="light"]) .bk-btn-primary {
  background: var(--gold-wash);
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 38%, transparent);
}

html[data-theme="dark"] .bk-btn-ghost,
:root:not([data-theme="light"]) .bk-btn-ghost {
  background: transparent;
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
}

.bk-btn-primary:focus-visible,
.bk-btn-ghost:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--gold) 70%, var(--bk-blue, #4a6fa5));
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .bk-btn-primary:hover {
    background: color-mix(in srgb, var(--gold) 26%, var(--bg));
    border-color: var(--gold);
    color: var(--gold-deep);
  }

  html[data-theme="dark"] .bk-btn-primary:hover,
  :root:not([data-theme="light"]) .bk-btn-primary:hover {
    background: color-mix(in srgb, var(--gold) 22%, var(--bg));
    color: var(--gold);
    border-color: var(--gold);
  }

  .bk-btn-ghost:hover {
    background: color-mix(in srgb, var(--gold) 10%, var(--bg));
    border-color: var(--gold);
    color: var(--gold-deep);
  }

  html[data-theme="dark"] .bk-btn-ghost:hover,
  :root:not([data-theme="light"]) .bk-btn-ghost:hover {
    background: color-mix(in srgb, var(--gold) 12%, transparent);
    color: var(--gold);
    border-color: var(--gold);
  }

  .bk-btn-ink:hover {
    border-color: var(--gold);
    color: var(--gold);
  }
}

/* -- Forms -- */
.bk-input,
.bk-select,
.bk-textarea {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--bone);
  background: var(--steel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  width: 100%;
  transition: border-color var(--duration-control) var(--ease-out-expo);
}

.bk-input:focus,
.bk-select:focus,
.bk-textarea:focus {
  outline: none;
  border-color: var(--bk-blue);
}

.bk-input:focus-visible,
.bk-select:focus-visible,
.bk-textarea:focus-visible {
  outline: 2px solid var(--bk-blue);
  outline-offset: 1px;
}

.bk-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.bk-field > label,
.bk-field > span {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--mute);
}

.bk-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--grey-light);
}

.bk-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--gold);
  border-radius: var(--radius-sm);
}

/* -- Tables -- */
.bk-table-wrap {
  border: 1px solid var(--line);
  background: var(--steel);
  overflow: auto;
  border-radius: var(--radius-lg);
}

.bk-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--bone);
}

.bk-table th {
  text-align: left;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  font-size: 0.7rem;
  color: var(--fg-muted, var(--mute));
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0.55rem;
  background: color-mix(in srgb, var(--bg-elevated, var(--steel)) 88%, var(--bg));
}

.bk-table td {
  padding: 0.35rem 0.55rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--fg, var(--bone));
}

html[data-theme="light"] .bk-table th {
  background: #f3f3f4;
  color: #5c5c5c;
}

html[data-theme="light"] .bk-table td {
  color: #111;
}

.bk-table tr.is-selected td,
.bk-table tr.selected td {
  background: var(--gold-wash);
  box-shadow: inset 3px 0 0 var(--gold);
}

.bk-table-light {
  border: 1px solid var(--line);
  background: var(--steel);
}

.bk-table-light .bk-table {
  color: var(--bone);
}

.bk-table-light .bk-table th {
  background: var(--ink);
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.bk-table-light .bk-table td {
  border-bottom-color: var(--line);
}


/* -- Alerts (Identity Controls toast strip) -- */
.bk-alert {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  border-radius: var(--radius-lg);
  border-left: 2px solid var(--line);
  background: var(--paper);
  padding: 0.85rem 1rem;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--mute);
}

.bk-alert > span:first-child,
.bk-alert-label {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.bk-alert-info {
  border-left-color: var(--bk-blue);
}

.bk-alert-info > span:first-child,
.bk-alert-info .bk-alert-label {
  color: var(--bk-blue);
}

.bk-alert-risk {
  border-left-color: var(--bk-red);
}

.bk-alert-risk > span:first-child,
.bk-alert-risk .bk-alert-label {
  color: var(--bk-red);
}

.bk-alert-neutral {
  border-left-color: var(--line);
}

.bk-alert-neutral > span:first-child,
.bk-alert-neutral .bk-alert-label {
  color: var(--mute);
}

/* -- Status -- */
.bk-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  padding: 0.2rem 0.45rem;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  background: transparent;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bk-badge-ok { color: var(--ok); }
.bk-badge-review { color: var(--review); }
.bk-badge-err { color: var(--err); }
.bk-badge-gold { color: var(--gold); }

.bk-status-ok { color: var(--ok); }
.bk-status-review { color: var(--review); }
.bk-status-err { color: var(--err); }

/* -- Tiles / KPI -- */
.bk-tile {
  display: flex;
  flex-direction: column;
  background: var(--steel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--motion-fast) var(--ease-smooth-out);
  overflow: hidden;
}

@media (hover: hover) and (pointer: fine) {
  .bk-tile:hover { border-color: var(--gold); }
}

.bk-tile-ink {
  background: var(--ink);
  border-color: var(--gold);
  color: var(--bone);
}

.bk-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

.bk-kpi {
  background: var(--steel);
  border: 1px solid var(--line);
  border-top: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  overflow: hidden;
  min-width: 0;
}

.bk-kpi .k {
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--mute);
  margin-bottom: var(--space-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bk-kpi .v {
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--bone);
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* -- Callout / chrome -- */
.bk-callout {
  background: var(--steel);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin: var(--space-4) 0;
}

.bk-footer-lock {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  color: var(--mute);
  padding: var(--space-4) 0;
}

.bk-footer-lock::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  background: var(--gold);
  margin-right: 0.45rem;
  vertical-align: middle;
}

/* Reveal motion */
.bk-reveal,
.reveal {
  opacity: 0;
  transform: translateY(var(--distance-medium));
  transition:
    opacity var(--duration-fast) var(--ease-smooth-out),
    transform var(--duration-fast) var(--ease-smooth-out);
}

.bk-reveal.is-visible,
.bk-reveal.visible,
.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .bk-reveal,
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .bk-btn {
    transition:
      background var(--motion-fast) var(--ease-smooth-out),
      color var(--motion-fast) var(--ease-smooth-out),
      border-color var(--motion-fast) var(--ease-smooth-out);
  }

  .bk-btn:active:not(:disabled):not(.is-disabled) {
    transform: none;
  }
}
