/* VibeStack style tokens. Light follows Catppuccin Latte, dark follows Tokyo Night, chosen by prefers-color-scheme.
   The pattern library forces a theme with data-theme="light" or data-theme="dark" on any element.
   Breakpoints (CSS cannot use variables in media queries): 600px and 960px.
   Soft backgrounds are 12 percent of their colour mixed into --surface. */

@font-face {
  font-family: "Inter";
  src: url("fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* Colour, light */
  --bg: #eff1f5;
  --surface: #ffffff;
  --surface-sunken: #e6e9ef;
  --border: #ccd0da;
  --border-strong: #7c7f93;
  --text: #4c4f69;
  --muted: #5c5f77;
  --accent: #8839ef;
  --accent-hover: #7527d8;
  --accent-text: #7527d8;
  --on-accent: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --good: #40a02b;
  --good-text: #1f6a10;
  --good-soft: color-mix(in srgb, var(--good) 12%, var(--surface));
  --warn: #df8e1d;
  --warn-text: #7f4a00;
  --warn-soft: color-mix(in srgb, var(--warn) 12%, var(--surface));
  --bad: #d20f39;
  --bad-text: #b0092f;
  --bad-soft: color-mix(in srgb, var(--bad) 12%, var(--surface));
  --focus: var(--accent);
  --brand-blue: #7aa2f7;
  --brand-violet: #bb9af7;

  /* Type */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-field: 0.9375rem;
  --text-field-phone: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.625rem;
  --text-2xl: 2rem;
  --leading-tight: 1.25;
  --leading-normal: 1.6;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;
  --space-9: 64px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* Shadow */
  --shadow: 0 1px 2px rgb(76 79 105 / 0.1), 0 1px 3px rgb(76 79 105 / 0.08);
  --shadow-hover: 0 4px 14px rgb(76 79 105 / 0.16);

  /* Breakpoints, for reference and for the pattern library */
  --bp-sm: 600px;
  --bp-lg: 960px;

  /* Motion: components use var(--motion) for every transition */
  --motion-duration: 140ms;
  --motion-ease: ease;
  --motion: var(--motion-duration) var(--motion-ease);

  /* Layout */
  --container: 60rem;
  --touch-target: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1b26;
    --surface: #1f2335;
    --surface-sunken: #16161e;
    --border: #3b4261;
    --border-strong: #737aa2;
    --text: #c0caf5;
    --muted: #9aa5ce;
    --accent: #7aa2f7;
    --accent-hover: #9db7fa;
    --accent-text: #7aa2f7;
    --on-accent: #1a1b26;
    --good: #9ece6a;
    --good-text: #9ece6a;
    --warn: #e0af68;
    --warn-text: #e0af68;
    --bad: #f7768e;
    --bad-text: #f7768e;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 1px 3px rgb(0 0 0 / 0.3);
    --shadow-hover: 0 4px 14px rgb(0 0 0 / 0.5);
  }
}

/* Forced themes for the pattern library (same values as above) */
[data-theme="light"] {
  color-scheme: light;
  --bg: #eff1f5;
  --surface: #ffffff;
  --surface-sunken: #e6e9ef;
  --border: #ccd0da;
  --border-strong: #7c7f93;
  --text: #4c4f69;
  --muted: #5c5f77;
  --accent: #8839ef;
  --accent-hover: #7527d8;
  --accent-text: #7527d8;
  --on-accent: #ffffff;
  --good: #40a02b;
  --good-text: #1f6a10;
  --warn: #df8e1d;
  --warn-text: #7f4a00;
  --bad: #d20f39;
  --bad-text: #b0092f;
  --shadow: 0 1px 2px rgb(76 79 105 / 0.1), 0 1px 3px rgb(76 79 105 / 0.08);
  --shadow-hover: 0 4px 14px rgb(76 79 105 / 0.16);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a1b26;
  --surface: #1f2335;
  --surface-sunken: #16161e;
  --border: #3b4261;
  --border-strong: #737aa2;
  --text: #c0caf5;
  --muted: #9aa5ce;
  --accent: #7aa2f7;
  --accent-hover: #9db7fa;
  --accent-text: #7aa2f7;
  --on-accent: #1a1b26;
  --good: #9ece6a;
  --good-text: #9ece6a;
  --warn: #e0af68;
  --warn-text: #e0af68;
  --bad: #f7768e;
  --bad-text: #f7768e;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 1px 3px rgb(0 0 0 / 0.3);
  --shadow-hover: 0 4px 14px rgb(0 0 0 / 0.5);
}

/* The soft colours are mixes of --surface, so they are set again where a theme is forced */
[data-theme] {
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --good-soft: color-mix(in srgb, var(--good) 12%, var(--surface));
  --warn-soft: color-mix(in srgb, var(--warn) 12%, var(--surface));
  --bad-soft: color-mix(in srgb, var(--bad) 12%, var(--surface));
  background: var(--bg);
  color: var(--text);
}

@media (min-width: 960px) {
  :root {
    --container: 70rem;
    --text-xl: 1.75rem;
    --text-2xl: 2.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root, [data-theme] { --motion-duration: 0s; }
}
