/* /Designs library (Views/Designs/Index.cshtml): hero with search + activity chips, compact 4-5 column cards,
   sort tabs, "show more" and the empty-search help. Dark theme, uses the site's --kl-* tokens. */

/* Hero */
.kl-dl-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--kl-border);
  background:
    radial-gradient(900px 320px at 12% -10%, rgba(228, 69, 255, .22), transparent 60%),
    radial-gradient(700px 300px at 92% 0%, rgba(56, 189, 248, .16), transparent 60%),
    radial-gradient(600px 260px at 55% 120%, rgba(250, 204, 21, .10), transparent 60%),
    var(--kl-dark);
}

.kl-dl-hero-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 34px 24px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  grid-template-areas:
    "copy search"
    "chips chips";
  gap: 18px 40px;
  align-items: end;
}

.kl-dl-hero-copy { grid-area: copy; min-width: 0; }

.kl-dl-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, .35);
  background: rgba(250, 204, 21, .08);
  color: #fde68a;
  font-size: .78rem;
  font-weight: 700;
}

.kl-dl-hero h1 {
  margin: 12px 0 8px;
  font-size: clamp(1.7rem, 2.8vw, 2.45rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.02em;
  color: var(--kl-text);
}

.kl-dl-hero p {
  margin: 0;
  max-width: 640px;
  color: var(--kl-text-muted);
  font-size: 1rem;
  line-height: 1.55;
}

/* Search */
.kl-dl-search {
  grid-area: search;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
}

.kl-dl-search i { color: #6b7280; font-size: 1.05rem; }

.kl-dl-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #111827;
  font-size: .98rem;
  padding: 9px 4px;
}

.kl-dl-search input::placeholder { color: #9ca3af; }

.kl-dl-search button {
  border: 0;
  border-radius: 999px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--kl-primary), #a855f7);
  color: #fff;
  font-weight: 800;
  font-size: .92rem;
  cursor: pointer;
}

/* Activity chips */
.kl-dl-chips {
  grid-area: chips;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 6px;
}

.kl-dl-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--kl-border);
  background: rgba(255, 255, 255, .03);
  color: var(--kl-text) !important;
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.kl-dl-chip:hover { border-color: #55556a; background: rgba(255, 255, 255, .07); transform: translateY(-1px); }
.kl-dl-chip i { color: #c4b5fd; }
.kl-dl-chip small {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: var(--kl-text-muted);
  font-size: .72rem;
  font-weight: 700;
}

.kl-dl-chip.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--kl-primary), #a855f7);
  color: #fff !important;
}

.kl-dl-chip.is-active i,
.kl-dl-chip.is-active small { color: #fff; }
.kl-dl-chip.is-active small { background: rgba(255, 255, 255, .22); }

/* Toolbar */
.kl-dl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.kl-dl-result-count { color: var(--kl-text-muted); font-size: .88rem; font-weight: 600; }

.kl-dl-sort {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--kl-border);
  background: var(--kl-surface);
}

.kl-dl-sort a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--kl-text-muted) !important;
  font-size: .84rem;
  font-weight: 700;
  text-decoration: none !important;
}

.kl-dl-sort a:hover { color: var(--kl-text) !important; }
.kl-dl-sort a.is-active { background: var(--kl-surface-2); color: var(--kl-text) !important; box-shadow: inset 0 0 0 1px #3d3d4b; }

/* Grid + cards */
.kl-dl-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px 16px;
}

.kl-dl-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--kl-border);
  background: var(--kl-surface);
  color: var(--kl-text) !important;
  text-decoration: none !important;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.kl-dl-card:hover {
  transform: translateY(-3px);
  border-color: #4a4a5c;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
}

.kl-dl-card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  padding: 12px 14px;
  background: #f3efe6;
}

.kl-dl-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 4px 12px rgba(30, 20, 10, .18), 0 1px 2px rgba(30, 20, 10, .2);
  transition: transform .2s ease;
}

