/* Hero: the browser-window-inspired frame, glow, noise, headline and scroll cue.
   The frame is a pure design element built from divs — not a screenshot, not an embedded browser. */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - 2 * var(--outer-pad));
  padding: calc(var(--nav-h) + 2 * var(--nav-offset) + 8px) var(--gutter) 0;
  overflow: clip;
}
.hero__stage {
  position: relative;
  flex: 1;
  display: flex;
  width: 100%;
  max-width: 1320px;
  margin-inline: auto;
}

/* ---- the frame ---- */
.frame {
  --frame-bar: 44px;
  container-type: inline-size;
  container-name: frame;
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-frame) var(--radius-frame) 0 0;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.035), 0 -1px 0 rgba(255, 255, 255, 0.2), 0 50px 120px -30px rgba(0, 0, 0, 0.9), 0 18px 50px -10px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translate3d(0, calc(var(--hero-p, 0) * -34px), 0) scale(calc(1 - var(--hero-p, 0) * 0.025));
  transform-origin: 50% 0;
  will-change: transform;
}
.frame::before {
  /* delicate metallic border: bright at the top edge, fading downward */
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.1) 30%, rgba(255, 255, 255, 0.04) 70%, rgba(255, 255, 255, 0));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* ---- slim browser chrome ---- */
.frame__bar {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: var(--frame-bar);
  padding: 0 16px;
  border-radius: var(--radius-frame) var(--radius-frame) 0 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.frame__bar::after {
  /* diagonal reflection sweeping across the glass */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 18%, rgba(255, 255, 255, 0.07) 34%, transparent 48%);
  pointer-events: none;
}
.frame__dots {
  display: flex;
  gap: 8px;
}
.frame__dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.04);
}
.frame__dots i:first-child {
  background: rgba(255, 255, 255, 0.22);
}
.frame__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  min-width: min(300px, 46cqi);
  justify-content: center;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-2);
  white-space: nowrap;
}
.frame__label svg {
  width: 11px;
  height: 11px;
  color: var(--text-3);
}
.frame__tools {
  justify-self: end;
  display: flex;
  gap: 6px;
  color: var(--text-3);
}
.frame__tools svg {
  width: 14px;
  height: 14px;
}

/* ---- interior ---- */
.frame__body {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
  isolation: isolate;
}
.frame__glow {
  position: absolute;
  inset: -10% -10% auto -10%;
  height: 120%;
  z-index: -3;
  background: radial-gradient(60% 52% at 38% 34%, rgba(255, 255, 255, 0.115), rgba(255, 255, 255, 0.035) 45%, transparent 72%),
    radial-gradient(40% 40% at 90% 90%, rgba(255, 255, 255, 0.04), transparent 70%);
  pointer-events: none;
}
.frame__noise {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url('../img/noise.png') 0 0 / 128px 128px;
  opacity: 0.09;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.frame__object {
  /* The sculpture lives in the free zone to the right of the headline. Only the middle ~76% x 50%
     of this square is visible geometry, so the box can be larger than what the eye sees. */
  position: absolute;
  z-index: -2;
  right: 0;
  top: 27%;
  width: min(36cqi, 560px);
  aspect-ratio: 1;
  transform: translateY(-50%);
  pointer-events: none;
}
.frame__scrim {
  /* keeps the headline and intro crisp if the sculpture ever drifts toward them */
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(16, 16, 16, 0.5) 0%, rgba(16, 16, 16, 0.2) 50%, transparent 70%);
  pointer-events: none;
}

.frame__content {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 5.4cqi, 72px);
  padding: clamp(20px, 3.6cqi, 48px) clamp(20px, 4.2cqi, 56px) clamp(150px, 15cqi, 200px);
}

.hero__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
}
.hero__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.hero__label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-2);
}
.hero__label::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--text-3);
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, 12.5vw, 5.5rem);
  font-size: clamp(2.5rem, 8cqi, 8.6rem);
  line-height: 0.96;
  letter-spacing: var(--track-display);
  color: #fff;
  text-wrap: balance;
  margin-top: auto;
}
.hero__title .line {
  display: block;
  overflow: hidden;
  padding-block: 0.08em 0.16em;
  margin-block: -0.08em -0.16em;
}
.hero__title .line__in {
  display: block;
}
.hero__title .accent {
  font-size: 1.07em;
  line-height: 0.9;
}

.hero__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 28px 40px;
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.hero__intro {
  display: grid;
  gap: 14px;
  max-width: 24rem;
  margin-left: auto;
}
.hero__intro p:first-child {
  font-size: var(--fs-lead);
  line-height: 1.32;
  letter-spacing: -0.015em;
  color: #e6e6e6;
  text-wrap: pretty;
}
.hero__intro .eyebrow {
  /* the hero's secondary line is real copy, not metadata: use the palette's secondary text colour */
  color: var(--text-2);
}

