@import url("https://unpkg.com/@catppuccin/palette/css/catppuccin.css");
@import "https://unpkg.com/open-props/easings.min.css";

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

:root {
  --crust: var(--ctp-latte-crust);
  --base: var(--ctp-latte-base);
  --surface1: var(--ctp-latte-surface1);
  --text: var(--ctp-latte-text);
  --subtext0: var(--ctp-latte-subtext0);
}

:root.dark {
  --crust: var(--ctp-mocha-crust);
  --base: var(--ctp-mocha-base);
  --surface1: var(--ctp-mocha-surface1);
  --text: var(--ctp-mocha-text);
  --text: var(--ctp-mocha-subtext0);
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  justify-content: center;
  background-color: var(--crust);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-column-gap: 50px;
  place-items: center;
  margin: auto;
}

.item {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 7em 3em;
  width: 100%;
  height: 100%;
  background-color: var(--base);
  border-radius: 20px;
  border: 2px solid var(--surface1);
  box-shadow: 0px 0px 50px rgba(0, 0, 0, 0.2);
  transition:
    transform 300ms ease,
    box-shadow 300ms ease;
}

.item:hover {
  transform: scale(1.2);
  box-shadow: 0px 0px 90px rgba(0, 0, 0, 0.1);
}

.label {
  font-size: 20pt;
  font-family: system-ui;
  color: var(--text);
}

/* THEME TOGGLE */
.sun-and-moon {
  & > :is(.moon, .sun, .sun-beams) {
    transform-origin: center center;
  }

  & > :is(.moon, .sun) {
    fill: var(--text);

    .theme-toggle:is(:hover, :focus-visible) > & {
      fill: var(--subtext0);
    }
  }

  & > .sun-beams {
    stroke: var(--text);
    stroke-width: 2px;

    .theme-toggle:is(:hover, :focus-visible) & {
      stroke: var(--subtext0);
    }
  }
}

.sun-and-moon {
  html.dark & {
    & > .sun {
      transform: scale(1.75);
    }

    & > .sun-beams {
      opacity: 0;
    }

    & > .moon > circle {
      transform: translateX(-7px);

      @supports (cx: 1) {
        transform: translateX(0);
        cx: 17;
      }
    }
  }
}

.sun-and-moon {
  & > .sun {
    transition: transform 0.5s var(--ease-elastic-3);
  }

  & > .sun-beams {
    transition:
      transform 0.5s var(--ease-elastic-4),
      opacity 0.5s var(--ease-3);
  }

  html.dark & {
    & > .sun {
      transform: scale(1.75);
      transition-timing-function: var(--ease-3);
      transition-duration: 0.25s;
    }

    & > .sun-beams {
      transform: rotateZ(-25deg);
      transition-duration: 0.15s;
    }
  }
}

.sun-and-moon {
  & .moon > circle {
    transition: transform 0.25s var(--ease-out-5);

    @supports (cx: 1) {
      transition: cx 0.25s var(--ease-out-5);
    }
  }

  html.dark & {
    & > .moon > circle {
      transition-delay: 0.25s;
      transition-duration: 0.5s;
    }
  }
}

#dark-mode-toggle {
  justify-content: center;
  position: absolute;
  top: 0;
  right: 0;
  margin-top: 20px;
  margin-right: 20px;
}

#dark-mode-toggle {
  background: none;
  border: none;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 50%;

  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  outline-offset: 5px;
}

#dark-mode-toggle > svg {
  width: 50px;
  max-width: 50px;
  height: 50px;
  max-height: 50px;
  border: unset;
  inline-size: 100%;
  block-size: 100%;
  stroke-linecap: round;
  color: var(--text);
}
