/* AI tools directory, phase 1. Geist + Geist Mono are loaded from the Fontsource CDN in each page head. */
:root {
  --bg: #fafaf9;
  --surface: #f2f2ef;
  --surface-2: #ebebe7;
  --line: #dcdcd6;
  --line-strong: #c2c2ba;
  --text: #1b1b19;
  --muted: #595954;
  --link: #1d4ed8;
  --link-hover: #1e3a9e;
  --btn: #1d4ed8;
  --btn-text: #ffffff;
  --radius: 8px;
  --radius-sm: 6px;
  --gap-section: 96px;
  --gap-title: 20px;
  --pad: 20px;
  --measure: 64rem;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

@media (min-width: 900px) {
  :root { --gap-section: 112px; --gap-title: 28px; --pad: 32px; }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 100%;
}
@media (min-width: 1920px) {
  html { font-size: 118%; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 400;
  overflow-wrap: break-word;
  min-width: 0;
}

img, svg { display: block; max-width: 100%; height: auto; }

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
@media (min-width: 1920px) { .wrap { max-width: 1280px; } }

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

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 1.0625rem; text-decoration: none; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand img { width: 24px; height: 24px; }
.nav { display: flex; gap: 6px; }
.nav a {
  color: var(--text); text-decoration: none; font-size: 0.9375rem; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid transparent;
}
.nav a:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface-2); border-color: var(--line-strong); }

/* page rhythm */
main { padding-bottom: var(--gap-section); border-bottom: 1px solid var(--line); }
.hero { padding-top: 56px; }
.section { margin-top: var(--gap-section); }
.hero + .section { margin-top: var(--gap-section); }

h1, h2, h3 { font-family: var(--font); color: var(--text); margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.2rem + 3.4vw, 3.25rem); line-height: 1.1; font-weight: 600; letter-spacing: -0.025em; margin-bottom: var(--gap-title); max-width: 22ch; }
h2 { font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2rem); line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; margin-bottom: var(--gap-title); }
h3 { font-size: 1.125rem; line-height: 1.35; font-weight: 600; letter-spacing: -0.005em; }

/* serif is allowed on exactly two things: the tool page H1 and long-form (editorial list) titles */
h1.title-serif { font-family: var(--serif); font-weight: 600; letter-spacing: -0.015em; }

p { margin: 0 0 1em; max-width: 68ch; }
.lede { font-size: 1.1875rem; line-height: 1.55; color: var(--text); max-width: 60ch; }
.fine { font-size: 0.9375rem; color: var(--muted); max-width: 72ch; margin: 12px 0 0; }
.hero .fine:first-of-type { margin-top: 20px; }
.section-note { font-size: 0.9375rem; color: var(--muted); margin: 0 0 20px; max-width: 72ch; }

.mono, .num, time { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.9em; }

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.9375rem; color: var(--muted); margin-bottom: 28px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }

/* buttons */
.btn, button.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 0.9375rem; font-weight: 500; line-height: 1.2;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid var(--btn);
  background: var(--btn); color: var(--btn-text); text-decoration: none; cursor: pointer;
}
.btn:hover { color: var(--btn-text); text-decoration: none; background: var(--btn); }
.btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 60%; z-index: -1;
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.38) 50%, transparent 80%);
  transform: translateX(-130%);
}
.btn:hover::after { transform: translateX(260%); transition: transform 0.7s ease; }

.btn.ghost { background: var(--bg); color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { color: var(--text); background: var(--surface); }
.btn.ghost::after { background: linear-gradient(105deg, transparent 20%, rgba(27, 27, 25, 0.10) 50%, transparent 80%); }
.btn.ghost[aria-pressed="true"] { background: var(--surface-2); border-color: var(--text); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .btn:hover::after { transition: none; }
}

.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 28px; }
.cta-row .fine { margin: 0; }

