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

html {
  font-family: ui-rounded, system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  color-scheme: light dark;
}

body {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: max-content auto max-content;
  gap: 2rem;
  place-items: center;
  padding: 1rem;
  background-color: light-dark(#d6d3d1, #1c1917);
  color: light-dark(#0c0a09, #f5f5f4);

  > * {
    max-width: 768px;
  }
}

a {
  color: light-dark(#dc2626, #f87171);
  text-decoration: none;
}

header {
  align-items: center;
  display: flex;
  height: 36px;
  justify-content: space-between;
  width: 100%;
  row-gap: 1rem;

  > a {
    display: flex;
    flex-direction: row;
    align-items: center;
    column-gap: 0.5rem;
    color: light-dark(#0c0a09, #f5f5f4);
  }

  picture {
    height: 36px;

    img {
      width: 36px;
      height: 36px;
    }
  }

  h4 {
    line-height: 1rem;
  }
}

nav {
  ul {
    display: flex;
    list-style: none;
    gap: 1rem;
  }
}

main {
  display: flex;
  flex-direction: column;
  align-self: flex-start;

  &.center {
    align-items: center;
  }
  &.two-column {
    flex-direction: row;
    align-items: center;
    column-gap: 1.5rem;
    row-gap: 3rem;
    width: 100%;
    margin-block-end: 1.5rem;

    > div:first-child {
      display: flex;
      flex-direction: column;
      align-items: center;
      flex: 0 0 auto;
      margin-inline-start: -24px;
    }

    > div:last-child {
      flex: 1;
      display: grid;
      grid-template-columns: auto 1fr;
      column-gap: 1.5rem;
      row-gap: 3rem;
      align-content: start;

      > h2 {
        grid-column: 2;
        margin: 0;
      }

      > .app-store-badge {
        grid-column: 2;
        margin-block-start: 1.5rem;
        margin-block-end: 1rem;
      }
    }

    ul {
      list-style: none;
      margin: 0;
      display: grid;
      grid-template-columns: subgrid;
      grid-column: 1 / -1;
      row-gap: 1rem;

      li {
        display: grid;
        grid-template-columns: subgrid;
        grid-column: 1 / -1;
        row-gap: 0.25rem;

        h3 {
          display: contents;
        }
        h3 svg {
          grid-column: 1;
          height: 21px;
          align-self: center;
          color: light-dark(#0c0a09, #f5f5f4);
          justify-self: center;
        }
        h3 svg.icon-sliders {
          height: 18px;
        }
        h3 span {
          grid-column: 2;
          font-size: 1.4rem;
          font-weight: 600;
        }
        p {
          grid-column: 2;
          font-weight: 400;
          font-size: 0.9rem;
          margin-block-end: 0;
          text-wrap: balance;
          color: light-dark(#292524, #a8a29e);
        }
        .live-activity {
          grid-column: 2;
          margin-block-start: 1rem;
        }
      }
    }

    @media (max-width: 768px) {
      flex-direction: column;
      align-items: center;

      > div:first-child {
        margin-inline-start: 0;
      }

      > div:last-child {
        max-width: 512px;
        grid-template-columns: 1fr;
        justify-items: center;

        > h2 {
          grid-column: 1;
          text-align: center;
        }

        > .app-store-badge {
          grid-column: 1;
        }
      }

      ul {
        li {
          display: flex;
          flex-direction: column;
          align-items: center;
          text-align: center;

          h3 {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin: 0;
          }

          p {
            margin-block-end: 0;
          }

          .live-activity {
            max-width: 320px;
            width: 100%;
          }
        }
      }
    }
  }
  &.not-found {
    margin-block-start: 5rem;
  }

  ul {
    margin-inline-start: 1rem;
    margin-block-end: 1rem;

    li {
      margin-block-end: 0.25rem;
    }
  }

  ol {
    margin-inline-start: 1rem;
    margin-block-end: 1rem;
    padding-inline-start: 1rem;

    li {
      margin-block-end: 0.25rem;
    }
  }
}

h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 2.5rem;
  text-align: center;

  small {
    font-size: 1rem;
    font-weight: normal;
    text-wrap: balance;
  }
}

h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-block-end: 0.5rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-block-start: 1.5rem;
  margin-block-end: 0.5rem;
}
h4 {
  font-size: 1.5rem;
}
h5 {
  font-size: 1.1rem;
  margin-block-start: 1.5rem;
  margin-block-end: 0.5rem;
}

p {
  margin-block-end: 1rem;
}

picture.icon {
  display: block;
  margin-inline: auto;
  margin-block: 2rem;

  img {
    width: 128px;
    height: 128px;
  }
}

.app-store-badge {
  svg {
    display: block;
  }
}

.badge-border {
  fill: light-dark(#a8a29e, #0c0a09);
}
.badge-bg {
  fill: light-dark(#0c0a09, #e7e5e4);
}
.badge-content {
  fill: light-dark(#e7e5e4, #0c0a09);
}

.video-controls {
  display: flex;

  button {
    cursor: pointer;
    border: 0;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    margin-block: -16px;
    margin-inline: -12px;

    svg {
      width: 32px;
      height: 32px;
      color: light-dark(#dc2626, #f87171);
    }
  }
}

.focus-video {
  width: min(350px, 100%);
  align-self: center;
  display: block;
}

.last-updated {
  margin-block-start: 2rem;
}

.live-activity {
  display: grid;
  place-items: center;
  border-radius: 16px;
  overflow: hidden;
  height: 48px;
  background-color: #292524;
  user-select: none;
  margin-block-start: 0.5rem;

  > * {
    grid-area: 1 / 1;
  }

  .countdown {
    color: #e7e5e4;
    font-size: 1.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    align-self: center;
    width: 100%;
    text-align: center;
    z-index: 3;
  }

  .progress {
    place-self: start;
    height: 100%;
    width: 30%;
    background-color: #57534e;
    z-index: 2;
    transition: width 0.25s linear;
  }

  .indicators {
    display: flex;
    align-self: end;
    width: 100%;
    z-index: 1;
    flex-direction: row;
    justify-content: space-evenly;

    > div {
      color: white;
      display: flex;
      width: 5px;
      height: 4px;
      border-top-left-radius: 2.5px;
      border-top-right-radius: 2.5px;
      background-color: #57534e;
    }
  }
}

.zstack {
  display: grid;
  place-items: center;
  aspect-ratio: 767 / 1600;
  width: min(calc(min(80vh, 800px) * 767 / 1600), calc(100vw - 2rem));
}

.zstack > * {
  grid-area: 1 / 1;
}

.zstack > video,
.zstack > .reduce-motion-img {
  z-index: 0;
  width: calc(700 / 767 * 100%);
  height: auto;
  clip-path: inset(0 round 14% / 7%);
  transform: scale(1.005);
}

.reduce-motion-img {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .zstack > video,
  .video-controls {
    visibility: hidden;
  }

  .reduce-motion-img {
    display: block;
  }
}

.zstack > picture {
  z-index: 1;
  width: 100%;
}

.zstack > picture img {
  width: 100%;
  height: auto;
  display: block;
}

@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
