/*!
 * house-theme.css — the house design tokens, light-default with a first-class dark theme.
 *
 * STANDARD:  canon/house-theme-light-default-standard.md
 * TOKENS:    canon/house-theme-tokens.json                 (the one source; colors, scales, motion)
 * GATE:      scripts/core/theme-contrast-check.py --file canon/house-theme-tokens.json
 * GENERATE:  scripts/core/theme-contrast-check.py --file canon/house-theme-tokens.json --sync <this file>
 *
 * The block between the GENERATED markers is written by that script, which refuses to emit a theme
 * that fails contrast. Never edit it by hand; --check-sync goes red on drift. Everything outside the
 * markers is hand-written. SwiftUI apps use the sibling HouseTheme.swift, generated from the same JSON.
 *
 * Pair with house-theme.js (or the inline no-FOUC snippet in the standard) so `data-theme`
 * is set on <html> BEFORE first paint.
 */

/* BEGIN GENERATED house-theme tokens — edit canon/house-theme-tokens.json, then run
   scripts/core/theme-contrast-check.py --file canon/house-theme-tokens.json --sync <this file>.
   Ratios are computed by that script, never estimated. */
:root,
[data-theme="light"] {
  --bg:             #fafafa;
  --surface:        #ffffff;
  --ink:            #1a1a1a;  /* 16.67:1 on --bg · 17.40:1 on --surface */
  --ink-muted:      #55595f;  /* 6.75:1 on --bg · 7.05:1 on --surface */
  --border:         #d8dade;  /* 1.34:1 on --bg, DECORATIVE hairline only (SC 1.4.11 exempt) */
  --border-strong:  #7c828c;  /* 3.71:1 on --bg · 3.87:1 on --surface */
  --focus:          #0b5fff;  /* 4.91:1 on --bg · 5.13:1 on --surface */
  --accent:         #0b5fff;  /* 4.91:1 on --bg · 5.13:1 on --surface */
  --accent-ink:     #ffffff;  /* 5.13:1 on --accent */
  --danger:         #d70015;  /* 5.16:1 on --bg · 5.38:1 on --surface */
  --success:        #188236;  /* 4.70:1 on --bg · 4.90:1 on --surface */
  --warning:        #9a5b00;  /* 5.20:1 on --bg · 5.43:1 on --surface */
  --shadow-ink:     #000000;
  --shadow: 0px 0px 0px 1px rgba(0,0,0, 0.06), 0px 1px 2px -1px rgba(0,0,0, 0.06), 0px 2px 4px 0px rgba(0,0,0, 0.04);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg:             #14161a;
  --surface:        #1c1f25;
  --ink:            #ececee;  /* 15.35:1 on --bg · 13.99:1 on --surface */
  --ink-muted:      #a5abb5;  /* 7.84:1 on --bg · 7.15:1 on --surface */
  --border:         #2c3039;  /* 1.37:1 on --bg, DECORATIVE hairline only (SC 1.4.11 exempt) */
  --border-strong:  #6e7683;  /* 3.95:1 on --bg · 3.60:1 on --surface */
  --focus:          #7aa2ff;  /* 7.28:1 on --bg · 6.63:1 on --surface */
  --accent:         #7aa2ff;  /* 7.28:1 on --bg · 6.63:1 on --surface */
  --accent-ink:     #0b0d10;  /* 7.82:1 on --accent */
  --danger:         #ff6961;  /* 6.42:1 on --bg · 5.85:1 on --surface */
  --success:        #30db5b;  /* 9.84:1 on --bg · 8.97:1 on --surface */
  --warning:        #ffb340;  /* 10.16:1 on --bg · 9.26:1 on --surface */
  --shadow-ink:     #000000;
  --shadow: 0px 0px 0px 1px rgba(255,255,255, 0.08);
  color-scheme: dark;
}
@media print {
  :root, [data-theme] {
    --bg: #ffffff; --surface: #ffffff; --ink: #000000; --ink-muted: #55595f; --border: #cccccc; --border-strong: #7c828c; --focus: #0b5fff; --accent: #0b5fff; --accent-ink: #ffffff; --danger: #d70015; --success: #188236; --warning: #9a5b00; --shadow-ink: #000000;
    --shadow: 0px 0px 0px 1px rgba(0,0,0, 0.06), 0px 1px 2px -1px rgba(0,0,0, 0.06), 0px 2px 4px 0px rgba(0,0,0, 0.04);
    color-scheme: light;
  }
}
:root {
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  --hit-floor: 24px;
  --hit-desktop: 40px;
  --hit-touch: 44px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --leading-tight: 1.15;
  --leading-body: 1.6;
  --text-large-title: 34px;
  --weight-large-title: 400;
  --text-title1: 28px;
  --weight-title1: 400;
  --text-title2: 22px;
  --weight-title2: 400;
  --text-title3: 20px;
  --weight-title3: 400;
  --text-headline: 17px;
  --weight-headline: 600;
  --text-body: 17px;
  --weight-body: 400;
  --text-callout: 16px;
  --weight-callout: 400;
  --text-subheadline: 15px;
  --weight-subheadline: 400;
  --text-footnote: 13px;
  --weight-footnote: 400;
  --text-caption1: 12px;
  --weight-caption1: 400;
  --text-caption2: 11px;
  --weight-caption2: 400;
  --dur-fast: 150ms;
  --dur-enter: 300ms;
  --dur-exit: 150ms;
  --dur-stagger: 100ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --press-scale: 0.96;
}
/* END GENERATED house-theme tokens */
/* Base surface. Deliberately NOT #000-on-#fff: see the standard's readability section. */
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: var(--leading-body);
}

a { color: var(--accent); }

/* Focus must be visible in BOTH themes — never `outline: none` without a replacement. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Operable boundaries use --border-strong; ornamental rules use --border. */
input, select, textarea, button { border: 1px solid var(--border-strong); }
hr, .divider { border: 0; border-top: 1px solid var(--border); }

/* Theme toggle: a real control, keyboard operable, visible in both themes. */
.theme-toggle {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--focus); }

/* Theme switch snaps (IC-5). Do not interpolate body color; house-theme.js kills
   transitions around setTheme. prefers-reduced-motion still wraps any other motion. */

/* Print is always light: the print palette is in the generated block above. */
@media print {
  .theme-toggle { display: none; }
}
