@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=Nunito+Sans:wght@800;900&family=DM+Mono:wght@400&family=Homemade+Apple&display=swap');

:root {
  /* ── shadcn base tokens ── The Chasm family: sand page, espresso ink ── */
  --background: #dfd7cc;
  --foreground: #21221c;
  --card: #e6dfd5;
  --card-foreground: #21221c;
  --popover: #e9e3da;
  --popover-foreground: #21221c;
  --primary: #382518;
  --primary-foreground: #efe9e1;
  --secondary: #d4cbbf;
  --secondary-foreground: #21221c;
  --muted: #d6cdc1;
  --muted-foreground: #5b5449;
  --accent: #d3c9bc;
  --accent-foreground: #21221c;
  --destructive: oklch(0.48 0.15 30);
  --destructive-foreground: oklch(0.95 0.012 82);
  --border: #a6998b;
  --input: #7d7062;
  --ring: #8A5748;
  --success: oklch(0.42 0.085 140);
  --warning: oklch(0.45 0.1 62);
  --chart-1: #8A5748;
  --chart-2: #382518;
  --chart-3: #a6998b;
  --chart-4: oklch(0.42 0.085 140);
  --chart-5: oklch(0.45 0.1 62);
  --sidebar: oklch(0.27 0.04 55);
  --sidebar-foreground: oklch(0.89 0.016 80);
  --sidebar-primary: oklch(0.56 0.08 35);
  --sidebar-primary-foreground: oklch(0.98 0.012 82);
  --sidebar-accent: oklch(0.33 0.04 55);
  --sidebar-accent-foreground: oklch(0.93 0.014 82);
  --sidebar-border: oklch(0.36 0.035 55);
  --sidebar-ring: oklch(0.62 0.07 35);

  /* ── surface hierarchy ────────────────────────────────────────── */
  --background-secondary: #d7cec2;
  --surface-hover:   color-mix(in srgb, var(--foreground) 6%,  var(--background));
  --surface-active:  color-mix(in srgb, var(--foreground) 10%, var(--background));
  --surface-elevated: #e9e3da;

  /* ── border hierarchy ─────────────────────────────────────────── */
  --border-subtle: #cfc5b8;
  --border-muted: #bfb3a5;
  --border-strong: #5b5449;

  /* ── text hierarchy ───────────────────────────────────────────── */
  --foreground-secondary: #5b5449;

  /* ── primary depth (hover/tint states for brand colour) ─────── */
  --primary-hover: color-mix(in srgb, var(--primary) 85%, var(--foreground));
  --primary-muted: color-mix(in srgb, var(--primary) 15%, var(--background));
  --primary-soft:  color-mix(in srgb, var(--primary) 8%,  var(--background));
  --primary-tint:  color-mix(in srgb, var(--primary) 5%,  var(--background));

  /* ── focus ring: solid clay so keyboard focus passes 3:1 on sand ─ */
  --clay: #8A5748;
  --clay-foreground: #f3eee7;
  --dust: #a6998b;
  --espresso: #382518;
  --ink-black: #161615;
  --focus-ring: #8A5748;

  /* ── error (form validation — distinct from destructive) ─────── */
  --error: oklch(0.44 0.15 30);
  --error-foreground: oklch(0.95 0.012 82);

  /* ── radius ── notebook corners: soft, never pill ─────────────── */
  --radius: 0.125rem;
  --radius-none: 0rem;
  --radius-sm: 0.0625rem;
  --radius-lg: 0.1875rem;
  --radius-xl: 0.25rem;
  --radius-full: 9999px;

  /* ── typography ───────────────────────────────────────────────── */
  --font-display: 'TCVolume', sans-serif;
  --font-sans: 'TCVolumeSans', sans-serif;
  --font-mono: "DM Mono", ui-monospace, SFMono-Regular, monospace;
  --font-eyebrow: "Avenir Black", "Avenir", "Avenir Next", "Nunito Sans", "DM Sans", ui-sans-serif, sans-serif;
  --font-script: "George Gibson", "Homemade Apple", "Instrument Serif", cursive;
  --font-weight-display: 400;
  --line-height-display: 1.08;
  --tracking-display: -0.01em;
  --font-weight-body: 400;
  --line-height-body: 1.6;
  --tracking-body: 0em;
  --font-weight-mono: 400;

  /* ── shadows ── warm, barely there ────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(56, 37, 24, 0.08);
  --shadow-md: 0 4px 14px rgba(56, 37, 24, 0.12);
  --shadow-lg: 0 14px 36px rgba(56, 37, 24, 0.18);

  /* ── motion ───────────────────────────────────────────────────── */
  --duration-fast: 120ms;
  --duration-normal: 220ms;
  --duration-slow: 360ms;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --ease-decelerate: cubic-bezier(0, 0, 0.2, 1);

  /* ── spacing ──────────────────────────────────────────────────── */
  --spacing-base: 0.25rem;
}

