/* Homepage bento layout and dynamic tile artwork. */

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.bento {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  grid-template-rows: 190px 190px 146px;
  gap: var(--gap);
  padding: 12px;
  border: 2px solid var(--maroon);
  border-radius: calc(var(--radius) + 8px);
  background: var(--maroon);
  box-shadow:
    0 12px 0 rgba(45, 5, 4, 0.22),
    0 32px 62px rgba(47, 35, 20, 0.18);
  overflow: visible;
  perspective: 1100px;
}

body[data-mode="create"] .bento {
  border-color: var(--create-frame);
  background: var(--create-frame);
  box-shadow:
    0 12px 0 rgba(16, 16, 16, 0.2),
    0 32px 62px rgba(20, 19, 19, 0.18);
}

.tile-letterboxd {
  --tile-bg: var(--orange);
  --tilt: -1deg;
  grid-column: 1 / span 6;
  grid-row: 1 / span 2;
  color: var(--ink);
  overflow: visible;
}

.tile-letterboxd .tile-title {
  max-width: 100%;
  font-size: var(--tile-title-feature);
  white-space: nowrap;
}

.tile-youtube {
  --tile-bg: var(--pink);
  --tilt: 1deg;
  grid-column: 7 / span 5;
  grid-row: 1 / span 2;
  color: var(--maroon);
}

.tile-youtube .tile-title {
  max-width: calc(100% - 116px);
  font-size: var(--tile-title-feature);
}

.tile-youtube .tile-icon {
  right: 34px;
  bottom: 42px;
  width: 74px;
  height: 74px;
  opacity: 0.9;
  --icon-tilt: 2deg;
}

.tile-bsky {
  --tile-bg: var(--blue);
  --tilt: -1deg;
  --icon-tilt: 7deg;
  grid-column: 1 / span 3;
  grid-row: 3;
}

.tile-pinterest .tile-title,
.tile-twitch .tile-title {
  max-width: calc(100% - 90px);
  font-size: var(--tile-title-side);
}

.tile-bsky .tile-title,
.tile-reddit .tile-title,
.tile-music .tile-title,
.tile-books .tile-title {
  max-width: calc(100% - 82px);
  font-size: var(--tile-title-small);
}

.tile-twitch {
  --tile-bg: #c7abf6;
  --tilt: 1deg;
  --icon-tilt: -4deg;
  color: var(--maroon);
  grid-column: 12 / span 4;
  grid-row: 2;
}

.tile-pinterest {
  --tile-bg: var(--peach);
  --tilt: -1deg;
  --icon-tilt: -8deg;
  grid-column: 12 / span 4;
  grid-row: 1;
}

.tile-reddit {
  --tile-bg: var(--green);
  --tilt: 0.7deg;
  --icon-tilt: 4deg;
  grid-column: 4 / span 3;
  grid-row: 3;
}

.tile-reddit .tile-icon {
  right: 20px;
  bottom: 18px;
}

.tile-music {
  --tile-bg: var(--yellow);
  --tilt: -0.8deg;
  grid-column: 7 / span 4;
  grid-row: 3;
}

.tile-books {
  --tile-bg: var(--cream);
  --tilt: 0.8deg;
  grid-column: 11 / span 5;
  grid-row: 3;
}

