/* ==========================================================================
   Toolzy — design system v2
   Modern, polished, light + dark. No framework.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
  /* light theme */
  --bg: #f4f6fc;
  --bg-grad-1: #eef1fb;
  --bg-grad-2: #f7f3ff;
  --surface: #ffffff;
  --surface-2: #f3f5fb;
  --border: #e6e9f3;
  --border-strong: #d6dbec;
  --text: #11162a;
  --text-muted: #5a6683;
  --brand: #635bff;
  --brand-2: #8b5cf6;
  --brand-hover: #5249f0;
  --brand-soft: #eef0ff;
  --accent: #06b6d4;
  --pink: #ec4899;
  --danger: #e11d48;
  --ok: #10b981;
  --warn: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(17, 22, 42, .05);
  --shadow: 0 4px 10px rgba(17, 22, 42, .06), 0 12px 32px rgba(17, 22, 42, .07);
  --shadow-lg: 0 20px 48px rgba(31, 27, 96, .16);
  --glow: 0 10px 40px rgba(99, 91, 255, .28);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --maxw: 1120px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: 'Plus Jakarta Sans', var(--font);
  color-scheme: light;
}
:root[data-theme="light"] { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #080b17;
    --bg-grad-1: #0c1024;
    --bg-grad-2: #120b22;
    --surface: #12172b;
    --surface-2: #161c33;
    --border: #222a44;
    --border-strong: #2d3759;
    --text: #eaeefc;
    --text-muted: #96a1c4;
    --brand: #8b85ff;
    --brand-2: #a78bfa;
    --brand-hover: #a7a2ff;
    --brand-soft: #1a2040;
    --accent: #22d3ee;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 6px 16px rgba(0,0,0,.4), 0 16px 40px rgba(0,0,0,.45);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
    --glow: 0 10px 44px rgba(139, 133, 255, .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080b17;
  --bg-grad-1: #0c1024;
  --bg-grad-2: #120b22;
  --surface: #12172b;
  --surface-2: #161c33;
  --border: #222a44;
  --border-strong: #2d3759;
  --text: #eaeefc;
  --text-muted: #96a1c4;
  --brand: #8b85ff;
  --brand-2: #a78bfa;
  --brand-hover: #a7a2ff;
  --brand-soft: #1a2040;
  --accent: #22d3ee;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 6px 16px rgba(0,0,0,.4), 0 16px 40px rgba(0,0,0,.45);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
  --glow: 0 10px 44px rgba(139, 133, 255, .4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 620px at 85% -8%, var(--bg-grad-2), transparent 60%),
    radial-gradient(900px 560px at 5% 0%, var(--bg-grad-1), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

h1, h2, h3, .brand { font-family: var(--font-head); letter-spacing: -.025em; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 66px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.28rem; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2) 55%, var(--accent));
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 1.05rem;
  box-shadow: var(--glow);
}
.nav-links { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--text-muted); padding: 9px 14px; border-radius: 10px;
  font-weight: 600; font-size: .95rem; transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 8px; }

.theme-btn, .menu-toggle {
  width: 40px; height: 40px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 11px; cursor: pointer;
  color: var(--text); display: grid; place-items: center; font-size: 1.1rem;
  transition: background .15s, transform .15s, box-shadow .15s;
}
.theme-btn:hover, .menu-toggle:hover { background: var(--surface-2); box-shadow: var(--shadow-sm); }
.theme-btn:active { transform: scale(.92); }
.menu-toggle { display: none; }

@media (max-width: 760px) {
  .menu-toggle { display: grid; }
  .nav-links {
    position: absolute; top: 66px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 12px 18px 18px; display: none; box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding: 72px 0 40px; text-align: center; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(520px 320px at 50% -40%, color-mix(in srgb, var(--brand) 30%, transparent), transparent 70%);
  pointer-events: none;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); font-size: .82rem; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.hero h1 { font-size: clamp(2.1rem, 5.6vw, 3.5rem); line-height: 1.08; margin: 0 0 16px; font-weight: 800; }
.hero h1 .grad {
  background: linear-gradient(100deg, var(--brand), var(--brand-2) 45%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-muted); font-size: clamp(1.02rem, 2.3vw, 1.2rem); max-width: 630px; margin: 0 auto 26px; }

/* ---------- Search ---------- */
.tool-search { max-width: 540px; margin: 0 auto; position: relative; }
.tool-search input {
  width: 100%; padding: 15px 18px 15px 48px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 1rem; font-family: inherit; box-shadow: var(--shadow); transition: box-shadow .2s, border-color .2s;
}
.tool-search input:focus { outline: none; border-color: var(--brand); box-shadow: var(--glow); }
.tool-search .search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1.05rem; }

/* ---------- Section head ---------- */
.section-head { margin: 48px 0 20px; }
.section-head h2 { margin: 0 0 6px; font-size: 1.55rem; }
.section-head p { margin: 0; color: var(--text-muted); }

/* ---------- Category chips ---------- */
.cat-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 22px; }
.cat-chip {
  padding: 8px 15px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted); font-weight: 600; font-size: .9rem;
  font-family: inherit; cursor: pointer; transition: all .15s;
}
.cat-chip:hover { color: var(--text); border-color: var(--brand); }
.cat-chip.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent); }

/* ---------- Related tools (tool pages) ---------- */
.related { margin-top: 50px; }
.related h2 { font-size: 1.3rem; margin: 0 0 16px; font-family: var(--font-head); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.related-card {
  display: flex; align-items: center; gap: 11px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: .95rem; transition: transform .15s, border-color .15s, box-shadow .15s;
}
.related-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); box-shadow: var(--shadow); text-decoration: none; }
.related-card .ri { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center; font-size: 1.15rem; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--border)); }
.related-all { margin-top: 18px; text-align: center; }

