.design-library {
  --library-ink: #172539;
  --library-muted: #4f5f72;
  --library-line: #d8dee7;
  --library-accent: #244886;
  color: var(--library-ink);
  background: #f5f6f8;
}

.library-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-block: 40px 28px;
}

.library-intro h1 {
  margin: 0 0 8px;
  color: var(--library-ink);
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.12;
  letter-spacing: -.055em;
}

.library-intro p, .library-help p {
  margin: 0;
  color: var(--library-muted);
  line-height: 1.55;
  word-break: keep-all;
}

.library-start {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  color: var(--library-accent);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.design-library .demo-catalogue { padding-block: 0 46px; }
.library-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  border-block: 1px solid var(--library-line);
  padding-block: 12px;
}

.library-start[hidden], .library-controls[hidden], .library-empty[hidden] { display: none; }
.design-library .screen-filters {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  gap: 7px;
  border: 0;
  padding: 0;
  margin: 0;
}

.design-library .screen-filter {
  flex: none;
  border: 1px solid var(--library-line);
  border-radius: 6px;
  padding: 7px 10px;
  min-height: 40px;
  background: #fff;
  color: var(--library-ink);
  font-size: 13px;
}

.design-library .screen-filter span { color: inherit; opacity: .8; }
.design-library .screen-filter:is(.is-active, [aria-pressed="true"]) {
  background: var(--library-accent);
  color: #fff;
  border-color: var(--library-accent);
}

.library-search {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 650;
}

.library-search input {
  width: clamp(180px, 20vw, 240px);
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--library-line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--library-ink);
  background: #fff;
  font: inherit;
  font-weight: 400;
}

.design-library .catalogue-status {
  color: var(--library-muted);
  margin: 16px 0 10px;
  padding: 0;
  font-size: 13px;
}

.design-library .catalogue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.design-library .template-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--library-line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 3px 12px #17253909;
}

.design-library .template-card[hidden] { display: none; }
.catalogue-preview {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1280 / 900;
  background: #e6ebf2;
  border-bottom: 1px solid var(--library-line);
}

.catalogue-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.catalogue-card-app .catalogue-preview { background: #e1e7ee; padding-top: 10px; }
.catalogue-card-app .catalogue-preview img { width: min(72%, 220px); height: auto; margin-inline: auto; }
.catalogue-preview > span {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 5px;
  background: #14253c;
  color: white;
  font-size: 12px;
  font-weight: 650;
}

.catalogue-preview:hover > span { background: #244886; }
.design-library .template-card figcaption {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 15px 16px 10px;
}

.design-library .template-card .catalogue-card-category {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  margin: 0 0 5px;
  color: var(--library-accent);
  font-size: 12px;
  font-weight: 700;
}

.catalogue-card-category span { color: var(--library-muted); font-weight: 500; }
.design-library .template-card h2 {
  margin: 0;
  color: var(--library-ink);
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: -.035em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.design-library .template-card .catalogue-card-features {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 0;
  margin: 7px 0 13px;
  list-style: none;
  color: var(--library-muted);
  font-size: 13px;
}

.design-library .catalogue-card-features li { margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; }
.design-library .demo-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--library-line);
}
.design-library .demo-card-actions a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1 0 auto;
  min-height: 44px;
  padding-inline: 8px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--library-accent);
}
.design-library .demo-card-actions a:first-child { background: var(--library-accent); color: #fff; }
.design-library .demo-card-actions a:first-child:hover { background: #193661; }

.design-library a:focus-visible, .design-library button:focus-visible, .design-library input:focus-visible {
  outline: 2px solid var(--library-accent);
  outline-offset: 2px;
}

.design-library .catalogue-preview:focus-visible { outline-offset: -4px; }
.library-empty { text-align: center; padding: 24px; border: 1px solid var(--library-line); background: #fff; }
.library-empty button, .library-help a { color: var(--library-accent); text-decoration: underline; text-underline-offset: 4px; }
.library-empty button { min-height: 44px; background: none; border: 0; cursor: pointer; font: inherit; }
.library-help { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-top: 26px; font-size: 13px; }

@media (max-width: 950px) { .design-library .catalogue-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 650px) {
  .library-intro { display: block; padding-block: 21px 9px; }
  .library-intro p { font-size: 14px; }
  .library-start { margin-top: 3px; }
  .library-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding-block: 8px; }
  .design-library .screen-filters { flex-wrap: nowrap; overflow-x: auto; padding: 3px 2px; scrollbar-width: thin; }
  .design-library .screen-filter { min-height: 44px; }
  .library-search input { width: 100%; min-height: 44px; font-size: 16px; }
  .library-search { display: grid; grid-template-columns: 65px minmax(0, 1fr); }
  .design-library .catalogue-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .design-library .catalogue-status { margin-block: 10px 7px; }
}
