@charset "utf-8";
/* ==========================================================================
   ToolsHub4u — Family sheet: CALCULATORS (26 pages)
   Hue: --cat-calculators (saffron). Ground, chrome and result types come from
   tools.css; this sheet only owns the calculator internals those sheets leave
   alone — the result readout furniture, bars/donuts/scale charts, sliders,
   segmented keys, the rows editor and the empty/warning states.
   Tokens only. No hard-coded colour, no hard shadows, no gradient text.
   ========================================================================== */

/* ---------- 1. Local handles ---------------------------------------------- */
.wb {
  --fam: var(--cat-calculators);
  --fam-soft: color-mix(in srgb, var(--fam) 14%, transparent);
  --fam-line: color-mix(in srgb, var(--fam) 42%, transparent);
  --lab-t: 0.6875rem;
  --lab-ls: 0.1em;
}

/* ---------- 2. Result value: unit suffix ---------------------------------- */
.res-value small {
  font-family: var(--font-text);
  font-size: 0.34em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-300);
  margin-left: 0.4em;
  white-space: nowrap;
}

/* ---------- 3. Status line: a 5px lamp, then the message ------------------ */
.res-status { align-items: baseline; line-height: 1.5; }
.res-status::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  margin-top: 0.45em;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.75;
}
.res-status[data-tone="good"],
.res-status[data-tone="ok"] { color: var(--phosphor-text); }
.res-status[data-tone="warn"] { color: var(--cat-calculators); }
.res-status[data-tone="bad"],
.res-status[data-tone="error"] { color: var(--cat-pdf); }
.res-status[data-tone="neutral"] { color: var(--text-200); }

/* ---------- 4. Inline code inside notes and step lists -------------------- */
.res-note code,
.res-steps code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xs);
  background: var(--ink-800);
  color: var(--text-100);
  overflow-wrap: anywhere;
}

/* ---------- 5. Proportional bars: hairline rows, no nested cards ---------- */
.res-bars {
  display: grid;
  gap: 2px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line-1);
}
.res-bars__title,
.res-chart__title {
  font-family: var(--font-mono);
  font-size: var(--lab-t);
  font-weight: 550;
  letter-spacing: var(--lab-ls);
  text-transform: uppercase;
  color: var(--text-300);
  margin-bottom: 6px;
}
.res-bar {
  display: grid;
  grid-template-columns: minmax(64px, 32%) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 26px;
}
.res-bar__label {
  font-size: 0.8125rem;
  color: var(--text-200);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.res-bar__track {
  position: relative;
  height: 6px;
  border-radius: 2px;
  background: var(--ink-500);
  box-shadow: inset 0 0 0 1px var(--line-1);
  overflow: hidden;
}
.res-bar__fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--bar-color, var(--fam));
  transition: width 420ms var(--ease-out);
}
.res-bar__marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: var(--text-300);
}
.res-bar__value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-100);
  min-width: 4.5ch;
  text-align: right;
}

/* ---------- 6. Threshold scale: a horizontal gauge ------------------------ */
.res-scale { margin-top: 18px; }
.res-scale__bar {
  position: relative;
  height: 10px;
  margin: 22px 0 12px;
  border-radius: 2px;
  overflow: visible;
}
.res-scale__seg {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--seg);
  opacity: 0.5;
}
.res-scale__seg:first-child { border-radius: 2px 0 0 2px; }
.res-scale__seg:last-of-type { border-radius: 0 2px 2px 0; }
.res-scale__marker {
  position: absolute;
  top: -14px;
  bottom: -6px;
  width: 1px;
  background: var(--text-100);
  transform: translateX(-0.5px);
}
.res-scale__marker b {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: var(--lab-t);
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  color: var(--text-100);
  white-space: nowrap;
}
.res-scale__legend,
.res-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.res-scale__legend li,
.res-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  color: var(--text-300);
}
.res-scale__seg { --seg-color: var(--seg); }
.res-scale__legend .swatch,
.res-legend .swatch {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 1px;
  background: var(--swatch-color, var(--swatch, var(--fam)));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-100) 20%, transparent);
}

/* ---------- 7. Donut: currentColor-driven, hairline-separated ------------ */
.res-chart {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  margin-top: 18px;
}
.res-donut {
  position: relative;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: var(--donut);
}
.res-donut::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: var(--ink-700);
  box-shadow: 0 0 0 1px var(--line-2);
}
.res-donut__center {
  position: absolute;
  inset: 22px;
  z-index: 1;
  display: grid;
  place-content: center;
  gap: 2px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--text-300);
}
.res-donut__center strong {
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text-100);
}
.res-legend { flex-direction: column; gap: 7px; }
.res-legend li { justify-content: flex-start; width: 100%; }
.res-legend b {
  margin-left: auto;
  padding-left: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-100);
}

