/*
  Miranda Davy Coaching: motion layer.
  Website developed by pressific.com Emily Park, Dileep C. Kaluaratchie and Tech Generation Ltd.

  Sits on top of the converted design without altering it. Everything below
  moves something that was already in place; nothing changes a box.

  1. FAIL-SAFE. Anything that starts hidden is scoped under .mrd-motion, a class
     JavaScript puts on <html>. No JS means nothing is ever hidden.
  2. SCROLL-COUPLED, not fire-once: reveals re-run on re-entry.
  3. Reduced motion gets none of it.

  Brand: cyan #13bfd4, ink #231f20, orange #f49342.
*/

:root {
  --mrd-cyan: #13bfd4;
  --mrd-ink:  #231f20;
  --mrd-orange: #f49342;
  --mrd-ease: cubic-bezier(.25, .46, .45, .94);
}

/* ---- the opening: a path resolving out of the noise ------------------------
   Her promise is "clear and defined strategic paths to follow", so the screen
   opens tangled and ends on one drawn route. Drawing is in mrd-intro.js.     */

.mrd-intro {
  position: fixed; inset: 0; z-index: 100000;
  background: #ffffff;
  pointer-events: none;
  opacity: 1;
  transition: opacity .7s ease;
}
.mrd-intro.is-done { opacity: 0; }
.mrd-intro__canvas { position: absolute; inset: 0; display: block; }

/* the wordmark sits just below the mark the canvas assembles */
.mrd-intro__word {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, 0);
  margin-top: min(15vmin, 132px);
  width: min(38vw, 300px);
  opacity: 0;
  transition: opacity 1s ease, transform 1s var(--mrd-ease);
}
.mrd-intro__word img { display: block; width: 100%; height: auto; }
.mrd-intro.is-named .mrd-intro__word { opacity: 1; transform: translate(-50%, -6px); }

.mrd-intro-open, .mrd-intro-open body { overflow: hidden; }

/* ---- scroll-coupled page motion -------------------------------------------- */

.mrd-motion [data-mrd="rise"] {
  opacity: 0; transform: translateY(22px);
  transition: opacity .85s ease, transform .95s var(--mrd-ease);
}
.mrd-motion [data-mrd="rise"].is-in { opacity: 1; transform: none; }
.mrd-motion [data-mrd="rise"][data-mrd-i="1"] { transition-delay: .09s; }
.mrd-motion [data-mrd="rise"][data-mrd-i="2"] { transition-delay: .18s; }
.mrd-motion [data-mrd="rise"][data-mrd-i="3"] { transition-delay: .27s; }

/* No heading rule here. The design already underlines its own headings, with
   hand-drawn SVG swashes under the hero lines and under each page title, so a
   second rule was both redundant and, sitting below the heading box, landing on
   the copy underneath it. */

/* photographs settle as they pass, tied to position not time */
.mrd-motion [data-mrd="drift"] {
  transform: translateY(calc((var(--p, .5) - .5) * -18px));
  transition: transform .12s linear;
  will-change: transform;
}
.mrd-motion [data-mrd="parallax"] {
  background-position-y: calc(50% + (var(--p, .5) - .5) * 70px) !important;
}

/* the service cards lift, since they are the route into the site */
[data-mrd="card"] {
  transition: transform .5s var(--mrd-ease), box-shadow .5s ease;
  will-change: transform;
}
@media (hover: hover) {
  [data-mrd="card"]:hover { transform: translateY(-5px); box-shadow: 0 18px 40px rgba(19,191,212,.22); }
}

