/* ============================================================
   ToolNest — premium design system v2
   Fonts: Poppins (headings) + Inter (body) via Google Fonts.
   Pure HTML/CSS/JS, no build step.
   ============================================================ */

/* ---------- design tokens ---------- */
:root {
  --primary: #6d28d9;
  --primary-600: #7c3aed;
  --primary-ink: #4c1d95;
  --primary-soft: #efe7fd;
  --accent: #f59e0b;
  --accent-soft: #fef3c7;
  --accent-ink: #92400e;
  --bg: #f6f6fb;
  --surface: #ffffff;
  --surface-2: #f1f0f7;
  --ink: #1a1b2e;
  --muted: #5d6079;
  --border: #e3e1f0;
  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 1120px;
  --font-head: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-sm: 0 1px 2px rgba(26, 27, 46, .05), 0 2px 8px rgba(26, 27, 46, .06);
  --shadow-md: 0 4px 14px rgba(26, 27, 46, .08), 0 12px 32px rgba(109, 40, 217, .08);
  --shadow-lg: 0 10px 30px rgba(26, 27, 46, .12), 0 24px 60px rgba(109, 40, 217, .14);
  --grad: linear-gradient(135deg, #7c3aed 0%, #6d28d9 60%, #5b21b6 100%);
  --grad-hero: linear-gradient(120deg, #5b21b6 0%, #7c3aed 45%, #9333ea 100%);
  --focus-ring: 0 0 0 3px rgba(124, 58, 237, .28);
}

/* ---------- dark mode ---------- */
html[data-theme="dark"] {
  --primary: #a78bfa;
  --primary-600: #c4b5fd;
  --primary-ink: #ddd6fe;
  --primary-soft: #241d45;
  --accent: #fbbf24;
  --accent-soft: #3a2a10;
  --accent-ink: #fde68a;
  --bg: #0f0e1a;
  --surface: #171627;
  --surface-2: #1e1c33;
  --ink: #f1f0fa;
  --muted: #a9a7c4;
  --border: #2b2947;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .45), 0 24px 60px rgba(0, 0, 0, .4);
  --grad: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 60%, #c4b5fd 100%);
  --grad-hero: linear-gradient(120deg, #31205f 0%, #4c2f96 45%, #5b21b6 100%);
  --focus-ring: 0 0 0 3px rgba(167, 139, 250, .35);
}

/* ---------- base ---------- */
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.25; letter-spacing: -.01em; }
a { color: var(--primary); }
img { max-width: 100%; height: auto; }
::selection { background: var(--primary-soft); color: var(--primary-ink); }

/* visible, consistent focus rings for keyboard users */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 8px;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .site-header { background: rgba(15, 14, 26, .82); }
.header-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 12px;
}
.logo {
  font-family: var(--font-head);
  color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.45rem; letter-spacing: .2px;
  background: none; border: none; cursor: pointer;
  min-height: 48px; display: inline-flex; align-items: center;
}
.logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.main-nav { display: none; gap: 2px; align-items: center; }
.main-nav a {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: 10px 14px; border-radius: 12px; transition: background .15s, color .15s;
}
.main-nav a:hover { background: var(--surface-2); color: var(--ink); }
.main-nav a.active { background: var(--primary-soft); color: var(--primary-ink); }
.theme-toggle {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  font-size: 1.15rem; line-height: 1; width: 48px; height: 48px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s, background .15s, box-shadow .15s;
}
.theme-toggle:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.menu-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink); border-radius: 12px;
  font-size: 1.25rem; width: 48px; height: 48px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.menu-btn:hover { background: var(--primary-soft); }
