/* Handbook layout and type on --ds-* tokens. Used by the web page and, without .hb--page, inside the DCM app. */

.hb { color: var(--ds-text-primary); line-height: 1.65; font-size: 16px; background: var(--ds-bg-surface); border-radius: var(--ds-radius-lg); padding: var(--ds-spacing-lg, 20px); }
.hb *, .hb *::before, .hb *::after { box-sizing: border-box; }
.hb-part { min-width: 0; }

/* ---------- web page layout ---------- */
.hb--page { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--ds-spacing-xl, 32px); align-items: start; }
.hb--page .hb-content { min-width: 0; max-width: 860px; }
.hb-toc {
  position: sticky; top: calc(var(--topbar-h, 56px) + 16px); align-self: start;
  max-height: calc(100vh - var(--topbar-h, 56px) - 32px); overflow-y: auto;
  background: var(--ds-bg-surface); border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-md, 8px); padding: 14px 12px 20px;
}
.hb-menu-btn, .hb-scrim { display: none; }

/* ---------- table of contents ---------- */
.hb-nav__part {
  font-size: var(--ds-text-xs, 11px); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ds-brand-primary); font-weight: var(--ds-weight-semibold, 600); margin: 18px 0 6px; padding-left: 2px;
}
.hb-nav__part:first-child { margin-top: 0; }
.hb-nav__link {
  display: block; color: var(--ds-text-secondary); text-decoration: none;
  font-size: var(--ds-text-sm, 14px); padding: 5px 10px; border-radius: var(--ds-radius-sm, 6px);
  border-left: 2px solid transparent;
}
.hb-nav__link--sub { padding-left: 24px; }
.hb-nav__link:hover { color: var(--ds-text-primary); background: var(--ds-bg-surface-2); }
.hb-nav__link--active {
  color: var(--ds-brand-primary); background: var(--ds-bg-surface-2);
  border-left-color: var(--ds-brand-primary); font-weight: var(--ds-weight-semibold, 600);
}
.hb-nav__link:focus-visible, .hb a:focus-visible { outline: 2px solid var(--ds-brand-primary); outline-offset: 2px; }

/* ---------- type ---------- */
.hb h1, .hb h2, .hb h3, .hb h4, .hb h5 { text-wrap: balance; line-height: 1.15; margin: 0; color: var(--ds-text-primary); }
.hb h1 { font-size: clamp(30px, 4.5vw, 42px); font-weight: 700; letter-spacing: -.01em; }
.hb h2 { font-size: 26px; font-weight: 700; margin-top: 8px; }
.hb h3 { font-size: 20px; font-weight: 600; margin-top: 30px; }
.hb h4 { font-size: 16px; font-weight: 600; margin-top: 20px; }
.hb h5 { font-size: 14px; font-weight: 600; margin-top: 14px; }
.hb p { margin: 12px 0; }
.hb strong, .hb b { font-weight: 600; }
.hb a { color: var(--ds-brand-primary); }
.hb ul, .hb ol { padding-left: 22px; margin: 12px 0; }
.hb li { margin: 6px 0; }
.hb code, .hb-path {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .86em;
  background: var(--ds-bg-surface-2); border: 1px solid var(--ds-border-subtle);
  padding: 1px 6px; border-radius: 5px; overflow-wrap: anywhere;
}
.hb-path { color: var(--ds-brand-primary); }
.hb-eyebrow {
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ds-brand-primary); font-weight: var(--ds-weight-semibold, 600); display: block; margin-bottom: 10px;
}
.hb-lead { font-size: 19px; line-height: 1.5; color: var(--ds-text-secondary); }
.hb-divider-note { font-size: 13px; color: var(--ds-text-muted); font-style: italic; }

/* ---------- sections ---------- */
.hb-doc { scroll-margin-top: calc(var(--topbar-h, 56px) + 16px); padding: 40px 0; border-top: 1px solid var(--ds-border-subtle); }
.hb-part > .hb-doc:first-child, .hb-hero + .hb-doc { border-top: 0; }
.hb-divider { padding: 30px 0 6px; }
.hb-divider h2 { font-size: 30px; }
.hb-divider p { color: var(--ds-text-secondary); max-width: 60ch; }

