/* Motion & interaction layer for the Alexander Auto Care landing page.
   Everything here is keyed off data-aac-* attributes set by enhance.js,
   so the compiled React bundle is left untouched. */

:root {
  --aac-orange: #F05A24;
  --aac-navy: #0B1A2C;
  --aac-ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Scroll progress bar ---------- */
.aac-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 60;
  pointer-events: none;
  transform-origin: 0 50%;
  transform: scaleX(var(--aac-progress, 0));
  background: linear-gradient(90deg, var(--aac-orange), #ffb08f);
  box-shadow: 0 0 10px rgba(240, 90, 36, .6);
}

/* ---------- Header ---------- */
header[data-aac-scrolled] {
  transition: box-shadow .3s ease;
}
header[data-aac-scrolled="true"] {
  box-shadow: 0 10px 30px -18px rgba(11, 26, 44, .45);
}
header nav a {
  position: relative;
}
header nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 3px;
  border-radius: 2px;
  background: var(--aac-orange);
  transform: scaleX(0) skewX(-18deg);
  transform-origin: 0 50%;
  transition: transform .35s var(--aac-ease);
}
header nav a:hover::after,
header nav a[data-aac-active="true"]::after {
  transform: scaleX(1) skewX(-18deg);
}

/* ---------- Scroll reveal ---------- */
[data-aac-reveal] {
  opacity: 0;
  translate: 0 28px;
  transition:
    opacity .7s var(--aac-ease) var(--aac-delay, 0ms),
    translate .7s var(--aac-ease) var(--aac-delay, 0ms);
}
[data-aac-reveal="left"] { translate: -32px 0; }
[data-aac-reveal="right"] { translate: 32px 0; }
[data-aac-reveal="pop"] { translate: 0 0; scale: .85; transition-property: opacity, scale; }
[data-aac-reveal][data-aac-in="true"] {
  opacity: 1;
  translate: 0 0;
  scale: 1;
}

/* Hero headline highlight sweeps in behind "before" */
#top h1 span[aria-hidden] {
  transform-origin: 0 50%;
  animation: aac-sweep .8s .35s var(--aac-ease) both;
}
@keyframes aac-sweep {
  from { scale: 0 1; }
  to { scale: 1 1; }
}

/* Hero report card drifts with the pointer */
[data-aac-parallax] {
  transition: translate .6s var(--aac-ease);
}

/* ---------- How it works: line draws, steps pop ---------- */
[data-aac-steps] > span[aria-hidden] {
  transition: scale 1.4s var(--aac-ease) .15s;
}
[data-aac-steps] > span[aria-hidden]:first-child { transform-origin: 0 50%; scale: 0 1; }
[data-aac-steps] > span[aria-hidden]:nth-child(2) { transform-origin: 50% 0; scale: 1 0; }
[data-aac-steps][data-aac-in="true"] > span[aria-hidden] { scale: 1 1; }

[data-aac-steps] > li > span:first-child {
  transition: scale .5s cubic-bezier(.34, 1.56, .64, 1), background-color .3s ease;
  scale: 0;
}
[data-aac-steps][data-aac-in="true"] > li > span:first-child { scale: 1; }
[data-aac-steps] > li:nth-of-type(1) > span:first-child { transition-delay: .2s; }
[data-aac-steps] > li:nth-of-type(2) > span:first-child { transition-delay: .5s; }
[data-aac-steps] > li:nth-of-type(3) > span:first-child { transition-delay: .8s; }
[data-aac-steps] > li:nth-of-type(4) > span:first-child { transition-delay: 1.1s; }
[data-aac-steps] > li:hover > span:first-child {
  background-color: var(--aac-orange);
  color: var(--aac-navy);
  transition-delay: 0s;
}

/* ---------- What we check: checklist items cascade in on every tab ---------- */
[role="tabpanel"] li {
  animation: aac-rise .45s var(--aac-ease) both;
}
[role="tabpanel"] li:nth-child(1) { animation-delay: .08s; }
[role="tabpanel"] li:nth-child(2) { animation-delay: .14s; }
[role="tabpanel"] li:nth-child(3) { animation-delay: .2s; }
[role="tabpanel"] li:nth-child(4) { animation-delay: .26s; }
[role="tabpanel"] li:nth-child(5) { animation-delay: .32s; }
[role="tabpanel"] li:nth-child(6) { animation-delay: .38s; }
[role="tabpanel"] li:nth-child(7) { animation-delay: .44s; }
[role="tabpanel"] li:nth-child(8) { animation-delay: .5s; }
[role="tabpanel"] li > span:first-child {
  animation: aac-tick .5s cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: inherit;
}
@keyframes aac-rise {
  from { opacity: 0; translate: 0 12px; }
  to { opacity: 1; translate: 0 0; }
}
@keyframes aac-tick {
  from { scale: 0; rotate: -45deg; }
  to { scale: 1; rotate: 0deg; }
}
[role="tab"] {
  transition: translate .25s var(--aac-ease), background-color .2s, color .2s, box-shadow .2s;
}
[role="tab"]:hover { translate: 4px 0; }
[role="tab"][aria-selected="true"] { box-shadow: inset 4px 0 0 var(--aac-orange); }

