/* Hopbox design tokens — v2.0 (November 2026)
 * Dark is the default theme. Add data-theme="light" on <html> (or any
 * container) for light surfaces. Raw palette values are --hb-*; build UI from
 * the semantic --color-* tokens so both themes work.
 *
 * Fonts (Google Fonts):
 * <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600&family=Martian+Mono:wght@400;500&display=swap">
 */

:root {
  /* Palette — "Lichen on basalt" */
  --hb-basalt: #0D0E0C;   /* ground */
  --hb-slag: #22231F;     /* surfaces, panels */
  --hb-ash: #3A3C35;      /* lines, borders on dark */
  --hb-stone: #5C5E57;    /* muted text on light */
  --hb-summit: #8E9088;   /* muted text on dark */
  --hb-mist: #B9BBB3;     /* secondary text on dark */
  --hb-alpine: #EDEEE8;   /* text on dark, light ground */
  --hb-paper: #FAFAF7;    /* raised surface on light */
  --hb-rule: #D6D8CF;     /* lines, borders on light */
  --hb-lichen: #C6EA2B;   /* the one accent — dark grounds only */
  --hb-lichen-tint: #2A3311; /* lichen badge background on dark */
  --hb-ember: #FF6B2C;    /* signal only: warnings, live/error states */

  /* Semantic — dark (default) */
  --color-bg: var(--hb-basalt);
  --color-surface: var(--hb-slag);
  --color-surface-sunken: #161714;
  --color-border: var(--hb-ash);
  --color-text: var(--hb-alpine);
  --color-text-secondary: var(--hb-mist);
  --color-text-muted: var(--hb-summit);
  --color-accent: var(--hb-lichen);          /* accent fills, cursor, focus */
  --color-on-accent: var(--hb-basalt);       /* text/icons on accent fills */
  --color-accent-text: var(--hb-lichen);     /* accent-coloured text (14:1 on basalt) */
  --color-accent-subtle: var(--hb-lichen-tint);
  --color-signal: var(--hb-ember);
  --color-focus: var(--hb-lichen);

  /* Type */
  --font-sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Martian Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-display: 600 72px/1.0 var(--font-sans);    /* letter-spacing: -0.035em */
  --text-heading: 600 48px/1.05 var(--font-sans);   /* letter-spacing: -0.03em */
  --text-title: 600 20px/1.3 var(--font-sans);      /* letter-spacing: -0.01em */
  --text-body: 400 17px/1.6 var(--font-sans);
  --text-small: 400 14px/1.5 var(--font-sans);
  --text-label: 500 12px/1.4 var(--font-mono);      /* uppercase, letter-spacing: 0.08em */
  --text-code: 400 14px/1.6 var(--font-mono);
  --tracking-display: -0.035em;
  --tracking-heading: -0.03em;
  --tracking-label: 0.08em;

  /* Shape & space */
  --radius-sm: 10px;   /* buttons, inputs, chips */
  --radius-md: 14px;   /* cards */
  --radius-lg: 20px;   /* panels */
  --radius-pill: 999px;
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px;
  --tap-min: 44px;

  /* Motion */
  --blink-duration: 1.1s;
}

[data-theme="light"] {
  --color-bg: var(--hb-alpine);
  --color-surface: var(--hb-paper);
  --color-surface-sunken: #E4E5DE;
  --color-border: var(--hb-rule);
  --color-text: var(--hb-basalt);
  --color-text-secondary: #2E302A;
  --color-text-muted: var(--hb-stone);
  /* Lichen fails contrast on light (1.2:1). On light, the accent is Basalt;
     Lichen may only appear as a fill with Basalt content on top. */
  --color-accent: var(--hb-basalt);
  --color-on-accent: var(--hb-alpine);
  --color-accent-text: var(--hb-basalt);
  --color-accent-subtle: #E9F6B3;
  --color-signal: #B33A09; /* darker ember: 5.1:1 on Alpine */
  --color-focus: var(--hb-basalt);
}

/* The blinking cursor — apply to the cursor polygon of the mark, or a █ in terminal UI. */
@keyframes hb-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.hb-blink { animation: hb-blink var(--blink-duration) infinite; }
@media (prefers-reduced-motion: reduce) { .hb-blink { animation: none; } }
