/* Preserve each source's visual identity, with one page and one scroll owner. */
.loader {
  --colour-dark: #000;
  --colour-mid: #fff;
  --colour-light: #fff;
  --colour-muted: #aaa;
  color: #fff;
}

.portfolio-intro {
  position: relative;
  height: 600vh;
  height: 600svh;
  background: #050b12;
}

.portfolio-intro__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

#portrait-scene {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #050b12;
}

.portfolio-intro__skip {
  position: absolute;
  right: max(16px, 2vw);
  bottom: 18px;
  padding: 8px 0;
  color: #e6f1f8;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
}

.portfolio-intro__skip:focus-visible {
  opacity: 1;
  pointer-events: auto;
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

body>header {
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

body.portfolio-past-intro>header {
  opacity: 1;
  pointer-events: auto;
}

.portfolio-nav a {
  color: inherit;
  text-decoration: none;
}

.work__canvas {
  display: none;
}

.work__screen--crt .work__canvas {
  display: block;
}

.work__poster {
  object-fit: contain;
}

.work__screen .work__poster,
.work__screen .work__canvas {
  transform: translate(var(--pointer-x, 0%), var(--pointer-y, 0%)) scale(1.07);
  transition: transform 350ms cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-reduced-motion: reduce) {
  .work__screen .work__poster,
  .work__screen .work__canvas {
    transform: none;
    transition: none;
  }
}

/* Keep the selected project in view while the visitor scrolls through this section. */
.work__tv-row > .row {
  min-height: 160svh;
}

.work__tv {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100svh;
}

@media (max-width: 575px) {
  .work__tv-row > .row {
    min-height: 140svh;
  }
}

#about,
#work,
#contact {
  scroll-margin-top: 80px;
}

#about:focus,
#work:focus,
#contact:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--colour-mid);
  outline-offset: 5px;
}

::selection {
  color: var(--colour-dark);
  background: var(--colour-mid);
}

@media (max-width: 575px) {
  .portfolio-intro {
    height: 660svh;
  }

  .portfolio-nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-intro {
    height: 100svh;
  }

  body>header {
    transition: none;
  }
}

/* The reference's global section padding must not offset the full-screen opening. */
.portfolio-intro,
section.portfolio-intro:first-child:not(.loader) {
  padding: 0;
}

.portfolio-intro__stage {
  top: max(9.9px, 1.0416666667vw);
  height: calc(100svh - 2 * max(9.9px, 1.0416666667vw));
}

.about__subtitle .text--heading {
  white-space: normal;
  font-size: clamp(60px, 11vw, 190px);
  max-width: 100%;
}

.about__subtitle .text--split-copy .char--space {
  width: .18em;
}

.portfolio-bio {
  max-width: 55ch;
  margin-top: 24px;
  font-size: clamp(14px, 1.25vw, 18px);
  line-height: 1.5;
  color: var(--colour-light);
}

@media (max-width: 575px) {
  body>header .header__branding {
    flex: 0 0 22%;
    max-width: 22%;
  }

  body>header .header__nav {
    flex: 0 0 78%;
    max-width: 78%;
  }

  .portfolio-nav {
    display: list-item;
  }

  .portfolio-nav:first-child {
    display: none;
  }

  .header__nav li:has([data-pong-open]) {
    display: none;
  }

  .about__subtitle .text--heading {
    font-size: 14vw;
  }

  .portfolio-bio {
    font-size: 13px;
    margin-top: 16px;
  }
}

/* Keep functional labels readable at phone sizes. */
.text--caption,
.footer__link,
.footer__copyright,
.footer__built,
.pong__gameover-subtitle {
  font-size: max(11px, 1.1111111111vw);
}

/* All automatic lighting modes stay within the deep-ocean color family. */
:root {
  color-scheme: dark;
  scrollbar-color: var(--colour-mid) var(--colour-dark);
  caret-color: var(--colour-mid);
}

/* The frame belongs to the viewport, including its bottom edge while scrolling. */
.portfolio-viewport-frame {
  position: fixed;
  inset: 0;
  height: 100dvh;
  box-sizing: border-box;
  border: max(9.9px, 1.0416666667vw) solid var(--colour-light);
  z-index: 1000;
  pointer-events: none;
}

.footer__link:has(.platform-icon) {
  display: inline-flex;
  align-items: center;
  gap: .65em;
}

.platform-icon {
  display: block;
  flex: 0 0 auto;
  width: 1.2em;
  height: 1.2em;
}

.platform-icon-reveal {
  display: inline-flex;
  flex: 0 0 auto;
  line-height: 0;
}

.platform-icon-reveal .char--letter {
  display: inline-flex;
}

/* Hide the custom cursor until it has received an actual pointer position. */
body:not(.cursor--positioned) .cursor {
  opacity: 0;
}
