/* ==========================================================================
   Saansad Tracker motion layer (every /saansad page).
   - Everything here is switched on by html.sn-mo, which the inline script in saansad/layout sets only when
     the visitor has not asked for reduced motion (system setting, or "Stop animations" / low-data in the
     accessibility panel). Without the class the pages are exactly as before.
   - transform / opacity only. No count-up numbers, no glass, no blur, no gradient orbs (CLAUDE.md §11.9).
   ========================================================================== */

/* 1 · Page-to-page transitions between Saansad pages (browsers without support just navigate). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
::view-transition-old(root) { animation: sn-vt-out .18s ease both; }
::view-transition-new(root) { animation: sn-vt-in .42s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes sn-vt-out { to { opacity: 0; transform: scale(.985); } }
@keyframes sn-vt-in { from { opacity: 0; transform: translateY(18px); } }
/* The bottom bar and the sub-navigation stay put while the page changes under them. */
.sn-mo .sn-appbar { view-transition-name: sn-appbar; }
.sn-mo .sn-subnav { view-transition-name: sn-subnav; }
::view-transition-old(sn-appbar), ::view-transition-new(sn-appbar),
::view-transition-old(sn-subnav), ::view-transition-new(sn-subnav) { animation: none; mix-blend-mode: normal; }
::view-transition-old(sn-appbar), ::view-transition-old(sn-subnav) { display: none; }
/* The active-tab marker slides from the old tab to the new one. */
.sn-mo .sn-app-pill { view-transition-name: sn-app-pill; }
::view-transition-group(sn-app-pill) { animation-duration: .38s; animation-timing-function: cubic-bezier(.3, 1.3, .5, 1); z-index: 2; }
::view-transition-group(sn-appbar) { z-index: 1; }
/* An MP's photo travels from the list card to the profile. */
.sn-mo .sn-photo--lg { view-transition-name: sn-mp-photo; }
::view-transition-group(sn-mp-photo) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); z-index: 3; }

/* 2 · Content rises in as it is scrolled to. Only elements the script marks below the fold are hidden. */
.sn-mo [data-mo] { opacity: 0; transform: translateY(26px) scale(.98); }
.sn-mo [data-mo].is-in { opacity: 1; transform: none; transition: opacity .6s ease var(--mo-d, 0ms), transform .7s cubic-bezier(.2, .8, .2, 1) var(--mo-d, 0ms); }
.sn-mo [data-mo="left"] { transform: translateX(-28px); }
.sn-mo [data-mo="pop"] { transform: scale(.86); }
.sn-mo [data-mo="pop"].is-in { transition: opacity .4s ease var(--mo-d, 0ms), transform .65s cubic-bezier(.3, 1.5, .5, 1) var(--mo-d, 0ms); }

/* 3 · Count bars draw from the left when they come into view (the figures themselves never tick). */
.sn-mo .sn-bars[data-mo-bars] .sn-bar-t i { transform: scaleX(0); transform-origin: left center; }
.sn-mo .sn-bars[data-mo-bars].is-in .sn-bar-t i { transform: none; transition: transform .9s cubic-bezier(.2, .8, .2, 1) calc(var(--i, 0) * 70ms + 80ms); }

/* 4 · Hero photograph drifts very slowly (the "moving image"); paused when off screen by the script. */
.sn-mo .ap-hero .ap-shot-frame picture { position: absolute; inset: 0; display: block; animation: sn-drift 36s ease-in-out infinite alternate; will-change: transform; }
.sn-mo .ap-hero .ap-shot-frame.is-away picture { animation-play-state: paused; }
@keyframes sn-drift { from { transform: scale(1.02) translate3d(0, 0, 0); } to { transform: scale(1.1) translate3d(-1.8%, -1.4%, 0); } }
/* A light sweep crosses the photograph once after it lands. */
.sn-mo .ap-hero .ap-shot-frame::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, .22) 50%, transparent 58%); transform: translateX(-120%); animation: sn-sweep 1.6s ease 1.1s 1 both; }
@keyframes sn-sweep { to { transform: translateX(120%); } }

