/* IMPERIA / SECTION TRANSITIONS — GPU-friendly, progressive enhancement */
:root{--chapter-ease:cubic-bezier(.22,1,.36,1)}
html{scroll-behavior:smooth}
.chapter-transition-line{
  position:fixed;top:0;left:0;right:0;height:3px;z-index:1100;pointer-events:none;
  transform:scaleX(0);transform-origin:left;
  background:linear-gradient(90deg,#eab6c5,#fff2dd 54%,#ad4a6d);
  opacity:0;box-shadow:0 0 24px #e9b3c799;
}
.chapter-transition-line.is-moving{opacity:1;animation:chapter-progress 850ms var(--chapter-ease) both}
@keyframes chapter-progress{
  0%{transform:scaleX(0);opacity:1}
  75%{transform:scaleX(.95);opacity:1}
  100%{transform:scaleX(1);opacity:0}
}
.chapter-target-flash{
  position:fixed;inset:0;z-index:105;pointer-events:none;
  opacity:0;
  background:linear-gradient(145deg,transparent 28%,#ac45611a 58%,transparent 85%);
}
.chapter-target-flash.is-moving{animation:chapter-flash 700ms ease-out both}
@keyframes chapter-flash{0%{opacity:0}35%{opacity:.8}100%{opacity:0}}
@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  .chapter-transition-line,.chapter-target-flash{display:none!important;animation:none!important}
}
.animation-paused .chapter-transition-line,
.animation-paused .chapter-target-flash{display:none!important;animation:none!important}

/* Focus is moved to the destination only for keyboard navigation. */
section h1[tabindex="-1"]:focus:not(:focus-visible),
section h2[tabindex="-1"]:focus:not(:focus-visible),
section h3[tabindex="-1"]:focus:not(:focus-visible){outline:none}
@media(max-width:720px){
  .chapter-transition-line{height:2px;box-shadow:0 0 12px #e9b3c766}
  .chapter-target-flash{background:linear-gradient(155deg,transparent 42%,#ac45610d 67%,transparent 92%)}
}
