/*!
 * ToolNest design system
 * Original design — light/dark theme tokens, layout and component styles.
 */

/* ---------- Design tokens ---------- */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Lexend", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --brand-50:  #eef1ff;
  --brand-100: #e0e4ff;
  --brand-200: #c3c9ff;
  --brand-300: #9ea6ff;
  --brand-400: #7c7ffb;
  --brand-500: #5b5bf0;
  --brand-600: #4640dd;
  --brand-700: #3830b3;
  --brand-800: #2d278e;
  --brand-900: #241f70;

  --accent-500: #12b8a6;
  --accent-600: #0e9c8c;

  --success-500: #16a34a;
  --danger-500: #dc2626;
  --warning-500: #d97706;

  --gray-0: #ffffff;
  --gray-50: #f8f9fc;
  --gray-100: #f0f1f7;
  --gray-200: #e3e5ef;
  --gray-300: #cdd0e0;
  --gray-400: #a3a7c2;
  --gray-500: #7d81a0;
  --gray-600: #5c6080;
  --gray-700: #434763;
  --gray-800: #2b2e45;
  --gray-900: #181a2a;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-xs: 0 1px 1px rgba(20, 20, 43, 0.04), 0 1px 2px rgba(20, 20, 43, 0.03);
  --shadow-sm: 0 1px 2px rgba(24, 26, 42, 0.04), 0 2px 6px -2px rgba(24, 26, 42, 0.05);
  --shadow-md: 0 2px 6px -2px rgba(35, 30, 90, 0.06), 0 12px 28px -8px rgba(35, 30, 90, 0.12);
  --shadow-lg: 0 8px 16px -6px rgba(35, 30, 90, 0.12), 0 28px 56px -12px rgba(35, 30, 90, 0.2);
  --shadow-glow: 0 0 0 1px rgba(91, 91, 240, 0.08), 0 16px 36px -10px rgba(91, 91, 240, 0.32);
  --gradient-brand: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  --gradient-accent: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --container-w: 1180px;

  /* semantic (light theme default) */
  --bg: var(--gray-50);
  --bg-elevated: var(--gray-0);
  --bg-subtle: var(--gray-100);
  --text: var(--gray-900);
  --text-muted: var(--gray-600);
  --text-faint: var(--gray-500);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  --link: var(--brand-600);
  --focus-ring: var(--brand-400);
  --header-bg: rgba(255, 255, 255, 0.85);
  --result-bg: var(--brand-50);
  --result-border: var(--brand-200);
  --code-bg: var(--gray-100);
  --hero-gradient-start: var(--brand-50);
}

