/* ==========================================================================
   GT Physical Therapy — motion layer (November 2026)
   Loaded after gtpt.css. Everything here is additive: remove this file and
   gtpt-motion.js and the site is exactly the October design.
   Part 1 is plain styling for the "Where does it hurt?" figure.
   Part 2 is movement, and only applies when the visitor has not asked their
   device to reduce motion.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Body map (works with no JavaScript and with reduced motion)
   -------------------------------------------------------------------------- */
.bodymap { --bone: #8A87B8; --bm-bg: var(--mist); margin-top: 0.75rem; }
p.bm-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-h3); line-height: 1.2; color: var(--navy); }
.bm-stage { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.25rem; align-items: start; margin-top: 0.75rem; }
/* width is worked out from the height (no aspect-ratio, so older iPhones size it correctly) */
.bm-figure { --bm-h: 33rem; position: relative; height: var(--bm-h); width: calc(var(--bm-h) * 0.2246); }
.bm-figure svg { display: block; width: 100%; height: 100%; overflow: visible; }

.bm-s { fill: none; stroke: var(--bone); stroke-linecap: round; }
.bm-f { fill: var(--bone); }
.bm-rib { fill: none; stroke: var(--bone); stroke-width: 2.2; stroke-linecap: round; }
.bm-body { fill: var(--navy); }
.bm-sp { fill: var(--navy); opacity: 0.55; }
.bm-sacrum { fill: var(--navy); opacity: 0.8; }
.bm-eye { fill: var(--bm-bg); }
.bm-scap { opacity: 0.6; stroke: var(--bone); stroke-width: 6; stroke-linejoin: round; }
.bm-under { fill: none; stroke: var(--bm-bg); stroke-linecap: round; stroke-linejoin: round; }
.bm-jaw { stroke: var(--bm-bg); stroke-width: 1.6; }
.bm-nerve { fill: none; stroke: var(--gold-ink); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: var(--len, 234); stroke-dashoffset: var(--len, 234); opacity: 0; }

.bm-f, .bm-s, .bm-body, .bm-sacrum { transition: fill 0.2s ease, stroke 0.2s ease, opacity 0.2s ease; }
.bodymap[data-active="head"] .bm-cranium,
.bodymap[data-active="jaw"] .bm-jaw,
.bodymap[data-active="shoulder"] .bm-shoulder,
.bodymap[data-active="knee"] .bm-knee .bm-f,
.bodymap[data-active="heel"] .bm-foot,
.bodymap[data-active="neck"] .bm-cerv .bm-body,
.bodymap[data-active="back"] .bm-lumb .bm-body,
.bodymap[data-active="back"] .bm-sacrum { fill: var(--gold); stroke: var(--navy); stroke-width: 1.4; opacity: 1; }
.bodymap[data-active="shoulder"] .bm-scap { fill: var(--gold); stroke: var(--gold); opacity: 0.85; }
.bodymap[data-active="sciatica"] .bm-nerve { opacity: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 0.9s ease, opacity 0.15s; }

.bm-dot { fill: var(--gold); stroke: var(--navy); stroke-width: 2.4; transform-box: fill-box; transform-origin: center; }
.bm-dot.is-on { fill: var(--navy); stroke: var(--gold); stroke-width: 3.2; }

/* Tap targets: 44px circles centred on each dot */
.bm-spot {
  position: absolute; width: 2.75rem; height: 2.75rem; margin: -1.375rem 0 0 -1.375rem; padding: 0;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none; appearance: none; touch-action: manipulation;
}
.bm-spot:hover, .bm-spot[aria-pressed="true"] { background: rgba(217, 171, 82, 0.2); }
.bm-spot:focus-visible { outline: 3px solid var(--navy); outline-offset: -4px; }
.bm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); -webkit-clip-path: inset(50%); clip-path: inset(50%); white-space: nowrap; }

.bm-panel { container-type: inline-size; align-self: center; min-width: 0; }
.bodymap .bm-hint { color: var(--ink-soft); font-size: var(--fs-small); line-height: 1.5; }
.bodymap .bm-hint b { display: block; color: var(--navy); font-family: var(--font-display); font-size: 1.1875rem; line-height: 1.2; margin-bottom: 0.35rem; }
.bm-card { display: grid; gap: 0.35rem; justify-items: start; border-left: 3px solid var(--gold); padding-left: 0.85rem; }
.bm-card[hidden] { display: none; }
.bodymap .bm-name { font-family: var(--font-display); font-weight: 700; font-size: 1.3125rem; line-height: 1.15; color: var(--navy); overflow-wrap: anywhere; }
@media (max-width: 339px) { .bm-stage { gap: 0.75rem; } .bodymap .bm-name { font-size: 1.125rem; } .bm-card { padding-left: 0.6rem; } }
.bodymap .bm-desc { font-size: var(--fs-small); line-height: 1.45; color: var(--ink-soft); }
.bm-go { display: inline-block; padding-block: 0.35rem; }
/* Narrow card (phones): the button just says Call. The number is added only where it fits. */
.bm-call { min-height: 3rem; padding: 0.6rem 0.9rem; font-size: 1.0625rem; white-space: nowrap; width: 100%; }
.bm-num { display: none; }
@container (min-width: 14.5rem) { .bm-num { display: inline; } .bm-call { width: auto; } }

