/* ============================================================================
   Pilot Gas Adelaide — Motion / Animation System
   ============================================================================
   Scroll-reveals (IntersectionObserver triggers .in-view), hero polish,
   staggered entrance, micro-interactions, marquee, shimmer.
   All motion respects prefers-reduced-motion.
   ========================================================================== */

/* ---------- Reveal primitives --------------------------------------------- */
/* Progressive enhancement:
   - No JS: fully visible (safest).
   - JS loaded: elements start SLIGHTLY dimmed/shifted, animate to full when observed.
   - Content is readable at all times even if animations never play. */
.js .reveal,
.js .reveal-up,
.js .reveal-left,
.js .reveal-right,
.js .reveal-scale {
  opacity: 0.01;
  transition:
    opacity 700ms var(--ease-out),
    transform 700ms var(--ease-out),
    filter 700ms var(--ease-out);
  will-change: opacity, transform;
}
.js .reveal-up { transform: translate3d(0, 24px, 0); }
.js .reveal-left { transform: translate3d(-24px, 0, 0); }
.js .reveal-right { transform: translate3d(24px, 0, 0); }
.js .reveal-scale { transform: scale(0.98); }

.reveal.in-view,
.reveal-up.in-view,
.reveal-left.in-view,
.reveal-right.in-view,
.reveal-scale.in-view {
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) scale(1) !important;
  filter: blur(0) !important;
}

/* Stagger children — use on a parent with class="stagger" */
.js .stagger > * {
  opacity: 0.01;
  transform: translate3d(0, 18px, 0);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}
.stagger.in-view > * { opacity: 1 !important; transform: none !important; }
.stagger.in-view > *:nth-child(1) { transition-delay: 60ms; }
.stagger.in-view > *:nth-child(2) { transition-delay: 140ms; }
.stagger.in-view > *:nth-child(3) { transition-delay: 220ms; }
.stagger.in-view > *:nth-child(4) { transition-delay: 300ms; }
.stagger.in-view > *:nth-child(5) { transition-delay: 380ms; }
.stagger.in-view > *:nth-child(6) { transition-delay: 460ms; }
.stagger.in-view > *:nth-child(7) { transition-delay: 540ms; }
.stagger.in-view > *:nth-child(8) { transition-delay: 620ms; }
.stagger.in-view > *:nth-child(9) { transition-delay: 700ms; }
.stagger.in-view > *:nth-child(10) { transition-delay: 780ms; }

/* ---------- Hero composition --------------------------------------------- */
.hero {
  background:
    radial-gradient(1200px 500px at 90% -10%, rgba(232, 83, 15, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(15, 27, 45, 0.08), transparent 60%),
    linear-gradient(180deg, var(--c-cream) 0%, #fff 100%);
}
.hero::before {
  /* subtle diagonal "ember" texture */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(232, 83, 15, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at 80% 0%, #000 0%, transparent 65%);
  -webkit-mask-image: radial-gradient(ellipse at 80% 0%, #000 0%, transparent 65%);
  pointer-events: none;
  opacity: 0.6;
}

/* Hero flex layout — copy left, photo right */
@media (min-width: 960px) {
  .hero .container {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--sp-12);
    align-items: center;
  }
  .hero-content { max-width: 640px; }
  .hero h1 {
    font-size: clamp(2.25rem, 3.4vw, 3.5rem);
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}
@media (min-width: 1280px) {
  .hero .container { gap: var(--sp-16); }
  .hero-content { max-width: 680px; }
}
.hero-visual {
  position: relative;
  aspect-ratio: 4 / 5;
  max-height: 640px;
  border-radius: var(--r-xl);
  overflow: visible;
  transform: translateZ(0);
}
.hero-visual > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r-xl);
  box-shadow:
    0 30px 60px rgba(15, 27, 45, 0.18),
    0 10px 20px rgba(15, 27, 45, 0.1);
  transition: transform 1200ms var(--ease-out);
}
.hero-visual:hover > img { transform: scale(1.02); }

/* Hero badges that float over the image (kept inside bounds so nothing gets cut off) */
.hero-badge {
  position: absolute;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: 0 12px 30px rgba(15, 27, 45, 0.18);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--c-navy);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
  animation: floaty 6s ease-in-out infinite;
  z-index: 2;
}
.hero-badge .icon { color: var(--c-primary); }
.hero-badge-1 { top: 6%; left: 4%; }
.hero-badge-2 { bottom: 22%; right: 4%; animation-delay: -3s; }
.hero-badge-3 { bottom: 6%; left: 28%; animation-delay: -1.5s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@media (max-width: 959px) {
  .hero-visual {
    margin-top: var(--sp-8);
    aspect-ratio: 4 / 3;
    max-height: 420px;
  }
}

/* Hero h1 gradient sweep on the accent word */
.hero h1 .hero-accent {
  background: linear-gradient(100deg, var(--c-primary) 0%, #FFA24A 40%, var(--c-primary) 80%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  animation: sweep 6s linear infinite;
}
@keyframes sweep {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ---------- Trust bar marquee --------------------------------------------- */
.trust-bar { overflow: hidden; }
.trust-bar-marquee {
  display: flex;
  gap: var(--sp-8);
  animation: marquee 40s linear infinite;
  width: max-content;
}
.trust-bar-marquee:hover { animation-play-state: paused; }
@keyframes marquee {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

/* ---------- Cards — layered hover --------------------------------------- */
.card {
  position: relative;
  overflow: hidden;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%),
              rgba(232, 83, 15, 0.08), transparent 40%);
  opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-out);
  pointer-events: none;
}
.card:hover::after { opacity: 1; }
.card h3 { transition: color var(--dur-fast) var(--ease-out); }
.card:hover h3 { color: var(--c-primary-dark); }

/* ---------- Pill / chip buttons with shimmer ----------------------------- */
.btn-primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 900ms var(--ease-out);
  z-index: -1;
}
.btn-primary:hover::before { transform: translateX(100%); }

/* ---------- Phone button — gentle pulse so it reads as "click now" ------ */
.mobile-cta,
.btn-phone {
  position: relative;
}
.mobile-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(232, 83, 15, 0.6);
  animation: pulse 2.4s var(--ease-out) infinite;
  pointer-events: none;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 83, 15, 0.55); }
  70% { box-shadow: 0 0 0 18px rgba(232, 83, 15, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 83, 15, 0); }
}