:root[data-theme="dark"] {
  --bg: #12131f;
  --bg-elevated: #1a1c2c;
  --bg-subtle: #20223580;
  --text: #eef0fb;
  --text-muted: #b3b6d4;
  --text-faint: #8b8fb3;
  --border: #2c2f47;
  --border-strong: #3a3e5c;
  --link: var(--brand-300);
  --focus-ring: var(--brand-300);
  --header-bg: rgba(18, 19, 31, 0.85);
  --result-bg: #201f45;
  --result-border: #38348a;
  --code-bg: #1e2036;
  --hero-gradient-start: #1c1d3a;
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 6px -2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 2px 8px -2px rgba(0, 0, 0, 0.3), 0 12px 28px -6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 20px -6px rgba(0, 0, 0, 0.45), 0 28px 56px -10px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 0 1px rgba(124, 127, 251, 0.18), 0 16px 36px -8px rgba(124, 127, 251, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12131f;
    --bg-elevated: #1a1c2c;
    --bg-subtle: #20223580;
    --text: #eef0fb;
    --text-muted: #b3b6d4;
    --text-faint: #8b8fb3;
    --border: #2c2f47;
    --border-strong: #3a3e5c;
    --link: var(--brand-300);
    --focus-ring: var(--brand-300);
    --header-bg: rgba(18, 19, 31, 0.85);
    --result-bg: #201f45;
    --result-border: #38348a;
    --code-bg: #1e2036;
    --hero-gradient-start: #1c1d3a;
    --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 6px -2px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 2px 8px -2px rgba(0, 0, 0, 0.3), 0 12px 28px -6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 20px -6px rgba(0, 0, 0, 0.45), 0 28px 56px -10px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 0 1px rgba(124, 127, 251, 0.18), 0 16px 36px -8px rgba(124, 127, 251, 0.4);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv05", "cv11", "ss01";
}
::selection { background: var(--brand-300); color: var(--brand-900); }
:root[data-theme="dark"] ::selection { background: var(--brand-700); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) ::selection { background: var(--brand-700); color: #fff; } }
html { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid var(--bg); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: padding-box; }
img, svg { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 var(--space-3); font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 1.5rem + 1.8vw, 2.75rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 var(--space-4); color: var(--text); }
ul, ol { padding-left: 1.3em; }
button { font-family: inherit; }
:focus-visible { outline: 2.5px solid var(--focus-ring); outline-offset: 3px; border-radius: 4px; transition: outline-offset .1s ease; }

.container { max-width: var(--container-w); margin: 0 auto; padding: 0 var(--space-5); }
.visually-hidden { 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 { position: absolute; left: -9999px; top: 0; background: var(--brand-600); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 200; }
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(200%) blur(14px);
  -webkit-backdrop-filter: saturate(200%) blur(14px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .25s var(--ease-out), border-color .25s var(--ease-out);
}
.site-header.is-scrolled { box-shadow: var(--shadow-sm); border-bottom-color: transparent; }
.site-header .container { display: flex; align-items: center; gap: var(--space-5); height: 68px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; color: var(--text); flex-shrink: 0; transition: opacity .15s ease; }
.brand:hover { text-decoration: none; opacity: .85; }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(255,255,255,0.06); }
.brand-name b { color: var(--brand-600); }

.main-nav { display: none; }
.main-nav ul { display: flex; gap: var(--space-6); list-style: none; margin: 0; padding: 0; }
.main-nav a { position: relative; display: inline-block; padding: 4px 0; color: var(--text-muted); font-weight: 600; font-size: 0.94rem; transition: color .15s var(--ease-out); }
.main-nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 2px; border-radius: 2px; background: var(--gradient-accent); transition: right .28s var(--ease-out); }
.main-nav a:hover { color: var(--text); text-decoration: none; }
.main-nav a:hover::after { right: 0; }
@media (min-width: 900px) { .main-nav { display: block; } }

.header-actions { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent; color: var(--text-muted); cursor: pointer;
  transition: background .18s var(--ease-out), color .18s var(--ease-out), border-color .18s var(--ease-out), transform .18s var(--ease-out);
}
.icon-btn:hover { background: var(--bg-subtle); border-color: var(--border); color: var(--brand-600); transform: translateY(-1px); }
:root[data-theme="dark"] .icon-btn:hover { color: var(--brand-300); }
.icon-btn svg { width: 20px; height: 20px; }

.header-search { position: relative; display: none; }
@media (min-width: 700px) { .header-search { display: block; width: 250px; } }
@media (min-width: 1100px) { .header-search { width: 300px; } }
/* The homepage already has a large hero search — hide the header one there to avoid showing two search bars at once. */
.is-home .header-search { display: none; }
.header-search input {
  width: 100%; padding: 9px 14px 9px 38px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-subtle); color: var(--text); font-size: 0.88rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.header-search input:focus { background: var(--bg-elevated); border-color: var(--brand-400); box-shadow: 0 0 0 4px rgba(91, 91, 240, 0.1); outline: none; }
.header-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); pointer-events: none; }

.menu-toggle { display: inline-flex; }
@media (min-width: 900px) { .menu-toggle { display: none; } }

html.nav-open, html.nav-open body { overflow: hidden; height: 100%; }
.mobile-nav {
  display: none;
  position: fixed; top: 68px; left: 0; right: 0; bottom: 0;
  border-top: 1px solid var(--border); background: var(--bg-elevated);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
  z-index: 49;
}
.mobile-nav.open { display: block; animation: navSlideIn .18s ease; }
@keyframes navSlideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.mobile-nav .container { flex-direction: column; align-items: stretch; height: auto; padding: var(--space-4) var(--space-5) var(--space-7); gap: var(--space-2); }
.mobile-nav a { display: block; padding: 12px 4px; color: var(--text); font-weight: 600; border-bottom: 1px solid var(--border); }

