/* Creator Spotlight cards and Discover layout on staging. */
:is(html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid), html[data-ks-match-spotlight] #matchGrid) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.ks-compact-slot { position: relative; min-width: 0; display: grid; }
.ks-compact-slot:has(> a:focus-visible) { outline: 2px solid var(--ks-focus); outline-offset: 3px; border-radius: 12px; }
html[data-ks-design] :is(#recentGrid, #budgetGrid, #matchGrid) .ks-compact-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 274px;
  padding: 7px 8px;
  gap: 3px;
  border: 1px solid var(--ks-card-rim);
  border-radius: 12px;
  background: var(--ks-card-background, var(--ks-card-body));
  color: var(--ks-card-ink);
  box-shadow: var(--ks-card-frame, none);
  transform: none;
}
.ks-compact-card {
  --ks-card-body: #e6f2eb;
  --ks-card-rim: #497265;
  --ks-card-ink: #162522;
  --ks-card-panel: #24433a;
  --ks-card-values: #f7f5f0;
  --ks-card-muted: #d9e7df;
  --ks-card-badge: #cbe2d6;
  --ks-card-badge-ink: #162522;
  --ks-card-rule: #ffffff35;
  --ks-card-stars: #f7f5f0;
}
.ks-compact-card[data-tier="obsidian"] {
  --ks-card-body: #f9f3e8;
  --ks-card-rim: #aaa092;
  --ks-card-ink: #302921;
  --ks-card-panel: transparent;
  --ks-card-values: #302921;
  --ks-card-muted: #5e5245;
  --ks-card-rule: #cbbdab;
  --ks-card-badge: transparent;
  --ks-card-badge-ink: #302921;
}
.ks-compact-card[data-tier="bronze"] {
  --ks-card-body: #eac7ae;
  --ks-card-ink: #352014;
  --ks-card-rim: #784731;
  --ks-card-panel: #46271d;
  --ks-card-values: #fff2e7;
  --ks-card-muted: #f3dbc9;
  --ks-card-stars: #fbd4b3;
  --ks-card-badge: linear-gradient(#e7b994, #b77953);
  --ks-card-badge-ink: #351b0f;
  --ks-card-frame: inset 0 1px #fff8, inset 0 0 0 2px #bb825d;
  --ks-card-background: linear-gradient(0deg, var(--ks-card-body) 49%, transparent 86%),
    repeating-linear-gradient(0deg, transparent 0 10px, #a46d4f31 10px 11px),
    var(--ks-card-body);
}
.ks-compact-card[data-tier="silver"] {
  --ks-card-body: #e7ebed;
  --ks-card-ink: #222c33;
  --ks-card-rim: #63717a;
  --ks-card-panel: #303940;
  --ks-card-values: #f3f7fb;
  --ks-card-muted: #dbe5ed;
  --ks-card-stars: #e4edf6;
  --ks-card-badge-ink: #243039;
  --ks-card-frame: inset 1px 0 #fff, inset 0 0 0 2px #8999a4, inset 0 0 0 3px #fafcfdab;
}
.ks-compact-card[data-tier="gold"] {
  --ks-card-body: #f0dfb5;
  --ks-card-ink: #35230e;
  --ks-card-rim: #795429;
  --ks-card-panel: #352417;
  --ks-card-values: #fff2cf;
  --ks-card-muted: #fbebc1;
  --ks-card-stars: #ffe3a3;
  --ks-card-badge-ink: #2d1d0c;
  --ks-card-background:
    url('/brand/assessment/gold-corner-top-left.svg') left 4px top 4px no-repeat,
    url('/brand/assessment/gold-corner-top-right.svg') right 4px top 4px no-repeat,
    url('/brand/assessment/gold-corner-bottom-left.svg') left 4px bottom 4px no-repeat,
    url('/brand/assessment/gold-corner-bottom-right.svg') right 4px bottom 4px no-repeat,
    linear-gradient(var(--ks-card-body), var(--ks-card-body)) center / calc(100% - 8px) calc(100% - 8px) no-repeat,
    linear-gradient(#69431a, #e5bc5f 16%, #f7df9d 35%, #926223 49%, #eabd58 74%, #f8de99 91%, #613f19);
  --ks-card-frame: inset 0 0 0 2px #ddb667, inset 0 0 0 3px #745126;
}
.ks-compact-card[data-tier="diamond"] {
  --ks-card-body: #152c47;
  --ks-card-ink: #eef7ff;
  --ks-card-rim: #7b9bca;
  --ks-card-panel: #0b192c;
  --ks-card-values: #f2f8ff;
  --ks-card-muted: #cfdeee;
  --ks-card-stars: #d2e9ff;
  --ks-card-badge-ink: #f2f8ff;
  --ks-card-background:
    url('/brand/assessment/diamond-facet-top-left.svg') left top no-repeat,
    url('/brand/assessment/diamond-facet-bottom-right.svg') right bottom no-repeat,
    linear-gradient(var(--ks-card-body),var(--ks-card-body)) center / calc(100% - 8px) calc(100% - 8px) no-repeat,
    linear-gradient(126deg,#d6f3ff,#5289bb 19%,#172f59 33%,#beb7ff 56%,#465f95 82%,#b8e4ff);
  clip-path: polygon(10px 0,calc(100% - 10px) 0,100% 10px,100% calc(100% - 10px),calc(100% - 10px) 100%,10px 100%,0 calc(100% - 10px),0 10px);
}
@media (prefers-color-scheme: dark) {
  .ks-compact-card[data-tier="obsidian"] { --ks-card-body: #eee6d8; }
  .ks-compact-card[data-tier="bronze"] { --ks-card-body: #4a3025; --ks-card-ink: #fff1e5; --ks-card-panel: #36201a; }
  .ks-compact-card[data-tier="silver"] { --ks-card-body: #353a3e; --ks-card-ink: #f2f5f7; --ks-card-panel: #272d32; }
  .ks-compact-card[data-tier="gold"] { --ks-card-body: #4c3a23; --ks-card-ink: #fff2cf; --ks-card-panel: #2b1d13; }
  .ks-compact-card[data-tier="diamond"] { --ks-card-body: #11223a; --ks-card-panel: #0a1627; }
}

html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid) .ks-compact-card::before,
html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid) .ks-compact-card::after { content: none; }

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid) .ks-compact-card {
    transition: translate 150ms ease-out, box-shadow 150ms ease-out, border-color 150ms ease-out;
  }
  html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid) .ks-compact-card:hover { translate: 0 -2px; }
}

.ks-compact-brand, .ks-compact-identity { flex: none; text-align: center; }
.ks-compact-brand { display: grid; place-items: center; height: 24px; container-type: inline-size; }
.ks-compact-brand picture img { display: block; height: auto; }
.ks-compact-brand .ks-compact-brand-symbol { display: none; }
@container (width < 116px) {
  .ks-compact-brand .ks-compact-brand-wordmark { display: none; }
  .ks-compact-brand .ks-compact-brand-symbol { display: block; }
}

.ks-compact-portrait {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  height: 64px;
}
html[data-ks-design] :is(#recentGrid, #budgetGrid, #matchGrid) .ks-compact-card .portrait {
  box-sizing: border-box;
  grid-area: auto;
  justify-self: center;
  width: 64px;
  height: 64px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  border: 2px solid var(--ks-card-rim);
  border-radius: 12px;
  background: var(--ks-soft);
  color: var(--ks-forest);
}
html[data-ks-design] :is(#recentGrid, #budgetGrid, #matchGrid) .ks-compact-card[data-tier="obsidian"] .portrait { border: 0; }
.ks-compact-card .portrait img { border-radius: inherit; }
.ks-compact-card .ks-compact-portrait .verified {
  position: absolute;
  z-index: 1;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
}
.ks-compact-identity { min-width: 0; height: 39px; padding: 0 2px; }
html[data-ks-design] :is(#recentGrid, #budgetGrid, #matchGrid) .ks-compact-card h3 {
  display: -webkit-box;
  min-height: 28px;
  margin: 0;
  overflow: hidden;
  color: var(--ks-card-ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 14px;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
html[data-ks-design] :is(#recentGrid, #budgetGrid, #matchGrid) .ks-compact-card .handle {
  display: block;
  margin: 0;
  overflow: hidden;
  color: var(--ks-card-ink);
  font-size: 9.8px;
  line-height: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ks-compact-rating, .ks-compact-metrics {
  box-sizing: border-box;
  flex: none;
  padding: 2px 3px 4px;
  border-radius: 5px;
  background: var(--ks-card-panel);
  color: var(--ks-card-values);
  text-align: center;
}
.ks-compact-rating {
  display: grid;
  justify-items: center;
  align-content: start;
  height: 55px;
  color: #f7f5f0;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 12px;
}
.ks-compact-card[data-tier="obsidian"] .ks-compact-rating { color: var(--ks-card-muted); }
.ks-compact-tier {
  box-sizing: border-box;
  display: inline-flex;
  height: 17px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--ks-card-badge, transparent);
  color: var(--ks-card-badge-ink);
  text-transform: uppercase;
}
[data-tier="silver"] .ks-compact-tier {
  width: 53px; background: url('/brand/assessment/silver-nameplate.svg') center no-repeat;
}
[data-tier="gold"] .ks-compact-tier {
  width: 59px; background: url('/brand/assessment/gold-nameplate.svg') center no-repeat;
}
[data-tier="diamond"] .ks-compact-tier {
  width: 73px; background: url('/brand/assessment/diamond-nameplate.svg') center no-repeat;
}
.ks-compact-rating { container-type: inline-size; }
.ks-compact-rating .ks-rating-row {
  --ks-star-size: clamp(7.5px,calc((100cqw - 25px) / 5),12px);
  --ks-star-gap: 1px;
  margin-top: 2px;
  color: var(--ks-card-stars);
}
.ks-compact-rating .ks-rating-score { font-size: 9px; line-height: 12px; }
.ks-compact-rating .ks-rating-status { color: var(--ks-card-muted); font-size: 9.25px; line-height: 11px; font-weight: 500; }
.ks-compact-rating .ks-rating-status strong { color: var(--ks-card-values); font-size: 14px; line-height: 14px; }
.ks-compact-slot > .ks-rating-info { position: absolute; top: 151px; right: 9px; }
.ks-compact-metrics { display: grid; align-content: end; gap: 2px; height: 64px; }
.ks-compact-card[data-tier="obsidian"] .ks-compact-metrics {
  border-top: 1px solid var(--ks-card-rule);
  border-radius: 0;
}
.ks-compact-metrics > div:first-child, .ks-compact-secondary > div { display: grid; min-width: 0; }
.ks-compact-metrics small { color: var(--ks-card-muted); font-size: 10px; line-height: 11px; }
.ks-compact-metrics b { font-size: 22px; font-variant-numeric: tabular-nums; line-height: 22px; }
.ks-compact-secondary {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  border-top: 1px solid var(--ks-card-rule);
  padding-top: 1px;
}
.ks-compact-secondary > div + div { border-left: 1px solid var(--ks-card-rule); }
.ks-compact-secondary small { font-size: 9px; line-height: 10px; }
.ks-compact-secondary b { font-size: 11px; line-height: 12px; }

html[data-ks-design="discover"] #budgetGrid .ks-compact-card .card-package {
  display: flex;
  gap: 4px;
  margin: 2px 0 0;
  padding: 4px;
  border-radius: 5px;
  background: var(--ks-card-body);
}
html[data-ks-design="discover"] #budgetGrid .ks-compact-card .owner-listed-rate {
  margin: 0;
  padding: 0;
  color: var(--ks-card-ink);
  font-size: 11px;
  line-height: 14px;
  overflow-wrap: anywhere;
}
.ks-compact-freshness {
  margin: 0;
  padding: 2px 4px;
  border-radius: 5px;
  background: var(--ks-card-body);
  color: var(--ks-card-ink);
  font-size: 10px;
  line-height: 13px;
}

html[data-ks-design="discover"] .directory-filters :is(input, select):focus-visible {
  outline: 3px solid var(--ks-focus);
  outline-offset: 3px;
  box-shadow: none;
}

/* Keep the first card row close to the search and filter controls. */
html[data-ks-design="discover"] .hero { padding: 32px 40px; }
html[data-ks-design="discover"] .hero h1 { max-width: 650px; font-size: clamp(42px, 5vw, 48px); line-height: 1.085; }
.ks-hero-small { display: none; }
html[data-ks-design="discover"] #recent { margin: 24px 0 12px; }
html[data-ks-design="discover"] #recent .section-heading {
  min-height: 0;
  margin-bottom: 16px;
  padding-right: 0;
}
html[data-ks-design="discover"] #recent .section-heading .muted { margin: 0; }
html[data-ks-design="discover"] .ks-directory-toolbar { position: static; }
html[data-ks-design="discover"] .ks-scope-help summary { color: var(--ks-forest); }

@media (min-width: 1200px) {
  :is(html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid), html[data-ks-match-spotlight] #matchGrid) {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  :is(html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid), html[data-ks-match-spotlight] #matchGrid) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  :is(html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid), html[data-ks-match-spotlight] #matchGrid) .ks-compact-card {
    min-height: 259px;
    padding: 6px 6px 5px;
  }
  .ks-compact-portrait { height: 56px; }
  :is(html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid), html[data-ks-match-spotlight] #matchGrid) .ks-compact-card .portrait {
    width: 54px;
    height: 54px;
  }
  .ks-compact-identity { height: 41px; }
  :is(html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid), html[data-ks-match-spotlight] #matchGrid) .ks-compact-card h3 {
    min-height: 24px;
    font-size: 11px;
    line-height: 12px;
  }
  :is(html[data-ks-design="discover"] :is(#recentGrid, #budgetGrid), html[data-ks-match-spotlight] #matchGrid) .ks-compact-card .handle {
    margin-top: 2px;
    font-size: 8.5px;
    line-height: 10px;
  }
  .ks-compact-metrics { height: 58px; }
  .ks-compact-metrics small { font-size: 9.15px; line-height: 10px; }
  .ks-compact-metrics b { font-size: 20px; line-height: 19px; }
  .ks-compact-secondary small { font-size: 8.1px; line-height: 9px; }
  .ks-compact-secondary b { font-size: 10.15px; line-height: 11px; }
  .ks-compact-slot > .ks-rating-info { top: 144px; right: 5px; }
  html[data-ks-design="discover"] .hero { padding: 14px 24px; }
  html[data-ks-design="discover"] .hero h1 { margin-bottom: 12px; font-size: 28px; line-height: 32px; }
  html[data-ks-design="discover"] .hero-copy { margin-bottom: 12px; font-size: 14px; line-height: 20px; }
  html[data-ks-design="discover"] .hero .search { grid-template-columns: minmax(0, 1fr) auto; }
  html[data-ks-design="discover"] .hero .scope { padding-inline: 16px; }
  .ks-hero-wide { display: none; }
  .ks-hero-small { display: inline; }
  html[data-ks-design="discover"] #recent { margin-top: 16px; }
  html[data-ks-design="discover"] #recent .section-heading,
  html[data-ks-design="discover"] .ks-directory-toolbar { margin-bottom: 8px; }
  html[data-ks-design="discover"] .ks-directory-toolbar :is(.ks-control, .ks-platform a) { padding-inline: 8px; }
  html[data-ks-design="discover"] #refreshDiscovery { width: 44px; }
  html[data-ks-design="discover"] #refreshDiscovery span { display: none; }
}

html.ks-filter-open { overflow: hidden; }

.ks-mobile-filter {
  position: fixed;
  inset: auto 0 0;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  max-height: 86dvh;
  margin: 0;
  padding: 0 24px max(24px, env(safe-area-inset-bottom));
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--ks-white);
  color: var(--ks-ink);
  overscroll-behavior: contain;
}

.ks-mobile-filter::backdrop {
  background: #16252266;
  animation: ks-filter-backdrop-in 240ms ease-out both;
}

.ks-mobile-filter.ks-filter-closing::backdrop {
  animation: ks-filter-backdrop-out 220ms ease-out both;
}

@keyframes ks-filter-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ks-filter-backdrop-out { from { opacity: 1; } to { opacity: 0; } }

.ks-filter-grip {
  display: grid;
  place-items: center;
  height: 40px;
  cursor: grab;
  touch-action: none;
}

.ks-filter-grip span {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--ks-control-line);
}

.ks-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ks-filter-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 28px;
}

.ks-filter-fields { display: grid; gap: 12px; }
html[data-ks-design="discover"] .ks-mobile-filter .directory-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 0;
}

html[data-ks-design="discover"] .ks-mobile-filter .directory-filters > label {
  min-width: 0;
  max-width: none;
  color: var(--ks-muted);
}

html[data-ks-design="discover"] .ks-mobile-filter #directoryFilterForm {
  padding: 0;
  border: 0;
}

html[data-ks-design="discover"] .ks-mobile-filter #directoryFilterForm > .refresh {
  width: 100%;
  background: var(--ks-mint);
  border-color: transparent;
  color: var(--ks-forest);
}

@media (prefers-reduced-motion: reduce) {
  .ks-mobile-filter::backdrop,
  .ks-mobile-filter.ks-filter-closing::backdrop { animation: none; }
}
