html[data-about-arriving] .home-scroll { visibility: hidden; }
html[data-about-direct] { scroll-behavior: auto; }
html[data-about-direct] #about { min-height: 100vh; min-height: 100dvh; }

@media (prefers-reduced-motion: no-preference) {
  html[data-home-scroll]:not([data-about-direct]) .home-scroll {
    height: calc(var(--hero-height) + var(--hero-travel));
  }

  html[data-home-scroll]:not([data-about-direct]) .home-scroll > .hero {
    position: sticky;
    top: 0;
  }

  html[data-home-scroll]:not([data-about-direct]) [data-home-below-scene] {
    top: var(--hero-travel) !important;
  }
}

.home-scrubbing .gallery-wrap { z-index: 20; }
.home-scrubbing .hero-footer { pointer-events: none; }
.scroll-disciplines {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
.scroll-disciplines span {
  position: absolute;
  display: block;
  inset: 0 auto auto 0;
  hyphens: auto;
  overflow-wrap: anywhere;
}
.home-scrubbing .gallery-header > :last-child { position: relative; z-index: 1; pointer-events: none; }
/* Inside the authenticated editor, the preview text must receive touch
   and pointer events instead of passing them through to the moving cards. */
html[data-portfolio-editor-preview] .home-scrubbing .gallery-header {
  position: relative;
  z-index: 40;
  pointer-events: auto;
}
html[data-portfolio-editor-preview] .home-scrubbing .gallery-header > span {
  position: relative;
  z-index: 41;
  pointer-events: auto !important;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
html[data-portfolio-editor-preview] .home-scrubbing .gallery-header > span:active {
  cursor: grabbing;
}
.scroll-disciplines-source { opacity: 0; }
.home-scrubbing .track { animation-play-state: paused !important; }
.home-scrubbing .marquee { overflow: visible; cursor: auto; }
.home-scrubbing .project { transform: translate3d(var(--project-x, 0px), var(--project-y, 0px), 0); transition: none; }
.home-scrubbing .project img { transform: none; transition: none; }
.home-photo-panning .hero-bg,
.home-photo-panning .hero-person-depth { background-position: var(--photo-x) var(--photo-y); }

/* On phones, keep the hero pinned to the actual small viewport and place both
   labels together above the carousel. Old mobile editor coordinates displaced
   the instruction by 281px; never apply that offset to the public mobile UI. */
@media (max-width: 700px) {
  html[data-home-scroll] .home-scroll > .hero {
    min-height: 0;
  }

  html[data-home-scroll] .gallery-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 0 5vw 12px;
    font-size: 10px;
    line-height: 1.35;
    letter-spacing: .08em;
  }

  html[data-home-scroll] .gallery-header > span {
    translate: 0 0 !important;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0;
    white-space: normal !important;
    overflow-wrap: normal;
  }

  html[data-home-scroll] .gallery-header > :first-child {
    text-align: left !important;
  }

  html[data-home-scroll] .gallery-header > :last-child {
    text-align: right !important;
  }
}

/* Dedicated mobile scroll-scene positions. The original cover labels keep
   their existing alignment until the scroll animation actually starts. */
@media (max-width: 700px) {
  .hero.home-scrubbing .gallery-header > :first-child {
    transform: translate3d(var(--mobile-scroll-title-x, 0px), var(--mobile-scroll-title-y, 0px), 0);
  }
  .hero.home-scrubbing .gallery-header > :last-child {
    transform: translate3d(var(--mobile-scroll-instructions-x, 0px), var(--mobile-scroll-instructions-y, 0px), 0);
  }
}

/* The editor preview intentionally does not set data-home-scroll. Mirror
   mobile gallery heading geometry there so the edit matches the live site. */
@media (max-width: 700px) {
  html[data-portfolio-editor-preview] .gallery-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 0 5vw 12px;
    font-size: 10px;
    line-height: 1.35;
    letter-spacing: .08em;
  }
  html[data-portfolio-editor-preview] .gallery-header > span {
    translate: 0 0 !important;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0;
    white-space: normal !important;
  }
  html[data-portfolio-editor-preview] .gallery-header > :first-child { text-align: left !important; }
  html[data-portfolio-editor-preview] .gallery-header > :last-child { text-align: right !important; }
}

/* Keep the mobile vertical gallery visually clean. Do not hide these texts
   at the beginning of the cover or on the desktop experience. */
@media (max-width: 700px) {
  .hero.home-mobile-vertical .gallery-header > :last-child,
  .hero.home-mobile-vertical .hero-footer,
  .hero.home-mobile-vertical .hero-subtitle,
  .hero.home-mobile-vertical .scroll-disciplines {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}