/* ---------- Search dropdown ---------- */
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); max-height: 380px; overflow-y: auto; z-index: 60; display: none;
}
.search-results.open { display: block; }
.search-results a { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; color: var(--text); }
.search-results a:hover, .search-results a.active { background: var(--bg-subtle); text-decoration: none; }
.search-results .sr-cat { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.search-results .sr-empty { padding: 16px; color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: calc(var(--space-8) + 12px) 0 var(--space-8);
  text-align: center;
  overflow: hidden;
  background: var(--bg);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(600px 340px at 15% -15%, rgba(91, 91, 240, 0.18), transparent 60%),
    radial-gradient(520px 320px at 88% 0%, rgba(18, 184, 166, 0.15), transparent 60%),
    radial-gradient(420px 260px at 50% 40%, rgba(124, 127, 251, 0.08), transparent 65%),
    linear-gradient(180deg, var(--hero-gradient-start), var(--bg) 78%);
  animation: heroDrift 18s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes heroDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-1.5%, 1%, 0) scale(1.03); }
}
@media (prefers-reduced-motion: reduce) { .hero::before { animation: none; } }
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(128, 128, 170, 0.16) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(560px 420px at 50% 0%, #000, transparent 75%);
  mask-image: radial-gradient(560px 420px at 50% 0%, #000, transparent 75%);
  pointer-events: none;
}
.hero .container { position: relative; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px 7px 8px; margin-bottom: var(--space-5);
  border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted); box-shadow: var(--shadow-sm);
  transition: box-shadow .2s var(--ease-out), border-color .2s var(--ease-out), transform .2s var(--ease-out);
}
.hero-eyebrow:hover { box-shadow: var(--shadow-md); border-color: var(--brand-300); transform: translateY(-1px); }
.hero-eyebrow .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--gradient-accent); display: inline-flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 2px 8px -2px rgba(18, 184, 166, 0.6); }
.hero-eyebrow .dot svg { width: 13px; height: 13px; }
.hero h1 {
  max-width: 800px; margin-inline: auto;
  background: linear-gradient(135deg, var(--text) 45%, var(--brand-600));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme="dark"] .hero h1 { background: linear-gradient(135deg, var(--text) 40%, var(--brand-300)); -webkit-background-clip: text; background-clip: text; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero h1 { background: linear-gradient(135deg, var(--text) 40%, var(--brand-300)); -webkit-background-clip: text; background-clip: text; } }
.hero .lede { max-width: 620px; margin: var(--space-3) auto var(--space-6); color: var(--text-muted); font-size: 1.15rem; }
.hero-search { max-width: 640px; margin: 0 auto; position: relative; }
.hero-search input {
  width: 100%; padding: 18px 22px 18px 52px; font-size: 1.05rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-glow);
  transition: box-shadow .25s var(--ease-out), border-color .25s var(--ease-out), transform .25s var(--ease-out);
}
.hero-search input:hover { transform: translateY(-1px); }
.hero-search input:focus { border-color: var(--brand-400); box-shadow: var(--shadow-glow), 0 0 0 4px rgba(91, 91, 240, 0.12); }
.hero-search svg { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--brand-500); }
.hero-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; margin-top: var(--space-5); }
.chip {
  display: inline-flex; align-items: center; padding: 7px 15px; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-muted);
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out), background .2s var(--ease-out);
}
.chip:hover { border-color: var(--brand-400); color: var(--brand-600); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); background: var(--bg-elevated); }
.trust-badges { display: flex; flex-wrap: wrap; gap: var(--space-6); justify-content: center; align-items: center; margin-top: var(--space-7); color: var(--text-faint); font-size: 0.85rem; font-weight: 500; }
.trust-badges span { display: inline-flex; align-items: center; gap: 7px; }
.trust-badges svg { width: 17px; height: 17px; color: var(--accent-600); }

