/* ============================================================
   FreePixelAI — Premium Design System v2
   ============================================================ */
:root {
  --bg: #f7f8fb;
  --bg-2: #ffffff;
  --bg-3: #eef0f6;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef2ff;
  --accent: #06b6d4;
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow: 0 4px 16px -2px rgba(15,23,42,.08);
  --shadow-lg: 0 12px 40px -8px rgba(15,23,42,.14);
  --radius: 14px;
  --radius-lg: 20px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  --nav-h: 64px;
}
[data-theme="dark"] {
  --bg: #0b1020;
  --bg-2: #111730;
  --bg-3: #1a2242;
  --text: #eef1f8;
  --text-2: #a5b0c8;
  --text-3: #64748b;
  --brand: #818cf8;
  --brand-2: #a78bfa;
  --brand-soft: #1e2247;
  --border: #232c4d;
  --border-2: #32406e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 4px 16px -2px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 40px -8px rgba(0,0,0,.5);
}

* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; -webkit-text-size-adjust:100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  transition: background .25s, color .25s;
}
img, svg { display:block; max-width:100%; }
a { color: var(--brand); text-decoration:none; }
a:hover { text-decoration:underline; }
button { font-family:inherit; cursor:pointer; }
input, textarea, select { font-family:inherit; font-size:15px; color:var(--text); }
::selection { background: var(--brand); color:#fff; }

.container { max-width:1200px; margin:0 auto; padding:0 20px; }
.icon { width:1.2em; height:1.2em; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }

/* Skip link */
.skip-link { position:absolute; left:-9999px; top:0; background:var(--brand); color:#fff; padding:10px 18px; border-radius:0 0 10px 0; z-index:200; }
.skip-link:focus { left:0; }

/* ============ NAVBAR ============ */
.navbar {
  position: sticky; top:0; z-index:100;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner { display:flex; align-items:center; gap:18px; height:var(--nav-h); }
.logo { display:flex; align-items:center; gap:10px; font-weight:800; font-size:19px; color:var(--text); letter-spacing:-.02em; }
.logo:hover { text-decoration:none; }
.logo-mark { width:34px; height:34px; border-radius:9px; background:var(--grad); display:grid; place-items:center; color:#fff; box-shadow: var(--shadow-sm); }
.logo-mark svg { width:19px; height:19px; }
.logo .free { color:var(--brand); }
.nav-links { display:flex; gap:4px; margin-left:8px; }
.nav-links a { padding:8px 13px; border-radius:9px; color:var(--text-2); font-weight:500; font-size:14.5px; }
.nav-links a:hover { background:var(--bg-3); color:var(--text); text-decoration:none; }
.nav-links a.active { color:var(--brand); background:var(--brand-soft); }
.nav-actions { margin-left:auto; display:flex; align-items:center; gap:10px; }
.search-trigger {
  display:flex; align-items:center; gap:8px;
  background:var(--bg-3); border:1px solid var(--border);
  border-radius:10px; padding:8px 14px; color:var(--text-3);
  font-size:14px; min-width:200px;
}
.search-trigger:hover { border-color:var(--border-2); }
.search-trigger kbd { margin-left:auto; background:var(--bg-2); border:1px solid var(--border); border-radius:5px; padding:1px 6px; font-size:11.5px; font-family:var(--mono); color:var(--text-3); }
.icon-btn { width:40px; height:40px; border-radius:10px; border:1px solid var(--border); background:var(--bg-2); color:var(--text-2); display:grid; place-items:center; transition:.15s; }
.icon-btn:hover { border-color:var(--brand); color:var(--brand); }
.menu-btn { display:none; }

/* Mobile nav */
.mobile-nav { display:none; position:fixed; inset:var(--nav-h) 0 0 0; background:var(--bg); z-index:99; padding:20px; overflow-y:auto; }
.mobile-nav.open { display:block; }
.mobile-nav a { display:block; padding:13px 16px; border-radius:10px; color:var(--text); font-weight:500; font-size:16px; }
.mobile-nav a:hover { background:var(--bg-3); text-decoration:none; }

/* ============ SEARCH MODAL ============ */
.search-modal { display:none; position:fixed; inset:0; z-index:150; background:rgba(10,14,30,.55); backdrop-filter:blur(4px); padding:12vh 20px 0; }
.search-modal.open { display:block; }
.search-box { max-width:620px; margin:0 auto; background:var(--bg-2); border-radius:16px; box-shadow:var(--shadow-lg); overflow:hidden; border:1px solid var(--border); }
.search-input-row { display:flex; align-items:center; gap:12px; padding:16px 20px; border-bottom:1px solid var(--border); }
.search-input-row svg { color:var(--text-3); }
#search-input { flex:1; border:none; outline:none; background:transparent; font-size:17px; }
.search-results { max-height:52vh; overflow-y:auto; padding:8px; }
.search-result { display:flex; align-items:center; gap:12px; padding:11px 14px; border-radius:10px; color:var(--text); }
.search-result:hover, .search-result.selected { background:var(--brand-soft); text-decoration:none; }
.search-result .sr-icon { width:36px; height:36px; border-radius:9px; background:var(--bg-3); display:grid; place-items:center; color:var(--brand); }
.search-result .sr-name { font-weight:600; font-size:14.5px; }
.search-result .sr-cat { font-size:12.5px; color:var(--text-3); }
.search-empty { padding:36px; text-align:center; color:var(--text-3); font-size:14.5px; }

/* ============ HERO ============ */
.hero { position:relative; padding:76px 0 60px; overflow:hidden; }
.hero::before {
  content:''; position:absolute; inset:-40% -20% auto; height:130%;
  background:
    radial-gradient(600px 400px at 18% 20%, color-mix(in srgb, var(--brand) 13%, transparent), transparent 70%),
    radial-gradient(700px 460px at 85% 10%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%);
  pointer-events:none;
}
.hero-inner { position:relative; text-align:center; max-width:820px; margin:0 auto; }
.hero-badge { display:inline-flex; align-items:center; gap:8px; background:var(--brand-soft); color:var(--brand); border:1px solid color-mix(in srgb, var(--brand) 22%, transparent); padding:7px 16px; border-radius:100px; font-size:13.5px; font-weight:600; margin-bottom:22px; }
.hero h1 { font-size:clamp(34px, 5.4vw, 58px); font-weight:800; letter-spacing:-.03em; line-height:1.12; margin-bottom:18px; }
.hero h1 .grad { background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent; }
.hero p.lead { font-size:clamp(16px,2.2vw,19px); color:var(--text-2); max-width:640px; margin:0 auto 30px; }
.hero-search {
  display:flex; align-items:center; gap:12px; max-width:560px; margin:0 auto 26px;
  background:var(--bg-2); border:1.5px solid var(--border); border-radius:16px;
  padding:15px 20px; box-shadow:var(--shadow); color:var(--text-3); font-size:16px;
  transition:.2s; text-align:left; width:100%;
}
.hero-search:hover { border-color:var(--brand); box-shadow:var(--shadow-lg); }
.hero-search kbd { margin-left:auto; background:var(--bg-3); border:1px solid var(--border); border-radius:6px; padding:2px 8px; font-size:12px; font-family:var(--mono); }
.hero-pills { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; }
.hero-pill { display:inline-flex; align-items:center; gap:7px; font-size:13.5px; font-weight:500; color:var(--text-2); background:var(--bg-2); border:1px solid var(--border); border-radius:100px; padding:7px 15px; }
.hero-pill svg { width:15px; height:15px; color:var(--green); }

/* Stats strip */
.stats-strip { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin:44px auto 0; max-width:860px; position:relative; }
.stat-card { background:var(--bg-2); border:1px solid var(--border); border-radius:var(--radius); padding:20px 14px; text-align:center; }
.stat-card .num { font-size:27px; font-weight:800; letter-spacing:-.02em; background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent; }
.stat-card .lbl { font-size:13px; color:var(--text-3); font-weight:500; margin-top:3px; }

/* ============ SECTIONS ============ */
.section { padding:64px 0; }
.section-head { text-align:center; max-width:640px; margin:0 auto 42px; }
.section-head .eyebrow { color:var(--brand); font-weight:700; font-size:13px; text-transform:uppercase; letter-spacing:.1em; margin-bottom:10px; }
.section-head h2 { font-size:clamp(26px,3.6vw,36px); font-weight:800; letter-spacing:-.025em; margin-bottom:12px; }
.section-head p { color:var(--text-2); font-size:16.5px; }

/* Category grid */
.cat-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px,1fr)); gap:18px; }
.cat-card {
  background:var(--bg-2); border:1px solid var(--border); border-radius:var(--radius-lg);
  padding:26px 24px; color:var(--text); position:relative; overflow:hidden;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.cat-card:hover { transform:translateY(-4px); box-shadow:var(--shadow-lg); border-color:var(--cat-color, var(--brand)); text-decoration:none; }
.cat-card .cat-icon { width:48px; height:48px; border-radius:13px; display:grid; place-items:center; margin-bottom:16px; color:#fff; background:var(--cat-color, var(--brand)); box-shadow:0 6px 16px -4px color-mix(in srgb, var(--cat-color, var(--brand)) 55%, transparent); }
.cat-card .cat-icon svg { width:23px; height:23px; }
.cat-card h3 { font-size:17.5px; font-weight:700; margin-bottom:6px; }
.cat-card p { font-size:13.8px; color:var(--text-2); line-height:1.55; margin-bottom:14px; }
.cat-card .cat-count { font-size:12.5px; font-weight:700; color:var(--cat-color, var(--brand)); background:color-mix(in srgb, var(--cat-color, var(--brand)) 10%, transparent); padding:4px 12px; border-radius:100px; display:inline-block; }

/* Tool grid */
.tool-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(255px,1fr)); gap:16px; }
.tool-card {
  background:var(--bg-2); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px; color:var(--text); display:flex; flex-direction:column; gap:9px;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.tool-card:hover { transform:translateY(-3px); box-shadow:var(--shadow); border-color:var(--brand); text-decoration:none; }
.tool-card .tc-icon { width:40px; height:40px; border-radius:10px; background:var(--brand-soft); color:var(--brand); display:grid; place-items:center; }
.tool-card .tc-icon svg { width:19px; height:19px; }
.tool-card h3 { font-size:15.5px; font-weight:700; letter-spacing:-.01em; }
.tool-card p { font-size:13.3px; color:var(--text-2); line-height:1.5; flex:1; }
.tool-card .tc-cat { font-size:11.8px; font-weight:600; color:var(--text-3); }

/* Feature grid */
.feature-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:18px; }
.feature-card { background:var(--bg-2); border:1px solid var(--border); border-radius:var(--radius-lg); padding:26px; }
.feature-card .fc-icon { width:44px; height:44px; border-radius:12px; background:var(--brand-soft); color:var(--brand); display:grid; place-items:center; margin-bottom:14px; }
.feature-card h3 { font-size:16.5px; font-weight:700; margin-bottom:7px; }
.feature-card p { font-size:14.2px; color:var(--text-2); }

/* FAQ */
.faq-list { max-width:760px; margin:0 auto; display:flex; flex-direction:column; gap:12px; }
.faq-item { background:var(--bg-2); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.faq-item summary { padding:18px 22px; font-weight:600; font-size:15.5px; cursor:pointer; list-style:none; display:flex; align-items:center; justify-content:space-between; gap:14px; }
.faq-item summary::-webkit-details-marker { display:none; }
.faq-item summary::after { content:'+'; font-size:22px; color:var(--text-3); font-weight:400; transition:transform .2s; }
.faq-item[open] summary::after { transform:rotate(45deg); }
.faq-item .faq-a { padding:0 22px 18px; color:var(--text-2); font-size:14.6px; }

/* CTA band */
.cta-band { background:var(--grad); border-radius:var(--radius-lg); padding:52px 40px; text-align:center; color:#fff; position:relative; overflow:hidden; }
.cta-band::before { content:''; position:absolute; inset:0; background:radial-gradient(400px 200px at 80% 0%, rgba(255,255,255,.18), transparent 70%); }
.cta-band h2 { font-size:clamp(24px,3.4vw,34px); font-weight:800; letter-spacing:-.02em; margin-bottom:12px; position:relative; }
.cta-band p { opacity:.92; max-width:520px; margin:0 auto 26px; position:relative; }
.cta-band .btn-white { display:inline-flex; align-items:center; gap:9px; background:#fff; color:var(--brand); font-weight:700; padding:13px 30px; border-radius:12px; font-size:15.5px; position:relative; box-shadow:0 8px 24px -6px rgba(0,0,0,.3); }
.cta-band .btn-white:hover { text-decoration:none; transform:translateY(-2px); }

/* ============ FOOTER ============ */
.footer { border-top:1px solid var(--border); background:var(--bg-2); margin-top:60px; }
.footer-grid { display:grid; grid-template-columns:1.6fr 1fr 1fr 1fr; gap:36px; padding:52px 0 40px; }
.footer h4 { font-size:13.5px; text-transform:uppercase; letter-spacing:.08em; color:var(--text-3); margin-bottom:16px; font-weight:700; }
.footer-links { display:flex; flex-direction:column; gap:9px; }
.footer-links a { color:var(--text-2); font-size:14.2px; }
.footer-links a:hover { color:var(--brand); }
.footer-brand p { color:var(--text-2); font-size:14.2px; margin:14px 0 18px; max-width:300px; }
.footer-bottom { border-top:1px solid var(--border); padding:20px 0; display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; color:var(--text-3); font-size:13.5px; }
.footer-bottom a { color:var(--text-2); }

/* ============ TOOL PAGE ============ */
.breadcrumbs { display:flex; align-items:center; gap:8px; font-size:13.5px; color:var(--text-3); padding:18px 0 0; flex-wrap:wrap; }
.breadcrumbs a { color:var(--text-2); }
.breadcrumbs .sep { color:var(--border-2); }
.tool-header { padding:26px 0 8px; }
.tool-header h1 { font-size:clamp(26px,3.6vw,36px); font-weight:800; letter-spacing:-.025em; display:flex; align-items:center; gap:14px; }
.tool-header .th-icon { width:50px; height:50px; border-radius:13px; background:var(--grad); color:#fff; display:grid; place-items:center; flex-shrink:0; }
.tool-header .th-icon svg { width:24px; height:24px; }
.tool-header p.sub { color:var(--text-2); font-size:16.5px; margin-top:10px; max-width:720px; }
.trust-pills { display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; }
.trust-pill { display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; color:var(--green); background:color-mix(in srgb, var(--green) 10%, transparent); border-radius:100px; padding:5px 13px; }
.trust-pill svg { width:13px; height:13px; }

/* Tool workspace */
.tool-workspace { background:var(--bg-2); border:1px solid var(--border); border-radius:var(--radius-lg); padding:28px; margin:26px 0; box-shadow:var(--shadow-sm); }
.tw-row { display:flex; gap:14px; flex-wrap:wrap; align-items:center; }
.tw-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
@media(max-width:760px){ .tw-grid-2 { grid-template-columns:1fr; } }

label.field-label { display:block; font-size:13.5px; font-weight:600; color:var(--text-2); margin-bottom:7px; }
.input, textarea.input, select.input {
  width:100%; background:var(--bg); border:1.5px solid var(--border); border-radius:11px;
  padding:11px 14px; outline:none; transition:border-color .15s;
}
.input:focus { border-color:var(--brand); }
textarea.input { min-height:170px; resize:vertical; line-height:1.6; }
textarea.mono, .mono { font-family:var(--mono); font-size:13.5px; }

.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; border:none; border-radius:11px; font-weight:600; font-size:14.5px; padding:11px 22px; transition:.15s; }
.btn-primary { background:var(--grad); color:#fff; box-shadow:0 4px 14px -4px color-mix(in srgb, var(--brand) 60%, transparent); }
.btn-primary:hover { transform:translateY(-1px); box-shadow:0 8px 20px -6px color-mix(in srgb, var(--brand) 65%, transparent); }
.btn-secondary { background:var(--bg-3); color:var(--text); border:1px solid var(--border); }
.btn-secondary:hover { border-color:var(--brand); color:var(--brand); }
.btn-sm { padding:8px 15px; font-size:13.5px; border-radius:9px; }
.btn svg { width:16px; height:16px; }

.result-box { background:var(--bg); border:1.5px dashed var(--border-2); border-radius:12px; padding:18px; margin-top:16px; }
.result-value { font-size:clamp(22px,3vw,30px); font-weight:800; color:var(--brand); letter-spacing:-.02em; word-break:break-all; }
.result-note { font-size:13.5px; color:var(--text-2); margin-top:6px; }
.steps-box { background:var(--brand-soft); border-radius:11px; padding:14px 18px; margin-top:12px; font-size:14px; color:var(--text-2); font-family:var(--mono); }

.stat-pills { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:11px; margin-bottom:16px; }
.stat-pill { background:var(--bg); border:1px solid var(--border); border-radius:11px; padding:13px 10px; text-align:center; }
.stat-pill .v { font-size:21px; font-weight:800; color:var(--brand); letter-spacing:-.02em; }
.stat-pill .k { font-size:11.8px; color:var(--text-3); font-weight:600; margin-top:2px; }

.copy-feedback { font-size:12.5px; color:var(--green); font-weight:600; opacity:0; transition:opacity .2s; }
.copy-feedback.show { opacity:1; }

/* Drop zone */
.drop-zone { border:2px dashed var(--border-2); border-radius:var(--radius); padding:44px 20px; text-align:center; color:var(--text-2); transition:.2s; cursor:pointer; background:var(--bg); }
.drop-zone:hover, .drop-zone.drag { border-color:var(--brand); background:var(--brand-soft); }
.drop-zone svg { width:40px; height:40px; margin:0 auto 12px; color:var(--brand); }
.drop-zone .dz-title { font-weight:700; color:var(--text); font-size:16px; }
.drop-zone .dz-sub { font-size:13.5px; margin-top:4px; }

/* range slider */
input[type=range] { width:100%; accent-color: var(--brand); height:6px; }

/* Content sections on tool pages */
.tool-content { max-width:840px; margin:10px auto 0; }
.tool-content h2 { font-size:23px; font-weight:800; letter-spacing:-.02em; margin:42px 0 14px; }
.tool-content p { color:var(--text-2); font-size:15.5px; margin-bottom:14px; }
.tool-content ol.howto { counter-reset:step; list-style:none; display:flex; flex-direction:column; gap:12px; margin:6px 0 10px; }
.tool-content ol.howto li { display:flex; gap:14px; align-items:flex-start; background:var(--bg-2); border:1px solid var(--border); border-radius:12px; padding:15px 18px; color:var(--text-2); font-size:14.8px; }
.tool-content ol.howto li::before { counter-increment:step; content:counter(step); width:28px; height:28px; border-radius:8px; background:var(--grad); color:#fff; font-weight:700; font-size:14px; display:grid; place-items:center; flex-shrink:0; }
.use-chips { display:flex; flex-wrap:wrap; gap:9px; }
.use-chip { background:var(--bg-2); border:1px solid var(--border); border-radius:100px; padding:7px 16px; font-size:13.5px; color:var(--text-2); font-weight:500; }

/* tables */
table.data-table { width:100%; border-collapse:collapse; font-size:14px; background:var(--bg-2); border-radius:12px; overflow:hidden; border:1px solid var(--border); }
table.data-table th { background:var(--bg-3); text-align:left; padding:10px 14px; font-weight:700; font-size:13px; color:var(--text-2); }
table.data-table td { padding:9px 14px; border-top:1px solid var(--border); color:var(--text-2); }

/* Category page */
.cat-hero { padding:52px 0 20px; }
.cat-hero h1 { font-size:clamp(28px,4vw,40px); font-weight:800; letter-spacing:-.025em; display:flex; align-items:center; gap:14px; }
.cat-hero p { color:var(--text-2); font-size:16.5px; margin-top:10px; max-width:680px; }

/* Diff view */
.diff-out { font-family:var(--mono); font-size:13px; line-height:1.7; background:var(--bg); border:1px solid var(--border); border-radius:12px; padding:14px; max-height:420px; overflow:auto; white-space:pre-wrap; }
.diff-add { background:color-mix(in srgb, var(--green) 16%, transparent); color:var(--green); display:block; }
.diff-del { background:color-mix(in srgb, var(--red) 14%, transparent); color:var(--red); display:block; text-decoration:line-through; }

/* regex highlight */
mark.rx { background:color-mix(in srgb, var(--amber) 40%, transparent); border-radius:3px; padding:0 1px; color:inherit; }

/* progress ring / timers */
.timer-display { font-size:clamp(52px,10vw,88px); font-weight:800; font-family:var(--mono); text-align:center; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }

/* invoice preview */
.invoice-paper { background:#fff; color:#111; border:1px solid var(--border); border-radius:12px; padding:36px; box-shadow:var(--shadow); }
[data-theme="dark"] .invoice-paper { border-color:#333; }

/* print */
@media print {
  .navbar, .footer, .no-print, .breadcrumbs, .tool-content, .trust-pills, .search-modal, .mobile-nav { display:none !important; }
  body { background:#fff; }
  .tool-workspace { border:none; box-shadow:none; padding:0; }
}

/* Responsive */
@media (max-width: 900px) {
  .nav-links, .search-trigger { display:none; }
  .menu-btn { display:grid; }
  .footer-grid { grid-template-columns:1fr 1fr; }
  .stats-strip { grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns:1fr; }
  .section { padding:44px 0; }
  .tool-workspace { padding:18px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation:none !important; transition:none !important; }
  html { scroll-behavior:auto; }
}
