:root {
  --bg: #020203;
  --ink: rgb(233 242 251 / 0.5);
  --font: "nimbus-sans-condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;

  --gutter: 16px;
  --slide-max-width: 886px;
  --slide-ratio: 1.56;
  --slide-radius: 24px;

  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Home: one screen, no page scroll; the slider takes the scroll gestures. */

html:has(body.home),
body.home {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* Intro: profile video, image, sub head */

.intro {
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  padding: clamp(24px, 7vh, 77px) var(--gutter) 0;
  /* Coming back: wait a moment so slide 1 has moved out of the way. */
  transition:
    opacity 500ms var(--ease-out) 150ms,
    transform 700ms var(--ease-out) 100ms,
    filter 500ms var(--ease-out) 150ms,
    visibility 0s;
}

.is-scrolled .intro {
  opacity: 0;
  transform: translateY(-16px) scale(0.98);
  filter: blur(8px);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 400ms var(--ease-out),
    transform 600ms var(--ease-out),
    filter 400ms var(--ease-out),
    visibility 0s linear 600ms;
}

.profile-video {
  position: relative;
  z-index: 1;
  width: 66px;
  height: 66px;
  border-radius: 9999px;
  overflow: hidden;
  background: #111114;
}

.profile-video video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* The poster covers the video until it plays (main.js adds .is-playing). If autoplay is
   refused (e.g. low-power mode), Safari would otherwise show a play button on it. */
.profile-video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../assets/profile-poster.jpg") center / cover;
  transition: opacity 300ms ease;
}

.profile-video.is-playing::after {
  opacity: 0;
}

/* The image box overlaps the video slightly, as in Figma. */
.intro-img {
  width: 360px;
  max-width: 100%;
  margin-top: -25px;
}

.intro-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sub-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 4px;
  /* Negative because hero.png has ~50px of empty space at its bottom. */
  margin-top: -16px;
  font-size: 14px;
  line-height: normal;
  text-align: center;
}

.sub-head__link,
.imprint-link {
  color: inherit;
  text-decoration: underline;
  text-underline-position: from-font;
  transition: opacity 200ms ease;
}

.sub-head__link:hover,
.imprint-link:hover,
.back-to-top:hover .back-to-top__label {
  opacity: 0.5;
}

.sub-head__link:focus-visible,
.imprint-link:focus-visible,
.back-to-top:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

/* Slider */

.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  container-type: size;
  transition: transform var(--slide-speed, 600ms) ease;
}

/* --scrolled-shift is set in main.js: how far the slider moves up after slide 1. */
.is-scrolled .stage {
  transform: translateY(calc(-1 * var(--scrolled-shift, 0px)));
}

/* Registered as a length so main.js can read --peek in px. */
@property --peek {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

.work-slider {
  --gap-top: clamp(32px, 8vh, 82px);
  /* How much room the next slide gets below slide 1. */
  --peek: clamp(40px, 9vh, 100px);
  /* The slide fills the space below the intro, but is at least 46% of the screen high,
     so while browsing the slides above and below run off the screen edges. If that is
     too big for the space below the intro, main.js scales slide 1 down to fit.
     Never below 240px wide, so the slider can't vanish on very short screens. */
  --slide-width: max(
    min(240px, 100cqw - 2 * var(--gutter)),
    min(
      var(--slide-max-width),
      100cqw - 2 * var(--gutter),
      max(100cqh - var(--gap-top) - var(--peek), 46svh) * var(--slide-ratio)
    )
  );

  width: var(--slide-width);
  height: calc(var(--slide-width) / var(--slide-ratio));
  margin: var(--gap-top) auto 0;
  /* --intro-scale is set in main.js; it only applies on slide 1. */
  transform: scale(var(--intro-scale, 1));
  transform-origin: 50% 0;
}

.has-moved .work-slider {
  transition: transform var(--slide-speed, 600ms) ease;
}

.is-scrolled .work-slider {
  transform: none;
}

.swiper-panorama {
  overflow: visible;
}

.swiper-panorama .swiper-slide {
  backface-visibility: hidden;
  /* With visibility, a slide that leaves the curve fades out before it is hidden
     (e.g. the active slide on "Back to top"). */
  transition-property: transform, opacity, visibility;
}

.slide-card {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: var(--slide-radius);
  background: #0c0c12;
  isolation: isolate;
  container-type: inline-size;
}

/* Taller than the card so the parallax shift never shows an edge. */
.slide-card__media {
  position: absolute;
  top: -13%;
  left: 0;
  width: 100%;
  height: 126%;
  object-fit: cover;
}

.slide-card__title {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  margin: 0;
  color: #fff;
  font-family: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(22px, 4.5cqw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.slide-card .swiper-lazy-preloader {
  z-index: 2;
}

/* Imprint */

.imprint-link {
  position: fixed;
  right: max(9px, env(safe-area-inset-right));
  bottom: calc(3px + env(safe-area-inset-bottom));
  z-index: 2;
  /* Padding enlarges the click area around the tiny label. */
  padding: 6px 8px;
  font-size: 8px;
  line-height: normal;
}

/* Back to top: shows from slide 2 on, while the intro is hidden. */

.back-to-top {
  position: fixed;
  left: 50%;
  /* The label sits 25px above the bottom edge, as in Figma. */
  bottom: calc(19px + env(safe-area-inset-bottom));
  z-index: 2;
  /* Padding enlarges the click area around the label. */
  padding: 6px 8px;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 12px;
  line-height: normal;
  white-space: nowrap;
  cursor: pointer;
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 400ms var(--ease-out),
    visibility 0s linear 400ms;
}

.is-scrolled .back-to-top {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 500ms var(--ease-out) 150ms,
    visibility 0s;
}

/* Hover fades the label, so it doesn't wait for the show/hide timing above. */
.back-to-top__label {
  transition: opacity 200ms ease;
}

@media (max-width: 767px) {
  :root {
    --slide-radius: 16px;
    /* Square slides on phones: a 1.56 slide would only be ~230px high here, so three
       would fit on screen and the slides above and below couldn't run off its edges. */
    --slide-ratio: 1;
  }

  /* Phones: the slide fills the width (at most 62% of the screen height), so the slides
     above and below run off the screen edges. On slide 1, main.js scales it down to fit
     below the intro. */
  .work-slider {
    --gap-top: clamp(24px, 4svh, 40px);
    --slide-width: min(100cqw - 2 * var(--gutter), 62svh * var(--slide-ratio));
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro,
  .is-scrolled .intro {
    transform: none;
    filter: none;
  }
}

.imprint {
  padding: 16px;
}

.slide-card__title {
  font-family: var(--font);
  font-weight: 400;
  font-size: 16px;
  color: var(--ink);
}