/* Homepage category cards */
.hc-section{
  --hc-surface:#ffffff;
  --hc-shell:rgba(255,255,255,.9);
  --hc-border:rgba(15,23,42,.08);
  --hc-chip:rgba(15,23,42,.05);
  --hc-text:#0f172a;
  --hc-muted:#64748b;
  --hc-shadow:0 30px 60px -32px rgba(30,41,59,.45);
  position:relative;
  padding-top:24px;
}
.theme-dark .hc-section{
  --hc-surface:#1d273b;
  --hc-shell:rgba(26,34,52,.92);
  --hc-border:rgba(255,255,255,.08);
  --hc-chip:rgba(255,255,255,.07);
  --hc-text:#f1f5f9;
  --hc-muted:#9aa7bd;
  --hc-shadow:0 30px 60px -30px rgba(0,0,0,.7);
}
.hc-overlap{padding-top:0}
.hc-overlap .hc-shell{margin-top:-64px}

.hc-shell{
  position:relative;z-index:2;
  background:var(--hc-shell);
  -webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);
  border:1px solid var(--hc-border);
  border-radius:26px;
  padding:28px;
  box-shadow:var(--hc-shadow);
}
.hc-head{margin-bottom:22px}
.hc-title{
  margin:0 0 4px;font-size:1.5rem;font-weight:800;letter-spacing:-.015em;
  color:var(--hc-text);display:flex;align-items:center;gap:12px;
}
.hc-title::before{
  content:"";flex:none;width:10px;height:28px;border-radius:6px;
  background:linear-gradient(180deg,#7c3aed,#ec4899 55%,#f97316);
}
.hc-sub{margin:0;color:var(--hc-muted);font-size:.95rem}

/* Grid */
.hc-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(225px,1fr));
  gap:16px;
}

/* Card */
.hc-card{
  position:relative;isolation:isolate;overflow:hidden;
  border-radius:20px;
  background:var(--hc-surface);
  border:1px solid var(--hc-border);
  transition:transform .3s cubic-bezier(.2,.8,.2,1),box-shadow .3s ease;
  animation:hc-in .55s cubic-bezier(.2,.8,.2,1) backwards;
  animation-delay:calc(var(--hc-i,0) * 45ms);
}
.hc-card::before{ /* soft colour glow */
  content:"";position:absolute;z-index:-1;
  width:190px;height:190px;border-radius:50%;
  inset-inline-end:-70px;bottom:-90px;
  background:radial-gradient(closest-side,var(--hc-b),transparent);
  opacity:.14;transition:opacity .35s ease,transform .45s ease;
}
.hc-card::after{ /* gradient border, shown on hover / open */
  content:"";position:absolute;inset:0;border-radius:inherit;padding:2px;pointer-events:none;
  background:linear-gradient(135deg,var(--hc-a),var(--hc-b));
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);
  -webkit-mask-composite:xor;mask-composite:exclude;
  opacity:0;transition:opacity .3s ease;
}
@media (hover:hover){
  .hc-card:hover{transform:translateY(-5px);box-shadow:0 22px 40px -22px var(--hc-a)}
  .hc-card:hover::before{opacity:.28;transform:scale(1.18)}
  .hc-card:hover::after{opacity:1}
  }
.hc-card.is-open::after{opacity:1}
.hc-card:active{transform:scale(.98)}
.hc-card.is-open{box-shadow:0 22px 40px -24px var(--hc-a)}