/* Auto-tour progress line on the active tab */
[role="tab"][data-aac-touring="true"] { position: relative; overflow: hidden; }
[role="tab"][data-aac-touring="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--aac-orange);
  transform-origin: 0 50%;
  animation: aac-tour var(--aac-tour-ms, 4500ms) linear both;
}
@keyframes aac-tour {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ---------- Cards: lift + pointer spotlight ---------- */
[data-aac-card] {
  position: relative;
  isolation: isolate;
  transition: transform .35s var(--aac-ease), filter .35s var(--aac-ease), color .2s, background-color .2s, box-shadow .2s;
}
[data-aac-card][data-aac-reveal] {
  transition:
    opacity .7s var(--aac-ease) var(--aac-delay, 0ms),
    translate .7s var(--aac-ease) var(--aac-delay, 0ms),
    transform .35s var(--aac-ease), filter .35s var(--aac-ease), color .2s, background-color .2s, box-shadow .2s;
}
[data-aac-card]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
  background: radial-gradient(260px circle at var(--aac-mx, 50%) var(--aac-my, 50%), rgba(240, 90, 36, .14), transparent 70%);
}
[data-aac-card]:hover {
  transform: translateY(-6px);
  filter: drop-shadow(0 18px 22px rgba(11, 26, 44, .18));
}
[data-aac-card]:hover::before { opacity: 1; }

/* Report feature icons wobble on hover */
[data-aac-icon] { transition: rotate .4s cubic-bezier(.34, 1.56, .64, 1), scale .4s cubic-bezier(.34, 1.56, .64, 1); }
[data-aac-icon-host]:hover [data-aac-icon] { rotate: -8deg; scale: 1.1; }

/* Areas strip: names hop on hover */
[data-aac-areas] > span { transition: translate .25s var(--aac-ease), color .2s; cursor: default; }
[data-aac-areas] > span:hover { translate: 0 -3px; color: #B8461A; }

/* ---------- Dark sections: soft glow follows the pointer ---------- */
[data-aac-glow] { position: relative; }
[data-aac-glow]::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  transition: opacity .4s ease;
  background: radial-gradient(520px circle at var(--aac-mx, 50%) var(--aac-my, 50%), rgba(240, 90, 36, .16), transparent 65%);
}
[data-aac-glow]:hover::before { opacity: 1; }

/* Price tag gets a gentle shine */
[data-aac-price] { position: relative; overflow: hidden; }
[data-aac-price]::after {
  content: "";
  position: absolute;
  inset: -20% auto -20% -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-18deg);
  animation: aac-shine 4.5s 1.5s ease-in-out infinite;
}
@keyframes aac-shine {
  0%, 70% { left: -60%; }
  100% { left: 130%; }
}

/* ---------- Plate input ---------- */
form label[for^="reg-"] {
  transition: box-shadow .25s ease, translate .25s var(--aac-ease);
}
form label[for^="reg-"]:focus-within {
  translate: 0 -2px;
  box-shadow: 0 4px 0 #0B1A2C, 0 0 0 4px rgba(240, 90, 36, .35);
}
form[data-aac-valid="true"] label[for^="reg-"] {
  box-shadow: 0 4px 0 #0B1A2C, 0 0 0 4px rgba(240, 90, 36, .6);
}
form[data-aac-valid="true"] button[type="submit"] {
  animation: aac-nudge 1.6s ease-in-out infinite;
}
@keyframes aac-nudge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 90, 36, .55); }
  50% { box-shadow: 0 0 0 10px rgba(240, 90, 36, 0); }
}

/* Buttons press down */
#root a[href^="#book"]:active,
#root button:active,
#root a[class*="rounded"]:active {
  scale: .97;
}

/* ---------- Floating "Book" button ---------- */
.aac-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 14px 18px;
  border-radius: 999px;
  background: var(--aac-orange);
  color: var(--aac-navy);
  font: 700 16px/1 Saira, Arial, sans-serif;
  text-decoration: none;
  box-shadow: 0 16px 30px -12px rgba(11, 26, 44, .55);
  translate: 0 140%;
  opacity: 0;
  transition: translate .45s var(--aac-ease), opacity .3s ease, background-color .2s;
}
.aac-fab[data-show="true"] { translate: 0 0; opacity: 1; }
.aac-fab:hover { background: #ff7a48; }
.aac-fab:focus-visible { outline: 3px solid var(--aac-navy); outline-offset: 3px; }
.aac-fab__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--aac-navy);
  box-shadow: 0 0 0 0 rgba(11, 26, 44, .5);
  animation: aac-ping 2s ease-out infinite;
}
@keyframes aac-ping {
  0% { box-shadow: 0 0 0 0 rgba(11, 26, 44, .45); }
  100% { box-shadow: 0 0 0 10px rgba(11, 26, 44, 0); }
}

/* ---------- Reduced motion: keep it calm ---------- */
@media (prefers-reduced-motion: reduce) {
  [data-aac-reveal],
  [data-aac-steps] > span[aria-hidden],
  [data-aac-steps] > li > span:first-child {
    opacity: 1 !important;
    translate: none !important;
    scale: none !important;
    transition: none !important;
  }
  #top h1 span[aria-hidden],
  [role="tabpanel"] li,
  [role="tabpanel"] li > span:first-child,
  [data-aac-price]::after,
  form[data-aac-valid="true"] button[type="submit"],
  .aac-fab__dot,
  [role="tab"][data-aac-touring="true"]::after {
    animation: none !important;
  }
  [data-aac-card]:hover { transform: none; }
  [role="tab"]:hover { translate: none; }
}
