/* ICD-10-CM diagnosis codes — templates/diagnosis-codes/index.twig + web/js/diagnosis-codes.js.
   Figma: Catalog — Diagnosis codes › "Option B · Code builder". Light Resources page, full width (no sidebar).
   Builder ON: intro row, then numbered steps on the left and the dark "Your code" card on the right.
   Builder OFF: plain intro + the PDF download (page.css .bp-downloads). */
.dx-page {
  grid-template-columns: minmax(0, 1200px);
}
.dx {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* ---- "Download the guide" + PDF link, then "Build your code" with the intro text under it, heading the builder.
   Figma: content inset 56px from the title on desktop. */
.dx {
  padding: 0 56px;
}
.dx-intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  max-width: 720px;
}
.dx .dx-intro__text {
  margin: 0;
  max-width: 680px;
  font-size: 18px;
  line-height: 1.6;
}
.dx .dx-subhead {
  margin: 0;
  color: var(--pcli-color-text-secondary, #555a59);
}
.dx-build-head {
  margin-bottom: -12px; /* 28px to the builder (the column gap is 40) */
}
.dx-tag {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 4px;
  background: var(--pcli-color-bg-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--pcli-color-text-secondary);
}
.dx .dx-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--pcli-color-text-link);
  text-decoration: none;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .dx .dx-pdf-link {
    align-items: flex-start;
    max-width: 100%;
    white-space: normal;
  }
  .dx .dx-pdf-link svg {
    flex: none;
    margin-top: 1px;
  }
}
.dx .dx-pdf-link:hover {
  text-decoration: underline;
}

/* ---- builder layout */
.dx-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 347px;
  gap: 40px;
  align-items: start;
}
.dx .dx-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}
.dx-step {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px;
  padding: 21px 0;
  border-bottom: 1px solid var(--pcli-color-border-subtle);
}
.dx-step:first-child {
  padding-top: 0;
}
.dx-step:last-child {
  border-bottom: 0;
}
.dx-step[hidden] {
  display: none;
}
.dx-step__num {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.dx-step__n {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1.5px solid var(--pcli-color-text-primary);
  font-size: 17px;
  font-weight: 500;
  color: var(--pcli-color-text-primary);
}
.dx-step__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--pcli-color-text-primary);
}
.dx-step__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
}
.dx-step__choices--cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.dx .dx-hint {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--pcli-color-text-tertiary);
}

/* ---- choices: pills and condition cards (same look, cards are taller) */
.dx-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--pcli-color-border-subtle);
  border-radius: 8px;
  background: #fff;
  color: var(--pcli-color-text-primary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.dx-choice:hover {
  border-color: var(--pcli-color-text-tertiary);
}
.dx-choice:focus-visible {
  outline: 2px solid var(--teal-500);
  outline-offset: 2px;
}
.dx-choice.is-selected {
  background: var(--pcli-color-text-primary);
  border-color: var(--pcli-color-text-primary);
  color: #fff;
}
.dx-choice__sub {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--pcli-color-text-tertiary);
}
.dx-choice.is-selected .dx-choice__sub {
  color: #b6bdc3;
}
.dx-choice--card {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 16px;
  min-height: 64px;
}
.dx-choice--card .dx-choice__sub {
  letter-spacing: 0.04em;
}

/* ---- the code card */
.dx-card {
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 32px;
  border-radius: 12px;
  background: #0b0d0f;
  color: #fff;
}
.dx .dx-card__label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7d868d;
}
.dx .dx-card__code {
  margin: 0;
  font-size: 56px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #fff;
  overflow-wrap: anywhere;
}
.dx .dx-card__desc {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  color: #dfe3e6;
}
.dx-card__parts {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid #2a3138;
}
.dx-card__parts[hidden] {
  display: none;
}
.dx-part__k {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.dx-part__k--cat {
  color: var(--teal-500);
}
.dx-part__k--eye,
.dx-part__k--stage {
  color: var(--orange-500);
}
.dx-part__v {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: #b6bdc3;
}
.dx-card__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 22px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--orange-600);
  color: var(--pcli-color-text-on-primary);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.dx-card__copy:hover {
  background: var(--orange-500);
}
.dx-card__copy.is-copied {
  background: var(--teal-500);
  color: #0b0d0f;
}
.dx-card__copy:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.dx-card__copy[hidden] {
  display: none;
}
.dx-card__others[hidden],
.dx-card__note[hidden] {
  display: none;
}
.dx-card__others {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dx-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dx-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #3a434b;
  border-radius: 6px;
  background: none;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.dx-chip:hover {
  border-color: #7d868d;
}
.dx-chip__eye {
  font-size: 11px;
  font-weight: 600;
  color: #7d868d;
}
.dx-chip__code {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.dx .dx-card__note {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid #2a3138;
  font-size: 13px;
  line-height: 1.5;
  color: #b6bdc3;
}

/* ---- responsive */
@media (max-width: 1100px) {
  .dx {
    padding: 0;
  }
  .dx-builder {
    grid-template-columns: 1fr;
  }
  .dx-card {
    position: static;
  }
}
@media (max-width: 720px) {
  .dx {
    gap: 28px;
  }
  .dx-step {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 20px 0;
  }
  .dx-step__num {
    flex-direction: row;
    gap: 10px;
  }
  .dx-step__n {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
  .dx-step__choices--cards {
    grid-template-columns: 1fr;
  }
  .dx-card {
    padding: 24px;
  }
  .dx .dx-card__code {
    font-size: 40px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .dx-choice,
  .dx-card__copy {
    transition: none;
  }
}
