/* ============================================================================
   Clearout Crew — Motion & Depth
   Implements ui-motion-and-depth.md using tokens from
   ../Global Styles/design-tokens.css. CSS-only; no JS animation libraries.
   Load AFTER design-tokens.css.

   Principles (Book II MOTION + UI Motion & Depth Policy):
   subtle, fast, purposeful; depth via shadows/layering; no autoplay/3D/WebGL;
   mobile-first; visible focus; honors prefers-reduced-motion.
   ========================================================================== */

/* --- Layering: alternating section surfaces for depth ---------------------- */
.cc-section            { background: var(--cc-bg); }
.cc-section--alt       { background: var(--cc-surface-alt); }
.cc-section--dark      { background: var(--cc-charcoal); color: var(--cc-white); }

/* --- Elevation utilities --------------------------------------------------- */
.cc-elevate-sm { box-shadow: var(--cc-shadow-sm); }
.cc-elevate-md { box-shadow: var(--cc-shadow-md); }
.cc-elevate-lg { box-shadow: var(--cc-shadow-lg); }

/* --- Cards: raised surface with a subtle hover lift ------------------------ */
.cc-card {
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius-lg);
  box-shadow: var(--cc-shadow-sm);
  transition: transform var(--cc-transition-base) var(--cc-ease),
              box-shadow var(--cc-transition-base) var(--cc-ease);
}
@media (hover: hover) and (pointer: fine) {
  .cc-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--cc-shadow-lg);
  }
}
.cc-card:focus-within { box-shadow: var(--cc-shadow-lg); }

/* --- Buttons --------------------------------------------------------------- */
.cc-btn {
  display: inline-flex; align-items: center; gap: var(--cc-space-8);
  font-family: var(--cc-font-heading);
  font-weight: var(--cc-weight-heading);
  border-radius: var(--cc-radius-md);
  padding: 0.75rem 1.25rem;
  min-height: 44px;                 /* WCAG touch target */
  cursor: pointer;
  transition: transform var(--cc-transition-fast) var(--cc-ease),
              box-shadow var(--cc-transition-fast) var(--cc-ease),
              background-color var(--cc-transition-fast) var(--cc-ease);
}
/* Primary CTA — "Get a Free Estimate".
   WCAG 2.2 AA (DEV-001 governed finding): white text requires --cc-orange-cta
   (#C2410C, 5.2:1). White on --cc-orange (#F97316) is ~2.9:1 and FAILS. */
.cc-btn--primary {
  background: var(--cc-orange-cta);
  color: var(--cc-white);
  box-shadow: var(--cc-shadow-sm);
}
@media (hover: hover) and (pointer: fine) {
  .cc-btn--primary:hover { background: var(--cc-orange-cta-hover); transform: translateY(-1px); box-shadow: var(--cc-shadow-md); }
}
.cc-btn--primary:active { background: var(--cc-orange-cta-hover); transform: translateY(0); box-shadow: var(--cc-shadow-xs); }

/* Secondary CTA — "Text Photos for a Quote": elevated, tinted, camera icon */
.cc-btn--photos {
  background: var(--cc-orange-tint);
  color: var(--cc-orange-active);
  border: 1px solid var(--cc-orange);
  box-shadow: var(--cc-shadow-md);
}
.cc-btn--photos::before { content: "\1F4F7"; /* 📷 */ font-size: 1.1em; line-height: 1; }
@media (hover: hover) and (pointer: fine) {
  .cc-btn--photos:hover { transform: translateY(-2px); box-shadow: var(--cc-shadow-lg); }
}
.cc-btn--photos:active { transform: translateY(0); box-shadow: var(--cc-shadow-sm); }

/* --- Text links ------------------------------------------------------------ */
.cc-link { color: var(--cc-link); text-decoration: underline; text-underline-offset: 2px;
  transition: color var(--cc-transition-fast) var(--cc-ease); }
.cc-link:hover { color: var(--cc-link-hover); }

/* Content links inside sections (supporting "→" links, prose links). Excludes
   block buttons and nav. AA-safe on light; switches to accent on dark sections. */
.cc-section :is(p, li) a:not(.wp-block-button__link) {
  color: var(--cc-link); text-decoration: underline; text-underline-offset: 2px;
}
.cc-section :is(p, li) a:not(.wp-block-button__link):hover { color: var(--cc-link-hover); }
.cc-section--dark :is(p, li) a:not(.wp-block-button__link) { color: var(--cc-link-on-dark); }

/* --- Visible focus for keyboard users (WCAG 2.2 AA) ------------------------ */
a:focus-visible, button:focus-visible, .cc-btn:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
  box-shadow: var(--cc-shadow-focus);
  border-radius: var(--cc-radius-sm);
}

/* --- Sticky Mobile Action Bar (mobile only) -------------------------------- */
.cc-sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--cc-z-sticky-bar);
  display: flex; gap: var(--cc-space-8);
  /* Extra bottom padding clears the iOS home indicator on notched phones; the
     footer reserves matching clearance (components.css) so nothing hides here. */
  padding: var(--cc-space-8) var(--cc-space-16) calc(var(--cc-space-8) + env(safe-area-inset-bottom, 0px));
  background: var(--cc-surface);
  box-shadow: 0 -4px 16px rgba(31, 41, 55, 0.10);   /* upward depth */
}
.cc-sticky-bar .cc-btn { flex: 1; justify-content: center; border-radius: var(--cc-radius-pill); }
@media (min-width: 1024px) { .cc-sticky-bar { display: none; } }

/* --- One-time entrance reveal (fires once; NOT a loop) --------------------- */
/* Apply .cc-reveal to elements; a tiny IntersectionObserver adds .is-in.
   Used sparingly, e.g. the Text-Photos CTA when it first scrolls into view. */
.cc-reveal { opacity: 0; transform: translateY(12px);
  transition: opacity var(--cc-transition-slow) var(--cc-ease),
              transform var(--cc-transition-slow) var(--cc-ease); }
.cc-reveal.is-in { opacity: 1; transform: none; }

/* --- Images: modern, layered, never distorted ------------------------------ */
.cc-media { border-radius: var(--cc-radius-lg); overflow: hidden; box-shadow: var(--cc-shadow-sm); }
.cc-media picture { display: block; }
.cc-media img { display: block; width: 100%; height: auto; }

/* --- Reduced motion: strip all non-essential motion, keep depth ------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .cc-reveal { opacity: 1; transform: none; }
  .cc-card:hover, .cc-btn:hover { transform: none; }
}