.mobile-menu {
  display: none; padding: 8px 20px 20px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.mobile-menu.open { display: block; animation: fadeSlideIn .22s ease; }
.mobile-menu a {
  display: block; color: var(--ink); text-decoration: none; font-weight: 600;
  padding: 12px 6px; border-top: 1px solid var(--border);
}
.mobile-menu a:hover { color: var(--primary); }
@media (min-width: 860px) {
  .main-nav { display: inline-flex; }
  .menu-btn, .mobile-menu { display: none !important; }
}

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- hero ---------- */
.hero {
  background: var(--grad-hero);
  color: #fff; padding: 64px 0 56px; text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 300px at 15% 20%, rgba(245, 158, 11, .22), transparent 60%),
    radial-gradient(700px 340px at 85% 80%, rgba(255, 255, 255, .1), transparent 60%);
}
.hero .wrap { position: relative; }
.hero-kicker {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22);
  padding: 7px 16px; border-radius: 999px; margin-bottom: 16px; color: #fff;
}
.hero h1 { margin: 0 0 12px; font-size: clamp(1.9rem, 4.5vw, 2.9rem); font-weight: 800; }
.grad-text {
  background: linear-gradient(90deg, #fbbf24, #fde68a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0 auto 24px; max-width: 660px; color: rgba(255, 255, 255, .85); font-size: 1.06rem; }
.stats-strip {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 28px auto 0; max-width: 720px;
}
.stat {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius); padding: 14px 22px; min-width: 140px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.stat strong { display: block; font-family: var(--font-head); font-size: 1.5rem; font-weight: 800; color: #fff; }
.stat span { font-size: .85rem; color: rgba(255, 255, 255, .8); }
.section-link { min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- search ---------- */
.search-box { max-width: 540px; margin: 0 auto; position: relative; }
.search-box input {
  width: 100%; padding: 15px 22px; border: none; border-radius: 999px; font-size: 16px;
  font-family: var(--font-body); color: var(--ink); background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.search-box input::placeholder { color: var(--muted); }
.search-results {
  position: absolute; top: calc(100% + 10px); left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); text-align: left; overflow: hidden; display: none; z-index: 40;
}
.search-results.open { display: block; animation: fadeSlideIn .18s ease; }
.search-results a {
  display: block; padding: 12px 18px; text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--border); font-size: .95rem; font-weight: 500;
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--primary-soft); }
.search-results .none { padding: 14px 18px; color: var(--muted); }

/* ---------- sections ---------- */
.section { padding: 44px 0; }
.section-head { margin-bottom: 22px; }
.section-title { font-size: 1.55rem; margin: 0 0 6px; font-weight: 700; }
.section .sub, .sub { color: var(--muted); margin: 0 0 20px; font-size: 1rem; }

/* ---------- category grid ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
.cat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 18px; text-decoration: none; color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  box-shadow: var(--shadow-sm);
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.cat-card .icon { font-size: 1.8rem; }
.cat-card h3 { margin: 10px 0 6px; font-size: 1.08rem; }
.cat-card p { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---------- tool grid & cards ---------- */
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }
.tool-grid.three { grid-template-columns: 1fr; }
@media (min-width: 640px) { .tool-grid.three { grid-template-columns: repeat(3, 1fr); } }
.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 18px; text-decoration: none; color: var(--ink); display: block;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.tool-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 44px;
  background: var(--primary-soft); color: var(--primary-ink);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.tool-card h3 { margin: 0 0 6px; font-size: 1.02rem; color: var(--ink); font-weight: 700; }
.tool-card p { margin: 0; font-size: .9rem; color: var(--muted); }

/* ---------- tool page ---------- */
.breadcrumb { font-size: .86rem; color: var(--muted); padding: 20px 0 0; }
.breadcrumb a { color: var(--primary); text-decoration: none; font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; }
.breadcrumb a:hover { text-decoration: underline; }
.tool-layout { display: grid; grid-template-columns: 1fr; gap: 28px; padding: 14px 0 48px; }
.tool-main { min-width: 0; } /* wide tables must never stretch the grid column */
@media (min-width: 900px) { .tool-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.tool-main h1 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); margin: 10px 0 12px; font-weight: 800; }
.tool-main .lede { color: var(--muted); font-size: 1.05rem; max-width: 68ch; }
.tool-main h2 { font-size: 1.35rem; margin: 34px 0 10px; }
.tool-main h3 { font-size: 1.12rem; margin: 24px 0 8px; }
.tool-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 22px; margin: 22px 0; box-shadow: var(--shadow-md);
}
.tool-box h2.tool-title { margin: 0 0 18px; font-size: 1.2rem; color: var(--ink); }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .94rem; margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 16px; font-family: var(--font-body); background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  min-height: 48px;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .8; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--focus-ring);
}
.field .hint { font-size: .84rem; color: var(--muted); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) {
  .field-row.two { grid-template-columns: 1fr 1fr; }
  .field-row.three { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--grad); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 13px 28px; font-size: 1rem; font-weight: 700; cursor: pointer; font-family: var(--font-head);
  min-height: 48px; text-decoration: none;
  box-shadow: 0 4px 14px rgba(109, 40, 217, .32);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(109, 40, 217, .4); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn.block { width: 100%; }
.btn.amber { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; box-shadow: 0 4px 14px rgba(245, 158, 11, .35); }
.btn.amber:hover { box-shadow: 0 8px 22px rgba(245, 158, 11, .45); }
.btn-primary { /* alias kept for forward-compat */
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--grad); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 13px 28px; font-size: 1rem; font-weight: 700; cursor: pointer; font-family: var(--font-head);
  min-height: 48px; text-decoration: none;
  box-shadow: 0 4px 14px rgba(109, 40, 217, .32);
  transition: transform .16s ease, box-shadow .16s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(109, 40, 217, .4); }
