/*
 * design-system.css
 *
 * Standalone stylesheet containing the design tokens (CSS custom properties)
 * and default element styles for this site. Served verbatim (not compiled by
 * Vite), so it can be <link>'d from other projects:
 *
 *   <link rel="stylesheet" href="https://stordahl.dev/styles/design-system.css">
 */

@layer reset, variables, base, elements;

@layer reset {

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  * {
    margin: 0;
  }

  body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    color-scheme: light dark;
  }

  img,
  picture,
  video,
  canvas,
  svg {
    display: block;
    max-width: 100%;
  }

  input,
  button,
  textarea,
  select {
    font: inherit;
  }

  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    overflow-wrap: break-word;
  }
}

@layer variables {
  :root {
    --white: #fffef9;
    --black: #161614;
    --light-grey: #8d8d8d;
    --grey: #403d39;
    --orange: #eb5e28;
    --blue: #0412e3;

    --theme-secondary: var(--blue);
  }

  body {
    --background: light-dark(var(--white), var(--black));
    --foreground: light-dark(var(--black), var(--white));
    --secondary: light-dark(var(--theme-secondary), var(--light-grey));

    --border: 1px solid var(--foreground);
    --border_subtle: 1px solid color-mix(in srgb, var(--foreground) 12%, transparent);
    --radius: 2px;

    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-md: 1rem;
    --font-lg: 1.2rem;
    --font-xl: 1.5rem;
    --font-2xl: 1.75rem;
    --font-3xl: 2.25rem;
  }
}

@layer base {
  html {
    scroll-behavior: smooth;
  }

  body {
    background-color: var(--background);
    color: var(--foreground);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 16px;
    font-weight: 500;
    scroll-behavior: smooth;
  }

  @supports (-moz-appearance: none) {
    body {
      background-blend-mode: soft-light;
    }
  }
}

@layer elements {

  h1,
  h2,
  h3 {
    font-weight: 500;
  }

  h1 {
    font-size: var(--font-xl);
  }

  h2 {
    font-size: var(--font-lg);
  }

  h3 {
    font-size: var(--font-md);
  }

  p {
    font-size: var(--font-md);
    line-height: 1.3;
    margin-bottom: 30px;
  }

  a {
    --link-color: var(--secondary);
    color: var(--link-color);
    text-decoration: none;
    transition: text-decoration 0.2s ease-in-out 0s;
  }

  a:hover {
    text-decoration: underline;
    text-decoration-style: wavy;
  }

  ul,
  ol {
    padding-left: 2ch;
    font-size: var(--font-md);
  }

  blockquote {
    margin: 30px auto;
    border-left: 1px solid var(--secondary);
    font-size: var(--font-md);
    padding-left: 1rem;
    font-style: italic;
  }

  blockquote p {
    font-size: var(--font-sm);
  }

  button {
    padding: 2px 5px;
    width: max-content;
    font-size: var(--font-xs);
    border: 1px solid var(--secondary);
    background: transparent;
    color: inherit;
    cursor: pointer;
  }

  button:hover:not(:disabled) {
    background: var(--secondary);
    color: var(--white);
    opacity: 0.8;
  }

  button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  button[data-variant='danger'] {
    border-color: #e74c3c;
    color: #e74c3c;
  }

  button[data-variant='danger']:hover:not(:disabled) {
    background: #e74c3c;
    color: var(--white);
    opacity: 1;
  }

  button[data-variant='success'] {
    border-color: #2ecc71;
    color: #2ecc71;
  }

  button[data-variant='success']:hover:not(:disabled) {
    background: #2ecc71;
    color: var(--white);
    opacity: 1;
  }

  input {
    border: 1px solid var(--secondary);
    background: transparent;
    color: inherit;
    width: 100%;
    font-size: var(--font-xs);
  }

  table {
    width: 100%;
    text-align: left;
    font-family: monospace;
    border-collapse: collapse;
    border: 1px solid var(--white);
    padding: 0.5rem;
    margin-bottom: 2rem;
  }

  table th {
    font-size: 0.9rem;
  }

  table td,
  table th {
    border: 1px solid var(--white);
    padding: 5px;
  }

  pre {
    padding: 20px;
    margin-bottom: 20px;
    overflow-x: auto;
    border: 1px solid light-dark(var(--grey), transparent);
  }

  code:not(pre > code) {
    background-color: light-dark(#e9e9e9, var(--grey));
    font-size: var(--font-sm);
    padding: 1px 4px;
    border-radius: 5px;
  }
}
