/*
 * MapsHQ design tokens.
 *
 * Every colour, type size, radius and shadow a view uses is named here, once
 * for light and once for dark. Views never use these variables directly: they
 * use ts-css utilities (`bg-page`, `text-fg-muted`, `rounded-panel`,
 * `shadow-md`), and config/css.ts points those utilities at these variables
 * through stx's role tokens. The components from @stacksjs/components draw
 * from the same roles, so a <Button> and a hand-written header agree.
 *
 * Dark mode is the `dark` class stx's colour-mode boot script puts on <html>
 * (config/ui.ts `app.colorMode`): it follows the system preference until the
 * visitor picks light or dark with the theme toggle, which is stored locally.
 *
 * The admin area re-points the accent with `data-area="admin"` on <html>;
 * it has to be the root element, because stx resolves `--stx-<role>` there.
 *
 * Contrast: every `fg*` role except `fg-subtle` meets WCAG AA (4.5:1) on
 * `page`, `content` and `panel` in both modes, and every `*-ink` meets it on
 * its `*-solid`. `fg-subtle` is for decoration and placeholder-adjacent text
 * that is never the only carrier of meaning. `line-strong` meets 3:1 against
 * `panel` for control borders (WCAG 1.4.11); `line` is for dividers only.
 */

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/geist/geist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/geist/geist-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  /* Type */
  --mhq-font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mhq-font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* A 1.2 (minor third) scale from a 16px body, with line heights on a 4px grid. */
  --mhq-text-xs: 0.75rem;
  --mhq-leading-xs: 1rem;
  --mhq-text-sm: 0.875rem;
  --mhq-leading-sm: 1.25rem;
  --mhq-text-base: 1rem;
  --mhq-leading-base: 1.5rem;
  --mhq-text-lg: 1.125rem;
  --mhq-leading-lg: 1.75rem;
  --mhq-text-xl: 1.25rem;
  --mhq-leading-xl: 1.75rem;
  --mhq-text-2xl: 1.5rem;
  --mhq-leading-2xl: 2rem;
  --mhq-text-3xl: 1.875rem;
  --mhq-leading-3xl: 2.25rem;
  --mhq-text-4xl: 2.25rem;
  --mhq-leading-4xl: 2.5rem;
  --mhq-text-5xl: 3rem;
  --mhq-leading-5xl: 1.1;

  /* Shape */
  --mhq-radius-control: 0.5rem;
  --mhq-radius-panel: 0.75rem;
  --mhq-radius-pill: 9999px;

  /* Elevation */
  --mhq-shadow-xs: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --mhq-shadow-sm: 0 1px 3px 0 rgb(15 23 42 / 0.08), 0 1px 2px -1px rgb(15 23 42 / 0.08);
  --mhq-shadow-md: 0 4px 8px -2px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.06);
  --mhq-shadow-lg: 0 12px 24px -6px rgb(15 23 42 / 0.12), 0 4px 8px -4px rgb(15 23 42 / 0.08);
  --mhq-shadow-xl: 0 24px 48px -12px rgb(15 23 42 / 0.18);

  /* Layout */
  --mhq-sidebar-width: 16rem;
  --mhq-header-height: 4rem;
  --mhq-content-max: 72rem;
  --mhq-prose-max: 44rem;

  /* Text */
  --mhq-color-fg: #0f172a;
  --mhq-color-fg-strong: #1e293b;
  --mhq-color-fg-muted: #475569;
  --mhq-color-fg-soft: #5b6678;
  --mhq-color-fg-subtle: #94a3b8;

  /* Surfaces */
  --mhq-color-page: #f6f8fa;
  --mhq-color-content: #ffffff;
  --mhq-color-panel: #ffffff;
  --mhq-color-field: #ffffff;
  --mhq-color-surface: #f6f8fa;
  --mhq-color-surface-raised: #eef2f6;
  --mhq-color-surface-sunken: #e6ebf1;
  --mhq-color-surface-hover: #eef2f6;
  --mhq-color-surface-raised-hover: #e2e8ef;
  --mhq-color-surface-sunken-hover: #d6dee7;
  --mhq-color-field-hover: #f6f8fa;
  --mhq-color-inverse: #0f172a;
  --mhq-color-inverse-ink: #f8fafc;

  /* Lines */
  --mhq-color-line: #e2e8f0;
  --mhq-color-line-strong: #8794a5;
  --mhq-color-line-hover: #6b7889;

  /* Links */
  --mhq-color-link: #0b6b6f;
  --mhq-color-link-hover: #084f52;

  /* Accent: MapsHQ teal. #0d7377 is 5.6:1 against white. */
  --mhq-color-accent: #0d7377;
  --mhq-color-accent-solid: #0d7377;
  --mhq-color-accent-solid-hover: #0a5e61;
  --mhq-color-accent-ink: #ffffff;
  --mhq-color-accent-soft: #e0f2f1;
  --mhq-color-accent-soft-ink: #0a4f52;

  /* Status */
  --mhq-color-info: #1d5fc2;
  --mhq-color-info-solid: #1d5fc2;
  --mhq-color-info-solid-hover: #174c9b;
  --mhq-color-info-ink: #ffffff;
  --mhq-color-info-soft: #e5efff;
  --mhq-color-info-soft-ink: #163f80;

  --mhq-color-success: #17723c;
  --mhq-color-success-solid: #17723c;
  --mhq-color-success-solid-hover: #125c30;
  --mhq-color-success-ink: #ffffff;
  --mhq-color-success-soft: #e3f5ea;
  --mhq-color-success-soft-ink: #115128;

  --mhq-color-warning: #8a5300;
  --mhq-color-warning-solid: #8a5300;
  --mhq-color-warning-solid-hover: #6f4300;
  --mhq-color-warning-ink: #ffffff;
  --mhq-color-warning-soft: #fdf1dc;
  --mhq-color-warning-soft-ink: #6b4100;

  --mhq-color-danger: #b42318;
  --mhq-color-danger-solid: #c4291c;
  --mhq-color-danger-solid-hover: #a12117;
  --mhq-color-danger-ink: #ffffff;
  --mhq-color-danger-soft: #fdecea;
  --mhq-color-danger-soft-ink: #8a1b12;
  --mhq-color-danger-fg: #b42318;
  --mhq-color-danger-line: #f3b4ad;

  --mhq-color-secondary: #475569;
  --mhq-color-secondary-solid: #475569;
  --mhq-color-secondary-solid-hover: #334155;
  --mhq-color-secondary-ink: #ffffff;
  --mhq-color-secondary-soft: #eef2f6;
  --mhq-color-secondary-soft-ink: #334155;
}

