.cwd-directory {
  max-width: 100%;
}

.cwd-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .6rem 1rem;
  margin: 0 0 .85rem;
}

.cwd-control {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
}

.cwd-control label {
  font-weight: 600;
}

.cwd-controls select,
.cwd-controls input[type="search"] {
  min-height: 2.4rem;
}

.cwd-search-wrap {
  flex: 1 1 18rem;
}

.cwd-search-wrap input {
  width: 100%;
  min-width: 14rem;
}

.cwd-view-picker,
.cwd-filter-wrap {
  flex: 0 1 auto;
}

.cwd-result-count {
  flex-basis: 100%;
  min-height: 0;
  margin: 0;
  font-size: .9em;
  opacity: .78;
}

.cwd-result-count:empty {
  display: none;
}

.cwd-panel[hidden],
.cwd-filterable[hidden],
.cwd-category[hidden] {
  display: none !important;
}

.cwd-directory.cwd-custom-link-color a {
  color: var(--cwd-link-color);
}

.cwd-layout-columns {
  column-width: 24rem;
  column-gap: 2.25rem;
}

.cwd-layout-columns > .cwd-az,
.cwd-layout-columns > .cwd-no-results {
  column-span: all;
}

.cwd-layout-columns .cwd-author,
.cwd-layout-columns .cwd-title-list li {
  break-inside: avoid-column;
  -webkit-column-break-inside: avoid;
}

.cwd-layout-columns .cwd-letter-anchor {
  break-after: avoid-column;
}

.cwd-az {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin: .1rem 0 1.2rem;
}

.cwd-az a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: .15rem .35rem;
  border: 1px solid currentColor;
  border-radius: .2rem;
  text-decoration: none;
}

.cwd-letter-anchor {
  display: block;
  position: relative;
  top: -1rem;
  visibility: hidden;
}

.cwd-author,
.cwd-category {
  margin: 0 0 1.5rem;
}

.cwd-author-header {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
}

.cwd-avatar {
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}

.cwd-author-heading-wrap {
  min-width: 0;
  flex: 1 1 auto;
}

.cwd-heading {
  margin: 0 0 .4rem;
}

.cwd-permalink {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  margin-inline-start: .12em;
  font-size: .72em;
  font-weight: 400;
  opacity: 0;
  text-decoration: none;
  vertical-align: .05em;
}

.cwd-permalink-icon {
  display: block;
  width: .92em;
  height: .92em;
}

.cwd-permalink::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: calc(100% + .45rem);
  transform: translateX(-50%);
  padding: .3rem .45rem;
  border-radius: .2rem;
  background: #1d2327;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.cwd-heading:hover .cwd-permalink,
.cwd-heading:focus-within .cwd-permalink,
.cwd-permalink:focus {
  opacity: .7;
}

.cwd-permalink:hover,
.cwd-permalink:focus-visible {
  opacity: 1;
}

.cwd-permalink:hover::after,
.cwd-permalink:focus-visible::after {
  opacity: 1;
}

.cwd-copy-status {
  position: fixed;
  z-index: 99999;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  max-width: min(90vw, 30rem);
  padding: .65rem .9rem;
  border-radius: .35rem;
  background: #1d2327;
  color: #fff;
  box-shadow: 0 .2rem .8rem rgba(0, 0, 0, .24);
  font-size: .95rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, .5rem);
  transition: opacity .16s ease, transform .16s ease;
}

.cwd-copy-status.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.cwd-author-count,
.cwd-author-website,
.cwd-latest-work {
  margin: .2rem 0 .45rem;
  font-size: .92em;
}

.cwd-author-bio > :first-child {
  margin-top: .2rem;
}

.cwd-author-bio > :last-child {
  margin-bottom: .55rem;
}

.cwd-works {
  margin: .45rem 0 0;
  padding-inline-start: 1.5em;
  list-style-position: outside;
  list-style-type: disc;
}

.cwd-works li {
  margin: .22rem 0;
  padding-inline-start: .1em;
}

.cwd-work-meta {
  margin-left: .55rem;
  opacity: .78;
  font-size: .92em;
}

.cwd-category-tree,
.cwd-category-tree ul {
  list-style: none;
}

.cwd-category-tree {
  margin-left: 0;
  padding-left: 0;
}

.cwd-category-children {
  margin: .7rem 0 0 1.2rem;
  padding-left: 1rem;
  border-left: 1px solid currentColor;
}

.cwd-no-results {
  padding: .75rem 0;
}

.cwd-archive-profile {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin: 0 0 2rem;
}

.cwd-archive-profile h2 {
  margin-top: 0;
}

.cwd-archive-avatar {
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}

.cwd-archive-bio > :first-child {
  margin-top: 0;
}

.cwd-back-to-top {
  position: fixed;
  z-index: 999;
  inset-inline-end: 1rem;
  bottom: 1rem;
  inset-inline-end: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, calc(env(safe-area-inset-bottom) + 1rem));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  min-height: 44px;
  padding: .58rem .82rem;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  background: rgba(29, 35, 39, .94);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(.4rem);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.cwd-back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cwd-back-to-top[hidden] {
  display: none;
}

.cwd-back-to-top:hover {
  background: rgba(29, 35, 39, 1);
}

.cwd-back-to-top:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

.cwd-back-to-top-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

@media (hover: none) {
  .cwd-heading .cwd-permalink {
    opacity: .7;
  }

  .cwd-permalink::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cwd-copy-status,
  .cwd-back-to-top {
    transition: none;
  }
}

@media (max-width: 640px) {
  .cwd-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .cwd-controls > * {
    width: 100%;
  }

  .cwd-control {
    align-items: stretch;
  }

  .cwd-controls select,
  .cwd-controls input[type="search"] {
    width: 100%;
  }

  .cwd-work-meta {
    display: block;
    margin: .15rem 0 0;
  }

  .cwd-archive-profile {
    flex-direction: column;
  }
}
