:root {
  --bg: #ffffff;
  --text: #363636;
  --muted: #6b6b6b;
  --link: #007aff;
  --max: 1080px;
  --read: 900px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --text: #e6e6e6;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 0.1rem solid var(--link);
  outline-offset: 0.1rem;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3.5rem 1.25rem 2rem;
  text-align: center;

  & h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 8rem);
    line-height: 1.05;
    font-weight: 600;
  }
}

h2 {
  a {
    color: var(--text);
    text-decoration: none;
  }

  a:hover,
  a:focus-visible {
    text-decoration: none;
  }

  a::before {
    text-decoration: none;
  }
}

.authors {
  margin: 0;
  font-size: 1.15rem;
}

.authors a {
  margin: 0 .15rem;
}

.note {
  margin: .25rem 0 0;
  font-size: .85rem;
  color: var(--muted);
}

.affiliations {
  margin: 1rem 0 0;
}

.venue {
  margin: .75rem 0 0;
  font-weight: 700;
}

.links {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
}

.btn {
  display: inline-block;
  padding: .45rem 1.1rem;
  border-radius: 100rem;
  background: var(--text);
  color: var(--bg);
  font-size: .95rem;
}

.btn:hover {
  text-decoration: none;
  opacity: .85;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

section {
  padding: 2rem 0;
}

section h2 {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 600;
}

#abstract p {
  max-width: var(--read);
  margin: 0 auto 1rem;
  text-align: justify;
}

video {
  width: 100%;
  max-width: var(--read);
  margin: 0 auto;
  border-radius: 0.2rem;
}

figure {
  margin: 0 auto 1.5rem;
}

figure img {
  margin: 0 auto;
}

figcaption {
  text-align: left;
  max-width: var(--read);
  margin: .75rem auto 0;
  font-size: .9rem;
  color: var(--muted);
  text-align: justify;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem 1.5rem;
}

.video-grid video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

pre {
  text-align: left;
  max-width: var(--read);
  margin: 0 auto;
  padding: 1rem;
  overflow-x: auto;
  background: color-mix(in srgb, var(--bg) 90%, var(--text));
  border-radius: 0.2rem;
  font-size: .85rem;
}

footer {
  max-width: var(--read);
  margin: 0 auto 0;
  padding: 0.5rem 0;
  border-top: 0.1rem solid color-mix(in srgb, var(--bg) 80%, var(--text));
  text-align: center;
  font-size: .85rem;
  color: var(--muted);

  p {
    margin: 0;
    padding: 0;
  }
}

/* Animated title */

@property --mx {
  syntax: "<number>";
  inherits: true;
  initial-value: 4.5;
}

@property --active {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

@keyframes force-intro {
  0% {
    --mx: 0;
    --active: 0;
  }

  10% {
    --mx: 0;
    --active: 1;
  }

  90% {
    --mx: 9;
    --active: 1;
  }

  100% {
    --mx: 9;
    --active: 0;
  }
}

.hero h1 {
  position: relative;
  display: inline-block;
  cursor: default;
  user-select: none;

  & span {
    padding: 0;
    line-height: 1;
  }

  & .sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  &>[aria-hidden] {
    --mx: 4.5;
    --active: 0;
    display: inline-flex;
    padding: 2rem 2rem 1rem;
    animation: force-intro 1.2s cubic-bezier(0.5, 0, 0.5, 1) 2s 1;
    transition:
      --mx 0.45s cubic-bezier(0.22, 1, 0.36, 1),
      --active 0.35s ease;

    &:hover {
      animation: none;
      --active: 1;
    }

    &:has(> :nth-child(1):hover) {
      --mx: 0;
    }

    &:has(> :nth-child(2):hover) {
      --mx: 1;
    }

    &:has(> :nth-child(3):hover) {
      --mx: 2;
    }

    &:has(> :nth-child(4):hover) {
      --mx: 3;
    }

    &:has(> :nth-child(5):hover) {
      --mx: 4;
    }

    &:has(> :nth-child(6):hover) {
      --mx: 5;
    }

    &:has(> :nth-child(7):hover) {
      --mx: 6;
    }

    &:has(> :nth-child(8):hover) {
      --mx: 7;
    }

    &:has(> :nth-child(9):hover) {
      --mx: 8;
    }

    &:has(> :nth-child(10):hover) {
      --mx: 9;
    }

    &>span {
      --dist: calc(var(--i) - var(--mx));
      --abs-dist: max(var(--dist), calc(var(--dist) * -1));
      --force: clamp(0, calc(1 - var(--abs-dist) * 0.22), 1);

      display: inline-block;
      transition: color 0.3s ease, text-shadow 0.3s ease;

      transform:
        translateX(calc(var(--dist) * var(--force) * 0.6rem * var(--active))) translateY(calc(var(--force) * -1.5rem * var(--active))) rotate(calc(var(--dist) * var(--force) * 5deg * var(--active))) scale(calc(1 + var(--force) * 0.25 * var(--active)));

      &:hover {
        color: var(--link);
        text-shadow: 0 1rem 2rem color-mix(in srgb, var(--link) 90%, var(--bg));
      }
    }
  }

  @media (prefers-reduced-motion: reduce) {

    &>[aria-hidden],
    &>[aria-hidden]>span {
      animation: none !important;
      transition: none !important;
      transform: none !important;
    }
  }
}

/* Animated section headers */

h2 {
  & a {
    position: relative;

    &::before {
      content: "#";
      position: absolute;
      right: 100%;
      margin-right: 0.35em;
      opacity: 0;
      transform: translateX(0.25em);
      transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    }

    &:hover,
    &:focus-visible {
      &::before {
        opacity: 1;
        transform: translateX(0);
      }
    }
  }
}