/* Premium micro-interactions layer — Ola 3 (T151).
   Global polish: accessible focus rings, smooth scroll, skeleton loaders,
   subtle fade-up on initial render, polished button press states. */

/* ---- Smooth scrolling with reduced-motion respect ---- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---- Accessible, polished focus ring everywhere interactive ---- */
*:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
  outline-offset: 2px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* ---- Skeleton loader: shimmer placeholder for loading states ---- */
.skeleton {
  background: linear-gradient(90deg,
    #f1f5f9 0%,
    #e2e8f0 40%,
    #f1f5f9 80%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
  border-radius: 6px;
  color: transparent;
  user-select: none;
  pointer-events: none;
}
.skeleton--text { height: 12px; margin: 6px 0; }
.skeleton--title { height: 18px; margin: 8px 0; width: 70%; }
.skeleton--image { aspect-ratio: 1 / 1; width: 100%; border-radius: 8px; }
.skeleton--circle { border-radius: 50%; }
.skeleton--btn { height: 40px; border-radius: 8px; }

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: #e2e8f0; }
}

/* ---- Subtle fade-up on initial page load (products grid + panels) ---- */
@media (prefers-reduced-motion: no-preference) {
  .grid--products > .card,
  .panel,
  .section__head {
    animation: pi-fade-up .35s ease-out both;
  }
  .grid--products > .card:nth-child(n+4) { animation-delay: .04s; }
  .grid--products > .card:nth-child(n+8) { animation-delay: .08s; }
  .grid--products > .card:nth-child(n+12){ animation-delay: .12s; }
  .grid--products > .card:nth-child(n+16){ animation-delay: .16s; }
}
@keyframes pi-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Polished button press states (global) ---- */
.btn,
button.btn {
  transition: background .15s ease, border-color .15s ease,
              box-shadow .15s ease, transform .08s ease;
}
.btn:active,
button.btn:active { transform: translateY(1px); }

.btn--accent,
.btn--primary {
  box-shadow: 0 2px 6px rgba(37, 99, 235, .15);
}
.btn--accent:hover,
.btn--primary:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}
.btn--accent:active,
.btn--primary:active {
  box-shadow: 0 1px 3px rgba(37, 99, 235, .2);
}

/* ---- Input / select polish ---- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
select,
textarea {
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

/* ---- Link hover refinement (breadcrumbs, footer) ---- */
.breadcrumbs a,
.breadcrumb a,
.footer a {
  transition: color .15s ease;
}

/* ---- Top loading bar during client-side nav (htmx/fetch-triggered) ----
   Uses `.is-loading` on <html> to show. Pages can opt-in. */
html.is-loading::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 30%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--primary, #2563eb) 50%, transparent 100%);
  z-index: 99999;
  animation: pi-top-loading 1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pi-top-loading {
  0%   { left: -30%; }
  100% { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html.is-loading::before { animation: none; opacity: .6; }
}

/* ---- Image loading: subtle blur-up fade-in when lazy image resolves ---- */
img[loading="lazy"] {
  transition: opacity .35s ease, filter .35s ease;
}
img[loading="lazy"]:not([src]),
img[loading="lazy"][src=""] {
  opacity: 0;
  filter: blur(8px);
}

/* ---- Table rows hover polish ---- */
table tbody tr {
  transition: background-color .1s ease;
}

/* ---- Details/summary (FAQ, expandables) polish ---- */
details > summary {
  transition: background-color .15s ease;
  cursor: pointer;
}
details[open] > summary { background-color: rgba(37, 99, 235, .04); }

/* ============================================================
   T261 — Footer transition + carousel rhythm polish (Ola 4)
   H: gradient fade from content to dark footer
   G: subtle dividers between consecutive product carousels
   ============================================================ */

/* Gradient transition before the dark footer — smooths the harsh
   white→navy edge that made the site feel "amateur" at scroll end. */
.site-footer {
  position: relative;
}
.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -48px;
  height: 48px;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(15, 23, 42, .04) 60%,
    rgba(15, 23, 42, .10) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Carousel rhythm — subtle separators between PDP/page product carousels
   so they don't visually merge into one long scroll of cards. */
.pdp-carousel + .pdp-carousel,
.pdp-reco + .pdp-reco,
.pdp-product-carousel + .pdp-product-carousel,
section.section + section.section {
  position: relative;
}
.pdp-carousel + .pdp-carousel::before,
.pdp-reco + .pdp-reco::before,
.pdp-product-carousel + .pdp-product-carousel::before {
  content: "";
  display: block;
  width: 72px;
  height: 2px;
  margin: 8px auto 20px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(37, 99, 235, .25) 50%,
    transparent 100%);
  border-radius: 2px;
}

/* Add a bit more breathing room between sections on PDP below buybox */
.pdp-section + .pdp-section,
.pdp-section + .pdp-bundles,
.pdp-bundles + .pdp-section {
  margin-top: 28px;
}

/* Section titles on PDP carousels — tighter weight for premium feel */
.pdp-carousel .section__title,
.pdp-reco .section__title,
section.section > .section__title {
  letter-spacing: -.015em;
}
