/* ==========================================================================
   PDF Toolkit — Platform layer
   Public surface (homepage, categories, tool pages, guides, footer).
   Builds on the tokens defined in main.css; defines no colours of its own
   outside the token fallbacks below, so both themes stay in sync.
   ========================================================================== */

:root {
  --measure: 68ch;          /* comfortable reading width for prose */
  --section-gap: clamp(2.5rem, 6vw, 4.5rem);
  --card-gap: clamp(.75rem, 2vw, 1.25rem);
}

/* ── Accessibility primitives ───────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 999;
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transition: top .15s var(--ease);
}
.skip-link:focus { top: 8px; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Section scaffolding ────────────────────────────────────────────────── */
.section { margin-block: var(--section-gap); }
.section-head { margin-bottom: 1.25rem; }
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 .35rem;
}
.section-head p { color: var(--text-dim); margin: 0; max-width: var(--measure); }
.section-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.prose { max-width: var(--measure); }
.prose p, .prose li { color: var(--text-dim); line-height: 1.7; }
.prose h2 { margin-top: 2rem; }
.prose h3 { margin-top: 1.5rem; }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  padding: clamp(1.5rem, 5vw, 3.25rem) 0 clamp(1rem, 3vw, 2rem);
  text-align: center;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 6vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -.035em;
  font-weight: 800;
  margin: 0 0 .75rem;
}
.hero h1 .hero-accent {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  color: var(--text-dim);
  font-size: clamp(.98rem, 2.2vw, 1.15rem);
  max-width: 58ch;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}
.hero-flow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem;
  margin-bottom: 1.5rem;
  font-size: .8rem;
  color: var(--text-faint);
}
.hero-flow li { list-style: none; display: flex; align-items: center; gap: .4rem; }
.hero-flow li:not(:last-child)::after { content: "→"; opacity: .5; }
.hero-flow a { color: var(--text-dim); text-decoration: none; }
.hero-flow a:hover { color: var(--text); }

/* ── Tool search ────────────────────────────────────────────────────────── */
.toolsearch { position: relative; max-width: 620px; margin: 0 auto; }
.toolsearch-field {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1rem;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.toolsearch-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.toolsearch-field .icon { width: 20px; height: 20px; color: var(--text-faint); flex: none; }
.toolsearch input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  outline: none;
}
.toolsearch input::-webkit-search-cancel-button { display: none; }
.toolsearch-clear {
  border: 0; background: none; cursor: pointer;
  color: var(--text-faint); font-size: 1.1rem; line-height: 1;
  padding: .25rem .4rem; border-radius: var(--radius-sm);
}
.toolsearch-clear:hover { color: var(--text); background: var(--glass); }

.toolsearch-results {
  position: absolute;
  z-index: 40;
  inset-inline: 0;
  top: calc(100% + .5rem);
  max-height: min(60vh, 420px);
  overflow-y: auto;
  padding: .35rem;
  background: var(--bg-soft);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: left;
}
.toolsearch-results[hidden] { display: none; }
.ts-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .6rem .7rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.ts-item:hover, .ts-item[aria-selected="true"] { background: var(--accent-soft); }
.ts-item .icon { width: 18px; height: 18px; color: var(--accent); flex: none; }
.ts-name { font-weight: 600; font-size: .93rem; }
.ts-tagline { display: block; color: var(--text-dim); font-size: .78rem; margin-top: .1rem; }
.ts-cat {
  margin-left: auto;
  font-size: .7rem;
  color: var(--text-faint);
  border: 1px solid var(--glass-border);
  padding: .12rem .45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.ts-empty { padding: 1rem; color: var(--text-dim); font-size: .9rem; }
.ts-empty strong { color: var(--text); }

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .45rem;
  margin-top: 1rem;
}
.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .8rem;
  font-size: .82rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-dim);
  text-decoration: none;
  transition: transform .12s var(--ease), color .12s var(--ease), border-color .12s var(--ease);
}
.quick-chip:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.quick-chip:active { transform: translateY(0); }

