/* ToolRadar — core stylesheet
   Plain CSS, no build step, no external fonts. */

:root {
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --bg-card: #ffffff;
  --text: #111827;
  --text-mid: #4b5563;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #4338ca;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --radius: 14px;
  --radius-sm: 8px;
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --bg-alt: #12151c;
    --bg-card: #141821;
    --text: #e8eaed;
    --text-mid: #b8bfcc;
    --text-muted: #8b94a5;
    --border: #232833;
    --border-strong: #2f3542;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: #1a1b3a;
    --accent-text: #a5b4fc;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.02em;
  flex-shrink: 0;
}

.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}

.logo-mark svg { width: 17px; height: 17px; }

.nav-links {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-mid);
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.nav-links a:hover {
  background: var(--bg-alt);
  color: var(--text);
}

/* ---------- search ---------- */

.search {
  position: relative;
  flex-shrink: 0;
  width: 212px;
}

.search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.search input:focus {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 15px;
  height: 15px;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
}

.search-results.open { display: block; }

.search-results a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.search-results a:hover,
.search-results a.active { background: var(--accent-soft); }

.search-results .sr-name { font-weight: 600; flex-shrink: 0; }
.search-results .sr-cat { color: var(--text-muted); font-size: 12px; }
.search-results .sr-empty {
  padding: 14px 10px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- hero ---------- */

.hero {
  padding: 64px 0 44px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.15;
  letter-spacing: -.03em;
  margin: 0 0 14px;
  font-weight: 800;
}

.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent), #db2777 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  font-size: clamp(15px, 2vw, 17px);
  color: var(--text-mid);
  max-width: 620px;
  margin: 0 auto 26px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 34px;
  flex-wrap: wrap;
  margin-top: 26px;
  color: var(--text-muted);
  font-size: 14px;
}

.hero-stats b {
  display: block;
  font-size: 22px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -.02em;
}

/* ---------- section headings ---------- */

.section {
  padding: 34px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head h2 {
  font-size: 21px;
  letter-spacing: -.02em;
  margin: 0;
  font-weight: 700;
}

.section-head .more {
  font-size: 14px;
  color: var(--accent-text);
  font-weight: 500;
}

/* ---------- category grid ---------- */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 14px;
}

.cat-card {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}

.cat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.cat-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.cat-icon svg { width: 19px; height: 19px; }

.cat-card h3 {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.cat-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Keeps the tool count pinned to the bottom so cards align across a row. */
.cat-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.cat-count {
  margin-top: auto !important;
  padding-top: 8px;
  font-size: 12px !important;
  opacity: .8;
}

/* ---------- tool grid ---------- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.tool-card-top {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 10px;
}

.tool-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -.02em;
}

.tool-card h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.tool-card .cat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.tool-card p {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--text-mid);
  line-height: 1.55;
  flex: 1;
}

.tool-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-mid);
  background: var(--bg-alt);
  white-space: nowrap;
}

.badge.free { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.badge.freemium { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.badge.paid { color: #b45309; background: #fffbeb; border-color: #fde68a; }

@media (prefers-color-scheme: dark) {
  .badge.free { color: #6ee7b7; background: #052e23; border-color: #065f46; }
  .badge.freemium { color: #93c5fd; background: #0c1a3a; border-color: #1e3a8a; }
  .badge.paid { color: #fcd34d; background: #2a1c05; border-color: #78350f; }
}

/* ---------- page head ---------- */

.page-head {
  padding: 42px 0 26px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}

.crumbs {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.crumbs a:hover { color: var(--accent-text); }
.crumbs span { margin: 0 6px; opacity: .5; }

.page-head h1 {
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: -.03em;
  margin: 0 0 10px;
  font-weight: 800;
}

.page-head .lead {
  color: var(--text-mid);
  font-size: 16px;
  max-width: 760px;
  margin: 0;
}

/* ---------- prose ---------- */

.prose {
  max-width: 780px;
  color: var(--text-mid);
  font-size: 15.5px;
  line-height: 1.75;
}

/* Centres the block without centring the text inside it. */
.prose-center {
  margin-left: auto;
  margin-right: auto;
}

.prose p { margin: 0 0 18px; }
.prose h2 {
  font-size: 20px;
  color: var(--text);
  margin: 34px 0 12px;
  letter-spacing: -.02em;
}
.prose h3 {
  font-size: 16.5px;
  color: var(--text);
  margin: 26px 0 8px;
}
.prose ul { padding-left: 20px; margin: 0 0 18px; }
.prose li { margin-bottom: 7px; }
.prose a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- tool detail ---------- */

.detail-head {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.detail-avatar {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 26px;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -.03em;
}

.detail-meta { flex: 1; min-width: 240px; }

.detail-meta h1 {
  margin: 0 0 6px;
  font-size: clamp(26px, 4vw, 34px);
  letter-spacing: -.03em;
  font-weight: 800;
}

.detail-meta .tagline {
  color: var(--text-mid);
  font-size: 16px;
  margin: 0 0 14px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 17px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, transform .12s, box-shadow .15s;
}

/* Icons inside buttons must never inherit the container size. */
.btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: var(--bg-alt);
  color: var(--text-mid);
  border-color: var(--border);
}

.btn-ghost:hover { background: var(--bg-card); color: var(--text); }

.detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 44px;
  margin: 36px 0 10px;
  align-items: start;
}

@media (max-width: 860px) {
  .detail-body { grid-template-columns: 1fr; gap: 28px; }
}

.side-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 18px;
  margin-bottom: 16px;
}

