/* Homepage tools discovery — iLoveIMG-inspired hub grid */

.tools-discovery {
  margin: 8px 0 32px;
  padding: 0;
}

/* Full catalog panel (Ferramentas category page only) */
.tools-discovery.is-catalog {
  margin-top: 28px;
  margin-bottom: 40px;
  padding: 28px 20px 32px;
  border-radius: 24px;
  background:
    radial-gradient(1200px 420px at 50% -10%, rgba(59, 130, 246, 0.08), transparent 60%),
    linear-gradient(180deg, #f4f7fc 0%, #eef2f8 100%);
  border: 1px solid #e5ebf5;
}

html[data-theme="dark"] .tools-discovery.is-catalog {
  background:
    radial-gradient(1000px 380px at 50% -10%, rgba(59, 130, 246, 0.12), transparent 55%),
    linear-gradient(180deg, #151a24 0%, #12161f 100%);
  border-color: var(--dica-border, #2a3344);
}

/* Homepage hubs strip */
.tools-discovery.is-home-hubs {
  margin: 8px 0 32px;
}
.tools-discovery-all {
  flex-shrink: 0;
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 650;
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
}
.tools-discovery-all:hover {
  text-decoration: underline;
}
.td-grid.is-multi {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (min-width: 1101px) {
  .tools-discovery.is-home-hubs .td-grid:not(.is-multi) {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .tools-discovery.is-home-hubs .td-grid.is-multi {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* —— Hero —— */
.td-hero {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 22px;
}
.td-hero-title {
  margin: 0 0 10px;
  font-size: clamp(1.45rem, 2.6vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.2;
  color: var(--dica-ink, #0f172a);
}
.td-hero-lead {
  margin: 0 auto;
  max-width: 540px;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--dica-muted, #64748b);
}
.td-hero-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
  font-size: 0.8rem;
  font-weight: 700;
}
html[data-theme="dark"] .td-hero-note {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

/* —— Filters —— */
.td-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 22px;
  max-width: 920px;
}
.td-filter {
  appearance: none;
  border: 1px solid transparent;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.td-filter:hover {
  border-color: #cbd5e1;
  color: #0f172a;
}
.td-filter.is-active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
}
.td-filter:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
html[data-theme="dark"] .td-filter {
  background: var(--dica-surface, #1a1f2e);
  color: var(--dica-body, #cbd5e1);
  border-color: var(--dica-border, #2a3344);
}
html[data-theme="dark"] .td-filter.is-active {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #e2e8f0;
}

/* —— Grid —— */
.td-tools-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.td-tools-grid[hidden] {
  display: none !important;
}

a.td-tool {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 168px;
  padding: 20px 18px 18px;
  border-radius: 18px;
  border: 1px solid #e8edf5;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 10px 28px rgba(15, 23, 42, 0.05);
  text-decoration: none !important;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
a.td-tool:hover {
  border-color: #c7d2fe;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.1);
  transform: translateY(-2px);
  text-decoration: none !important;
  color: inherit;
}
a.td-tool::after {
  content: none !important;
  display: none !important;
}
a.td-tool[hidden] {
  display: none !important;
}

.td-tool-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.td-tool-badge svg {
  width: 24px;
  height: 24px;
  display: block;
}

.td-tool--pdf .td-tool-badge { background: #fee2e2; color: #dc2626; }
.td-tool--image .td-tool-badge { background: #dbeafe; color: #2563eb; }
.td-tool--video .td-tool-badge { background: #ede9fe; color: #7c3aed; }
.td-tool--whatsapp .td-tool-badge { background: #dcfce7; color: #16a34a; }
.td-tool--zip .td-tool-badge { background: #ffedd5; color: #ea580c; }
.td-tool--tests .td-tool-badge { background: #e0e7ff; color: #4f46e5; }
.td-tool--util .td-tool-badge { background: #fce7f3; color: #db2777; }

.td-tool-name {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--dica-ink, #0f172a);
  letter-spacing: -0.2px;
}
.td-tool-desc {
  flex: 1;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--dica-muted, #64748b);
}
.td-tool-new {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.td-foot {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}
.td-foot-link {
  font-size: 0.92rem;
  font-weight: 700;
  color: #2563eb;
  text-decoration: none;
}
.td-foot-link:hover {
  text-decoration: underline;
}

/* —— Hub cards (homepage + category top) —— */
.tools-discovery.is-category {
  margin: 8px 0 24px;
  padding: 0;
  background: none;
  border: 0;
}
.tools-discovery-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.tools-discovery-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.35px;
  line-height: 1.2;
  color: var(--dica-ink, #0f172a);
}
.tools-discovery-spark {
  display: inline-flex;
  color: #3b82f6;
  font-size: 1.05rem;
  line-height: 1;
}
.tools-discovery-lead {
  margin: 8px 0 0;
  max-width: 520px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #64748b;
}
.td-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
a.td-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 168px;
  padding: 16px 16px 14px;
  border-radius: 16px;
  border: 1px solid #e8edf5;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  text-decoration: none !important;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
a.td-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
  text-decoration: none !important;
  color: inherit;
}
a.td-card::after {
  content: none !important;
  display: none !important;
}
.td-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.td-badge svg {
  width: 22px;
  height: 22px;
  display: block;
}
.td-card--pdf .td-badge { background: #fee2e2; color: #dc2626; }
.td-card--image .td-badge { background: #dcfce7; color: #16a34a; }
.td-card--video .td-badge { background: #ede9fe; color: #7c3aed; }
.td-card--whatsapp .td-badge { background: #dcfce7; color: #16a34a; }
.td-card--zip .td-badge { background: #ffedd5; color: #ea580c; }
.td-card--util .td-badge { background: #e0e7ff; color: #4f46e5; }
.td-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}
.td-desc {
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #64748b;
}
.td-go {
  margin-top: auto;
  font-size: 0.88rem;
  font-weight: 700;
  color: #2563eb;
}

html[data-theme="dark"] a.td-tool,
html[data-theme="dark"] a.td-card {
  background: var(--dica-surface, #1a1f2e);
  border-color: var(--dica-border, #2a3344);
}
html[data-theme="dark"] .td-tool-name,
html[data-theme="dark"] .td-title,
html[data-theme="dark"] .tools-discovery-title,
html[data-theme="dark"] .td-hero-title {
  color: var(--dica-ink, #f1f5f9);
}
html[data-theme="dark"] .td-tool-desc,
html[data-theme="dark"] .td-desc,
html[data-theme="dark"] .tools-discovery-lead,
html[data-theme="dark"] .td-hero-lead {
  color: var(--dica-muted, #94a3b8);
}

@media (max-width: 1100px) {
  .td-tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .tools-discovery.is-catalog {
    padding: 22px 14px 26px;
    border-radius: 18px;
  }
  .td-tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  a.td-tool {
    min-height: 150px;
    padding: 16px 14px 14px;
  }
  .td-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tools-discovery-head {
    flex-direction: column;
  }
}
@media (max-width: 420px) {
  .td-tools-grid,
  .td-grid {
    grid-template-columns: 1fr;
  }
  .td-filter {
    padding: 8px 12px;
    font-size: 0.82rem;
  }
}