/* ── Tool cards ─────────────────────────────────────────────────────────── */
.tool-grid {
  display: grid;
  gap: var(--card-gap);
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
}
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  text-decoration: none;
  color: inherit;
  transition: transform .14s var(--ease), border-color .14s var(--ease),
              background .14s var(--ease);
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--glass-strong);
}
.tool-card:active { transform: translateY(0); }
.tool-card-top { display: flex; align-items: center; gap: .6rem; }
.tool-card-icon {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  flex: none;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
}
.tool-card-icon .icon { width: 18px; height: 18px; }
.tool-card h3 { margin: 0; font-size: .97rem; font-weight: 650; letter-spacing: -.01em; }
.tool-card p {
  margin: 0;
  font-size: .84rem;
  line-height: 1.5;
  color: var(--text-dim);
}
.tool-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-top: auto;
  padding-top: .55rem;
}
.tool-card-cat { font-size: .72rem; color: var(--text-faint); }
.tool-card-go { font-size: .8rem; color: var(--accent); font-weight: 600; }

.badge-row { display: flex; flex-wrap: wrap; gap: .3rem; }
.badge {
  font-size: .68rem;
  padding: .15rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
}

/* ── Category sections ──────────────────────────────────────────────────── */
.cat-section { scroll-margin-top: calc(var(--topbar-h) + 12px); }
.cat-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .35rem;
}
.cat-head .tool-card-icon { width: 30px; height: 30px; }
.cat-head h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.cat-head a { color: inherit; text-decoration: none; }
.cat-head a:hover { color: var(--accent); }
.cat-blurb { color: var(--text-dim); margin: 0 0 .9rem; max-width: var(--measure); font-size: .9rem; }

/* ── Workflows ──────────────────────────────────────────────────────────── */
.workflow-list { display: grid; gap: var(--card-gap); }
.workflow {
  padding: 1rem 1.1rem;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass);
}
.workflow h3 { margin: 0 0 .2rem; font-size: 1rem; }
.workflow p { margin: 0 0 .7rem; color: var(--text-dim); font-size: .87rem; }
.workflow-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  padding: 0; margin: 0; list-style: none;
}
.workflow-steps li { display: flex; align-items: center; gap: .4rem; }
.workflow-steps li:not(:last-child)::after {
  content: "→"; color: var(--text-faint); font-size: .85rem;
}
.workflow-steps a {
  padding: .3rem .65rem;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  font-size: .82rem;
  text-decoration: none;
  color: var(--text);
}
.workflow-steps a:hover { border-color: var(--accent); color: var(--accent); }

/* ── Tool page ──────────────────────────────────────────────────────────── */
.tool-hero { margin-bottom: 1.25rem; }
.tool-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  letter-spacing: -.03em;
  margin: 0 0 .4rem;
}
.tool-hero .lede { color: var(--text-dim); max-width: var(--measure); margin: 0; }

.crumbs-bar { margin-bottom: .75rem; font-size: .82rem; }
.crumbs-bar ol { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 0; }
.crumbs-bar li { display: flex; align-items: center; gap: .35rem; color: var(--text-faint); }
.crumbs-bar li:not(:last-child)::after { content: "/"; opacity: .5; }
.crumbs-bar a { color: var(--text-dim); text-decoration: none; }
.crumbs-bar a:hover { color: var(--text); text-decoration: underline; }

.tool-content { margin-top: var(--section-gap); }
.tool-content > * + * { margin-top: var(--section-gap); }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: .75rem;
  align-items: start;
  color: var(--text-dim);
  line-height: 1.6;
}
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .8rem;
  font-weight: 700;
}

.spec-list { display: grid; gap: .5rem; margin: 0; }
.spec-list div { display: flex; gap: .6rem; flex-wrap: wrap; font-size: .9rem; }
.spec-list dt { color: var(--text-faint); min-width: 92px; }
.spec-list dd { margin: 0; color: var(--text-dim); }

