@font-face {
  font-family: "Sans";
  src: url("./fonts/sans.otf") format("opentype");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mono";
  src: url("./fonts/mono.ttf") format("truetype");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #080808;
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, .66);
  --line: rgba(255, 255, 255, .15);
  --sans: "Sans", sans-serif;
  --mono: "Mono", "Courier New", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  scrollbar-gutter: stable;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 110px 20px 20px;
}

.top-nav {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 48px;
  width: 100vw;
  max-width: none;
  padding: 44px 28px 32px;
  background: rgba(8, 8, 8, .8);
  box-shadow: 0 .5px 0 rgba(255, 255, 255, .035), 0 12px 32px rgba(0, 0, 0, .48);
  transform: translateX(-50%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.top-nav::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 100vw;
  height: 1px;
  background: rgba(255, 255, 255, .18);
  transform: translateX(-50%) scaleY(.5);
  transform-origin: bottom;
}

.nav-item {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.nav-title {
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 400;
  line-height: .9;
  letter-spacing: .02em;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  padding-top: 10px;
}

.archive-item {
  position: relative;
  display: block;
  grid-column: span 3;
  overflow: hidden;
  background: #111;
}

.archive-item:nth-child(6n + 1) {
  grid-column: span 6;
}

.archive-item:nth-child(6n + 2) {
  grid-column: span 3;
}

.archive-item:nth-child(6n + 3) {
  grid-column: span 3;
}

.archive-item:nth-child(6n + 4),
.archive-item:nth-child(6n + 5),
.archive-item:nth-child(6n + 6) {
  grid-column: span 4;
}

.archive-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  opacity: 0;
  filter: blur(14px);
  object-fit: cover;
  transform: scale(1.035);
  transition:
    opacity .9s ease,
    filter 1.1s cubic-bezier(.22, 1, .36, 1),
    transform 1.1s cubic-bezier(.22, 1, .36, 1);
}

.archive-item img.is-loaded {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

.archive-item:nth-child(6n + 1) img {
  aspect-ratio: 16 / 9;
}

.archive-item:nth-child(6n + 4) img,
.archive-item:nth-child(6n + 5) img,
.archive-item:nth-child(6n + 6) img {
  aspect-ratio: 5 / 4;
}

.contact-footer {
  margin-top: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 0;
  overflow: hidden;
  background: var(--bg);
}

.footer-center {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}

.contact-btn {
  position: relative;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 3rem;
  border: 1px solid #fff;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  transition: background .25s ease, color .25s ease, transform .25s ease;
}

.contact-btn:hover {
  background: #fff;
  color: #080808;
  transform: translateY(-2px);
}

.contact-btn:active {
  transform: translateY(0) scale(.98);
}

.contact-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.footer-meta {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  margin: 1rem auto 0;
  padding: 0 20px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.4;
  text-transform: uppercase;
}

.footer-meta > div:last-child {
  text-align: right;
}

@media (min-width: 769px) {
  .top-nav {
    padding-right: calc((100vw - 1400px) / 2 + 28px);
    padding-left: calc((100vw - 1400px) / 2 + 28px);
  }
}

@media (min-width: 1101px) {
  .archive-item:last-child:nth-child(6n + 4) {
    grid-column: span 12;
  }

  .archive-item:last-child:nth-child(6n + 4) img {
    aspect-ratio: 16 / 7;
  }
}

@media (max-width: 1100px) {
  .archive-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .archive-item,
  .archive-item:nth-child(n) {
    grid-column: span 3;
  }

  .archive-item:nth-child(5n + 1) {
    grid-column: span 6;
  }
}

@media (max-width: 768px) {
  .page {
    padding: 90px 20px 20px;
  }

  .top-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    padding: 38px 20px 28px;
  }

  .nav-item:first-child {
    justify-self: start;
    align-items: flex-start;
    text-align: left;
  }

  .nav-item:nth-child(2) {
    justify-self: center;
    align-items: center;
    text-align: center;
  }

  .nav-item:nth-child(3) {
    justify-self: end;
    align-items: flex-end;
    text-align: right;
  }

  .nav-title {
    font-size: 14px;
    line-height: 1;
  }

  .archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 12px;
  }

  .archive-item,
  .archive-item:nth-child(n) {
    grid-column: span 1;
  }

  .archive-item:nth-child(3n) {
    grid-column: 1 / -1;
  }

  .archive-item img,
  .archive-item:nth-child(n) img {
    aspect-ratio: 4 / 5;
  }

  .archive-item:nth-child(3n) img {
    aspect-ratio: 16 / 10;
  }
}