/* ---------- Sections / cards ---------- */
.section { padding: var(--space-7) 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.section-head h2 { margin: 0; }
.section-head .see-all { font-weight: 700; font-size: 0.9rem; white-space: nowrap; color: var(--brand-600); display: inline-block; transition: transform .2s var(--ease-out); }
.section-head .see-all:hover { transform: translateX(3px); }
:root[data-theme="dark"] .section-head .see-all { color: var(--brand-300); }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-4); }
.tool-card {
  position: relative;
  display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text);
  transition: box-shadow .28s var(--ease-out), border-color .28s var(--ease-out), transform .28s var(--ease-out);
}
.tool-card:hover { box-shadow: var(--shadow-glow); border-color: var(--brand-300); text-decoration: none; transform: translateY(-4px); }
.tool-card:active { transform: translateY(-2px); transition-duration: .1s; }
.tool-card .ti {
  width: 42px; height: 42px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: linear-gradient(145deg, var(--brand-50), var(--brand-100)); color: var(--brand-600);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(91, 91, 240, 0.08);
  transition: transform .28s var(--ease-spring);
}
.tool-card:hover .ti { transform: scale(1.08) rotate(-4deg); }
:root[data-theme="dark"] .tool-card .ti { background: linear-gradient(145deg, #262a52, #1e2140); color: var(--brand-300); box-shadow: inset 0 0 0 1px rgba(124, 127, 251, 0.18); }
.tool-card .ti svg { width: 21px; height: 21px; }
.tool-card .tc-name { display: block; font-weight: 700; margin-bottom: 3px; letter-spacing: -0.01em; }
.tool-card .tc-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.category-card {
  position: relative; padding: var(--space-5); border-radius: var(--radius-lg);
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text);
  transition: box-shadow .28s var(--ease-out), border-color .28s var(--ease-out), transform .28s var(--ease-out);
}
.category-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow-glow); text-decoration: none; transform: translateY(-4px); }
.category-card .ti {
  width: 46px; height: 46px; border-radius: var(--radius-md); margin-bottom: var(--space-4);
  background: linear-gradient(145deg, var(--brand-50), var(--brand-100)); color: var(--brand-600);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(91, 91, 240, 0.08);
  transition: transform .28s var(--ease-spring);
}
.category-card:hover .ti { transform: scale(1.08) rotate(-4deg); }
:root[data-theme="dark"] .category-card .ti { background: linear-gradient(145deg, #262a52, #1e2140); color: var(--brand-300); box-shadow: inset 0 0 0 1px rgba(124, 127, 251, 0.18); }
.category-card h3 { letter-spacing: -0.01em; }
.category-card p { margin: 4px 0 0; font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; }

.empty-state { color: var(--text-muted); padding: var(--space-5); text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer; min-height: 44px;
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out), background .18s var(--ease-out), border-color .18s var(--ease-out), filter .18s var(--ease-out);
}
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 1px 2px rgba(35,30,90,.1), 0 6px 16px -4px rgba(70, 64, 221, 0.45); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(35,30,90,.1), 0 12px 26px -6px rgba(70, 64, 221, 0.6); text-decoration: none; filter: brightness(1.04); }
.btn-primary:active { transform: translateY(0); filter: brightness(0.98); }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-subtle); border-color: var(--brand-300); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-subtle); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn svg { width: 18px; height: 18px; }

.field { margin-bottom: var(--space-4); }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field .hint { font-size: 0.8rem; color: var(--text-faint); margin-top: 4px; }
.field input[type="text"], .field input[type="number"], .field input[type="date"], .field input[type="email"],
.field input[type="tel"], .field input[type="password"], .field input[type="search"], .field input[type="time"],
.field select, .field textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--bg-elevated); color: var(--text); font-size: 1rem; min-height: 44px;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--text-faint); }
.field textarea { min-height: 120px; font-family: var(--font-mono); font-size: 0.9rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(91, 91, 240, 0.12); outline: none; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); }
.radio-group, .check-group { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.radio-group label, .check-group label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 0.9rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); margin: 0 0 var(--space-4); }
legend { font-weight: 700; padding: 0 6px; }
.error-text { color: var(--danger-500); font-size: 0.85rem; margin-top: 6px; display: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger-500); }
.field.has-error .error-text { display: block; }

/* ---------- Tool page layout ---------- */
.breadcrumb { padding: var(--space-4) 0 0; font-size: 0.85rem; color: var(--text-faint); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.breadcrumb li:not(:last-child)::after { content: "/"; margin-left: 6px; color: var(--border-strong); }

.tool-hero { padding: var(--space-5) 0 var(--space-6); }
.tool-hero .lede { color: var(--text-muted); max-width: 720px; font-size: 1.05rem; }
.privacy-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--accent-600); background: rgba(18,184,166,.1); border: 1px solid rgba(18,184,166,.3); border-radius: 999px; padding: 5px 12px; margin-bottom: var(--space-3); }
.privacy-badge svg { width: 14px; height: 14px; }

.tool-layout { display: grid; grid-template-columns: 1fr; gap: var(--space-6); }
@media (min-width: 980px) { .tool-layout { grid-template-columns: minmax(0,1fr) 300px; } }
.tool-main { min-width: 0; }
.tool-side { display: flex; flex-direction: column; gap: var(--space-5); }

.calc-card { position: relative; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-md); overflow: hidden; }
.calc-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gradient-accent); box-shadow: 0 0 16px 0 rgba(91, 91, 240, 0.4); }
.calc-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); }