/* ---------- Tool grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 18px; padding-bottom: 10px; }
.tool-card {
  position: relative; display: block; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.tool-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
  opacity: 0; transition: opacity .2s;
}
.tool-card:hover {
  transform: translateY(-5px); box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); text-decoration: none;
}
.tool-card:hover::before { opacity: 1; }
.tool-card .ico {
  width: 50px; height: 50px; border-radius: 14px; margin-bottom: 14px;
  display: grid; place-items: center; font-size: 1.5rem;
  background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--brand) 16%, transparent));
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--border));
}
.tool-card h3 { margin: 0 0 5px; font-size: 1.12rem; color: var(--text); }
.tool-card p { margin: 0; color: var(--text-muted); font-size: .93rem; }
.tool-card::after {
  content: "→"; position: absolute; top: 22px; right: 22px;
  color: var(--brand); font-size: 1.1rem; opacity: 0; transform: translateX(-5px); transition: all .2s;
}
.tool-card:hover::after { opacity: 1; transform: translateX(0); }
.no-results { color: var(--text-muted); padding: 12px 2px; display: none; }

/* ---------- Tool page ---------- */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 22px 0 0; padding: 8px 15px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text-muted);
  font-weight: 600; font-size: .88rem;
  transition: color .15s, border-color .15s, background .15s, transform .15s;
}
.back-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--surface-2); text-decoration: none; transform: translateX(-2px); }
.back-btn + .breadcrumb { padding-top: 10px; }
.breadcrumb { font-size: .9rem; color: var(--text-muted); padding: 26px 0 6px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--brand); }
.tool-head { padding: 8px 0 22px; }
.tool-head h1 { margin: 0 0 10px; font-size: clamp(1.8rem, 4.2vw, 2.5rem); font-weight: 800; }
.tool-head h1 .grad { background: linear-gradient(100deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tool-head p { margin: 0; color: var(--text-muted); max-width: 700px; font-size: 1.04rem; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 18px; }
.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; margin-bottom: 8px; font-size: .94rem; }

textarea, input[type="text"], input[type="number"], input[type="date"], input[type="time"], select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
  font-size: 1rem; font-family: inherit; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); background: var(--surface); }
textarea { min-height: 180px; resize: vertical; line-height: 1.55; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border-strong)); }

input[type="date"], input[type="time"], input[type="color"], select { cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .85; padding: 3px; border-radius: 5px; }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; background: var(--brand-soft); }
input[type="color"] { padding: 4px; height: 48px; }
input[type="range"] { accent-color: var(--brand); cursor: pointer; width: 100%; }
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
label.check input { accent-color: var(--brand); width: 17px; height: 17px; cursor: pointer; }

.row { display: flex; flex-wrap: wrap; gap: 14px; }
.row > * { flex: 1 1 170px; }
.row .field { margin-bottom: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  font-weight: 700; font-size: .97rem; font-family: inherit; cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 32%, transparent);
  transition: transform .14s, box-shadow .14s, filter .14s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px color-mix(in srgb, var(--brand) 42%, transparent); text-decoration: none; filter: brightness(1.04); }
.btn:active { transform: translateY(0); }
.btn.secondary {
  background: var(--surface-2); color: var(--text); border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn.secondary:hover { background: var(--surface); border-color: var(--brand); box-shadow: var(--shadow); }
.btn-row { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 6px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px,1fr)); gap: 13px; margin-top: 22px; }
.stat {
  background: linear-gradient(160deg, var(--surface-2), color-mix(in srgb, var(--brand) 6%, var(--surface-2)));
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 12px; text-align: center;
}
.stat .num {
  font-family: var(--font-head); font-size: 1.7rem; font-weight: 800; line-height: 1.1;
  background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .lbl { font-size: .76rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }

.result-box {
  margin-top: 18px; padding: 18px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--accent) 8%, var(--brand-soft)));
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--border));
  font-size: 1.06rem; word-break: break-word;
}

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 100; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Prose / content ---------- */
.prose { max-width: 760px; }
.prose h2 { margin: 34px 0 12px; font-size: 1.45rem; }
.prose h3 { margin: 24px 0 8px; font-size: 1.14rem; }
.prose p, .prose li { color: var(--text); }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq-item h3 { margin: 0 0 6px; font-size: 1.05rem; }
.faq-item p { margin: 0; color: var(--text-muted); }

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 30px 0; min-height: 96px; border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm); display: grid; place-items: center;
  color: var(--text-muted); font-size: .82rem; background: var(--surface-2);
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 72px; padding: 40px 0; color: var(--text-muted); font-size: .92rem; background: color-mix(in srgb, var(--surface) 50%, transparent); }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 28px; }
.footer-grid h4 { color: var(--text); margin: 0 0 12px; font-size: .95rem; font-family: var(--font-head); }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--text-muted); }
.footer-col a:hover { color: var(--brand); }
.footer-bottom { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); text-align: center; }

.content { min-height: 55vh; }

/* ---------- Scroll to top ---------- */
.to-top {
  position: fixed; bottom: 22px; right: 22px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 1.2rem; box-shadow: var(--shadow); display: grid; place-items: center;
  opacity: 0; transform: translateY(12px) scale(.9); pointer-events: none;
  transition: opacity .2s, transform .2s, background .15s;
}
.to-top.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.to-top:hover { background: var(--brand); color: #fff; border-color: transparent; }

/* ---------- Reveal animation ---------- */
@media (prefers-reduced-motion: no-preference) {
  .tool-card, .panel { animation: rise .5s cubic-bezier(.2,.7,.3,1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
}
