/* DMAIC Toolbox: tabs, panels, and the featured hub card. Uses the site's theme variables (light and dark). */

.tb-intro { max-width: 70ch; }

/* ---------- Tab bar ---------- */
.tb-tabs-wrap {
  position: sticky;
  top: var(--tb-header-offset, 58px);
  z-index: 15;
  margin: 1.25rem 0 0;
  padding: 0.5rem 0 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.tb-tablist {
  display: flex;
  gap: 0.35rem;
  margin: 0;
  padding: 0 0 0 0;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.tb-tab {
  flex: 1 1 0;
  min-width: 9.5rem;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 0.65rem;
  padding: 0.6rem 0.9rem;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.tb-tab:hover { background: var(--surface-soft); }
.tb-tab:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.tb-tab-letter {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--brand);
  border: 2px solid var(--brand);
  background: transparent;
}
.tb-tab-name { font-weight: 700; line-height: 1.15; }
.tb-tab-sub { font-size: 0.78rem; color: var(--muted); line-height: 1.2; }
.tb-tab[aria-selected="true"] {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 -3px 0 var(--brand) inset;
  margin-bottom: -1px;
  padding-bottom: calc(0.6rem + 1px);
}
.tb-tab[aria-selected="true"] .tb-tab-letter { background: var(--brand); color: var(--surface); }
.tb-tab-soon .tb-tab-sub::after { content: " \00b7 coming soon"; color: var(--accent); }

/* ---------- Panels ---------- */
.tb-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 2rem;
  box-shadow: 0 12px 28px var(--shadow);
}
.tb-panel[hidden] { display: none; }
.tb-panel-head { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; justify-content: space-between; align-items: flex-start; }
.tb-panel-head h2 { margin: 0.1rem 0 0.25rem; font-size: clamp(1.7rem, 3vw, 2.2rem); }
.tb-eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.tb-lead { font-size: 1.08rem; color: var(--text); max-width: 72ch; }
.tb-tools-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tb-tools-bar button { cursor: pointer; border: none; font: inherit; font-size: 0.9rem; padding: 0.5rem 0.85rem; }

/* At-a-glance strip */
.tb-glance {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin: 1.1rem 0 1.25rem;
}
.tb-glance-item {
  padding: 0.75rem 0.95rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.tb-glance dt { font-size: 0.74rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 0.2rem; }
.tb-glance dd { margin: 0; font-size: 0.97rem; line-height: 1.4; }

/* Jump navigation inside a panel */
.tb-jump {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}
.tb-jump strong { display: block; font-size: 0.78rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.tb-jump ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; }
.tb-jump a {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  text-decoration: none;
  background: var(--surface);
}
.tb-jump a:hover { border-color: var(--brand); }

/* Sections */
.tb-section { margin: 2.25rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--border); scroll-margin-top: calc(var(--tb-header-offset, 58px) + 5.5rem); }
.tb-section:first-of-type { border-top: none; }
.tb-section h3 { margin: 0 0 0.4rem; font-size: 1.4rem; color: var(--text); }
.tb-section h4 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.tb-section p { max-width: 78ch; }
.tb-grid { display: grid; gap: 0.9rem; margin: 1rem 0; }
.tb-grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tb-grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tb-card { box-shadow: none; }
.tb-card p:last-child, .tb-card ul:last-child { margin-bottom: 0; }
.tb-callout-warn { border-left-color: var(--accent); }
.tb-figure { margin: 1.25rem 0; }

/* Numbered steps */
.tb-steps { list-style: none; counter-reset: none; margin: 1rem 0; padding: 0; display: grid; gap: 0.9rem; }
.tb-step { display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.9rem; padding: 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.tb-step-num { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--brand); color: var(--surface); }
.tb-step-body h4 { margin: 0.15rem 0 0.4rem; font-size: 1.08rem; }
.tb-step-body p { margin: 0.4rem 0; }
.tb-step-meta { font-size: 0.93rem; color: var(--muted); }
.tb-step-meta strong { color: var(--text); }
.tb-watch strong { color: var(--accent); }

/* Checklist */
.tb-checklist { margin: 1rem 0; }
.tb-check-group { border: 1px solid var(--border); border-radius: 12px; margin: 0 0 0.75rem; padding: 0.4rem 1rem 0.7rem; background: var(--card); }
.tb-check-group legend { padding: 0 0.4rem; font-weight: 700; }
.tb-check-group ul { list-style: none; margin: 0; padding: 0; }
.tb-check { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.6rem; align-items: start; padding: 0.35rem 0; cursor: pointer; }
.tb-check input { width: 1.15rem; height: 1.15rem; margin-top: 0.2rem; accent-color: var(--brand); }
.tb-check input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.tb-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-bottom: 0.9rem; }
.tb-progress-text { font-weight: 700; min-width: 9rem; }
.tb-progress-track { flex: 1 1 180px; height: 0.7rem; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.tb-progress-fill { height: 100%; width: 0; background: var(--brand); transition: width 200ms ease; }
.tb-reset { cursor: pointer; border: none; font: inherit; font-size: 0.85rem; padding: 0.4rem 0.75rem; }

/* Resource lists */
.tb-res-group { padding: 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.tb-res-group h4 { margin: 0 0 0.5rem; }
.tb-res-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.tb-res-list li { display: grid; gap: 0.1rem; }
.tb-res-list li span { font-size: 0.88rem; color: var(--muted); }

.tb-stub { padding: 1rem 0; }
.tb-sources { font-size: 0.93rem; }

/* ---------- Featured card on the Six Sigma hub ---------- */
.tb-feature {
  display: grid;
  grid-template-columns: minmax(0, 220px) 1fr;
  gap: 1.25rem;
  align-items: center;
  margin: 0 0 2rem;
  padding: 1.1rem;
  border: 2px solid var(--brand);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 14px 30px var(--shadow-strong);
}
.tb-feature img { width: 100%; height: auto; border-radius: 12px; display: block; }
.tb-feature .tb-eyebrow { color: var(--accent); }
.tb-feature h2 { margin: 0.2rem 0 0.4rem; }
.tb-feature h2 a { text-decoration: none; }
.tb-feature p { margin: 0 0 0.6rem; }
.tb-feature-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0.2rem; padding: 0; list-style: none; }
.tb-feature-tags li { padding: 0.15rem 0.6rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.82rem; background: var(--surface-muted); }

@media (max-width: 720px) {
  .tb-tab { min-width: 8rem; padding: 0.5rem 0.65rem; }
  .tb-tab-sub { display: none; }
  .tb-step { grid-template-columns: 1fr; }
  .tb-feature { grid-template-columns: 1fr; }
  .tb-section { scroll-margin-top: calc(var(--tb-header-offset, 58px) + 4.5rem); }
}

/* ---------- Print: only the active panel ---------- */
@media print {
  .site-header, .site-footer, .tb-tabs-wrap, .tb-jump, .tb-tools-bar, .tb-reset, .page-header .guide-meta { display: none !important; }
  .tb-panel[hidden] { display: none !important; }
  .tb-panel { border: none; box-shadow: none; padding: 0; }
  .tb-section { break-inside: avoid-page; }
  .tb-step, .tb-check-group, .tb-figure { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  .tb-tab, .tb-progress-fill { transition: none; }
}

/* Without JavaScript every panel is shown, so the tab bar is hidden. */
[data-toolbox]:not(.tb-ready) .tb-tabs-wrap { display: none; }
[data-toolbox]:not(.tb-ready) .tb-panel { margin-top: 1.25rem; border-top: 1px solid var(--border); border-radius: 14px; }
