@import "https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Mono:wght@500;600;700&family=Work+Sans:wght@400;500;600&display=swap";

:root {
  --ink-900: #0a0b0f;
  --ink-800: #12131a;
  --ink-700: #1a1c26;
  --ink-600: #2a2d3a;
  --ink-500: #3a3d4e;
  --brass: #c8a44e;
  --brass-bright: #e8c85e;
  --brass-dim: #8a7030;
  --text-onDark: #e8e6e0;
  --text-onDark-dim: #8a8d9a;
  --text-onDark-muted: #5a5d6a;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-body: 'Work Sans', system-ui, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --glow-brass: 0 0 20px rgba(200,164,78,0.15);
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--ink-900);
  color: var(--text-onDark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }

a { color: var(--brass-bright); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brass); text-decoration: underline; }

/* ── Header ── */
.site-header {
  background: var(--ink-900);
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid var(--ink-600);
  backdrop-filter: blur(12px);
  background: rgba(10,11,15,0.92);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; gap: 20px;
}
.wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 22px;
  color: var(--text-onDark); letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 8px;
}
.wordmark:hover { text-decoration: none; }
.wordmark-accent { color: var(--brass-bright); }
.wordmark-icon {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--brass-bright), var(--brass));
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--ink-900);
}
.main-nav { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.main-nav a {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-onDark-dim); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 4px 0; position: relative;
}
.main-nav a:hover { color: var(--brass-bright); text-decoration: none; }
.main-nav a::after {
  content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 1px;
  background: var(--brass-bright); transition: width var(--transition);
}
.main-nav a:hover::after { width: 100%; }

/* ── Search ── */
.search-wrap {
  position: relative; max-width: 480px; margin: 0 auto 32px;
}
.search-input {
  width: 100%; padding: 14px 20px 14px 48px;
  background: var(--ink-700); border: 1px solid var(--ink-600);
  border-radius: var(--radius-lg); color: var(--text-onDark);
  font-family: var(--font-body); font-size: 15px;
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  border-color: var(--brass); box-shadow: var(--glow-brass);
}
.search-input::placeholder { color: var(--text-onDark-muted); }
.search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--text-onDark-muted); pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--ink-700); border: 1px solid var(--ink-600);
  border-radius: var(--radius-md); max-height: 320px; overflow-y: auto;
  display: none; z-index: 200; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.search-results.active { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--ink-600);
  transition: background var(--transition);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--ink-600); text-decoration: none; }
.search-result-cat {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--brass); text-transform: uppercase; letter-spacing: 0.08em;
  min-width: 60px;
}
.search-result-name { font-size: 14px; color: var(--text-onDark); }

/* ── Mobile nav toggle ── */
.nav-toggle {
  display: none; background: none; border: none; color: var(--text-onDark);
  cursor: pointer; padding: 8px;
}
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--ink-800); flex-direction: column; gap: 0;
    border-bottom: 1px solid var(--ink-600); padding: 8px 0;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 24px; }
}

