/* The artwork is the gallery's focal point; its tools read like an index.
   Preserve native buttons/select, live counts and existing search handlers.
   Stable columns avoid label movement when the selection or counts change. */
#typewriterWorkshop .cw-community-page .cd-library .cd-library-toolbar {
  border-bottom: 0;
  padding-bottom: 8px;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-filters {
  display: grid;
  grid-template-columns: minmax(0, .55fr) minmax(0, 1.1fr) minmax(0, 1.2fr);
  width: 320px;
  max-width: 100%;
  min-width: 0;
  flex: none;
  gap: 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-filters > button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  min-height: 44px;
  padding: 10px 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--cw-community-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  text-decoration: none;
  box-shadow: none;
  /* Filtering is immediate, including when using the keyboard. */
  transition: none;
  animation: none;
  transform: none;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-filters > button[aria-pressed=true] {
  background: transparent;
  color: var(--cw-community-ink);
  font-weight: 600;
  text-decoration: none;
  box-shadow: none;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-filters > button[aria-pressed=true]::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 24px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  pointer-events: none;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-filters [data-count] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 16px;
  height: 20px;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--cw-community-muted);
  opacity: 1;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-filters > button[aria-pressed=true] [data-count] {
  color: var(--cw-community-muted);
  font-weight: 600;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-library-tools {
  gap: 8px 24px;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-sort {
  gap: 4px;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-sort select {
  width: 180px;
  border: 0;
  border-radius: 6px;
  padding-inline: 8px;
  background: transparent;
  box-shadow: none;
  transition: none;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-library-tools > .community-action-secondary {
  /* The shared action skin declares border !important. This single scoped
     reset removes it here without changing any product/purchase buttons. */
  border: 0 !important;
  border-radius: 6px;
  padding: 10px 0;
  gap: 8px;
  background: transparent;
  color: var(--cw-community-muted);
  box-shadow: none;
  font-weight: 500;
  transition: none;
  transform: none;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-library-tools > .community-action-secondary::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 4.5 4.5'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-library-tools > .community-action-secondary[aria-expanded=true] {
  background: transparent;
  color: var(--cw-community-ink);
  box-shadow: none;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

@media (hover: hover) and (pointer: fine) {
  #typewriterWorkshop .cw-community-page .cd-library .cd-filters > button:not([aria-pressed=true]):not(:disabled):hover {
    background: transparent;
    color: var(--cw-community-ink);
  }

  #typewriterWorkshop .cw-community-page .cd-library .cd-sort select:hover {
    background: var(--cw-community-hover);
  }

  #typewriterWorkshop .cw-community-page .cd-library .cd-library-tools > .community-action-secondary:not(:disabled):hover {
    background: transparent;
    color: var(--cw-community-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
  }
}

#typewriterWorkshop .cw-community-page .cd-library .cd-filters > button:not([aria-pressed=true]):not(:disabled):active {
  background: var(--cw-community-pressed);
  color: var(--cw-community-ink);
}

#typewriterWorkshop .cw-community-page .cd-library .cd-library-tools > .community-action-secondary:not(:disabled):active {
  background: var(--cw-community-pressed);
  color: var(--cw-community-ink);
  transform: none;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-filters > button:focus-visible {
  outline: 2px solid var(--cw-community-focus);
  outline-offset: 1px;
  box-shadow: none;
}

#typewriterWorkshop .cw-community-page .cd-library .cd-library-tools :is(select, button):focus-visible {
  outline: 2px solid var(--cw-community-focus);
  outline-offset: 3px;
  box-shadow: none;
}

/* A light field edge, not an outlined panel. Focus adds a soft elevation
   instead of doubling the full-width border with a dark inset stroke.
   Only transfer the input focus ring when the containing-field selector works.
   Clear and Close retain their own visible focus rings and 44px targets. */
#typewriterWorkshop .cw-community-page .cd-library .cd-search {
  border-color: var(--cw-community-rule);
  padding: 8px 14px;
  box-shadow: none;
}

@supports selector(:has(input:focus)) {
  #typewriterWorkshop .cw-community-page .cd-library .cd-search:has(input:focus) {
    border-color: #b8bec4;
    box-shadow: 0 2px 10px rgb(32 33 36 / 5%);
  }

  #typewriterWorkshop .cw-community-page .cd-library .cd-search input:focus {
    outline: none;
    box-shadow: none;
  }
}

@media (max-width: 820px) {
  #typewriterWorkshop .cw-community-page .cd-library .cd-library-toolbar {
    gap: 8px;
  }
}

@media (max-width: 620px) {
  #typewriterWorkshop .cw-community-page .cd-library .cd-library-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    width: 100%;
  }

  #typewriterWorkshop .cw-community-page .cd-library .cd-sort {
    min-width: 0;
    gap: 0;
    /* The select retains its full accessible name. Its value and chevron
       identify sorting on small screens without an extra label column. */
    font-size: 0;
  }

  #typewriterWorkshop .cw-community-page .cd-library .cd-sort select {
    width: 100%;
    min-width: 0;
    padding-inline: 4px;
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  #typewriterWorkshop .cw-community-page .cd-library .cd-filters > button {
    font-size: 13px;
  }
}

@media (forced-colors: active) {
  #typewriterWorkshop .cw-community-page .cd-library .cd-filters {
    background: Canvas;
  }

  #typewriterWorkshop .cw-community-page .cd-library .cd-filters > button[aria-pressed=true] {
    box-shadow: none;
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  #typewriterWorkshop .cw-community-page .cd-library .cd-filters > button[aria-pressed=true]::after {
    display: none;
  }

  @supports selector(:has(input:focus)) {
    #typewriterWorkshop .cw-community-page .cd-library .cd-search:has(input:focus) {
      outline: 2px solid Highlight;
      outline-offset: 2px;
    }
  }
}
