/* ==========================================================================
   Hero wrap — dark stage that bleeds into the top half of the project row
   ========================================================================== */
.hero-wrap {
  --card-w: clamp(16.5rem, 29vw, 36rem);
  --band: calc(var(--card-w) * 0.325 + clamp(3.5rem, 6vw, 6rem));
  --container-left: max(var(--gutter), (100% - var(--container)) / 2);
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  background: linear-gradient(var(--black) calc(100% - var(--band)), var(--off-white) 0);
}
.hero-wrap__bg {
  position: absolute; inset: 0 0 var(--band); z-index: -1;
  overflow: clip;
}
.hero-wrap__bg img { width: 100%; height: 100%; object-fit: cover; object-position: 30% 50%; }
.hero-wrap__bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgb(0 0 0 / 0.82) 0%, rgb(0 0 0 / 0.45) 55%, rgb(0 0 0 / 0.7) 100%),
    linear-gradient(180deg, rgb(0 0 0 / 0.5) 0%, transparent 30%, rgb(0 0 0 / 0.9) 100%);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { position: relative; }
.hero__inner {
  position: relative;
  min-height: min(90svh, 62rem);
  display: flex; align-items: center;
  padding-block: calc(var(--header-h) + 2rem) clamp(3rem, 7vh, 5.5rem);
}
.hero__copy { position: relative; z-index: 1; max-width: 100%; }
.hero__kicker {
  font-size: clamp(1.1rem, 0.55rem + 1.3vw, 2.5rem);
  font-weight: 500; letter-spacing: -0.03em;
}
.hero__title {
  margin-top: clamp(0.25rem, 0.8vw, 1rem);
  font-size: var(--fs-mega);
  font-weight: 700;
  line-height: 1;
  letter-spacing: var(--tracking-display);
  color: var(--blue);
  white-space: nowrap;
}
.hero__title-visual { display: block; }
.hero__sep { padding-inline: 0.12em; color: var(--white); }
.hero__lead {
  max-width: 31em;
  margin-top: clamp(1rem, 2.2vw, 2.5rem);
  font-size: clamp(1.02rem, 0.55rem + 1.1vw, 2.1rem);
  font-weight: 400; line-height: 1.35; letter-spacing: -0.03em;
  color: rgb(255 255 255 / 0.92);
}
.hero__copy .btn { margin-top: clamp(1.75rem, 3.6vw, 4.25rem); }

/* --- artwork ------------------------------------------------------------- */
.hero__visual {
  --px: 0; --py: 0;
  position: absolute; z-index: 2;
  right: 4%; top: 50%;
  width: clamp(20rem, 39vw, 48rem);
  aspect-ratio: 1;
  translate: 0 -54%;
  pointer-events: none;
}
.orb { width: 100%; height: 100%; overflow: visible; }
/* only the animated groups — transform-origin would also skew the inner rotate() attributes */
.orb :is(.orb__ring, .orb__tilt, .orb__body, .orb__device, .orb__chip) { transform-box: view-box; transform-origin: 320px 320px; }
.orb__ring   { --depth: -0.5; }
.orb__body   { --depth: 0.35; }
.orb__device { --depth: 0.8; }
.orb__chip   { --depth: 1.25; }
.orb :is(.orb__ring, .orb__body, .orb__device, .orb__chip) {
  translate: calc(var(--px) * var(--depth) * 22px) calc(var(--py) * var(--depth) * 22px);
}

/* ==========================================================================
   Featured projects
   ========================================================================== */
