/* ==========================================================
   MamaTool – shared stylesheet
   Theme colors live in CSS variables. Dark mode = [data-theme="dark"]
   ========================================================== */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef0f8;
  --text: #161a33;
  --muted: #5a6082;
  --border: #dde1f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eceafd;
  --on-primary: #ffffff;
  --accent: #0d9488;
  --danger: #dc2626;
  --success: #15803d;
  --warn: #b45309;
  --shadow: 0 1px 2px rgba(20, 24, 60, .06), 0 10px 30px rgba(20, 24, 60, .08);
  --radius: 14px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c0f1f;
  --surface: #151a31;
  --surface-2: #1d2342;
  --text: #e8eaf8;
  --muted: #a3aacb;
  --border: #2b3260;
  --primary: #8f88ff;
  --primary-hover: #a8a2ff;
  --primary-soft: #232a56;
  --on-primary: #0c0f1f;
  --accent: #2dd4bf;
  --danger: #f87171;
  --success: #4ade80;
  --warn: #fbbf24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); line-height: 1.65; font-size: 16px;
  transition: background .25s, color .25s;
}
img, svg, canvas { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); margin-top: 2.2rem; }
h3 { font-size: 1.15rem; margin-top: 1.4rem; }
p { margin: 0 0 1em; }
.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 860px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: 8px; z-index: 200; }
.skip-link:focus { left: 8px; }

/* ---------- Header / navigation ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.nav-wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.3rem; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.logo b { color: var(--primary); }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 800; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; }
.nav a, .nav .nav-link { display: block; padding: 8px 14px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav a:hover, .nav .nav-link:hover, .nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.has-dropdown { position: relative; }
.dropdown { position: absolute; top: 100%; left: 0; min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 8px !important; display: none !important; flex-direction: column; align-items: stretch !important; gap: 2px !important; }
.has-dropdown.open > .dropdown { display: flex !important; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle, .hamburger { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.theme-toggle:hover, .hamburger:hover { background: var(--primary-soft); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.hamburger { display: none; }
.hamburger span, .hamburger span::before, .hamburger span::after { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; transition: .2s; }
.hamburger span::before, .hamburger span::after { content: ""; position: absolute; left: 0; }
.hamburger span::before { top: -6px; } .hamburger span::after { top: 6px; }
@media (max-width: 820px) {
  .hamburger { display: grid; }
  .nav { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px 16px; display: none; max-height: calc(100vh - 64px); overflow: auto; }
  .site-header.nav-open .nav { display: block; }
  .nav ul { flex-direction: column; align-items: stretch; }
  .nav a, .nav .nav-link { text-align: left; width: 100%; }
  .dropdown { position: static; box-shadow: none; border: 0; padding: 0 0 0 12px !important; min-width: 0; }
}

/* ---------- Hero ---------- */
.hero { padding: 56px 0 36px; text-align: center; background: radial-gradient(1000px 380px at 50% -80px, var(--primary-soft), transparent 70%); }
.hero p.sub { max-width: 680px; margin: 0 auto 26px; color: var(--muted); font-size: 1.1rem; }
.hero h1 span { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.search-box { max-width: 620px; margin: 0 auto 20px; position: relative; }
.search-box input { width: 100%; padding: 15px 18px 15px 48px; font-size: 1.05rem; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-family: inherit; }
.search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.chip-filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip-btn { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: .92rem; cursor: pointer; font-family: inherit; }
.chip-btn:hover { border-color: var(--primary); }
.chip-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.hero-stats { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin-top: 22px; color: var(--muted); font-size: .95rem; }

/* ---------- Tool grid ---------- */
.cat-section { margin: 34px 0; scroll-margin-top: 84px; }
.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cat-head h2 { margin: 0; font-size: 1.45rem; }
.cat-head .count { font-size: .85rem; color: var(--muted); background: var(--surface-2); padding: 2px 10px; border-radius: 99px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tool-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: transform .15s, box-shadow .15s, border-color .15s; }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); color: var(--text); }
.tool-card .ico { width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.5rem; background: var(--primary-soft); border-radius: 12px; margin-bottom: 6px; }
.tool-card h3 { margin: 0; font-size: 1.05rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.no-results { text-align: center; padding: 40px 0; color: var(--muted); }

/* ---------- Generic sections ---------- */
.section { padding: 28px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.why-grid .card { box-shadow: none; }
.why-grid .ico { font-size: 1.8rem; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details[open] summary { margin-bottom: 8px; color: var(--primary); }
.faq details p { margin: 0; color: var(--muted); }

/* ---------- Ads ---------- */
.ad-slot { margin: 24px auto; min-height: 90px; display: grid; place-items: center; text-align: center; border: 1.5px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; background: repeating-linear-gradient(45deg, transparent 0 10px, var(--surface-2) 10px 11px); }

/* AdSense not approved yet: hide empty ad slots so the site looks clean.
   When AdSense units are pasted in, delete this rule to show the slots again. */
.ad-slot { display: none; }

/* ---------- Page layout ---------- */
.page-head { padding: 34px 0 10px; }
.breadcrumb { font-size: .88rem; color: var(--muted); margin-bottom: 12px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--border); }
.breadcrumb a { color: var(--muted); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 800px; }
.prose { max-width: 800px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .45em; }
.prose h2 { padding-top: .4rem; }
.feature-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 22px; list-style: none; padding: 0 !important; }
.feature-list li { padding-left: 28px; position: relative; margin: 0; }
.feature-list li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--success); font-weight: 800; }
.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { counter-increment: s; position: relative; padding: 4px 0 4px 46px; margin-bottom: 12px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.related-grid a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 600; }
.related-grid a:hover { border-color: var(--primary); }