.result-panel { margin-top: var(--space-5); padding: var(--space-5); background: var(--result-bg); border: 1px solid var(--result-border); border-radius: var(--radius-md); display: none; }
.result-panel.show { display: block; animation: fadein .4s var(--ease-out); }
@keyframes fadein { from { opacity: 0; transform: translateY(10px) scale(.99);} to { opacity: 1; transform: none; } }
.result-panel .result-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.result-panel .result-value {
  font-family: var(--font-display); font-size: clamp(1.6rem, 1.3rem + 1.3vw, 2.25rem); font-weight: 800; letter-spacing: -0.01em; word-break: break-word;
  background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme="dark"] .result-panel .result-value { background: linear-gradient(135deg, var(--brand-200), var(--accent-500)); -webkit-background-clip: text; background-clip: text; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); margin-top: var(--space-4); }
.result-stat { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); transition: border-color .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.result-stat:hover { border-color: var(--brand-300); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.result-stat .rs-num { font-weight: 800; font-size: 1.2rem; }
.result-stat .rs-label { font-size: 0.78rem; color: var(--text-muted); }
.result-actions { display: flex; gap: var(--space-2); margin-top: var(--space-4); flex-wrap: wrap; }
.result-actions .btn { min-height: 38px; padding: 8px 16px; font-size: 0.85rem; }
.error-banner { display: none; margin-top: var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: rgba(220,38,38,.08); border: 1px solid rgba(220,38,38,.35); color: var(--danger-500); font-size: 0.9rem; font-weight: 600; }
.error-banner.show { display: block; }

.disclaimer { margin-top: var(--space-5); padding: var(--space-4); border-radius: var(--radius-md); background: rgba(217,119,6,.08); border: 1px solid rgba(217,119,6,.3); color: var(--text); font-size: 0.85rem; }
.disclaimer strong { color: var(--warning-500); }

.output-box { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-4); font-family: var(--font-mono); font-size: 0.85rem; white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; }

.article-block { margin-top: var(--space-7); }
.article-block h2 { margin-top: var(--space-6); }
.article-block .steps { padding-left: 1.4em; }
.article-block .steps li { margin-bottom: var(--space-2); }
.use-case-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); margin: var(--space-4) 0; }
.use-case-grid .uc { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-4); font-size: 0.9rem; }
.formula-box { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-4); font-family: var(--font-mono); font-size: 0.9rem; overflow-x: auto; }

.faq-list { border-top: 1px solid var(--border); }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary { cursor: pointer; list-style: none; padding: var(--space-4) 0; font-weight: 700; display: flex; justify-content: space-between; gap: var(--space-3); align-items: center; transition: color .15s ease; }
.faq-item summary:hover { color: var(--brand-600); }
:root[data-theme="dark"] .faq-item summary:hover { color: var(--brand-300); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .plus { flex-shrink: 0; width: 20px; height: 20px; color: var(--text-faint); transition: transform .25s var(--ease-spring); }
.faq-item[open] summary .plus { transform: rotate(45deg); }
.faq-item p { padding-bottom: var(--space-4); color: var(--text-muted); margin: 0; animation: fadein .25s var(--ease-out); }

.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); }

.conv-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: var(--space-4) 0; }
.conv-table th, .conv-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.conv-table th { color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.conv-table tbody tr { transition: background .15s ease; }
.conv-table tbody tr:hover { background: var(--bg-subtle); }

/* ---------- Ad slots ---------- */
.ad-slot {
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--bg-subtle); border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
  color: var(--text-faint); font-size: 0.75rem; letter-spacing: .04em; text-transform: uppercase;
  min-height: 90px; margin: var(--space-6) 0; padding: var(--space-3);
}
.ad-slot[data-slot="sidebar"] { min-height: 250px; }
.ad-slot .ad-tag { display: block; }

