/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header__inner { display: flex; align-items: center; gap: var(--space-4); min-height: var(--header-h); }

.brand { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--primary); text-decoration: none; margin-right: auto; }
.brand__name { font-size: var(--text-xl); font-weight: 750; letter-spacing: -.02em; color: var(--ink); }
/* Approved logo (aspect 2:1). Fixed size keeps the header from shifting while the image loads. */
.brand__logo { display: block; width: auto; height: 52px; max-width: 100%; }
@media (max-width: 479px) { .brand__logo { height: 40px; } }
/* The logo has a white background: in dark mode it sits on a white chip so it stays readable. */
[data-theme="dark"] .brand__logo { background: #fff; border-radius: 8px; padding: 4px 6px; box-sizing: content-box; }

.header__actions { display: flex; align-items: center; gap: var(--space-2); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; cursor: pointer;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 12px;
  transition: background-color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--accent-soft); border-color: var(--primary); }

/* theme icons: show the one for the mode you would switch to */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

.nav__list { display: flex; gap: var(--space-1); }
.nav__link {
  display: block; padding: var(--space-2) var(--space-4); border-radius: 999px;
  color: var(--ink-muted); font-weight: 600; text-decoration: none;
}
.nav__link:hover { color: var(--ink); background: var(--surface-2); }
.nav__link[aria-current="page"] { color: var(--primary); background: var(--accent-soft); }

/* Mobile first: with JavaScript the menu folds into a button */
.nav-toggle { display: none; }
.js .nav-toggle { display: inline-flex; }
.js .nav {
  display: none; position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border-bottom: 1px solid var(--line); padding: var(--space-3) var(--space-4) var(--space-4);
  box-shadow: var(--shadow);
}
.js .nav.is-open { display: block; }
.js .nav__list { flex-direction: column; }
.js .nav__link { border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); }
/* without JavaScript the links simply wrap under the brand */
.nav { order: 3; width: 100%; }
.header__inner { flex-wrap: wrap; }
.js .header__inner { flex-wrap: nowrap; }

