/* Shared project gallery: wide imagery, tight gutters and paired compositions. */
.project-page { --project-gap: 10px; --gallery-radius: 16px; }
.project-page .project-hero-heading { padding-inline: 24px; }
.project-page .project-hero-body { display: flex; flex-direction: column; gap: 24px; padding: 0 10px; }
.project-page .project-hero-body > p { order: initial; min-height: 0; max-width: 42rem; margin: 0; padding: 24px 14px 0; }
.project-page .project-hero-image { order: initial; margin: 0; width: 100%; border-radius: var(--gallery-radius); }
.project-page .project-hero-image img { width: 100%; height: auto; max-height: 90svh; object-fit: contain; }
.project-page .project-hero-image-empty { display: none; }
.project-page .project-gallery { gap: 10px; padding: 10px; }
.project-page .project-gallery > .project-media,
.project-page .project-media-pair .project-media { border-radius: var(--gallery-radius); }
.project-page .project-media-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
.project-page .project-media-pair .project-media { display: block; width: 100%; }
.project-page .project-media img,
.project-page .project-media video { display: block; width: 100%; height: auto; max-width: none; max-height: none; object-fit: contain; }
.project-page .project-media-pair-equal-height { align-items: start; }
.project-page .project-story { margin-block: 30px; padding: 24px 14px; column-gap: 24px; }
.project-page .project-story:has(p:empty) { display: none; }
.project-page .project-media .motion-plyr { width: 100%; max-height: none; margin: 0; }
.project-page .project-website-showcase { margin-inline: 0; padding-inline: 0; gap: 10px; }
.project-page .project-website-video,
.project-page .project-website-screen { border-radius: var(--gallery-radius); }
@media (max-width: 700px) {
  .project-page { --gallery-radius: 10px; }
  .project-page .project-hero-heading { padding-inline: 16px; }
  .project-page .project-hero-body { gap: 20px; }
  .project-page .project-hero-body > p { padding: 20px 6px 0; }
  .project-page .project-hero-image img { max-height: none; }
  .project-page .project-media-pair { grid-template-columns: minmax(0, 1fr); }
  .project-page .project-story { margin-block: 20px; padding: 20px 6px; }
}