.tip-preset { padding: 12px 10px; min-height: 48px; }

/* ---------- results ---------- */
.form-error { color: #dc2626; font-size: .92rem; margin-top: 10px; font-weight: 500; }
html[data-theme="dark"] .form-error { color: #fca5a5; }
.result-box {
  display: none; margin-top: 20px; background: var(--primary-soft);
  border: 1px solid var(--primary); border-radius: var(--radius); padding: 22px;
}
.result-box.show {
  display: block;
  animation: resultIn .35s cubic-bezier(.2, .7, .3, 1);
}
@keyframes resultIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-box .big {
  font-family: var(--font-head); font-size: 2rem; font-weight: 800;
  color: var(--primary-ink); margin: 6px 0;
}
.result-box table { width: 100%; border-collapse: collapse; font-size: .94rem; margin-top: 10px; }
.result-box td { padding: 8px 4px; border-top: 1px dashed var(--border); }
.result-box td:last-child { text-align: right; font-weight: 600; }

/* Copy / Share buttons injected at the top of result boxes */
.result-actions { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.mini-btn {
  background: var(--surface); border: 1px solid var(--primary); color: var(--primary-ink);
  border-radius: var(--radius-sm); padding: 10px 18px; min-height: 44px;
  font-size: .9rem; font-weight: 700; cursor: pointer; font-family: var(--font-body);
  transition: background .15s, transform .15s;
}
.mini-btn:hover { background: var(--primary-soft); transform: translateY(-1px); }

/* ---------- styled tables ---------- */
.example-table { width: 100%; border-collapse: collapse; font-size: .94rem; margin: 14px 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 14px 0; }
.table-wrap .example-table { margin: 0; }
.example-table th, .example-table td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.example-table th {
  background: var(--primary-soft); color: var(--primary-ink);
  font-family: var(--font-head); font-weight: 700; font-size: .88rem; letter-spacing: .02em;
}
.example-table tr:nth-child(even) td { background: var(--surface-2); }

/* ---------- formula ---------- */
.formula {
  background: #14132b; color: #e7e5f7; border-radius: var(--radius-sm); padding: 16px 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .96rem; overflow-x: auto; border: 1px solid #2b2947;
}

/* ---------- callouts ---------- */
.callout {
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  padding: 14px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 18px 0; font-size: .96rem;
}
.callout.warn {
  border-left-color: #dc2626; background: #fef2f2;
}
html[data-theme="dark"] .callout.warn { background: #3a1620; }
.callout b, .callout strong { color: var(--ink); }

/* ---------- FAQ accordion ---------- */
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 12px; background: var(--surface); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: box-shadow .18s, border-color .18s;
}
.faq-item:hover { border-color: var(--primary); }
.faq-item[open] { box-shadow: var(--shadow-md); }
.faq-item summary {
  padding: 15px 18px; cursor: pointer; font-weight: 600; list-style: none;
  font-family: var(--font-head); font-size: .98rem; min-height: 48px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem;
  transition: transform .25s ease, background .2s;
}
.faq-item[open] summary::after { content: "–"; transform: rotate(180deg); background: var(--primary); color: #fff; }
.faq-item .faq-a {
  max-height: 0; overflow: hidden; padding: 0 18px;
  color: var(--muted); font-size: .96rem;
  transition: max-height .32s ease, padding .32s ease;
}
.faq-item[open] .faq-a { max-height: 640px; padding-bottom: 16px; }

/* ---------- prose (articles / legal pages) ---------- */
.prose { max-width: 72ch; }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: .4em; }
.post-hero {
  border-radius: var(--radius); overflow: hidden; margin: 0 0 24px;
  box-shadow: var(--shadow-md);
}
.post-hero img { display: block; width: 100%; }

/* ---------- sidebar ---------- */
.sidebar .side-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.sidebar h3 { margin: 0 0 12px; font-size: 1.02rem; color: var(--ink); }
.sidebar ul { margin: 0; padding: 0; list-style: none; }
.sidebar li { margin-bottom: 9px; font-size: .94rem; }
.sidebar a { text-decoration: none; font-weight: 500; }
.sidebar a:hover { text-decoration: underline; }

/* ---------- article / content pages ---------- */
.content-page {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 26px; margin: 22px 0 48px; box-shadow: var(--shadow-sm);
}
.content-page h1 { font-size: clamp(1.6rem, 3.5vw, 2rem); margin: 0 0 12px; }
.content-page h2 { font-size: 1.3rem; margin: 32px 0 10px; }
.content-page h3 { font-size: 1.12rem; }
.article-meta { color: var(--muted); font-size: .88rem; margin-bottom: 20px; }
.blog-list .post-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.blog-list .post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.blog-list .post-card h2 { margin: 0 0 10px; font-size: 1.22rem; }
.blog-list .post-card h2 a { text-decoration: none; color: var(--ink); }
.blog-list .post-card h2 a:hover { color: var(--primary); }
.blog-list .post-card p { margin: 0 0 12px; color: var(--muted); font-size: .96rem; }

/* ---------- footer ---------- */
.site-footer { background: #151426; color: #b9b7d4; margin-top: 24px; border-top: 1px solid #262445; }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 44px 20px 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px;
}
@media (min-width: 760px) { .footer-inner { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.site-footer h4 { color: #fff; margin: 0 0 14px; font-size: .96rem; font-family: var(--font-head); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 9px; font-size: .92rem; }
.site-footer a { color: #b9b7d4; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid #262445; padding: 16px 20px; text-align: center;
  font-size: .84rem; color: #8f8dab; max-width: var(--maxw); margin: 0 auto;
}

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; padding: 8px 16px; min-height: 40px;
  border-radius: 999px; background: var(--primary-soft); color: var(--primary-ink);
  font-size: .86rem; font-weight: 600; text-decoration: none; border: 1px solid transparent;
  transition: background .15s, transform .15s;
}
.chip:hover { transform: translateY(-1px); background: var(--surface-2); }

/* ---------- favorite star on tool pages ---------- */
.tool-main .fav-star {
  float: right; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 1.5rem; line-height: 1; padding: 6px 10px; cursor: pointer; color: var(--muted);
  margin: 4px 0 8px 12px; min-width: 48px; min-height: 48px; font-family: inherit;
  transition: border-color .15s, color .15s, transform .15s;
}
.tool-main .fav-star:hover { border-color: var(--accent); color: var(--accent-ink); transform: scale(1.06); }
.tool-main .fav-star.active { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- touch targets: 48px+, 16px font (no iOS zoom) ---------- */
.tool-box input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.tool-box select,
.tool-box textarea,
.tool-box button,
.search-box input {
  min-height: 48px;
  font-size: 16px;
}

/* ---------- homepage "Recently used" / "Your favorites" ---------- */
.user-section { padding-top: 10px; }
.user-card { position: relative; }
.user-card-link { text-decoration: none; display: block; color: var(--ink); }
.user-card-link h3 { padding-right: 34px; }
.unfav {
  position: absolute; top: 12px; right: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--muted); cursor: pointer; font-size: .9rem;
  padding: 4px 9px; min-height: 44px; min-width: 44px; font-family: inherit;
  transition: color .15s, border-color .15s;
}
.unfav:hover { color: #dc2626; border-color: #dc2626; }

/* ---------- animations ---------- */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */
@media (max-width: 899px) {
  .tool-layout { grid-template-columns: 1fr; } /* sidebar stacks below main content */
}
@media (max-width: 640px) {
  .cat-grid, .tool-grid, .tool-grid.three { grid-template-columns: 1fr; }
  .hero { padding: 48px 0 40px; }
  .tool-box { padding: 22px 16px; }
  .content-page { padding: 24px 18px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .stat { min-width: 120px; padding: 12px 16px; }
}
@media (max-width: 420px) {
  .header-inner { padding: 0 14px; }
  .wrap { padding: 0 14px; }
  .logo { font-size: 1.28rem; }
}

/* ============================================================
   ToolNest FX layer — 3D + snappy US-fintech motion
   GPU-only (transform/opacity). Honors prefers-reduced-motion.
   ============================================================ */
:root {
  --navy: #0a0a23;
  --navy-2: #141442;
  --ease-snap: cubic-bezier(.2, .9, .25, 1.12);
  --ease-crisp: cubic-bezier(.3, .7, .3, 1);
}
html, body { overflow-x: clip; }

/* ---------- hero: deep navy confidence (Stripe/Robinhood energy) ---------- */
.hero {
  background: linear-gradient(120deg, #0a0a23 0%, #2a1065 48%, #6d28d9 100%);
}

/* ---------- hero 3D scene (JS-injected, desktop only) ---------- */
.fx-scene { position: absolute; inset: 0; z-index: 0; pointer-events: none; perspective: 1000px; overflow: hidden; }
.hero .wrap { z-index: 2; }
#fx-particles { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-shape { position: absolute; opacity: 0; animation: fxShapeIn .42s var(--ease-snap) forwards; }
@keyframes fxShapeIn { from { opacity: 0; } to { opacity: 1; } }
.fx-shape .fx-inner { transition: transform .3s var(--ease-crisp); will-change: transform; }

/* true 3D glass cube */
.fx-cube .fx-inner { width: 92px; height: 92px; position: relative; transform-style: preserve-3d;
  transform: translate3d(calc(var(--px, 0) * var(--depth, 30px)), calc(var(--py, 0) * var(--depth, 30px)), 0) rotateX(-22deg) rotateY(30deg); }
.fx-cube .fc { position: absolute; inset: 0; border: 1px solid rgba(255, 255, 255, .35); }
.fx-cube .f1 { background: linear-gradient(135deg, rgba(167, 139, 250, .88), rgba(109, 40, 217, .88)); transform: translateZ(46px); }
.fx-cube .f2 { background: rgba(76, 29, 149, .88); transform: rotateY(180deg) translateZ(46px); }
.fx-cube .f3 { background: rgba(124, 58, 237, .82); transform: rotateY(90deg) translateZ(46px); }
.fx-cube .f4 { background: rgba(91, 33, 182, .82); transform: rotateY(-90deg) translateZ(46px); }
.fx-cube .f5 { background: rgba(196, 181, 253, .92); transform: rotateX(90deg) translateZ(46px); }
.fx-cube .f6 { background: rgba(46, 16, 101, .92); transform: rotateX(-90deg) translateZ(46px); }

/* amber ring */
.fx-ring .fx-inner { width: 112px; height: 112px; border-radius: 50%;
  border: 13px solid rgba(245, 158, 11, .9);
  box-shadow: 0 20px 44px rgba(0, 0, 0, .35), inset 0 0 24px rgba(245, 158, 11, .35);
  transform: translate3d(calc(var(--px, 0) * var(--depth, 30px)), calc(var(--py, 0) * var(--depth, 30px)), 0) rotateX(66deg); }

/* gradient sphere */
.fx-sphere .fx-inner { width: 66px; height: 66px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffffff 0%, #ddd6fe 34%, #8b5cf6 68%, #5b21b6 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .4);
  transform: translate3d(calc(var(--px, 0) * var(--depth, 30px)), calc(var(--py, 0) * var(--depth, 30px)), 0); }

/* ambient orbs (static; parallax only — no dreamy loops) */
.fx-orb .fx-inner { width: 380px; height: 380px; border-radius: 50%; filter: blur(80px);
  transform: translate3d(calc(var(--px, 0) * var(--depth, 30px)), calc(var(--py, 0) * var(--depth, 30px)), 0); }
.fx-orb.orb-a .fx-inner { background: radial-gradient(circle, rgba(147, 51, 234, .5), transparent 70%); }
.fx-orb.orb-b .fx-inner { background: radial-gradient(circle, rgba(245, 158, 11, .26), transparent 70%); }

/* ---------- hero headline: staggered snappy entrance ---------- */
.fx-hero-pre .hero-kicker, .fx-hero-pre .hero h1,
.fx-hero-pre .hero .sub, .fx-hero-pre .search-box { opacity: 0; transform: translateY(18px); }
.fx-hero-go .hero-kicker { animation: fxUp .34s var(--ease-snap) .03s forwards; }
.fx-hero-go .hero h1 { animation: fxUp .34s var(--ease-snap) .1s forwards; }
.fx-hero-go .hero .sub { animation: fxUp .34s var(--ease-snap) .17s forwards; }
.fx-hero-go .search-box { animation: fxUp .34s var(--ease-snap) .24s forwards; }
@keyframes fxUp { to { opacity: 1; transform: translateY(0); } }

/* ---------- stats strip: full-bleed navy band ---------- */
.stats-strip {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  border-top: 1px solid rgba(167, 139, 250, .25);
  max-width: none; margin: 0; padding: 30px 20px;
}

/* ---------- 3D tilt cards (desktop, fine pointer) ---------- */
body.fx-tilt .tool-grid, body.fx-tilt .cat-grid { perspective: 1400px; }
body.fx-tilt .tool-card, body.fx-tilt .cat-card {
  position: relative; transform-style: preserve-3d; will-change: transform;
  transition: transform .18s ease-out, box-shadow .18s ease, border-color .18s ease;
}
body.fx-tilt .tool-card:hover, body.fx-tilt .cat-card:hover { transform: none; } /* JS drives transform */
body.fx-tilt .tool-card .card-top, body.fx-tilt .tool-card h3, body.fx-tilt .tool-card p,
body.fx-tilt .cat-card .card-top, body.fx-tilt .cat-card h3, body.fx-tilt .cat-card p { transform: translateZ(16px); }
body.fx-tilt .tool-card .tool-icon, body.fx-tilt .cat-card .tool-icon { transform: translateZ(38px); }
.fx-glare {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  transition: opacity .25s ease;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .3), transparent 55%);
}
body.fx-tilt .tool-card:hover .fx-glare, body.fx-tilt .cat-card:hover .fx-glare { opacity: 1; }

/* ---------- scroll reveals (JS adds .fx-reveal, IO adds .fx-in) ---------- */
.fx-reveal { opacity: 0; transform: translateY(16px); transition: opacity .3s ease, transform .34s var(--ease-snap); }
.fx-reveal.fx-in { opacity: 1; transform: none; }

/* ---------- buttons: 3D press ---------- */
.btn:active, .btn-primary:active, .mini-btn:active { transform: translateY(1px) scale(.98); }

/* ---------- result panel: snappy pop on recalc ---------- */
@keyframes fxResultPop { 0% { transform: scale(.965); } 60% { transform: scale(1.008); } 100% { transform: scale(1); } }
.result-box.fx-flash { animation: fxResultPop .32s var(--ease-snap); }

/* ---------- merged pages: soft glow pulse on the live output ----------
   GPU-only (opacity + transform). Subtle: no overshoot, small amplitude. */
@keyframes fxOutGlow {
  0% { opacity: .55; transform: scale(.996); }
  100% { opacity: 1; transform: scale(1); }
}
.tool-box .fx-glow { animation: fxOutGlow .45s var(--ease-crisp); }

/* ---------- theme toggle: smooth cross-fade ---------- */
html.fx-theme-x, html.fx-theme-x *, html.fx-theme-x *::before, html.fx-theme-x *::after {
  transition: background-color .35s ease, border-color .35s ease, color .35s ease,
    box-shadow .35s ease, fill .35s ease, stroke .35s ease !important;
}

/* ============================================================
   FINANCE PAGES — solid & trustworthy, restrained motion
   (body.fx-finance set by JS from the tool slug)
   ============================================================ */
body.fx-finance .tool-box {
  background: linear-gradient(165deg, #151542 0%, var(--navy) 100%);
  border-color: #34336b;
  box-shadow: 0 18px 44px rgba(4, 4, 20, .45);
}
body.fx-finance .tool-box h2.tool-title, body.fx-finance .field label { color: #f1f0fa; }
body.fx-finance .field .hint { color: #b9b7d6; }
body.fx-finance .result-box { background: rgba(124, 58, 237, .16); border-color: var(--primary-600); color: #e7e5f7; }
body.fx-finance .result-box .big { color: #ffffff; font-size: 2.5rem; font-variant-numeric: tabular-nums; }
body.fx-finance .result-box td { border-top-color: #34336b; }
body.fx-finance .result-box .result-actions .mini-btn { background: rgba(255, 255, 255, .08); }
/* restrained motion: quick fade, no overshoot, no scale */
body.fx-finance .fx-reveal { transform: translateY(10px); transition: opacity .22s ease, transform .22s ease; }
@keyframes fxFade { from { opacity: .35; } to { opacity: 1; } }
body.fx-finance .result-box.fx-flash { animation: fxFade .22s ease; }

/* ---------- reduced motion: kill the FX layer ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-scene, #fx-particles { display: none !important; }
  .fx-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .fx-hero-pre .hero-kicker, .fx-hero-pre .hero h1,
  .fx-hero-pre .hero .sub, .fx-hero-pre .search-box { opacity: 1 !important; transform: none !important; }
  .result-box.fx-flash { animation: none !important; }
  .tool-box .fx-glow { animation: none !important; opacity: 1 !important; transform: none !important; }
}

/* ---------- cookie consent banner ---------- */
.cookie-banner{position:fixed;left:0;right:0;bottom:0;z-index:200;display:none;justify-content:center;padding:14px 16px;pointer-events:none}
.cookie-banner.show{display:flex}
.cookie-card{pointer-events:auto;max-width:860px;width:100%;background:var(--card,#fff);border:1px solid var(--border,#e5e7eb);border-radius:14px;box-shadow:0 12px 40px rgba(0,0,0,.18);padding:14px 16px;display:flex;gap:14px;align-items:center;flex-wrap:wrap}
.cookie-card p{margin:0;font-size:.88rem;line-height:1.5;flex:1 1 240px;color:var(--text,#111)}
.cookie-card p a{color:var(--accent,#4f46e5);font-weight:600}
.cookie-actions{display:flex;gap:10px;flex:0 0 auto}
.cookie-actions button{border:0;border-radius:10px;padding:10px 18px;font-weight:700;font-size:.9rem;cursor:pointer;min-width:110px}
.cookie-accept{background:var(--accent,#4f46e5);color:#fff}
.cookie-decline{background:#3f4756;color:#fff;border:1px solid #3f4756}
@media(max-width:520px){.cookie-card{align-items:stretch}.cookie-actions{width:100%}.cookie-actions button{flex:1}}

/* ---------- reserved AdSense slots (empty until ads go live) ----------
   Static, clearly labeled, never sticky/floating. Place only BETWEEN
   content sections — never inside a tool input area or directly under
   a button, to avoid accidental clicks. */
.ad-slot{margin:2.5rem 0;text-align:center;position:static}
.ad-slot .ad-ph{display:block;border:1px dashed var(--border,#cbd5e1);background:var(--card,#f8fafc);border-radius:10px;padding:1.4rem 1rem;color:var(--muted,#94a3b8);font-size:.68rem;letter-spacing:.14em;text-transform:uppercase;font-weight:700}

/* Accessibility: skip-to-content link — visually hidden until focused
   (SAGE fix, 2026-11-01). One global rule for every page's skip link. */
.skip-link{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.skip-link:focus{position:fixed;top:12px;left:12px;width:auto;height:auto;padding:10px 18px;margin:0;overflow:visible;clip:auto;white-space:normal;background:#1e1b4b;color:#fff;font-weight:600;border-radius:8px;z-index:10000;text-decoration:none}
