/* ==========================================================
   Tools hub (/tools)
   Reuses from main.css: nav, .tcv-footer, .tcv-free-review-split, .fr-card.
   ========================================================== */

:root {
  --th-primary: #2563eb;
  --th-primary-light: #3B82F6;
  --th-primary-deep: #1d4ed8;
  --th-primary-50: #eff6ff;
  --th-primary-100: #dbeafe;
  --th-primary-200: #bfdbfe;
  --th-primary-700: #1d4ed8;
  --th-ink: #0f172a;
  --th-ink-soft: #334155;
  --th-mute: #64748b;
  --th-mute-soft: #94a3b8;
  --th-surface: #ffffff;
  --th-surface-2: #f8fafc;
  --th-surface-3: #f1f5f9;
  --th-border: #e2e8f0;
  --th-border-soft: #f1f5f9;
  --th-radius: 10px;
  --th-radius-lg: 16px;
  --th-radius-xl: 24px;

  --tone-blue:        #2563eb;
  --tone-blue-deep:   #1d4ed8;
  --tone-blue-bg:     #eff6ff;
  --tone-blue-bg-2:   #dbeafe;
  --tone-blue-bd:     #bfdbfe;

  --tone-green:       #059669;
  --tone-green-deep:  #047857;
  --tone-green-bg:    #ecfdf5;
  --tone-green-bg-2:  #d1fae5;
  --tone-green-bd:    #a7f3d0;

  --tone-amber:       #d97706;
  --tone-amber-deep:  #b45309;
  --tone-amber-bg:    #fffbeb;
  --tone-amber-bg-2:  #fef3c7;
  --tone-amber-bd:    #fde68a;

  --tone-violet:      #7c3aed;
  --tone-violet-deep: #6d28d9;
  --tone-violet-bg:   #f5f3ff;
  --tone-violet-bg-2: #ede9fe;
  --tone-violet-bd:   #ddd6fe;
}

body.tools-hub { background: var(--th-surface); }


/* ==========================================================
   §1 HERO — flush to navbar, tight padding, soft blue bg
   ========================================================== */
.th-hero {
  position: relative;
  overflow: hidden;
  padding: 48px 1.25rem 24px;
  background:
    radial-gradient(900px 380px at 70% -10%, rgba(37, 99, 235, .14), transparent 60%),
    radial-gradient(700px 320px at 0% 110%, rgba(35, 206, 107, .07), transparent 65%),
    linear-gradient(180deg, #f4f7ff 0%, #eef2ff 100%);
  isolation: isolate;
  margin-bottom: 0;
}
/* Kill gap between navbar and hero — sit directly under the fixed nav */
.th-hero { margin-top: 0; }

.th-hero__decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
.th-hero__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
}
.th-hero__blob--a {
  width: 460px; height: 460px;
  top: -180px; right: -120px;
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  opacity: .18;
}
.th-hero__blob--b {
  width: 320px; height: 320px;
  bottom: -140px; left: -100px;
  background: linear-gradient(135deg, #23ce6b, #00a6fb);
  opacity: .12;
}
.th-hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(37, 99, 235, .06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(37, 99, 235, .06) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 80%);
  opacity: .8;
}

.th-hero__inner {
  max-width: 920px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}

/* Eyebrow as a flat tag (not pill) */
.th-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--th-primary-700);
  margin: 0 0 18px;
}
.th-eyebrow__dot {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--th-primary);
}