/* ---------- Sidebar widgets ---------- */
.side-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); box-shadow: var(--shadow-sm); transition: box-shadow .25s var(--ease-out); }
.side-card:hover { box-shadow: var(--shadow-md); }
.side-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-3); }
.side-card-head h3 { margin: 0; font-size: 0.92rem; }
.side-card-head .ti {
  width: 32px; height: 32px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: linear-gradient(145deg, var(--brand-50), var(--brand-100)); color: var(--brand-600);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(91, 91, 240, 0.08);
}
:root[data-theme="dark"] .side-card-head .ti { background: linear-gradient(145deg, #262a52, #1e2140); color: var(--brand-300); box-shadow: inset 0 0 0 1px rgba(124, 127, 251, 0.18); }
.side-card-head .ti svg { width: 16px; height: 16px; }

.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.side-list a {
  font-size: 0.87rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px; margin: 0 -8px; border-radius: var(--radius-sm);
  transition: background .15s ease, color .15s ease;
}
.side-list a:hover { background: var(--bg-subtle); color: var(--brand-600); text-decoration: none; }
:root[data-theme="dark"] .side-list a:hover { color: var(--brand-300); }
.side-list a span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-btn { background: none; border: none; cursor: pointer; color: var(--text-faint); padding: 2px; flex-shrink: 0; }
.fav-btn:hover { color: var(--warning-500); }
.fav-btn.active { color: var(--warning-500); }
.fav-btn svg { width: 18px; height: 18px; }
.side-card .empty-state { padding: var(--space-3) var(--space-2); font-size: 0.83rem; border: none; text-align: left; }

/* ---------- Category / listing pages ---------- */
.page-head { padding: var(--space-6) 0 var(--space-5); border-bottom: 1px solid var(--border); }
.page-head p { color: var(--text-muted); max-width: 680px; }

/* ---------- Legal pages ---------- */
.prose { max-width: 760px; }
.prose h2 { margin-top: var(--space-6); }
.prose ul { color: var(--text); }

/* ---------- Footer ---------- */
.site-footer { position: relative; background: var(--bg-elevated); border-top: 1px solid var(--border); margin-top: var(--space-8); padding: var(--space-7) 0 var(--space-6); }
.site-footer::before { content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--brand-300), transparent); opacity: .6; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-6); }
.footer-grid h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-bottom: var(--space-3); font-weight: 700; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-grid a { color: var(--text-muted); font-size: 0.9rem; transition: color .15s ease, padding-left .15s ease; }
.footer-grid a:hover { color: var(--brand-600); padding-left: 2px; }
:root[data-theme="dark"] .footer-grid a:hover { color: var(--brand-300); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); align-items: center; margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--border); color: var(--text-faint); font-size: 0.85rem; }
.footer-bottom .brand { font-size: 1rem; }
.theme-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px; gap: 2px; }
.theme-switch button { border: none; background: transparent; color: var(--text-faint); width: 32px; height: 32px; border-radius: 999px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .2s var(--ease-out), color .2s var(--ease-out); }
.theme-switch button svg { width: 16px; height: 16px; }
.theme-switch button:hover:not(.active) { background: var(--bg-subtle); color: var(--text); }
.theme-switch button.active { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-sm); }

/* ---------- QR / misc tool specifics ---------- */
.qr-preview { display: none; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-5); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); }
.qr-preview.show { display: flex; }
.qr-preview canvas { image-rendering: pixelated; background: #fff; border-radius: var(--radius-sm); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-4); }
.tab-btn { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text-muted); font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all .2s var(--ease-out); }
.tab-btn:hover { border-color: var(--brand-400); color: var(--text); transform: translateY(-1px); }
.tab-btn.active { background: var(--gradient-brand); color: #fff; border-color: transparent; box-shadow: 0 4px 12px -2px rgba(70, 64, 221, 0.4); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadein .25s var(--ease-out); }

.swap-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text-muted); cursor: pointer; transition: all .25s var(--ease-spring); }
.swap-btn:hover { color: #fff; border-color: transparent; background: var(--gradient-accent); transform: rotate(180deg); box-shadow: 0 4px 14px -2px rgba(18, 184, 166, 0.5); }
.swap-btn svg { width: 18px; height: 18px; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.reveal.in-view { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .hero::before { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Cookie consent banner ---------- */
.cookie-banner {
  position: fixed; left: var(--space-4); right: var(--space-4); bottom: var(--space-4); z-index: 300;
  max-width: 640px; margin: 0 auto;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: var(--space-5);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4);
  transform: translateY(140%); transition: transform .35s var(--ease-out);
}
.cookie-banner.show { transform: translateY(0); }
.cookie-banner p { margin: 0; flex: 1 1 260px; font-size: 0.88rem; color: var(--text-muted); }
.cookie-banner p a { color: var(--link); font-weight: 600; }
.cookie-banner .cookie-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }
@media (max-width: 560px) {
  .cookie-banner { left: var(--space-3); right: var(--space-3); bottom: var(--space-3); padding: var(--space-4); }
  .cookie-banner .cookie-actions { width: 100%; }
  .cookie-banner .cookie-actions .btn { flex: 1; }
}
