/* Contrast Living v26 and v27: the v23 hover animations, on the pages built from the design canvas and on the canvas
   header and footer of every page. tools/canvas_import.py adds the mo-* classes to the canvas markup (the canvas
   itself is not changed). The canvas sets colours inline, so hover colours here use !important. */

/* Menu links: a 1px line runs in from the left (v23 .header__nav > a::after, 0.3s) */
.mo-nav { position: relative; }
.mo-nav::after { content: ""; position: absolute; left: 0; right: 0; bottom: 10px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left center; transition: transform .3s ease; pointer-events: none; }
.mo-nav:hover::after, .mo-nav:focus-visible::after { transform: scaleX(1); }

/* Arrows in text links and round buttons move 3px to the right (v23 .tlink:hover svg, .pill:hover svg, 0.2s) */
.mo-arrow { position: relative; left: 0; transition: left .2s ease; }
a:hover .mo-arrow, a:focus-visible .mo-arrow, button:hover .mo-arrow, button:focus-visible .mo-arrow { left: 3px; }

/* Underlined text links: text and line go to the muted tone (v23 .tlink:hover, 0.2s; on dark and photo 70% white) */
.mo-line { transition: opacity .2s ease; }
.mo-line:hover { opacity: .7; }

/* Round buttons: white turns paper, dark turns near black (v23 .pill:hover, .pill--light:hover, 0.2s) */
.mo-pill { transition: background-color .2s ease, color .2s ease; }
.mo-pill--light:hover, .mo-pill[data-mo-light="true"]:hover { background: #FBF9F6 !important; }
.mo-pill--dark:hover, .mo-pill[data-mo-light="false"]:hover { background: #111111 !important; }
/* v40: the outline pill on dark (Contact, Join the wait list) gets a light fill */
.mo-pill--outline:hover { background: rgba(251, 249, 246, .12) !important; }

/* LinkedIn and Instagram in the footer fade a little (v24 .footer__social a:hover) */
footer a[aria-label^="Contrast Living on"] { transition: opacity .2s ease; }
footer a[aria-label^="Contrast Living on"]:hover { opacity: .7; }

/* Previous and next buttons: one step darker (v23 .car__btn:hover, 0.2s) */
.mo-round { transition: background-color .2s ease; }
.mo-round:hover { background: #E4DDD3 !important; }

/* Pictures: a slow zoom (v23 galleries 1.015, Journal entries 1.02, 0.6s) */
.mo-zoom img { transition: transform .6s ease; }
.mo-zoom:hover img { transform: scale(1.015); }
.mo-zoom--journal:hover img { transform: scale(1.02); }

/* Galleries (v27, as v23): the arrows appear when the pointer is on the picture (always on touch screens);
   an arrow turns white and moves 2px outwards on hover (v23 .gal__btn, 0.2s). The canvas draws the arrows. */
.gal .gal-btn { transition: opacity .2s ease, background-color .2s ease, transform .2s ease; }
@media (hover: hover) and (pointer: fine) {
  .gal .gal-btn { opacity: 0; }
  .gal:hover .gal-btn, .gal:focus-within .gal-btn { opacity: 1; }
}
.gal .gal-btn:hover { background: #FFFFFF !important; }
.gal .gal-prev:hover { transform: translate(-2px, -50%) !important; }
.gal .gal-next:hover { transform: translate(2px, -50%) !important; }

/* Journal titles and footer links: underline on hover (v23 .jentry__t a, .footer__list a, .footer__mail a) */
.mo-title:hover { text-decoration-line: underline !important; text-decoration-thickness: 1px !important; text-underline-offset: .15em; }
.mo-foot:hover { text-decoration: underline !important; text-underline-offset: .2em; }
.mo-legal:hover { color: #282828 !important; }
.mo-mail:hover { color: #282828 !important; text-decoration: underline !important; text-underline-offset: .2em; }

@media (prefers-reduced-motion: reduce) {
  .mo-nav::after, .mo-arrow, .mo-line, .mo-pill, .mo-round, .mo-zoom img, .gal .gal-btn { transition: none; }
  .mo-zoom:hover img { transform: none; }
  /* as v23: no transitions at all, also the canvas's own (NOI chart, Home steps) */
  #dc-root *, #dc-root *::before, #dc-root *::after, .dc-chrome *, .dc-chrome *::before, .dc-chrome *::after { transition: none !important; }
}

/* v29: motion for Durk's requests of 29 October, on top of the animations above.
   Header: as the bar turns white on scroll the logo crossfades from white to dark and Contact us turns black,
   in the same 0.25s as the bar itself; the menu on a phone slides open. About: the sections below In short rise
   into view once as you scroll (assets/js/motion.js), and the How we make a
   difference rows open and close smoothly, the plus turning into a minus. tools/canvas_import.py adds the
   markup hooks (mo-logo, data-mo-light on the header, mo-acc, mo-pm); the canvas itself is not changed. */
.hn-logo { position: relative; }
.mo-logo { transition: opacity .25s ease; }
.mo-logo--light { position: absolute; left: 0; top: 0; }
header[data-mo-light="true"] .mo-logo--dark, header[data-mo-light="false"] .mo-logo--light { opacity: 0; }
.hn-cta.mo-pill { transition: background-color .25s ease, color .25s ease; }

.mo-acc { transition: grid-template-rows .5s cubic-bezier(.2, .7, .2, 1); }
.mo-acc > div > * { opacity: 0; transform: translateY(-6px); transition: opacity .3s ease, transform .4s ease; }
[aria-expanded="true"] + .mo-acc > div > * { opacity: 1; transform: none; transition-delay: .1s; }
.mo-pm { position: relative; display: block; width: 12px; height: 12px; }
.mo-pm::before, .mo-pm::after { content: ""; position: absolute; left: 0; top: 50%; width: 12px; height: 1.5px; margin-top: -.75px;
  border-radius: 1px; background: currentColor; transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
.mo-pm::after { transform: rotate(90deg); }
[aria-expanded="true"] .mo-pm::after { transform: rotate(180deg); }
#esg button[aria-expanded] > span:last-child { transition: background-color .2s ease; }
#esg button[aria-expanded]:hover > span:last-child { background: rgba(40, 40, 40, .12) !important; }
#team a[href^="mailto:"], #team a[href*="linkedin.com"] { transition: opacity .2s ease; }
#team a[href^="mailto:"]:hover, #team a[href*="linkedin.com"]:hover { opacity: .7; }

@keyframes mo-up { from { opacity: 0; transform: translateY(18px); } }
/* v39 (9 November): the entrance as each page loads comes from the page's own stylesheet, as on the canvas
   (cl-rise in About.css, ForOwners.css, Locations.css, Contact.css, WaitList.css; Home in Main.css). */
@keyframes mo-drop { from { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: no-preference) {
  .hn-panel { animation: mo-drop .25s ease both; }
  .mo-rise { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
  .mo-rise.mo-in { opacity: 1; transform: none; }
  .mo-rise[data-mo-i="1"] { transition-delay: .08s; }
  .mo-rise[data-mo-i="2"] { transition-delay: .16s; }
  .mo-rise[data-mo-i="3"] { transition-delay: .24s; }
  .mo-rise[data-mo-i="4"] { transition-delay: .32s; }
  .mo-rise[data-mo-i="5"] { transition-delay: .4s; }
}

/* v40 (9 November): one motion language on every page. The accordions on Home (Our approach, the app questions),
   For owners (services) and About open and close in 0.5s with the text fading in (mo-acc); the sections below the
   first screen on Home, For owners and Our projects rise into view like About (assets/js/motion.js); the legal
   pages open like the others: label, title and first paragraph rise in (as cl-rise on the canvas pages). */
@keyframes mo-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .prose > .kicker, .prose > #ph-title, .prose > #ph-title + p { animation: mo-in .9s cubic-bezier(.2, .7, .2, 1) both; }
  .prose > #ph-title { animation-delay: .12s; }
  .prose > #ph-title + p { animation-delay: .28s; }
}
