/* ==========================================================================
   Digigosticx – Free Tools page (/tools)
   Left: every tool by category (scrolls with the page).
   Right: "10 most popular" box that stays in place while the left side scrolls.
   Uses the colour variables from header.css and home.css.
   ========================================================================== */

/* ---------- hero ---------- */
.tp-crumbs ol, .tp-pop-list { list-style: none; margin: 0; padding: 0; }
.tp-hero { padding: 36px 0 34px; background: var(--dgx-ground); border-bottom: 1px solid var(--dgx-line); }
.tp-crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; color: var(--dgx-muted); margin-bottom: 26px !important; }
.tp-crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--dgx-line-strong); }
.tp-crumbs a { text-decoration: none; color: var(--dgx-ink-2); }
.tp-crumbs a:hover { color: var(--dgx-violet-ink); }
.tp-hero__in { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 40px; align-items: end; }
.tp-hero__in .hp-lead { margin-top: 14px; }
.tp-h1 { margin: 0; font: 800 clamp(32px, 4.2vw, 52px)/1.06 var(--dgx-display); letter-spacing: -1.2px; text-wrap: balance; }

.tp-search { position: relative; }
.tp-search > svg { position: absolute; left: 18px; top: 18px; pointer-events: none; }
.tp-search input { width: 100%; height: 58px; padding: 0 18px 0 50px; border-radius: 16px; border: 1.5px solid var(--dgx-line-strong); background: var(--dgx-surface); color: var(--dgx-ink); font: 500 16px var(--dgx-font); box-shadow: 0 10px 24px rgba(22, 19, 46, .06); }
.tp-search input:focus { outline: none; border-color: var(--dgx-violet); box-shadow: 0 0 0 4px var(--dgx-tint); }
.tp-search__count { margin: 8px 4px 0; font-size: 13.5px; color: var(--dgx-muted); }

.tp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px !important; }
.tp-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--dgx-line); background: var(--dgx-surface); font-size: 14px; font-weight: 600; text-decoration: none; transition: border-color .15s, background .15s; }
.tp-chip span { font-size: 12px; font-weight: 700; color: var(--dgx-muted); background: var(--dgx-ground); border-radius: 999px; padding: 1px 7px; }
.tp-chip:hover, .tp-chip.is-active { border-color: var(--dgx-violet); color: var(--dgx-violet-ink); }
.tp-chip.is-active { background: var(--dgx-tint); }

/* ---------- two-column layout ---------- */
.tp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; padding-top: 40px; padding-bottom: 96px; }
.tp-main { min-width: 0; display: flex; flex-direction: column; gap: 52px; }

/* right column stays in place below the sticky header while the tools scroll */
.tp-aside {
  position: sticky; top: calc(var(--dgx-bar-h) + 20px);
  max-height: calc(100vh - var(--dgx-bar-h) - 40px); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 16px; padding-bottom: 4px; scrollbar-width: thin;
}

/* ---------- category sections ---------- */
.tp-cat { scroll-margin-top: calc(var(--dgx-bar-h) + 20px); }
.tp-cat__head { display: flex; align-items: center; gap: 16px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--dgx-line); }
.tp-cat__head > div { flex: 1; min-width: 0; }
.tp-cat__title { margin: 0; font: 800 24px/1.2 var(--dgx-display); letter-spacing: -.3px; display: flex; align-items: center; gap: 10px; }
.tp-count { font: 700 13px var(--dgx-font); color: var(--dgx-violet-ink); background: var(--dgx-tint); border-radius: 999px; padding: 2px 9px; }
.tp-cat__intro { margin: 4px 0 0; color: var(--dgx-ink-2); font-size: 15px; }
.tp-cat__all { flex: 0 0 auto; font-size: 14px; font-weight: 700; color: var(--dgx-violet-ink); text-decoration: none; }
.tp-cat__all:hover { text-decoration: underline; }