.th-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--th-ink);
  margin: 0 0 16px;
  background: none;
  -webkit-text-fill-color: var(--th-ink);
}
.th-grad {
  background: linear-gradient(90deg, #3B82F6 0%, #2563EB 50%, #1d4ed8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

.th-hero__sub {
  max-width: 680px;
  margin: 0 auto 22px;
  color: var(--th-ink-soft);
  font-size: 1.05rem;
  line-height: 1.55;
}

.th-hero__chips {
  list-style: none;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 0;
  margin: 0;
}
.th-hero__chips li {
  font-size: 12px;
  font-weight: 600;
  color: var(--th-ink-soft);
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(37, 99, 235, .12);
  border-radius: 999px;
  padding: 6px 12px;
}
.th-hero__chips li strong {
  color: var(--th-primary-700);
  font-weight: 800;
  margin-right: 2px;
}


/* ==========================================================
   §2 STICKY FILTER BAR — flush to hero
   ========================================================== */
.th-filterbar {
  position: sticky;
  top: 80px;
  z-index: 50;
  background: #ffffff;
  border-bottom: 1px solid var(--th-border);
}
.th-filterbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 1.25rem 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.th-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--th-ink-soft);
  background: var(--th-surface);
  border: 1px solid var(--th-border);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
}
.th-filter__icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  color: var(--th-mute);
  transition: color .15s ease;
}
.th-filter__icon svg { width: 16px; height: 16px; }
.th-filter__count {
  display: inline-block;
  min-width: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--th-mute);
  background: var(--th-surface-3);
  border-radius: 999px;
  padding: 2px 7px;
  margin-left: 2px;
  transition: all .15s ease;
}
.th-filter:hover {
  color: var(--th-primary-700);
  border-color: var(--th-primary-200);
  background: var(--th-primary-50);
  transform: translateY(-1px);
}
.th-filter:hover .th-filter__icon { color: var(--th-primary-700); }
.th-filter.is-active {
  color: #fff;
  background: linear-gradient(90deg, #3B82F6 0%, #2563EB 100%);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .25);
}
.th-filter.is-active .th-filter__icon { color: #fff; }
.th-filter.is-active .th-filter__count {
  background: rgba(255, 255, 255, .25);
  color: #fff;
}


/* ==========================================================
   §3 MAIN — clusters on tinted panels
   ========================================================== */
.tools-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 1.25rem 64px;
}

.th-cluster {
  position: relative;
  overflow: hidden;
  scroll-margin-top: 156px;
  padding: 32px 32px 36px;
  border-radius: var(--th-radius-xl);
  margin-bottom: 20px;
  isolation: isolate;
  transition: opacity .25s ease, transform .25s ease;
}

/* Per-tone tinted backgrounds and decorative blobs */
.th-cluster[data-tone="blue"] {
  background:
    radial-gradient(700px 380px at 90% -20%, rgba(37, 99, 235, .14), transparent 60%),
    linear-gradient(160deg, #f1f5ff 0%, #eef2ff 100%);
  border: 1px solid rgba(37, 99, 235, .12);
}
.th-cluster[data-tone="green"] {
  background:
    radial-gradient(700px 380px at 90% -20%, rgba(5, 150, 105, .12), transparent 60%),
    linear-gradient(160deg, #f0fdf6 0%, #ecfdf5 100%);
  border: 1px solid rgba(5, 150, 105, .12);
}
.th-cluster[data-tone="amber"] {
  background:
    radial-gradient(700px 380px at 90% -20%, rgba(217, 119, 6, .12), transparent 60%),
    linear-gradient(160deg, #fffbf2 0%, #fff7e6 100%);
  border: 1px solid rgba(217, 119, 6, .14);
}
.th-cluster[data-tone="violet"] {
  background:
    radial-gradient(700px 380px at 90% -20%, rgba(124, 58, 237, .12), transparent 60%),
    linear-gradient(160deg, #f8f5ff 0%, #f5f3ff 100%);
  border: 1px solid rgba(124, 58, 237, .14);
}

/* Decorative shape in cluster top-right */
.th-cluster::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .35;
  z-index: -1;
}
.th-cluster[data-tone="blue"]::before   { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.th-cluster[data-tone="green"]::before  { background: linear-gradient(135deg, #34d399, #059669); }
.th-cluster[data-tone="amber"]::before  { background: linear-gradient(135deg, #fbbf24, #d97706); }
.th-cluster[data-tone="violet"]::before { background: linear-gradient(135deg, #a78bfa, #7c3aed); }

/* SEO-safe filtering */
body.tools-hub.is-filtered .th-cluster[data-cluster] { display: none; }
body.tools-hub.is-filtered .th-cluster.is-active { display: block; }


/* Cluster head — magazine-style with imagery */
.th-cluster__head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 32px;
}
@media (min-width: 880px) {
  .th-cluster__head {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 40px;
  }
}

.th-cluster__intro {
  text-align: left;
}
.th-cluster__icon {
  display: inline-flex;
  width: 56px;
  height: 56px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  margin: 0 0 14px;
  color: #fff;
}
.th-cluster__icon svg { width: 26px; height: 26px; }

.th-cluster[data-tone="blue"] .th-cluster__icon {
  background: linear-gradient(135deg, #3B82F6 0%, #1d4ed8 100%);
  box-shadow: 0 10px 24px rgba(37, 99, 235, .3);
}
.th-cluster[data-tone="green"] .th-cluster__icon {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  box-shadow: 0 10px 24px rgba(5, 150, 105, .3);
}
.th-cluster[data-tone="amber"] .th-cluster__icon {
  background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  box-shadow: 0 10px 24px rgba(217, 119, 6, .3);
}
.th-cluster[data-tone="violet"] .th-cluster__icon {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  box-shadow: 0 10px 24px rgba(124, 58, 237, .3);
}

.th-cluster__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.th-cluster[data-tone="blue"]   .th-cluster__label { color: var(--tone-blue-deep); }
.th-cluster[data-tone="green"]  .th-cluster__label { color: var(--tone-green-deep); }
.th-cluster[data-tone="amber"]  .th-cluster__label { color: var(--tone-amber-deep); }
.th-cluster[data-tone="violet"] .th-cluster__label { color: var(--tone-violet-deep); }

.th-cluster__head h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.95rem);
  letter-spacing: -0.015em;
  font-weight: 800;
  color: var(--th-ink);
  margin: 0 0 12px;
  text-align: left;
  line-height: 1.2;
}
.th-cluster__sub {
  color: var(--th-ink-soft);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  text-align: left;
}

/* Decorative preview card (right side of cluster head) */
.th-cluster__visual {
  position: relative;
  height: 200px;
  perspective: 800px;
  display: none;
}
@media (min-width: 880px) {
  .th-cluster__visual { display: block; }
}

.th-preview {
  position: absolute;
  background: #fff;
  border-radius: 12px;
  box-shadow:
    0 1px 3px rgba(15, 23, 42, .08),
    0 18px 40px rgba(15, 23, 42, .12);
  overflow: hidden;
  transform-origin: center center;
}
.th-preview--main {
  inset: 16px 32px 16px 0;
  transform: rotate3d(0, 1, 0, -8deg) rotate(-2deg);
  z-index: 2;
}
.th-preview--back {
  inset: 0 0 24px 56px;
  transform: rotate3d(0, 1, 0, -10deg) rotate(3deg);
  opacity: .75;
  z-index: 1;
}
.th-preview__top {
  height: 24px;
  background: linear-gradient(90deg, var(--prev-grad-a), var(--prev-grad-b));
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 5px;
}
.th-preview__top::before, .th-preview__top::after, .th-preview__dot {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .5);
}
.th-preview__body {
  padding: 12px 14px;
}
.th-preview__line {
  height: 6px;
  border-radius: 4px;
  background: var(--th-surface-3);
  margin-bottom: 8px;
}
.th-preview__line--w70 { width: 70%; }
.th-preview__line--w50 { width: 50%; }
.th-preview__line--w90 { width: 90%; }
.th-preview__line--w40 { width: 40%; }
.th-preview__bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 56px;
  margin-top: 10px;
}
.th-preview__bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--prev-grad-a), var(--prev-grad-b));
  opacity: .85;
}
.th-preview__funnel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}
.th-preview__funnel-row {
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--prev-grad-a), var(--prev-grad-b));
}
.th-preview__metric {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 8px 0;
}
.th-preview__num {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--prev-grad-a), var(--prev-grad-b));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.th-preview__num-suffix {
  font-size: 14px;
  font-weight: 700;
  color: var(--th-mute);
}

