:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a202c;
  --muted: #5b6472;
  --brand: #1a56db;
  --brand-dark: #1242a6;
  --border: #e2e6ec;
  --accent: #0e9f6e;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 820px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--brand);
  text-decoration: none;
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-header nav a:hover { color: var(--brand); }

/* Layout */
main { padding: 32px 0 48px; }

.hero h1 { font-size: 1.9rem; margin: 8px 0 8px; line-height: 1.25; }
.tool-article h1 { font-size: 1.7rem; margin: 8px 0 8px; line-height: 1.3; }

.intro { color: var(--muted); font-size: 1.05rem; margin: 0 0 24px; }

.page-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 { font-size: 1.15rem; margin: 0 0 12px; }
.card p { margin: 0 0 12px; }
.card p:last-child { margin-bottom: 0; }

/* Calculator form */
.calculator { padding: 24px; }

.calc-form { display: grid; grid-template-columns: 1fr; gap: 16px; }

.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfd;
  overflow: hidden;
}
.input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12); }

.input-wrap .unit {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
  background: #f1f3f6;
  align-self: stretch;
  display: flex;
  align-items: center;
}

.input-wrap input {
  width: 100%;
  border: none;
  outline: none;
  padding: 10px 12px;
  font-size: 1rem;
  background: transparent;
  min-width: 0;
}

.field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfd;
  appearance: auto;
}

/* Results */
.calc-result {
  margin-top: 20px;
  border-top: 1px dashed var(--border);
  padding-top: 16px;
}
.calc-result h2 { font-size: 1rem; margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid #eef0f4;
  font-size: 0.98rem;
}
.row:last-child { border-bottom: none; }
.row .val { font-weight: 600; white-space: nowrap; }
.row.strong { font-weight: 700; font-size: 1.05rem; }
.row.strong .val { color: var(--accent); }

/* FAQ */
.faq-item { border-bottom: 1px solid #eef0f4; padding: 12px 0; }
.faq-item:first-child { padding-top: 0; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-item h3 { font-size: 1rem; margin: 0 0 6px; }
.faq-item p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Related grid + tool cards */
.related { margin: 24px 0; }
.related h2 { font-size: 1.15rem; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 8px 0 28px;
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.tool-card:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 14px rgba(26, 86, 219, 0.10);
  transform: translateY(-2px);
}
.tool-card h2 { font-size: 1.02rem; margin: 0 0 6px; color: var(--brand); }
.tool-card p { margin: 0; font-size: 0.9rem; color: var(--muted); }

.related-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.related-links a {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
}
.related-links a:hover { border-color: var(--brand); color: var(--brand); }

/* Misc */
.disclaimer {
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 28px;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 20px 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand); }
.site-footer .footer-nav { margin-bottom: 8px; }
.site-footer .footer-nav a { font-weight: 600; }

.see-all { margin: 12px 0 0; font-size: 0.95rem; }
.see-all a { color: var(--brand); text-decoration: none; }
.see-all a:hover { text-decoration: underline; }

@media (min-width: 640px) {
  .calc-form { grid-template-columns: repeat(2, 1fr); }
}

/* Category nav under header */
.cat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding-top: 0;
  padding-bottom: 12px;
  font-size: 0.9rem;
}
.cat-nav a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}
.cat-nav a:hover { color: var(--brand); border-bottom-color: var(--brand); }

/* Home search */
.search-wrap { margin: 4px 0 8px; max-width: 520px; }
.search-wrap input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  outline: none;
}
.search-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

/* Category sections on home */
.cat-section { margin-bottom: 36px; }
.cat-section > h2 {
  font-size: 1.25rem;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.cat-section .tool-grid { margin: 0 0 4px; }

.hidden { display: none !important; }

/* Breadcrumb */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 10px;
  overflow-x: auto;
  white-space: nowrap;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); text-decoration: underline; }
.breadcrumb span { color: var(--text); }

/* Form actions / reset */
.form-actions { grid-column: 1 / -1; }
.btn-reset {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-reset:hover {
  color: var(--brand);
  border-color: var(--brand);
}
