.pattern-intro {
  background: radial-gradient(ellipse at 78% 10%, #2d6558, #183b38 68%);
  color: white;
}
.pattern-intro-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem 2rem;
  padding-block: clamp(2rem, 5vw, 3.8rem);
}
.guide-link {
  color: #c6f3da;
  font-weight: 650;
  text-underline-offset: .2em;
}
.pattern-intro h1 {
  margin-block: .65rem;
  font-size: clamp(2.5rem, 6vw, 4.7rem);
  letter-spacing: -.055em;
  line-height: 1;
}
.pattern-intro p {
  max-width: 52ch;
  color: #e4f4ed;
  line-height: 1.55;
}
.pattern-key {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.2rem;
  font-size: .93rem;
}
.pattern-key span {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.pattern-key i {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  aspect-ratio: 1;
  border-radius: .26rem;
  background: #b8efd4;
  color: #183b38;
  font-style: normal;
  line-height: 1;
}
.pattern-library {
  padding-block: clamp(1.5rem, 4vw, 2.75rem) 4rem;
}
.library-tools {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: .55rem .65rem;
  padding: .6rem .35rem .65rem;
  margin-bottom: 1.1rem;
  background: #fcfaff;
  border-block-end: 1px solid #b1c4ba;
  box-shadow: 0 .3rem .45rem -.35rem #183b385c;
}
.pattern-filter {
  min-width: 0;
  max-width: 25rem;
}
.pattern-categories {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.pattern-categories button {
  padding: .35rem .7rem;
  border: 1px solid #a7b9b0;
  border-radius: 2rem;
  background: white;
  color: #194b38;
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
}
.pattern-categories button[aria-pressed="true"] {
  background: #19583f;
  border-color: #19583f;
  color: white;
  font-weight: 700;
}
.pattern-categories button:focus-visible {
  outline: 2px solid #19583f;
  outline-offset: 2px;
}
.pattern-search-label {
  display: block;
  font-weight: 700;
}
.search-field {
  display: flex;
  overflow: hidden;
  border: 1px solid #a7b9b0;
  border-radius: .65rem;
  background: white;
}
.search-field:focus-within {
  outline: 2px solid #217356;
  outline-offset: 2px;
}
.search-field input, .search-field button {
  min-height: 2.8rem;
  border: 0;
  font: inherit;
}
.search-field input {
  flex: 1;
  min-width: 0;
  padding: .55rem .85rem;
  background: transparent;
  color: inherit;
}
.search-field input:focus {
  outline: none;
}
.search-field input::-webkit-search-cancel-button {
  appearance: none;
}
.search-field button {
  padding-inline: .9rem;
  color: #155139;
  background: #e6f6ed;
  font-weight: 650;
  cursor: pointer;
}
.search-field button:focus-visible {
  outline: 2px solid #155139;
  outline-offset: -4px;
}
#pattern-count {
  margin-block: .4rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pattern-grid {
  /* Filtered cards can disappear or change rows while the search field stays in place. */
  overflow-anchor: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr));
  gap: clamp(.6rem, 1.5vw, 1.1rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.pattern-card {
  scroll-margin-top: 10rem;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: .25rem;
  padding: 1.2rem .7rem 1rem;
  border: 1px solid #d8e4dd;
  border-radius: .85rem;
  background: white;
  text-align: center;
}
.pattern-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  width: min(100%, 7.7rem);
  margin-bottom: .65rem;
}
.pattern-board i {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid #bed1c6;
  border-radius: 3px;
  background: #f0f6f2;
  font-size: clamp(.7rem, 1.3vw, .9rem);
  font-style: normal;
  line-height: 1;
}
.pattern-board .target {
  border-color: #21654f;
  background: #21654f;
  color: white;
}
.pattern-card h2 {
  font-size: clamp(1rem, 2vw, 1.15rem);
  font-weight: 730;
  line-height: 1.25;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}
.pattern-card p {
  color: var(--muted);
  font-size: .9rem;
}
.pattern-card .official-name {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 500;
}
.pattern-card a {
  padding-block: .3rem;
  color: #155139;
  font-weight: 650;
  text-underline-offset: .18em;
}
.empty-results {
  padding-block: 2rem;
  color: var(--muted);
}
.pattern-library [hidden] {
  display: none;
}
@media (max-width: 30rem) {
  .pattern-card {
    scroll-margin-top: 12rem;
  }
  #pattern-count {
    max-width: 6.4rem;
    margin-block: 0;
    font-size: .91rem;
    text-align: right;
  }
  .pattern-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pattern-board {
    width: min(100%, 6.9rem);
  }
}
@media (max-height: 26rem) {
  .library-tools {
    position: static;
  }
  .pattern-card {
    scroll-margin-top: 1rem;
  }
}
@media (forced-colors: active) {
  .pattern-board i, .pattern-key i {
    forced-color-adjust: none;
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
  }
  .pattern-board .target, .pattern-key i {
    border-color: Highlight;
    background: Highlight;
    color: HighlightText;
  }
}