.projects { position: relative; padding-bottom: clamp(3rem, 5vw, 5rem); }
.projects__inner {
  display: grid;
  grid-template-columns: clamp(9.5rem, 15.5vw, 19rem) minmax(0, 1fr);
  padding-left: var(--container-left);
}
.projects__head { display: grid; align-content: start; justify-items: start; gap: clamp(1.25rem, 2.2vw, 2.25rem); padding-right: 1.5rem; }
.projects__title {
  font-size: clamp(1.25rem, 0.75rem + 1.05vw, 2.15rem);
  font-weight: 500; letter-spacing: -0.04em; line-height: 1.1;
}
.projects__viewport { min-width: 0; }
.projects__track {
  display: flex;
  gap: clamp(1rem, 2.6vw, 3.1rem);
  padding-right: var(--gutter);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.projects__track::-webkit-scrollbar { display: none; }
.projects__track.is-dragging { scroll-snap-type: none; cursor: grabbing; }
.projects__track.is-dragging .project__link { pointer-events: none; }

.project { flex: 0 0 var(--card-w); scroll-snap-align: start; }
.project__link {
  --px: 0; --py: 0; --s: 1;
  position: relative; display: block;
  aspect-ratio: 800 / 520;
  overflow: hidden;
  background: #151515;
  user-select: none; -webkit-user-select: none;
}
.project__media { position: absolute; inset: 0; overflow: hidden; }
.project__media img {
  width: 100%; height: 100%; object-fit: cover;
  transform: translate3d(calc(var(--px) * -14px), calc(var(--py) * -10px), 0) scale(var(--s));
  transition: transform 1s var(--ease-out);
  -webkit-user-drag: none;
}
.project__info {
  position: absolute; inset: auto 0 0;
  display: grid; grid-template-columns: 1fr auto; align-items: end;
  column-gap: 1rem;
  padding: 3.5rem clamp(1rem, 1.6vw, 1.6rem) clamp(0.9rem, 1.4vw, 1.4rem);
  background: linear-gradient(transparent, rgb(0 0 0 / 0.78));
  transform: translate3d(0, 101%, 0);
  transition: transform 0.7s var(--ease-out);
}
.project__cat {
  grid-column: 1;
  font-size: var(--fs-micro); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgb(255 255 255 / 0.7);
}
.project__name { grid-column: 1; font-size: clamp(1.15rem, 0.8rem + 0.8vw, 1.85rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.project__go {
  grid-column: 2; grid-row: 1 / span 2;
  display: grid; place-items: center;
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  background: var(--white); color: var(--black);
  transform: rotate(-45deg) scale(0.6);
  transition: transform 0.7s var(--ease-out);
}
.project__go svg { width: 1.1rem; height: 0.55rem; }
.project__link:is(:hover, :focus-visible) { --s: 1.07; }
.project__link:is(:hover, :focus-visible) .project__info { transform: none; }
.project__link:is(:hover, :focus-visible) .project__go { transform: none; transition-delay: 0.1s; }
.project__link:focus-visible { outline-offset: -3px; }
@media (hover: none) {
  .project__info { transform: none; }
  .project__go { transform: rotate(-45deg) scale(0.85); }
}

.projects__progress {
  height: 1px; margin: clamp(1.5rem, 2.4vw, 2.5rem) var(--gutter) 0 0;
  background: rgb(0 0 0 / 0.12);
  overflow: hidden;
}
.projects__progress span {
  display: block; height: 100%;
  background: var(--black);
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0.25));
}
@supports (animation-timeline: scroll()) and (animation-range: entry) {
  .projects__viewport { timeline-scope: --track; }
  .projects__track { scroll-timeline: --track inline; }
  .projects__progress span { animation: track-progress linear both; animation-timeline: --track; }
  @keyframes track-progress { from { transform: scaleX(0.25); } to { transform: scaleX(1); } }
}

/* ==========================================================================
   Motion
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  /* intro on load */
  .js .hero-wrap__bg img { opacity: 0; transform: scale(1.12); }
  .js .hero__title .mask > span { transform: translate3d(0, 112%, 0); }
  .js .hero__visual .orb { opacity: 0; transform: scale(0.88) rotate(-6deg); }
  .js .project { opacity: 0; transform: translate3d(6rem, 0, 0); }

  .is-loaded .hero-wrap__bg img { opacity: 1; transform: none; transition: opacity 1.6s var(--ease-soft), transform 2.6s var(--ease-out); }
  .is-loaded .hero__title .mask > span { transform: none; transition: transform 1.3s var(--ease-out) calc(var(--d) * 110ms + 250ms); }
  .is-loaded .hero__visual .orb { opacity: 1; transform: none; transition: opacity 1.2s var(--ease-soft) 0.5s, transform 2s var(--ease-out) 0.45s; }
  .is-loaded .project { opacity: 1; transform: none; transition: opacity 1s var(--ease-soft), transform 1.4s var(--ease-out); transition-delay: calc(var(--i) * 110ms + 900ms); }

  /* ambient orb motion — paused by JS while the hero is off-screen */
  .orb__ring { animation: orb-spin 70s linear infinite; }
  .orb__tilt { animation: orb-tilt 14s var(--ease-in-out) infinite alternate; }
  .orb__body { animation: orb-float 8s ease-in-out infinite alternate; }
  .orb__device { animation: orb-float 6s ease-in-out -3s infinite alternate; }
  .orb__chip { animation: orb-float 7s ease-in-out -1.5s infinite alternate; }
  .orb__sat { transform-box: fill-box; transform-origin: center; animation: orb-pulse 4s ease-in-out infinite; }
  .hero.is-paused .orb * { animation-play-state: paused; }

  @keyframes orb-spin { to { transform: rotate(360deg); } }
  @keyframes orb-tilt { from { transform: rotate(-5deg); } to { transform: rotate(4deg); } }
  @keyframes orb-float { from { transform: translate3d(0, -9px, 0); } to { transform: translate3d(0, 9px, 0); } }
  @keyframes orb-pulse { 50% { transform: scale(0.8); } }

  /* scroll: background sinks, copy lifts away */
  @supports (animation-timeline: scroll()) and (animation-range: entry) {
    .hero-wrap__bg img { animation: hero-bg linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
    @media (min-width: 48.01em) {
      .hero__copy { animation: hero-copy linear both; animation-timeline: scroll(root); animation-range: 10vh 85vh; }
    }
    @keyframes hero-bg { to { translate: 0 18vh; } }
    @keyframes hero-copy { to { opacity: 0.15; transform: translate3d(0, -8vh, 0); } }
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 75em) { /* 1200 */
  .hero__visual { right: -9%; width: clamp(20rem, 42vw, 34rem); }
}

@media (max-width: 64em) { /* 1024 */
  .hero__title { white-space: normal; }
  .hero__visual { top: calc(var(--header-h) * 0.4); translate: 0 0; right: -10%; width: 50vw; z-index: 0; opacity: 0.95; }
  .hero__lead { max-width: 26em; }
}

@media (max-width: 48em) { /* 768 */
  .hero-wrap { --card-w: min(80vw, 24rem); }
  .hero__inner { flex-direction: column; align-items: stretch; justify-content: flex-end; min-height: 100svh; padding-top: var(--header-h); }
  .hero__visual {
    position: relative; order: -1; top: auto; right: auto;
    width: min(94vw, 30rem);
    margin: 0 calc(var(--gutter) * -1.5) calc(min(94vw, 30rem) * -0.22) auto;
  }
  .hero__title { font-size: clamp(3.4rem, 17vw, 5.5rem); line-height: 0.94; }
  .hero__title-visual { display: grid; justify-items: start; }
  .hero__sep { display: none; }
  .mask:not(.hero__sep):not(:last-child) > span::after { content: "."; color: var(--white); }
  .hero__lead { font-size: 1.05rem; }

  .projects__inner { grid-template-columns: 1fr; row-gap: 1.5rem; padding-left: 0; }
  .projects__head { grid-auto-flow: column; justify-content: space-between; align-items: center; padding-inline: var(--gutter); }
  .projects__track { padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
  .projects__progress { margin-inline: var(--gutter); }
}

@media (max-width: 30em) { /* 480 */
  .hero__kicker { font-size: 1rem; }
  .hero__copy .btn { width: 100%; justify-content: space-between; }
}