/* 5 · Touch and pointer feedback. */
.sn-mo .sn-mpcard, .sn-mo .sn-topic, .sn-mo .sn-tile, .sn-mo .sn-btn, .sn-mo .sn-chip, .sn-mo a.sn-card { transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .22s ease, border-color .2s ease, background-color .2s ease; }
@media (hover: hover) {
  .sn-mo .sn-mpcard:hover, .sn-mo .sn-topic:hover { transform: translateY(-3px); box-shadow: 0 14px 28px -18px rgba(11, 37, 69, .45); }
  .sn-mo .sn-mpcard:hover .sn-photo img { transform: scale(1.06); }
  .sn-mo .sn-btn--primary:hover { transform: translateY(-1px); }
}
.sn-mo .sn-photo img { transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.sn-mo .sn-mpcard:active, .sn-mo .sn-topic:active, .sn-mo .sn-btn:active, .sn-mo .sn-chip:active { transform: scale(.96); transition-duration: .08s; }

/* 6 · Thin progress line at the top while the next page loads. */
.sn-nprog { position: fixed; left: 0; top: 0; z-index: 10000; height: 4px; width: 100%; background: #d97706; transform: scaleX(0); transform-origin: left center; opacity: 0; pointer-events: none; }
.sn-nprog.is-go { opacity: 1; transform: scaleX(.86); transition: transform 6s cubic-bezier(.1, .7, .1, 1), opacity .1s linear; }

/* 7 · Loading placeholder for "Find my MP" results, and the results easing in. */
.sn-skel { height: 96px; margin-top: 10px; border-radius: 12px; background: #eef2f7; overflow: hidden; position: relative; }
.sn-skel + .sn-skel { height: 96px; }
.sn-mo .sn-skel::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .75) 50%, transparent 70%); transform: translateX(-100%); animation: sn-shim 1.1s linear infinite; }
@keyframes sn-shim { to { transform: translateX(100%); } }
.sn-mo .sn-finder-out > .sn-myarea, .sn-mo .sn-finder-out > .sn-myarea ~ * { animation: sn-rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.sn-mo .sn-finder-out > .sn-myarea ~ * { animation-delay: .08s; }
@keyframes sn-rise { from { opacity: 0; transform: translateY(14px); } }

/* 8 · "Show full text" opens smoothly where the browser can animate it. */
@supports (interpolate-size: allow-keywords) {
  .sn-mo .sn-speech-txt { interpolate-size: allow-keywords; }
  .sn-mo .sn-speech-txt::details-content { block-size: 0; overflow: hidden; opacity: 0; transition: block-size .35s ease, opacity .35s ease, content-visibility .35s allow-discrete; }
  .sn-mo .sn-speech-txt[open]::details-content { block-size: auto; opacity: 1; }
}

/* 9 · Phone app shell additions (<= 700px). */
.sn-app-pill { display: none; }
@media (max-width: 700px) {
  .sn-app-i { position: relative; }
  .sn-app-i svg, .sn-app-i span { position: relative; z-index: 1; }
  .sn-app-pill { display: block; position: absolute; top: 2px; left: 50%; width: 58px; height: 34px; margin-left: -29px; border-radius: 17px; background: #eff6ff; }
  .sn-mo .sn-app-i.is-on svg { animation: sn-pop .5s cubic-bezier(.3, 1.6, .5, 1) .12s both; }
  @keyframes sn-pop { from { transform: scale(.7) translateY(4px); } }
  /* The bar tucks away while reading down the page and returns on the way up. */
  .sn-mo .sn-appbar { transition: transform .32s cubic-bezier(.2, .8, .2, 1); }
  .sn-mo .sn-appbar.is-tucked { transform: translateY(calc(100% + 12px)); }
  /* Softer, larger surfaces on a phone. */
  .sn-mo .sn-card, .sn-mo .sn-latest, .sn-mo .sn-speech, .sn-mo .sn-mpcard, .sn-mo .sn-topic, .sn-mo .sn-tile { border-radius: 18px; }
  .sn-mo .sn-photo { border-radius: 14px; }
  .sn-mo .sn-photo--framed { border-radius: 0; }
  /* Summary tiles become a row you swipe, like an app shelf. */
  .sn-mo .sn-tiles { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -16px; padding: 4px 16px 10px; scrollbar-width: none; }
  .sn-mo .sn-tiles::-webkit-scrollbar { display: none; }
  .sn-mo .sn-tile { flex: 0 0 62%; scroll-snap-align: center; padding: 20px 18px; }
  .sn-mo .sn-tile b { font-size: 40px; }
}

/* Safety: anyone who stops animations sees everything, at rest. */
.sn.sn-a11y-still [data-mo], .sn.sn-a11y-low [data-mo] { opacity: 1 !important; transform: none !important; }
.sn.sn-a11y-still .sn-bar-t i, .sn.sn-a11y-low .sn-bar-t i { transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  [data-mo] { opacity: 1 !important; transform: none !important; }
  .sn-bar-t i { transform: none !important; }
  .sn-nprog { display: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