.youtube-thumb {
  position: absolute;
  top: 48%;
  left: 50%;
  z-index: 4;
  width: min(64%, 300px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 4px solid var(--line);
  border-radius: 14px;
  box-shadow:
    0 12px 0 rgba(45, 5, 4, 0.16),
    0 20px 20px rgba(47, 35, 20, 0.1);
  transform: translate(-50%, -50%) translateZ(42px) rotate(-3deg);
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 220ms ease;
}

.tile:hover .youtube-thumb {
  transform: translate(-50%, calc(-50% - 8px)) translateZ(52px) rotate(-5deg);
  box-shadow:
    0 16px 0 rgba(45, 5, 4, 0.16),
    0 26px 26px rgba(47, 35, 20, 0.12);
}

.poster-stack {
  position: relative;
  z-index: 4;
  width: min(100%, 420px);
  height: 214px;
  margin: -32px auto 8px;
}

.poster {
  position: absolute;
  top: 0;
  width: 134px;
  height: 198px;
  overflow: hidden;
  border: 4px solid rgba(20, 19, 19, 0.88);
  border-radius: 7px;
  background: #5b320d;
  box-shadow:
    0 12px 0 rgba(45, 5, 4, 0.18),
    0 20px 20px rgba(47, 35, 20, 0.1);
}

.poster::after,
.album-cover::after,
.book-cover::after {
  content: none;
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ghost-poster {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent),
    repeating-linear-gradient(90deg, #4c2a0e 0 28px, #6d3d12 28px 56px);
}

.poster-a {
  left: -6px;
  transform: translateZ(24px) rotate(-6deg);
}

.poster-b {
  left: 82px;
  transform: translateZ(32px) rotate(4deg);
}

.poster-c {
  left: 170px;
  transform: translateZ(40px) rotate(-3deg);
}

.poster-d {
  left: 258px;
  transform: translateZ(48px) rotate(5deg);
}

.album-cover {
  position: absolute;
  right: 18px;
  top: -14px;
  z-index: 4;
  width: 116px;
  height: 116px;
  object-fit: cover;
  border: 4px solid var(--line);
  border-radius: 14px;
  box-shadow:
    0 12px 0 rgba(45, 5, 4, 0.16),
    0 20px 20px rgba(47, 35, 20, 0.1);
  transform: translateZ(42px) rotate(6deg);
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 220ms ease;
}

.tile-music .tile-title {
  max-width: calc(100% - 92px);
}

.book-cover {
  position: absolute;
  right: 32px;
  top: -32px;
  z-index: 4;
  width: 104px;
  height: 160px;
  object-fit: cover;
  border: 4px solid var(--line);
  border-radius: 8px;
  box-shadow:
    0 12px 0 rgba(45, 5, 4, 0.14),
    0 20px 20px rgba(47, 35, 20, 0.08);
  transform: translateZ(42px) rotate(-6deg);
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 220ms ease;
}

.tile:hover .album-cover {
  transform: translateY(-8px) translateZ(52px) rotate(9deg);
  box-shadow:
    0 16px 0 rgba(45, 5, 4, 0.16),
    0 26px 26px rgba(47, 35, 20, 0.12);
}

.tile:hover .book-cover {
  transform: translateY(-8px) translateZ(52px) rotate(-9deg);
  box-shadow:
    0 16px 0 rgba(45, 5, 4, 0.14),
    0 26px 26px rgba(47, 35, 20, 0.1);
}

.tile-books .tile-title {
  max-width: calc(100% - 118px);
}

.create-bento {
  grid-template-rows: 190px 190px 146px;
}

.create-bento .tile {
  border-color: rgba(255, 248, 234, 0.16);
  background:
    radial-gradient(circle at var(--mx, 18%) var(--my, 12%), rgba(255, 255, 255, 0.16), transparent 12rem),
    linear-gradient(145deg, var(--tile-bg), var(--tile-bg-2, #1d1d1d));
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 234, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 8px 0 rgba(0, 0, 0, 0.2),
    0 22px 34px rgba(16, 16, 16, 0.16);
}

.create-bento .tile::before {
  opacity: 0.2;
  background:
    radial-gradient(circle at var(--mx, 24%) var(--my, 12%), rgba(255, 255, 255, 0.2), transparent 12rem),
    linear-gradient(115deg, transparent 48%, rgba(255, 248, 234, 0.08) 48.4%, transparent 49%);
}

.create-bento .tile:hover {
  filter: saturate(1.04) contrast(1.03);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 234, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.34),
    0 14px 0 rgba(0, 0, 0, 0.24),
    0 30px 42px rgba(16, 16, 16, 0.2);
}

.create-bento .tile-kicker {
  color: rgba(255, 248, 234, 0.66);
}

.create-bento .tile-title,
.create-bento .create-count {
  color: #fff8ea;
}

.tile-create-youtube {
  --tile-bg: #171717;
  --tile-bg-2: #050505;
  --tilt: -0.8deg;
  --icon-tilt: 4deg;
  grid-column: 1 / span 5;
  grid-row: 1 / span 3;
  color: var(--cream);
}

.tile-chatgpt {
  --tile-bg: #232323;
  --tile-bg-2: #101010;
  --tilt: 0.8deg;
  --icon-tilt: -6deg;
  grid-column: 6 / span 5;
  grid-row: 1;
  color: var(--cream);
}

.tile-umami {
  --tile-bg: #2c2720;
  --tile-bg-2: #12100d;
  --tilt: -0.4deg;
  --icon-tilt: 3deg;
  grid-column: 6 / span 5;
  grid-row: 2;
  color: var(--cream);
}

.tile-curseforge {
  --tile-bg: #2d211b;
  --tile-bg-2: #110c09;
  --tilt: -1deg;
  --icon-tilt: 8deg;
  grid-column: 11 / span 5;
  grid-row: 1;
  color: var(--cream);
}

.tile-epidemic {
  --tile-bg: #211f25;
  --tile-bg-2: #0f0e12;
  --tilt: 1deg;
  --icon-tilt: -3deg;
  grid-column: 6 / span 5;
  grid-row: 3;
  color: var(--cream);
}

.tile-github {
  --tile-bg: #181818;
  --tile-bg-2: #060606;
  --tilt: 0.4deg;
  --icon-tilt: -4deg;
  grid-column: 11 / span 5;
  grid-row: 2 / span 2;
  color: var(--cream);
}

.create-count {
  position: relative;
  z-index: 3;
  align-self: flex-start;
  margin-top: auto;
  margin-bottom: 8px;
  font-family: var(--display);
  font-size: clamp(72px, 8vw, 116px);
  font-weight: 700;
  line-height: 0.78;
  letter-spacing: 0;
  transform: translateZ(20px);
}

.tile-create-youtube .tile-title {
  max-width: calc(100% - 112px);
  font-size: var(--tile-title-side);
}

.tile-create-youtube .tile-icon {
  right: 26px;
  bottom: 28px;
  width: 92px;
  height: 92px;
}

.tile-chatgpt .tile-title,
.tile-umami .tile-title,
.tile-curseforge .tile-title,
.tile-epidemic .tile-title {
  font-size: var(--tile-title-side);
}

.tile-chatgpt .tile-icon,
.tile-umami .tile-icon,
.tile-curseforge .tile-icon,
.tile-epidemic .tile-icon {
  width: 82px;
  height: 82px;
}

.tile-chatgpt .tile-icon {
  width: 88px;
  height: 88px;
  right: 24px;
  bottom: 18px;
  filter: drop-shadow(8px 10px 0 rgba(0, 0, 0, 0.18));
}

.tile-github {
  overflow: hidden;
}

.tile-github .tile-title {
  font-size: var(--tile-title-side);
  max-width: calc(100% - 72px);
  z-index: 5;
}

.tile-github .tile-icon {
  left: auto;
  right: 22px;
  bottom: 18px;
  width: 82px;
  height: 82px;
  z-index: 5;
  filter: drop-shadow(8px 10px 0 rgba(0, 0, 0, 0.18));
}

.github-dots {
  position: absolute;
  z-index: 3;
  right: 22px;
  top: 48px;
  width: min(58%, 220px);
  max-height: 92px;
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 5px;
  opacity: 0.72;
  transform: translateZ(38px) rotate(-0.8deg);
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.github-dot {
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 234, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.github-dot.is-l1 { background: #9be15d; }
.github-dot.is-l2 { background: #64c94c; }
.github-dot.is-l3 { background: #37a342; }
.github-dot.is-l4 { background: #d7ff65; }

.tile-github:hover .github-dots {
  transform: translateY(-8px) translateZ(50px) rotate(0.4deg);
}

@media (max-width: 760px) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: minmax(132px, auto);
  }

  .tile-letterboxd,
  .tile-youtube,
  .tile-reddit {
    grid-column: span 2;
    grid-row: auto;
    min-height: 270px;
  }

  .tile-bsky,
  .tile-twitch,
  .tile-pinterest,
  .tile-reddit,
  .tile-music,
  .tile-books,
  .tile-chatgpt,
  .tile-umami,
  .tile-curseforge,
  .tile-epidemic {
    grid-column: span 1;
    grid-row: auto;
  }

  .tile-reddit {
    grid-column: span 1;
    min-height: 126px;
  }

  .tile-books {
    grid-column: span 2;
  }

  .tile-music {
    grid-column: span 2;
  }

  .tile-create-youtube {
    grid-column: span 2;
    grid-row: auto;
    min-height: 260px;
    order: 1;
  }

  .tile-chatgpt {
    order: 2;
  }

  .tile-umami {
    order: 3;
  }

  .tile-curseforge {
    order: 4;
  }

  .tile-github {
    grid-column: span 1;
    grid-row: auto;
    min-height: 148px;
    order: 5;
  }

  .tile-epidemic {
    grid-column: span 2;
    order: 6;
  }

  .create-count {
    font-size: 74px;
  }

  .github-dots {
    right: 14px;
    top: 36px;
    width: min(54%, 150px);
    max-height: 46px;
    gap: 3px;
  }

  .tile-github .tile-title {
    max-width: calc(100% - 64px);
    transform: translateZ(44px);
  }

  .tile-github .tile-icon {
    left: auto;
    right: 18px;
    bottom: 16px;
    width: 72px;
    height: 72px;
  }

  .poster-stack {
    width: 320px;
    height: 160px;
  }

  .poster {
    width: 100px;
    height: 148px;
  }

  .poster-a {
    left: -4px;
  }

  .poster-b {
    left: 64px;
  }

  .poster-c {
    left: 128px;
  }

  .poster-d {
    left: 192px;
  }

  .tile-youtube .tile-icon {
    width: 92px;
    height: 92px;
  }

  .tile-youtube .tile-title {
    max-width: calc(100% - 108px);
  }

  .youtube-thumb {
    top: 46%;
    left: 50%;
    width: min(64%, 230px);
  }

  .album-cover {
    top: -10px;
    width: 92px;
    height: 92px;
  }

  .book-cover {
    top: -18px;
    right: 18px;
    width: 74px;
    height: 116px;
  }

  .tile-books .tile-title {
    max-width: calc(100% - 86px);
  }
}