/* ── Hero ── */
.hero {
  padding: 64px 0 48px;
  background: linear-gradient(180deg, var(--ink-800) 0%, var(--ink-900) 100%);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at 50% 80%, rgba(200,164,78,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.hero-inner { max-width: 640px; position: relative; z-index: 1; }
.eyebrow {
  font-family: var(--font-mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--brass); margin-bottom: 12px;
}
.hero h1 {
  font-family: var(--font-display); font-size: clamp(32px, 5vw, 52px);
  font-weight: 700; line-height: 1.1; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-onDark) 60%, var(--brass-bright));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub { font-size: 17px; color: var(--text-onDark-dim); max-width: 520px; line-height: 1.7; }

/* ── Dial readout ── */
.dial-readout {
  display: inline-block; margin: 24px 0;
  padding: 16px 28px; font-family: var(--font-mono);
  font-size: clamp(18px, 3vw, 28px); font-weight: 600;
  background: var(--ink-700); border: 1px solid var(--ink-600);
  border-radius: var(--radius-md); color: var(--brass-bright);
  letter-spacing: -0.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.tabular { font-variant-numeric: tabular-nums; }

/* ── Tick divider ── */
.tick-divider {
  height: 1px; background: var(--ink-600);
  background-image: repeating-linear-gradient(90deg, var(--ink-500) 0, var(--ink-500) 1px, transparent 1px, transparent 8px);
}

/* ── Categories ── */
.categories-section { padding: 8px 24px 64px; }
.categories-section h2 {
  font-family: var(--font-display); font-size: 22px; margin-bottom: 24px;
}
.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.cat-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--ink-700); border: 1px solid var(--ink-600);
  border-radius: var(--radius-md); padding: 20px;
  color: var(--text-onDark);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.cat-card:hover {
  border-color: var(--brass); transform: translateY(-3px);
  box-shadow: var(--glow-brass); text-decoration: none;
}
.cat-icon {
  color: var(--brass-bright); background: var(--ink-800);
  border-radius: var(--radius-sm); width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cat-card h3 { font-family: var(--font-display); font-size: 16px; margin-bottom: 4px; }
.cat-card p { font-size: 13px; margin: 0; color: var(--text-onDark-dim); line-height: 1.5; }
.cat-count {
  font-family: var(--font-mono); font-size: 11px; color: var(--brass-dim);
  margin-top: 6px;
}

/* ── Converter page ── */
.page-top { padding-top: 40px; max-width: 640px; }
.page-sub { font-size: 17px; color: var(--text-onDark-dim); margin-bottom: 8px; }

/* ── Breadcrumbs ── */
.breadcrumbs {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-onDark-muted); margin-bottom: 20px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.breadcrumbs a { color: var(--text-onDark-dim); }
.breadcrumbs a:hover { color: var(--brass-bright); }

/* ── Converter widget ── */
.converter {
  background: var(--ink-700); border: 1px solid var(--ink-600);
  border-radius: var(--radius-lg); padding: 28px;
  margin: 24px 0; position: relative;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.converter-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.field { flex: 1; min-width: 160px; }
.field label {
  display: block; font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-onDark-muted); margin-bottom: 8px;
}
.field input, .field select {
  width: 100%; padding: 12px 16px;
  background: var(--ink-800); border: 1px solid var(--ink-600);
  border-radius: var(--radius-sm); color: var(--text-onDark);
  font-family: var(--font-mono); font-size: 18px;
  outline: none; transition: border-color var(--transition);
}
.field input:focus, .field select:focus { border-color: var(--brass); }
.field select { font-size: 14px; cursor: pointer; }

.swap-btn {
  background: var(--ink-800); border: 1px solid var(--ink-600);
  border-radius: 50%; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brass-bright); cursor: pointer;
  transition: all var(--transition); flex-shrink: 0;
}
.swap-btn:hover { background: var(--ink-600); transform: rotate(180deg); }

.result-display {
  margin-top: 20px; padding: 20px;
  background: var(--ink-800); border: 1px solid var(--ink-600);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.result-value {
  font-family: var(--font-mono); font-size: clamp(22px, 4vw, 32px);
  font-weight: 700; color: var(--brass-bright);
  font-variant-numeric: tabular-nums;
}
.copy-btn {
  background: var(--ink-700); border: 1px solid var(--ink-600);
  border-radius: var(--radius-sm); padding: 8px 14px;
  color: var(--text-onDark-dim); font-family: var(--font-mono); font-size: 12px;
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.copy-btn:hover { border-color: var(--brass); color: var(--brass-bright); }
.copy-btn.copied { border-color: #4ade80; color: #4ade80; }

/* ── Convert All ── */
.convert-all {
  margin: 24px 0; padding: 24px;
  background: var(--ink-700); border: 1px solid var(--ink-600);
  border-radius: var(--radius-lg);
}
.convert-all h3 {
  font-family: var(--font-display); font-size: 16px;
  margin-bottom: 16px; color: var(--text-onDark);
}
.convert-all-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.convert-all-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--ink-800);
  border: 1px solid var(--ink-600); border-radius: var(--radius-sm);
  font-size: 13px;
}
.convert-all-unit { color: var(--text-onDark-dim); font-family: var(--font-mono); font-size: 12px; }
.convert-all-val { color: var(--brass-bright); font-family: var(--font-mono); font-weight: 600; }

/* ── Formula box ── */
.formula-box {
  margin: 24px 0; padding: 20px;
  background: linear-gradient(135deg, rgba(200,164,78,0.06), transparent);
  border: 1px solid var(--brass-dim); border-radius: var(--radius-md);
}
.formula-box h3 {
  font-family: var(--font-display); font-size: 15px;
  color: var(--brass-bright); margin-bottom: 8px;
}
.formula-box p { font-size: 14px; color: var(--text-onDark-dim); line-height: 1.7; }
.formula-box code {
  font-family: var(--font-mono); background: var(--ink-800);
  padding: 2px 8px; border-radius: 4px; font-size: 13px;
  color: var(--brass-bright);
}

/* ── Quick reference table ── */
.ref-table { margin: 24px 0; overflow-x: auto; }
.ref-table table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
.ref-table th {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-onDark-muted); text-align: left;
  padding: 10px 14px; border-bottom: 1px solid var(--ink-600);
}
.ref-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--ink-600);
  color: var(--text-onDark-dim);
}
.ref-table td:last-child { color: var(--brass-bright); font-family: var(--font-mono); }
.ref-table tr:hover td { background: rgba(200,164,78,0.03); }

