.cat-section{
  --red:#D32F2F;
  --black:#111111;
  --sub:#6B7280;
  background:#fafafa;
  padding:56px 24px;
  font-family:'Inter','Poppins',Arial,sans-serif;
}

.cat-container{ max-width:1080px; margin:0 auto; }

.cat-head{
  text-align:center;
  max-width:560px;
  margin:0 auto 32px;
  opacity:0;
  transform:translateY(16px);
  animation:catFadeUp .7s ease forwards;
}
.cat-eyebrow{
  display:inline-block;
  font-size:12px;
  font-weight:700;
  letter-spacing:2px;
  text-transform:uppercase;
  color:var(--red);
  margin-bottom:12px;
}
.cat-heading{
  margin:0 0 12px;
  font-size:34px;
  font-weight:800;
  color:var(--black);
  letter-spacing:-.5px;
}
.cat-subheading{
  margin:0;
  font-size:14.5px;
  line-height:1.65;
  color:var(--sub);
}

/* ---------- FEATURED CARD ---------- */
.cat-featured{
  display:flex;
  align-items:center;
  gap:40px;
  background:#ffffff;
  border:1px solid rgba(17,17,17,.08);
  border-radius:20px;
  padding:28px 32px;
  box-shadow:0 16px 34px rgba(17,17,17,.07);
  margin-bottom:16px;
  opacity:0;
  transform:translateY(20px);
  animation:catFadeUp .7s ease .08s forwards;
}

.cat-doc{
  position:relative;
  flex:0 0 auto;
  width:96px; height:120px;
}
.cat-doc-sheet{
  position:absolute;
  inset:0;
  border-radius:10px;
  background:#ffffff;
  border:1px solid rgba(17,17,17,.08);
  box-shadow:0 10px 22px rgba(17,17,17,.08);
}
.cat-doc-sheet--3{ transform:rotate(8deg) translate(6px, 4px); background:#f3f3f3; }
.cat-doc-sheet--2{ transform:rotate(-5deg) translate(-4px, 2px); background:#f8f8f8; }
.cat-doc-sheet--1{
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px;
  transform:none;
  background:linear-gradient(180deg, #ffffff, #fdfdfd);
}
.cat-doc-sheet--1 svg{ width:30px; height:30px; }
.cat-doc-badge{
  font-size:10px;
  font-weight:800;
  letter-spacing:1px;
  color:#ffffff;
  background:var(--red);
  padding:3px 10px;
  border-radius:6px;
}

.cat-featured-body{ flex:1; min-width:0; }
.cat-tag{
  display:inline-block;
  font-size:10.5px;
  font-weight:700;
  letter-spacing:.5px;
  text-transform:uppercase;
  color:var(--red);
  background:rgba(211,47,47,.08);
  padding:4px 10px;
  border-radius:20px;
  margin-bottom:8px;
}
.cat-featured-title{
  margin:0 0 6px;
  font-size:20px;
  font-weight:800;
  color:var(--black);
  letter-spacing:-.3px;
}
.cat-featured-desc{
  margin:0 0 14px;
  font-size:13.5px;
  line-height:1.6;
  color:var(--sub);
  max-width:520px;
}

.cat-meta{
  display:flex;
  flex-wrap:wrap;
  gap:16px;
  margin-bottom:16px;
}
.cat-meta-item{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:12.5px;
  font-weight:600;
  color:var(--sub);
}
.cat-meta-item svg{ width:15px; height:15px; color:var(--red); }

.cat-btn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  font-size:13.5px;
  font-weight:700;
  color:#ffffff;
  background:var(--red);
  text-decoration:none;
  padding:12px 22px;
  border-radius:12px;
  box-shadow:0 12px 24px rgba(211,47,47,.22);
  transition:transform .3s cubic-bezier(.16,1,.3,1), box-shadow .3s ease, background .3s ease;
}
.cat-btn svg{ width:17px; height:17px; }
.cat-btn:hover{
  transform:translateY(-3px);
  box-shadow:0 20px 36px rgba(211,47,47,.32);
  background:#b8281f;
}

/* ---------- CATEGORY GRID ---------- */
/* Auto-fills columns to fit however many items the admin has added —
   not locked to a fixed count. */
.cat-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(220px, 1fr));
  gap:16px;
}

