/* Dekalb Chiropractic: motion layer (global). Everything here sits behind prefers-reduced-motion: no-preference and html:not(.dkc-fx-off).
   Scroll-driven effects run on the compositor (animation-timeline), so they cost no JavaScript. */

/* ---------- footer switch ---------- */
.dkc-fxswitch { flex-basis: 100%; }
.dkc-fxswitch__btn { min-height: 44px; padding: 8px 16px; border: 1px solid #5d7a86; background: transparent; color: #fff; font: 500 .9rem var(--body); cursor: pointer; }
.dkc-fxswitch__btn:hover { background: #1b3944; }
.dkc-foot .dkc-fxswitch__btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* ---------- page transitions: a goniometer arm sweeps the new page into view ---------- */
@media (prefers-reduced-motion: no-preference) {
	::view-transition-old(root) { animation: dkc-dim .75s ease-in both; }
	::view-transition-new(root) { animation: dkc-sweep .75s linear both; mix-blend-mode: normal; }
	::view-transition-group(dkc-header) { animation-duration: 0s; }
	.dkc-header { view-transition-name: dkc-header; }
	@media (max-width: 767px) { .dkc-callbar { view-transition-name: dkc-callbar; } }
	@keyframes dkc-dim { to { opacity: .45; } }
	@keyframes dkc-sweep {
		0%   { clip-path: polygon(0 100%, 300vw 100%, 300vw calc(100% - 300vw * tan(0.5deg))); }
		15%  { clip-path: polygon(0 100%, 300vw 100%, 300vw calc(100% - 300vw * tan(8deg))); }
		30%  { clip-path: polygon(0 100%, 300vw 100%, 300vw calc(100% - 300vw * tan(16deg))); }
		45%  { clip-path: polygon(0 100%, 300vw 100%, 300vw calc(100% - 300vw * tan(25deg))); }
		60%  { clip-path: polygon(0 100%, 300vw 100%, 300vw calc(100% - 300vw * tan(34deg))); }
		72%  { clip-path: polygon(0 100%, 300vw 100%, 300vw calc(100% - 300vw * tan(45deg))); }
		84%  { clip-path: polygon(0 100%, 300vw 100%, 300vw calc(100% - 300vw * tan(62deg))); }
		94%  { clip-path: polygon(0 100%, 300vw 100%, 300vw calc(100% - 300vw * tan(78deg))); }
		100% { clip-path: polygon(0 100%, 300vw 100%, 300vw calc(100% - 300vw * tan(89.9deg))); }
	}
}

/* ---------- scroll choreography (CSS scroll-driven; unsupported browsers keep the finished state) ---------- */
@media (prefers-reduced-motion: no-preference) {
	@supports (animation-timeline: view()) {
		/* rulers draw tick by tick as they enter */
		html:not(.dkc-fx-off) body:not(.dkc-no-choreo) .dkc-ruler:not(.dkc-banner .dkc-ruler) { animation: dkc-draw linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
		html:not(.dkc-fx-off) body:not(.dkc-no-choreo) .dkc-fig::after { animation: dkc-draw linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
		@keyframes dkc-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

		/* the orange arm of every label sweeps from lying flat to its measured angle */
		html:not(.dkc-fx-off) body:not(.dkc-no-choreo) .dkc-kicker::after { animation: dkc-arm linear both; animation-timeline: view(); animation-range: entry 10% entry 110%; }
		@keyframes dkc-arm { from { transform: rotate(49deg); } to { transform: rotate(0); } }
		html:not(.dkc-fx-off) body:not(.dkc-no-choreo) .dkc-arc__arm { transform-box: view-box; transform-origin: 40px 40px; animation: dkc-arm2 linear both; animation-timeline: view(); animation-range: entry 0% cover 55%; }
		@keyframes dkc-arm2 { from { transform: rotate(48.7deg); } to { transform: rotate(0); } }

		/* parallax depth: service photos drift inside their frame; the hero's photo and words part slowly */
		html:not(.dkc-fx-off) body:not(.dkc-no-choreo) .dkc-frame__ph img { animation: dkc-par linear both; animation-timeline: view(); animation-range: cover; }
		@keyframes dkc-par { from { transform: translateY(-6%) scale(1.14); } to { transform: translateY(6%) scale(1.14); } }
		html:not(.dkc-fx-off) body:not(.dkc-no-choreo) .dkc-hero__media { animation: dkc-heromedia linear both; animation-timeline: scroll(root); animation-range: 0 520px; }
		html:not(.dkc-fx-off) body:not(.dkc-no-choreo) .dkc-hero__text { animation: dkc-herotext linear both; animation-timeline: scroll(root); animation-range: 0 520px; }
		@keyframes dkc-heromedia { to { transform: translateY(46px); } }
		@keyframes dkc-herotext { to { transform: translateY(-22px); } }
	}
	/* staggered rise for cards and list rows (class added by motion.js only when they start below the fold) */
	html:not(.dkc-fx-off) body:not(.dkc-no-choreo) .dkc-pop { opacity: 0; transform: translateY(26px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i, 0) * 80ms); }
	html:not(.dkc-fx-off) body:not(.dkc-no-choreo) .dkc-pop.is-in { opacity: 1; transform: none; }
}
.dkc-frame__ph { display: block; overflow: hidden; }
.dkc-frame__ph img { display: block; }

/* ---------- pointer effects: glow, tilt (motion.js adds .dkc-fine only for a mouse) ---------- */
.dkc-glow { position: relative; overflow: clip; --glow: rgba(27, 96, 120, .16); }
.dkc-glow > *:not(.dkc-glow__orb) { position: relative; z-index: 1; }
.dkc-glow__orb { position: absolute; left: 0; top: 0; width: 560px; height: 560px; margin: -280px 0 0 -280px; border-radius: 50%; background: radial-gradient(closest-side, var(--glow), transparent); opacity: 0; transition: opacity .5s; pointer-events: none; z-index: 0; will-change: transform; }
.dkc-glow.is-lit > .dkc-glow__orb { opacity: 1; }
.dkc-fx-off .dkc-glow__orb { display: none; }
.dkc-fine .dkc-svc__card { transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s; transform-style: preserve-3d; will-change: transform; }
.dkc-fine .dkc-svc__card.is-tilt { box-shadow: 0 22px 40px rgba(16, 39, 47, .16); transition: transform .08s linear, box-shadow .3s; }
.dkc-svc { perspective: 1100px; }
.dkc-fx-off .dkc-svc__card { transform: none !important; }
.dkc-fx-off *, .dkc-fx-off *::before, .dkc-fx-off *::after { scroll-behavior: auto !important; }
.dkc-fx-off .dkc-rise { opacity: 1; transform: none; transition: none; }

/* ---------- primary buttons: the cut top-right corner opens wider and a darker flap folds over it on hover and keyboard focus.
   Resting look is unchanged. Only clip-path and a transform move (no layout shift); instant with reduced motion; plain hover when the footer switch is off. ---------- */
html:not(.dkc-fx-off) body:not(.dkc-no-pointer) :is(.dkc-btn--solid, .wp-block-button:not(.is-style-outline) .wp-block-button__link) { position: relative; transition: background-color .15s, color .15s, clip-path .26s cubic-bezier(.2, .8, .2, 1); }
html:not(.dkc-fx-off) body:not(.dkc-no-pointer) :is(.dkc-btn--solid, .wp-block-button:not(.is-style-outline) .wp-block-button__link)::after { content: ""; position: absolute; top: 0; right: 0; width: 24px; height: 24px; pointer-events: none; background: linear-gradient(45deg, #0a2e3b 50%, transparent 50%); transform: scale(0); transform-origin: 0 100%; transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
html:not(.dkc-fx-off) body:not(.dkc-no-pointer) :is(.dkc-btn--solid, .wp-block-button:not(.is-style-outline) .wp-block-button__link):focus-visible { clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 0 100%); }
html:not(.dkc-fx-off) body:not(.dkc-no-pointer) :is(.dkc-btn--solid, .wp-block-button:not(.is-style-outline) .wp-block-button__link):focus-visible::after { transform: scale(1); }
@media (hover: hover) {
	html:not(.dkc-fx-off) body:not(.dkc-no-pointer) :is(.dkc-btn--solid, .wp-block-button:not(.is-style-outline) .wp-block-button__link):hover { clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 0 100%); }
	html:not(.dkc-fx-off) body:not(.dkc-no-pointer) :is(.dkc-btn--solid, .wp-block-button:not(.is-style-outline) .wp-block-button__link):hover::after { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
	:is(.dkc-btn--solid, .wp-block-button:not(.is-style-outline) .wp-block-button__link), :is(.dkc-btn--solid, .wp-block-button:not(.is-style-outline) .wp-block-button__link)::after { transition: none !important; }
}
