/* =========================================================
   Directory reference components
   ---------------------------------------------------------
   Loaded only by the directory views (home, New, Top, search,
   category and topic) so the rest of the site keeps its current
   markup and styles. Everything here lives under the isolated
   .smp-dir root and adds no overrides to unrelated pages.

   Reused deliberately from app.css (they already implement the
   reference components): .feed-card, .lcard, .fav, .tag,
   .badge, .chip, .board, .row-item, .grid-listing, .directory,
   .filters, .dir-bar, .select, .view-switch, .empty-state,
   .pagination, .stats-strip and the button classes.

   Brand note: the reference orange is used for fills only. Text
   on it stays ink, and accent text on light surfaces uses the
   contrast-checked --accent-text token.
   ========================================================= */

.smp-dir {
  --smp-accent: #ff4f1a;
  --smp-accent-ink: #17140f;
  --smp-hi: #e4ff4f;
  --smp-hi-ink: #17140f;
  --smp-edge: #17140f;
}

[data-theme="dark"] body.layout-public .smp-dir,
body.layout-public[data-theme="dark"] .smp-dir {
  --smp-accent: #ff6a3d;
  --smp-accent-ink: #17140f;
  --smp-hi: #d9f24a;
  --smp-edge: #000000;
}

/* ---------- Hero ---------- */

.smp-dir .smp-hero {
  position: relative;
  padding: 56px 0 40px;
}

.smp-dir .smp-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.4;
  background-image: radial-gradient(var(--line-2) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 70% 58% at 30% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 58% at 30% 30%, #000 30%, transparent 75%);
}

.smp-dir .smp-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 48px;
  align-items: center;
}

.smp-dir .smp-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 3px 13px 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.smp-dir .smp-live {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 999px;
  background: var(--ok);
}

.smp-dir .smp-h1 {
  margin: 18px 0;
  font-family: var(--font-display);
  font-size: clamp(44px, 7vw, 88px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.98;
}

.smp-dir .smp-squiggle {
  position: relative;
  display: inline-block;
  color: var(--smp-accent);
}

.smp-dir .smp-squiggle svg {
  position: absolute;
  left: -2%;
  bottom: -0.1em;
  width: 104%;
  height: 0.26em;
  color: var(--smp-accent);
}

.smp-dir .smp-lede {
  max-width: 54ch;
  margin: 0 0 26px;
  color: var(--ink-2);
  font-size: clamp(16px, 1.5vw, 19px);
}

.smp-dir .smp-search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 620px;
  padding: 8px 8px 8px 18px;
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--edge);
}

.smp-dir .smp-lede b {
  color: var(--ink);
}

.smp-dir .smp-search__icon {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--muted);
}

