/* Globzi — shared styles for every page. Light by default, dark when the system prefers it. */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e2e5ea;
  --text: #16181d;
  --muted: #5f6672;
  --faint: #8b929e;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --ok: #15803d;
  --bad: #c2410c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1015;
    --surface: #161a22;
    --surface-2: #1d222c;
    --border: #2a303c;
    --text: #e8eaee;
    --muted: #a1a8b5;
    --faint: #6f7684;
    --accent: #8b8cff;
    --accent-soft: #23264a;
    --ok: #4ade80;
    --bad: #fb923c;
    --shadow: none;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header & footer ---------- */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.logo { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text); text-decoration: none; }
.logo span { color: var(--accent); }
.site-header nav { margin-left: auto; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 0.92rem; font-weight: 500; }
.site-header nav a:hover { color: var(--text); }

.site-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 28px 0; color: var(--faint); font-size: 0.85rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

main { padding: 36px 0 64px; }

/* ---------- Home ---------- */
.hero { text-align: center; padding: 28px 0 8px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.hero p { margin-top: 10px; color: var(--muted); font-size: 1.1rem; }
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 560px;
  margin: 26px auto 0;
  padding: 0 16px;
  height: 52px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search svg { flex-shrink: 0; color: var(--faint); }
.search input[type="search"] { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; border-radius: 0; outline: none; background: none; font-size: 16px; }
.search input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.search kbd { font: 0.75rem var(--mono); color: var(--faint); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; }

/* Home: one panel per category, tools listed inside. */
.categories { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-auto-rows: 1fr; gap: 16px; margin-top: 44px; }
.category { padding: 8px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.category h2 { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; font-size: 1rem; font-weight: 700; }
.category h2 .count { margin-left: auto; color: var(--faint); font-weight: 500; font-size: 0.85rem; }
.tool-link { display: block; padding: 10px 12px; color: inherit; text-decoration: none; transition: background 0.12s; }
.tool-link:hover, .tool-link:focus-visible { background: var(--accent-soft); outline: none; }
.tool-link strong { display: block; font-weight: 650; font-size: 0.97rem; }
.tool-link:hover strong { color: var(--accent); }
.tool-link span { display: block; margin-top: 1px; color: var(--muted); font-size: 0.86rem; line-height: 1.4; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.card {
  display: block;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h3 { font-size: 1rem; font-weight: 650; }
.card p { margin-top: 4px; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.no-results { margin-top: 40px; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Tool page ---------- */
.crumbs { font-size: 0.85rem; color: var(--faint); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.tool-head h1 { margin-top: 6px; font-size: clamp(1.6rem, 3.5vw, 2.1rem); font-weight: 800; letter-spacing: -0.02em; }
.tool-head p { margin-top: 6px; color: var(--muted); }
.tool { margin-top: 24px; padding: 24px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.about { margin-top: 36px; max-width: 720px; }
.about h2, .related h2 { font-size: 1.1rem; font-weight: 700; }
.about p { margin-top: 10px; color: var(--muted); }
.related { margin-top: 40px; }

/* ---------- Form controls used by the tools ---------- */
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.row + .row, .row + .block, .block + .row, .block + .block { margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.grow { flex: 1 1 200px; }
label, .label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  font-size: 16px; /* 16px stops iOS Safari from zooming in */
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 220px; resize: vertical; line-height: 1.5; }
textarea.mono, input.mono, .mono { font-family: var(--mono); font-size: 14px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; }
input[type="color"] { width: 46px; height: 42px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.95rem; font-weight: 500; color: var(--text); cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: default; filter: none; border-color: var(--border); }
.btn.small { padding: 6px 11px; font-size: 0.82rem; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 36px 20px;
  border: 2px dashed var(--border);
  border-radius: 14px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { color: var(--text); font-size: 1.05rem; }
.dropzone input { display: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; background: var(--surface-2); border-radius: 10px; }
.stat .v { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 0.8rem; color: var(--muted); }

.output {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.output > span { flex: 1; min-width: 0; }
.msg { margin-top: 12px; font-size: 0.9rem; }
.msg.ok { color: var(--ok); }
.msg.bad { color: var(--bad); }
.note { font-size: 0.85rem; color: var(--faint); }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data td, table.data th { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; }
table.data th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
table.data td:last-child { text-align: right; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.88rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 50;
}

@media (max-width: 600px) {
  .tool { padding: 16px; }
  .search kbd { display: none; }
}