.faq-list { display: grid; gap: .5rem; }
.faq-item {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass);
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  padding: .85rem 1rem;
  font-weight: 600;
  font-size: .93rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  color: var(--text-faint);
  font-size: 1.2rem;
  line-height: 1;
  flex: none;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item .faq-body {
  padding: 0 1rem 1rem;
  color: var(--text-dim);
  line-height: 1.65;
  font-size: .9rem;
  max-width: var(--measure);
}

/* ── Ad slots ───────────────────────────────────────────────────────────── */
.ad-slot {
  margin-block: var(--section-gap);
  padding: .5rem 0;
  border-block: 1px solid var(--glass-border);
  text-align: center;
  min-height: 90px;
  display: grid;
  place-items: center;
  gap: .3rem;
}
.ad-slot-label {
  font-size: .65rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: var(--section-gap);
  border-top: 1px solid var(--glass-border);
  background: var(--glass);
  padding: clamp(1.75rem, 5vw, 3rem) clamp(1rem, 4vw, 2.5rem) 1.25rem;
}
.footer-inner {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  max-width: 1200px;
  margin: 0 auto;
}
.footer-brand-col { grid-column: span 2; min-width: 220px; }
.footer-brand { display: flex; align-items: center; gap: .55rem; margin-bottom: .6rem; }
.footer-logo {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: .62rem; font-weight: 800; letter-spacing: .02em;
}
.footer-brand-name { font-weight: 700; }
.footer-blurb { color: var(--text-dim); font-size: .85rem; line-height: 1.6; margin: 0; max-width: 40ch; }
.footer-head { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .6rem; }
.footer-head a { color: var(--text); text-decoration: none; }
.footer-head a:hover { color: var(--accent); }
.footer-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.footer-list a { color: var(--text-dim); text-decoration: none; font-size: .85rem; }
.footer-list a:hover { color: var(--text); text-decoration: underline; }
.footer-bar {
  max-width: 1200px;
  margin: 1.75rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.footer-legal { margin: 0; color: var(--text-faint); font-size: .78rem; max-width: 60ch; }
.footer-meta { display: flex; flex-wrap: wrap; gap: 1rem; list-style: none; margin: 0; padding: 0; }
.footer-meta a { color: var(--text-dim); font-size: .78rem; text-decoration: none; }
.footer-meta a:hover { color: var(--text); }

/* ── Notification empty state ───────────────────────────────────────────── */
.notif-empty { padding: 1.25rem; text-align: center; font-size: .85rem; margin: 0; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tool-card { padding: .8rem; }
  .tool-card p { display: none; }
  .footer-brand-col { grid-column: 1 / -1; }
  .footer-inner { grid-template-columns: repeat(2, 1fr); }
  .hero { padding-top: 1rem; }
}

/* Nothing may scroll the page sideways. */
html, body { max-width: 100%; overflow-x: hidden; }

/* ── Motion preferences ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .bg-fx { display: none; }
}

/* ── Workspace panel titles ─────────────────────────────────────────────── */
/* Semantically h2 (they sit under the page h1) but sized like panel labels. */
.panel-title {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -.01em;
  margin: 0;
}
.dropzone-title {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0;
}
.dropzone-accepts {
  font-size: .78rem;
  color: var(--text-faint);
  margin: .35rem 0 0;
}

/* ── Result: real before/after figures ──────────────────────────────────── */
.size-delta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-md);
  background: var(--ok-soft);
  font-size: .87rem;
}
.size-delta.is-flat { background: var(--glass); }
.size-before { color: var(--text-dim); text-decoration: line-through; }
.size-arrow { color: var(--text-faint); }
.size-after { font-weight: 700; }
.size-note { color: var(--text-dim); margin-left: auto; }

