/*
 * Vetrina's own tokens and base rules. Component styles are generated by
 * css() into the "rmx" layer; "base" sits under them and "app" over them.
 *
 * The look: a black stage, the six colours of a video test card used as
 * solid blocks, and everything built on a 4 px pixel. Corners are stepped
 * (.px-corners), not rounded.
 */
@layer base, rmx, app;

@layer base {
  :root {
    --black: #000000;
    --panel: #121317;
    --panel-2: #1b1d23;
    --line: #2a2d35;
    --line-2: #3a3e48;
    --text: #f2f3f5;
    --text-2: #a9adb8;
    --text-3: #747986;

    /* the test card */
    --yellow: #f7d41c;
    --cyan: #19c8e6;
    --green: #3fd35a;
    --magenta: #e84fd0;
    --red: #f0453a;
    --blue: #4460ff;

    --action: var(--yellow);
    --on-action: #000000;
    --danger: var(--red);

    --font: "Radio Canada", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-big: "Radio Canada Big", "Radio Canada", system-ui, sans-serif;
    --font-pixel: "Pixelify Sans", ui-monospace, "Cascadia Mono", Consolas, monospace;

    --px: 4px;
    --gutter: clamp(16px, 4vw, 48px);
    --measure: 62ch;
    color-scheme: dark;
  }

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

  html {
    background: var(--black);
    color: var(--text);
    -webkit-text-size-adjust: 100%;
  }

  body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  h1,
  h2,
  h3,
  p,
  ul,
  ol,
  dl,
  dd,
  figure {
    margin: 0;
  }

  h1,
  h2,
  h3 {
    font-family: var(--font-big);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.01em;
    text-wrap: balance;
  }

  a {
    color: inherit;
    text-underline-offset: 0.18em;
    text-decoration-thickness: 0.08em;
  }

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

  button {
    cursor: pointer;
  }

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

  ::selection {
    background: var(--yellow);
    color: #000000;
  }

  :focus-visible {
    outline: 2px solid var(--yellow);
    outline-offset: 2px;
  }

  /* A rectangle with one-pixel steps for corners */
  .px-corners {
    clip-path: polygon(
      0 var(--px),
      var(--px) var(--px),
      var(--px) 0,
      calc(100% - var(--px)) 0,
      calc(100% - var(--px)) var(--px),
      100% var(--px),
      100% calc(100% - var(--px)),
      calc(100% - var(--px)) calc(100% - var(--px)),
      calc(100% - var(--px)) 100%,
      var(--px) 100%,
      var(--px) calc(100% - var(--px)),
      0 calc(100% - var(--px))
    );
  }

  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  @media (prefers-reduced-motion: no-preference) {
    html {
      scroll-behavior: smooth;
    }
  }
}