.cat-card{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:4px;
  background:#ffffff;
  border:1px solid rgba(17,17,17,.08);
  border-radius:14px;
  padding:16px 16px 14px;
  text-decoration:none;
  box-shadow:0 6px 16px rgba(17,17,17,.05);
  opacity:0;
  transform:translateY(18px);
  animation:catFadeUp .6s cubic-bezier(.16,1,.3,1) forwards;
  transition:transform .3s cubic-bezier(.16,1,.3,1), box-shadow .3s ease, border-color .3s ease;
}
.cat-card:nth-child(1){ animation-delay:.16s; }
.cat-card:nth-child(2){ animation-delay:.22s; }
.cat-card:nth-child(3){ animation-delay:.28s; }
.cat-card:nth-child(4){ animation-delay:.34s; }
.cat-card:nth-child(5){ animation-delay:.40s; }
.cat-card:nth-child(6){ animation-delay:.46s; }
.cat-card:nth-child(n+7){ animation-delay:.5s; }

.cat-card:hover{
  transform:translateY(-6px);
  box-shadow:0 20px 36px rgba(211,47,47,.12);
  border-color:rgba(211,47,47,.22);
}

.cat-card-icon{
  width:34px; height:34px;
  display:flex; align-items:center; justify-content:center;
  border-radius:9px;
  background:rgba(211,47,47,.08);
  margin-bottom:6px;
  transition:transform .3s ease, background .3s ease;
}
.cat-card-icon svg{ width:16px; height:16px; }
.cat-card:hover .cat-card-icon{
  background:rgba(211,47,47,.14);
  transform:rotate(-4deg) scale(1.05);
}

.cat-card-title{
  font-size:14px;
  font-weight:700;
  color:var(--black);
}
.cat-card-meta{
  font-size:11.5px;
  color:var(--sub);
}

.cat-card-dl{
  position:absolute;
  top:20px; right:18px;
  width:26px; height:26px;
  display:flex; align-items:center; justify-content:center;
  border-radius:50%;
  color:var(--sub);
  transition:transform .3s cubic-bezier(.16,1,.3,1), color .3s ease, background .3s ease;
}
.cat-card-dl svg{ width:14px; height:14px; }
.cat-card:hover .cat-card-dl{
  color:var(--red);
  background:rgba(211,47,47,.08);
  transform:translateY(2px);
}

.cat-foot{
  text-align:center;
  margin:20px 0 0;
  font-size:13.5px;
  color:var(--sub);
}
.cat-foot a{
  color:var(--red);
  font-weight:700;
  text-decoration:none;
  border-bottom:1.5px solid rgba(211,47,47,.35);
}
.cat-foot a:hover{ border-color:var(--red); }

@keyframes catFadeUp{ to{ opacity:1; transform:translateY(0); } }

/* ============ RESPONSIVE ============ */

@media (max-width:900px){
  .cat-grid{ grid-template-columns:repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width:780px){
  .cat-featured{ flex-direction:column; text-align:center; gap:20px; padding:26px 22px; }
  .cat-meta{ justify-content:center; }
  .cat-featured-desc{ margin-left:auto; margin-right:auto; }
}

@media (max-width:640px){
  .cat-section{ padding:40px 18px; }
  .cat-heading{ font-size:23px; }
  .cat-subheading{ font-size:13.5px; }

  .cat-featured{ padding:22px 18px; border-radius:16px; }
  .cat-featured-title{ font-size:17px; }
  .cat-doc{ width:78px; height:100px; }
  .cat-doc-sheet--1 svg{ width:26px; height:26px; }

  .cat-grid{ grid-template-columns:1fr 1fr; gap:10px; }
  .cat-card{ padding:14px 12px 12px; }
  .cat-card-dl{ top:12px; right:10px; }
}

@media (max-width:420px){
  .cat-grid{ grid-template-columns:1fr; }
}

@media (prefers-reduced-motion: reduce){
  .cat-head, .cat-featured, .cat-card{ animation:none; opacity:1; transform:none; }
  .cat-card:hover, .cat-btn:hover{ transform:none; }
}