.kl-dl-card:hover .kl-dl-card-media img { transform: scale(1.025); }
.kl-dl-card-media > i { font-size: 2rem; color: #b8ad98; }

.kl-dl-card-pages {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(20, 20, 24, .82);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
}

.kl-dl-card-body {
  display: grid;
  gap: 4px;
  padding: 10px 12px 12px;
  min-width: 0;
}

.kl-dl-card-kind {
  color: #c4b5fd;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kl-dl-card h3 {
  margin: 0;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kl-dl-card-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--kl-text-muted);
  font-size: .76rem;
}

/* Show more */
.kl-dl-more-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 28px;
}

.kl-dl-progress { margin: 0; color: var(--kl-text-muted); font-size: .84rem; }

.kl-dl-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 26px;
  border-radius: 999px;
  border: 1px solid rgba(228, 69, 255, .55);
  background: rgba(228, 69, 255, .12);
  color: var(--kl-text) !important;
  font-weight: 800;
  text-decoration: none !important;
  transition: background .15s ease, transform .15s ease;
}

.kl-dl-more:hover { background: rgba(228, 69, 255, .22); transform: translateY(-1px); }
.kl-dl-more small { color: var(--kl-text-muted); font-weight: 600; }
.kl-dl-more.is-loading { opacity: .7; cursor: progress; }

.kl-dl-more--quiet {
  padding: 6px 12px;
  border: 0;
  background: none;
  color: var(--kl-text-muted) !important;
  font-weight: 600;
  font-size: .85rem;
}

.kl-dl-more--quiet:hover { background: none; color: var(--kl-text) !important; }

/* Sidebar: folded categories */
.kl-dl-more-categories summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 7px;
  color: #c4b5fd;
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.kl-dl-more-categories summary::-webkit-details-marker { display: none; }
.kl-dl-more-categories summary:hover { background: var(--kl-surface-2); }
.kl-dl-more-categories summary i { margin-left: auto; transition: transform .15s ease; }
.kl-dl-more-categories[open] summary i { transform: rotate(180deg); }
.kl-dl-more-categories .kl-dl-more-open { display: none; }
.kl-dl-more-categories[open] .kl-dl-more-open { display: inline; }
.kl-dl-more-categories[open] .kl-dl-more-closed { display: none; }

/* Empty search */
.kl-dl-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 44px 20px 36px;
  border-radius: 18px;
  border: 1px dashed #3d3d4b;
  background: var(--kl-surface);
  text-align: center;
}

.kl-dl-empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(228, 69, 255, .12);
  color: var(--kl-primary);
  font-size: 1.8rem;
}

.kl-dl-empty h2 { margin: 6px 0 0; font-size: 1.35rem; font-weight: 800; }
.kl-dl-empty p { margin: 0; color: var(--kl-text-muted); }

.kl-dl-didyoumean { font-size: 1.05rem; }
.kl-dl-didyoumean a { color: #f0abfc !important; font-weight: 800; text-decoration: underline !important; }

.kl-dl-empty-block { display: grid; gap: 10px; margin-top: 14px; width: min(100%, 720px); }
.kl-dl-empty-block h3 {
  margin: 0;
  color: var(--kl-text-muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.kl-dl-empty-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.kl-dl-empty-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--kl-border);
  background: var(--kl-surface-2);
  color: var(--kl-text) !important;
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none !important;
}

.kl-dl-empty-links a:hover { border-color: #55556a; }
.kl-dl-empty-links i { color: #c4b5fd; }
.kl-dl-empty-links small { color: var(--kl-text-muted); font-weight: 600; }

/* Responsive */
@media (max-width: 1360px) {
  .kl-dl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .kl-dl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .kl-dl-hero-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "search" "chips";
    padding: 24px 16px 16px;
    gap: 14px;
  }
}

@media (max-width: 640px) {
  .kl-dl-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 8px; scrollbar-width: none; }
  .kl-dl-chips::-webkit-scrollbar { display: none; }
  .kl-dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kl-dl-hero p { font-size: .92rem; }
  .kl-dl-search button { padding: 9px 14px; }
  .kl-dl-toolbar { flex-direction: column; align-items: stretch; }
  .kl-dl-sort { overflow-x: auto; }
  .kl-dl-sort a { white-space: nowrap; }
  .kl-dl-card-media { padding: 8px 10px; }
  .kl-dl-card h3 { font-size: .84rem; }
}