/* MISC: reversible scroll collage on desktop and touch. */
.misc-motion .page {
  min-height: calc(100svh + var(--misc-reveal-start, 0px) + var(--misc-scroll-distance, 1080px));
}

.misc-motion .page {
  position: relative;
  max-width: none;
  padding: 0;
}

.misc-motion .misc-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.misc-motion .archive-grid {
  position: sticky;
  top: 0;
  height: 100svh;
  display: block;
  padding: 0;
  pointer-events: none;
  overflow: hidden;
}

.trail-card {
  position: absolute;
  box-shadow: 0 14px 45px rgba(0, 0, 0, .24);
}

.trail-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.misc-motion .contact-footer {
  position: relative;
  z-index: 100;
}

.marquee {
  overflow: hidden;
  white-space: nowrap;
}

.marquee-bottom {
  color: rgba(142, 142, 142, .99);
}

.track {
  font-family: var(--sans);
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 400;
  line-height: 1;
}

@media (min-width: 769px) {
  .contact-footer { padding-top: 4.8rem; }
  .contact-footer .track {
    font-size: clamp(4.4rem, 12.1vw, 10.9rem);
    line-height: .9;
  }
}

@media (min-width: 769px) {
  .top-nav {
    padding-left: max(28px, calc((100vw - 1400px) / 2 + 28px));
    padding-right: max(28px, calc((100vw - 1400px) / 2 + 28px));
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .archive-item img { transition: none; }
}

/* Shared portfolio identity, held in place behind the photo trail. */
.hero-logo {
  width: 100%;
  margin-top: 8px;
  margin-bottom: 48px;
  overflow: hidden;
}

.hero-logo img {
  width: 100%;
  height: auto;
  animation: logoReveal 1.3s cubic-bezier(.22, 1, .36, 1) both;
}

.hero-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  margin-top: -10px;
  margin-bottom: 72px;
}

.hero-meta {
  color: var(--fg);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.3;
  text-transform: uppercase;
}

.hero-meta-center { text-align: center; }
.hero-meta-right { text-align: right; }

.misc-motion .misc-intro {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 110px 20px 0;
  pointer-events: none;
}

.misc-motion .archive-grid {
  z-index: 1;
}

@keyframes logoReveal {
  from { transform: translateY(120%); }
  to { transform: translateY(0); }
}

@media (max-width: 768px) {
  .hero-logo {
    margin-top: -10px;
    margin-bottom: 32px;
  }

  .hero-meta-grid {
    gap: 12px;
    margin-top: -6px;
    margin-bottom: 56px;
  }

  .hero-meta { font-size: 8px; }

  body:not(.misc-motion) .page { padding-top: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-logo img { animation: none; }
}

/* Desktop uses the mouse; scrolling leads directly to the footer. */
.misc-pointer .page {
  min-height: 100dvh;
}


/* Give desktop photography its own space below the full-size identity. */
.misc-pointer .misc-stage {
  position: relative;
  inset: auto;
  height: clamp(500px, 75dvh, 900px);
  pointer-events: auto;
}

.misc-pointer .archive-grid {
  position: relative;
  top: auto;
  height: 100%;
}

/* Keep the five touch layers ready for compositor-only scroll updates. */
.touch-card {
  top: 0;
  left: 0;
  visibility: hidden;
  will-change: transform;
}

.touch-card.is-visible {
  visibility: visible;
}

/* Native sticky scrolling moves the first photo below the intro, then holds it.
   This also stays in sync with iOS momentum scrolling and rubber banding. */
.misc-motion:not(.misc-pointer) .misc-stage {
  top: var(--misc-reveal-start, 0px);
}

/* The returning identity always covers the collage, including during iOS flicks. */
.misc-motion:not(.misc-pointer) .misc-intro {
  z-index: 2;
  background: var(--bg);
}