.hb-hero {
  background: var(--ds-bg-surface); border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius-lg, 14px);
  padding: clamp(22px, 4vw, 40px); box-shadow: var(--ds-shadow-sm); margin-bottom: 8px;
}
.hb-hero .hb-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 20px; font-size: 14px; color: var(--ds-text-secondary); }
.hb-hero .hb-meta b { color: var(--ds-text-primary); }

.hb-steps { counter-reset: step; list-style: none; padding-left: 0; }
.hb-steps > li { position: relative; padding: 3px 0 3px 42px; margin: 10px 0; }
.hb-steps > li::before {
  counter-increment: step; content: counter(step); position: absolute; left: 0; top: 2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--ds-bg-surface-2); color: var(--ds-brand-primary);
  font-weight: 600; font-size: 14px; display: grid; place-items: center;
}

/* ---------- callouts ---------- */
.hb-call {
  border: 1px solid var(--ds-border-subtle); border-left: 3px solid var(--ds-brand-primary);
  background: var(--ds-bg-surface); border-radius: var(--ds-radius-md, 9px);
  padding: 14px 18px; margin: 18px 0; box-shadow: var(--ds-shadow-sm);
}
.hb-call__tag {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 4px;
}
.hb-call p:last-child, .hb-call ul:last-child { margin-bottom: 0; }
.hb-call p:first-of-type { margin-top: 4px; }
.hb-call--tip { border-left-color: var(--ds-info-border); background: var(--ds-info-bg); }
.hb-call--tip .hb-call__tag { color: var(--ds-info-text); }
.hb-call--imp { border-left-color: var(--ds-warning-border); background: var(--ds-warning-bg); }
.hb-call--imp .hb-call__tag { color: var(--ds-warning-text); }

/* ---------- per-task how-to card ---------- */
.hb-task {
  background: var(--ds-bg-surface); border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius-lg, 12px);
  padding: 18px 20px 20px; margin: 20px 0; box-shadow: var(--ds-shadow-sm);
}
.hb-task__head { margin-bottom: 2px; }
.hb-task__name { font-weight: 600; font-size: 18px; display: flex; align-items: center; gap: 9px; }
.hb-task__purpose { font-size: 14.5px; color: var(--ds-text-secondary); margin: 5px 0 0; line-height: 1.5; }
.hb-task__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 16px; }
.hb-task__col { border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius-md, 10px); padding: 12px 15px 15px; background: var(--ds-bg-surface-2); min-width: 0; }
.hb-task__col--dcm { border-top: 3px solid var(--ds-success-border); }
.hb-task__col--web { border-top: 3px solid var(--ds-info-border); }
.hb-task__col-head { font-size: 12px; letter-spacing: .04em; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.hb-task__col--dcm .hb-task__col-head { color: var(--ds-success-text); }
.hb-task__col--web .hb-task__col-head { color: var(--ds-info-text); }
.hb-task__col .hb-steps { margin: 8px 0 0; }
.hb-task__col .hb-steps > li { font-size: 14.5px; padding: 2px 0 2px 34px; margin: 8px 0; }
.hb-task__col .hb-steps > li::before { width: 23px; height: 23px; font-size: 12px; top: 1px; }
.hb-task__note { font-size: 14px; color: var(--ds-text-secondary); margin: 13px 0 0; }
.hb-task__note b { color: var(--ds-text-primary); }

/* ---------- lists, flows, panels ---------- */
.hb-cols2 { columns: 2; column-gap: 32px; }
.hb-cols2 li { break-inside: avoid; }
.hb-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0; }
.hb-flow__step {
  font-weight: 600; font-size: 14px; background: var(--ds-bg-surface-2); color: var(--ds-brand-primary);
  border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius-md, 8px); padding: 7px 12px;
}
.hb-flow__arrow { color: var(--ds-text-muted); font-size: 14px; }
.hb-panel {
  background: var(--ds-bg-surface); border: 1px solid var(--ds-border-subtle); border-left: 3px solid var(--ds-brand-primary);
  border-radius: var(--ds-radius-md, 10px); padding: 16px 18px; margin: 18px 0; box-shadow: var(--ds-shadow-sm);
}
.hb-panel > h4:first-child { margin-top: 0; }
.hb-panel__meta { font-size: 13px; color: var(--ds-text-muted); }

