@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0d0f14;
  --surface: #141720;
  --surface2: #1c2030;
  --border: #252935;
  --text: #e2e5ee;
  --muted: #7c8199;
  --accent: #f59e0b;
  --accent-dim: rgba(245,158,11,.14);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,.12);
  --green: #10b981;
  --green-dim: rgba(16,185,129,.12);
  --mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── NAV ─────────────────────────────────────────────── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 8px;
}
.nav-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.nav-logo span { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  margin-left: 16px;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color .15s, background .15s;
  text-decoration: none;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: var(--surface2);
}

/* ── LAYOUT ──────────────────────────────────────────── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 20px 80px;
}

/* ── AD SLOTS ────────────────────────────────────────── */
.ad-top {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 32px;
}
.ad-mid {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  margin: 32px 0;
}

/* ── HERO ────────────────────────────────────────────── */
.hero {
  margin-bottom: 32px;
}
.hero h1 {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 700;
  letter-spacing: -.5px;
  line-height: 1.2;
  margin-bottom: 8px;
}
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p {
  color: var(--muted);
  font-size: 15px;
  max-width: 620px;
}

/* ── CALCULATOR CARD ─────────────────────────────────── */
.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 28px;
}
.calc-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.calc-header h2 {
  font-size: 15px;
  font-weight: 600;
}
.calc-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.calc-body {
  padding: 24px 20px;
}

/* ── FORM GRID ───────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s;
  appearance: none;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237c8199' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ── RESULTS ─────────────────────────────────────────── */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.result-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.result-item.highlight {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.result-item.warn {
  border-color: var(--red);
  background: var(--red-dim);
}
.result-item.good {
  border-color: var(--green);
  background: var(--green-dim);
}
.result-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.result-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}
.result-item.highlight .result-value { color: var(--accent); }
.result-item.warn .result-value { color: var(--red); }
.result-item.good .result-value { color: var(--green); }
.result-unit {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── EXPLAINER ───────────────────────────────────────── */
.explainer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 28px;
}
.explainer h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}
.explainer h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--accent);
}
.explainer p { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.explainer ul { color: var(--muted); font-size: 14px; padding-left: 20px; }
.explainer ul li { margin-bottom: 6px; }
.formula {
  font-family: var(--mono);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--accent);
  margin: 12px 0;
  overflow-x: auto;
}

/* ── RELATED GRID ────────────────────────────────────── */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color .15s, background .15s;
}
.related-card:hover {
  border-color: var(--accent);
  background: var(--surface2);
  text-decoration: none;
}
.related-card .icon {
  font-size: 20px;
  flex-shrink: 0;
}
.related-card .info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.related-card .info span {
  font-size: 12px;
  color: var(--muted);
}

/* ── HOME GRID ───────────────────────────────────────── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 32px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-decoration: none;
  display: block;
  transition: border-color .15s, transform .1s;
}
.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}
.tool-card .tc-icon {
  font-size: 28px;
  margin-bottom: 12px;
}
.tool-card .tc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.tool-card .tc-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.tool-card .tc-tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 99px;
}

/* ── SECTION HEADING ─────────────────────────────────── */
.section-heading {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin: 32px 0 14px;
}

/* ── FOOTER ──────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

/* ── MODE TOGGLE ─────────────────────────────────────── */
.mode-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
}
.mode-toggle button {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mode-toggle button.active {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ── TWO-COLUMN CARD LAYOUT ──────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 700px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .results { grid-template-columns: 1fr 1fr; }
  .nav-links a { padding: 5px 8px; font-size: 12px; }
}
