/* Full-page transitions run only between documents that have opted in. */
@media (prefers-reduced-motion: no-preference) {
    ::view-transition-group(root) { animation-duration: 380ms }
    ::view-transition-image-pair(root) { isolation: isolate; background: #1f312d }
    ::view-transition-old(root) {
        mix-blend-mode: normal;
        animation: sah-page-out 165ms cubic-bezier(.55,0,.85,.6) both;
    }
    ::view-transition-new(root) {
        mix-blend-mode: normal;
        animation: sah-page-in 215ms 165ms cubic-bezier(.15,.4,.35,1) both;
    }
    @keyframes sah-page-out { from { clip-path: inset(0 0 0 0) } to { clip-path: inset(0 0 0 100%) } }
    @keyframes sah-page-in { from { clip-path: inset(0 100% 0 0) } to { clip-path: inset(0 0 0 0) } }

    /* Other browsers use the same colours and timings on a non-interactive layer. */
    html:is(.sah-leaving,.sah-arriving)::after {
        content: ""; position: fixed; inset: 0; z-index: 2147483646;
        background: #1f312d; pointer-events: none;
    }
    html.sah-leaving::after { animation: sah-curtain-enter 165ms cubic-bezier(.55,0,.85,.6) both }
    html.sah-arriving::after { animation: sah-curtain-exit 215ms cubic-bezier(.15,.4,.35,1) both }

    @keyframes sah-curtain-enter { from { transform: translateX(-100%) } to { transform: translateX(0) } }
    @keyframes sah-curtain-exit { from { transform: translateX(0) } to { transform: translateX(100%) } }

    .sah-landing :is(.pc-photo,.sc-photo) { overflow: hidden }
    .sah-landing :is(.pc-photo,.sc-photo) img { transition: transform 180ms ease-out }
    .sah-landing :is(.pc-enquiry,.ct-map-card) { transition: translate 150ms ease-out }
    :is(.sah-landing,.sah-home-design .sah-quote) .wp-block-button__link::after,
    .sah-contact-page .ct-send::after { transition: translate 150ms ease-out }

    :is(.sah-landing,.sah-home-design .sah-quote) .wp-block-button__link:focus-visible::after,
    .sah-contact-page .ct-send:has(:focus-visible)::after { translate: 2px -2px }
    .sah-landing :is(.pc-enquiry,.ct-map-card):has(a:focus-visible) { translate: 0 -2px }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .sah-landing :is(.pc-card,.sc-step):hover :is(.pc-photo,.sc-photo) img { transform: scale(1.025) }
    .sah-landing .pc-enquiry:has(.wp-block-button__link:hover),
    .sah-landing .ct-map-card:has(a:hover) { translate: 0 -2px }
    :is(.sah-landing,.sah-home-design .sah-quote) .wp-block-button__link:hover::after,
    .sah-contact-page .ct-send:has([type=submit]:hover)::after { translate: 2px -2px }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(root), ::view-transition-old(root), ::view-transition-new(root) { animation: none !important }
}

/* The section is legible before its entrance starts, including during a fast scroll. */
@media screen and (prefers-reduced-motion: no-preference) {
    .sah-landing { --sah-start-opacity: .76 }
    .sah-landing :is(h1,h2,h3,.sah-accent) { --sah-start-opacity: .22 }
    .sah-landing :is(.pc-card-title,.sc-card-title,.sc-country) { --sah-start-opacity: .52 }
    .sah-landing :is(.sah-portrait,.sah-about-team-photo,.sah-about-supply-photo,.sc-hero,.sc-photo,.pc-photo,.ct-photo) { --sah-start-opacity: .8 }
    html.sah-arming .sah-landing :is(h1,h2,h3,.sah-accent,.sah-lead,.sc-lead,.ct-lead,.pc-intro-copy,.sah-intro,.sah-about-copy,.pc-description,.pc-enquiry-copy,.sc-card-copy,.sc-capacity-note,.sc-cities,.sah-portrait,.sah-about-team-photo,.sah-about-supply-photo,.sc-hero,.sc-photo,.pc-photo,.ct-photo):not(.sah-contact *,.ct-panel *,form *,[contenteditable="true"] *),
    .sah-landing .sah-queued { opacity: var(--sah-start-opacity) }
}