.tp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tp-tool { position: relative; display: flex; align-items: flex-start; gap: 14px; height: 100%; padding: 16px; border-radius: 16px; border: 1px solid var(--dgx-line); background: var(--dgx-surface); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tp-tool:hover { border-color: var(--dgx-line-strong); box-shadow: 0 12px 26px rgba(22, 19, 46, .08); transform: translateY(-1px); }
.tp-tool:hover .dgx-tile { transform: translateY(-1px); }
.tp-tool__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.tp-tool__name { font-weight: 700; font-size: 15.5px; color: var(--dgx-ink); }
.tp-tool:hover .tp-tool__name { color: var(--dgx-violet-ink); }
.tp-tool__desc { font-size: 13.5px; color: var(--dgx-muted); line-height: 1.45; }
.tp-tool__go { opacity: 0; transition: opacity .15s; flex: 0 0 auto; margin-top: 2px; }
.tp-tool:hover .tp-tool__go, .tp-tool:focus-visible .tp-tool__go { opacity: 1; }

.tp-badge { display: inline-block; margin-left: 8px; font-size: 9.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; vertical-align: 2px; }
.tp-badge--trending { color: var(--dgx-trending); }
.tp-badge--new { color: var(--dgx-new); }
.tp-empty { margin: 0; padding: 28px; border-radius: 18px; border: 1px dashed var(--dgx-line-strong); text-align: center; color: var(--dgx-ink-2); }
.tp-empty a { color: var(--dgx-violet-ink); font-weight: 700; }

/* ---------- popular box ---------- */
.tp-box { border-radius: 22px; border: 1px solid var(--dgx-line); background: var(--dgx-surface); padding: 18px; box-shadow: 0 18px 40px rgba(22, 19, 46, .07); }
.tp-box__head { padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--dgx-line-2); }
.tp-box__title { margin: 0; display: flex; align-items: center; gap: 8px; font: 800 19px var(--dgx-display); }
.tp-box__sub { margin: 4px 0 0; font-size: 13px; color: var(--dgx-muted); }
.tp-pop-list { display: flex; flex-direction: column; gap: 2px; }
.tp-pop { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; text-decoration: none; transition: background .12s; }
.tp-pop:hover { background: var(--dgx-hover); }
.tp-pop__text { display: flex; flex-direction: column; min-width: 0; }
.tp-pop__name { font-weight: 700; font-size: 14px; color: var(--dgx-ink); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-pop:hover .tp-pop__name { color: var(--dgx-violet-ink); }
.tp-pop__cat { font-size: 12px; color: var(--dgx-muted); display: flex; align-items: center; gap: 6px; }
.tp-pop__cat .tp-badge { margin-left: 0; vertical-align: 0; }
.tp-pop .dgx-tile--md { width: 34px; height: 34px; flex-basis: 34px; }
.tp-box--cta { background: var(--hp-band); border-color: var(--hp-band-line); color: #fff; display: flex; flex-direction: column; gap: 8px; }
.tp-box__kicker { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: #C9B8FF; }
.tp-box__cta-title { margin: 0 0 6px; font: 700 18px/1.25 var(--dgx-display); }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  .tp-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; }
  .tp-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .tp-hero__in { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  /* popular list moves above the categories and stops being sticky */
  .tp-layout { grid-template-columns: minmax(0, 1fr); }
  .tp-aside { position: static; max-height: none; overflow: visible; order: -1; }
  .tp-box--cta { display: none; }
  .tp-pop-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; }
  .tp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tp-hero { padding: 24px 0 26px; }
  .tp-chips { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px !important; margin-right: -16px !important; padding: 0 16px 6px; scrollbar-width: none; }
  .tp-chips::-webkit-scrollbar { display: none; }
  .tp-chip { white-space: nowrap; }
  .tp-pop-list, .tp-grid { grid-template-columns: minmax(0, 1fr); }
  .tp-cat__head { flex-wrap: wrap; }
  .tp-cat__all { width: 100%; padding-left: 68px; margin-top: -6px; }
  .tp-layout { padding-top: 24px; padding-bottom: 64px; }
}
@media (max-width: 1179px) { .tp-aside { top: calc(68px + 16px); } .tp-cat { scroll-margin-top: 84px; } }
@media (prefers-reduced-motion: reduce) { .tp-tool, .tp-tool:hover { transition: none; transform: none; } }
/* on shorter laptop screens keep the full popular list visible and drop the audit card */
@media (min-width: 961px) and (max-height: 960px) { .tp-box--cta { display: none; } }
.tp-tool__note { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--dgx-muted); }