/* ---------- Section divider (slanted wedge) ------------------------------ */
.section-divider {
  position: relative;
  height: 60px;
  overflow: hidden;
}
.section-divider svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- Before/After slider ----------------------------------------- */
.gallery-ba {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  aspect-ratio: 16 / 10;
  box-shadow: var(--shadow-md);
  cursor: ew-resize;
  user-select: none;
  touch-action: none;
}
.gallery-ba img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.gallery-ba .ba-after {
  clip-path: inset(0 0 0 var(--ba-pos, 50%));
  transition: clip-path 200ms linear;
}
.gallery-ba .ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--ba-pos, 50%);
  width: 3px;
  background: white;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
  pointer-events: none;
}
.gallery-ba .ba-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.gallery-ba .ba-handle::after {
  content: "⇆";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--c-navy);
  font-weight: 700;
  font-size: 1.2rem;
}
.gallery-ba .ba-label {
  position: absolute;
  top: var(--sp-3);
  padding: 4px 12px;
  background: rgba(15, 27, 45, 0.85);
  color: white;
  border-radius: var(--r-full);
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.gallery-ba .ba-label-before { left: var(--sp-3); }
.gallery-ba .ba-label-after { right: var(--sp-3); }

/* ---------- Image treatments -------------------------------------------- */
.img-rounded {
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.img-rounded img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 800ms var(--ease-out);
}
.img-rounded:hover img { transform: scale(1.04); }

/* Service card with media header */
.card-media {
  padding: 0;
  overflow: hidden;
}
.card-media .card-media-img {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--c-bg-alt);
}
.card-media .card-media-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease-out);
}
.card-media:hover .card-media-img img { transform: scale(1.06); }
.card-media .card-body { padding: var(--sp-6); }
@media (min-width: 768px) {
  .card-media .card-body { padding: var(--sp-8); }
}

/* ---------- Metric counters --------------------------------------------- */
.metrics {
  display: grid;
  gap: var(--sp-6);
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 768px) { .metrics { grid-template-columns: repeat(4, 1fr); } }
.metric {
  text-align: center;
}
.metric-value {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  font-weight: 800;
  color: var(--c-primary);
  line-height: 1;
  letter-spacing: -0.03em;
}
.metric-label {
  color: var(--c-text-muted);
  font-size: var(--fs-small);
  font-weight: 500;
  margin-top: var(--sp-2);
}

/* ---------- Chatbot launcher override (Tawk overlap fix) ---------------- */
@media (max-width: 959px) {
  #tawkchat-minified-container,
  .tawk-min-container {
    bottom: 80px !important;
  }
}

/* ---------- Booking widget wrapper -------------------------------------- */
.calendly-wrap {
  min-height: 650px;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: white;
}

/* ---------- Form states ------------------------------------------------- */
.form-note {
  font-size: var(--fs-small);
  color: var(--c-text-muted);
  margin-top: var(--sp-2);
}
.form-success {
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: #0F5132;
  border-radius: var(--r-md);
  padding: var(--sp-5);
}
.form-error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: #7F1D1D;
  border-radius: var(--r-md);
  padding: var(--sp-4);
}

/* ---------- Honeypot (anti-spam) ---------------------------------------- */
.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Reduced motion override ------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-up, .reveal-left, .reveal-right, .reveal-scale,
  .stagger > * { opacity: 1 !important; transform: none !important; filter: none !important; }
  .hero-badge, .mobile-cta::after, .hero h1 .hero-accent,
  .trust-bar-marquee { animation: none !important; }
  .gallery-ba { cursor: default; }
}