.side-card h4 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.kv:last-child { border-bottom: 0; padding-bottom: 0; }
.kv .k { color: var(--text-muted); }
.kv .v { font-weight: 550; text-align: right; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- ad slot ---------- */

.ad-slot {
  margin: 30px 0;
  min-height: 90px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--bg-alt);
}

.ad-slot:has(ins[data-ad-status]) {
  border: 0;
  background: none;
  min-height: 0;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 60px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 40px 0 30px;
  font-size: 14px;
  color: var(--text-muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 28px;
}

@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}

.footer-grid h5 {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text);
  font-weight: 650;
}

.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a:hover { color: var(--accent-text); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}

/* ---------- misc ---------- */

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 860px) {
  .nav-links { display: none; }
  /* flex:1 + min-width:0 keeps the input inside the flex row instead of
     forcing it to its intrinsic width and pushing the layout wider. */
  .search {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 280px;
    margin-left: auto;
  }
  .hero { padding: 42px 0 30px; }
  .hero-stats { gap: 22px; }
}

@media (max-width: 520px) {
  .header-inner { gap: 10px; }
  /* Hide the wordmark only — .logo-mark is also a span, so it must be excluded. */
  .logo span:not(.logo-mark) { display: none; }
  .search { max-width: none; }
  .hero-stats { gap: 16px; font-size: 13px; }
  .hero-stats b { font-size: 19px; }
}

/* ---------- guides ---------- */

.nav-links a.nav-guides {
  color: var(--accent-text);
  font-weight: 600;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.guide-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}

.guide-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.guide-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

.guide-card h3 {
  margin: 0 0 9px;
  font-size: 16.5px;
  font-weight: 680;
  letter-spacing: -.02em;
  line-height: 1.35;
}

.guide-card p {
  margin: 0 0 15px;
  font-size: 13.5px;
  color: var(--text-mid);
  line-height: 1.6;
  flex: 1;
}

.guide-more {
  font-size: 13.5px;
  color: var(--accent-text);
  font-weight: 600;
}

/* ---------- prose extras (tables, quotes, code) ---------- */

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0 26px;
  font-size: 14.5px;
}

.prose th,
.prose td {
  text-align: left;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}

.prose th {
  color: var(--text);
  font-weight: 650;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--border-strong);
}

.prose tbody tr:last-child td { border-bottom: 0; }

.prose blockquote {
  margin: 22px 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--accent);
}

.prose blockquote p {
  margin: 0;
  color: var(--text-mid);
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  background: var(--bg-alt);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.prose h2:first-child { margin-top: 0; }

@media (max-width: 640px) {
  .prose table { font-size: 13px; }
  .prose th, .prose td { padding: 7px 8px; }
}

/* ---------- editorial principles ---------- */

.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 14px;
}

.principle {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
}

.principle h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -.01em;
}

.principle p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-mid);
  line-height: 1.62;
}
