:root {
  --ctp-rosewater: #dc8a78;
  --ctp-flamingo: #dd7878;
  --ctp-pink: #ea76cb;
  --ctp-mauve: #8839ef;
  --ctp-red: #d20f39;
  --ctp-maroon: #e64553;
  --ctp-peach: #fe640b;
  --ctp-yellow: #df8e1d;
  --ctp-green: #40a02b;
  --ctp-teal: #179299;
  --ctp-sky: #04a5e5;
  --ctp-sapphire: #209fb5;
  --ctp-blue: #1e66f5;
  --ctp-lavender: #7287fd;
  --ctp-text: #4c4f69;
  --ctp-subtext1: #5c5f77;
  --ctp-subtext0: #6c6f85;
  --ctp-overlay2: #7c7f93;
  --ctp-overlay1: #8c8fa1;
  --ctp-overlay0: #9ca0b0;
  --ctp-surface2: #acb0be;
  --ctp-surface1: #bcc0cc;
  --ctp-surface0: #ccd0da;
  --ctp-base: #eff1f5;
  --ctp-mantle: #e6e9ef;
  --ctp-crust: #dce0e8;

  --color-bg: var(--ctp-base);
  --color-bg-elev: var(--ctp-mantle);
  --color-bg-code: #1e1e2e;
  --color-surface: var(--ctp-surface0);
  --color-border: var(--ctp-surface1);
  --color-border-soft: var(--ctp-surface0);
  --color-text: var(--ctp-text);
  --color-text-muted: var(--ctp-subtext1);
  --color-heading: #2c2d3a;
  --color-link: color-mix(in srgb, var(--ctp-blue) 75%, var(--ctp-text) 25%);
  --color-link-hover: var(--ctp-mauve);
  --color-accent: var(--ctp-mauve);
  --color-selection-bg: #dce1ff;
  --color-selection-fg: #2c2d3a;

  --callout-info: var(--ctp-blue);
  --callout-tip: var(--ctp-green);
  --callout-warn: var(--ctp-yellow);
  --callout-danger: var(--ctp-red);
  --callout-note: var(--ctp-lavender);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --fs-root: 17px;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 1.875rem;
  --fs-4xl: 2.25rem;

  --lh-tight: 1.25;
  --lh-snug: 1.4;
  --lh-normal: 1.65;
  --lh-relaxed: 1.75;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(24, 24, 37, 0.04), 0 1px 3px rgba(24, 24, 37, 0.06);
  --shadow-md: 0 4px 10px rgba(24, 24, 37, 0.06), 0 2px 4px rgba(24, 24, 37, 0.04);

  --measure-prose: 72ch;
  --breakout-max: min(100%, 1100px);

  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--ctp-blue) 45%, transparent);
  --motion-fast: 120ms;
  --motion-base: 200ms;
  --easing: cubic-bezier(0.2, 0.6, 0.2, 1);
}

html.dark {
  --ctp-rosewater: #f5e0dc;
  --ctp-flamingo: #f2cdcd;
  --ctp-pink: #f5c2e7;
  --ctp-mauve: #cba6f7;
  --ctp-red: #f38ba8;
  --ctp-maroon: #eba0ac;
  --ctp-peach: #fab387;
  --ctp-yellow: #f9e2af;
  --ctp-green: #a6e3a1;
  --ctp-teal: #94e2d5;
  --ctp-sky: #89dceb;
  --ctp-sapphire: #74c7ec;
  --ctp-blue: #89b4fa;
  --ctp-lavender: #b4befe;
  --ctp-text: #cdd6f4;
  --ctp-subtext1: #bac2de;
  --ctp-subtext0: #a6adc8;
  --ctp-overlay2: #9399b2;
  --ctp-overlay1: #7f849c;
  --ctp-overlay0: #6c7086;
  --ctp-surface2: #585b70;
  --ctp-surface1: #45475a;
  --ctp-surface0: #313244;
  --ctp-base: #1e1e2e;
  --ctp-mantle: #181825;
  --ctp-crust: #11111b;

  --color-bg: var(--ctp-base);
  --color-bg-elev: var(--ctp-mantle);
  --color-bg-code: #1e1e2e;
  --color-surface: var(--ctp-surface0);
  --color-border: var(--ctp-surface1);
  --color-border-soft: var(--ctp-surface0);
  --color-text: var(--ctp-text);
  --color-text-muted: var(--ctp-subtext0);
  --color-heading: #f5f6ff;
  --color-link: var(--ctp-blue);
  --color-link-hover: var(--ctp-lavender);
  --color-accent: var(--ctp-mauve);
  --color-selection-bg: #394264;
  --color-selection-fg: var(--ctp-text);

  --callout-info: var(--ctp-blue);
  --callout-tip: var(--ctp-green);
  --callout-warn: var(--ctp-yellow);
  --callout-danger: var(--ctp-red);
  --callout-note: var(--ctp-lavender);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.3);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--ctp-blue) 55%, transparent);
}

@media (prefers-color-scheme: dark) {
  html:not(.light) {
    --ctp-rosewater: #f5e0dc;
    --ctp-flamingo: #f2cdcd;
    --ctp-pink: #f5c2e7;
    --ctp-mauve: #cba6f7;
    --ctp-red: #f38ba8;
    --ctp-maroon: #eba0ac;
    --ctp-peach: #fab387;
    --ctp-yellow: #f9e2af;
    --ctp-green: #a6e3a1;
    --ctp-teal: #94e2d5;
    --ctp-sky: #89dceb;
    --ctp-sapphire: #74c7ec;
    --ctp-blue: #89b4fa;
    --ctp-lavender: #b4befe;
    --ctp-text: #cdd6f4;
    --ctp-subtext1: #bac2de;
    --ctp-subtext0: #a6adc8;
    --ctp-overlay2: #9399b2;
    --ctp-overlay1: #7f849c;
    --ctp-overlay0: #6c7086;
    --ctp-surface2: #585b70;
    --ctp-surface1: #45475a;
    --ctp-surface0: #313244;
    --ctp-base: #1e1e2e;
    --ctp-mantle: #181825;
    --ctp-crust: #11111b;

    --color-bg: var(--ctp-base);
    --color-bg-elev: var(--ctp-mantle);
    --color-bg-code: #1e1e2e;
    --color-surface: var(--ctp-surface0);
    --color-border: var(--ctp-surface1);
    --color-border-soft: var(--ctp-surface0);
    --color-text: var(--ctp-text);
    --color-text-muted: var(--ctp-subtext0);
    --color-heading: #f5f6ff;
    --color-link: var(--ctp-blue);
    --color-link-hover: var(--ctp-lavender);
    --color-accent: var(--ctp-mauve);
    --color-selection-bg: #394264;
    --color-selection-fg: var(--ctp-text);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.3);
    --focus-ring: 0 0 0 3px color-mix(in srgb, var(--ctp-blue) 55%, transparent);
  }
}
