/* Geneva Tools — shared stylesheet. Mobile-first, vanilla CSS, no frameworks. */

:root {
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-light: #eff6ff;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; margin-top: 2rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1rem; }
main { padding: 1.5rem 0 3rem; }
.lede { color: var(--muted); font-size: 1.1rem; max-width: 42rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.logo svg { display: block; }
.site-nav {
  margin-left: auto;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--bg); }
.site-nav a.active { color: var(--primary); background: var(--primary-light); }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
}
.hero h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 38rem; margin: 0 auto; }
.hero .badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Tool cards ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0 2.5rem;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12); }
.tool-card .icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
}
.tool-card h3 { margin: 0.25rem 0 0; font-size: 1.15rem; color: var(--text); }
.tool-card p { margin: 0; color: var(--muted); font-size: 0.95rem; flex: 1; }
.tool-card .cta { color: var(--primary); font-weight: 700; font-size: 0.95rem; }

/* ---------- Ad slots ---------- */
.ad-slot {
  border: 2px dashed #cbd5e1;
  background: #f1f5f9;
  color: #94a3b8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.5rem auto;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.ad-leaderboard { min-height: 90px; max-width: 970px; }
.ad-infeed { min-height: 220px; margin: 0; }

/* ---------- Tool page layout ---------- */
.tool-page h1 { margin-top: 0.5rem; }
.tool-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 700; margin-bottom: 0.35rem; font-size: 0.95rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }

input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input:focus, textarea:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
textarea { min-height: 90px; resize: vertical; }

button, .btn {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.4rem;
  background: var(--primary);
  color: #fff;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button:disabled { background: #94a3b8; cursor: not-allowed; }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }

/* Unit converter */
.converter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: stretch;
  margin: 1rem 0;
}
.converter-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}
.converter-col .result {
  font-size: 1.6rem;
  font-weight: 800;
  min-height: 2.6rem;
  word-break: break-all;
  margin-bottom: 0.5rem;
}
.swap-wrap { display: flex; justify-content: center; }
#swapBtn {
  width: 52px; height: 52px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  align-self: center;
}
.all-results {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}
.all-results th, .all-results td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.all-results th { color: var(--muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.all-results td:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }

/* QR generator */
.qr-output {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1rem 0;
}
.qr-output img, .qr-output canvas, .qr-output table { max-width: 100%; height: auto; }
.qr-placeholder { color: var(--muted); font-size: 0.95rem; text-align: center; }
.form-error { color: #b91c1c; font-weight: 600; font-size: 0.95rem; min-height: 1.4em; }

/* Password generator */
.pw-output-row { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.pw-output-row input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; flex: 1; }
input[type="range"] { width: 100%; accent-color: var(--primary); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 1rem 0; }
.checks label {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.95rem; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.6rem 0.8rem;
}
.checks input { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }
.meter { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin: 0.4rem 0 0.25rem; }
.meter > div { height: 100%; width: 0; border-radius: 999px; transition: width 0.2s ease, background 0.2s ease; }
.meter-label { font-size: 0.9rem; font-weight: 700; }
.copy-feedback { color: var(--primary-dark); font-size: 0.9rem; font-weight: 600; min-height: 1.4em; }

/* FAQ */
.faq { margin: 2rem 0; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.faq summary { font-weight: 700; cursor: pointer; }
.faq summary::marker { color: var(--primary); }
.faq p { margin: 0.5rem 0 0; color: var(--muted); }

/* SEO intro */
.seo-intro { color: var(--muted); max-width: 46rem; }
.seo-intro h2 { color: var(--text); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding: 2rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.footer-grid h4 { color: var(--text); margin: 0 0 0.5rem; font-size: 1rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 0.35rem; }
.footer-grid a { color: var(--muted); text-decoration: none; }
.footer-grid a:hover { color: var(--primary); }
.footer-bottom {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  font-size: 0.85rem;
}

/* 404 */
.not-found { text-align: center; padding: 4rem 1rem; }
.not-found h1 { font-size: 4rem; margin-bottom: 0.5rem; color: var(--primary); }

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
  h1 { font-size: 2.2rem; }
  .hero h1 { font-size: 2.6rem; }
  .tool-grid { grid-template-columns: 1fr 1fr; }
  .converter-grid { grid-template-columns: 1fr auto 1fr; align-items: center; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
  .ad-leaderboard { min-height: 110px; }
}
@media (min-width: 900px) {
  .tool-grid { grid-template-columns: 1fr 1fr 1fr; }
  .tool-grid .ad-infeed { grid-column: auto; }
}

/* ---------- New tools (batch 2) ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}
.stat-value { font-size: 1.35rem; font-weight: 800; word-break: break-all; }
.stat-label { font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }
.swatch {
  width: 100%; height: 84px;
  border-radius: 8px; border: 1px solid var(--border);
  margin-bottom: 1rem;
}
textarea.code-output {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}
input[type="color"] {
  width: 100%; height: 3rem; padding: 0.2rem;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.mini-form { border-top: 1px solid var(--border); padding-top: 1.25rem; margin-top: 1.25rem; }
.mini-form:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
