/* Useful Cat — ranked directory, cat-flavored */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f3f5f7;
  --border: #dfe3e8;
  --text: #17191c;
  --text-muted: #656b73;
  --text-faint: #959ca5;
  --accent: #17191c;
  --accent-hover: #34383e;
  --accent-soft: #e9edf1;
  --rank: #b5bbc3;
  --live: #2f9e6b;
  --claim: #2563eb;
  --claim-hover: #1d4ed8;
  --shadow-card:
    0 1px 2px rgba(23, 25, 28, 0.04),
    0 8px 24px rgba(23, 25, 28, 0.04);

  --tint-design: #f7f4f1;
  --tint-color: #f8f6ef;
  --tint-fonts: #f1f6f7;
  --tint-icons: #f3f2f8;
  --tint-dev: #f1f5f8;
  --tint-components: #f3f4f6;
  --tint-learn: #f1f6f3;
  --tint-productivity: #f6f2f7;
  --tint-fun: #f8f2f4;

  --font-display: "Manrope", "Segoe UI", sans-serif;
  --font-sans: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1,
h2 { text-wrap: balance; }

p,
.row-desc { text-wrap: pretty; }

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3.25rem 2rem 4rem;
}

/* ---------- HERO ---------- */

.hero { margin-bottom: 2.1rem; }

.hero-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.logo-row {
  display: flex;
  align-items: flex-end;
  position: relative;
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(2.35rem, 6vw, 3.45rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  margin: 0;
  color: var(--text);
  line-height: 0.9;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.cat-visual {
  display: flex;
  align-items: flex-end;
  margin-left: 10px;
  margin-bottom: -8px;
  transform: translateY(44px);
  transform-origin: bottom left;
  position: relative;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(28, 25, 20, 0.12));
}

.cat-loose {
  display: block;
  width: 124px;
  height: 124px;
  object-fit: contain;
}

.board-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.board-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--live);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  position: relative;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: var(--live);
  opacity: 0;
  transform: scale(0.5);
  animation: live-ping 1.8s ease-out infinite paused;
}

.board-live.is-visible .live-dot::after {
  animation-play-state: running;
}

@keyframes live-ping {
  0% { opacity: 0.35; transform: scale(0.5); }
  75%, 100% { opacity: 0; transform: scale(2); }
}

.tagline {
  margin: 0.85rem 0 0;
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 40rem;
  text-wrap: pretty;
}

.tagline span { display: block; }

/* ---------- TABS ---------- */

.tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: var(--surface-muted);
  margin-bottom: 1.75rem;
}

.tab {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 0.58rem 1rem;
  min-height: 40px;
  cursor: pointer;
  transition: color 0.15s ease-out, background-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(23, 25, 28, 0.1);
}

.pane[hidden] { display: none; }

/* ---------- LEADERBOARD ---------- */

.board-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.board-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.board-title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.4vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin: 0 0 0.45rem;
}

.board-lede {
  margin: 0;
  color: var(--text-muted);
  max-width: none;
  font-size: 0.95rem;
  white-space: nowrap;
}

.trophy-mark {
  display: inline-block;
  line-height: 1;
  transform: translateY(0.06em);
}

.cta {
  font-family: inherit;
  background: var(--text);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.72rem 1.2rem;
  border: 0;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  min-height: 44px;
  transition: background-color 0.15s ease-out, transform 0.15s ease-out;
}

.cta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.cta:active { transform: translateY(0) scale(0.96); }

.cta:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.banner {
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
  opacity: 1;
  transition: opacity 0.15s ease-out;
}

.banner.is-dismissing { opacity: 0; }

.banner[data-kind="cancel"],
.banner[data-kind="error"] {
  background: #fbe9e9;
  color: #9f2f37;
}

.rank-list {
  display: grid;
  gap: 0.2rem;
  list-style: none;
  margin: 0;
  padding: 1rem;
  background: var(--surface);
  border-radius: 18px;
  box-shadow:
    0 2px 4px rgba(23, 25, 28, 0.06),
    0 14px 32px rgba(23, 25, 28, 0.1),
    0 28px 64px rgba(23, 25, 28, 0.06);
}

.rank-row,
.tool-row {
  display: grid;
  grid-template-columns: 3.1rem 2rem minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 1rem 0.55rem;
  border-bottom: 0;
  border-radius: 12px;
  transition: background-color 0.12s ease-out;
}

.tool-row {
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  padding: 0.85rem 0.7rem;
  background: transparent;
  transform: translateY(0);
  transition: background-color 0.15s ease-out, transform 0.15s ease-out;
}