/* bare mode: browser frame switched off in the config */
.frame--bare {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
.frame--bare::before,
.frame--bare .frame__bar {
  display: none;
}
/* Without the frame there is no box to clip against: let the glow bleed out and fade naturally
   (the hero section itself still clips it at the canvas edge), so no rectangular edge shows. */
.frame--bare .frame__body {
  overflow: visible;
}

/* ---- soft fade into the next section, and the scroll cue ---- */
.hero__fade {
  position: absolute;
  z-index: 6;
  inset: auto 0 0 0;
  height: clamp(170px, 24svh, 280px);
  background: linear-gradient(180deg, rgba(8, 8, 8, 0) 0%, rgba(8, 8, 8, 0.72) 55%, var(--bg) 100%);
  pointer-events: none;
}
.scroll-cue {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: clamp(20px, 4svh, 40px);
  translate: -50% 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  color: var(--text);
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.scroll-cue .icon {
  width: 16px;
  height: 16px;
  animation: cue 2.4s var(--ease-in-out) infinite;
}
.scroll-cue:hover,
.scroll-cue:focus-visible {
  background: #f5f5f5;
  color: #080808;
  border-color: #f5f5f5;
}
@keyframes cue {
  0%,
  100% {
    transform: translateY(-2px);
  }
  50% {
    transform: translateY(3px);
  }
}
html:not(.anim) .scroll-cue .icon {
  animation: none;
}

/* ---- load sequence (only when animations are enabled) ---- */
html.anim .frame {
  opacity: 0;
  translate: 0 36px;
  transition: opacity 1.1s var(--ease), translate 1.3s var(--ease);
}
html.anim.ready .frame {
  opacity: 1;
  translate: 0 0;
}
html.anim .hero__title .line__in {
  transform: translateY(105%);
  transition: transform 1.15s var(--ease);
  transition-delay: calc(0.32s + var(--i, 0) * 0.11s);
}
html.anim.ready .hero__title .line__in {
  transform: none;
}
html.anim .hero__top,
html.anim .hero__bottom > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: 0.7s;
}
html.anim .hero__bottom > *:nth-child(2) {
  transition-delay: 0.85s;
}
html.anim.ready .hero__top,
html.anim.ready .hero__bottom > * {
  opacity: 1;
  transform: none;
}
html.anim .frame__object {
  opacity: 0;
  transition: opacity 1.6s var(--ease) 0.5s;
}
html.anim.ready .frame__object {
  opacity: 1;
}

/* ---- object canvas + poster fallback ---- */
.object3d {
  position: relative;
  width: 100%;
  height: 100%;
}
.object3d__poster,
.object3d canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.object3d canvas {
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.object3d.is-live canvas {
  opacity: 1;
}
.object3d.is-live .object3d__poster {
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

/* ---- responsive ---- */
@container frame (max-width: 760px) {
  .hero__title {
    font-size: clamp(2.45rem, 12.4cqi, 5rem);
    line-height: 0.98;
  }
  .frame__object {
    /* narrow frames: the sculpture bleeds off the top-right corner, behind the first headline line */
    right: -16cqi;
    top: 14%;
    width: 84cqi;
    transform: translateY(-34%);
    opacity: 0.72;
  }
  html.anim.ready .frame__object {
    opacity: 0.72;
  }
  .frame__scrim {
    background: linear-gradient(180deg, rgba(16, 16, 16, 0) 0%, rgba(16, 16, 16, 0.55) 55%, rgba(16, 16, 16, 0.7) 100%);
  }
  .frame__label {
    min-width: 0;
  }
  .frame__tools {
    display: none;
  }
  .hero__intro {
    margin-left: 0;
  }
  .frame__content {
    padding-bottom: 140px;
  }
}
/* Portrait tablets and tall narrow windows. The frame is taller than it is wide, so the small desktop
   sculpture would float in empty space above the headline. Reuse the narrow-frame composition: a large
   sculpture bleeding off the top-right corner, with the scrim keeping the type crisp. A container query
   cannot see height, hence the media query. Frames up to 760px already get this from the rule above. */
@media (max-aspect-ratio: 1/1) and (min-width: 761px) and (max-width: 1300px) {
  .hero__title {
    /* continuous with the narrow-frame size (80px at a 760px frame): 4.354cqi + 46.9px.
       Without this the headline would shrink from 80px to ~63px as a tablet gets wider. */
    font-size: clamp(2.5rem, calc(4.354cqi + 2.93rem), 8.6rem);
  }
  .frame__object {
    right: -12cqi;
    top: 15%;
    width: min(78cqi, 760px);
    transform: translateY(-30%);
    opacity: 0.92;
  }
  html.anim.ready .frame__object {
    opacity: 0.92;
  }
  .frame__scrim {
    /* clear over the sculpture, darkening only toward the headline and intro */
    background: linear-gradient(180deg, rgba(16, 16, 16, 0) 0%, rgba(16, 16, 16, 0) 42%, rgba(16, 16, 16, 0.5) 72%, rgba(16, 16, 16, 0.66) 100%);
  }
}
@media (max-width: 900px) {
  .hero {
    padding-inline: var(--outer-pad);
    padding-top: calc(var(--nav-h) + 2 * var(--nav-offset) + 2px);
  }
  /* the glass capsule lives at the bottom edge on small screens: lift the scroll cue above it */
  .scroll-cue {
    bottom: calc(max(env(safe-area-inset-bottom), 0px) + var(--nav-offset) + var(--nav-h) + 18px);
  }
  .frame {
    border-radius: 18px 18px 0 0;
  }
  .frame__bar {
    border-radius: 18px 18px 0 0;
    padding: 0 12px;
  }
}
@media (max-width: 520px) {
  .hero__cta .btn {
    flex: 1 1 auto;
  }
  .status {
    font-size: 10px;
  }
}
@media (min-width: 2000px) {
  .hero__stage {
    max-width: 1500px;
  }
}
@media (max-height: 560px) and (min-width: 901px) {
  .hero {
    min-height: 640px;
  }
}