/* panels: darker fill and a full thin border, no accent edges */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.cite { margin: 0 0 24px; padding: 20px 24px; max-width: 72ch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cite p { margin: 0; font-size: 1.1875rem; line-height: 1.5; max-width: none; }
.method-lines p { font-size: 0.9375rem; color: var(--muted); margin: 0 0 8px; max-width: 78ch; }

/* key / value rows */
.kv { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-width: 640px; }
.kv > div { display: grid; grid-template-columns: 9rem 1fr; gap: 16px; padding: 12px 20px; }
.kv > div:not(:last-child) { border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: 0.9375rem; }
.kv dd { margin: 0; font-weight: 500; }
.kv .sub { display: block; font-weight: 400; color: var(--muted); font-size: 0.9375rem; }
@media (max-width: 480px) {
  .kv > div { grid-template-columns: 1fr; gap: 2px; padding: 12px 16px; }
}

/* home: our product */
.product {
  max-width: var(--measure);
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px 24px; align-items: center;
  padding: 20px 24px; color: var(--text); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.product:hover { color: var(--text); text-decoration: none; border-color: var(--line-strong); background: var(--surface-2); }
.product h3 { margin-bottom: 4px; }
.product p { margin: 0; color: var(--muted); }
.product .aside { color: var(--muted); font-size: 0.9375rem; }
.tag {
  display: inline-block; font-size: 0.875rem; font-weight: 500; padding: 3px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); white-space: nowrap;
}
@media (max-width: 720px) {
  .product { grid-template-columns: 1fr; justify-items: start; gap: 10px; }
}

/* home: categories */
.index { max-width: var(--measure); list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.index li:not(:last-child) { border-bottom: 1px solid var(--line); }
.index-item { display: grid; grid-template-columns: 3rem 1fr auto; gap: 8px 16px; align-items: baseline; padding: 16px 20px; color: var(--text); text-decoration: none; }
a.index-item:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.index-num { font-family: var(--mono); font-size: 0.875rem; color: var(--muted); }
.index-name { display: block; font-weight: 600; }
.index-scope { display: block; color: var(--muted); font-size: 0.9375rem; }
.index-go { font-size: 0.9375rem; font-weight: 500; color: var(--link); }
a.index-item:hover .index-go { text-decoration: underline; }
@media (max-width: 480px) {
  .index-item { grid-template-columns: 2.25rem 1fr; padding: 14px 16px; }
  .index-go { grid-column: 2; }
}

/* home: rankings cards */
.cards { max-width: var(--measure); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 800px) { .cards { grid-template-columns: 1fr; } }
.card { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card h3 { margin-bottom: 12px; font-size: 1.25rem; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--link); }
.card p { margin: 0; color: var(--text); }

/* home: steps */
.steps { max-width: var(--measure); list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; } }
.steps li { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.steps h3 { margin-bottom: 10px; }
.steps .n { font-family: var(--mono); font-size: 0.9em; color: var(--muted); margin-right: 8px; }
.steps p { margin: 0; color: var(--muted); }

/* tables */
.data-table { width: 100%; max-width: var(--measure); border-collapse: separate; border-spacing: 0; table-layout: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font-size: 0.9375rem; }
.data-table th, .data-table td { padding: 11px 16px; text-align: left; vertical-align: top; overflow-wrap: break-word; border-bottom: 1px solid var(--line); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table thead th { background: var(--surface); font-weight: 600; vertical-align: bottom; line-height: 1.3; }
.data-table thead th:first-child { border-top-left-radius: calc(var(--radius) - 1px); }
.data-table thead th:last-child { border-top-right-radius: calc(var(--radius) - 1px); }
.data-table tbody tr:hover td { background: var(--surface); }
.data-table .r { text-align: right; }
.data-table td.who, .data-table td.name { font-weight: 500; }
.data-table td.muted { color: var(--muted); }
.data-table tr[hidden] { display: none !important; }

.sort-btn {
  display: inline-flex; align-items: flex-end; gap: 6px; max-width: 100%;
  font: inherit; font-weight: 600; color: inherit; text-align: inherit; line-height: 1.3;
  background: none; border: 1px solid transparent; border-radius: 4px; margin: -3px -6px; padding: 3px 6px; cursor: pointer;
}
.r .sort-btn { text-align: right; }
.sort-btn:hover { background: var(--surface-2); border-color: var(--line); }
.sort-ind { flex: none; display: inline-block; width: 9px; height: 12px; margin-bottom: 3px; position: relative; }
.sort-ind::before, .sort-ind::after { content: ""; position: absolute; left: 0; width: 9px; height: 5px; background: var(--line-strong); }
.sort-ind::before { top: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.sort-ind::after { bottom: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); }
th[aria-sort="ascending"] .sort-ind::before { background: var(--text); }
th[aria-sort="descending"] .sort-ind::after { background: var(--text); }

/* Small screens: every row of a [data-stack] table becomes a short card, so all columns stay visible,
   nothing scrolls sideways and the text never drops below 13px. Cells carry a role class:
   c-main (name), c-end (right aligned figure), c-meta (small labelled value), c-wide (full width). */
@media (max-width: 600px) {
  .data-table { font-size: 0.875rem; }
  .data-table th, .data-table td { padding: 10px 12px; }
  .data-table .num, .data-table time { font-size: 1em; }
  .sort-btn { gap: 4px; }

  .data-table[data-stack], .data-table[data-stack] tbody { display: block; }
  .data-table[data-stack] thead { display: block; border-bottom: 1px solid var(--line); background: var(--surface); border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
  .data-table[data-stack] thead tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 10px 12px; }
  .data-table[data-stack] thead tr::before { content: "Sort by"; color: var(--muted); font-size: 0.8125rem; }
  .data-table[data-stack] thead th { display: block; padding: 0; border: 0; background: none; border-radius: 0; font-size: 0.8125rem; }
  .data-table[data-stack] thead th .sort-btn { margin: 0; padding: 4px 2px; }
  .data-table[data-stack] tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; row-gap: 2px; padding: 12px; border-bottom: 1px solid var(--line); }
  .data-table[data-stack] tbody tr:last-child { border-bottom: 0; }
  .data-table[data-stack] tbody tr:hover td { background: none; }
  .data-table[data-stack] td { display: block; padding: 0; border: 0; min-width: 0; }
  .data-table[data-stack] td[data-label]::before { content: attr(data-label); display: block; font-family: var(--font); color: var(--muted); font-size: 0.8125rem; line-height: 1.4; }
  .data-table[data-stack] td.c-main { grid-column: 1 / span 2; grid-row: 1; align-self: end; font-size: 1rem; }
  .data-table[data-stack] td.c-end { grid-column: 3; grid-row: 1; text-align: right; }
  .data-table[data-stack] td.c-meta { grid-row: 2; margin-top: 6px; text-align: left; }
  .data-table[data-stack] td.c-wide { grid-column: 1 / -1; margin-top: 6px; }
  .data-table[data-stack] td.c-main:only-child { grid-column: 1 / -1; }
  .data-table[data-stack] tr[hidden] { display: none; }
}
@media (max-width: 480px) {
  :root { --pad: 16px; }
}

/* category toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: var(--gap-title); max-width: var(--measure); }
.toolbar h2 { margin: 0; }
.filter-note { margin: -8px 0 16px; min-height: 0; font-size: 0.9375rem; color: var(--muted); }
.filter-note:empty { display: none; }
.count-line { margin: 28px 0 0; font-weight: 500; }

/* tool page */
.prose p { font-size: 1.0625rem; max-width: 70ch; }
.source-line { margin: 16px 0 0; font-size: 0.9375rem; }
.tasks { margin: 0; padding-left: 1.25rem; max-width: 60ch; }
.tasks li { margin-bottom: 8px; }
.tagline { font-size: 1.1875rem; color: var(--text); max-width: 56ch; margin-bottom: 28px; }

/* ranking: counts */
.fine-after { margin-top: 20px; }

/* FAQ */
.faq { margin: 0; max-width: var(--measure); border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.faq > div { padding: 20px 24px; }
.faq > div:not(:last-child) { border-bottom: 1px solid var(--line); }
.faq dt { font-weight: 600; font-size: 1.0625rem; margin-bottom: 8px; }
.faq dd { margin: 0; color: var(--muted); max-width: 66ch; }
@media (max-width: 480px) { .faq > div { padding: 16px; } }

/* digest */
.digest { max-width: var(--measure); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px 48px; align-items: start; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.digest h2 { margin-bottom: var(--gap-title); }
.digest p { margin: 0; color: var(--muted); }
.digest-form { display: flex; flex-wrap: wrap; gap: 12px; }
.digest-form input { flex: 1 1 14rem; min-width: 0; font: inherit; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
.digest-form input::placeholder { color: #77776f; }
.digest-status { flex-basis: 100%; min-height: 0; font-size: 0.9375rem; }
.digest-status:empty { display: none; }
@media (max-width: 800px) { .digest { grid-template-columns: 1fr; padding: 24px 20px; } }

/* footer */
.site-footer { background: var(--bg); padding: 40px 0 48px; }
.site-footer .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: start; }
.site-footer p { color: var(--muted); font-size: 0.9375rem; margin: 0; max-width: 72ch; }
.site-footer .brand-line { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; margin-bottom: 12px; }
.site-footer .brand-line img { width: 20px; height: 20px; }
.foot-nav { display: flex; flex-direction: column; gap: 6px; font-size: 0.9375rem; }
.foot-nav a { color: var(--text); }
@media (max-width: 600px) { .site-footer .wrap { grid-template-columns: 1fr; } }

/* 404 */
.lost { padding-top: 96px; }
.lost-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }

/* home: featured ranking. Heavier than the plain sections: bigger type, a stronger border, more padding, a filled panel. */
.feature {
  max-width: var(--measure); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px 48px; align-items: start;
  padding: 44px; background: var(--surface-2); border: 1px solid var(--text); border-radius: var(--radius);
}
.feature + .feature { margin-top: 20px; }
.feature h3 { font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem); line-height: 1.2; letter-spacing: -0.015em; margin-bottom: 16px; }
.feature h3 a { color: var(--text); }
.feature h3 a:hover { color: var(--link); }
.feature .feature-cite { font-size: clamp(1.1875rem, 1.05rem + 0.6vw, 1.4375rem); line-height: 1.45; margin: 0 0 28px; max-width: 34ch; }
.feature .kv { background: var(--bg); border-color: var(--line-strong); max-width: none; }
.feature .kv dd { font-size: 1.25rem; }
@media (max-width: 800px) { .feature { grid-template-columns: 1fr; padding: 28px 20px; gap: 24px; } }

/* tool page: sticky outbound bar on small screens */
.sticky-cta { display: none; }
@media (max-width: 767px) {
  .sticky-cta {
    display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    padding: 10px var(--pad); background: var(--bg); border-top: 1px solid var(--line-strong);
  }
  .sticky-cta .btn { flex: none; }
  .sticky-cta span { font-size: 0.8125rem; color: var(--muted); line-height: 1.35; }
  body.has-sticky .site-footer { padding-bottom: 96px; }
}

/* product page */
.price-line { font-size: 1.5rem; font-weight: 600; margin: 0 0 20px; }
.price-line .num { font-size: 1em; }

/* editorial list */
.best-list { max-width: var(--measure); margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); counter-reset: rank; }
.best-list > li { counter-increment: rank; display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 4px 16px; padding: 20px 24px; }
.best-list > li:not(:last-child) { border-bottom: 1px solid var(--line); }
.best-list > li::before { content: counter(rank); font-family: var(--mono); color: var(--muted); grid-row: 1 / span 3; padding-top: 2px; }
.best-list h3 { margin-bottom: 6px; }
.best-list p { margin: 0 0 6px; }
.best-list .meta { color: var(--muted); font-size: 0.9375rem; }
@media (max-width: 480px) { .best-list > li { padding: 16px; grid-template-columns: 2rem minmax(0, 1fr); } }
.warn { max-width: var(--measure); padding: 16px 20px; margin: 0 0 24px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.warn p { margin: 0; }

/* submit form */
.form { display: grid; gap: 16px; max-width: 40rem; }
.form label { display: grid; gap: 6px; font-weight: 500; }
.form input, .form select, .form textarea { font: inherit; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); width: 100%; }
.entry-points { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 0; padding: 0; list-style: none; }