/* ---------- 8. Working steps: a mono-numbered list ----------------------- */
.res-steps {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-1);
}
.res-steps ol { display: grid; gap: 5px; margin-top: 6px; }
.res-steps li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 4px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-200);
}
.res-steps li span:first-child {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-300);
  padding-top: 0.15em;
}

/* ---------- 9. Collapsed table: the "show all rows" disclosure ----------- */
.res-more { margin-top: 8px; }
.res-more > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  font-family: var(--font-mono);
  font-size: var(--lab-t);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-300);
  list-style: none;
  cursor: pointer;
  transition: color 140ms;
}
.res-more > summary::before {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
  transition: transform 200ms var(--ease-out);
}
.res-more > summary:hover { color: var(--text-100); }
.res-more[open] > summary { margin-bottom: 4px; }
.res-more[open] > summary::before { transform: rotate(45deg) translateY(-1px); }

/* ---------- 10. Empty, async and warning states -------------------------- */
.res-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 92px;
  padding: 18px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background-image: linear-gradient(to right, var(--line-1) 1px, transparent 1px);
  background-size: 22px 100%;
  background-position: 0 100%;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-300);
}
.res-empty::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid var(--text-400);
}
.res-async {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px;
  font-family: var(--font-mono);
  font-size: var(--lab-t);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-300);
}
.res-async::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--line-3);
  border-top-color: var(--phosphor-text);
  animation: fam-spin 780ms linear infinite;
}
@keyframes fam-spin { to { transform: rotate(360deg); } }
.calc-out.is-updating { opacity: 0.55; transition: opacity 160ms; }

.res-warning {
  display: grid;
  grid-template-columns: 3px minmax(0, 1fr);
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px 12px 0;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--fam) 7%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fam) 22%, transparent);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-200);
}
.res-warning::before {
  content: "";
  grid-row: 1;
  width: 3px;
  height: 100%;
  border-radius: 0 2px 2px 0;
  background: var(--fam);
}

/* ---------- 11. Range slider: a real instrument fader -------------------- */
.wb-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  align-items: center;
  gap: 14px;
}
.wb-range input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --pct: 50%;
}
.wb-range input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background:
    linear-gradient(to right, var(--fam) 0 var(--pct), var(--ink-400) var(--pct) 100%);
}
.wb-range input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--ink-400);
}
.wb-range input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--fam);
}
.wb-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--ink-700);
  border: 2px solid var(--fam);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 140ms var(--ease-out), border-color 140ms;
}
.wb-range input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-700);
  border: 2px solid var(--fam);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.wb-range input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.12); border-color: var(--text-100); }
.wb-range input[type="range"]:active::-webkit-slider-thumb { transform: scale(0.96); }
.wb-range input[type="range"]:hover::-moz-range-thumb { border-color: var(--text-100); }
.wb-range input[type="range"]:focus-visible { outline: none; }
.wb-range input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.wb-range input[type="range"]:focus-visible::-moz-range-thumb {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.wb-range .wb-input-wrap input { text-align: right; font-family: var(--font-mono); }

/* ---------- 12. Rows editor (GPA and friends): a hairline ledger --------- */
.wb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}
.wb-table th {
  padding: 0 6px 8px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: var(--lab-t);
  font-weight: 550;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-300);
  text-align: left;
  white-space: nowrap;
}
.wb-table td { padding: 5px 6px; vertical-align: middle; }
.wb-table td:first-child { padding-left: 0; }
.wb-table td:last-child { width: 40px; padding-right: 0; }
.wb-table input,
.wb-table select {
  width: 100%;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-xs);
  background: var(--ink-800);
  color: var(--text-100);
  font-family: var(--font-text);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  transition: border-color 140ms, background-color 140ms;
}
.wb-table input:hover,
.wb-table select:hover { border-color: var(--line-2); }
.wb-table input:focus,
.wb-table select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--fam);
}
.wb-table select {
  appearance: none;
  cursor: pointer;
  padding-right: 26px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-300) 50%),
    linear-gradient(135deg, var(--text-300) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.wb-table .row-del {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-inline: auto;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  color: var(--text-300);
  transition: color 140ms, background-color 140ms, border-color 140ms;
}
.wb-table .row-del:hover {
  color: var(--cat-pdf);
  border-color: color-mix(in srgb, var(--cat-pdf) 38%, transparent);
  background: color-mix(in srgb, var(--cat-pdf) 10%, transparent);
}
.wb-table .row-del .icon { width: 15px; height: 15px; }
.wb-add {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin-top: 4px;
  padding: 0 12px 0 9px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-200);
  transition: color 140ms, border-color 140ms, background-color 140ms;
}
.wb-add .icon { color: var(--fam); }
.wb-add { color: var(--text-100); }
.wb-add:hover {
  color: var(--text-100);
  border-color: var(--fam-line);
  background: color-mix(in srgb, var(--fam) 7%, var(--ink-700));
}

