/* ============================================================
   WTEC — Web Tools & Tech Centre
   style.css — Clean professional design, light/dark mode
   ============================================================ */

/* ── 1. CSS Variables ─────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:         #f1f5f9;
  --bg-card:    #ffffff;
  --bg-surface: #ffffff;
  --bg-input:   #f8fafc;
  --bg-hover:   #f8fafc;

  /* Text */
  --text:   #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;

  /* Borders */
  --border:       #e2e8f0;
  --border-light: #f1f5f9;

  /* Accent — Indigo */
  --accent:       #4f46e5;
  --accent-hover: #4338ca;
  --accent-bg:    #eef2ff;
  --accent-dim:   rgba(79,70,229,0.08);
  --accent-glow:  none;
  --glow:         none;

  /* Semantic */
  --green:    #16a34a;
  --green-bg: #f0fdf4;
  --red:      #dc2626;
  --red-bg:   #fef2f2;
  --yellow:   #d97706;
  --yellow-bg:#fffbeb;
  --purple:   #7c3aed;
  --purple-bg:#f5f3ff;

  /* Elevation */
  --shadow:    0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);

  /* Nav / footer */
  --nav-bg:     #ffffff;
  --nav-border: #e2e8f0;
  --footer-bg:  #0f172a;

  /* Layout */
  --nav-h:  60px;
  --max-w:  1200px;
  --radius:    8px;
  --radius-sm: 5px;
  --radius-lg: 12px;

  /* Typography */
  --font-ui:   -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Liberation Mono', monospace;
}

/* ── Dark mode ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:         #0f1117;
  --bg-card:    #1a1d27;
  --bg-surface: #1e2230;
  --bg-input:   #252836;
  --bg-hover:   #22253a;

  --text:   #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;

  --border:       #2a2d3e;
  --border-light: #232638;

  --accent:       #6366f1;
  --accent-hover: #4f46e5;
  --accent-bg:    rgba(99,102,241,0.12);
  --accent-dim:   rgba(99,102,241,0.08);

  --green:    #22c55e;
  --green-bg: rgba(34,197,94,0.1);
  --red:      #ef4444;
  --red-bg:   rgba(239,68,68,0.1);
  --yellow:   #f59e0b;
  --yellow-bg:rgba(245,158,11,0.1);
  --purple:   #a78bfa;
  --purple-bg:rgba(167,139,250,0.1);

  --shadow:    0 1px 3px rgba(0,0,0,0.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.5);

  --nav-bg:     #1a1d27;
  --nav-border: #2a2d3e;
  --footer-bg:  #0a0d14;
}

/* ── 2. Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-ui); }
input, select, textarea { font-family: var(--font-ui); }

/* ── 3. Navigation ───────────────────────────────────────── */
#site-nav {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 8px;
}
.nav-logo:hover { text-decoration: none; }
.nav-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #1e1b4b;
  border: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: -1px;
}
.nav-logo-text { display: flex; flex-direction: column; }
.nav-logo-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.nav-logo-tag {
  font-size: 9px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  line-height: 1;
}
.nav-links {
  display: flex;
  list-style: none;
  gap: 2px;
  margin-left: 4px;
}
.nav-links a {
  display: block;
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--accent); background: var(--accent-bg); }
.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  height: 36px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-3);
  transition: border-color 0.15s;
  min-width: 180px;
}
.nav-search:focus-within { border-color: var(--accent); }
.nav-search input {
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
  width: 150px;
}
.nav-search input::placeholder { color: var(--text-3); }

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }

.nav-mobile-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-2);
  padding: 6px;
}

