/* The opening ident sits beside the headline without taking over the primary action. */
.site-home .hero:has(.hero-motion) {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr);
  grid-template-areas: 'title ident' 'actions ident';
  padding-block: clamp(30px, 4.8vw, 72px) clamp(30px, 4.4vw, 68px);
  gap: clamp(16px, 1.9vw, 28px) clamp(24px, 4.5vw, 68px);
  align-items: start;
}
.hero:has(.hero-motion) .hero-top { grid-area: title; min-width: 0; }
.site-home .hero:has(.hero-motion) .hero-bottom { grid-area: actions; gap: 16px; margin-top: 0; }
.hero:has(.hero-motion) h1 { font-size: clamp(46px, 5vw, 80px); margin-top: 24px; }
.hero-motion {
  grid-area: ident;
  align-self: center;
  min-width: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}
.hero-motion-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 6px 10px 6px 18px;
  border-bottom: 1px solid var(--line);
}
.hero-motion-caption {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}
.hero-motion-caption i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--focus); }
.hero-motion-pause {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--raised);
  color: var(--ink);
}
.hero-motion-pause[hidden] { display: none; }
.hero-motion-pause:hover { border-color: var(--focus); }
.hero-motion-pause:focus-visible { outline-offset: 2px; }
.hero-motion-pause[aria-pressed="false"] .hero-motion-icon-play,
.hero-motion-pause[aria-pressed="true"] .hero-motion-icon-pause { display: none; }
.hero-motion-visual {
  display: grid;
  place-items: center;
  aspect-ratio: 8 / 5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: center;
}
.hero-motion-art { display: block; width: 100%; height: 100%; }
.hero-motion-guides { stroke: var(--muted); stroke-dasharray: 3 7; opacity: .58; }
.hero-motion-ghost { stroke: var(--muted); opacity: .52; }
.hero-motion-plate { fill: var(--raised); stroke: var(--muted); }
.hero-motion-crosshairs, .hero-motion-ticks { stroke: var(--focus); stroke-width: 1.4; stroke-linecap: round; }
.hero-motion-piece { fill: var(--lime); transform-box: fill-box; transform-origin: center; }
.hero-motion-outline { stroke: var(--action-ink); stroke-width: 1.3; }
.hero-motion-point { fill: var(--lime); }
.hero-motion-point { stroke: var(--action-ink); }
.hero-motion-wordmark, .hero-motion-editor { opacity: 0; }
.hero-motion-wordmark { fill: var(--ink); }
.hero-motion-sign { transform-box: view-box; transform-origin: 156px 93px; }
.hero-motion-playhead { stroke: #d0ee53; stroke-width: 1.5; fill: #d0ee53; }
.hero-cut { fill: #8ba18b; }
.clip-city { fill: #aebea6; }
.clip-trail { fill: #d0ee53; }
.hero-scene-sun, .hero-cut { transform-box: fill-box; transform-origin: center; }
.hero-cut { transform-origin: left center; }

.piece-left { --piece-x: -65px; --piece-y: 0px; --piece-tilt: 0deg; --piece-delay: 0ms; }
.piece-centre { --piece-x: 0px; --piece-y: -57px; --piece-tilt: -19deg; --piece-delay: 90ms; }
.piece-right { --piece-x: 65px; --piece-y: 0px; --piece-tilt: 0deg; --piece-delay: 165ms; }
.ghost-left { --ghost-x: -20px; --ghost-y: -12px; }
.ghost-right { --ghost-x: 20px; --ghost-y: 12px; }

@media (prefers-reduced-motion: no-preference) {
  .hero-motion[data-playing] { --hero-sequence: 4600ms; }
  .hero-motion[data-playing] .hero-motion-ghost { animation: hero-align 700ms var(--ease) both; }
  .hero-motion[data-playing] .hero-motion-crosshairs { animation: hero-lock var(--hero-sequence) linear both; }
  .hero-motion[data-playing] .hero-motion-piece { animation: hero-assemble 490ms var(--ease) var(--piece-delay) both; }
  .hero-motion[data-playing] .hero-motion-outline { animation: hero-ink 210ms var(--ease) 610ms both; }
  .hero-motion[data-playing] .hero-motion-sign { animation: hero-sign 5800ms var(--ease) both; }
  .hero-motion[data-playing] .hero-motion-wordmark { animation: hero-wordmark var(--hero-sequence) var(--ease) both; }
  .hero-motion[data-playing] .hero-motion-editor { animation: hero-editor var(--hero-sequence) var(--ease) both; }
  .hero-motion[data-playing] .hero-motion-playhead { animation: hero-playhead 2350ms linear 1420ms both; }
  .hero-motion[data-playing] .hero-scene-sky { animation: hero-ink 410ms var(--ease) 1390ms both; }
  .hero-motion[data-playing] .hero-scene-sun { animation: hero-sun 610ms var(--ease) 1630ms both; }
  .hero-motion[data-playing] .hero-scene-city { animation: hero-city 540ms var(--ease) 2050ms both; }
  .hero-motion[data-playing] .hero-scene-road { animation: hero-city 390ms var(--ease) 2360ms both; }
  .hero-motion[data-playing] .hero-scene-trail { stroke-dasharray: 1; animation: hero-trail 700ms var(--ease) 2670ms both; }
  .hero-motion[data-playing] .hero-cut { animation: hero-cut 480ms var(--ease) 1500ms both; }
  .hero-motion[data-playing] .clip-city { animation-delay: 2050ms; }
  .hero-motion[data-playing] .clip-trail { animation-delay: 2640ms; }
  .hero-motion[data-playing]:not([data-running]) .hero-motion-art * { animation-play-state: paused; }
}
@keyframes hero-sign {
  0%, 20.6% { transform: translateY(34.2px) scale(.4); opacity: 1; }
  24.6%, 65.8% { transform: translateY(34.2px) scale(.4); opacity: 0; }
  66.6% { transform: translate(20px, 13px) scale(.75); opacity: 0; }
  76.1%, 100% { transform: none; opacity: 1; }
}
@keyframes hero-wordmark {
  0%, 9% { opacity: 0; transform: translateY(7px); }
  16%, 25% { opacity: 1; transform: none; }
  32%, 100% { opacity: 0; transform: translateY(-5px); }
}
@keyframes hero-editor {
  0%, 28% { opacity: 0; transform: translateY(8px); }
  34%, 80% { opacity: 1; transform: none; }
  88%, 100% { opacity: 0; transform: translateY(-8px); }
}
@keyframes hero-playhead { to { transform: translateX(264px); } }
@keyframes hero-cut { from { transform: scaleX(.09); opacity: 0; } }
@keyframes hero-align { from { transform: translate(var(--ghost-x), var(--ghost-y)); opacity: .18; } }
@keyframes hero-lock { 0%, 14%, 93%, 100% { opacity: 1; } 30%, 88% { opacity: 0; } }
@keyframes hero-assemble {
  0% { transform: translate(var(--piece-x), var(--piece-y)) rotate(var(--piece-tilt)) scale(.66); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes hero-ink { from { opacity: 0; } }
@keyframes hero-sun { from { transform: translateY(19px) scale(.73); opacity: 0; } }
@keyframes hero-city { from { transform: translateY(18px); opacity: 0; } }
@keyframes hero-trail { from { stroke-dashoffset: 1; opacity: 0; } to { stroke-dashoffset: 0; opacity: 1; } }

@media (max-width: 1020px) {
  .site-home .hero:has(.hero-motion) { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'title' 'actions' 'ident'; }
  .hero-motion { width: min(100%, 560px); }
  .hero-motion-visual { aspect-ratio: 2 / 1; }
}
@media (max-width: 650px) {
  .site-home .hero:has(.hero-motion) { padding-block: 18px 22px; gap: 11px; }
  .hero:has(.hero-motion) h1 { font-size: clamp(31px, 8.2vw, 42px); margin-top: 12px; }
  .site-home .hero:has(.hero-motion) .hero-bottom { gap: 8px; }
  .hero:has(.hero-motion) .hero-description { font-size: 16px; }
  .hero-motion-head { min-height: 50px; padding: 2px 5px 2px 12px; }
  .hero-motion-visual { aspect-ratio: 2.5 / 1; background-size: 18px 18px; }
}
@media (max-width: 390px) {
  .site-home .hero:has(.hero-motion) .hero-cta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 8px; }
  .site-home .hero:has(.hero-motion) .hero-cta .link-action { width: 100%; padding-inline: 10px; gap: 8px; font-size: 14px; line-height: 1.2; text-align: left; }
  .hero:has(.hero-motion) .home-work-link { font-size: 14px; line-height: 1.2; gap: 7px; }
  .hero:has(.hero-motion) h1 br { display: none; }
  .hero:has(.hero-motion) .hero-description { font-size: 15px; line-height: 1.45; }
  .hero-motion-visual { aspect-ratio: 2.7 / 1; }
}
@media (max-width: 345px) {
  .hero:has(.hero-motion) h1 { font-size: clamp(27px, 8.6vw, 30px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-motion-pause { display: none; }
}
