/* =========================================================
   SITE MOTION  (rules: .claude/skills/site-motion/SKILL.md)
   Loaded on every page after that page's own stylesheet.
   Only opacity and transform are animated, so the layout never shifts.
   ========================================================= */
:root {
  --m-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --m-fast: 180ms;     /* hover and focus feedback */
  --m-hero: 560ms;     /* hero load stagger */
  --m-reveal: 520ms;   /* scroll reveals */
  --m-rise: 16px;      /* how far things rise into place */
}

@keyframes m-rise {
  from { opacity: 0; transform: translateY(var(--m-rise)); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 1. HERO LOAD STAGGER ----------
   Runs only when motion.js has added "js-motion" to <html>.
   "backwards" keeps each item hidden during its delay and leaves no
   transform behind afterwards. */
html.js-motion :where(
  .md-kicker, .fq-kicker, .blogs-hero div > p:first-child,
  .hero-title, .service-hero-copy h1, .about-hero h1, .smiles-hero h1,
  .blogs-hero h1, .rt-hero h1, .md-hero h1, .fq-hero h1, .ar-hero h1,
  .hero-subtitle, .service-hero-copy p, .about-hero p, .smiles-hero p,
  .blogs-hero h1 + p, .rt-hero-text p, .md-hero-row, .fq-hero-intro, .ar-summary,
  .hero-content > .btn, .service-hero-copy .btn, .ar-meta
) {
  animation: m-rise var(--m-hero) var(--m-ease) backwards;
}
/* Step 1: eyebrow/kicker (0ms). Step 2: heading. Step 3: supporting text. Step 4: CTA.
   :where() keeps every rule here at the same specificity, so these delays
   reliably override the 0ms delay in the "animation" shorthand above. */
html.js-motion :where(.hero-title, .service-hero-copy h1, .about-hero h1, .smiles-hero h1,
  .blogs-hero h1, .rt-hero h1, .md-hero h1, .fq-hero h1, .ar-hero h1) { animation-delay: 90ms; }
html.js-motion :where(.hero-subtitle, .service-hero-copy p, .about-hero p, .smiles-hero p,
  .blogs-hero h1 + p, .rt-hero-text p, .md-hero-row, .fq-hero-intro, .ar-summary) { animation-delay: 180ms; }
html.js-motion :where(.hero-content > .btn, .service-hero-copy .btn, .ar-meta) { animation-delay: 270ms; }

/* ---------- 2. REVEAL ONCE ON SCROLL ----------
   motion.js adds .m-reveal only to elements that start below the fold,
   then adds .m-in when they scroll into view. */
.m-reveal {
  opacity: 0;
  transform: translateY(var(--m-rise));
  transition:
    opacity var(--m-reveal) var(--m-ease) var(--m-delay, 0ms),
    transform var(--m-reveal) var(--m-ease) var(--m-delay, 0ms);
}
.m-reveal.m-in { opacity: 1; transform: none; }

/* ---------- 3. HOVER AND KEYBOARD FOCUS FEEDBACK ---------- */
/* Buttons: colour/shadow change and a 1px lift */
:is(.btn, .form-btn, .rt-form button, .fq-form button, .newsletter-form button,
    .about-book-form button, .blog-read-more, .blog-load-more, .circle-btn, .round-btn,
    .contact-btn, .service-urgent a, .dialog-close) {
  transition:
    color var(--m-fast) var(--m-ease),
    background-color var(--m-fast) var(--m-ease),
    border-color var(--m-fast) var(--m-ease),
    box-shadow var(--m-fast) var(--m-ease),
    filter var(--m-fast) var(--m-ease),
    transform var(--m-fast) var(--m-ease);
}
@media (hover: hover) {
  :is(.btn, .form-btn, .rt-form button, .fq-form button, .newsletter-form button,
      .about-book-form button, .blog-load-more, .circle-btn, .round-btn,
      .contact-btn, .service-urgent a):hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px -10px rgba(9, 46, 58, 0.55);
  }
  /* Blog card links cover the whole card, so they get shadow and colour only (no lift) */
  .blog-read-more:hover { box-shadow: 0 8px 18px -10px rgba(9, 46, 58, 0.7); background-color: #0e4759; }
}
:is(.btn, .form-btn, .rt-form button, .fq-form button, .newsletter-form button,
    .about-book-form button, .blog-read-more, .blog-load-more, .circle-btn, .round-btn,
    .contact-btn, .service-urgent a):active {
  transform: none;
  box-shadow: none;
}

/* Text links: colour/opacity only (no movement) */
:is(.main-nav a, .footer-links a, .footer-contact a, .text-link, .media-link, .faq-all,
    .socials a, .logo, .pg-back, .team-next, .fq-question span, .fq-answer a) {
  transition:
    color var(--m-fast) var(--m-ease),
    opacity var(--m-fast) var(--m-ease),
    background-color var(--m-fast) var(--m-ease);
}
@media (hover: hover) {
  :is(.socials a, .logo):hover { opacity: 0.75; }
  .pg-back:hover { background-color: rgba(63, 71, 74, 0.08); }
  .text-link:hover img, .media-link:hover, .faq-all:hover { opacity: 0.85; }
}

/* One clear focus ring for keyboard users (zero specificity, so page rules still win) */
:where(a, button, summary, input, textarea, select):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* ---------- 4. SERVICES PAGE FAQ (<details>) ----------
   Smooth open/close in browsers that can animate to "auto" height;
   other browsers simply open instantly, as before. */
@supports (interpolate-size: allow-keywords) {
  .faq-list details { interpolate-size: allow-keywords; }
  .faq-list details::details-content {
    height: 0;
    overflow: clip;
    transition: height 240ms var(--m-ease), content-visibility 240ms allow-discrete;
  }
  .faq-list details[open]::details-content { height: auto; }
}

/* ---------- 5. REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  html.js-motion *,
  html.js-motion *::before,
  html.js-motion *::after { animation: none !important; }
  .m-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  :is(.btn, .form-btn, .rt-form button, .fq-form button, .newsletter-form button,
      .about-book-form button, .blog-read-more, .blog-load-more, .circle-btn, .round-btn,
      .contact-btn, .service-urgent a):hover { transform: none !important; }
  .faq-list details::details-content { transition: none !important; }
  /* Homepage seal stays at Figma's angle */
  .stamp-seal-turn { transform: none !important; }
}

/* ---------- 6. PRINT: always show everything ---------- */
@media print {
  .m-reveal { opacity: 1 !important; transform: none !important; }
}
