/* Chebit handbook page. It adds to styles.css and uses only its tokens.
   A coin shows a status by how full it is: full is done, half is partial, empty is not built. */

/* ---------- hero ---------- */
.hb-hero {
  padding-top: 78px;
  padding-bottom: 84px;
}

.hb-hero h1 {
  max-width: 15em;
  color: var(--rail-heading);
}

.hb-hero h1 .quiet {
  color: var(--rail-muted);
}

.hb-hero .hero-description {
  max-width: 660px;
}

.hb-hero .hero-note:empty {
  display: none;
}

.hb-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 32px;
  margin-top: 44px;
  color: var(--rail-muted);
  font-size: 13px;
}

.hb-legend li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.hb-legend strong {
  color: var(--rail-heading);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ---------- coins ---------- */
.coin {
  display: inline-block;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.coin.done {
  background: currentColor;
}

.coin.partial {
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.hb-coins {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 900px;
  margin-top: 22px;
  color: var(--rail-heading);
}

.hb-coins .coin {
  width: 14px;
  height: 14px;
  transition: color 0.15s;
}

.hb-coins .coin:hover {
  color: #7fa6c4;
}

/* ---------- inline code and links inside handbook text ---------- */
main code,
.hb-hero code {
  font: 400 0.87em/1.4 var(--mono);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.section-lead code,
.hb-detail code,
.hb-table code,
.hb-after code,
.hb-missing code {
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--soft);
}

.band-surface .hb-table code {
  background: var(--canvas);
}

.hb-detail a,
.hb-table a {
  border-bottom: 1px solid currentColor;
  transition: color 0.15s;
}

.hb-detail a:hover,
.hb-table a:hover {
  color: var(--accent);
}

.hb-missing {
  padding-block: 28px;
  color: var(--muted);
}

/* ---------- filters and search ---------- */
.hb-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 64px;
}

.hb-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hb-filters button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: 500 13px/1.2 var(--sans);
  cursor: pointer;
  transition: background 0.15s;
}

.hb-filters button:hover,
.hb-filters button[aria-pressed="true"] {
  background: var(--soft);
}

.hb-filters button[aria-pressed="true"] {
  border-color: var(--accent);
}

.hb-filters .count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hb-search {
  flex: 1 1 240px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  font: 400 15px/1.4 var(--sans);
}

.hb-search::placeholder {
  color: var(--tertiary);
}

.hb-search:focus-visible {
  border-color: var(--accent);
}

.hb-empty {
  margin-top: 40px;
  color: var(--muted);
}

/* ---------- parts and practices: rows with a rule on top ---------- */
.hb-part {
  margin-top: 72px;
}

.hb-part > h3 {
  margin-bottom: 22px;
}

.hb-practice {
  border-top: 1px solid var(--line);
}

.hb-practice:last-child {
  border-bottom: 1px solid var(--line);
}

.hb-practice summary {
  display: grid;
  grid-template-columns: 14px 26px minmax(0, 1fr) auto 12px;
  align-items: center;
  gap: 16px;
  padding-block: 21px;
  cursor: pointer;
  list-style: none;
}

.hb-practice summary::-webkit-details-marker {
  display: none;
}

.hb-practice summary::after {
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  content: "";
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.hb-practice[open] summary::after {
  margin-top: 4px;
  transform: rotate(225deg);
}

.hb-num {
  color: var(--tertiary);
  font: 400 13px/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.hb-title {
  font-size: 19px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.03em;
  transition: color 0.15s;
}

.hb-practice summary:hover .hb-title {
  color: var(--accent);
}

.hb-state {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.hb-detail {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px 32px;
  margin: 0;
  padding: 6px 0 40px 72px;
}

.hb-detail dt {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}

.hb-detail dd {
  max-width: 740px;
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
}

.hb-detail dd > * + * {
  margin-top: 10px;
}

.hb-detail ul {
  padding-left: 18px;
  list-style: disc;
}

.hb-detail li + li {
  margin-top: 7px;
}

.hb-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.hb-detail pre {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--rail);
  color: var(--rail-heading);
  font: 400 13px/1.75 var(--mono);
  letter-spacing: -0.025em;
}

.hb-detail pre code {
  padding: 0;
  background: none;
  font-size: inherit;
  overflow-wrap: normal;
}

/* ---------- findings ---------- */
.hb-table {
  width: 100%;
  margin-top: 64px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.6;
}

.hb-table th {
  padding: 0 24px 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.hb-table td {
  padding: 22px 24px 22px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.hb-table th:last-child,
.hb-table td:last-child {
  min-width: 9em;
  padding-right: 0;
}

.hb-table .id {
  font: 500 13px/1.85 var(--mono);
  white-space: nowrap;
}

.hb-table .severity,
.hb-table .where {
  white-space: nowrap;
}

.hb-table .severity.high::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
  vertical-align: 1px;
}

.hb-after {
  max-width: 740px;
  margin-top: 32px;
  color: var(--muted);
  font-size: 15px;
}

/* ---------- agents ---------- */
#agents .chip code {
  font-size: 13px;
}

#agents .rows > li:first-child {
  padding-top: 0;
  border-top: 0;
}

.hb-commands {
  margin-top: 40px;
}

.hb-commands pre code {
  overflow-wrap: normal;
}

.hb-commands figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.hb-commands figcaption code {
  color: var(--rail-text);
}

.hb-copy {
  padding: 9px 13px;
  border: 1px solid var(--rail-line);
  border-radius: 3px;
  background: transparent;
  color: var(--rail-heading);
  font: 500 13px/1.2 var(--sans);
  cursor: pointer;
  transition: background 0.15s;
}

.hb-copy:hover {
  background: var(--rail-active);
}

/* ---------- smaller screens ---------- */
@media (max-width: 1040px) {
  .hb-detail {
    padding-left: 0;
  }
}

@media (max-width: 760px) {
  .hb-hero {
    padding-top: 48px;
    padding-bottom: 60px;
  }

  .hb-tools {
    margin-top: 44px;
  }

  .hb-part {
    margin-top: 52px;
  }

  .hb-practice summary {
    grid-template-columns: 14px 22px minmax(0, 1fr) 12px;
    gap: 12px;
  }

  .hb-state {
    display: none;
  }

  .hb-detail {
    grid-template-columns: 1fr;
    gap: 4px;
    padding-bottom: 28px;
  }

  .hb-detail dd {
    margin-bottom: 14px;
  }

  .hb-table,
  .hb-table tbody,
  .hb-table tr,
  .hb-table td {
    display: block;
  }

  .hb-table {
    margin-top: 44px;
  }

  .hb-table thead {
    display: none;
  }

  .hb-table tr {
    padding-block: 20px;
    border-top: 1px solid var(--line);
  }

  .hb-table td {
    padding: 3px 0;
    border: 0;
    white-space: normal;
  }

  .hb-table td[data-label]:not(.severity)::before {
    color: var(--muted);
    content: attr(data-label) ": ";
    font-size: 13px;
  }
}
