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

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

  body {
    margin: 0;
  }
}

@layer tokens {
  :root {
    color-scheme: dark;
    --color-page: oklch(29% 0.03 240);
    --color-ink: oklch(15% 0.02 245);
    --color-ink-dot: oklch(15% 0.02 245 / 0.16);
    --color-cream: oklch(97% 0.025 90);
    --color-teal: oklch(52% 0.085 200);
    --color-cherry: oklch(58% 0.19 28);
    --color-mustard: oklch(81% 0.15 83);

    --font-sign: "Futura", "Century Gothic", "Avenir Next", "Trebuchet MS", system-ui, sans-serif;

    --scene-size: min(100dvi - 2rem, (100dvb - 2rem) * 800 / 480, 60rem);
  }
}

@layer base {
  body {
    min-block-size: 100dvh;
    display: grid;
    place-items: center;
    background: var(--color-page);
  }
}

@layer components {
  .scene {
    --u: calc(100cqi / 800);
    --slip-x: calc(-5 * var(--u));
    --slip-y: calc(-4 * var(--u));
    --line: calc(3.5 * var(--u));
    --grain: radial-gradient(circle, var(--color-ink-dot) 32%, transparent 36%) 0 0 / calc(7 * var(--u)) calc(7 * var(--u));

    position: relative;
    container-type: inline-size;
    isolation: isolate;
    inline-size: var(--scene-size);
    aspect-ratio: 800 / 480;
    font-family: var(--font-sign);
    forced-color-adjust: none;

    & > * {
      position: absolute;
      inset-inline-start: calc(var(--x) * var(--u));
      inset-block-start: calc(var(--y) * var(--u));
      inline-size: calc(var(--w) * var(--u));
      block-size: calc(var(--h) * var(--u));
      rotate: var(--turn, 0deg);
    }
  }

  .shape {
    background: var(--grain), var(--fill);

    &::after {
      content: "";
      position: absolute;
      inset: 0;
      border: var(--line) solid var(--color-ink);
      border-radius: inherit;
      translate: var(--slip-x) var(--slip-y);
      pointer-events: none;
    }
  }

  .cut {
    display: grid;
    place-items: center;

    &::before,
    &::after {
      content: "";
      position: absolute;
      clip-path: var(--shape);
    }

    &::before {
      inset: 0;
      background: var(--color-ink);
      translate: var(--slip-x) var(--slip-y);
    }

    &::after {
      inset: var(--line);
      background: var(--grain), var(--fill);
    }

    & > * {
      z-index: 1;
    }
  }

  .type {
    color: var(--color-cream);
    font-weight: 900;
    letter-spacing: 0.06em;
    line-height: 1;
    white-space: nowrap;
    text-shadow: calc(-4 * var(--u)) calc(-3 * var(--u)) 0 var(--color-ink);
    text-transform: uppercase;
  }

  .hangers {
    --x: 340;
    --y: 300;
    --w: 128;
    --h: 52;

    background: repeating-linear-gradient(90deg, var(--color-cream) 0 calc(8 * var(--u)), transparent 0 calc(40 * var(--u)));
  }

  .speed {
    --x: 70;
    --h: 13;
    --turn: 19.3deg;
    --fill: var(--color-cherry);

    transform-origin: 0 50%;
    border-radius: calc(7 * var(--u));

    &[data-n="1"] {
      --y: 226;
      --w: 240;
    }

    &[data-n="2"] {
      --y: 254;
      --w: 200;
    }

    &[data-n="3"] {
      --y: 282;
      --w: 160;
    }
  }

  .boomerang {
    --x: 40;
    --y: 90;
    --w: 720;
    --h: 222;
    --shape: polygon(0% 9.01%, 50% 63.96%, 100% 0%, 98.33% 34.23%, 50% 100%, 1.67% 43.24%);
    --fill: var(--color-teal);
  }

  .arm {
    display: grid;
    place-items: center;
    font-size: calc(44 * var(--u));

    &[data-n="1"] {
      --x: 34;
      --y: 168;
      --w: 290;
      --h: 60;
      --turn: 19.3deg;

      font-size: calc(36 * var(--u));
    }

    &[data-n="2"] {
      --x: 460;
      --y: 165;
      --w: 260;
      --h: 60;
      --turn: -22deg;
    }
  }

  .badge {
    --x: 315;
    --y: 177;
    --w: 170;
    --h: 170;
    --fill: var(--color-mustard);

    border-radius: 50%;
    box-shadow:
      inset 0 0 0 calc(12 * var(--u)) var(--color-mustard),
      inset 0 0 0 calc(17 * var(--u)) var(--color-cherry);
  }

  .pin {
    --x: 364;
    --y: 196;
    --w: 46;
    --h: 118;
    --shape: polygon(60% 0%, 71% 2%, 77.5% 5%, 81% 10%, 80% 15%, 72.5% 22%, 68% 28%, 70% 34%, 81% 42%, 92.5% 52%, 99% 62%, 100% 72%, 97% 82%, 89% 92%, 81% 100%, 19% 100%, 11% 92%, 3% 82%, 0% 72%, 1% 62%, 7.5% 52%, 19% 42%, 30% 34%, 32% 28%, 27.5% 22%, 20% 15%, 19% 10%, 22.5% 5%, 29% 2%, 40% 0%);
    --fill: linear-gradient(transparent 21%, var(--color-cherry) 0 25%, transparent 0 29%, var(--color-cherry) 0 33%, transparent 0), var(--color-cream);
  }

  .ball {
    --x: 398;
    --y: 262;
    --w: 62;
    --h: 62;
    --fill:
      radial-gradient(circle calc(4.5 * var(--u)) at 38% 32%, var(--color-ink) 90%, transparent),
      radial-gradient(circle calc(4.5 * var(--u)) at 58% 27%, var(--color-ink) 90%, transparent),
      radial-gradient(circle calc(4.5 * var(--u)) at 52% 48%, var(--color-ink) 90%, transparent),
      var(--color-teal);

    border-radius: 50%;
  }

  .plaque {
    --x: 262;
    --y: 348;
    --w: 276;
    --h: 54;
    --fill: var(--color-cherry);

    display: grid;
    place-items: center;
    border-radius: calc(27 * var(--u));
    color: var(--color-mustard);
    font-size: calc(20 * var(--u));
    font-weight: 900;
    letter-spacing: 0.2em;
    line-height: 1;
    padding-inline-start: 0.2em;
    text-transform: uppercase;
    white-space: nowrap;
  }
}