.th-cluster[data-tone="blue"]   .th-preview { --prev-grad-a: #60a5fa; --prev-grad-b: #2563eb; }
.th-cluster[data-tone="green"]  .th-preview { --prev-grad-a: #34d399; --prev-grad-b: #059669; }
.th-cluster[data-tone="amber"]  .th-preview { --prev-grad-a: #fbbf24; --prev-grad-b: #d97706; }
.th-cluster[data-tone="violet"] .th-preview { --prev-grad-a: #a78bfa; --prev-grad-b: #7c3aed; }


/* ==========================================================
   §4 CARD GRID — 4 tools per row on desktop.
   :has() collapses to fewer columns when the cluster has
   fewer cards, so 2- and 3-tool clusters fill the row evenly
   instead of leaving empty columns.
   ========================================================== */
.th-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.th-cluster:has(.th-card:nth-child(3):last-child) .th-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.th-cluster:has(.th-card:nth-child(2):last-child) .th-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.th-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--th-surface);
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: var(--th-radius-lg);
  padding: 20px 20px 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
  transition: transform .2s ease, box-shadow .2s ease;
  overflow: hidden;
}
.th-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--th-card-grad-from), var(--th-card-grad-to));
  opacity: 0;
  transition: opacity .2s ease;
}
.th-card[data-tone="blue"]   { --th-card-grad-from: #3B82F6; --th-card-grad-to: #1d4ed8; }
.th-card[data-tone="green"]  { --th-card-grad-from: #10b981; --th-card-grad-to: #047857; }
.th-card[data-tone="amber"]  { --th-card-grad-from: #f59e0b; --th-card-grad-to: #b45309; }
.th-card[data-tone="violet"] { --th-card-grad-from: #8b5cf6; --th-card-grad-to: #6d28d9; }

.th-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, .10);
}
.th-card:hover::before { opacity: 1; }

/* Live cards */
.th-card--live {
  background: #fff;
  border-color: var(--th-primary-200);
  box-shadow: 0 8px 24px rgba(37, 99, 235, .12);
}
.th-card--live::before { opacity: 1; height: 4px; }

.th-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.th-card__icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex: 0 0 auto;
  transition: transform .2s ease;
}
.th-card__icon svg { width: 22px; height: 22px; }
.th-card[data-tone="blue"] .th-card__icon {
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  box-shadow: 0 6px 14px rgba(37, 99, 235, .25);
}
.th-card[data-tone="green"] .th-card__icon {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  box-shadow: 0 6px 14px rgba(5, 150, 105, .25);
}
.th-card[data-tone="amber"] .th-card__icon {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  box-shadow: 0 6px 14px rgba(217, 119, 6, .25);
}
.th-card[data-tone="violet"] .th-card__icon {
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  box-shadow: 0 6px 14px rgba(124, 58, 237, .25);
}
.th-card:hover .th-card__icon { transform: scale(1.05) rotate(-3deg); }

/* Status badge */
.th-card__badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid;
  flex: 0 0 auto;
  white-space: nowrap;
}
.th-card__badge--soon {
  color: var(--th-mute);
  background: rgba(255, 255, 255, .6);
  border-color: var(--th-border);
}
.th-card__badge--new {
  color: #fff;
  background: linear-gradient(90deg, #3B82F6 0%, #2563EB 100%);
  border-color: transparent;
  box-shadow: 0 3px 8px rgba(37, 99, 235, .3);
}

.th-card__title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--th-ink);
  letter-spacing: -0.01em;
  margin: 6px 0 6px;
  text-align: left;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}
