/* AllTools Hub design system.
   Palette: paper white, deep pine green (accent), brass (logo only). One accent colour on purpose. */
:root {
  --bg: #f5f7f6; --surface: #ffffff; --ink: #13201c; --muted: #54625c; --line: #dce3df; --soft: #eaf0ed;
  --accent: #0e5a48; --accent-ink: #ffffff; --accent-hover: #0a4638; --brass: #b08a2e;
  --err: #9b1c1c; --err-bg: #fdeeee; --ok: #0e5a48; --ok-bg: #e6f3ee;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0d1512; --surface: #14201c; --ink: #e8efec; --muted: #9db0a8; --line: #25352f; --soft: #1a2a24;
  --accent: #5fc4a3; --accent-ink: #08130f; --accent-hover: #7ad3b5; --brass: #d3ad52;
  --err: #ffaaa3; --err-bg: #3a1d1d; --ok: #7fd9b9; --ok-bg: #153024;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
main { flex: 1; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 700; font-size: 1.25rem; margin-right: auto; }
.brand:hover { color: var(--ink); }
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--ink); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; }
.nav a:hover { background: var(--soft); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- homepage ---------- */
.hero { padding: 56px 0 36px; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 40em; }
.hero h1 { max-width: 15em; }
.search { position: relative; max-width: 620px; margin: 28px 0 18px; }
.search input { width: 100%; font: inherit; font-size: 1.1rem; padding: 16px 18px 16px 50px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.search svg { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cats a { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .92rem; }
.cats a:hover { border-color: var(--accent); color: var(--accent); }
.trust { margin: 22px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px 26px; color: var(--muted); font-size: .95rem; }
.trust li::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 9px; border-radius: 50%; background: var(--brass); }

.section { padding: 34px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head p { margin: 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { display: grid; grid-template-columns: 46px 1fr; column-gap: 14px; row-gap: 2px; align-items: start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); transition: border-color .15s; }
.card:hover { border-color: var(--accent); color: var(--ink); }
.ico { grid-row: span 2; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 8px; background: var(--soft); color: var(--accent); font: 700 .95rem var(--mono); }
.card-t { font-weight: 650; line-height: 1.3; }
.card-d { color: var(--muted); font-size: .92rem; line-height: 1.45; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.feature { display: block; padding: 24px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.feature:hover { background: var(--accent-hover); color: var(--accent-ink); }
.feature h3 { margin-bottom: .4em; font-size: 1.3rem; }
.feature p { margin: 0; opacity: .92; }
.cat-block { padding: 6px 0 26px; }
.cat-block h3 { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cat-block h3 span { font: 400 .95rem var(--sans); color: var(--muted); }
#results-count { color: var(--muted); }

/* ---------- tool page ---------- */
.crumbs { padding: 22px 0 0; font-size: .92rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.tool-head { padding: 14px 0 22px; max-width: 46em; }
.tool-head p { color: var(--muted); font-size: 1.08rem; margin: 0; }
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: .95rem; }
.field input, .field select, .field textarea, .out { font: inherit; width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.field textarea, .out { resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .out:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.field.check label { display: flex; gap: 10px; align-items: center; font-weight: 400; cursor: pointer; }
.field.check input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.help { color: var(--muted); font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn { font: inherit; font-weight: 650; padding: 11px 22px; border-radius: 8px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; min-height: 44px; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--soft); }
.msg { margin-top: 18px; padding: 12px 16px; border-radius: 8px; font-weight: 500; }
.msg.err { background: var(--err-bg); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 35%, transparent); }
.msg.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.results { margin-top: 22px; padding-top: 22px; border-top: 1px dashed var(--line); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0; }
.stat { background: var(--soft); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.stat dt { font-size: .86rem; color: var(--muted); }
.stat dd { margin: 2px 0 0; font: 700 1.3rem/1.3 var(--serif); overflow-wrap: anywhere; }
.out-box { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.out-label { font-weight: 600; font-size: .95rem; }
.out { font-family: var(--mono); font-size: .95rem; }
.tool-note { margin-top: 14px; font-size: .9rem; color: var(--muted); }

.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; padding: 40px 0 10px; }
.info ol { padding-left: 1.3em; margin: 0; }
.info li { margin-bottom: .5em; padding-left: .2em; }
.related { padding: 26px 0 50px; }

/* ---------- text pages ---------- */
.prose { max-width: 46em; padding: 40px 0 60px; }
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.updated { color: var(--muted); font-size: .92rem; }

/* ---------- footer ---------- */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: var(--surface); padding: 36px 0 22px; font-size: .94rem; }
.foot { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 28px; }
.foot h2 { font: 650 .98rem var(--sans); margin-bottom: .7em; letter-spacing: 0; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: .4em; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--accent); text-decoration: underline; }
.foot p { color: var(--muted); max-width: 26em; }
.copy { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); }

@media (max-width: 760px) {
  .foot { grid-template-columns: 1fr 1fr; }
  .foot > :first-child { grid-column: 1 / -1; }
  .hero { padding-top: 36px; }
}
@media (max-width: 520px) {
  .bar { flex-wrap: wrap; padding: 8px 0 4px; gap: 4px 8px; }
  .icon-btn { order: 2; }
  .nav { order: 3; width: 100%; margin-left: -8px; }
  .nav a { padding: 8px; }
  .tool-card { padding: 16px; }
  .btn { flex: 1 1 auto; }
  .card { grid-template-columns: 42px 1fr; }
  .ico { width: 42px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
