/* <style> */
/* ============================================================
   DESIGN DIRECTION: Refined Luxury Editorial
   - Warm cream/ivory background with deep charcoal text
   - Gold accent system (primary actions, highlights)
   - Playfair Display for headings (jeweller's register)
   - Clean grid, generous whitespace, subtle shadows
   - Category icons with colored dot accents
============================================================ */

:root {
  --gold:        #b8860b;
  --gold-mid:    #d4a017;
  --gold-light:  #f0c040;
  --gold-pale:   #fdf6e3;
  --gold-border: #e8d5a0;
  --cream:       #faf8f3;
  --ivory:       #f5f0e8;
  --warm-white:  #fffef9;
  --charcoal:    #1c1917;
  --ink:         #292524;
  --muted:       #78716c;
  --dim:         #a8a29e;
  --border:      #e7e2d8;
  --border-dark: #d6ceba;
  --card-bg:     #ffffff;
  --input-bg:    #fefcf8;
  --silver:      #8b8b8b;
  --silver-light:#c0c0c0;
  --copper:      #b87333;
  --green:       #4a7c59;
  --blue:        #2563a8;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.06), 0 2px 12px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 20px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.05);
  --shadow-gold: 0 4px 20px rgba(184,134,11,0.15);
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
}

/* Subtle background texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(184,134,11,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 100% 100%, rgba(184,134,11,0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* ── TOOL LAYOUT (matching OurToolsHub pattern) ── */
.tool-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 28px;
  align-items: start;
  padding-top: 32px;
}

@media (max-width: 860px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-sidebar { order: -1; }
}

/* ── HEADER ── */
.tool-header {
  margin-bottom: 28px;
}

.tool-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 700;
  color: var(--charcoal);
  line-height: 1.2;
  margin-bottom: 10px;
}

.tool-header h1 span {
  background: linear-gradient(135deg, var(--gold), var(--gold-mid));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tool-header p {
  color: var(--muted);
  font-size: 14px;
  max-width: 600px;
  line-height: 1.7;
}

/* ── CATEGORY TABS ── */
.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.cat-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 50px;
  border: 1.5px solid var(--border-dark);
  background: var(--card-bg);
  color: var(--muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.cat-tab:hover {
  border-color: var(--gold-mid);
  color: var(--gold);
  transform: translateY(-1px);
}

.cat-tab.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-mid));
  border-color: var(--gold);
  color: #fff;
  box-shadow: var(--shadow-gold);
}

.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-gold   { background: var(--gold-light); }
.dot-silver { background: var(--silver-light); }
.dot-weight { background: #6ea8fe; }
.dot-grain  { background: #82ca9d; }
.dot-liquid { background: #5bc0de; }
.dot-temp   { background: #ff7675; }
.dot-speed  { background: #a29bfe; }
.dot-fuel   { background: #fd79a8; }

.cat-tab.active .cat-dot { background: rgba(255,255,255,0.8); }

/* ── CALCULATOR CARD ── */
.calc-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.calc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.calc-card-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  gap: 10px;
}

.h2-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.icon-gold   { background: #fef9c3; }
.icon-silver { background: #f1f5f9; }
.icon-weight { background: #eff6ff; }
.icon-grain  { background: #f0fdf4; }
.icon-liquid { background: #ecfeff; }
.icon-temp   { background: #fff1f2; }
.icon-speed  { background: #f5f3ff; }
.icon-fuel   { background: #fdf4ff; }

/* ── CONVERTER ROWS ── */
.conv-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

@media (max-width: 560px) {
  .conv-grid {
    grid-template-columns: 1fr;
  }
  .swap-col { display: flex; justify-content: center; }
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.field-group input,
.field-group select {
  background: var(--input-bg);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  color: var(--charcoal);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.field-group input:focus,
.field-group select:focus {
  border-color: var(--gold-mid);
  box-shadow: 0 0 0 3px rgba(184,134,11,0.1);
}

.field-group input[readonly] {
  background: var(--gold-pale);
  border-color: var(--gold-border);
  color: var(--gold);
  font-family: 'DM Mono', monospace;
  cursor: default;
}

.field-group select {
  font-size: 13px;
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2378716c' 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;
}

.select-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

@media (max-width: 560px) {
  .select-row { grid-template-columns: 1fr; }
}

/* ── SWAP BUTTON ── */
.swap-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-border);
  background: var(--gold-pale);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: 16px;
}

.swap-btn:hover {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
  transform: rotate(180deg);
}

/* ── RESULT BAR ── */
.result-bar {
  background: linear-gradient(135deg, var(--charcoal) 0%, #292524 100%);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  color: #fff;
  display: none;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}

.result-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
}

.result-bar.show { display: block; animation: fadeUp 0.25s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-main {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 500;
  color: var(--gold-light);
  margin-bottom: 4px;
}

.result-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.result-copy-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.result-copy-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
.result-copy-btn.copied { background: #16a34a; color: #fff; border-color: #16a34a; }

/* ── BREAKDOWN GRID ── */
.breakdown-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: none;
}
.breakdown-section.show { display: block; }
.breakdown-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--dim);
  margin-bottom: 12px;
}
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.bd-item {
  background: var(--ivory);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: all 0.15s;
}
.bd-item:hover { background: var(--gold-pale); border-color: var(--gold-mid); }
.bd-unit { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gold); margin-bottom: 3px; }
.bd-val  { font-family: 'DM Mono', monospace; font-size: 15px; font-weight: 500; color: var(--charcoal); word-break: break-all; }

/* ── REFERENCE TABLE ── */
.ref-table-wrap { overflow-x: auto; margin-top: 8px; }
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ref-table th {
  background: var(--gold-pale);
  color: var(--gold);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--gold-border);
  white-space: nowrap;
}
.ref-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  vertical-align: top;
}
.ref-table tr:last-child td { border-bottom: none; }
.ref-table tr:hover td { background: var(--ivory); }
.ref-table td:first-child { font-weight: 600; color: var(--charcoal); }
.ref-table .section-head td {
  background: var(--ivory);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 7px 14px;
}
.ref-table .section-head:hover td { background: var(--ivory) !important; }

/* ── SIDEBAR ── */
.tool-sidebar { display: flex; flex-direction: column; gap: 16px; }

.sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.sidebar-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-card ul li a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-card ul li a::before {
  content: '→';
  color: var(--gold-mid);
  font-weight: 700;
  font-size: 12px;
}

.sidebar-card ul li a:hover { color: var(--gold); }

/* Quick fact card */
.fact-card {
  background: linear-gradient(135deg, var(--charcoal), #1c1917);
  border-radius: var(--radius);
  padding: 20px;
  color: #fff;
}

.fact-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  color: var(--gold-light);
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 10px;
}

.fact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
}
.fact-row:last-child { border-bottom: none; }
.fact-label { color: rgba(255,255,255,0.5); }
.fact-val { font-family: 'DM Mono', monospace; color: var(--gold-light); font-weight: 500; }

/* ── SEO CONTENT ── */
.content-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
}
.content-section h2 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--charcoal);
  margin: 24px 0 10px;
}
.content-section h2:first-child { margin-top: 0; }
.content-section p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
  margin-bottom: 10px;
}
.content-section ul {
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 2;
}
.content-section ul li::before { content: '• '; color: var(--gold); font-weight: 700; }
.formula-box {
  background: var(--gold-pale);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--gold);
  margin: 12px 0;
}

/* ── PANEL SYSTEM ── */
.cat-panel { display: none; }
.cat-panel.active { display: block; }

/* Utility */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .two-col { grid-template-columns: 1fr; } }
/* </style> */