/* 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);
}

/* ── Landing "Find your LLC" search bar (#335) ────────────────────────── */

/* Sage focus glow per the locked search-card design. Lives here because
 * :focus-within can't be expressed as a Reflex inline style. */
.llck-searchbar:focus-within {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-soft) !important;
}
.llck-searchbar:focus-within svg {
  color: var(--primary);
}

/* Strip Radix TextField chrome inside the landing search bar so the
 * debounce-wrapped rx.input inherits the bar's own styling. */
.llck-searchbar-input .rt-TextFieldRoot,
.llck-searchbar-input.rt-TextFieldRoot {
  all: unset;
  display: flex;
  flex: 1;
  min-width: 0;
}
.llck-searchbar-input input,
.llck-searchbar input.rt-reset {
  all: unset;
  flex: 1;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 18px;
  color: var(--ink);
}
.llck-searchbar input::placeholder {
  color: var(--muted);
}
@media (max-width: 767px) {
  .llck-searchbar input { font-size: 16px; }
}
/* Strip Radix TextField chrome inside debounced form inputs (#546) and
 * wizard inputs (#545) so the inner <input> renders exactly like the old
 * bare rx.el.input did. Replicates each _INPUT_CLASS in plain CSS because
 * `all: unset` would otherwise lose to the Tailwind utilities on
 * specificity-unstable ground. Mirrors the .llck-searchbar-input approach.
 */
.llck-form-input .rt-TextFieldRoot,
.llck-form-input.rt-TextFieldRoot,
.llck-wizard-input .rt-TextFieldRoot,
.llck-wizard-input.rt-TextFieldRoot {
  all: unset;
  display: contents;
}
.llck-form-input input,
.llck-wizard-input input {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  padding: 0.875rem 1rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 18px;
  line-height: 1.5;
  font-family: var(--font-sans);
  transition-property: color, background-color, border-color, box-shadow;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.llck-form-input input {
  color: var(--ink);
}
.llck-form-input input:focus {
  outline: none;
  border-color: var(--primary);
}
.llck-wizard-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}
.llck-form-input input::placeholder,
.llck-wizard-input input::placeholder {
  color: var(--muted);
  opacity: 1;
}
