@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@300..900&display=swap");

:root {
  --bg-color: #d4e1e2;
}

html,
body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
}

html * {
  box-sizing: border-box;
}

body {
  padding: 30px;
  font-family: "Avenir Next", "Avenir", "Figtree", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  background-color: var(--bg-color);
}

p {
  font-size: 18px;
}

main {
  max-width: 1000px;
  margin: 0 auto;
}

section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  max-width: 100%;
}

section > div {
  position: relative;
  /* aspect-ratio: 1 / 1; */
  perspective: 1000px;
  min-width: 0;
}

section > div.w2-h1 {
  grid-column: span 2;
  aspect-ratio: 16 / 9;
}

section > div.w1-h2 {
  grid-row: span 2;
  aspect-ratio: 320 / 568;
}

section > div > div {
  position: absolute;
  inset: 0;
  transition: transform 0.6s;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

section > div > div:first-child {
  transform: rotateY(0deg);
}

section > div.contain:not(.dark) > div:first-child > img,
section > div.contain:not(.dark) > div:first-child > video {
  background-color: white;
}

section > div.contain.dark > div:first-child > img,
section > div.contain.dark > div:first-child > video {
  background-color: black;
}

section > div.w1-h2.contain.dark video {
  border-top: 1px solid #d4e1e2;
  border-top: 1px solid #d4e1e2;
}

section > div.flip > div:first-child {
  transform: rotateY(-180deg);
}

section > div > div:last-child {
  transform: rotateY(180deg);
  backface-visibility: hidden;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: black;
  padding: 30px;
  font-size: 14px;
}

section > div.contain.dark > div:last-child {
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
}

section > div.flip > div:last-child {
  transform: rotateY(0deg);
}

section > div img,
section > div video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: white;
}

section > div.dark img,
section > div.dark video {
  background-color: black;
}

section > div.contain img,
section > div.contain video {
  object-fit: contain;
}

h1 {
  font-weight: 700;
  font-variation-settings: "wght" 800;
  font-size: 36px;
  margin: 0;
  padding: 0;
  background: radial-gradient(
    ellipse at left bottom,
    /* #000000 0%,
    #003344 40%, */ #065874 0%,
    #0dabdf 80%,
    #00bfff 100%
  );
  background-clip: text;
  color: transparent;
  display: inline-block;
}

header > p {
  font-size: 20px;
  margin: 5px 0 30px;
}

@media (max-width: 869px) {
  body {
    padding: 15px;
  }

  main {
    margin: 0 -15px;
  }

  header {
    padding: 15px;
  }

  section {
    grid-template-columns: 1fr;
  }

  section > div:nth-child(3) ~ div:not(.w2-h1) {
    aspect-ratio: 1 / 1;
  }

  section > div,
  section > div.w2-h1,
  section > div.w1-h2 {
    grid-column: span 1;
  }

  section > div {
    aspect-ratio: 1 / 1;
  }
}

img {
  position: relative;
  z-index: 1;
}

section > div > div > img,
section > div > div > video {
  mask-image: linear-gradient(-135deg, transparent 2.8284em, black 0);
  mask-size: 100% 100%;
  mask-repeat: no-repeat;
}

.fold {
  transition: transform 500ms ease;
  position: absolute;
  z-index: 3;
  font-size: 16px;
  inset: 0;
  transform-origin: calc(100% - 2em) 2em;
  transform: rotateZ(45deg) rotateX(0deg) rotateZ(-45deg);
}

.fold > img,
.fold > video {
  mask-size: 4em, 4em;
  mask-position: top right;
  mask-repeat: no-repeat;
  mask-image: url("media/fold.svg");
  background-color: white;
}

.fold:after {
  position: absolute;
  top: -1px;
  right: -1px;
  display: block;
  width: 4em;
  height: 4em;
  content: "\a0";
  border-top: 1px solid var(--bg-color);
  border-right: 1px solid var(--bg-color);
}

@media (hover: hover) and (pointer: fine) {
  section > div:hover .fold {
    transition: transform 500ms 500ms ease;
    transform: rotateZ(45deg) rotateX(180deg) rotateZ(-45deg);
  }
}

section > div > div:first-child > p {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  margin: 0;
  padding: 0;
  line-height: 1;
  width: 18px;
  height: 18px;
  padding-top: 2px;
  border: 1px solid #06587466;
  border-radius: 9px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: #065874;
}