/* ── FAQ ── */
.faq { margin: 40px 0; }
.faq h2 { font-family: var(--font-display); font-size: 20px; margin-bottom: 16px; }
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  background: var(--ink-700); border: 1px solid var(--ink-600);
  border-radius: var(--radius-sm); overflow: hidden;
}
.faq-item summary {
  cursor: pointer; font-family: var(--font-display); font-weight: 600;
  font-size: 15px; color: var(--text-onDark); padding: 14px 16px;
  list-style: none; display: flex; align-items: center; justify-content: space-between;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; font-size: 20px; color: var(--brass); transition: transform var(--transition);
}
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 16px 14px; font-size: 14px; color: var(--text-onDark-dim); line-height: 1.7; }

/* ── Related links ── */
.related { margin: 32px 0; }
.related h3 { font-family: var(--font-display); font-size: 16px; margin-bottom: 12px; }
.related ul {
  list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px;
}
.related a {
  display: block; padding: 10px 14px; font-size: 13px;
  background: var(--ink-700); border: 1px solid var(--ink-600);
  border-radius: var(--radius-sm); color: var(--text-onDark-dim);
  transition: all var(--transition);
}
.related a:hover { border-color: var(--brass); color: var(--brass-bright); text-decoration: none; }
.hub-link {
  font-family: var(--font-mono); font-size: 13px;
  display: inline-block; margin-top: 12px;
}

/* ── Popular conversions ── */
.popular { margin: 40px 0; }
.popular h2 { font-family: var(--font-display); font-size: 20px; margin-bottom: 16px; }
.popular-list {
  list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px;
}
.popular-list a {
  display: block; padding: 12px 16px;
  background: var(--ink-700); border: 1px solid var(--ink-600);
  border-radius: var(--radius-sm); font-size: 14px;
  color: var(--text-onDark-dim); transition: all var(--transition);
}
.popular-list a:hover { border-color: var(--brass); color: var(--brass-bright); text-decoration: none; }

/* ── Ad slot ── */
.ad-slot {
  margin: 24px 0; padding: 16px;
  border: 1px dashed var(--ink-600); border-radius: var(--radius-sm);
  min-height: 100px; display: flex; align-items: center; justify-content: center;
  color: var(--text-onDark-muted); font-family: var(--font-mono); font-size: 11px;
}
.ad-label { text-transform: uppercase; letter-spacing: 0.1em; }

/* ── Footer ── */
.site-footer { margin-top: 64px; background: var(--ink-900); border-top: 1px solid var(--ink-600); padding-top: 32px; }
.footer-row {
  display: flex; justify-content: space-between; gap: 32px;
  flex-wrap: wrap; padding: 16px 24px 24px;
}
.footer-tagline { max-width: 320px; font-size: 14px; color: var(--text-onDark-dim); margin-top: 8px; }
.footer-cols ul { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.footer-cols a { font-size: 14px; color: var(--text-onDark-dim); }
.footer-cols a:hover { color: var(--brass-bright); }
.footer-copy {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-onDark-muted); padding: 16px 24px;
  border-top: 1px solid var(--ink-600);
}

/* ── Units list on category page ── */
.units-list { margin: 40px 0 64px; max-width: 420px; }
.units-list h3 { font-family: var(--font-display); font-size: 16px; margin-bottom: 12px; }
.units-list ul { list-style: none; padding: 0; }
.units-list li {
  padding: 8px 0; border-bottom: 1px solid var(--ink-600);
  font-size: 14px; color: var(--text-onDark-dim);
}
.units-list li span { color: var(--brass-bright); font-family: var(--font-mono); }

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.4s ease forwards; }

/* ── Print ── */
@media print {
  .site-header, .site-footer, .ad-slot, .search-wrap, .swap-btn, .copy-btn { display: none; }
  body { background: white; color: black; }
  .converter { border: 1px solid #ccc; }
}
