/* Homepage hero motion. Artwork sits beside (desktop) or above (mobile) the
   hero copy. This file also reserves the layout so first paint has no new CLS.
   The first-visit overlay styles in motion-intro.css are not loaded. */

.hero.has-hero-motion {
  --hero-motion-h: min(42vh, 380px);
}

#hero-motion {
  --fabric: #CFC4B0;
  --fabric-line: #BCAF98;
  --on-fabric: #4A4438;
  --hm-muted: #8C8A82;
  position: absolute;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

[data-theme="light"] #hero-motion {
  --fabric: #2E2C27;
  --fabric-line: #3B3933;
  --on-fabric: #B9B2A3;
  --hm-muted: #5E5D57;
}

#hero-motion .hero-motion-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

#hero-motion .hero-motion-poster,
#hero-motion .hero-motion-live-wrap {
  position: absolute;
  inset: 0;
}

#hero-motion .hero-motion-poster svg,
#hero-motion .hero-motion-live,
#hero-motion .hero-motion-live-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

#hero-motion.is-ready .hero-motion-poster {
  display: none;
}

#hero-motion .hero-motion-chapters {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 8px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

#hero-motion .hero-motion-chapters li {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--slate);
}

#hero-motion .hero-motion-chapters li .bar {
  display: block;
  height: 1px;
  background: var(--warm-rule);
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

#hero-motion .hero-motion-chapters li .bar i {
  position: absolute;
  inset: 0;
  background: var(--terminal);
  transform-origin: left;
  transform: scaleX(var(--p, 0));
}

#hero-motion .hero-motion-chapters li.on {
  color: var(--parchment);
}

#hero-motion .hero-motion-chapters li b {
  font-weight: 400;
  color: var(--terminal);
  margin-right: 6px;
}

/* Desktop: copy on the left, artwork in the right half. Space is reserved
   from first paint so the later JS layer does not shift the headline. */
@media (min-width: 901px) {
  .hero.has-hero-motion > .container.hero-inner {
    margin-left: max(48px, calc((100% - 1100px) / 2));
    margin-right: auto;
    width: min(540px, 46%);
    max-width: 540px;
    padding-right: 16px;
  }
  .hero.has-hero-motion .hero-headline {
    max-width: 520px;
  }
  #hero-motion {
    top: 80px;
    bottom: 32px;
    left: 50%;
    right: 12px;
  }
}

/* Mobile and tablet: reserved art band above the typography. */
@media (max-width: 900px) {
  .hero.has-hero-motion {
    justify-content: flex-start;
    padding-top: calc(72px + var(--hero-motion-h));
    --hero-motion-h: min(32vh, 260px);
  }
  .hero.has-hero-motion .hero-headline { margin-bottom: 18px; }
  .hero.has-hero-motion .hero-sub { margin-bottom: 16px; line-height: 1.7; }
  #hero-motion {
    top: 72px;
    left: 0;
    right: 0;
    height: var(--hero-motion-h);
    bottom: auto;
  }
  #hero-motion .hero-motion-chapters {
    left: 16px;
    right: 16px;
    bottom: 4px;
    gap: 10px;
  }
  #hero-motion .hero-motion-chapters li {
    font-size: 8px;
    letter-spacing: 0.12em;
  }
}

@media (max-width: 600px) {
  .hero.has-hero-motion {
    --hero-motion-h: min(28vh, 210px);
  }
}

@media (max-width: 900px) and (max-height: 700px) {
  .hero.has-hero-motion {
    --hero-motion-h: min(26vh, 200px);
  }
}

