/* NexDev Tools — shared design system
   Light background, dark text, single accent (#2563eb). Mobile-first. */

:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #475569;
  --muted-2: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --container: 1120px;
  --header-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
img, svg, canvas { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.65rem); margin-top: 1.6em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.25rem; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--text); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: .95rem; font-weight: 800; flex: none;
}
.brand small { display: block; font-size: .7rem; font-weight: 500; color: var(--muted-2); letter-spacing: .02em; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--muted); font-size: .92rem; font-weight: 500;
  padding: 8px 10px; border-radius: var(--radius-sm);
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.nav-studio { color: var(--accent); font-weight: 600; }
.nav-toggle {
  display: none; margin-left: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 10px; font-size: 1rem; cursor: pointer; color: var(--text);
}
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; top: var(--header-h); left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--border); padding: 10px 20px 16px;
    flex-direction: column; align-items: stretch; gap: 2px; box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 64px; padding: 40px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.footer-grid h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin: 0 0 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.footer-grid a { color: var(--muted); font-size: .9rem; }
.footer-grid a:hover { color: var(--text); }
.footer-note { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: .84rem; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  padding: 11px 18px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: #fff; color: var(--text); cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: 12px; }
.btn-sm { padding: 7px 12px; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---------- Home ---------- */
.hero { padding: clamp(40px, 7vw, 76px) 0 28px; text-align: center; }
.hero p { max-width: 640px; margin: 0 auto 8px; color: var(--muted); font-size: 1.06rem; }
.hero .eyebrow { display: inline-block; margin-bottom: 14px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 5px 12px; border-radius: 999px; }
.search-wrap { max-width: 560px; margin: 26px auto 0; position: relative; }
.search-wrap input {
  width: 100%; font: inherit; font-size: 1rem; padding: 14px 16px 14px 44px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: #fff; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.search-wrap svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted-2); }
.tool-section { padding-top: 26px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 1.25rem; }
.section-head span { color: var(--muted-2); font-size: .85rem; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
  color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tool-card:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.tool-card .tag { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.tool-card strong { font-size: 1rem; }
.tool-card span.desc { color: var(--muted); font-size: .87rem; line-height: 1.45; }
.tool-card .privacy { margin-top: auto; padding-top: 8px; font-size: .74rem; color: var(--muted-2); display: flex; align-items: center; gap: 5px; }
.no-results { display: none; padding: 32px; text-align: center; color: var(--muted); }
.no-results.show { display: block; }

/* ---------- Tool page ---------- */
.page-head { padding: 38px 0 6px; }
.breadcrumbs { font-size: .84rem; color: var(--muted-2); margin-bottom: 12px; }
.breadcrumbs a { color: var(--muted-2); }
.page-head h1 { margin-bottom: 10px; }
.lede { color: var(--muted); font-size: 1.04rem; max-width: 760px; }
.privacy-badge {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 6px;
  background: var(--success-soft); color: var(--success); border: 1px solid #bbf7d0;
  font-size: .82rem; font-weight: 600; padding: 6px 11px; border-radius: 999px;
}
.privacy-badge.server { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.tool-shell { margin: 24px 0 8px; }
.panel {
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
  box-shadow: var(--shadow-sm); padding: clamp(18px, 3vw, 28px);
}
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface); padding: clamp(28px, 6vw, 48px) 20px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 40px; height: 40px; color: var(--accent); margin-bottom: 10px; }
.dropzone p { margin: 0 0 4px; font-weight: 600; }
.dropzone small { color: var(--muted-2); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.field-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 180px; flex: 1 1 180px; }
.field > label { font-size: .86rem; font-weight: 600; color: var(--muted); }
.field input[type=text], .field input[type=number], .field select, .field textarea {
  font: inherit; font-size: .95rem; color: var(--text); background: #fff;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 11px; width: 100%;
}
.field textarea { min-height: 110px; resize: vertical; }
.field .hint { font-size: .78rem; color: var(--muted-2); }
.field-inline { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

.file-list { margin-top: 18px; display: grid; gap: 8px; }
.file-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  font-size: .9rem;
}
.file-item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .meta { color: var(--muted-2); font-size: .8rem; flex: none; }
.file-item .grow { flex: 1; min-width: 0; }
.file-item .remove { background: none; border: 0; color: var(--danger); cursor: pointer; font-size: .82rem; font-weight: 600; padding: 4px 6px; }
.file-item .move { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .82rem; padding: 4px 6px; }

.progress { display: none; margin-top: 18px; }
.progress.show { display: block; }
.progress-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-label { font-size: .82rem; color: var(--muted); margin-top: 6px; }

.alert { margin-top: 18px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: .9rem; display: none; }
.alert.show { display: block; }
.alert-error { background: var(--danger-soft); border: 1px solid #fecaca; color: var(--danger); }
.alert-success { background: var(--success-soft); border: 1px solid #bbf7d0; color: var(--success); }
.alert-info { background: var(--accent-soft); border: 1px solid #bfdbfe; color: var(--accent-dark); }

.result { display: none; margin-top: 20px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.result.show { display: block; }
.result-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.result-head strong { font-size: 1rem; }
.result-stats { display: flex; flex-wrap: wrap; gap: 10px 22px; color: var(--muted); font-size: .88rem; }
.result-stats b { color: var(--text); }
.preview-box { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; padding: 10px; display: grid; place-items: center; min-height: 120px; }
.preview-box img { max-height: 360px; width: auto; border-radius: 4px; }
.preview-box canvas { max-height: 360px; width: auto; }

.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; width: fit-content; }
.tabs button {
  font: inherit; font-size: .88rem; font-weight: 600; border: 0; background: transparent;
  color: var(--muted); padding: 8px 14px; border-radius: 8px; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Content sections ---------- */
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; margin-top: 44px; }
@media (max-width: 900px) { .content-grid { grid-template-columns: 1fr; gap: 28px; } }
.prose h2 { margin-top: 1.9em; }
.prose h2:first-child { margin-top: 0; }
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 12px; }
.steps li { position: relative; padding-left: 42px; color: var(--muted); }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; font-size: .85rem;
  display: grid; place-items: center;
}
.steps li strong { color: var(--text); }
.faq { display: grid; gap: 10px; margin-top: 14px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 600; font-size: .95rem; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted-2); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq .faq-body { padding: 0 16px 16px; color: var(--muted); font-size: .93rem; }
.sidebar { display: grid; gap: 18px; align-content: start; }
.side-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 18px; }
.side-card h3 { font-size: .95rem; margin-bottom: 10px; }
.side-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.side-card a { font-size: .9rem; }
.side-card p { font-size: .86rem; color: var(--muted); margin: 0; }

/* ---------- Trust pages ---------- */
.trust-page { max-width: 800px; padding-top: 38px; }
.trust-page h2 { margin-top: 1.8em; }
.trust-page p, .trust-page li { color: var(--muted); }
.trust-page strong { color: var(--text); }
.updated { font-size: .84rem; color: var(--muted-2); margin-bottom: 26px; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; }
.toast {
  background: var(--text); color: #fff; padding: 11px 16px; border-radius: 10px;
  font-size: .9rem; box-shadow: var(--shadow); max-width: 340px; animation: toast-in .18s ease-out;
}
.toast.error { background: #7f1d1d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Misc ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