.hb-where { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.hb-chip {
  font-size: 12px; letter-spacing: .03em; border: 1px solid var(--ds-border-strong); border-radius: var(--ds-radius-full, 999px);
  padding: 4px 12px; color: var(--ds-text-secondary); display: inline-flex; align-items: center; gap: 6px;
}
.hb-chip b { color: var(--ds-text-primary); font-weight: 600; }
.hb-chip--web { border-color: var(--ds-info-border); background: var(--ds-info-bg); color: var(--ds-info-text); }
.hb-chip--dcm { border-color: var(--ds-success-border); background: var(--ds-success-bg); color: var(--ds-success-text); }
.hb-chip--inline { vertical-align: middle; }

.hb-modgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin: 22px 0; }
.hb-modcard {
  display: block; text-decoration: none; color: inherit; background: var(--ds-bg-surface);
  border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius-md, 11px);
  padding: 16px 16px 15px; box-shadow: var(--ds-shadow-sm);
}
.hb-modcard:hover { border-color: var(--ds-brand-primary); }
.hb-modcard__icon { font-size: 22px; }
.hb-modcard__name { font-weight: 600; font-size: 17px; margin-top: 8px; }
.hb-modcard__desc { font-size: 13.5px; color: var(--ds-text-secondary); line-height: 1.45; margin-top: 3px; }

/* ---------- tables ---------- */
.hb-tablewrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius-md, 11px); box-shadow: var(--ds-shadow-sm); }
.hb table { border-collapse: collapse; width: 100%; font-size: 15px; min-width: 480px; }
.hb th, .hb td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--ds-border-subtle); vertical-align: top; }
.hb thead th { background: var(--ds-bg-surface-2); font-weight: 600; font-size: 14px; color: var(--ds-text-primary); }
.hb tbody tr:last-child td { border-bottom: 0; }
.hb tbody tr:nth-child(even) { background: var(--ds-bg-surface-2); }
.hb-tier { font-weight: 600; }

/* ---------- links, facts, spacing ---------- */
.hb-link { display: inline; color: var(--ds-brand-primary); text-decoration: none; font-weight: 600; }
.hb-link:hover { text-decoration: underline; }
.hb-facts {
  background: var(--ds-bg-surface-2); border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-md, 8px); padding: 12px 16px; margin: 18px 0;
}
.hb-facts h4 { margin-top: 0; }
.hb-facts p:first-of-type { margin-top: 6px; }
.hb-facts ul { margin: 8px 0; }
.hb-mt-md { margin-top: 14px; }
.hb-my-md { margin: 14px 0; }
.hb-dim { opacity: .7; }

.hb-footer { margin-top: 50px; padding-top: 20px; border-top: 1px solid var(--ds-border-subtle); font-size: 13.5px; color: var(--ds-text-muted); }

/* ---------- narrow screens ---------- */
@media (max-width: 640px) {
  .hb-task__cols { grid-template-columns: 1fr; }
  .hb-cols2 { columns: 1; }
}
@media (max-width: 900px) {
  .hb--page { grid-template-columns: 1fr; gap: 0; }
  .hb-toc {
    position: fixed; top: var(--topbar-h, 56px); bottom: 0; left: 0; width: 280px; max-height: none;
    z-index: var(--ds-z-dropdown, 40); border-radius: 0; transform: translateX(-100%); transition: transform .22s ease;
  }
  .hb--page.hb-nav-open .hb-toc { transform: translateX(0); }
  .hb-scrim { position: fixed; inset: 0; background: color-mix(in srgb, var(--ds-text-primary) 45%, transparent); z-index: calc(var(--ds-z-dropdown, 40) - 1); }
  .hb--page.hb-nav-open .hb-scrim { display: block; }
  .hb-menu-btn {
    display: inline-flex; align-items: center; gap: 9px; width: 100%; margin-bottom: 14px;
    background: var(--ds-bg-surface); border: 1px solid var(--ds-border-subtle); border-radius: var(--ds-radius-md, 8px);
    color: var(--ds-text-primary); font-weight: 600; font-size: 16px; padding: 12px 16px; cursor: pointer;
  }
}
@media (prefers-reduced-motion: reduce) { .hb-toc { transition: none; } }
