.pdb {
  font-family: var(--ms-font);
  color: var(--ms-ink);
}

.pdb-wrap {
  max-width: var(--ms-max);
  margin: 0 auto;
  padding: 0 var(--ms-gutter) var(--ms-space-7);
}

.pdb-head h1 {
  font-size: 28px;
  line-height: var(--ms-leading-heading);
  margin: var(--ms-space-4) 0 var(--ms-space-3);
}

.pdb-intro {
  color: var(--ms-mute);
  line-height: var(--ms-leading-copy);
  max-width: 42em;
}

/* Filter area: the media listing's ms-list-filter / ms-filter / ms-field /
   ms-select pattern from the shared bundle. Only page-specific deltas here. */
.pdb-filter-block {
  margin-block-start: var(--ms-space-6);
}

.pdb-filters fieldset {
  min-inline-size: 0;
}

/* The legend names the group for assistive tech; the field labels carry
   the visual structure, as on the media listing. */
.pdb-legend {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* On this paper page white fields read as inputs, as they do on the
   listing's white band. */
.pdb-filters .ms-select {
  background: var(--ms-white);
}

/* Sorting is not filtering: push it to the end of the row. */
.pdb-sort {
  margin-inline-start: auto;
}

/* Result count: the listing's divider closes the form, the figure sits
   directly under it, and an orange rule marks an active filter. */
.pdb-count {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--ms-space-1) var(--ms-space-3);
  margin: 0 0 var(--ms-space-5);
  padding-block: var(--ms-space-4);
  padding-inline-start: 0;
  border-inline-start: 0 solid var(--ms-orange);
  line-height: var(--ms-leading-heading);
}

.pdb-count-now {
  font-size: var(--ms-type-list-card);
  font-weight: 900;
}

.pdb-count-total {
  color: var(--ms-mute);
  font-size: var(--ms-type-caption);
}

.pdb-count.is-filtered {
  padding-inline-start: var(--ms-space-3);
  border-inline-start-width: 4px;
}

@media (max-width: 640px) {
  /* Two fields per row instead of the listing's full-width stack: five
     44px selects stacked would push the results off the first screen. */
  .pdb-filters .ms-field {
    flex: 1 1 calc(50% - var(--ms-space-4));
    min-width: 0;
  }
  .pdb-filters .pdb-sort {
    flex-basis: 100%;
    margin-inline-start: 0;
  }
}

/* Show cards: the listing's cover-card surface (white, hairline border,
   square corners) without the cover. Grid items need min-inline-size: 0 or
   an open episode table widens the whole page on phones. */
.pdb-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ms-space-5);
}

.pdb-show {
  min-inline-size: 0;
  padding: var(--ms-space-5);
  background: var(--ms-white);
  border: var(--ms-border);
  border-radius: var(--ms-radius-square);
}

.pdb-show-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.pdb-show-head h2 {
  margin: var(--ms-space-3) 0 0;
  font-size: var(--ms-type-list-card);
  font-weight: 700;
  line-height: 1.45;
}

/* Publisher: the cover card's lilac category label, above the name. */
.pdb-publisher {
  order: -1;
  margin: 0;
  padding: 2px var(--ms-space-2);
  background: var(--ms-lilac);
  font-size: var(--ms-type-label);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

/* Difficulty bands: quiet outline pills (the ms-pill shape on a hairline),
   the axis name muted so the band reads first. */
.pdb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ms-space-2);
  margin: var(--ms-space-3) 0 0;
}

.pdb-chip {
  padding: 2px 10px;
  border: var(--ms-border);
  border-radius: var(--ms-radius-pill);
  font-size: var(--ms-type-label);
  font-weight: 700;
  line-height: 1.5;
}

.pdb-chip-key {
  color: var(--ms-mute);
}

/* Metrics: four even columns ruled like the listing filter divider; two
   per row on phones. */
.pdb-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 var(--ms-space-5);
  margin: var(--ms-space-5) 0 0;
}

.pdb-stats > div {
  min-inline-size: 0;
  padding-block: var(--ms-space-3) 0;
  border-block-start: var(--ms-border);
}