/* ---------- 13. Copy confirmation ---------------------------------------- */
.wb-copy.is-copied {
  color: var(--phosphor-text);
  border-color: color-mix(in srgb, var(--phosphor) 40%, transparent);
  background: color-mix(in srgb, var(--phosphor) 8%, transparent);
}

/* ---------- 14. Live dot while the tool is busy -------------------------- */
.wb-live.is-busy .wb-dot { animation-duration: 900ms; }

/* ---------- 15. Reset affordance in the form foot ------------------------ */
.wb-form .btn-quiet[data-calc-reset] {
  min-height: 34px;
  padding-inline: 4px;
}

/* ---------- 16. Responsive ----------------------------------------------- */
@media (max-width: 640px) {
  .res-bar { grid-template-columns: minmax(52px, 40%) minmax(0, 1fr) auto; gap: 9px; }
  .res-chart { grid-template-columns: 92px minmax(0, 1fr); gap: 16px; }
  .res-donut { width: 92px; height: 92px; }
  .res-donut::after, .res-donut__center { inset: 17px; }
  .res-empty { min-height: 76px; padding: 14px; }
  .wb-range { grid-template-columns: minmax(0, 1fr) 78px; gap: 10px; }
  .wb-table th, .wb-table td { padding-inline: 4px; }
  .wb-table input, .wb-table select { min-height: 38px; padding: 6px 7px; font-size: 0.8125rem; }
}
@media (max-width: 420px) {
  .res-chart { grid-template-columns: 1fr; justify-items: start; }
  .res-scale__legend, .res-legend { gap: 5px 12px; }
}

/* ---------- 17. Motion fallbacks ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .res-bar__fill, .res-more > summary::before, .wb-copy,
  .wb-range input[type="range"]::-webkit-slider-thumb,
  .wb-table input, .wb-table select, .wb-add { transition: none; }
  .wb-range input[type="range"]:hover::-webkit-slider-thumb,
  .wb-range input[type="range"]:active::-webkit-slider-thumb { transform: none; }
  .res-async::before { animation: none; }
  .wb-live.is-busy .wb-dot { animation: none; }
}

/* ---------- 18. Slider fill position (progressive enhancement) ------------
   The filled portion of a native range track cannot be sized in pure CSS, so
   --pct is published by a one-line delegate. Until then the fallback is 50%;
   Firefox uses ::-moz-range-progress and needs no script at all. */

/* ---------- 19. Shared readout labels: tools.css uses --text-400 -----------
   tools.css paints .res-stat dt and .res-table th with --text-400, which is
   3.7:1 on every ground. These are the sheet's own readout labels, so raise
   them one step to --text-300 (>=5.8:1 dark and light). */
.res-stat dt,
.res-table th {
  color: var(--text-300);
}

/* ---------- 20. Checkbox focus ring (gap in the shared chrome) -----------
   tools.css gives segmented radios a ring via the sibling span, but the
   .wb-check checkbox has none. Both families carry checkboxes, so both fix it. */
.wb-check input[type="checkbox"]:focus-visible,
.wb-check input[type="radio"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
/* ---------- 21. Expression display -------------------------------------
   The scientific calculator has no keypad markup - it is a single text
   expression input. Styled as an instrument display instead: large mono,
   hairline inset frame, tinted ground, visible caret. Scoped to #expression
   so no other text field in the family inherits the display treatment.
   (Accepted deviation: brief asked for a keypad; there is no DOM for one.) */
.wb-field #expression {
  font-family: var(--font-mono);
  font-size: clamp(1.0625rem, 2.2vw, 1.25rem);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-100);
  background: var(--ink-800);
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 var(--line-1);
  caret-color: var(--fam);
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.wb-field #expression:hover { border-color: var(--line-3); }
.wb-field #expression:focus,
.wb-field #expression:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--fam-line);
  background: var(--ink-700);
}
@media (max-width: 420px) {
  .wb-field #expression { min-height: 48px; font-size: 1rem; }
}