/* the appointment button is the conversion: give it a slow sheen */
[data-mrd="cta"] { position: relative; overflow: hidden; }
[data-mrd="cta"]::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.28) 50%, transparent 62%);
  transform: translateX(-100%);
  animation: mrd-sheen 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes mrd-sheen { 0%,64% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.mrd-progress {
  position: fixed; top: 0; left: 0; height: 3px; z-index: 9998; width: 100%;
  transform: scaleX(var(--mrd-scroll, 0)); transform-origin: 0 50%;
  background: var(--mrd-cyan); pointer-events: none;
}

.mrd-motion a:focus-visible, .mrd-motion button:focus-visible,
.mrd-motion input:focus-visible, .mrd-motion textarea:focus-visible {
  outline: 2px solid var(--mrd-cyan); outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .mrd-intro { display: none !important; }
  .mrd-motion [data-mrd="rise"] { opacity: 1 !important; transform: none !important; transition: none; }
  .mrd-motion [data-mrd="drift"] { transform: none !important; }
  .mrd-motion [data-mrd="parallax"] { background-position-y: 50% !important; }
  .mrd-motion [data-mrd="rule"]::after { transition: none; width: 68px; }
  [data-mrd="cta"]::after { animation: none; }
  [data-mrd="card"] { transition: none; }
  .mrd-progress { display: none; }
}

/* ---- corrections to the conversion ----------------------------------------
   Website developed by pressific.com Emily Park, Dileep C. Kaluaratchie and Tech Generation Ltd.

   Lining the Book an appointment button up with the nav.

   The nav is a block <ul> of inline-block <li>s. The links carry
   padding-bottom: 43px against a 14px line-height, so their text sits near the
   top of a 57px box while the button is a 37px box with its text centred.
   Matching the boxes is therefore wrong: centring them (vertical-align:middle)
   agrees on the box centres and puts the button's text 21px BELOW the links,
   and the browser default (baseline) puts it 12px above.

   So align the tops and lift the button by half the difference between the
   link's line box and the button's own height, which is what puts the two runs
   of text on the same line:

       (14px line-height - 37px button) / 2  =  -11.5px

   Measured against the text rectangles rather than the element boxes, because
   the text is what the eye lines up.                                         */
header nav > ul > li { vertical-align: top; }
header nav > ul > li:last-child { margin-top: -12px; }

/* ---- the rebuilt testimonials carousel ------------------------------------
   Controls for the carousel whose behaviour was lost with the theme's
   JavaScript. Styled in the site's own cyan and orange.                      */
.mrd-slider__nav {
  display: flex; align-items: center; justify-content: center; gap: 1.1rem;
  margin: 1.2rem auto 0;
  position: relative; z-index: 5;
}
.mrd-slider__arrow {
  width: 2.6rem; height: 2.6rem;
  display: grid; place-items: center;
  font-size: 1.6rem; line-height: 1;
  color: #fff; background: transparent;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
  cursor: pointer;
  transition: background .3s var(--mrd-ease), border-color .3s var(--mrd-ease), color .3s var(--mrd-ease);
}
.mrd-slider__arrow:hover { background: #fff; border-color: #fff; color: var(--mrd-cyan); }
.mrd-slider__arrow:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.mrd-slider__dots { display: flex; align-items: center; gap: .5rem; }
.mrd-slider__dot {
  width: 9px; height: 9px; padding: 0;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .45);
  cursor: pointer;
  transition: background .3s ease, transform .3s var(--mrd-ease);
}
.mrd-slider__dot.is-on { background: #fff; transform: scale(1.35); }
.mrd-slider__dot:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .mrd-slider__arrow, .mrd-slider__dot { transition: none; }
}

/* ---- her swashes, drawing themselves ---------------------------------------
   The dash length is set per path in JavaScript from the path's own measured
   length, because every swash is a different length. All the stylesheet does
   is run the offset to zero once the heading is on screen, and put it back
   when it leaves, so it draws again on the way up.                           */
.mrd-motion [data-mrd="swash"] path[data-mrd-draw] {
  transition: stroke-dashoffset 1.2s cubic-bezier(.25,.46,.45,.94) .15s;
}
.mrd-motion [data-mrd="swash"].is-in path[data-mrd-draw] { stroke-dashoffset: 0 !important; }

/* ---- ambient leaves --------------------------------------------------------
   Behind the content of the illustrated bands, never interactive, and never in
   the document flow, so no box on the page moves because of it.              */
.mrd-leaves {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

@media (prefers-reduced-motion: reduce) {
  .mrd-motion [data-mrd="swash"] path[data-mrd-draw] { stroke-dashoffset: 0 !important; transition: none; }
  .mrd-leaves { display: none; }
}

/* ---- moving between pages ---------------------------------------------------
   Website developed by pressific.com Emily Park, Dileep C. Kaluaratchie and Tech Generation Ltd.

   A cross-document view transition: the browser holds the old page, builds the
   new one, and animates between them, so there is no white flash and no sense
   of a document being fetched. Paired with the prerendering in mrd-instant.js
   the click lands on a page that already exists.

   Progressive by nature. A browser without view transitions ignores all of this
   and navigates the way it always did, so there is nothing to fail safe.       */

@view-transition { navigation: auto; }

/* The header is the constant: naming the logo and the nav means the browser
   holds them still and morphs them rather than cross-fading them out and back,
   which is what makes the site read as one surface instead of five documents. */
header .mrd-vt-logo { view-transition-name: mrd-logo; }
header nav          { view-transition-name: mrd-nav; }

/* the body of the page is what actually changes, so that is what moves */
::view-transition-old(root) { animation: mrd-out .28s cubic-bezier(.4,0,1,1) both; }
::view-transition-new(root) { animation: mrd-in .42s cubic-bezier(0,0,.2,1) both; }
@keyframes mrd-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes mrd-in { from { opacity: 0; transform: translateY(10px); } }

/* the header parts glide rather than fade */
::view-transition-group(mrd-logo),
::view-transition-group(mrd-nav) { animation-duration: .42s; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  ::view-transition-group(*) { animation-duration: 0.01ms; }
}