/* ── Result: carry the file into the next tool ──────────────────────────── */
.chain-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .9rem;
  padding-top: .8rem;
  border-top: 1px solid var(--glass-border);
}
.chain-label { font-size: .85rem; color: var(--text-dim); }

/* ── Guides ─────────────────────────────────────────────────────────────── */
.guide-index { display: grid; gap: var(--card-gap); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.guide-card {
  display: flex; flex-direction: column; gap: .4rem;
  padding: 1.1rem; border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border); background: var(--glass);
}
.guide-card h2 { font-size: 1rem; margin: 0; line-height: 1.4; }
.guide-card h2 a { color: var(--text); text-decoration: none; }
.guide-card h2 a:hover { color: var(--accent); }
.guide-card p { margin: 0; font-size: .86rem; color: var(--text-dim); line-height: 1.55; }
.guide-card-tool { margin-top: auto; padding-top: .5rem; font-size: .82rem; color: var(--accent); text-decoration: none; font-weight: 600; }

.guide > section { margin-top: var(--section-gap); }
.guide h2 { font-size: clamp(1.2rem, 2.6vw, 1.55rem); letter-spacing: -.02em; margin: 0 0 .75rem; }
.guide-cta {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  margin-top: 1.75rem; padding: 1rem 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--accent); background: var(--accent-soft);
}
.guide-cta strong { display: block; font-size: .98rem; }
.guide-cta .dim { font-size: .84rem; color: var(--text-dim); }
.guide-cta .btn { margin-left: auto; }
.guide-back { margin-top: var(--section-gap); font-size: .88rem; }
.guide-back a { color: var(--text-dim); }

.guide-link {
  display: block; padding: .9rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border); background: var(--glass);
  text-decoration: none; color: inherit;
}
.guide-link:hover { border-color: var(--accent); }
.guide-link strong { display: block; margin-bottom: .15rem; }
.guide-link .dim { font-size: .85rem; color: var(--text-dim); }

/* ── Legal pages ────────────────────────────────────────────────────────── */
.legal-body h2 { font-size: 1.12rem; margin: 2rem 0 .6rem; }
.legal-body h2:first-child { margin-top: 0; }
.legal-body p { margin: 0 0 .85rem; }
.legal-body code {
  font-family: var(--font-mono); font-size: .85em;
  padding: .1rem .35rem; border-radius: 4px; background: var(--glass-strong);
}

/* ── Consent bar ────────────────────────────────────────────────────────── */
.consent-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 200;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .9rem clamp(1rem, 4vw, 2rem);
  background: var(--bg-soft);
  border-top: 1px solid var(--glass-border-strong);
  box-shadow: var(--shadow);
}
.consent-text { margin: 0; font-size: .85rem; color: var(--text-dim); max-width: 68ch; }
.consent-text a { color: var(--accent); }
.consent-actions { display: flex; gap: .5rem; margin-left: auto; }
@media (max-width: 560px) {
  .consent-actions { margin-left: 0; width: 100%; }
  .consent-actions .btn { flex: 1; }
}

/* ── Contrast corrections ───────────────────────────────────────────────────
   Measured against the rendered background in both themes. The accent hue is
   fine as a surface but too light behind white text, so text-on-accent uses
   the deeper --accent-ink-bg. */
.skip-link { background: var(--accent-ink-bg, var(--accent-strong)); color: #fff; }

/* Link-coloured text on a page background needs the stronger shade in light
   mode, where the base accent only reaches 3.84:1. */
html[data-theme="light"] .tool-card-go,
html[data-theme="light"] .guide-card-tool,
html[data-theme="light"] .consent-text a,
html[data-theme="light"] .ts-empty a { color: var(--accent-ink-bg, var(--accent-strong)); }

/* The sidebar inherited a light-theme slate colour in both themes. */
.nav-item { color: var(--text-dim); }
.crumbs .sep { color: var(--text-faint); }
.crumbs .here { color: var(--text); }
.crumbs a { color: var(--text-dim); }

/* ══════════════════════════════════════════════════════════════════════════
   Tool artwork
   The illustrations carry their own pale rounded-tile background, so they are
   masked to a consistent radius and given a surface that reads deliberately
   in dark mode rather than looking like a stray light rectangle.
   ══════════════════════════════════════════════════════════════════════════ */
.tool-art {
  flex: none;
  display: block;
  border-radius: 14px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.16), 0 6px 16px -8px rgba(0,0,0,.35);
  transition: transform .22s var(--spring), box-shadow .22s var(--ease);
}
html[data-theme="dark"] .tool-art {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.10),
    0 1px 2px rgba(0,0,0,.5),
    0 10px 22px -10px rgba(0,0,0,.8);
}

