/* =========================================================
   Shared styles for individual tool pages.
   Load after styles.css.
   ========================================================= */

.breadcrumbs {
  font-size: 0.88rem;
  color: var(--muted);
  padding: 20px 0 0;
}
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; opacity: 0.6; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--text); }

.tool-header { padding: 12px 0 20px; }
.tool-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 8px;
}
.tool-header p { margin: 0; color: var(--muted); font-size: 1.05rem; max-width: 680px; }

/* ---------- Layout: inputs | results ---------- */
.tool-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 20px;
  align-items: start;
}
.tool-layout > * { min-width: 0; }
@media (max-width: 860px) {
  .tool-layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.panel + .panel { margin-top: 20px; }
.panel h2 { font-size: 1.05rem; margin: 0 0 14px; }

/* ---------- Form fields ---------- */
.field { margin-bottom: 14px; }
.field label, .field .label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.field .hint { font-weight: 400; color: var(--muted); }

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input-wrap .affix {
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  background: var(--surface-2);
  align-self: stretch;
  display: grid;
  place-items: center;
}
.input-wrap input, .input-wrap select {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 0;
  padding: 0 12px;
  font: inherit;
  font-size: max(16px, 1rem);   /* 16px or more: iPhones zoom in on smaller fields */
  color: var(--text);
  background: transparent;
}
.input-wrap input:focus, .input-wrap select:focus { outline: none; }
.input-wrap select { cursor: pointer; }

.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.field-row > * { min-width: 0; }
.field-row > .field { display: flex; flex-direction: column; }
.field-row > .field > .input-wrap { margin-top: auto; }

.field-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  margin: 4px 0 14px;
  cursor: pointer;
}
.field-check input { width: 16px; height: 16px; accent-color: var(--accent); }

details.more-options {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 12px;
}
details.more-options summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent);
  margin-bottom: 12px;
  list-style: none;
}
details.more-options summary::-webkit-details-marker { display: none; }
details.more-options summary::before { content: "+ "; }
details.more-options[open] summary::before { content: "− "; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }

/* ---------- Results ---------- */
.result-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}
@media (max-width: 520px) {
  .result-hero .result-big + .result-big { padding-left: 0 !important; border-left: 0 !important; }
}
.result-big .label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.result-big .value {
  font-size: clamp(2.2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.result-big .sub { color: var(--muted); font-size: 0.9rem; }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-left: auto; }
.donut { width: 140px; height: 140px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.88rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .amt { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; font-weight: 600; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.stat {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 14px;
}
.stat .label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .value.good { color: var(--good, #16a34a); }

.callout {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 0.92rem;
}
.callout strong { color: var(--accent); }

/* ---------- Chart ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .gridline { stroke: var(--border); stroke-width: 1; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

/* ---------- Tabs / segmented ---------- */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  font: inherit;
  font-size: 0.85rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }

/* ---------- Table ---------- */
.table-scroll { overflow: auto; max-height: 480px; border: 1px solid var(--border); border-radius: 12px; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td { padding: 9px 12px; text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
table.data tbody tr + tr td { border-top: 1px solid var(--border); }

/* Side-by-side comparison table: let text wrap so it fits narrow panels */
table.data.compare th, table.data.compare td { white-space: normal; padding: 9px 10px; }
table.data.compare td:first-child { color: var(--muted); }
table.data.compare th:not(:first-child), table.data.compare td:not(:first-child) { width: 32%; }
table.data.compare tr:last-child td { font-weight: 700; color: var(--text); }

/* ---------- Article content (SEO text) ---------- */
.content {
  max-width: 760px;
  margin: 40px auto 0;
}
.content h2 { font-size: 1.45rem; letter-spacing: -0.01em; margin: 36px 0 10px; }
.content h3 { font-size: 1.1rem; margin: 24px 0 8px; }
.content p, .content li { color: var(--text); }
.content ul, .content ol { padding-left: 22px; }
.content li { margin: 6px 0; }
.formula {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.95rem;
}
.faq details {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
}
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 2px; }

.related { margin-top: 40px; }
.related h2 { font-size: 1.2rem; margin: 0 0 14px; }

.disclaimer { color: var(--muted); font-size: 0.82rem; margin-top: 24px; }

.ad-slot--rect { min-height: 250px; max-width: 336px; }

/* Wide tables in article text scroll sideways on phones instead of widening the page */
.fn-table-wrap { overflow-x: auto; }
