/* ==========================================================================
   site-motion.css: how the public site moves (Eric, 2026-11-21: "smooth,
   seamless loading with fade in animation and swipe effects on all pages,
   sections etc." and "smooth pill toggle animations like iOS native").

   What it owns, all of it public theme only (admin and OS never load it):
     1. THE PAGE CROSS-FADE. The cross-document View Transition is switched on
        in core/assets/feel.css; this file sets its beat (220ms) and keeps the
        header, the brokerage strip and the List/Map toggle still across it.
     2. THE SECTION FADE-UP. 14px over 400ms, ease-out. The hidden state is
        .sm-wait, which only site-motion.js adds, only under html.sm-on, and
        only to blocks that start below the fold. The older .fade hidden state
        (core/assets/motion.css) is neutralised here so nothing is ever hidden
        at first paint.
     3. SWIPE ROWS. Chip rows and the reviews become one-line rows with native
        momentum and snap on phones.
     4. THE SEGMENTED THUMB. One sliding pill under each toggle (.sm-seg,
        built by site-motion.js), labels cross-fading as it passes.

   Never: hide anything without html.sm-on, animate anything but opacity and
   transform, touch the listing photo carousel (.pcar, .ztrack, .lz-track), or
   delay the RMLS notices.
   Siblings: site-motion.js (the engine), core/assets/motion.css, feel.css.
   ========================================================================== */

:root { --sm-ease: cubic-bezier(.16, 1, .3, 1); --sm-spring: cubic-bezier(.32, .72, 0, 1); }

/* ---------- 1. the page cross-fade ---------- */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 220ms; animation-timing-function: ease-out; }
::view-transition-group(*) { animation-duration: 220ms; animation-timing-function: var(--sm-spring); }
/* the chrome holds still: the same name on both pages means it is morphed in
   place, not faded with the page. One element per name, or the browser drops
   the whole transition, which is why the floating map toggle is left out. */
#nav { view-transition-name: site-nav; }
.brokebar { view-transition-name: site-brokebar; }
.zseg:not(.zseg-float) { view-transition-name: site-zseg; }

/* ---------- 2. the section fade-up ---------- */
/* The old engine hid every .fade from the first paint until its observer ran,
   which faded the hero stats and the login card in on arrival. Visible unless
   this engine has decided, below the fold, to hold it. */
html.js .fade:not(.sm-wait),
html.js .reveal:not(.sm-wait),
html.js .lgrid .fade:not(.sm-wait) { opacity: 1; transform: none; }

:root.sm-on .sm-wait.sm-wait { opacity: 0; transform: translate3d(0, 14px, 0); transition: none; }
:root.sm-on .sm-in { transition: opacity .4s var(--sm-ease), transform .4s var(--sm-ease); }

/* a cloned carousel card carries the class with nobody watching it */
:root.sm-on .splide .sm-wait.sm-wait,
:root.sm-on [data-motion-skip] .sm-wait.sm-wait { opacity: 1; transform: none; }

/* cards a script adds later (a refreshed results grid) arrive on a keyframe,
   which always ends visible whatever happens to the script */
.sm-pop { animation: sm-pop .4s var(--sm-ease) backwards; animation-delay: var(--sm-d, 0ms); }
@keyframes sm-pop { from { opacity: 0; transform: translate3d(0, 12px, 0); } }

@media print {
  :root .sm-wait.sm-wait, .sm-pop { opacity: 1 !important; transform: none !important; animation: none !important; }
}

/* ---------- 3. swipe rows (phones) ---------- */
/* Chip rows that wrapped onto four or five lines become one row the thumb
   flicks through: native momentum, a soft snap, the first chip on the page
   gutter and the next one peeking past the edge. Set in the stylesheet, so the
   row is one line from the first paint (no shift). */
@media (max-width: 640px) {
  .kw-chips, .hx-chips, .hub-chips, .townrow {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 24px;
    scrollbar-width: none;
    margin-inline: -24px;
    padding: 2px 24px;
    /* a one-line row must not widen its column: without this a grid or flex
       parent sizes to the whole row and the text beside it runs off screen */
    contain: inline-size;
  }
  .kw-chips::-webkit-scrollbar, .hx-chips::-webkit-scrollbar,
  .hub-chips::-webkit-scrollbar, .townrow::-webkit-scrollbar { display: none; }
  .kw-chips > *, .hx-chips > *, .hub-chips > *, .townrow > * { flex: none; scroll-snap-align: start; white-space: nowrap; }
}
/* the reviews: a card strip, equal heights, the next card peeking */
@media (max-width: 860px) {
  #reviews .qgrid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(82vw, 340px);
    gap: 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 24px;
    scrollbar-width: none;
    margin-inline: -24px;
    padding: 4px 24px 12px;
    contain: inline-size;
  }
  #reviews .qgrid::-webkit-scrollbar { display: none; }
  #reviews .qgrid > * { scroll-snap-align: start; }
}
/* any other sideways scroller the engine finds (never the photo carousels) */
.sm-row { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }

/* ---------- 4. the segmented thumb ---------- */
.sm-seg { isolation: isolate; }
.sm-seg.sm-rel { position: relative; }
.sm-thumb {
  position: absolute; top: 0; left: 0; z-index: 0;
  pointer-events: none;
  transform-origin: 0 0;
  background: var(--sm-on-bg);
  border-radius: var(--sm-rad);
  box-shadow: var(--sm-on-sh);
  border: var(--sm-on-bw, 0) solid var(--sm-on-bd, transparent);
  box-sizing: border-box;
}
.sm-thumb.sm-go { transition: transform .28s var(--sm-spring); }
/* the labels ride above the thumb and take its colour as it arrives */
.sm-seg .sm-v {
  position: relative;
  background-color: transparent !important;
  box-shadow: none !important;
  color: var(--sm-off-c) !important;
  transition: color .25s ease, transform .14s ease;
}
.sm-seg .sm-v.sm-cur { color: var(--sm-on-c) !important; }
.sm-seg .sm-v.sm-press { transform: scale(.96); }
/* chip rows (each option its own outlined pill): the option's own fill and
   outline move to a layer under the thumb, so the thumb shows on top of an
   idle chip while the label stays above both */
.sm-seg.sm-chip .sm-v { border-color: transparent !important; }
.sm-seg.sm-chip .sm-v::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: calc(-1 * var(--sm-off-bw, 0px));
  border-radius: inherit;
  background: var(--sm-off-bg);
  border: var(--sm-off-bw, 0px) solid var(--sm-off-bd, transparent);
}

/* ---------- reduced motion: everything shown, nothing slides ---------- */
@media (prefers-reduced-motion: reduce) {
  :root.sm-on .sm-wait.sm-wait { opacity: 1; transform: none; }
  .sm-pop { animation: none; }
  .sm-thumb.sm-go, .sm-seg .sm-v { transition: none; }
  .sm-seg .sm-v.sm-press { transform: none; }
}