/* ── 4. Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border); color: var(--text); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--bg-input); color: var(--text-2); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost { background: none; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--border); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.btn.copied { background: var(--green-bg); color: var(--green); border-color: var(--green); }

/* ── 5. Tool Grid & Cards ─────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.tool-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
  text-decoration: none;
}
[data-theme="dark"] .tool-card:hover { border-color: var(--accent); }
.tool-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  color: var(--accent);
  margin-bottom: 2px;
  font-size: 18px;
  flex-shrink: 0;
}
.tool-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.tool-card-desc {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55;
}

/* ── 6. Tool Page Layout ──────────────────────────────────── */
.tool-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}
.tool-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tool-breadcrumb a { color: var(--text-3); text-decoration: none; }
.tool-breadcrumb a:hover { color: var(--accent); text-decoration: none; }
.tool-breadcrumb span { color: var(--text-3); }
.tool-hero { margin-bottom: 24px; }
.tool-hero h1 {
  font-size: clamp(22px, 3.5vw, 30px);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.tool-hero p {
  font-size: 15px;
  color: var(--text-2);
  max-width: 620px;
  line-height: 1.65;
}

/* ── 7. Tool Box (interface container) ───────────────────── */
.tool-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.tool-box-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
}
.tool-box-dots { display: flex; gap: 6px; align-items: center; }
.tool-box-dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.tool-box-dots span:nth-child(1) { background: #ff5f57; }
.tool-box-dots span:nth-child(2) { background: #ffbd2e; }
.tool-box-dots span:nth-child(3) { background: #28c940; }
.tool-box-title {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.tool-box-body { padding: 20px; }

/* ── 8. Inputs & Selects ──────────────────────────────────── */
.ui-input, .ui-select, .code-input, textarea.code-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13.5px;
  padding: 9px 13px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.ui-input:focus, .ui-select:focus, .code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.ui-input::placeholder { color: var(--text-3); }
.code-input {
  font-family: var(--font-mono);
  font-size: 12.5px;
  resize: vertical;
  min-height: 100px;
  line-height: 1.7;
}
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 6px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.check-item input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; }
.w-full { width: 100%; }

/* ── 9. Output Areas ──────────────────────────────────────── */
.output-area {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 80px;
}
.relative { position: relative; }
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.output-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.tool-col-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }

/* ── 10. Tool Columns ─────────────────────────────────────── */
.tool-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media(max-width:640px) { .tool-cols { grid-template-columns: 1fr; } }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:560px) { .cols-2 { grid-template-columns: 1fr; } }

/* ── 11. Alerts ───────────────────────────────────────────── */
.alert {
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  display: none;
  line-height: 1.5;
}
.alert.show { display: block; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(22,163,74,0.2); }
.alert-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid rgba(220,38,38,0.2); }
.alert-info    { background: var(--accent-bg); color: var(--accent);border: 1px solid rgba(79,70,229,0.2); }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-16 { margin-top: 16px; }

/* ── 12. FAQ ──────────────────────────────────────────────── */
.tool-description,
.faq,
.related-tools {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.tool-description h2,
.faq h2,
.related-tools h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.tool-description h3 { font-size: 14px; font-weight: 600; color: var(--text); margin: 14px 0 8px; }
.tool-description p  { font-size: 14px; color: var(--text-2); line-height: 1.8; margin-bottom: 12px; }
.tool-description ul { padding-left: 20px; color: var(--text-2); font-size: 14px; line-height: 2; margin-bottom: 12px; }
.tool-description code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent);
}
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 13px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: color 0.15s;
}
.faq-q:hover { color: var(--accent); }
.faq-arrow { color: var(--text-3); transition: transform 0.2s; font-size: 16px; flex-shrink: 0; }
.faq-item.open .faq-q .faq-arrow { transform: rotate(180deg); color: var(--accent); }
.faq-a {
  display: none;
  padding: 0 0 14px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.75;
}
.faq-item.open .faq-a { display: block; }

