@layer reset, tokens, base, layout, components, utilities, overrides;

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

    --color-bg: oklch(14% 0.01 260);
    --color-surface: oklch(19% 0.012 260);
    --color-text: oklch(95% 0.01 250);
    --color-muted: oklch(72% 0.02 250);
    --color-border: oklch(32% 0.015 255);
    --color-accent: oklch(82% 0.14 80);

    --space-3xs: .125rem;
    --space-2xs: .25rem;
    --space-xs: .5rem;
    --space-s: .75rem;
    --space-m: 1rem;
    --space-l: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    --radius-s: .375rem;
    --radius-m: .75rem;
    --radius-l: 1.25rem;
    --radius-full: 999px;

    --font-sans: system-ui, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;

    --step--1: .8125rem;
    --step-0: 1rem;
    --step-1: 1.25rem;
    --step-2: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);

    --leading-tight: 1.15;
    --leading-body: 1.55;

    --measure-prose: 68ch;
    --measure-page: 72rem;

    --size-target-min: 24px;

    --ease-out: cubic-bezier(.2, .7, .2, 1);
    --duration-quick: .18s;
  }
}

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

  body,
  h1,
  p {
    margin: 0;
  }

  :where(input, button) {
    font: inherit;
  }
}

@layer base {
  body {
    min-block-size: 100dvh;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: var(--leading-body);
  }

  h1 {
    font-size: var(--step-2);
    line-height: var(--leading-tight);
    text-wrap: balance;
  }

  p {
    text-wrap: pretty;
  }

  a {
    color: var(--color-accent);
    text-underline-offset: .2em;
  }

  code {
    font-family: var(--font-mono);
    font-size: .92em;
  }

  :where(a, button, [tabindex]):focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
  }
}

@layer layout {
  .page-header {
    display: grid;
    gap: var(--space-xs);
    max-inline-size: var(--measure-page);
    margin-inline: auto;
    padding: var(--space-l) var(--space-m) 0;

    p {
      max-inline-size: var(--measure-prose);
      color: var(--color-muted);
    }
  }

  .back {
    justify-self: start;
    font-size: var(--step--1);
    color: var(--color-muted);
  }

  .stage {
    display: grid;
    justify-items: center;
    gap: var(--space-l);
    padding: var(--space-xl) var(--space-m) var(--space-2xl);
  }
}

@layer components {
  .bench-button {
    min-block-size: var(--size-target-min);
    padding: var(--space-2xs) var(--space-s);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--step--1);
    cursor: pointer;

    @media (hover: hover) {
      &:hover {
        border-color: var(--color-muted);
      }
    }
  }
}

@layer utilities {
  .visually-hidden {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: clip;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
}
