/* ============================================================
   Career Pakistan — perf-improvements.css
   Image loading performance, shimmer skeletons, professional polish
   ============================================================ */

/* ── Image loading states ─────────────────────────────────── */
img {
  /* Prevent layout shift by reserving space */
  min-width: 0;
  min-height: 0;
}

/* Blur-up reveal animation */
.img-loading {
  filter: blur(8px);
  transform: scale(1.02);
  transition: filter 0.4s ease, transform 0.4s ease, opacity 0.3s ease;
  opacity: 0.7;
}

.img-loaded {
  filter: blur(0);
  transform: scale(1);
  opacity: 1;
  transition: filter 0.4s ease, transform 0.4s ease, opacity 0.3s ease;
}

/* Card image container — always fills correctly */
.card-img {
  position: relative;
  overflow: hidden;
  background: var(--bg-alt);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease, filter 0.4s ease, opacity 0.3s ease;
  will-change: transform;
}

.card:hover .card-img img {
  transform: scale(1.04);
}

/* ── Shimmer skeleton improved ─────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skeleton-card,
.card-img.shimmer,
.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-alt) 25%,
    color-mix(in srgb, var(--bg-alt) 60%, var(--border) 40%) 50%,
    var(--bg-alt) 75%
  );
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-card {
  border-radius: var(--radius-lg);
  min-height: 240px;
  border: 1px solid var(--border);
}

/* ── Card professional improvements ────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card:hover {
  box-shadow: 0 12px 32px rgba(20, 184, 166, 0.13), 0 2px 8px rgba(0,0,0,0.05);
  border-color: var(--primary);
  transform: translateY(-3px);
}

/* ── Navbar professional improvements ───────────────────────── */
.navbar {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ── Footer improvements ────────────────────────────────────── */
.footer {
  border-top: 2px solid var(--border);
  padding-top: 36px;
}

.footer-col h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.footer-col ul li a {
  font-size: 0.88rem;
  color: var(--text-secondary);
  padding: 3px 0;
  display: inline-block;
  transition: color 0.18s ease, padding-left 0.18s ease;
}

.footer-col ul li a:hover {
  color: var(--primary);
  padding-left: 4px;
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ── Section headers improved ──────────────────────────────── */
.section-title {
  position: relative;
  padding-bottom: 10px;
}

.section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), transparent);
  border-radius: 2px;
}

/* ── Buttons professional polish ──────────────────────────── */
.btn {
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.3);
}

/* ── Page header subtle improvement ─────────────────────────── */
.page-header:not(.home-hero) {
  background: linear-gradient(135deg, var(--primary-bg) 0%, var(--bg-alt) 100%);
  border-bottom: 1px solid var(--border);
  padding: 24px 0 20px;
}

/* ── View all link polish ────────────────────────────────────── */
.view-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 5px 14px;
  border-radius: 999px;
  transition: background 0.18s ease, color 0.18s ease;
}

.view-all:hover {
  background: var(--primary);
  color: #fff !important;
  text-decoration: none;
}

/* ── Quick nav cards polish ─────────────────────────────────── */
.quick-nav-card {
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.quick-nav-card:hover {
  transform: translateY(-2px);
}

/* ── Stats ribbon polish ─────────────────────────────────────── */
.stat-cell {
  transition: transform 0.2s ease;
}

.stat-cell:hover {
  transform: scale(1.04);
}

/* ── Font rendering ──────────────────────────────────────────── */
body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Reduce animation for reduced-motion preference ──────────── */
@media (prefers-reduced-motion: reduce) {
  .img-loading,
  .img-loaded,
  .card,
  .card:hover,
  .card-img img,
  .card:hover .card-img img,
  .btn,
  .btn-primary:hover,
  .quick-nav-card,
  .quick-nav-card:hover {
    transition: none !important;
    transform: none !important;
    animation: none !important;
  }
}

/* ── Cat pill active improved ────────────────────────────────── */
.cat-pill {
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

/* ── Blog card improvements ──────────────────────────────────── */
.blog-card {
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(20, 184, 166, 0.13);
}

/* ── Search input focus ───────────────────────────────────────── */
.hero-search-input:focus,
.filter-select:focus,
input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

/* ── Mobile nav bottom polish ─────────────────────────────────── */
.mobile-bottom-nav {
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg-card) 96%, transparent 4%);
}

/* ── Preload hint for above-fold logo ─────────────────────────── */
.nav-logo img {
  will-change: auto;
  content-visibility: auto;
}

/* ── Content visibility for off-screen sections ──────────────── */
.section:not(:first-child) {
  content-visibility: auto;
  contain-intrinsic-size: 0 400px;
}