.dark {
  /* ── shadcn base tokens ── lamp-lit desk: black page, espresso panels ── */
  --background: oklch(0.17 0.004 100);
  --foreground: oklch(0.89 0.016 80);
  --card: oklch(0.23 0.02 60);
  --card-foreground: oklch(0.9 0.015 80);
  --popover: oklch(0.25 0.022 60);
  --popover-foreground: oklch(0.9 0.015 80);
  --primary: oklch(0.875 0.016 80);
  --primary-foreground: oklch(0.22 0.03 55);
  --secondary: oklch(0.29 0.022 60);
  --secondary-foreground: oklch(0.9 0.015 80);
  --muted: oklch(0.27 0.02 60);
  --muted-foreground: oklch(0.72 0.022 75);
  --accent: oklch(0.31 0.024 60);
  --accent-foreground: oklch(0.92 0.014 80);
  --destructive: oklch(0.66 0.15 30);
  --destructive-foreground: oklch(0.16 0.01 60);
  --primary-hover: color-mix(in srgb, var(--primary) 88%, white);
  --primary-muted: color-mix(in srgb, var(--primary) 16%, var(--background));
  --primary-soft:  color-mix(in srgb, var(--primary) 9%,  var(--background));
  --border: oklch(0.36 0.022 65);
  --input: oklch(0.4 0.022 65);
  --ring: oklch(0.68 0.08 35);
  --success: oklch(0.72 0.1 140);
  --warning: oklch(0.78 0.11 70);
  --chart-1: oklch(0.68 0.08 35);
  --chart-2: oklch(0.875 0.016 80);
  --chart-3: oklch(0.6 0.026 72);
  --chart-4: oklch(0.72 0.1 140);
  --chart-5: oklch(0.78 0.11 70);
  --sidebar: oklch(0.21 0.018 60);
  --sidebar-foreground: oklch(0.89 0.016 80);
  --sidebar-primary: oklch(0.68 0.08 35);
  --sidebar-primary-foreground: oklch(0.16 0.01 60);
  --sidebar-accent: oklch(0.28 0.022 60);
  --sidebar-accent-foreground: oklch(0.93 0.014 82);
  --sidebar-border: oklch(0.32 0.022 60);
  --sidebar-ring: oklch(0.68 0.08 35);

  /* ── surface hierarchy ────────────────────────────────────────── */
  --background-secondary: oklch(0.2 0.008 80);
  --surface-elevated: oklch(0.28 0.022 60);

  /* ── border hierarchy ─────────────────────────────────────────── */
  --border-subtle: oklch(0.27 0.018 65);
  --border-muted: oklch(0.31 0.02 65);
  --border-strong: oklch(0.5 0.024 68);

  /* ── text hierarchy ───────────────────────────────────────────── */
  --foreground-secondary: oklch(0.78 0.02 76);

  /* ── primary depth ────────────────────────────────────────────── */
  --primary-tint: color-mix(in srgb, var(--primary) 6%, var(--background));

  /* ── focus ring ───────────────────────────────────────────────── */
  --clay: #b07a69;
  --clay-foreground: #161615;
  --dust: #6f6458;
  --espresso: #dfd7cc;
  --ink-black: #161615;
  --focus-ring: oklch(0.68 0.08 35);

  /* ── error ────────────────────────────────────────────────────── */
  --error: oklch(0.7 0.15 30);
  --error-foreground: oklch(0.16 0.01 60);

  /* ── shadows ──────────────────────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.55);
}

/* Stencil Tweaks */
@font-face {
  font-family: 'TCVolume';
  src: url('/assets/fonts/TCVolume-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'TCVolumeSans';
  src: url('/assets/fonts/TCVolumeSans-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* /Stencil Tweaks */