.th-card__pitch {
  color: var(--th-ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0;
  position: relative;
  z-index: 1;
}
.th-card__hook {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--th-primary-700);
  background: rgba(37, 99, 235, .08);
  border-radius: 4px;
  padding: 4px 8px;
  margin: 4px 0 0;
  position: relative;
  z-index: 1;
}

.th-card__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  position: relative;
  z-index: 1;
}

.th-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #3B82F6 0%, #2563EB 100%);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .22);
  transition: transform .15s ease, box-shadow .15s ease;
}
.th-card__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(37, 99, 235, .32);
  color: #fff;
}
.th-card__cta--ghost {
  color: var(--th-mute);
  background: rgba(255, 255, 255, .5);
  border: 1px dashed rgba(15, 23, 42, .15);
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}
.th-card__cta--ghost:hover { transform: none; box-shadow: none; }

.th-card__secondary {
  display: inline-block;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--th-primary-700);
  padding: 4px 0;
  transition: color .15s ease;
}
.th-card__secondary:hover {
  color: var(--th-primary);
  text-decoration: underline;
}


/* ==========================================================
   §5 RESPONSIVE
   ========================================================== */
@media (max-width: 1080px) {
  .th-grid,
  .th-cluster:has(.th-card:nth-child(3):last-child) .th-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 768px) {
  .th-hero { padding: 40px 1rem 0; }
  .th-hero h1 { font-size: 2rem; }
  .th-filterbar__inner { padding: 12px 1rem 14px; gap: 6px; }
  .th-filter { padding: 8px 12px 8px 10px; font-size: 13px; }
  .th-filter__icon svg { width: 14px; height: 14px; }
  .th-cluster { padding: 28px 22px 28px; margin-bottom: 18px; }
  .th-cluster__icon { width: 48px; height: 48px; }
  .th-cluster__icon svg { width: 22px; height: 22px; }
  .tools-main { padding: 24px 1rem 48px; }
}
@media (max-width: 480px) {
  .th-grid,
  .th-cluster:has(.th-card:nth-child(3):last-child) .th-grid,
  .th-cluster:has(.th-card:nth-child(2):last-child) .th-grid {
    grid-template-columns: 1fr;
  }
  .th-cluster { padding: 24px 18px 24px; }
}