.pdb-stats dt {
  color: var(--ms-mute);
  font-size: var(--ms-type-label);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.pdb-stats dd {
  margin: var(--ms-space-1) 0 0;
  font-size: var(--ms-type-body);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.pdb-stats strong {
  font-size: var(--ms-type-list-card);
  line-height: 1.3;
}

.pdb-range,
.pdb-note {
  display: block;
  margin-block-start: 2px;
  color: var(--ms-mute);
  font-size: var(--ms-type-caption);
}

.pdb-source {
  margin: var(--ms-space-4) 0 0;
  color: var(--ms-faint);
  font-size: var(--ms-type-caption);
  line-height: 1.5;
}

/* Links: the article link is the card's one action (ms-list-all weight,
   ms-arrow); any extra links use the reading footer's quiet underline. */
.pdb-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--ms-space-5);
  margin: var(--ms-space-2) 0 0;
}

.pdb-links a {
  display: inline-flex;
  align-items: center;
  gap: var(--ms-space-2);
  min-height: var(--ms-target);
  font-size: var(--ms-type-body);
}

.pdb-link-primary {
  font-weight: 900;
}

.pdb-link-quiet {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--ms-line);
  text-underline-offset: 3px;
}

.media-system .pdb-link-quiet:hover {
  text-decoration-color: currentColor;
}

/* Episode details: a ruled disclosure row with a chevron that turns. */
.pdb-episodes {
  margin-block-start: var(--ms-space-2);
  border-block-start: var(--ms-border);
}

.pdb-episodes summary {
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
  min-height: var(--ms-target);
  cursor: pointer;
  font-size: var(--ms-type-body);
  font-weight: 700;
  list-style: none;
}

.pdb-episodes summary::-webkit-details-marker {
  display: none;
}

.pdb-episodes summary::after {
  content: "";
  inline-size: 7px;
  block-size: 7px;
  margin-block-start: -4px;
  /* Physical sides on purpose: the chevron points down in both directions. */
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.pdb-episodes[open] summary::after {
  margin-block-start: 3px;
  transform: rotate(-135deg);
}

/* Episode table: the article table's ruling (2px ink under the head,
   hairlines between rows), figures aligned on the end edge. */
.pdb-table-scroll {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  margin-block: var(--ms-space-1) var(--ms-space-2);
}

.pdb-table-scroll:focus-visible {
  outline: var(--ms-focus-width) solid var(--ms-ink);
  outline-offset: var(--ms-focus-offset);
}

.pdb-table-scroll table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: var(--ms-type-caption);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.pdb-table-scroll :is(th, td) {
  padding: 10px var(--ms-space-3);
  border-block-end: var(--ms-border);
  text-align: start;
  vertical-align: top;
  white-space: nowrap;
}

.pdb-table-scroll :is(th, td):first-child {
  padding-inline-start: 0;
}

.pdb-table-scroll :is(th, td):last-child {
  padding-inline-end: 0;
}

.pdb-table-scroll thead th {
  border-block-end: var(--ms-border-strong);
  font-size: var(--ms-type-label);
  letter-spacing: 0.04em;
  vertical-align: bottom;
}

.pdb-table-scroll :is(th, td):nth-child(n + 3) {
  text-align: end;
}

.pdb-table-scroll td:first-child {
  color: var(--ms-mute);
}

.pdb-table-scroll td:nth-child(2) {
  min-inline-size: 14em;
  white-space: normal;
}

.pdb-table-scroll td a {
  text-decoration: underline;
  text-decoration-color: var(--ms-line);
  text-underline-offset: 3px;
}

.media-system .pdb-table-scroll td a:hover {
  text-decoration-color: currentColor;
}

.pdb-empty {
  color: var(--ms-mute);
}

@media (max-width: 640px) {
  .pdb-show {
    padding: var(--ms-space-4);
  }
  .pdb-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ms-space-4) var(--ms-space-4);
  }
  /* Let the first figure column show before the table scrolls. */
  .pdb-table-scroll td:nth-child(2) {
    min-inline-size: 9em;
  }
}

.pdb-method {
  margin-top: var(--ms-space-7);
  max-width: 42em;
  line-height: var(--ms-leading-copy);
}

.pdb-method h2 {
  font-size: 20px;
}

/* Podcast article pages load this stylesheet too: their reading footer
   links here, and the footer's divider follows the CTA pattern. */
.media-system .media-article.page .pdb-link {
  margin-block-end: 20px;
  padding-block-start: 20px;
  font-weight: 700;
}
.media-system .media-article.page .readingFooter:has(> .pdb-link) {
  border-block-start: 1px solid var(--ms-line);
}
