/* skeleton.css — Phase 11.9
 *
 * Skeleton screens for data-driven content. Used by all pages with
 * async-loaded sections (dashboard, profile, browse, edit-profile, etc).
 *
 * Pattern: while a fetch() is in-flight, render grey shimmer placeholders
 * at the approximate size of the eventual content. Eliminates "fields
 * popping into place" layout shift that follows fetch completion.
 *
 * No HTML structure changes required — JS helpers in skeleton.js inject
 * the markup into the target container. After fetch resolves, the page's
 * normal render function overwrites innerHTML and the skeleton vanishes.
 *
 * Theming: uses existing CSS variables from each page's theme. Dark and
 * light themes both work because we use surface/border colors, not raw
 * hex codes.
 */

@keyframes skel-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skel {
  background: linear-gradient(
    90deg,
    var(--surface, rgba(255,255,255,0.04)) 0%,
    var(--surface2, rgba(255,255,255,0.08)) 50%,
    var(--surface, rgba(255,255,255,0.04)) 100%
  );
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s linear infinite;
  border-radius: 6px;
  display: block;
  position: relative;
  overflow: hidden;
}

/* Pre-sized variants — pick the one closest to your real content size. */

.skel-line     { height: 0.9rem; margin: 0.45rem 0; border-radius: 4px; }
.skel-line.sm  { height: 0.7rem; }
.skel-line.lg  { height: 1.2rem; }
.skel-line.xl  { height: 1.8rem; }

.skel-text-w-25  { width: 25%; }
.skel-text-w-40  { width: 40%; }
.skel-text-w-60  { width: 60%; }
.skel-text-w-75  { width: 75%; }
.skel-text-w-90  { width: 90%; }
.skel-text-w-100 { width: 100%; }

.skel-circle   { border-radius: 50%; aspect-ratio: 1 / 1; }
.skel-circle.sm { width: 32px; height: 32px; }
.skel-circle.md { width: 56px; height: 56px; }
.skel-circle.lg { width: 96px; height: 96px; }

.skel-pill     { height: 1.5rem; border-radius: 999px; display: inline-block; margin: 0.2rem 0.3rem 0.2rem 0; }
.skel-pill.sm  { width: 56px; }
.skel-pill.md  { width: 84px; }
.skel-pill.lg  { width: 120px; }

.skel-block    { border-radius: 12px; }
.skel-block.h-stat { height: 96px; }
.skel-block.h-card { height: 140px; }
.skel-block.h-hero { height: 180px; }
.skel-block.h-bio  { height: 100px; }

/* Container helpers — these target the wrappers the helpers create. */

.skel-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.skel-row {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.skel-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Hero pattern — avatar + name + sub line, used by profile/dashboard headers */
.skel-hero {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0.6rem 0;
}
.skel-hero .skel-hero-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Stat card pattern — used in dashboard stat grid */
.skel-stat {
  padding: 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--surface, rgba(255,255,255,0.03));
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  justify-content: center;
}

/* Profile card pattern — used in browse.html grid */
.skel-prof-card {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--surface, rgba(255,255,255,0.03));
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.skel-prof-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.skel-prof-card-head .skel-prof-card-head-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Listing row pattern — compact card-like row for "my listings" sections */
.skel-listing-row {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  background: var(--surface, rgba(255,255,255,0.02));
  display: flex;
  align-items: center;
  gap: 1rem;
}
.skel-listing-row > .skel-listing-row-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
}
