/* Motion is progressive enhancement: content is visible without JS; no scroll hijacking. */
/* Cross-fade only when the next document is ready. Native navigation keeps
   links, downloads, history and loading behaviour intact; no click delay. */
@media screen and (prefers-reduced-motion: no-preference) {
  ::view-transition-group(root),
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: .2s;
    animation-timing-function: ease-in-out;
  }
}
.reading-progress {
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
  display: none;
}
.bt-motion-enabled .reading-progress { display: block; }
/* Contain lateral headings without clipping their own accents or line-height. */
main { overflow-x: clip; }
main [data-bt-motion="card"] { position: relative; }
.bt-card-accent {
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--red);
  transform-origin: left;
  pointer-events: none;
}
/* Only while the drawn accent exists. The permanent red border is the fallback. */
html.bt-motion-enabled main [data-bt-motion="card"].bt-card-drawing {
  border-top-color: transparent;
}
.history-photo picture { display: block; overflow: hidden; border-radius: 2px; }
@media (prefers-reduced-motion: no-preference) {
  /* Added by JS only to offscreen photos; removed on entrance, stop or failure. */
  .bt-motion-enabled .history-photo.bt-photo-pending { opacity: 0; }
  .button { transition: background .25s, color .25s, transform .3s, box-shadow .3s; }
  .button .icon, .text-link .icon, .specialty-strip .icon, .security-index .icon {
    transition: transform .35s cubic-bezier(.2,.7,.2,1);
  }
  /* The top border must return instantly when the animated accent is removed.
     A transition on border/border-color/all creates a second fade (visible flash).
     Apply to every animated card, overriding legacy border transitions too. */
  main [data-bt-motion="card"] {
    transition: box-shadow .35s, border-left-color .35s,
      border-right-color .35s, border-bottom-color .35s;
  }
  .history-photo img { transition: transform 1.1s cubic-bezier(.2,.7,.2,1); }
  .specialty-strip a, .security-index > a { transition: background .3s; }
  .bt-motion-enabled [data-bt-motion="label"].is-revealed::before {
    animation: bt-line-in .65s cubic-bezier(.2,.7,.2,1) both;
    transform-origin: left;
  }
  .button:focus-visible .icon, .text-link:focus-visible .icon { transform: translateX(4px); }
  @media (hover: hover) and (pointer: fine) {
    .history-photo:hover img { transform: scale(1.025); }
    .button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px #20252a18; }
    .button:hover .icon, .text-link:hover .icon,
    .specialty-strip a:hover .icon, .security-index a:hover .icon { transform: translateX(5px); }
    .service-card:hover, .value-card:hover, .safety-card:hover,
    .configuration-grid > article:hover, .qualification-grid > article:hover,
    .public-document-card:hover, .location-card:hover, .job-row:hover {
      transform: none;
      box-shadow: 0 10px 26px #20252a0e;
      border-color: #cda5a8;
    }
    .specialty-strip a:hover { background: #e9ebed; }
    .security-index a:hover { background: #ffffff09; }
  }
  .button:active { transform: translateY(0); box-shadow: none; }
}
@keyframes bt-line-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .reading-progress { display: none !important; }
  .button:hover, .service-card:hover, .history-photo:hover img { transform: none; }
}
@media print {
  .reading-progress { display: none !important; }
  .history-photo.bt-photo-pending { opacity: 1 !important; }
}