@media (min-width: 800px) {
  .nav-toggle, .js .nav-toggle { display: none; }
  .nav, .js .nav, .js .nav.is-open {
    display: block; position: static; order: 0; width: auto; margin-right: var(--space-2);
    padding: 0; background: none; border: 0; box-shadow: none;
  }
  .nav__list, .js .nav__list { flex-direction: row; }
  .nav__link, .js .nav__link { border-radius: 999px; padding: var(--space-2) var(--space-4); }
  .header__inner, .js .header__inner { flex-wrap: nowrap; }
  .brand { margin-right: auto; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 var(--space-5); cursor: pointer;
  font: inherit; font-weight: 650; text-decoration: none;
  color: var(--primary-ink); background: var(--primary);
  border: 1px solid var(--primary); border-radius: 12px;
  transition: background-color .15s;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--ghost { color: var(--primary); background: var(--surface); border-color: var(--line); }
.btn--ghost:hover { background: var(--accent-soft); border-color: var(--primary); }

/* ---------- Hero ---------- */
.hero {
  padding: var(--space-7) 0 var(--space-6);
  background: linear-gradient(180deg, var(--hero-from) 0%, var(--hero-to) 100%);
}
.hero--compact { padding: var(--space-7) 0; }
.hero__inner { max-width: 760px; }
.hero__title { font-size: var(--text-hero); font-weight: 800; letter-spacing: -.03em; text-wrap: balance; }
.hero__lead { margin-top: var(--space-4); max-width: 60ch; font-size: var(--text-lg); color: var(--ink-muted); }
.hero__actions { margin-top: var(--space-5); }
@media (min-width: 800px) { .hero { padding: var(--space-8) 0 var(--space-7); } }

/* ---------- Search ---------- */
.search {
  position: relative; display: flex; align-items: center; gap: var(--space-2);
  margin-top: var(--space-5); padding: var(--space-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.search:focus-within { border-color: var(--primary); outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent); }
.search__icon { flex: none; margin-left: var(--space-3); color: var(--ink-muted); }
.search__input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 var(--space-2);
  font: inherit; color: var(--ink); background: transparent; border: 0; outline: none;
}
.search__input::placeholder { color: var(--ink-muted); opacity: .85; }
.search__input::-webkit-search-cancel-button { cursor: pointer; }
.search .btn { flex: none; }
@media (max-width: 479px) { .search .btn { padding-inline: var(--space-4); } }

/* ---------- Sections ---------- */
.section { padding: var(--space-6) 0; }
.section--tint { background: var(--bg-tint); border-block: 1px solid var(--line); padding-bottom: var(--space-7); }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.section__title { font-size: var(--text-xl); font-weight: 750; }
.section__meta { color: var(--ink-muted); font-size: var(--text-sm); }
.section .card-grid, .section__head + .card-grid { margin-top: var(--space-4); }

.empty {
  margin-top: var(--space-4); padding: var(--space-5); text-align: center; color: var(--ink-muted);
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ---------- Category cards ---------- */
.card-grid { display: grid; gap: var(--space-3); grid-template-columns: 1fr; }
@media (min-width: 560px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) {
  .card-grid--popular { grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
  .card-grid--all { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) { .card-grid--all { grid-template-columns: repeat(4, 1fr); } }

.card-grid > li { display: flex; }
.cat-card {
  position: relative; display: flex; flex: 1; gap: var(--space-4);
  padding: var(--space-4); color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cat-card__tile {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px;
  color: var(--primary); background: var(--accent-soft); border-radius: 14px;
}
.cat-card__body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.cat-card__name { font-weight: 700; line-height: 1.3; }
.cat-card__desc { font-size: var(--text-sm); color: var(--ink-muted); line-height: 1.45; }

.cat-card--large { flex-direction: column; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-lg); background: linear-gradient(160deg, var(--surface) 55%, var(--surface-2)); }
.cat-card--large .cat-card__tile { width: 56px; height: 56px; border-radius: 16px; }
.cat-card--large .cat-card__name { font-size: var(--text-lg); }
.cat-card--large .cat-card__desc { font-size: var(--text-base); }
@media (max-width: 559px) {
  .cat-card--large { flex-direction: row; align-items: flex-start; gap: var(--space-4); padding: var(--space-4); border-radius: var(--radius); }
  .cat-card--large .cat-card__tile { width: 48px; height: 48px; border-radius: 14px; }
}

.cat-card--compact { align-items: flex-start; }
.cat-card--compact .cat-card__tile { width: 40px; height: 40px; border-radius: 12px; }

.badge {
  align-self: flex-start; margin-top: var(--space-2);
  padding: 2px var(--space-3); font-size: .75rem; font-weight: 650; white-space: nowrap;
  color: var(--ink-muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
}

.cat-card.is-link { transition: border-color .15s, transform .15s; }
.cat-card.is-link:hover { border-color: var(--primary); transform: translateY(-2px); }

/* ---------- Footer ---------- */
.site-footer { padding: var(--space-6) 0 var(--space-5); border-top: 1px solid var(--line); background: var(--surface); }
.footer__grid { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
.footer__brand { font-weight: 750; font-size: var(--text-lg); }
.footer__tagline { color: var(--ink-muted); font-size: var(--text-sm); }
.footer__heading { margin-bottom: var(--space-2); font-size: var(--text-sm); font-weight: 700; color: var(--ink); }
.footer__col a { display: inline-block; padding: var(--space-2) 0; color: var(--ink-muted); text-decoration: none; font-size: var(--text-sm); }
.footer__col a:hover { color: var(--primary); text-decoration: underline; }
.footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2) var(--space-5); margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.footer__note, .footer__copy { color: var(--ink-muted); font-size: var(--text-sm); }
@media (min-width: 560px) { .footer__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .footer__grid { grid-template-columns: 1.3fr 1.5fr 1fr 1.3fr; gap: var(--space-6); } }

/* ---------- Page header (inner pages) ---------- */
.page-head { padding: var(--space-5) 0 var(--space-5); background: linear-gradient(180deg, var(--hero-from) 0%, var(--hero-to) 100%); }
.page-head__title { margin-top: var(--space-3); font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem); font-weight: 800; letter-spacing: -.025em; text-wrap: balance; }
.page-head__lead { margin-top: var(--space-3); max-width: 62ch; font-size: var(--text-lg); color: var(--ink-muted); }
.page-head__meta { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--ink-muted); }

.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); font-size: var(--text-sm); color: var(--ink-muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: var(--space-2); opacity: .6; }
.breadcrumbs a { display: inline-block; padding: var(--space-1) 0; color: var(--primary); }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ---------- Long-form text (policies, about, contact) ---------- */
.prose { max-width: 760px; margin-inline: auto; padding-block: var(--space-6) var(--space-7); }
.prose > * + * { margin-top: var(--space-4); }
.prose h2 { margin-top: var(--space-6); font-size: var(--text-xl); font-weight: 750; }
.prose h2:first-child { margin-top: 0; }
.prose ul { list-style: disc; padding-left: var(--space-5); }
.prose li + li { margin-top: var(--space-2); }
.prose code { padding: 1px 6px; font-size: .9em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; }

.notice { padding: var(--space-3) var(--space-4); background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); }
.placeholder { padding: 1px 6px; color: var(--ink); background: #fff3bf; border: 1px dashed #b08900; border-radius: 6px; font-weight: 600; }
:root[data-theme="dark"] .placeholder { color: #fff3bf; background: #4a3b00; border-color: #e0b400; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table-wrap code { white-space: nowrap; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table-wrap th, .table-wrap td { padding: var(--space-3) var(--space-4); text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table-wrap thead th { background: var(--surface-2); }
.table-wrap tbody tr:last-child > * { border-bottom: 0; }

/* ---------- Category page ---------- */
.status-panel { max-width: 640px; padding: var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.status-panel > * + * { margin-top: var(--space-3); }
.status-panel__title { font-size: var(--text-xl); font-weight: 750; }
.badge--live { color: var(--primary); background: var(--accent-soft); border-color: var(--primary); }

.tool-card { display: flex; flex: 1; flex-direction: row; align-items: flex-start; gap: var(--space-3); padding: var(--space-4); color: inherit; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .15s; }
.tool-card:hover { border-color: var(--primary); }
.tool-card__name { font-weight: 700; }
/* Tool card icon (Batch 2): fixed size, so the layout does not move while the icon loads. */
.tool-card__icon { flex: 0 0 40px; width: 40px; height: 40px; }
.tool-card__icon img { display: block; width: 40px; height: 40px; }
.tool-card__icon--art { flex: 0 0 64px; width: 64px; height: 48px; border-radius: var(--radius-sm, 6px); overflow: hidden; }
.tool-card__icon--art img { width: 64px; height: 48px; object-fit: contain; }
.tool-card__body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.tool-card__desc { font-size: var(--text-sm); color: var(--ink-muted); }

/* ---------- FAQ (visible text, for tool pages) ---------- */
.faq { margin-top: var(--space-6); max-width: 760px; }
.faq__title { font-size: var(--text-xl); font-weight: 750; }
.faq__item { margin-top: var(--space-4); }
.faq__q { font-size: var(--text-base); font-weight: 700; }
.faq__a { margin-top: var(--space-1); color: var(--ink-muted); }

/* ---------- Ad slot (dormant: only exists when ads are really enabled) ---------- */
.ad-slot { clear: both; margin: var(--space-7) 0; padding: var(--space-4) 0; border-block: 1px solid var(--line); text-align: center; }
.ad-slot__label { margin-bottom: var(--space-2); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.ad-slot__unit { min-height: 250px; }

/* ---------- HTML sitemap page ---------- */
.sitemap { padding-block: var(--space-6) var(--space-7); display: grid; gap: var(--space-6); }
.sitemap__title { font-size: var(--text-xl); font-weight: 750; margin-bottom: var(--space-3); }
.sitemap__groups { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
.sitemap__cat { font-size: var(--text-lg); font-weight: 700; margin-bottom: var(--space-2); }
.sitemap__list > li { padding: var(--space-1) 0; }
.sitemap__list a { display: inline-block; padding: var(--space-1) 0; }
.sitemap__desc { display: block; font-size: var(--text-sm); color: var(--ink-muted); }
.sitemap__note { color: var(--ink-muted); font-size: var(--text-sm); }
@media (min-width: 800px) { .sitemap__groups { grid-template-columns: repeat(2, 1fr); } }

/* Category introduction and grouped tool cards (optional editorial content) */
.cat-intro { max-width: 70ch; }
.cat-intro > * + * { margin-top: var(--space-3); }
.tool-group + .tool-group { margin-top: var(--space-6); }
.tool-group__title { font-size: var(--text-lg); font-weight: 700; }
.tool-group .card-grid { margin-top: var(--space-3); }
.section__title + .tool-group { margin-top: var(--space-3); }

/* All Tools page (Batch 3): search and category filter above the tool cards */
.all-tools__filters { display: grid; gap: var(--space-3); margin-bottom: var(--space-3); }
@media (min-width: 640px) { .all-tools__filters { grid-template-columns: 2fr 1fr; align-items: end; } }
.all-tools__field { display: grid; gap: var(--space-1); }
.all-tools__field label { font-size: var(--text-sm); font-weight: 600; }
.all-tools__field input, .all-tools__field select {
  font: inherit; min-height: 44px; padding: var(--space-2) var(--space-3);
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.all-tools__field input:focus-visible, .all-tools__field select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.all-tools__count { font-size: var(--text-sm); color: var(--ink-muted); margin: var(--space-3) 0; }

/* Cookie choice banner (rendered only when ads are configured) */
.consent-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--surface, #fff); color: var(--text, #111); border-top: 1px solid var(--border, #ddd); box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
.consent-banner[hidden] { display: none; }
.consent-banner__text { margin: 0; max-width: 60ch; font-size: .95rem; }
.consent-banner__actions { display: flex; gap: 8px; }