.smp-dir .smp-search input {
  min-width: 0;
  min-height: 44px;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.smp-dir .smp-popular {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.smp-dir .smp-popular a {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 3px;
}

.smp-dir .smp-popular a:hover {
  color: var(--accent-text);
  text-decoration-color: var(--accent-text);
}

.smp-dir .smp-perks {
  display: flex;
  gap: 18px;
  margin-top: 26px;
  flex-wrap: wrap;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
}

.smp-dir .smp-perks span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.smp-dir .smp-perks svg {
  width: 16px;
  height: 16px;
  color: var(--ok);
}

/* ---------- Feed sticker and honest subline ---------- */

/* Section links carry a small arrow; without an explicit size the SVG
   falls back to its 300x150 default and opens a huge gap. */

.smp-dir .sec-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.smp-dir .sec-link svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.smp-dir .smp-feed {
  position: relative;
}

.smp-dir .smp-sticker {
  position: absolute;
  z-index: 4;
  right: -12px;
  top: -26px;
  display: grid;
  width: 100px;
  height: 100px;
  place-items: center;
  border: 1.5px solid var(--smp-edge);
  border-radius: 999px;
  background: var(--smp-hi);
  color: var(--smp-hi-ink);
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  transform: rotate(12deg);
  box-shadow: 0 2px 0 var(--smp-edge);
  pointer-events: none;
}

.smp-dir .feed-head {
  /* Keep the sticker clear of the heading text. */
  padding-right: 66px;
}

.smp-dir .smp-feed-note {
  display: block;
  max-width: 100%;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* Legacy "body.layout-public .feed-head > span" wins on class count, so the
   column layout needs the parent class in the selector as well. */
.smp-dir .feed-head > .smp-feed-heading {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.smp-dir .smp-feed-heading__title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.smp-dir .smp-feed-heading__title svg {
  width: 16px;
  height: 16px;
  color: var(--accent-text);
}

.smp-dir .smp-feed__when {
  flex: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.smp-dir .smp-feed__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.smp-dir .smp-feed__foot .btn {
  flex: 1;
}

/* ---------- Category tiles ---------- */

.smp-dir .smp-cat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.smp-dir .smp-cat {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.smp-dir .smp-cat__ico {
  display: grid;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 21px;
  line-height: 1;
}

.smp-dir .smp-cat__name {
  display: block;
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.22;
}

.smp-dir .smp-cat__count {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* ---------- Top board with creator rail ---------- */

.smp-dir .smp-board-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}

.smp-dir .smp-side {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 88px;
}

.smp-dir .smp-side-card {
  padding: 22px;
}

.smp-dir .smp-side-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.14;
}

.smp-dir .smp-side-card p {
  margin: 0 0 16px;
  color: var(--ink-2);
  font-size: 14px;
}

.smp-dir .smp-spot {
  position: relative;
  overflow: hidden;
  border-color: var(--line-2);
  background: var(--inverse-bg);
  color: var(--inverse-ink);
}

.smp-dir .smp-spot p {
  color: var(--inverse-muted);
}

.smp-dir .smp-spot .eyebrow {
  color: var(--smp-hi);
}

.smp-dir .smp-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}

.smp-dir .smp-tabs a {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.smp-dir .smp-tabs a[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* The starting allocation is real, so it is explained rather than
   dressed up as member activity. */
.smp-dir .smp-score-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.smp-dir .smp-score-note b {
  color: var(--ink-2);
  font-weight: 700;
}

/* ---------- Directory toolbar ---------- */

.smp-dir .smp-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 6px;
  scrollbar-width: none;
}

.smp-dir .smp-rail::-webkit-scrollbar {
  display: none;
}

.smp-dir .smp-rail .chip {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border-color: var(--line);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
}

.smp-dir .smp-rail .chip[aria-current="page"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

/* ---------- Compact filter rows ---------- */

.smp-dir .smp-filter-list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.smp-dir .smp-filter-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 6px 9px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 14px;
}

.smp-dir .smp-filter-list a:hover,
.smp-dir .smp-filter-list a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--ink);
}

.smp-dir .filters__block {
  display: grid;
  gap: 8px;
}

.smp-dir .filters__block h3 {
  margin-bottom: 0;
}

.smp-dir .smp-filter-list .count {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.smp-dir .smp-filter-list .ico {
  flex: none;
  font-size: 14px;
}

/* ---------- Creator call to action ---------- */

.smp-dir .smp-creator {
  position: relative;
  padding: clamp(28px, 5vw, 56px);
  border-radius: 28px;
  background: var(--smp-accent);
  color: var(--smp-accent-ink);
  overflow: hidden;
}

.smp-dir .smp-creator::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(23, 20, 15, 0.16) 1.2px, transparent 1.2px);
  background-size: 20px 20px;
}

.smp-dir .smp-creator > * {
  position: relative;
}

.smp-dir .smp-creator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  gap: 40px;
  align-items: center;
}

.smp-dir .smp-creator h2 {
  margin: 0 0 14px;
  color: var(--smp-accent-ink);
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 60px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.smp-dir .smp-creator .eyebrow {
  color: var(--smp-accent-ink);
}

.smp-dir .smp-creator p {
  max-width: 52ch;
  margin: 0 0 22px;
  color: var(--smp-accent-ink);
  font-size: 17px;
}

.smp-dir .smp-creator .btn-ink {
  background: #17140f;
  color: #ffffff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.smp-dir .smp-creator .btn-plain {
  border: 1.5px solid rgba(23, 20, 15, 0.45);
  background: transparent;
  color: var(--smp-accent-ink);
}

.smp-dir .smp-creator .btn-plain:hover {
  border-color: rgba(23, 20, 15, 0.75);
  background: rgba(255, 255, 255, 0.22);
}

.smp-dir .smp-steps {
  display: grid;
  gap: 12px;
}

.smp-dir .smp-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px;
  border: 1px solid rgba(23, 20, 15, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.28);
}

.smp-dir .smp-step .num {
  display: grid;
  width: 32px;
  height: 32px;
  flex: none;
  place-items: center;
  border-radius: 10px;
  background: #ffffff;
  color: #b9340e;
  font-family: var(--font-mono);
  font-weight: 750;
}

.smp-dir .smp-step strong {
  display: block;
  font-size: 16px;
}

.smp-dir .smp-step span {
  display: block;
  font-size: 14px;
}

/* ---------- Collections teaser ---------- */

.smp-dir .smp-coll-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.smp-dir .smp-ct {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.smp-dir .smp-mosaic {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-2);
}

.smp-dir .smp-mosaic .fav {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  font-size: 17px;
}

.smp-dir .smp-ct h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.smp-dir .smp-ct p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.smp-dir .smp-ct .by {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .smp-dir .smp-cat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1000px) {
  .smp-dir .smp-hero-grid,
  .smp-dir .smp-board-wrap,
  .smp-dir .smp-creator-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .smp-dir .smp-side {
    position: static;
  }

  .smp-dir .smp-coll-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .smp-dir .smp-cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .smp-dir .smp-hero {
    padding-top: 36px;
  }

  .smp-dir .smp-sticker {
    right: 4px;
    top: -22px;
    width: 84px;
    height: 84px;
    font-size: 12.5px;
  }

  .smp-dir .feed-head {
    padding-right: 82px;
  }
}

@media (max-width: 560px) {
  body.layout-public .smp-dir .grid-listing.is-list .lcard {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
  }

  body.layout-public .smp-dir .grid-listing.is-list .thumb-wrap {
    width: 76px;
    min-width: 76px;
  }

  body.layout-public .smp-dir .grid-listing.is-list .lcard-body {
    flex: 1;
  }

  .smp-dir .smp-cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .smp-dir .smp-search {
    flex-wrap: wrap;
    padding: 8px 8px 8px 14px;
  }

  .smp-dir .smp-search .btn {
    width: 100%;
  }
}