/* ---------- Tool box + form controls ---------- */
.tool-box { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); margin: 18px 0 8px; }
.tool-box h3:first-child { margin-top: 0; }
.field { margin-bottom: 16px; }
.field > label, .field-label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.tool-box input[type="text"], .tool-box input[type="number"], .tool-box input[type="date"], .tool-box input[type="email"],
.tool-box input[type="search"], .tool-box input[type="url"], .tool-box input[type="password"], .tool-box select, .tool-box textarea {
  width: 100%; padding: 11px 14px; font-size: 1rem; font-family: inherit; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; transition: border-color .15s;
}
.tool-box textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.tool-box textarea.mono, .tool-box textarea.output, .output { font-family: var(--mono); font-size: .92rem; }
.tool-box input:focus, .tool-box select:focus, .tool-box textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.tool-box input[type="color"] { width: 64px; height: 44px; padding: 3px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg); cursor: pointer; }
.tool-box input[type="range"] { width: 100%; accent-color: var(--primary); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 14px; margin-bottom: 4px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .tool-box { padding: 16px; } }
@media (min-width: 701px) and (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 10px; border: 1.5px solid var(--primary); background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: .95rem; font-family: inherit; cursor: pointer; text-decoration: none; transition: background .15s, transform .1s; }
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn.secondary:hover { background: var(--surface-2); color: var(--primary-hover); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--primary); background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-size: .88rem; font-weight: 600; border: 0; font-family: inherit; }
button.chip { cursor: pointer; } button.chip:hover { background: var(--primary); color: var(--on-primary); }
button.chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 16px 0; }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 12px; text-align: center; }
.stat-value { display: block; font-size: 1.45rem; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; word-break: break-word; }
.stat-label { display: block; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.result-box { background: var(--primary-soft); border-radius: 12px; padding: 16px 18px; margin: 14px 0; font-weight: 600; word-break: break-word; }
.result-box.big { font-size: 1.5rem; text-align: center; color: var(--primary); }
.output { width: 100%; background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; min-height: 60px; color: var(--text); }
.msg { padding: 10px 14px; border-radius: 10px; margin: 0 0 14px; font-size: .93rem; font-weight: 500; }
.msg.error { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.msg.success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 40%, transparent); }
.msg.info { background: var(--primary-soft); color: var(--primary); }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 12px; max-height: 420px; margin: 12px 0; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: var(--surface-2); position: sticky; top: 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab { padding: 9px 16px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-family: inherit; cursor: pointer; font-size: .95rem; }
.tab:hover { background: var(--surface-2); }
.tab[aria-selected="true"] { background: var(--primary); color: var(--on-primary); }
.dropzone { display: block; border: 2px dashed var(--border); border-radius: 14px; padding: 34px 16px; text-align: center; cursor: pointer; color: var(--muted); background: var(--bg); transition: .15s; margin-bottom: 16px; }
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.preview { max-width: 100%; max-height: 320px; border-radius: 10px; border: 1px solid var(--border); background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--bg) 0 50%) 0 0 / 16px 16px; }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .3s, background .3s; }
.swatch { height: 90px; border-radius: 12px; border: 1px solid var(--border); }
.big-display { font-size: clamp(3rem, 14vw, 5.5rem); font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: 10px 0 18px; }
.list { list-style: none; margin: 0 0 16px; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.list-item .grow { flex: 1; word-break: break-word; }
.list-item.done .grow { text-decoration: line-through; color: var(--muted); }
.diff-view { font-family: var(--mono); font-size: .9rem; white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px; line-height: 1.7; }
.diff-add { background: color-mix(in srgb, var(--success) 22%, transparent); border-radius: 3px; }
.diff-del { background: color-mix(in srgb, var(--danger) 22%, transparent); text-decoration: line-through; border-radius: 3px; }
mark, .match { background: color-mix(in srgb, #f59e0b 40%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Articles ---------- */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.article-card { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.article-card h3 { margin: 0; font-size: 1.15rem; }
.article-card h3 a { color: var(--text); text-decoration: none; }
.article-card h3 a:hover { color: var(--primary); }
.article-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.meta-line { font-size: .82rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.badge { background: var(--primary-soft); color: var(--primary); padding: 2px 10px; border-radius: 99px; font-weight: 700; font-size: .75rem; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 60px; background: var(--surface); border-top: 1px solid var(--border); padding: 40px 0 20px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 7px; }
.site-footer a { color: var(--text); text-decoration: none; font-size: .95rem; }
.site-footer a:hover { color: var(--primary); }
.footer-bottom { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); font-size: .88rem; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .site-header, .site-footer, .ad-slot, .hamburger { display: none !important; } }

/* ---------- Tool page layout with sidebar ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 30px; align-items: start; }
.sidebar { position: sticky; top: 84px; display: grid; gap: 16px; }
.sidebar .ad-slot { min-height: 250px; margin: 0; }
.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.side-card h2 { font-size: 1rem; margin: 0 0 10px; }
.side-card ul { list-style: none; margin: 0; padding: 0; }
.side-card li { margin: 0; }
.side-card a { display: block; padding: 7px 4px; text-decoration: none; color: var(--text); font-size: .95rem; border-bottom: 1px solid var(--border); }
.side-card li:last-child a { border-bottom: 0; }
.side-card a:hover { color: var(--primary); }
@media (max-width: 1020px) { .layout { grid-template-columns: 1fr; } .sidebar { position: static; } }
.cta-card { background: var(--primary-soft); border-radius: var(--radius); padding: 20px; margin: 26px 0; }
.cta-card p { margin: 0 0 12px; }

/* ==========================================================
   v2 design upgrade: category colors, bold hero, popular tools
   ========================================================== */
:root { --c-text: #6366f1; --c-calc: #0ea5e9; --c-dev: #8b5cf6; --c-gen: #f59e0b; --c-image: #ec4899; --c-prod: #10b981; }
[data-cat="text"] { --cat: var(--c-text); } [data-cat="calc"] { --cat: var(--c-calc); } [data-cat="dev"] { --cat: var(--c-dev); }
[data-cat="gen"] { --cat: var(--c-gen); } [data-cat="image"] { --cat: var(--c-image); } [data-cat="prod"] { --cat: var(--c-prod); }

.hero { position: relative; overflow: hidden; padding: 78px 0 56px; color: #fff; text-align: center;
  background: radial-gradient(900px 420px at 88% -10%, rgba(45, 212, 191, .38), transparent 60%), radial-gradient(800px 420px at 8% 0, rgba(129, 140, 248, .5), transparent 60%), linear-gradient(160deg, #15133a, #1e1b4b 55%, #0b3b3a); }
.hero h1 { color: #fff; font-size: clamp(2.2rem, 5.6vw, 3.7rem); margin-bottom: .4em; }
.hero h1 span { background: linear-gradient(90deg, #a5b4fc, #5eead4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { color: #d6dcf2; font-size: 1.15rem; }
.hero-pill { display: inline-flex; gap: 8px; align-items: center; padding: 6px 16px; border-radius: 99px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); font-size: .86rem; font-weight: 700; margin-bottom: 20px; }
.hero .search-box { max-width: 680px; }
.hero .search-box input { background: #fff; color: #161a33; border-color: transparent; padding: 17px 20px 17px 50px; font-size: 1.1rem; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.hero .search-box svg { color: #5a6082; }
.hero .chip-btn { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .28); }
.hero .chip-btn:hover { background: rgba(255, 255, 255, .2); border-color: #fff; }
.hero .chip-btn[aria-pressed="true"] { background: #fff; color: #1e1b4b; border-color: #fff; }
.hero-stats { color: #c9cfec; }
.trending { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 0 auto 24px; max-width: 820px; font-size: .9rem; color: #c9cfec; }
.trending a { color: #fff; background: rgba(255, 255, 255, .14); padding: 4px 13px; border-radius: 99px; text-decoration: none; font-weight: 600; }
.trending a:hover { background: rgba(255, 255, 255, .28); color: #fff; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.section-title h2 { margin: 0; }
.pop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 14px; }
.pop-card { position: relative; display: flex; gap: 14px; align-items: center; padding: 18px 18px 18px 22px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.pop-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--cat, var(--primary)); }
.pop-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--cat, var(--primary)); color: var(--text); }
.pop-card .ico { width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 1.7rem; background: color-mix(in srgb, var(--cat, var(--primary)) 16%, transparent); }
.pop-card strong { display: block; font-size: 1.02rem; }
.pop-card .d { display: block; font-size: .86rem; color: var(--muted); line-height: 1.4; }
.pop-card .go { margin-left: auto; color: var(--cat, var(--primary)); font-weight: 800; font-size: 1.2rem; }

.tool-card { position: relative; overflow: hidden; animation: rise .45s both; }
.tool-card::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--cat, var(--primary)); transform: scaleX(0); transform-origin: left; transition: transform .25s; }
.tool-card:hover::after { transform: scaleX(1); }
.tool-card .ico { background: color-mix(in srgb, var(--cat, var(--primary)) 15%, transparent); }
.tool-card:hover { border-color: var(--cat, var(--primary)); }
.cat-head .count { background: color-mix(in srgb, var(--cat, var(--primary)) 14%, transparent); color: var(--text); }
.view-all { font-weight: 700; font-size: .92rem; text-decoration: none; white-space: nowrap; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* tool + category page header */
.tool-top { background: linear-gradient(135deg, color-mix(in srgb, var(--cat, var(--primary)) 13%, var(--surface)), var(--surface) 70%); border: 1px solid var(--border); border-radius: 20px; padding: 26px 28px; margin-top: 14px; }
.tool-top h1 { margin-bottom: .35em; }
.tool-top .lead { margin-bottom: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.badges span { font-size: .82rem; font-weight: 700; padding: 4px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); }
.badges .cat-pill { background: var(--cat, var(--primary)); border-color: transparent; color: #fff; text-decoration: none; }
.badges a.cat-pill:hover { color: #fff; filter: brightness(1.08); }
.toc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 22px 0 0; font-size: .88rem; }
.toc strong { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.toc a { padding: 4px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 600; }
.toc a:hover { border-color: var(--cat, var(--primary)); color: var(--cat, var(--primary)); }
.tool-box { border-top: 4px solid var(--cat, var(--primary)); }
.prose h2 { border-left: 4px solid var(--cat, var(--primary)); padding-left: 12px; scroll-margin-top: 84px; }
.btn:not(.secondary):not(.ghost):not(.danger) { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 65%, var(--accent))); border-color: transparent; }
.btn:not(.secondary):not(.ghost):not(.danger):hover { filter: brightness(1.08); }

/* footer: five columns */
.footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr; }
@media (max-width: 960px) { .footer-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 620px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .footer-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .tool-card { animation: none; } }
@media (max-width: 700px) { .hero { padding: 54px 0 40px; } .tool-top { padding: 20px 18px; } }
.badges a.cat-pill { display: inline-block; font-size: .82rem; font-weight: 700; padding: 4px 12px; border-radius: 99px; line-height: 1.65; }
.pop-card > span:nth-child(2) { flex: 1; min-width: 0; }
.pop-card .go { flex: none; }
.pop-card { padding: 16px 14px 16px 20px; gap: 12px; }
.pop-card .go { display: none; }
.pop-card .ico { width: 46px; height: 46px; font-size: 1.5rem; }