/* ── 13. Related Tools ────────────────────────────────────── */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.related-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.related-card:hover { border-color: var(--accent); background: var(--accent-bg); text-decoration: none; }
.related-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.related-name { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.related-desc { font-size: 11.5px; color: var(--text-3); line-height: 1.3; }

/* ── 14. Stats Row ────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0;
}
.stat-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 80px;
  text-align: center;
}
.stat-num   { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--accent); line-height: 1.2; }
.stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.stat-box   { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; flex: 1; min-width: 120px; text-align: center; }
.stat-box-num   { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-box-label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.mono { font-family: var(--font-mono); }

/* ── 15. Color result grid (hex-rgb tool) ─────────────────── */
.color-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.color-result-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.color-result-item:hover { border-color: var(--accent); }
.color-result-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
.color-result-value { font-family: var(--font-mono); font-size: 13px; color: var(--text); word-break: break-all; }

/* ── 16. JSON syntax highlighting ────────────────────────── */
.json-key     { color: var(--accent); }
.json-string  { color: var(--green); }
.json-number  { color: var(--yellow); }
.json-boolean { color: var(--purple); }
.json-null    { color: var(--text-3); }

/* ── 17. Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 99px;
}
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-blue   { background: var(--accent-bg); color: var(--accent); }

/* ── 18. Footer ───────────────────────────────────────────── */
#site-footer { background: var(--footer-bg); }
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: 32px;
  padding: 48px 24px 36px;
}
.footer-brand p {
  font-size: 13px;
  color: #64748b;
  line-height: 1.7;
  margin-top: 12px;
  max-width: 240px;
}
.footer-col h4 {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 13px; color: #64748b; text-decoration: none; transition: color 0.15s; }
.footer-col a:hover { color: #ffffff; text-decoration: none; }
.footer-bottom {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px 24px;
  border-top: 1px solid #1e2230;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-bottom span, .footer-bottom a {
  font-size: 12px;
  color: #475569;
  text-decoration: none;
}
.footer-bottom a:hover { color: #94a3b8; text-decoration: none; }

/* ── 19. Legal / Static pages ────────────────────────────── */
.legal-page { max-width: 780px; margin: 0 auto; padding: 48px 24px 60px; }
.legal-page h1 { font-size: clamp(22px,4vw,34px); font-weight: 700; color: var(--text); margin-bottom: 8px; letter-spacing: -.02em; }
.legal-page .page-subtitle { font-size: 13px; color: var(--text-3); margin-bottom: 32px; font-family: var(--font-mono); }
.legal-page h2 { font-size: 17px; font-weight: 700; color: var(--text); margin: 32px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.legal-page h3 { font-size: 14px; font-weight: 600; color: var(--text); margin: 16px 0 8px; }
.legal-page p  { font-size: 14.5px; color: var(--text-2); line-height: 1.85; margin-bottom: 14px; }
.legal-page ul { padding-left: 20px; color: var(--text-2); font-size: 14.5px; line-height: 2.1; margin-bottom: 14px; }
.legal-page a  { color: var(--accent); }
.legal-page code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-input); padding: 1px 5px; border-radius: 3px; color: var(--accent); }

/* ── 20. Admin styles (minimal, admin has own CSS) ────────── */
#site-nav .nav-search-results a:hover { background: var(--bg-hover); }

/* ── 21. Responsive ───────────────────────────────────────── */
@media(max-width:1024px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
  /* On tablet hide lower-priority nav items to prevent overflow */
  .nav-links li:nth-child(n+6) { display: none; }
}
@media(max-width:768px) {
  /* Hide tagline from logo — too wide on mobile */
  .nav-logo-tag { display: none; }

  /* Hide full nav links — hamburger controls them */
  .nav-links { display: none !important; }

  /* When mobile menu is open, show all links including hidden ones */
  .nav-links[data-open="1"] {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 60px; left: 0; right: 0;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    padding: 8px 16px 16px;
    gap: 2px;
    z-index: 99;
    box-shadow: var(--shadow-md);
  }
  .nav-links[data-open="1"] li { display: list-item !important; }
  .nav-links[data-open="1"] a {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 8px;
    display: block;
  }

  /* Shrink search to icon-only on mobile */
  .nav-search { min-width: unset; width: 36px; padding: 0 8px; justify-content: center; transition: width 0.2s, padding 0.2s; overflow: hidden; }
  .nav-search input { width: 0; opacity: 0; pointer-events: none; transition: width 0.2s, opacity 0.2s; }
  .nav-search.expanded { width: min(220px, 55vw); padding: 0 12px; }
  .nav-search.expanded input { width: 120px; opacity: 1; pointer-events: auto; }

  .nav-mobile-btn { display: flex; }
  .theme-toggle { margin-left: 4px; }

  .tool-page { padding: 20px 16px 40px; }
  .tool-box-body { padding: 16px; }
  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .footer-inner { grid-template-columns: 1fr 1fr; padding: 36px 16px 24px; gap: 20px; }
}
@media(max-width:480px) {
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-brand { display: none; }
  .tool-cols { grid-template-columns: 1fr; }
}

/* ── 22. Loading animation ────────────────────────────────── */
.loading { opacity: 0.6; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 23. Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── 24. Range input ──────────────────────────────────────── */
input[type=range] { -webkit-appearance: none; width: 100%; height: 4px; background: var(--border); border-radius: 2px; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--bg-card); }

/* ── 25. Select arrow ─────────────────────────────────────── */
.ui-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ── 26. Char counter ─────────────────────────────────────── */
.char-counter { font-size: 11px; font-family: var(--font-mono); margin-left: 6px; }
.char-ok   { color: var(--green); }
.char-warn { color: var(--yellow); }
.char-bad  { color: var(--red); }

/* ── 27. Table ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }
.name-cell { font-weight: 500; color: var(--text); }

/* ── 28. Translate Widget ─────────────────────────────────── */
#wtec-translate {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
#translate-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.15s;
  font-family: var(--font-ui);
  white-space: nowrap;
}
#translate-btn:hover {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}
#translate-dropdown {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
}
#translate-dropdown.open { display: block; }
.translate-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-ui);
}
.translate-option:hover { background: var(--bg-hover); color: var(--text); }
.translate-option.active { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.translate-lang-code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: auto;
}
#translate-dropdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 0;
}
/* Hide the raw Google Translate select element */
.goog-te-banner-frame,
.goog-te-balloon-frame { display: none !important; }
.goog-te-combo { display: none !important; }
body { top: 0 !important; }