/* Hero-led introduction shared by every project. */
.project-page .project-intro { padding: 0; display: block; }
.project-intro-visual { margin: 0; width: 100%; background: var(--project-paper); overflow: hidden; }
.project-intro-visual img { display: block; width: 100%; height: min(85svh, 66vw); min-height: 380px; object-fit: contain; }
.project-intro-content { padding: 40px 32px 48px; }
.project-intro-content h1 { margin: 0; padding: 0 0 32px; font-size: clamp(3rem, 6vw, 6rem); line-height: 1; font-weight: 500; letter-spacing: -.035em; text-wrap: balance; }
.project-intro-details { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr); gap: 48px; padding-top: 24px; border-top: var(--line); }
.project-intro-meta { display: grid; gap: 20px; margin: 0; align-content: start; }
.project-intro-meta dt { font-size: .8125rem; line-height: 1.4; margin-bottom: 4px; }
.project-intro-meta dd { margin: 0; font-size: 1rem; line-height: 1.45; }
.project-intro-summary { margin: 0; max-width: 28em; font-size: clamp(1.5rem, 2.4vw, 2.5rem); line-height: 1.25; font-weight: 300; text-wrap: pretty; }
.project-page .project-gallery > .project-story:first-child { margin-top: 0; }
@media (max-width: 700px) {
  .project-intro-visual img { height: auto; min-height: 0; max-height: 80svh; object-fit: contain; }
  .project-intro-content { padding: 28px 20px 32px; }
  .project-intro-content h1 { font-size: clamp(2.75rem, 10vw, 4rem); padding-bottom: 24px; overflow-wrap: anywhere; }
  .project-intro-details { grid-template-columns: 1fr; gap: 28px; }
  .project-intro-meta { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
  .project-intro-summary { font-size: 1.5rem; }
}

/* Match gallery edges to the navigation at every breakpoint. */
.project-page .project-gallery { padding-inline: var(--page-padding); }
.project-page .project-media-pair .project-media img { width: 100%; height: auto; max-width: none; max-height: none; margin: 0; }

/* Align project introductions with the navigation and gallery. */
.project-page .project-intro-content { padding-inline: var(--page-padding); }

/* Align the closing project navigation with the shared page edges. */
.project-page .project-end-nav { padding-inline: var(--page-padding); }

/* The desktop navigation ends at the first gallery column edge. */
@media (min-width: 48.0625rem) {
  body:has(.project-page) .site-header { padding-right: calc(50% + 5px); }
}

@media (min-width: 48.0625rem) and (max-width: 70rem) {
 body:has(.project-page) .nav-link { padding-inline: .375rem; font-size: .875rem; }
}

/* Keep every project image within 90% of the viewport height. */
.project-page .project-intro-visual img,
.project-page .project-hero-image img,
.project-page .project-media img,
.project-page .project-media-pair .project-media img,
.project-page .project-website-screen img {
  max-height: 90vh;
  min-height: 0;
  object-fit: contain;
}

/* Direction-aware navigation, using the navigation hover easing. */
.site-header {
  transform: none;
  transition: transform 520ms cubic-bezier(.22, 1, .36, 1);
}
html.navbar-scroll-hidden .site-header:not(.is-menu-open):not(.is-index-open) {
  transform: translateY(calc(-100% - 3rem));
  transition-duration: 700ms;
}
@media (prefers-reduced-motion: reduce) {
  html.navbar-scroll-hidden .site-header, .site-header { transform: none; transition: none; }
}

/* Viewport-sized video frames: preserve the complete picture and controls. */
.project-page .project-media:has(.motion-plyr) { background: transparent; }
.project-page .project-media .motion-plyr {
  width: min(100%, calc(90svh * 16 / 9));
  max-height: 90svh;
  margin-inline: auto;
  border-radius: var(--gallery-radius);
  overflow: hidden;
}
.project-page .project-media-pair .project-media .motion-plyr {
  width: min(100%, calc(90svh * 9 / 16));
  margin-inline: auto;
}
.project-page .motion-plyr .plyr:not(.plyr--fullscreen-active),
.project-page .motion-plyr .plyr:not(.plyr--fullscreen-active) .plyr__video-wrapper { max-height: 90svh; }
.project-page .project-media .motion-plyr video { height: 100%; width: 100%; object-fit: contain; }

/* Four portrait films share one desktop row. */
.project-page .project-media-pair.project-media-quad { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
 .project-page .project-media-pair.project-media-quad { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
 .project-page .project-media-pair.project-media-quad { grid-template-columns: minmax(0, 1fr); }
}

/* Motion overview sits beside its metadata instead of repeating below. */
.project-intro-overview h2 { margin: 0 0 16px; font-size: 1.5rem; line-height: 1.2; font-weight: 500; }
.project-intro-overview p { margin: 0; max-width: 36em; font-size: 1rem; line-height: 1.5; font-weight: 300; white-space: pre-line; }

/* Ducky's long website captures retain their full page height. */
.project-page .project-website-screen img[src^="/assets/projects/ducky/website/"] {
  width: 100%;
  height: auto;
  max-height: none;
}

/* Project names share the homepage display scale at every breakpoint. */
html .project-page .project-intro .project-intro-content h1 {
 font-size: var(--display-size);
 line-height: 1.1;
}

/* Project heroes begin at the top behind the fixed navigation. */
.route-shell:has(> .project-page) { padding-top: 0; }

/* Keep the header bottom inset consistent with its top spacing. */
.site-header { padding-bottom: 2rem; }

/* Hero artwork fills the canvas; its natural ratio sets height until the viewport cap. */
.project-page .project-intro-visual img {
 width: 100%;
 height: auto;
 max-height: 90vh;
 object-fit: cover;
 object-position: center;
}

/* Taller, consistent project hero crops on phones. */
@media (max-width: 48rem) {
 .project-page .project-intro-visual img {
  height: min(110vw, 70svh);
  max-height: 70svh;
  object-fit: cover;
  object-position: 50% 50%;
 }
}

/* Square edges across every project image and media frame. */
.project-page { --gallery-radius: 0px; }
.project-page .project-intro-visual,
.project-page .project-intro-visual img,
.project-page .project-hero-image,
.project-page .project-hero-image img,
.project-page .project-media,
.project-page .project-media img,
.project-page .project-media video,
.project-page .project-website-screen,
.project-page .project-website-screen img,
.project-page .project-website-video,
.project-page .motion-plyr,
.project-page .motion-plyr .plyr { border-radius: 0; }

/* Motion: contain the animated cover within a black, full-width stage. */
.project-page .project-intro-visual:has(img[src="/assets/projects/motion/cover.gif"]) {
 height: 90svh;
 background: #020306;
 display: grid;
 place-items: center;
}
.project-page .project-intro-visual img[src="/assets/projects/motion/cover.gif"] {
 width: min(58%, 540px);
 height: 80%;
 max-height: none;
 object-fit: contain;
}
@media (max-width: 48rem) {
 .project-page .project-intro-visual:has(img[src="/assets/projects/motion/cover.gif"]) { height: min(110vw, 70svh); }
}


/* Give introductions without an opening image room below the fixed navigation. */
.project-page .project-intro:not(:has(.project-intro-visual)) .project-intro-content {
  padding-top: 7rem;
}

/* Keep the Small Projects poster and film aligned in two equal columns. */
.project-page .project-media-pair:has(img[src="/assets/projects/small-projects/08-row2.webp"]) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.project-page .project-media-pair:has(img[src="/assets/projects/small-projects/08-row2.webp"]) img,
.project-page .project-media-pair:has(img[src="/assets/projects/small-projects/08-row2.webp"]) video {
  width: 100%;
  height: auto;
  max-height: none;
}
