/* ===== Tools / Calculators (extends style.css) ===== */
/* Uses the same design tokens defined in style.css */

.tool-hero {
  background: linear-gradient(135deg, var(--green-50) 0%, var(--cream) 100%);
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
}
.tool-hero .breadcrumb {
  max-width: 900px;
  text-align: left;
  margin: 0 auto 1.5rem;
  padding: 0;
}
.tool-hero h1 { font-size: 2.4rem; margin-bottom: 0.75rem; }
.tool-hero p { font-size: 1.1rem; color: var(--gray-500); max-width: 640px; margin: 0 auto; }

.tool-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Intro / lead under hero */
.tool-intro {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-left: 4px solid var(--green-600);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.98rem;
  color: var(--gray-700);
}

/* Two-column calc layout: inputs + sticky results */
.calc-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 820px) {
  .calc-layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.panel h2 { font-size: 1.3rem; margin: 0 0 1.25rem; }
.panel h3 { font-size: 1.05rem; margin: 1.5rem 0 0.75rem; color: var(--green-700); }

/* Form fields */
.field { margin-bottom: 1.15rem; }
.field > label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  color: var(--gray-900);
}
.field .hint { font-size: 0.82rem; color: var(--gray-500); margin-top: 0.3rem; }
.field input[type="number"],
.field select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-sans);
  background: var(--warm-white);
  color: var(--gray-900);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input[type="number"]:focus,
.field select:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100);
}
.field-row { display: flex; gap: 0.85rem; }
.field-row .field { flex: 1; }

/* Segmented control (unit toggle / sex / diet) */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: var(--gray-100);
  padding: 0.3rem;
  border-radius: var(--radius-md);
}
.seg button {
  border: none;
  background: transparent;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.18s;
  font-family: var(--font-sans);
}
.seg button:hover { color: var(--green-700); }
.seg button.active {
  background: var(--white);
  color: var(--green-700);
  box-shadow: var(--shadow-sm);
}
.seg.full { display: flex; }
.seg.full button { flex: 1; text-align: center; }

/* Range / slider */
.field input[type="range"] {
  width: 100%;
  accent-color: var(--green-600);
}
.range-head { display: flex; justify-content: space-between; align-items: baseline; }
.range-head .range-val {
  font-weight: 700;
  color: var(--green-700);
  font-size: 1.1rem;
}

/* Results panel */
.results { position: sticky; top: 90px; }
@media (max-width: 820px) { .results { position: static; } }

.result-card {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}
.result-card .headline-label {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.8rem;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}
.result-card .headline-value {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.1;
  font-family: var(--font-serif);
}
.result-card .headline-unit { font-size: 1.1rem; font-weight: 600; opacity: 0.9; }
.result-card .headline-sub { margin-top: 0.5rem; font-size: 0.92rem; opacity: 0.9; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.stat {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.stat .s-val { font-size: 1.35rem; font-weight: 700; }
.stat .s-lab { font-size: 0.78rem; opacity: 0.85; }

/* Goal chips */
.goal-chips { display: flex; flex-direction: column; gap: 0.5rem; }
.goal-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.95rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.18s;
  background: var(--white);
}
.goal-chip:hover { border-color: var(--green-500); }
.goal-chip.active {
  border-color: var(--green-600);
  background: var(--green-50);
}
.goal-chip .gc-title { font-weight: 600; color: var(--gray-900); }
.goal-chip .gc-desc { font-size: 0.82rem; color: var(--gray-500); }
.goal-chip .gc-cal { font-weight: 700; color: var(--green-700); white-space: nowrap; }

/* Macro visual bar */
.macro-bar {
  display: flex;
  height: 26px;
  border-radius: 50px;
  overflow: hidden;
  margin: 1rem 0 0.5rem;
  box-shadow: var(--shadow-sm);
}
.macro-bar span { display: block; height: 100%; }
.macro-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.88rem; }
.macro-legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 0.4rem; }
.macro-legend b { color: var(--gray-900); }

/* Meat of result rows */
.result-rows { margin-top: 1rem; }
.result-row {
  display: flex;
  justify-content: space-between;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.result-row:last-child { border-bottom: none; }
.result-row .rr-label { color: var(--gray-700); }
.result-row .rr-val { font-weight: 700; color: var(--gray-900); }

/* Action buttons under results */
.tool-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }

/* Tool promo box (injected into blog posts) */
.tool-promo {
  background: linear-gradient(135deg, var(--green-50), var(--cream));
  border: 1px solid var(--green-100);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin: 2.5rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
}
.tool-promo .tp-icon { font-size: 2.4rem; line-height: 1; }
.tool-promo .tp-body { flex: 1; min-width: 220px; }
.tool-promo h3 { margin: 0 0 0.35rem; font-size: 1.2rem; color: var(--green-700); }
.tool-promo p { margin: 0 0 0.75rem; font-size: 0.95rem; color: var(--gray-700); }
.tool-promo .tp-links { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.tool-promo .tp-links a {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green-700);
  background: var(--white);
  border: 1.5px solid var(--green-100);
  padding: 0.45rem 0.9rem;
  border-radius: 50px;
  text-decoration: none;
  transition: all 0.18s;
}
.tool-promo .tp-links a:hover { background: var(--green-600); color: var(--white); border-color: var(--green-600); }