/* Tools with no illustration keep the set coherent: same tile, same radius,
   their own line icon centred on it. */
.tool-art--glyph {
  width: var(--art-size, 56px);
  height: var(--art-size, 56px);
  display: grid;
  place-items: center;
  /* Deliberately light in BOTH themes: the illustrations carry pale tiles, so
     a dark fallback would stand out as the odd one in the grid. */
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(124, 92, 255, .16), transparent 70%),
    linear-gradient(150deg, #ffffff, #f4f1fb);
  color: #5B3FD6;
}
html[data-theme="light"] .tool-art--glyph {
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(2, 132, 199, .14), transparent 70%),
    linear-gradient(150deg, #ffffff, #eef6fc);
  color: #01659B;
}
.tool-art--glyph .icon {
  width: calc(var(--art-size, 56px) * .42);
  height: calc(var(--art-size, 56px) * .42);
  stroke-width: 1.8;
}

/* ── Tool cards, rebuilt around the artwork ─────────────────────────────── */
.tool-card {
  gap: .65rem;
  padding: 1.1rem 1.1rem 1rem;
  overflow: hidden;
}
/* A soft wash that only appears on hover, picking up the accent. */
.tool-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(80% 60% at 50% 0%, var(--accent-soft), transparent 70%);
  opacity: 0;
  transition: opacity .2s var(--ease);
  pointer-events: none;
}
.tool-card:hover::after { opacity: 1; }
.tool-card:hover .tool-art {
  transform: translateY(-3px) scale(1.04) rotate(-2deg);
  box-shadow: 0 10px 24px -8px var(--accent-glow);
}
.tool-card-top { align-items: center; gap: .85rem; position: relative; z-index: 1; }
.tool-card-heading { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.tool-card-heading h3 { font-size: 1rem; }
.tool-card-cat {
  font-size: .7rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.tool-card p { position: relative; z-index: 1; }
.tool-card-foot { position: relative; z-index: 1; padding-top: .35rem; }
.tool-card-go {
  transition: transform .18s var(--ease);
  display: inline-block;
}
.tool-card:hover .tool-card-go { transform: translateX(3px); }

/* ── Tool page hero with artwork ────────────────────────────────────────── */
.tool-hero--art {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.tool-hero--art > div { min-width: 0; flex: 1 1 260px; }
.tool-hero--art h1 { margin-bottom: .3rem; }

/* ── Search results show the artwork too ────────────────────────────────── */
.ts-item .tool-art,
.ts-item .ts-art {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: none;
}

@media (max-width: 640px) {
  /* Cards go compact on small screens, but the artwork is the last thing to
     shrink - it is what makes a tool recognisable at a glance. */
  .tool-card { padding: .85rem; }
  .tool-card-top { gap: .6rem; }
  .tool-art { width: 46px; height: 46px; border-radius: 12px; }
  .tool-art--glyph { --art-size: 46px; }
  .tool-hero--art { gap: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tool-card:hover .tool-art,
  .tool-card:hover .tool-card-go { transform: none; }
}

/* ── Auth: reset-password affordance ────────────────────────────────────── */
.auth-extra-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
button.auth-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: .85rem;
  color: var(--accent-ink-bg, var(--accent-strong));
  cursor: pointer;
  text-decoration: underline;
}
button.auth-link:disabled { opacity: .6; cursor: progress; }
.auth-note {
  margin: .6rem 0 0;
  font-size: .84rem;
  line-height: 1.5;
  color: var(--text-dim);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: .55rem .7rem;
}

/* ── Page selection rail ────────────────────────────────────────────────── */
.page-select-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .5rem .6rem;
  margin-bottom: .5rem;
  border-radius: var(--radius-md);
  background: var(--glass);
  border: 1px solid var(--glass-border);
}
.page-select-count { font-size: .8rem; color: var(--text-dim); }
.page-select-actions { display: flex; flex-wrap: wrap; gap: .3rem; }

.thumbs.is-selectable .thumb { cursor: pointer; position: relative; }
.thumbs.is-selectable .thumb::after {
  content: "";
  position: absolute;
  top: 6px; right: 6px;
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 2px solid var(--glass-border-strong);
  background: var(--bg-soft);
  transition: background .14s var(--ease), border-color .14s var(--ease);
}
.thumbs.is-selectable .thumb.selected::after {
  background: var(--accent);
  border-color: var(--accent);
  /* Tick drawn with a mask so it needs no extra element. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 12px 12px;
  background-repeat: no-repeat;
  background-position: center;
}
.thumbs.is-selectable .thumb.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ── Drag to reorder files ──────────────────────────────────────────────── */
.file-chip[draggable="true"] { cursor: grab; }
.file-chip.dragging { opacity: .45; cursor: grabbing; }
.file-chip.drop-before { box-shadow: inset 0 3px 0 0 var(--accent); }
.file-chip.drop-after { box-shadow: inset 0 -3px 0 0 var(--accent); }

/* ── Before / after comparison ──────────────────────────────────────────── */
.compare { margin-top: 1rem; }
.compare-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem;
}
.compare-title { margin: 0; font-size: .95rem; font-weight: 650; }
.compare-hint { font-size: .78rem; color: var(--text-faint); }
.compare-stage {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--glass-border);
  line-height: 0;
}
/* Bounded, because the stage takes its height from this image and an image
   is whatever shape the document is. A tall or oddly-proportioned page would
   otherwise size the stage to the full height of the screen, leaving the
   divider running edge to edge with a sliver of magnified page behind it. */
.compare-after {
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  display: block;
}
/* The original sits exactly on top of the result and is clipped, so the two
   halves line up at any container width.
   `object-fit: contain` matters on both: stretched to `height: 100%` with the
   default `fill`, this one is squashed to whatever box the result produced,
   so any difference in page shape between the two shows up as distortion in
   the left half only -- which reads as the slider being misaligned. */
.compare-before {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  clip-path: inset(0 50% 0 0);
}
.compare-divider {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(0,0,0,.25);
  pointer-events: none;
}
.compare-divider::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 28px; height: 28px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}
.compare-range:focus-visible { opacity: 1; }
.compare-tag {
  position: absolute;
  bottom: 10px;
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: rgba(0,0,0,.62);
  color: #fff;
  line-height: 1.4;
  pointer-events: none;
}
.compare-tag--before { left: 10px; }
.compare-tag--after { right: 10px; }



/* ── Long-form reading ──────────────────────────────────────────────────────
   Guides and legal pages are read, not scanned. The 14.5px used elsewhere is
   fine for UI copy and small for prose, so these pages get a full 16px and a
   slightly narrower measure - about 65 characters a line rather than 85,
   which is where reading speed peaks. Applies at every width. */
.guide .prose,
.guide .prose p,
.guide .prose li,
.legal-body,
.legal-body p,
.legal-body li {
  font-size: 1rem;
  line-height: 1.72;
}

.guide .prose,
.legal-body {
  max-width: 65ch;
}

.guide .steps li { font-size: .97rem; line-height: 1.65; }

/* Headings keep their relationship to the new body size. */
.guide h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
.legal-body h2 { font-size: 1.2rem; }
