/* ==========================================================
   Domovita shared motion layer (added 2026-11-18, Anthony's call: carry the homepage
   polish onto the property page and search results, lightly).

   Loaded by tmpl/property/default.php and tmpl/properties/default.php. The homepage
   keeps its own, richer set in homepage.css (scoped to .dv-home); this file is the
   subset that is safe on pages people come to READ figures from.

   Rules that hold for everything in this file:
   - Nothing moves around a price, figure, table, chart or the photo gallery.
   - The resting state is the finished state. Every effect is a scroll-linked or
     hover-triggered change TOWARDS what is already there, so a browser without scroll
     timelines, reduced motion, a paused page, a background tab or a screenshot all show
     the page complete. (Lesson of the 2026-11-16 design critique: delayed entrance
     animations left blank gaps in captures.)
   - No opacity in the scroll reveals, for the same reason - content is never faded.
   - prefers-reduced-motion: reduce switches all of it off.
   - html.dv-motion-paused switches all of it off. That class is set by a one-line inline
     script in each template from the homepage's saved "Pause animation" choice
     (localStorage dvHomeMotion = 'paused'), so a visitor who paused motion on the
     homepage does not meet it again here.
   - Nothing here plays on its own for more than five seconds, so no pause control is
     needed on these pages (WCAG 2.2.2); everything is tied to scrolling or hovering.
   ========================================================== */

/* M0 - let view() timelines see the page scroll on the search results. Helix's
   .body-innerwrapper is `overflow-x: hidden`, which makes it a scroll container that
   never scrolls, so every view() animation inside it binds to it and sits "finished"
   (measured 2026-11-18). `clip` hides sideways overflow without that side effect. The
   property page already has this rule (dv-helix-overrides.css, since 2026-05-10). */
body.view-properties,
body.view-properties .body-innerwrapper {
  overflow-y: visible !important;
  overflow-x: clip !important;
}

:root {
  --dvm-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dvm-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dvm-accent: var(--dv-btn-primary, #2F6FCC);
}

/* M1 - section headings: the blue rule under each heading draws across as it scrolls
   into view. The rule is the heading's existing 2px border (domovita.css .section-title);
   only where scroll timelines exist is it swapped for an identical background line that
   can grow. Everywhere else the border stays exactly as it was. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    html:not(.dv-motion-paused) .section-title {
      border-bottom-color: transparent;
      background: linear-gradient(var(--dvm-accent), var(--dvm-accent)) 0 100% / 100% 2px no-repeat;
      background-origin: border-box;
      animation: dvmDraw linear both;
      animation-timeline: view();
      animation-range: entry 40% cover 30%;
    }
  }
}
@keyframes dvmDraw { from { background-size: 0% 2px; } }

/* M2 - main calls to action: a soft shine sweeps across on hover, as on the homepage
   buttons (homepage.css FX 07). Contact the agent, and the buyer-report button. */
:is(.btn-contact, .dv-buyerreport-cta-btn) {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
:is(.btn-contact, .dv-buyerreport-cta-btn)::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.4) 50%, transparent 70%);
  transform: translateX(-120%);
}
@media (prefers-reduced-motion: no-preference) {
  html:not(.dv-motion-paused) :is(.btn-contact, .dv-buyerreport-cta-btn):hover::after {
    transition: transform 0.7s var(--dvm-ease-out);
    transform: translateX(120%);
  }
  html:not(.dv-motion-paused) .dv-buyerreport-cta-btn svg {
    transition: transform 200ms var(--dvm-ease-spring);
  }
  html:not(.dv-motion-paused) .dv-buyerreport-cta-btn:hover svg {
    transform: translateX(3px);
  }
}

/* M3 - search results: each property card settles up into place as it scrolls in.
   Uses `translate`/`scale`, NOT `transform`, so the existing :hover lift in
   domovita.css (.property-card:hover transform) and the .removing shrink still work.
   No opacity: the card is fully visible at every point. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    html:not(.dv-motion-paused) .dv-results-motion .property-card {
      animation: dvmSettle linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
  }
}
@keyframes dvmSettle { from { translate: 0 28px; scale: 0.985; } }

/* M4 - search results: a springier hover lift on the cards (same distance as before,
   domovita.css .property-card:hover, just a livelier curve). */
@media (prefers-reduced-motion: no-preference) {
  html:not(.dv-motion-paused) .dv-results-motion .property-card {
    transition: transform 280ms var(--dvm-ease-spring), box-shadow 280ms, border-color 280ms, opacity 0.4s ease-out;
  }
}
