/* ===================================
   Tool Page — extends style.css
   =================================== */

.tool-page-header {
  padding: 40px 0 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--slate-400);
  margin-bottom: 28px;
}
.breadcrumb a { color: var(--slate-500); transition: color .15s ease; }
.breadcrumb a:hover { color: var(--navy-900); }
.breadcrumb .sep { color: var(--slate-200); }
.breadcrumb .current { color: var(--navy-900); font-weight: 500; }

.tool-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 36px;
}
.tool-hero-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.tool-hero h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: -.01em;
  margin-bottom: 6px;
}
.tool-hero p { color: var(--slate-500); font-size: 15.5px; max-width: 560px; line-height: 1.55; }

/* ===== Main tool layout: calculator + sidebar ===== */
.tool-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.85fr;
  gap: 28px;
  padding-bottom: 72px;
  align-items: start;
}

.tool-panel {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-sm);
}

.tool-panel-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
  background: var(--cream-100);
  padding: 5px;
  border-radius: 11px;
}
.tool-panel-tab {
  flex: 1;
  text-align: center;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--slate-500);
  padding: 9px 0;
  border-radius: 8px;
  transition: all .15s ease;
}
.tool-panel-tab.active { background: var(--navy-900); color: var(--white); }

.input-group { margin-bottom: 20px; }
.input-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--navy-900);
  margin-bottom: 8px;
}
.input-group .hint { color: var(--slate-400); font-weight: 400; font-size: 12.5px; }

.input-control {
  position: relative;
}
.input-control input,
.input-control select {
  width: 100%;
  height: 52px;
  border: 1.5px solid var(--slate-200);
  border-radius: 11px;
  padding: 0 16px;
  font-size: 16px;
  font-family: var(--font-mono);
  color: var(--navy-900);
  background: var(--white);
  transition: border-color .15s ease;
}
.input-control select { font-family: var(--font-body); appearance: none; padding-right: 40px; }
.input-control input:focus, .input-control select:focus { border-color: var(--amber-500); }
.input-control input::placeholder { color: var(--slate-400); font-family: var(--font-body); }

.input-control .unit-suffix {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 13.5px;
  color: var(--slate-400);
  font-weight: 500;
  pointer-events: none;
}
.input-control .select-chevron {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--slate-400);
}

.input-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.unit-toggle {
  display: inline-flex;
  background: var(--cream-100);
  border-radius: 9px;
  padding: 4px;
  margin-bottom: 18px;
}
.unit-toggle button {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-500);
  padding: 7px 16px;
  border-radius: 6px;
  transition: all .15s ease;
}
.unit-toggle button.active { background: var(--white); color: var(--navy-900); box-shadow: var(--shadow-sm); }

.btn-calculate {
  width: 100%;
  height: 54px;
  background: var(--navy-900);
  color: var(--white);
  font-size: 15.5px;
  font-weight: 600;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s ease;
  margin-top: 8px;
}
.btn-calculate:hover { background: var(--navy-700); }

/* ===== Result card ===== */
.result-card {
  margin-top: 28px;
  padding: 26px;
  background: var(--navy-900);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.result-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(245,158,11,0.12), transparent 60%);
  pointer-events: none;
}
.result-label {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--amber-400);
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}
.result-value {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 600;
  color: var(--white);
  line-height: 1.1;
  position: relative;
  z-index: 1;
}
.result-sub {
  font-size: 14px;
  color: var(--slate-400);
  margin-top: 6px;
  position: relative;
  z-index: 1;
}
.result-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,0.1);
  position: relative;
  z-index: 1;
}
.result-breakdown-item .num {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--white);
}
.result-breakdown-item .lbl {
  font-size: 11.5px;
  color: var(--slate-400);
  margin-top: 2px;
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.btn-ghost-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-500);
  background: var(--white);
  border: 1.5px solid var(--slate-200);
  padding: 9px 16px;
  border-radius: 9px;
  transition: all .15s ease;
}
.btn-ghost-sm:hover { border-color: var(--navy-900); color: var(--navy-900); }

/* ===== BMI gauge ===== */
.bmi-gauge {
  margin-top: 22px;
  position: relative;
  z-index: 1;
}
.bmi-gauge-track {
  display: flex;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}
.bmi-gauge-track span { flex: 1; }
.bmi-gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--slate-400);
}
.bmi-marker {
  position: relative;
  height: 0;
}
.bmi-marker-dot {
  position: absolute;
  top: -22px;
  width: 2px;
  height: 18px;
  background: var(--white);
  transition: left .3s ease;
}

/* ===== Sidebar ===== */
.tool-sidebar { display: flex; flex-direction: column; gap: 20px; }

.sidebar-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 22px;
}
.sidebar-card h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 14px;
}
.sidebar-card p { font-size: 13.5px; color: var(--slate-500); line-height: 1.6; }

.related-tool-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--slate-200);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--navy-900);
}
.related-tool-link:last-child { border-bottom: none; }
.related-tool-link .icon-sq {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.faq-item { border-bottom: 1px solid var(--slate-200); padding: 14px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-q { font-size: 14px; font-weight: 500; color: var(--navy-900); margin-bottom: 6px; }
.faq-a { font-size: 13.5px; color: var(--slate-500); line-height: 1.6; }

/* ===== Explainer section (below tool) ===== */
.explainer-section {
  padding: 0 0 88px;
}
.explainer-section .container { max-width: 760px; }
.explainer-section h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--navy-900);
  margin: 32px 0 14px;
}
.explainer-section h2:first-child { margin-top: 0; }
.explainer-section p {
  font-size: 15px;
  color: var(--slate-500);
  line-height: 1.7;
  margin-bottom: 14px;
}

@media (max-width: 980px) {
  .tool-layout { grid-template-columns: 1fr; }
  .input-row-2, .input-row-3 { grid-template-columns: 1fr; }
  .result-breakdown { grid-template-columns: 1fr 1fr; }
  .tool-panel { padding: 24px; }
}

@media (max-width: 600px) {
  .tool-hero h1 { font-size: 25px; }
  .result-value { font-size: 32px; }
}

/* ===================================
   AD SLOTS — left/right rail + in-content
   =================================== */

/* Page wrapper becomes a 3-column layout when ads are present */
.page-with-ads {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  gap: 20px;
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 16px;
}

.ad-rail {
  position: sticky;
  top: 88px;
  height: fit-content;
  display: none; /* hidden until an ad actually loads, see below */
}

.ad-slot {
  background: var(--cream-100);
  border: 1px dashed var(--slate-200);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-400);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  overflow: hidden;
}

/* Standard sizes */
.ad-slot--rail { width: 160px; height: 600px; margin-bottom: 20px; }
.ad-slot--inline { width: 100%; height: 100px; margin: 32px 0; }
.ad-slot--leaderboard { width: 100%; max-width: 728px; height: 90px; margin: 0 auto 28px; }

/* Show the rail only once ads.js confirms a slot has filled, OR always show
   the placeholder in dev. Toggle this class via JS in production. */
.ads-enabled .ad-rail { display: block; }

@media (max-width: 1300px) {
  .page-with-ads { grid-template-columns: 1fr; }
  .ad-rail { display: none !important; }
}
