* {
  box-sizing: border-box;
}

html {
  color-scheme: dark light;
  background: canvas;
  color: canvastext;
  font:
    100%/1.4 system-ui,
    sans-serif;
}

body {
  margin: 0;
}

.grid {
  display: grid;

  gap: 1rem;
  padding: 1rem;
  border-block-end: 10px dashed;

  > div {
    height: 150px;
    background: #1e88e5;
    color: white;
    display: grid;
    place-items: center;
  }

  &:has(> :nth-child(2)) {
    grid-template-columns: 1fr 1fr;

    > div {
      background: rebeccapurple;
    }
  }

  &:has(> :nth-child(3)):not(:has(> :nth-child(4))) {
    > :nth-child(3) {
      grid-column: span 2;
    }

    > div {
      background: #26a69a;
    }
  }

  &:has(> :nth-child(5)) {
    grid-template-columns: unset;

    grid-auto-flow: column;
    grid-auto-columns: 200px;

    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;

    anchor-name: --⚓️-carousel;

    padding-block: 1rem;
    /* Dumb you can't just transparent the track. */
    scrollbar-color: oklch(53% 0% 68deg) transparent;

    position: relative;

    > div {
      scroll-snap-align: center;
      background: #ff8f00;
    }

    &::scroll-button(*) {
      position: absolute;
      top: 0;
      left: 0;
      position-anchor: --⚓️-carousel;
      background: none;
      border: 0;
      padding: 0;
      font-size: 32px;
    }

    &::scroll-button(right) {
      position-area: center inline-end;
      translate: -3rem -0.5rem;
      content: "➡️" / "Next";
    }

    &::scroll-button(left) {
      position-area: inline-start center;
      translate: 3rem -0.5rem;
      content: "⬅️" / "Previous";
    }
  }
}
