@layer reset, tokens, base, components, pages, utilities;

@layer tokens {
  :root {
    color-scheme: light dark;

    /* The first value is a fallback for engines without light-dark(). */
    --bg: #f7f5ef;
    --bg: light-dark(#f7f5ef, #0e1512);
    --surface: #ffffff;
    --surface: light-dark(#ffffff, #16201b);
    --surface-2: #f1eee6;
    --surface-2: light-dark(#f1eee6, #1b2721);
    --surface-3: #e8e3d8;
    --surface-3: light-dark(#e8e3d8, #22312a);
    --ink: #1b211d;
    --ink: light-dark(#1b211d, #e8efea);
    --muted: #5e6a62;
    --muted: light-dark(#5e6a62, #a6b4aa);
    --line: #ddd8cc;
    --line: light-dark(#ddd8cc, #2a3730);
    --line-strong: #c7c0b1;
    --line-strong: light-dark(#c7c0b1, #3b4b42);
    --accent: #176b52;
    --accent: light-dark(#176b52, #5bd6a0);
    --accent-strong: #0f5741;
    --accent-strong: light-dark(#0f5741, #7ee8b9);
    --accent-ink: #ffffff;
    --accent-ink: light-dark(#ffffff, #0b1511);
    --accent-soft: #e4f2ec;
    --accent-soft: light-dark(#e4f2ec, #12352a);
    --amber: #b45f06;
    --amber: light-dark(#b45f06, #f2b35e);
    --amber-soft: #fff1dc;
    --amber-soft: light-dark(#fff1dc, #3a2a14);
    --danger: #b42318;
    --danger: light-dark(#b42318, #ff8a80);
    --danger-soft: #fbe9e7;
    --danger-soft: light-dark(#fbe9e7, #3d1b19);
    --ok: #1f6b45;
    --ok: light-dark(#1f6b45, #6ee7a8);
    --ok-soft: #e6f4ec;
    --ok-soft: light-dark(#e6f4ec, #123326);
    --info: #245f8a;
    --info: light-dark(#245f8a, #8ac8f2);
    --info-soft: #e7f2fa;
    --info-soft: light-dark(#e7f2fa, #132b3a);

    --input-bg: #ffffff;
    --input-bg: light-dark(#ffffff, #0f1814);
    --overlay: rgba(12, 20, 16, 0.55);
    --shadow-sm: 0 1px 2px rgba(20, 28, 24, 0.08);
    --shadow-md: 0 12px 32px rgba(20, 28, 24, 0.12);
    --shadow-lg: 0 24px 64px rgba(10, 18, 14, 0.22);

    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
      Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas,
      "Liberation Mono", monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: clamp(1.25rem, 1.05rem + 0.8vw, 1.5rem);
    --text-2xl: clamp(1.55rem, 1.2rem + 1.4vw, 2.05rem);
    --text-3xl: clamp(1.9rem, 1.35rem + 2.2vw, 2.8rem);

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    --container: 1200px;
    --container-narrow: 460px;
    --header-h: 4rem;
    --bottom-nav-h: 4.25rem;

    --transition: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
    --z-header: 40;
    --z-nav: 45;
    --z-toast: 60;
    --z-dialog: 70;
  }

  html[data-theme="light"] {
    color-scheme: light;
  }

  html[data-theme="dark"] {
    color-scheme: dark;
  }

  @media (prefers-contrast: more) {
    :root {
      --line: light-dark(#8b8578, #617468);
      --line-strong: light-dark(#4f4a42, #8fa196);
      --muted: light-dark(#3f4842, #c8d3cc);
    }
  }
}
