@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-cherry-deep: oklch(46% 0.16 26);
    --color-teal-deep: oklch(40% 0.07 205);
    --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;
  }

  .cactus {
    --y: 250;
    --w: 80;
    --h: 180;
    --shape: polygon(35% 4.44%, 37.5% 1.11%, 45% 0%, 55% 0%, 62.5% 1.11%, 65% 4.44%, 65% 53.33%, 72.5% 53.33%, 72.5% 24.44%, 75% 22.22%, 82.5% 21.11%, 90% 22.22%, 92.5% 24.44%, 92.5% 62.22%, 65% 62.22%, 65% 100%, 35% 100%, 35% 71.11%, 7.5% 71.11%, 7.5% 35.56%, 10% 33.33%, 17.5% 32.22%, 25% 33.33%, 27.5% 35.56%, 27.5% 62.22%, 35% 62.22%);
    --fill: repeating-linear-gradient(90deg, var(--color-teal) 0 calc(6 * var(--u)), var(--color-teal-deep) 0 calc(8 * var(--u)));

    &[data-n="1"] {
      --x: 60;
    }

    &[data-n="2"] {
      --x: 660;
    }
  }

  .burst {
    --shape: polygon(50% 0%, 56.1% 11.48%, 65.45% 2.45%, 67.71% 15.25%, 79.39% 9.55%, 77.58% 22.42%, 90.45% 20.61%, 84.75% 32.29%, 97.55% 34.55%, 88.52% 43.9%, 100% 50%, 88.52% 56.1%, 97.55% 65.45%, 84.75% 67.71%, 90.45% 79.39%, 77.58% 77.58%, 79.39% 90.45%, 67.71% 84.75%, 65.45% 97.55%, 56.1% 88.52%, 50% 100%, 43.9% 88.52%, 34.55% 97.55%, 32.29% 84.75%, 20.61% 90.45%, 22.42% 77.58%, 9.55% 79.39%, 15.25% 67.71%, 2.45% 65.45%, 11.48% 56.1%, 0% 50%, 11.48% 43.9%, 2.45% 34.55%, 15.25% 32.29%, 9.55% 20.61%, 22.42% 22.42%, 20.61% 9.55%, 32.29% 15.25%, 34.55% 2.45%, 43.9% 11.48%);

    &[data-n="back"] {
      --x: 194;
      --y: 8;
      --w: 412;
      --h: 412;
      --turn: 9deg;
      --fill: var(--color-cherry);
    }

    &[data-n="front"] {
      --x: 210;
      --y: 24;
      --w: 380;
      --h: 380;
      --fill: var(--color-mustard);
    }
  }

  .oval {
    --x: 150;
    --y: 128;
    --w: 500;
    --h: 196;
    --fill: var(--color-teal);

    display: grid;
    place-content: center;
    justify-items: center;
    gap: calc(6 * var(--u));
    border-radius: 50%;
    box-shadow:
      inset 0 0 0 calc(11 * var(--u)) var(--color-teal),
      inset 0 0 0 calc(15 * var(--u)) var(--color-cream);
  }

  .oval-name {
    font-size: calc(70 * var(--u));
  }

  .oval-sub {
    color: var(--color-mustard);
    font-size: calc(24 * var(--u));
    font-style: italic;
    font-weight: 700;
    letter-spacing: 0.4em;
    line-height: 1;
    padding-inline-start: 0.4em;
    text-transform: uppercase;
  }

  .tail {
    --y: 320;
    --w: 100;
    --h: 56;
    --fill: var(--color-cherry-deep);

    &[data-n="1"] {
      --x: 140;
      --shape: polygon(0 0, 100% 0, 100% 100%, 0 100%, 24% 50%);
    }

    &[data-n="2"] {
      --x: 560;
      --shape: polygon(0 0, 100% 0, 76% 50%, 100% 100%, 0 100%);
    }
  }

  .ribbon {
    --x: 196;
    --y: 296;
    --w: 408;
    --h: 62;
    --shape: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    --fill: linear-gradient(transparent 13%, var(--color-cream) 0 17%, transparent 0 83%, var(--color-cream) 0 87%, transparent 0), var(--color-cherry);

    & span {
      color: var(--color-mustard);
      font-size: calc(24 * var(--u));
      font-weight: 900;
      letter-spacing: 0.3em;
      padding-inline-start: 0.3em;
      text-transform: uppercase;
    }
  }

  .sparkle {
    --shape: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
    --fill: var(--color-cream);

    &[data-n="1"] {
      --x: 112;
      --y: 70;
      --w: 46;
      --h: 46;
    }

    &[data-n="2"] {
      --x: 640;
      --y: 48;
      --w: 58;
      --h: 58;
    }

    &[data-n="3"] {
      --x: 700;
      --y: 168;
      --w: 32;
      --h: 32;
    }
  }

  .sand {
    --x: 30;
    --y: 360;
    --w: 740;
    --h: 90;
    --shape: polygon(0% 100%, 0% 53.33%, 2.97% 53.33%, 5.68% 13.33%, 18.65% 13.33%, 21.62% 53.33%, 78.38% 53.33%, 81.35% 17.78%, 94.32% 17.78%, 97.03% 53.33%, 100% 53.33%, 100% 100%);
    --fill:
      linear-gradient(transparent 62%, var(--color-mustard) 0 68%, transparent 0 80%, var(--color-mustard) 0 84%, transparent 0),
      var(--color-cream);
  }

  .bloom {
    --w: 16;
    --h: 16;
    --fill: var(--color-cherry);

    border-radius: 50%;

    &[data-n="1"] {
      --x: 92;
      --y: 243;
    }

    &[data-n="2"] {
      --x: 118;
      --y: 284;
    }

    &[data-n="3"] {
      --x: 63;
      --y: 304;
    }

    &[data-n="4"] {
      --x: 692;
      --y: 243;
    }

    &[data-n="5"] {
      --x: 718;
      --y: 284;
    }

    &[data-n="6"] {
      --x: 663;
      --y: 304;
    }
  }
}