@media (min-width: 960px) {
  /* The heading column is sticky on desktop: size the figure to the window so it always fits. */
  .bm-figure { --bm-h: clamp(22rem, calc(100vh - 23rem), 33rem); }
}
.index-list li.is-hot a { background: var(--paper); }
.index-list li.is-hot .name { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }

/* --------------------------------------------------------------------------
   1b. Photos (second cut) and the tablet header
   -------------------------------------------------------------------------- */
/* Reviews photo is now a wide two-shot of both faces, so give it a wider frame and a bigger column */
.reviews-top .photo img { aspect-ratio: 4 / 3 !important; object-position: 50% 50% !important; }
@media (min-width: 700px) { .reviews-top { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); } }
/* Tablets: the clinic name wrapped onto four lines once the Book button was added. Keep it on one. */
@media (min-width: 561px) and (max-width: 1279px) { .site-header .brand-name strong { white-space: nowrap; } }
@media (min-width: 761px) and (max-width: 959px) {
  .site-header .brand-name span { display: none; }
  .site-header .header-row { gap: 0.75rem; }
  .site-header .header-call .num { display: none; }
  .site-header .header-call .short { display: inline; }
}

/* --------------------------------------------------------------------------
   2. Movement
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {

  /* Page-to-page cross-fade (browsers that don't support it just load the page) */
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: gt-vt-out 0.16s ease both; }
  ::view-transition-new(root) { animation: gt-vt-in 0.28s ease both; }
  .mo .site-header { view-transition-name: gt-header; }

  /* ---- Logo: plays once per visit, under 1.2 seconds. Uses the real logo, split into its two colours. ---- */
  .mo-first .site-header .brand { position: relative; }
  .mo-first .site-header .brand img { animation: gt-logo-swap 1.2s linear both; }
  .mo-first .site-header .brand::before,
  .mo-first .site-header .brand::after {
    content: ""; position: absolute; left: 0; top: 50%; width: 3.1rem; height: calc(3.1rem * 0.8727);
    margin-top: calc(3.1rem * -0.4364); pointer-events: none;
    background: url("gt-mark-tri.png") center / contain no-repeat;
    animation: gt-logo-tri 1.2s cubic-bezier(0.2, 0.8, 0.3, 1) both;
  }
  .mo-first .site-header .brand::after {
    background-image: url("gt-mark-fig.png");
    animation-name: gt-logo-fig; animation-timing-function: cubic-bezier(0.15, 0.85, 0.3, 1);
  }
  .mo-first .site-header .brand-name { animation: gt-name 0.5s 0.45s ease both; }
  @media (max-width: 560px) {
    .mo-first .site-header .brand::before,
    .mo-first .site-header .brand::after { width: 2.4rem; height: calc(2.4rem * 0.8727); margin-top: calc(2.4rem * -0.4364); }
  }

  /* ---- Header: stays on screen on tablets and desktops (phones already have the bottom call bar) ---- */
  @media (min-width: 761px) and (min-height: 600px) {   /* not on a phone held sideways */
    html.mo { scroll-padding-top: 6.5rem; }
    .mo .site-header { position: sticky; top: 0; }
    .mo .split > .sec-head { top: 6.5rem; }
  }
  .mo .site-header .brand img { transition: transform 0.25s ease; transform-origin: left center; }
  .mo.is-scrolled .site-header .brand img { transform: scale(0.88); }
  /* Gold reading-progress line: under the header, and on top of the phone call bar */
  .mo .site-header::after, .mo .call-bar::before {
    content: ""; position: absolute; left: 0; right: 0; height: 3px; background: var(--gold);
    transform: scaleX(var(--sp, 0)); transform-origin: left; pointer-events: none;
  }
  .mo .site-header::after { bottom: -2px; }
  .mo .call-bar::before { top: -2px; }

  /* ---- First screen: the headline, photo and buttons are never animated (they must show instantly). ---- */
  .mo .hc-card::before, .mo .hc-card::after { transform-origin: left; animation: gt-draw 0.9s 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .mo .hc-card::after { animation-delay: 0.5s; }
  .mo .hero--home .fact { animation: gt-rise 0.5s ease both; }
  .mo .hero--home .fact:nth-child(1) { animation-delay: 0.25s; }
  .mo .hero--home .fact:nth-child(2) { animation-delay: 0.35s; }
  .mo .hero--home .fact:nth-child(3) { animation-delay: 0.45s; }
  .mo .hero-actions .btn--primary svg { animation: gt-ring 0.8s 2.4s ease both; transform-origin: 50% 60%; }

  /* ---- Buttons and the conditions list ---- */
  .mo .btn { transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease, background-position 0.6s ease; }
  .mo .btn:active { transform: scale(0.975); }
  .mo .btn--gold {
    background-image: linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, 0.5) 50%, transparent 60%);
    background-size: 260% 100%; background-position: 130% 0; background-repeat: no-repeat;
  }
  .mo .btn--gold:hover { background-position: -30% 0; }
  .mo .index-list a { position: relative; transition: padding-left 0.2s ease, background-color 0.15s ease; }
  .mo .index-list a::before {
    content: ""; position: absolute; left: 0; top: 0.6rem; bottom: 0.6rem; width: 3px; background: var(--gold);
    transform: scaleY(0); transition: transform 0.2s ease;
  }
  .mo .index-list a:hover, .mo .index-list li.is-hot a { padding-left: 0.85rem; }
  .mo .index-list a:hover::before, .mo .index-list li.is-hot a::before { transform: scaleY(1); }

  /* ---- Sections ease in as you scroll to them ---- */
  .rv { opacity: 0; transform: translateY(18px); }
  .rv.rv-in { opacity: 1; transform: none; transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1); transition-delay: var(--d, 0ms); }
  .mo .photo picture, .mo .dn-photos picture { display: block; overflow: hidden; }
  .rv picture img { transform: scale(1.08); }
  .rv.rv-in picture img { transform: none; transition: transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1); transition-delay: var(--d, 0ms); }
  .steps li.rv::before { transform: scale(0.5); }
  .steps li.rv.rv-in::before { transform: none; transition: transform 0.5s cubic-bezier(0.3, 1.5, 0.5, 1); transition-delay: calc(var(--d, 0ms) + 120ms); }
  .gt-star { display: inline-block; transform: scale(0) rotate(-40deg); }
  .rv-in .gt-star, .gt-stars-in .gt-star { transform: none; transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); transition-delay: calc(var(--n) * 90ms + 150ms); }

  /* ---- Body map: the spine stacks up from the pelvis, then the dots appear ---- */
  .bm-armed .bm-bone { opacity: 0; }
  .bm-armed .bm-sacrum { opacity: 0; }
  .bm-armed .bm-vi { opacity: 0; transform: translate(-18px, -8px); }
  .bm-armed .bm-dot { opacity: 0; transform: scale(0); }
  .bm-armed.is-in .bm-bone { opacity: 1; transition: opacity 0.5s ease; }
  .bm-armed.is-in .bm-sacrum { opacity: 0.8; transition: opacity 0.4s ease 0.15s; }
  .bm-armed.is-in .bm-vi { opacity: 1; transform: none; transition: opacity 0.2s ease, transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3); transition-delay: calc(0.3s + var(--i) * 36ms); }
  .bm-armed.is-in .bm-arm { transition-delay: 0.9s; }
  .bm-armed.is-in .bm-skull { transition-delay: 1.15s; }
  .bm-armed.is-in .bm-dot { opacity: 1; transform: none; transition: opacity 0.2s ease, transform 0.45s cubic-bezier(0.3, 1.7, 0.5, 1); transition-delay: calc(1.45s + var(--n, 0) * 80ms); }
  .bm-armed.is-in.is-done .bm-dot { transition-delay: 0s; }
  .bodymap.is-done:not([data-active]) .bm-dot { animation: gt-pulse 2.4s ease-in-out 3; animation-delay: calc(var(--n, 0) * 120ms); }
  .bm-card:not([hidden]) { animation: gt-rise 0.3s ease both; }

  @keyframes gt-vt-out { to { opacity: 0; } }
  @keyframes gt-vt-in { from { opacity: 0; } }
  @keyframes gt-logo-swap { 0%, 76% { opacity: 0; } 88%, 100% { opacity: 1; } }
  @keyframes gt-logo-tri {
    0% { opacity: 0; transform: scale(0.25) rotate(-150deg); }
    42% { opacity: 1; transform: scale(1.06) rotate(4deg); }
    55%, 90% { opacity: 1; transform: none; }
    100% { opacity: 0; transform: none; }
  }
  @keyframes gt-logo-fig {
    0%, 22% { opacity: 0; transform: translateX(-85%) skewX(-18deg); }
    58% { opacity: 1; transform: translateX(4%) skewX(3deg); }
    70%, 90% { opacity: 1; transform: none; }
    100% { opacity: 0; transform: none; }
  }
  @keyframes gt-name { from { opacity: 0; transform: translateX(-8px); } }
  @keyframes gt-draw { from { transform: scaleX(0); } }
  @keyframes gt-rise { from { opacity: 0; transform: translateY(10px); } }
  @keyframes gt-ring { 0%, 100% { transform: none; } 20% { transform: rotate(-16deg); } 40% { transform: rotate(14deg); } 60% { transform: rotate(-9deg); } 80% { transform: rotate(6deg); } }
  @keyframes gt-pulse { 0%, 100% { transform: none; } 50% { transform: scale(1.35); } }
}

/* Printing, or a browser that never reports scroll position: show everything */
@media print {
  .rv, .bm-armed .bm-bone, .bm-armed .bm-vi, .bm-armed .bm-dot { opacity: 1 !important; transform: none !important; }
  .bm-armed .bm-sacrum { opacity: 0.8 !important; }
}
