*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --karwaan-nav-h: 64px;
  --karwaan-hero-min-h: 420px;
  --karwaan-cat-section-h: 136px;
  --karwaan-footer-h: 200px;
}

body {
  background: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#root {
  min-height: 100vh;
  background: #f8fafc;
}

/* Full-page overlay — stays until React home data is ready (avoids skeleton → white → skeleton). */
.app-skeleton {
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow-y: auto;
  background: #f8fafc;
  -webkit-overflow-scrolling: touch;
}

.app-skeleton--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 0s linear 220ms;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Matches Navbar: h-16 sticky */
.skel-nav {
  height: var(--karwaan-nav-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  max-width: 80rem;
  margin: 0 auto;
}

.skel-nav-l {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: #e2e8f0;
  animation: pulse 1.5s infinite;
}

.skel-nav-m {
  flex: 1;
  max-width: 36rem;
  height: 44px;
  margin: 0 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  animation: pulse 1.5s infinite;
}

.skel-nav-r {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.skel-nav-r > div {
  width: 36px;
  height: 36px;
  background: #e2e8f0;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

/* Matches HeroSection min-height */
.skel-hero {
  min-height: var(--karwaan-hero-min-h);
  background: linear-gradient(135deg, #059669, #0d9488, #0891b2);
}

.skel-hero-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 48px 16px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.skel-hero-text {
  width: min(100%, 320px);
  height: 120px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  animation: pulse 1.5s infinite;
}

.skel-hero-img {
  width: 256px;
  height: 256px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}

/* SSR LCP hero image: a transparent fixed frame that never crops its source. */
img.lcp-hero-paint {
  display: block;
  width: 16rem;
  height: 16rem;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.45));
}

@media (min-width: 768px) {
  img.lcp-hero-paint {
    width: 20rem;
    height: 20rem;
  }
}

@media (min-width: 768px) {
  :root {
    --karwaan-hero-min-h: 480px;
  }

  .skel-hero-inner {
    flex-direction: row;
    padding: 80px 16px 96px;
  }

  .skel-hero-text {
    flex: 1;
    width: auto;
    height: 160px;
  }

  .skel-hero-img {
    width: 320px;
    height: 320px;
  }
}

/* Matches CategoryNav: grid-cols-6, w-10 h-10 icons */
.skel-cats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  padding: 32px 16px;
  max-width: 80rem;
  margin: 0 auto;
  min-height: var(--karwaan-cat-section-h);
}

.skel-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.skel-cat-icon {
  width: 56px;
  height: 56px;
  background: #e2e8f0;
  border-radius: 16px;
  animation: pulse 1.5s infinite;
}

.skel-cat-label {
  width: 40px;
  height: 12px;
  background: #e2e8f0;
  border-radius: 4px;
  animation: pulse 1.5s infinite;
}

.skel-grid {
  padding: 0 16px 48px;
  max-width: 80rem;
  margin: 0 auto;
}

/* Match the loaded page-container so loading does not shift content sideways. */
@media (min-width: 768px) {
  .skel-nav,
  .skel-hero-inner,
  .skel-cats,
  .skel-grid {
    --page-gutter: clamp(1rem, 3vw, 3rem);
    max-width: calc(78rem + 2 * var(--page-gutter));
    padding-inline: var(--page-gutter);
  }

  .skel-hero-inner {
    --page-gutter: max(3.75rem, 3vw);
  }
}

.skel-section-title {
  height: 24px;
  width: 160px;
  background: #e2e8f0;
  border-radius: 4px;
  margin-bottom: 20px;
  animation: pulse 1.5s infinite;
}

/* Matches ProductGrid: grid-cols-2, aspect-square cards */
.skel-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (min-width: 768px) {
  .skel-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.skel-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #f1f5f9;
}

.skel-card-img {
  aspect-ratio: 1 / 1;
  width: 100%;
  background: #e2e8f0;
  animation: pulse 1.5s infinite;
}

.skel-card-body {
  padding: 14px;
}

.skel-card-body > div {
  height: 14px;
  background: #e2e8f0;
  border-radius: 4px;
  margin-bottom: 8px;
  animation: pulse 1.5s infinite;
}

.skel-card-body > div:nth-child(1) {
  width: 80%;
}

.skel-card-body > div:nth-child(2) {
  width: 50%;
  height: 20px;
}

.skel-footer {
  height: var(--karwaan-footer-h);
  background: #0f172a;
  margin-top: auto;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skel-nav-l,
  .skel-nav-m,
  .skel-nav-r > div,
  .skel-hero-text,
  .skel-hero-img,
  .skel-cat-icon,
  .skel-cat-label,
  .skel-card-img,
  .skel-card-body > div,
  .skel-section-title {
    animation: none;
  }
}