.dark {
  color-scheme: dark;

  --mhq-shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --mhq-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.45), 0 1px 2px -1px rgb(0 0 0 / 0.45);
  --mhq-shadow-md: 0 4px 8px -2px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --mhq-shadow-lg: 0 12px 24px -6px rgb(0 0 0 / 0.55), 0 4px 8px -4px rgb(0 0 0 / 0.45);
  --mhq-shadow-xl: 0 24px 48px -12px rgb(0 0 0 / 0.65);

  --mhq-color-fg: #e8eef4;
  --mhq-color-fg-strong: #d3dce6;
  --mhq-color-fg-muted: #a9b6c4;
  --mhq-color-fg-soft: #93a2b3;
  --mhq-color-fg-subtle: #5e6d7e;

  --mhq-color-page: #0b1015;
  --mhq-color-content: #0f151b;
  --mhq-color-panel: #141c24;
  --mhq-color-field: #18212b;
  --mhq-color-surface: #0f151b;
  --mhq-color-surface-raised: #18212b;
  --mhq-color-surface-sunken: #1d2732;
  --mhq-color-surface-hover: #1a242e;
  --mhq-color-surface-raised-hover: #222d39;
  --mhq-color-surface-sunken-hover: #283442;
  --mhq-color-field-hover: #1d2732;
  --mhq-color-inverse: #e8eef4;
  --mhq-color-inverse-ink: #0b1015;

  --mhq-color-line: #233041;
  --mhq-color-line-strong: #5d6e84;
  --mhq-color-line-hover: #75879e;

  --mhq-color-link: #5fd4ca;
  --mhq-color-link-hover: #8ae4dc;

  --mhq-color-accent: #5fd4ca;
  --mhq-color-accent-solid: #3fbfb4;
  --mhq-color-accent-solid-hover: #5fd4ca;
  --mhq-color-accent-ink: #05211f;
  --mhq-color-accent-soft: #10302f;
  --mhq-color-accent-soft-ink: #8ae4dc;

  --mhq-color-info: #7cb2ff;
  --mhq-color-info-solid: #5a9cff;
  --mhq-color-info-solid-hover: #7cb2ff;
  --mhq-color-info-ink: #071a36;
  --mhq-color-info-soft: #13253f;
  --mhq-color-info-soft-ink: #a9cbff;

  --mhq-color-success: #5fd08c;
  --mhq-color-success-solid: #3fbf72;
  --mhq-color-success-solid-hover: #5fd08c;
  --mhq-color-success-ink: #052312;
  --mhq-color-success-soft: #112b1c;
  --mhq-color-success-soft-ink: #92e3b2;

  --mhq-color-warning: #f2b552;
  --mhq-color-warning-solid: #f0a83a;
  --mhq-color-warning-solid-hover: #f2b552;
  --mhq-color-warning-ink: #2a1a00;
  --mhq-color-warning-soft: #33250c;
  --mhq-color-warning-soft-ink: #f7cf8c;

  --mhq-color-danger: #ff8a7f;
  --mhq-color-danger-solid: #f2675a;
  --mhq-color-danger-solid-hover: #ff8a7f;
  --mhq-color-danger-ink: #2b0602;
  --mhq-color-danger-soft: #3a1512;
  --mhq-color-danger-soft-ink: #ffb4ab;
  --mhq-color-danger-fg: #ff8a7f;
  --mhq-color-danger-line: #6e2a24;

  --mhq-color-secondary: #a9b6c4;
  --mhq-color-secondary-solid: #a9b6c4;
  --mhq-color-secondary-solid-hover: #c3ced9;
  --mhq-color-secondary-ink: #0b1015;
  --mhq-color-secondary-soft: #18212b;
  --mhq-color-secondary-soft-ink: #d3dce6;
}

/* The admin area: the same shell with a violet accent, so it is never mistaken for a customer's dashboard. */
[data-area='admin'] {
  --mhq-color-accent: #6d28d9;
  --mhq-color-accent-solid: #6d28d9;
  --mhq-color-accent-solid-hover: #5b21b6;
  --mhq-color-accent-ink: #ffffff;
  --mhq-color-accent-soft: #efe7fd;
  --mhq-color-accent-soft-ink: #4c1d95;
  --mhq-color-link: #6d28d9;
  --mhq-color-link-hover: #5b21b6;
}

.dark[data-area='admin'] {
  --mhq-color-accent: #b79cff;
  --mhq-color-accent-solid: #a585ff;
  --mhq-color-accent-solid-hover: #b79cff;
  --mhq-color-accent-ink: #1b0b3d;
  --mhq-color-accent-soft: #241a3d;
  --mhq-color-accent-soft-ink: #d3c3ff;
  --mhq-color-link: #b79cff;
  --mhq-color-link-hover: #d3c3ff;
}

html {
  font-family: var(--mhq-font-sans);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background-color: var(--mhq-color-page);
  color: var(--mhq-color-fg);
}

code,
kbd,
pre,
samp {
  font-family: var(--mhq-font-mono);
}
