/* Veranda design system — global styles
 *
 * Loaded as a top-level <link rel="stylesheet"> from app/app.py so the rules
 * apply globally on top of Reflex's Tailwind preflight. Spec lives in
 * docs/design/veranda/README.md and issue #46.
 *
 * Why a real stylesheet (not rx.App(style={":root": ...}) or stylesheets=[]):
 *  - rx.App style dict gets applied as inline style to a CHILD component, not
 *    the document root, so :root vars never become globally inherited.
 *  - stylesheets=[] @imports get bundled inside Reflex's @layer __reflex_base,
 *    where Tailwind preflight wins specificity AND the browser leaves font
 *    faces 'unloaded' because nothing else declares them.
 *  - A plain stylesheet served from /assets/ is loaded with its own cascade
 *    weight and the font URLs are local — no third-party CDN dependency.
 */

/* ── Fonts ─────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'General Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/GeneralSans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'General Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/GeneralSans-500.woff2') format('woff2');
}
@font-face {
  font-family: 'General Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/GeneralSans-600.woff2') format('woff2');
}
@font-face {
  font-family: 'General Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/GeneralSans-700.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/JetBrainsMono-400.woff2') format('woff2');
}

/* ── Tokens (real :root rule, globally inherited) ─────────────────────── */

:root {
  --primary:       #5F7553;
  --primary-hover: #4D6043;
  --primary-soft:  #DDE5D5;
  --accent:        #C8633F;
  --accent-soft:   #F2DCCF;
  --brand-mark:    #D97757;  /* fixed favicon/logo mark color, per brief §1 */

  --ink:           #1F2820;
  --ink-soft:      #4A5448;
  --muted:         #7E8979;
  --cream:         #F2EFE3;
  --paper:         #F6F4EA;
  --surface:       #FFFFFF;
  --border:        #DDD9CC;
  --border-soft:   #E8E5D8;

  --success:       #4A7A3D;
  --success-bg:    #E1EDD8;
  --warning:       #C99A2E;
  --warning-bg:    #F7ECCB;
  --danger:        #B53B2E;
  --danger-bg:    #F4D9D2;

  --font-sans:     'General Sans', system-ui, -apple-system, sans-serif;
  --font-mono:     'JetBrains Mono', ui-monospace, monospace;

  --radius-sm:     12px;
  --radius-md:     18px;
  --radius-lg:     28px;
  --radius-pill:   999px;

  --shadow-card:   0 8px 32px rgba(31, 40, 32, 0.06);

  /* Override Tailwind preflight's default font stack so the entire app
   * inherits General Sans without having to touch every Tailwind class. */
  --default-font-family: 'General Sans', system-ui, -apple-system, sans-serif;
}

/* ── Global body defaults ─────────────────────────────────────────────── */

/* Use ! important because Tailwind preflight sets html/body font-family at
 * @layer __reflex_base specificity and our stylesheet loads in the user
 * cascade. The footprint here is intentional: every page picks up Veranda
 * paper + 18px body without changes to existing class names. */
html,
body {
  font-family: var(--font-sans) !important;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

/* Reflex wraps every page in <div class="radix-themes"> which Radix Themes
 * sets --default-font-family to its own system stack. Reflex's bundled CSS
 * loads AFTER our stylesheet so we need !important on the var override to
 * win the cascade. Once set, every rt-* Radix component (BaseButton, Badge,
 * Card, AvatarFallback) inherits General Sans via var(--default-font-family).
 *
 * Tailwind preflight's `font-family: --default-font-family, ui-sans-serif, ...`
 * is buggy CSS (var name not wrapped in var()), so we also pin font-family
 * directly on .radix-themes so non-Radix elements inherit through it. */
.radix-themes {
  --default-font-family: var(--font-sans) !important;
  font-family: var(--font-sans) !important;
}

/* Mono utility — used by status mono labels + EIN inputs. */
.font-mono,
code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
}
