/* Small overrides on top of Tailwind. Keep this file thin —
   most styling should live in utility classes. */

/* Smooth scroll for anchor links */
html { scroll-behavior: smooth; }

/* =========================================================
   PREVENT HORIZONTAL PAGE SCROLL ON MOBILE
   Some elements (carousels with -mx-6, oversized absolute
   numerals in the zigzag section, etc.) can leak beyond the
   viewport on narrow screens.

   We use 'overflow-x: clip' (not 'hidden') because:
     - 'overflow-x: hidden' turns the body into a SCROLL CONTAINER,
       which silently breaks position:sticky on all descendants
       (sticky elements would try to stick to the body's never-
       scrolling container instead of the viewport, and never
       actually stick). This bit the blog post's sticky sidebars.
     - 'overflow-x: clip' clips overflowing content visually but
       does NOT create a scroll container, so position:sticky on
       descendants works correctly against the viewport.

   'overflow-x: hidden' is declared first as a fallback for older
   browsers (pre-2022 Safari, very old Chrome/Firefox) that do not
   recognize 'clip'. Modern browsers use the second declaration.

   Individual overflow-x-auto containers (carousel, table) still
   scroll internally as designed — their own overflow context is
   separate from the document-level clipping here.
   ========================================================= */
html, body {
  overflow-x: hidden;     /* fallback for pre-2022 browsers */
  overflow-x: clip;       /* modern browsers — preserves sticky */
}

/* Selection color */
::selection { background: #dae6ff; color: #1c3088; }

/* Reduce CLS — reserve nav height even before Tailwind loads from CDN.
   Also: auto-hide on scroll down / show on scroll up (toggled by
   animate.js setupHeaderAutoHide). Transition is GPU-accelerated. */
header {
  min-height: 4rem;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
header.header-hidden {
  transform: translateY(-100%);
}

/* Form focus ring polish */
.input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid #d8d9df;
  font-size: 0.95rem;
  color: #22253a;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: #5b85fb;
  box-shadow: 0 0 0 3px rgba(91, 133, 251, .2);
}

/* =========================================================
   MOTION LAYER
   Tasteful, performant. Everything below is GPU-accelerated
   (opacity + transform only) and respects prefers-reduced-motion.
   ========================================================= */

/* --- Scroll-reveal (toggled by assets/js/animate.js) --- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* --- Hero arrow pulse (home page, between suspended → active states) --- */
@keyframes pulseArrow {
  0%, 100% {
    transform: translateY(-50%) scale(1);
    box-shadow: 0 4px 14px rgba(41, 98, 255, 0.30);
  }
  50% {
    transform: translateY(-50%) scale(1.12);
    box-shadow: 0 8px 26px rgba(41, 98, 255, 0.55);
  }
}
.pulse-arrow {
  animation: pulseArrow 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: transform, box-shadow;
}

/* --- "REINSTATED" stamp pulse (service-page hero visuals) ---
   A subtle "press" every ~5s. Looks like a real rubber stamp being
   reapplied. Lifted shadow swells with the press. */
@keyframes stampPress {
  0%, 92%, 100% {
    transform: rotate(6deg) scale(1);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.30);
  }
  94% {
    transform: rotate(6deg) scale(0.94);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.50);
  }
  96% {
    transform: rotate(7deg) scale(1.06);
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.55);
  }
  98% {
    transform: rotate(6deg) scale(1);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.30);
  }
}
.stamp-press {
  animation: stampPress 5s ease-in-out infinite;
  transform-origin: center;
  will-change: transform, box-shadow;
}

/* --- Hover lift on linked cards (policy grid, related-policies, flagged grid) ---
   Tailwind gives us hover:shadow-md and hover:border-brand-300 already.
   This just adds the upward translation. */
.lift-on-hover {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.25s ease,
              border-color 0.25s ease;
  will-change: transform;
}
.lift-on-hover:hover {
  transform: translateY(-3px);
}

/* --- Respect user motion preference (vestibular / OS-level setting) --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .pulse-arrow, .stamp-press { animation: none; }
  .lift-on-hover { transition: none; }
  .lift-on-hover:hover { transform: none; }
  header { transition: none; }
}