/* Hub cards */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1rem 0 2.5rem;
}
.hub-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}
.hub-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.hub-card .hc-icon { font-size: 2.2rem; margin-bottom: 0.5rem; }
.hub-card h3 { margin: 0.25rem 0 0.5rem; font-size: 1.25rem; }
.hub-card p { font-size: 0.92rem; color: var(--gray-500); flex: 1; }
.hub-card .hc-link {
  margin-top: 1rem;
  font-weight: 600;
  color: var(--green-700);
  text-decoration: none;
}
.hub-card .hc-link:hover { color: var(--green-500); }

/* Grocery list */
.grocery-cats { margin-top: 1.5rem; }
.grocery-cat { margin-bottom: 1.5rem; }
.grocery-cat h3 {
  font-size: 1.05rem;
  color: var(--green-700);
  border-bottom: 2px solid var(--green-100);
  padding-bottom: 0.4rem;
  margin: 0 0 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.grocery-list { list-style: none; padding: 0; margin: 0; }
.grocery-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px dashed var(--gray-100);
  font-size: 0.95rem;
}
.grocery-list li .gi-qty { font-weight: 700; color: var(--gray-900); white-space: nowrap; margin-left: 1rem; }
.grocery-list li .gi-name { color: var(--gray-700); }

.empty-state {
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  color: var(--gray-500);
  font-size: 0.95rem;
}

/* Embed / backlink box */
.embed-box { margin-top: 2rem; }
.embed-box h3 { font-size: 1.05rem; color: var(--green-700); margin-bottom: 0.5rem; }
.embed-box p { font-size: 0.9rem; color: var(--gray-500); margin-bottom: 0.75rem; }
.embed-box textarea {
  width: 100%;
  min-height: 90px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--warm-white);
  color: var(--gray-700);
  resize: vertical;
}

.copy-btn {
  margin-top: 0.5rem;
  background: var(--green-700);
  color: var(--white);
  border: none;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}
.copy-btn:hover { background: var(--green-500); }
.copy-btn.copied { background: var(--accent); }

.disclaimer-tool {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
}

/* Explanatory content section (SEO / user education, below the tool) */
.tool-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem 3.5rem;
  color: var(--gray-700);
}
.tool-content > h2 {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  color: var(--green-700);
  margin: 2.75rem 0 1rem;
  line-height: 1.25;
}
.tool-content > h3 {
  font-size: 1.18rem;
  color: var(--gray-900);
  margin: 1.75rem 0 0.6rem;
}
.tool-content p {
  font-size: 1.02rem;
  line-height: 1.72;
  margin: 0 0 1rem;
}
.tool-content a {
  color: var(--green-700);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tool-content a:hover { color: var(--green-500); }
.tool-content ul, .tool-content ol { margin: 0 0 1.15rem; padding-left: 1.4rem; }
.tool-content li { line-height: 1.7; margin-bottom: 0.45rem; font-size: 1.02rem; }
.tool-content strong { color: var(--gray-900); }

/* Formula / callout box */
.formula-box {
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-left: 4px solid var(--green-600);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  margin: 0 0 1.25rem;
  font-size: 0.98rem;
  color: var(--gray-700);
}
.formula-box .fb-label {
  font-weight: 700;
  color: var(--green-700);
  display: block;
  margin-bottom: 0.25rem;
}
.formula-box code {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  background: var(--white);
  border: 1px solid var(--green-100);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  margin-top: 0.5rem;
  color: var(--gray-900);
}

/* Deficit reference table */
.deficit-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}
.deficit-table th, .deficit-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
}
.deficit-table th {
  background: var(--green-50);
  color: var(--green-700);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.deficit-table td { color: var(--gray-700); }
.deficit-table td:first-child { font-weight: 600; color: var(--gray-900); }
.deficit-table tr.total-row td {
  border-top: 2px solid var(--green-600);
  border-bottom: none;
  background: var(--green-50);
  color: var(--green-700);
  font-weight: 700;
}

/* FAQ on hub */
.faq-grid { margin-top: 1rem; }
.faq-item {
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  margin-bottom: 0.85rem;
  background: var(--white);
}
.faq-item h3 { margin: 0 0 0.35rem; font-size: 1.02rem; color: var(--green-700); }
.faq-item p { margin: 0; font-size: 0.92rem; color: var(--gray-700); }

/* Print grocery list */
@media print {
  .site-header, .site-footer, .tool-hero, .panel:first-child,
  .tool-actions, .embed-box, .disclaimer-tool, .breadcrumb,
  .tool-content { display: none !important; }
  .calc-layout { display: block; }
  .panel { box-shadow: none; border: none; padding: 0; }
  .grocery-cat h3 { color: #000; }
}