.hc-main,.hc-jump,.hc-btn,.hc-tool{-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.hc-jump::after{content:"";position:absolute;inset:-8px;border-radius:50%}
.hc-main{
  all:unset;box-sizing:border-box;cursor:pointer;
  display:flex;flex-direction:column;align-items:flex-start;gap:6px;
  width:100%;height:100%;padding:20px;
  font:inherit;color:var(--hc-text);text-align:start;
}
.hc-main:focus-visible{outline:3px solid var(--hc-a);outline-offset:-3px;border-radius:20px}

.hc-icon{
  flex:none;display:grid;place-items:center;
  width:52px;height:52px;border-radius:16px;margin-bottom:10px;
  color:#fff;
  background:linear-gradient(135deg,var(--hc-a),var(--hc-b));
  box-shadow:0 12px 22px -10px var(--hc-a),inset 0 1px 0 rgba(255,255,255,.35);
  transition:transform .35s cubic-bezier(.2,.8,.2,1);
}
.hc-icon svg{width:25px;height:25px}

.hc-name{font-size:1.04rem;font-weight:700;line-height:1.3;color:var(--hc-text);padding-inline-end:28px}
.hc-desc{
  font-size:.84rem;line-height:1.45;color:var(--hc-muted);
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
.hc-foot{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  width:100%;margin-top:auto;padding-top:14px;
}
.hc-stack{display:flex;align-items:center}
.hc-stack img,.hc-more{
  width:30px;height:30px;border-radius:50%;flex:none;
  background:var(--hc-surface);
  border:2px solid var(--hc-surface);
  box-shadow:0 0 0 1px var(--hc-border);
  object-fit:contain;padding:4px;box-sizing:border-box;
  margin-inline-start:-9px;
}
.hc-stack > :first-child{margin-inline-start:0}
.hc-more{display:grid;place-items:center;padding:0;font-size:.68rem;font-weight:700;color:var(--hc-muted)}
.hc-cta{
  display:inline-flex;align-items:center;gap:3px;white-space:nowrap;
  font-size:.8rem;font-weight:700;
  background:linear-gradient(90deg,var(--hc-a),var(--hc-b));
  -webkit-background-clip:text;background-clip:text;color:transparent;
}
.hc-cta svg{stroke:var(--hc-b);transition:transform .3s ease}
.hc-card.is-open .hc-cta svg{transform:rotate(180deg)}

/* Jump-to-section button */
.hc-jump{
  position:absolute;top:18px;inset-inline-end:16px;z-index:2;
  width:34px;height:34px;border-radius:50%;
  display:grid;place-items:center;
  color:var(--hc-muted);background:var(--hc-chip);
  text-decoration:none;
  transition:transform .25s ease,color .25s ease,background .25s ease,box-shadow .25s ease;
}
@media (hover:hover){.hc-jump:hover{color:#fff;background:linear-gradient(135deg,var(--hc-a),var(--hc-b));transform:translateY(2px)}}
.hc-jump:focus-visible{
  color:#fff;background:linear-gradient(135deg,var(--hc-a),var(--hc-b));
  transform:translateY(2px);box-shadow:0 8px 16px -8px var(--hc-a);outline:none;
}

/* Tools panel */
.hc-panel{
  grid-column:1 / -1;position:relative;overflow:hidden;
  border-radius:22px;
  background:var(--hc-surface);
  border:1px solid var(--hc-border);
  box-shadow:0 26px 50px -30px var(--hc-a);
  animation:hc-drop .38s cubic-bezier(.2,.8,.2,1);
}
.hc-panel[hidden]{display:none}
.hc-panel::before{
  content:"";position:absolute;inset:0 0 auto 0;height:4px;
  background:linear-gradient(90deg,var(--hc-a),var(--hc-b));
}
.hc-panel-head{display:flex;align-items:center;flex-wrap:wrap;gap:14px;padding:22px 22px 10px}
.hc-panel-head .hc-icon{width:46px;height:46px;margin:0;border-radius:14px}
.hc-panel-head .hc-icon svg{width:22px;height:22px}
.hc-panel-text{min-width:0}
.hc-panel-title{margin:0;font-size:1.12rem;font-weight:800;color:var(--hc-text)}
.hc-panel-meta{font-size:.82rem;color:var(--hc-muted)}
.hc-panel-actions{margin-inline-start:auto;display:flex;align-items:center;gap:8px}
.hc-btn{
  display:inline-flex;align-items:center;gap:6px;
  height:38px;padding:0 16px;border-radius:999px;
  font-size:.84rem;font-weight:600;line-height:1;
  color:var(--hc-text);background:var(--hc-chip);border:0;
  cursor:pointer;text-decoration:none;
  transition:transform .2s ease,box-shadow .2s ease,filter .2s ease;
}
.hc-btn:hover{transform:translateY(-1px);color:var(--hc-text);text-decoration:none}
.hc-btn-primary,.hc-btn-primary:hover{color:#fff;background:linear-gradient(135deg,var(--hc-a),var(--hc-b));box-shadow:0 10px 20px -12px var(--hc-a)}
.hc-btn-primary:hover{filter:brightness(1.06)}
.hc-close{width:38px;padding:0;justify-content:center}

.hc-tools{
  list-style:none;margin:0;
  display:grid;grid-template-columns:repeat(auto-fill,minmax(215px,1fr));gap:10px;
  padding:10px 22px 24px;
  max-height:440px;overflow-y:auto;overscroll-behavior:contain;
}
.hc-tool{
  display:flex;align-items:center;gap:11px;height:100%;
  padding:10px 12px;border-radius:14px;
  color:var(--hc-text);text-decoration:none;
  border:1px solid var(--hc-border);
  transition:background .2s ease,border-color .2s ease,transform .2s ease;
}
@media (hover:hover){.hc-tool:hover{color:var(--hc-text);text-decoration:none;background:var(--hc-chip);border-color:var(--hc-a);transform:translateX(3px)}}
.hc-tool:active{background:var(--hc-chip)}
.hc-tool:focus-visible{
  color:var(--hc-text);text-decoration:none;
  background:var(--hc-chip);border-color:var(--hc-a);transform:translateX(3px);outline:none;
}
@media (hover:hover){[dir="rtl"] .hc-tool:hover{transform:translateX(-3px)}}
[dir="rtl"] .hc-tool:focus-visible{transform:translateX(-3px)}
.hc-tool img{width:30px;height:30px;flex:none;object-fit:contain}
.hc-tool span{font-size:.9rem;font-weight:500;line-height:1.3}

/* The category box the jump button scrolls to */
#tools-box .card{scroll-margin-top:90px}
.hc-flash{animation:hc-flash 1.8s ease}

@keyframes hc-in{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
@keyframes hc-drop{from{opacity:0;transform:translateY(-8px) scale(.99)}to{opacity:1;transform:none}}
@keyframes hc-flash{0%,100%{box-shadow:0 0 0 0 rgba(124,58,237,0)}25%{box-shadow:0 0 0 4px rgba(124,58,237,.45)}}

/* Tablet */
@media (max-width:991.98px){
  .hc-overlap .hc-shell{margin-top:-44px}
  .hc-shell{padding:22px}
  .hc-grid{grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:14px}
}
/* Phone: compact two-column cards */
@media (max-width:575.98px){
  .hc-overlap .hc-shell{margin-top:-32px}
  .hc-shell{padding:16px;border-radius:20px}
  .hc-title{font-size:1.2rem}
  .hc-title::before{height:22px;width:8px}
  .hc-sub{font-size:.86rem}
  .hc-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .hc-card{border-radius:16px}
  .hc-main{padding:14px;gap:4px}
  .hc-icon{width:42px;height:42px;border-radius:13px;margin-bottom:6px}
  .hc-icon svg{width:21px;height:21px}
  .hc-name{font-size:.92rem;padding-inline-end:0}
  .hc-desc,.hc-stack{display:none}
  .hc-foot{padding-top:8px}
  .hc-jump{top:12px;inset-inline-end:10px;width:34px;height:34px}
  .hc-panel-head{padding:18px 16px 8px}
  .hc-panel-actions{margin-inline-start:0;width:100%}
  .hc-panel-actions .hc-btn-primary{flex:1;justify-content:center}
  .hc-tools{grid-template-columns:1fr;gap:8px;padding:8px 16px 18px;max-height:none;overflow:visible}
  .hc-tool{min-height:48px}
  .hc-btn{height:42px}
  .hc-close{width:42px}
}
@media (prefers-reduced-motion:reduce){
  .hc-card,.hc-panel,.hc-flash{animation:none}
  .hc-card,.hc-icon,.hc-tool,.hc-jump,.hc-btn{transition:none}
  .hc-card:hover{transform:none}
}
.theme-dark .hc-cta{filter:brightness(1.3) saturate(1.1)}