/* SVG artwork (same marks as the overlay, scoped to the hero stage). */
#hero-motion .ln { fill: none; stroke: var(--parchment); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
#hero-motion .ln.pencil { stroke-width: 0.8; opacity: 0.38; }
#hero-motion .ln.thin { stroke-width: 1; }
#hero-motion .dash { stroke-dasharray: 1 1; }
#hero-motion .guide { stroke: var(--slate); stroke-width: 0.8; stroke-dasharray: 3 5; fill: none; }
#hero-motion .guide-t,
#hero-motion .note-t,
#hero-motion .lab-t,
#hero-motion .tile-t,
#hero-motion .tag-t,
#hero-motion .ruler-t {
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
#hero-motion .guide-t { font-size: 8px; fill: var(--slate); }
#hero-motion .note-t { font-size: 9px; fill: var(--soft); text-transform: none; letter-spacing: 0.06em; font-style: italic; }
#hero-motion .note-l { stroke: var(--slate); stroke-width: 0.8; fill: none; }
#hero-motion .lab-t { font-size: 8.5px; fill: var(--terminal); }
#hero-motion .paper { fill: var(--parchment); }
#hero-motion .fabric { fill: url(#hm-twill); }
#hero-motion .hero-motion-poster .fabric { fill: url(#hmp-twill); }
#hero-motion .hero-motion-poster .grain { marker-start: url(#hmp-arrow); marker-end: url(#hmp-arrow); }
#hero-motion .sa { fill: none; stroke: var(--terminal); stroke-width: 0.8; stroke-dasharray: 2 3; }
#hero-motion .grain { stroke: var(--terminal); stroke-width: 1; marker-start: url(#hm-arrow); marker-end: url(#hm-arrow); }
#hero-motion .arrow-head { fill: var(--terminal); }
#hero-motion .notch { stroke: var(--terminal); stroke-width: 1.3; fill: none; stroke-linecap: square; }
#hero-motion .stitch { fill: none; stroke: var(--signal); stroke-width: 1.3; stroke-linecap: round; }
#hero-motion .btn-dot { fill: var(--void); stroke: var(--parchment); stroke-width: 1; }
#hero-motion .mat-grid-minor { stroke: var(--terminal); stroke-width: 0.5; opacity: 0.14; }
#hero-motion .mat-grid-major { stroke: var(--terminal); stroke-width: 0.8; opacity: 0.24; }
#hero-motion .mat-edge { fill: none; stroke: var(--terminal); stroke-width: 1; opacity: 0.5; }
#hero-motion .ruler-t { font-size: 7px; fill: var(--terminal); letter-spacing: 0.05em; }
#hero-motion .rail { stroke: var(--parchment); stroke-width: 2.2; stroke-linecap: round; fill: none; }
#hero-motion .bracket { stroke: var(--slate); stroke-width: 1.2; fill: none; }
#hero-motion .hanger { fill: none; stroke: var(--parchment); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
#hero-motion .ghost .ln,
#hero-motion .ghost .hanger { stroke: var(--slate); }
#hero-motion .ghost .gfill { fill: var(--carbon); }
#hero-motion .tile-frame { fill: var(--carbon); stroke: var(--warm-rule); stroke-width: 1; }
#hero-motion .tile-img { fill: var(--void); stroke: var(--warm-rule); stroke-width: 1; }
#hero-motion .tile-t { font-size: 8px; fill: var(--hm-muted); }
#hero-motion .tile-t.name { font-size: 10px; fill: var(--parchment); letter-spacing: 0.12em; }
#hero-motion .tile-t.ok { fill: var(--terminal); }
#hero-motion .chip { fill: none; stroke: var(--warm-rule); }
#hero-motion .chip.on { stroke: var(--signal); }
#hero-motion .tag-card { fill: var(--parchment); }
#hero-motion .tag-t { font-size: 6.5px; fill: var(--void); letter-spacing: 0.08em; }
#hero-motion .tag-string { stroke: var(--slate); stroke-width: 0.8; fill: none; }
#hero-motion .fab-base { fill: var(--fabric); }
#hero-motion .fab-line { stroke: var(--fabric-line); stroke-width: 1.6; }
#hero-motion .on-fabric { stroke: var(--on-fabric); }

@media (prefers-reduced-motion: reduce) {
  /* Layout and the final-frame poster stay visible. JS leaves the live layer
     on the last frame when it is allowed to run. */
}