.rank-row:hover,
.rank-row:focus-visible { background: rgba(255, 255, 255, 0.7); }

.tool-arrow {
  align-self: center;
  color: var(--text-muted);
  font-size: 0.92rem;
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.tool-row:hover,
.tool-row:focus-visible {
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 1px 2px rgba(23, 25, 28, 0.08),
    0 8px 18px rgba(23, 25, 28, 0.08);
  transform: translateY(-1px);
}

.tool-row:hover .tool-arrow,
.tool-row:focus-visible .tool-arrow {
  opacity: 1;
  transform: translate(0, 0);
}

.tool-row .favicon { transition: transform 0.15s ease-out; }

.tool-row:hover .favicon,
.tool-row:focus-visible .favicon { transform: scale(1.04); }

.rank-row:hover .rank { color: var(--accent); }
.rank-row:hover .row-name,
.tool-row:hover .row-name { color: var(--accent); }

.rank {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--rank);
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}

.rank-row.is-top { background: var(--surface-muted); }

.rank-row.is-top .rank {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border-radius: 11px;
  background: #f5eccd;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08), 0 5px 14px rgba(17, 24, 39, 0.08);
  color: var(--text);
  font-size: 1.05rem;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

.favicon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 0;
  outline: 1px solid rgba(0, 0, 0, 0.1);
  outline-offset: -1px;
  background: var(--surface);
  flex-shrink: 0;
  margin-top: 2px;
  object-fit: contain;
  padding: 3px;
}

