/*
 * Showroom theme contract.
 *
 * This is the only file a host needs to edit to rebrand the template. Every
 * component in app.css reads these semantic roles and never a raw colour.
 *
 * Both themes are declared once, together, through light-dark(). The root
 * follows the operating system until the reader makes an explicit choice, at
 * which point data-theme pins color-scheme and light-dark() resolves with it.
 */

@font-face {
  font-family: 'Familjen Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('./fonts/familjen-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Familjen Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('./fonts/familjen-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;

  /* ---- Typeface roles -------------------------------------------------- */
  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui,
    sans-serif;
  --font-display: 'Familjen Grotesk', var(--font-system);
  --font-body: var(--font-system);
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  /* ---- Type scale: five fixed steps, 1.25 ratio ------------------------ */
  --text-meta: 0.8125rem;
  --text-body: 1rem;
  --text-lead: 1.25rem;
  --text-title: 1.5625rem;
  --text-display: 1.953rem;

  --leading-tight: 1.25;
  --leading-snug: 1.4;
  --leading-prose: 1.6;
  --tracking-display: -0.015em;
  --tracking-micro: 0.07em;

  /* ---- Spacing: 4pt scale, named by relationship ----------------------- */
  --space-3xs: 4px;
  --space-2xs: 8px;
  --space-xs: 12px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;

  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Measure. Agent prose runs long; a user turn is a remark, not an essay. */
  --measure-shell: 52rem;
  --measure-prose: 68ch;
  --measure-user: 42ch;
  --gutter-mark: 22px;
  --target-min: 44px;

  /* ---- Motion: state communication only -------------------------------- */
  --motion-fast: 150ms;
  --motion-base: 200ms;
  --motion-slow: 250ms;
  --motion-pulse: 1400ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* ---- Page canvas ----------------------------------------------------- */
  --canvas: light-dark(oklch(0.972 0.006 95), oklch(0.185 0.006 95));

  /* ---- Surfaces -------------------------------------------------------- */
  --surface-primary: light-dark(oklch(0.945 0.008 95), oklch(0.225 0.007 95));
  --surface-secondary: light-dark(oklch(0.915 0.010 95), oklch(0.262 0.008 95));
  --surface-raised: light-dark(oklch(0.995 0.003 95), oklch(0.302 0.008 95));
  --surface-raised-shadow: light-dark(
    0 8px 24px oklch(0.28 0.008 95 / 0.14),
    0 8px 24px oklch(0.10 0.006 95 / 0.5)
  );

  /* ---- Text ------------------------------------------------------------ */
  --text-primary: light-dark(oklch(0.28 0.008 95), oklch(0.945 0.005 95));
  --text-secondary: light-dark(oklch(0.44 0.010 95), oklch(0.805 0.007 95));
  --text-muted: light-dark(oklch(0.48 0.010 95), oklch(0.705 0.008 95));
  --text-on-accent: light-dark(oklch(0.985 0.004 95), oklch(0.175 0.010 250));

  /* ---- Borders and separators ------------------------------------------ */
  --border-subtle: light-dark(oklch(0.885 0.008 95), oklch(0.315 0.008 95));
  /* Separators may be quiet; anything that outlines a control clears 3:1. */
  --border-strong: light-dark(oklch(0.610 0.012 95), oklch(0.605 0.012 95));

  /* ---- Accent ---------------------------------------------------------- */
  --accent: light-dark(oklch(0.44 0.079 250), oklch(0.760 0.082 250));
  --accent-hover: light-dark(oklch(0.375 0.075 250), oklch(0.840 0.065 250));
  --accent-quiet: light-dark(oklch(0.915 0.028 250), oklch(0.290 0.038 250));

  /* ---- Focus ----------------------------------------------------------- */
  --focus: light-dark(oklch(0.44 0.110 250), oklch(0.800 0.100 250));
  --focus-width: 3px;
  --focus-offset: 2px;

  /* ---- Status ---------------------------------------------------------- */
  --success: light-dark(oklch(0.435 0.095 150), oklch(0.775 0.098 150));
  --success-surface: light-dark(oklch(0.940 0.030 150), oklch(0.275 0.042 150));
  --warning: light-dark(oklch(0.470 0.105 75), oklch(0.815 0.105 80));
  --warning-surface: light-dark(oklch(0.945 0.038 75), oklch(0.288 0.045 80));
  --danger: light-dark(oklch(0.443 0.137 27), oklch(0.760 0.120 27));
  --danger-surface: light-dark(oklch(0.945 0.028 27), oklch(0.290 0.050 27));

  /* ---- Messages -------------------------------------------------------- */
  --message-user-surface: light-dark(oklch(0.905 0.014 95), oklch(0.278 0.010 95));
  --message-user-text: var(--text-primary);
  --message-user-border: light-dark(oklch(0.855 0.014 95), oklch(0.340 0.010 95));
  --message-agent-surface: transparent;
  --message-agent-text: var(--text-primary);
  --message-author: var(--text-secondary);
  --message-mark: var(--accent);

  /* ---- Code ------------------------------------------------------------ */
  --code-surface: light-dark(oklch(0.928 0.008 95), oklch(0.238 0.008 95));
  --code-text: light-dark(oklch(0.30 0.012 95), oklch(0.915 0.008 95));
  --code-border: var(--border-subtle);
  --code-inline-surface: light-dark(oklch(0.918 0.010 95), oklch(0.268 0.009 95));
  --code-inline-text: light-dark(oklch(0.30 0.012 95), oklch(0.925 0.008 95));

  /* ---- Composer -------------------------------------------------------- */
  --composer-chrome: light-dark(oklch(0.945 0.008 95), oklch(0.212 0.007 95));
  --composer-surface: light-dark(oklch(0.992 0.003 95), oklch(0.258 0.008 95));
  --composer-border: var(--border-strong);
  --composer-border-focus: var(--accent);
  --composer-text: var(--text-primary);
  --composer-placeholder: var(--text-muted);

  /* ---- Tool activity --------------------------------------------------- */
  --tool-surface: light-dark(oklch(0.935 0.008 95), oklch(0.240 0.008 95));
  --tool-border: var(--border-subtle);
  --tool-text: var(--text-secondary);
  --tool-name: var(--text-primary);
  --tool-requested: var(--text-muted);
  --tool-running: var(--accent);
  --tool-completed: var(--success);
  --tool-failed: var(--danger);

  /* ---- Disabled and loading -------------------------------------------- */
  --state-disabled-surface: light-dark(oklch(0.918 0.005 95), oklch(0.248 0.005 95));
  --state-disabled-text: light-dark(oklch(0.490 0.008 95), oklch(0.655 0.008 95));
  --state-disabled-border: var(--border-subtle);
  --state-loading-track: light-dark(oklch(0.895 0.008 95), oklch(0.300 0.008 95));
  --state-loading-indicator: var(--accent);
}

/* An explicit reader choice pins the scheme and therefore every light-dark(). */
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 1ms;
    --motion-base: 1ms;
    --motion-slow: 1ms;
  }
}
