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

@layer tokens {
  :root {
    color-scheme: dark;
    --color-bg: #0b0d10;
    --color-surface: #151922;
    --color-surface-2: #1c212c;
    --color-text: #f1f3f5;
    --color-muted: #9aa4b2;
    --color-border: #303846;
    --color-accent: #34d399;
    --stage-bg: #0f1218;
    --stage-border: #3a4352;
    --shadow-color: rgb(0 0 0 / 13%);

    /* Numbered rather than t-shirt sized: this lab's 23 demos land on 14
       distinct rem steps between .1rem and 3rem. */
    --space-1: .1rem;
    --space-2: .25rem;
    --space-3: .35rem;
    --space-4: .4rem;
    --space-5: .5rem;
    --space-6: .6rem;
    --space-7: .75rem;
    --space-8: .8rem;
    --space-9: .9rem;
    --space-10: 1rem;
    --space-11: 1.25rem;
    --space-12: 1.5rem;
    --space-13: 2rem;
    --space-14: 3rem;

    --radius-xs: .35rem;
    --radius-s: .5rem;
    --radius-sm: .6rem;
    --radius-m: .75rem;
    --radius-l: 1rem;
    --radius-xl: 1.25rem;
    --radius-full: 999px;

    /* Content-width caps: same concept (a block's max-inline-size before
       centering with margin-inline: auto) reused across demo cards. */
    --measure-m: 700px;
    --measure-l: 900px;
    --measure-xl: 1100px;
  }
}

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

  body {
    margin: 0;
    font: 16px system-ui, sans-serif;
  }
}

@layer base {
  html,
  body {
    background: var(--color-bg);
    color: var(--color-text);
  }

  header {
    max-inline-size: var(--measure-l);
    margin-block: var(--space-13) 0;
    margin-inline: auto;
    padding-inline: var(--space-10);

    h1 {
      margin-block-end: var(--space-2);
    }

    p {
      max-inline-size: 70ch;
      color: var(--color-muted);
      margin-block-start: 0;
    }
  }

  :is(h1, h2, h3) {
    text-wrap: balance;
  }

  p {
    text-wrap: pretty;
  }

  button {
    background: var(--color-surface-2);
    color: var(--color-text);
    border-color: var(--color-border);
  }

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

@layer layout {
  .stage {
    container-type: inline-size;
    /* physical: the drag handle a browser paints for `resize` always sits at the
       physical bottom-right corner regardless of writing mode */
    resize: horizontal;
    overflow: auto;
    inline-size: min(90vw, var(--stage-max, var(--measure-m)));
    min-inline-size: var(--stage-min, 220px);
    margin-block: var(--space-14);
    margin-inline: auto;
    padding: var(--space-10);
    border: 2px dashed var(--stage-border);
    background: var(--stage-bg);
  }
}