.row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.row-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.row-external {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.85rem;
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.rank-row:hover .row-external,
.rank-row:focus-visible .row-external {
  opacity: 1;
  transform: translate(0, 0);
}

.row-name {
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.row-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.row-meta {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 1rem;
  white-space: nowrap;
}

.row-bid,
.row-clicks {
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  font-size: 0.95rem;
}

.row-bid { color: var(--accent); }

.row-bid span,
.row-clicks span {
  display: block;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.badge {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
}

.empty-note,
.no-results {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.9rem;
  padding: 2.5rem 1rem;
  margin: 0;
}

/* ---------- CURATED ---------- */

.toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1rem 0.65rem 2.4rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-box input::placeholder { color: var(--text-faint); }

.search-box input:focus {
  border-color: var(--accent);
}

.search-box input::-webkit-search-cancel-button { cursor: pointer; }

.filter-pills {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  width: 100%;
}

.filter-pills.is-scrollable {
  mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
}

.filter-pills::-webkit-scrollbar { display: none; }

.pill {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  min-height: 40px;
  cursor: pointer;
  transition: background-color 0.12s ease-out, color 0.12s ease-out, border-color 0.12s ease-out;
}

.pill:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.pill.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.curated {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.curated-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.curated-column[hidden] { display: none; }

.bento {
  width: 100%;
  border-radius: 20px;
  border: 0;
  padding: 1.15rem 0.5rem 0.55rem;
  margin: 0;
  box-shadow: none;
}

.bento.design { background: var(--tint-design); }
.bento.color { background: var(--tint-color); }
.bento.fonts { background: var(--tint-fonts); }
.bento.icons { background: var(--tint-icons); }
.bento.dev { background: var(--tint-dev); }
.bento.components { background: var(--tint-components); }
.bento.learn { background: var(--tint-learn); }
.bento.productivity { background: var(--tint-productivity); }
.bento.fun { background: var(--tint-fun); }

.bento[hidden] { display: none; }

.bento h2 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 0.35rem;
  padding: 0 0.7rem;
  color: var(--text);
}

.tool-row[hidden] { display: none; }

/* ---------- MODAL ---------- */

.modal:not([open]) { display: none; }

.modal {
  width: min(760px, calc(100% - 2.5rem));
  max-height: calc(100dvh - 2rem);
  max-width: none;
  z-index: 20;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: auto;
}

.modal::backdrop {
  background: rgba(28, 25, 20, 0.38);
}

.modal-panel {
  position: relative;
  width: 100%;
  background: var(--surface);
  border-radius: 18px;
  padding: 2.25rem 2.25rem 2rem;
  box-shadow:
    0 0 0 1px rgba(28, 25, 20, 0.08),
    0 24px 50px -24px rgba(28, 25, 20, 0.35);
}

.modal-panel h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: -0.04em;
  margin: 0 0 0.4rem;
}

.modal-lede {
  margin: 0 3rem 2rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.modal-panel form {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background-color 0.15s ease-out, color 0.15s ease-out, transform 0.15s ease-out;
}

.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-close:active { transform: scale(0.96); }

.modal-panel label,
.amount-section > label {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.modal-panel input:not([type="file"]),
.modal-panel textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.78rem 0.9rem;
  outline: none;
  transition: border-color 0.15s ease-out;
}

.modal-panel textarea {
  min-height: 4.75rem;
  resize: none;
}

.modal-panel input:not([type="file"]):focus,
.modal-panel textarea:focus {
  border-color: var(--accent);
}

.amount-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.amount-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
}

.amount-input {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 52px;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: text;
  transition: border-color 0.15s ease-out;
}

.amount-input:focus-within {
  border-color: var(--accent);
}

.amount-input > span {
  color: var(--text-muted);
  font-size: 1.1rem;
  user-select: none;
}

.amount-input input:not([type="file"]) {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.amount-input input:not([type="file"]):focus { box-shadow: none; }

.placement-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  column-gap: 0.45rem;
  min-height: 52px;
  padding: 0 1.1rem 0 1.2rem;
  border: 0;
  border-radius: 12px;
  box-shadow: none;
  background: var(--claim);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease-out, transform 0.15s ease-out;
}

.placement-badge:hover:not(:disabled) { background: var(--claim-hover); }
.placement-badge:active:not(:disabled) { transform: scale(0.96); }

.placement-badge:disabled {
  background: var(--surface-muted);
  color: var(--text-faint);
  cursor: not-allowed;
  opacity: 0.68;
}

.placement-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.placement-result {
  margin: 0.1rem 0 0;
  font-weight: 600;
}

.amount-minimum { flex: 0 0 auto; }

.field-help,
.secure-note {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.84rem;
}

.thumbnail-input {
  width: 100%;
  min-height: 58px;
  padding: 0.45rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.thumbnail-input::file-selector-button {
  min-height: 42px;
  margin-right: 0.8rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.thumbnail-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.thumbnail-preview[hidden] { display: none; }

.thumbnail-preview img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  outline: 1px solid rgba(0, 0, 0, 0.1);
  outline-offset: -1px;
}

.form-error {
  margin: 0;
  color: #b42318;
  font-size: 0.82rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
  align-items: center;
}

.btn-ghost {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 0;
  padding: 0.72rem 0.9rem;
  min-height: 44px;
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.15s ease-out, transform 0.15s ease-out;
}

.btn-ghost:hover { color: var(--text); }
.btn-ghost:active { transform: scale(0.96); }

/* ---------- FOOTER ---------- */

.site-footer {
  margin-top: 4.5rem;
  padding: 0 2rem 2rem;
}

.footer-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  width: min(1216px, 100%);
  margin: 0 auto;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer-brand { color: var(--text); font-weight: 700; }
.footer-visitors { text-align: center; }
.footer-note { text-align: right; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ---------- RESPONSIVE ---------- */

@media (max-width: 980px) {
  .curated { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-lede { white-space: normal; }
}

@media (max-width: 680px) {
  .search-box,
  .filter-pills { flex: 0 0 auto; }
  .board-intro { align-items: stretch; }
  .board-actions { justify-content: space-between; }
  .cta { width: 100%; text-align: center; }
  .curated { grid-template-columns: 1fr; }
  .modal-panel { padding: 1.75rem 1.15rem 1.35rem; }
  .amount-row { grid-template-columns: 1fr; }
  .placement-badge { width: 100%; }
  .modal-actions { flex-direction: column; align-items: stretch; }
  .modal-actions .btn-ghost { order: 2; }
  .footer-line { grid-template-columns: 1fr; text-align: center; }
  .footer-visitors,
  .footer-note { text-align: center; }
}

@media (max-width: 560px) {
  .cat-visual {
    margin-left: 4px;
    transform: translateY(40px);
  }

  .tagline span { display: inline; }

  .tagline span + span::before { content: " "; }
  .cat-loose { width: 94px; height: 94px; }
  .page { padding: 2.5rem 1.15rem 3rem; }
  .hero-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .rank-row {
    grid-template-columns: 2.5rem 1.75rem minmax(0, 1fr) auto;
  }
  .rank-list { padding: 0.45rem; }
  .row-meta { flex-direction: column; gap: 0.15rem; }
  .row-clicks { display: none; }
  .logo { font-size: 2.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cta,
  .btn-ghost,
  .placement-badge,
  .modal-close,
  .tool-row,
  .tool-row .favicon,
  .tool-arrow,
  .row-external,
  .banner { transition-duration: 0.01ms; }
  .live-dot::after { animation: none; }
}
