:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #1a2230;
  --muted: #4b5563;
  --accent: #0a6cf1;
  --accent-soft: #e8f1fe;
  --chip-bg: #eef1f5;
  --caution: #b45309;
  --caution-bg: #fdf3e3;
  --ok: #15803d;
  --ok-bg: #e9f7ee;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);

  /* structural / typography tokens (palette unchanged) */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 28px; --space-7: 40px;
  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-base: 14px; --fs-lg: 15px; --fs-xl: 18px; --fs-2xl: 22px; --fs-3xl: clamp(24px, 3vw, 32px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

/* keyboard focus: consistent high-contrast ring (palette-neutral) */
:focus-visible {
  outline: 3px solid rgba(10, 108, 241, .55);
  outline-offset: 2px;
  border-radius: 4px;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 24px; padding: 12px 20px; max-width: 1080px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 18px; }
.brand-mark {
  background: linear-gradient(135deg, #0a6cf1, #2563eb);
  color: #fff; border-radius: 8px; padding: 2px 7px; font-size: 13px; letter-spacing: .5px;
}
.brand-dot { color: var(--accent); }
.site-nav { display: flex; gap: 18px; margin-left: auto; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.site-nav a:hover { color: var(--accent); }
.independence-badge {
  font-size: 11px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}

/* Hero */
.hero { padding: clamp(32px, 6vw, 56px) 0 clamp(24px, 4vw, 40px); background: linear-gradient(180deg, #fff 0%, var(--bg) 100%); border-bottom: 1px solid var(--border); }
.hero-inner { max-width: 760px; margin: 0 auto; text-align: center; padding: 0 20px; }
.hero-title { font-size: var(--fs-3xl); line-height: 1.15; margin: 0 auto 14px; letter-spacing: -.6px; font-weight: 700; max-width: 20ch; }
.hero-stats {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  gap: 8px 18px; margin: 0 auto 26px; color: var(--muted); font-size: var(--fs-md);
}
.hero-stat { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.hero-stat strong {
  color: var(--text); font-size: var(--fs-xl); font-weight: 650;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.3px;
}
.hero-stat-sep { color: #b6bfcc; }
.hero-search { max-width: 640px; margin: 0 auto; text-align: left; }
.hero-search #search-input { padding: 14px 18px 14px 44px; font-size: var(--fs-lg); }
.sort-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.search-box { position: relative; flex: 1; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
#search-input {
  width: 100%; padding: 13px 16px 13px 42px; font-size: var(--fs-base);
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  box-shadow: var(--shadow); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
#search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: #fff; }

/* Sections */
#directory { padding: 44px 20px 8px; max-width: 1080px; }
.section-head h2 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.2px; }
.section-note { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--chip-bg); color: var(--muted);
  border-radius: 999px; padding: 5px 13px; font-size: 13px; cursor: pointer; user-select: none;
  transition: all .15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.sort-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
#sort-select {
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px;
  background: var(--surface); color: var(--text); outline: none; cursor: pointer;
}
.result-meta { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* Plugin card grid */
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: stretch; }
/* main.js wraps each card in a <div style="--i:…"> animation-delay wrapper, which is the
   real grid item; make that wrapper a flex container and let the card stretch, so every
   card in a grid row is exactly equal height. */
.plugin-grid > div { display: flex; }
.plugin-card { flex: 1; min-height: 0; position: relative; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  width: 100%;
}
.plugin-card:hover { transform: translateY(-3px); border-color: #b9c8dc; box-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 14px 34px rgba(16, 24, 40, .10); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-title-wrap { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.rank-badge {
  flex: none; background: var(--accent); color: #fff; border-radius: 6px;
  padding: 2px 7px; font-size: var(--fs-xs); font-weight: 700; font-family: var(--font-mono);
  margin-top: 1px; letter-spacing: .3px;
}

/* ===== Ranking page ===== */
.ranking { display: flex; flex-direction: column; gap: 12px; }
.rank-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; box-shadow: var(--shadow);
}
.rank-row .rank-badge { font-size: var(--fs-sm); padding: 4px 9px; border-radius: 8px; }
.rank-main { min-width: 0; }
.rank-name { font-weight: 700; font-size: var(--fs-lg); color: var(--text); text-decoration: none; }
.rank-name:hover { color: var(--accent); }
.rank-cat { display: inline-block; margin-left: 8px; color: var(--accent); font-size: var(--fs-xs);
  background: var(--accent-soft); border-radius: 6px; padding: 1px 7px; font-weight: 600; vertical-align: middle; }
.rank-desc { margin: 3px 0 0; color: var(--muted); font-size: var(--fs-md); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rank-stars { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text);
  font-weight: 650; font-size: var(--fs-md); white-space: nowrap; }
.rank-install { display: flex; align-items: center; background: #101828; border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius-sm); overflow: hidden; max-width: 260px; }
.rank-install .prompt { width: 22px; flex: none; display: flex; align-items: center; justify-content: center;
  color: #5c86c4; background: rgba(255,255,255,.05); border-right: 1px solid rgba(255,255,255,.07);
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600; align-self: stretch; }
.rank-install code { flex: 1; min-width: 0; color: #d7e3f4; padding: 7px 4px 7px 9px; font-size: var(--fs-xs);
  font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-install .copy-btn { position: static; flex: none; margin: 0 4px; transform: none; }
/* top 3: amber highlight (reuse --ok/--caution grammar, no new hue) */
.rank-row.rank-top { border-color: #b9c8dc; }
.rank-row.rank-top:nth-child(1) .rank-badge { background: var(--caution); }
.rank-row.rank-top:nth-child(2) .rank-badge { background: var(--muted); }
.rank-row.rank-top:nth-child(3) .rank-badge { background: var(--ok); }
@media (max-width: 720px) {
  .rank-row { grid-template-columns: auto 1fr; }
  .rank-stars { grid-column: 2; }
  .rank-install { grid-column: 1 / -1; max-width: none; }
}
.card-title { font-size: var(--fs-lg); font-weight: 700; margin: 0; letter-spacing: -.2px; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent); }
/* stretched link: whole card clickable, but keep copy button / links interactive */
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card-top, .card-tags, .card-owner, .card-desc, .card-meta, .card-install, .card-links, .card-stars, .rank-badge { position: relative; z-index: 1; }
.card-owner { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; letter-spacing: .2px; margin-top: -4px; }
/* fixed 2-line description so every card has equal height on any column count:
   reserve 2 lines (min-height), clamp to 2 lines (line-clamp) */
.card-desc {
  font-size: var(--fs-base); color: var(--text); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: calc(2 * 1.55em);
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card-stars { color: var(--muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.card-date { color: var(--muted); font-size: 11.5px; font-weight: 500; margin-left: auto; font-variant-numeric: tabular-nums; }
.tag { font-size: var(--fs-xs); font-weight: 600; border-radius: 6px; padding: 2px 8px; }
.tag-cat { background: var(--accent-soft); color: var(--accent); }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-caution { background: var(--caution-bg); color: var(--caution); }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: var(--fs-sm); margin-top: -2px; font-variant-numeric: tabular-nums; }
/* bottom section (separator + links) pins to the card bottom for equal-height cards */
.card-sep { border-top: 1px solid var(--border); margin: 2px 0; margin-top: auto; }
/* terminal-style install command strip */
.card-install {
  position: relative; display: flex; align-items: center; margin-top: 2px;
  background: #101828; border: 1px solid rgba(255, 255, 255, .06); border-radius: var(--radius-sm);
  overflow: hidden;
}
.card-install .prompt {
  flex: none; width: 22px; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #5c86c4; font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 600;
  background: rgba(255, 255, 255, .05); border-right: 1px solid rgba(255, 255, 255, .07);
}
.card-install code {
  flex: 1; min-width: 0; display: block; color: #d7e3f4; padding: 9px 4px 9px 11px; font-size: var(--fs-sm);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; line-height: 1.5;
}
.copy-btn {
  border: 0; border-radius: 6px; padding: 5px 10px;
  background: rgba(255, 255, 255, .12); color: #cbd5e1; font-size: var(--fs-xs); cursor: pointer;
  font-family: var(--font-mono); transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.copy-btn:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.copy-btn.is-copied { background: var(--ok); color: #fff; font-weight: 600; }
.copy-btn.is-copied:hover { background: var(--ok); }
/* the on-card copy button lives in the command-strip flex flow (right side) so it
   never overlaps the code text; long commands truncate with an ellipsis */
.card-install .copy-btn { flex: none; margin: 0 6px 0 4px; }
.card-links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-md); align-items: center; }
.card-links a { color: var(--accent); text-decoration: none; font-weight: 500; }
.card-links a:hover { text-decoration: underline; }
.empty-state { text-align: center; padding: 48px 0; color: var(--muted); }
.empty-state p { margin: 4px 0; }
.muted { color: var(--muted); font-size: var(--fs-md); }

/* Card entrance stagger (initial load / discrete filter actions only) */
.card-anim .plugin-card { animation: card-in .38s ease both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Ecosystem */
.ecosystem { padding: 48px 20px 64px; max-width: 1080px; }
.eco-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.eco-card { background: var(--surface); border: 1px dashed #c9d4e4; border-radius: var(--radius); padding: 18px; }
.eco-card h3 { margin: 0 0 4px; font-size: 15px; }
.eco-card h3 a { color: var(--text); text-decoration: none; }
.eco-card h3 a:hover { color: var(--accent); }
.eco-card .card-owner { margin-bottom: 8px; }
.eco-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 10px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 32px 0 40px; }
.disclaimer { font-size: 14px; color: var(--text); max-width: 820px; }
.footer-meta { font-size: 13px; color: var(--muted); max-width: 860px; margin-top: 8px; }
.footer-meta a { color: var(--accent); text-decoration: none; }

@media (max-width: 640px) {
  .independence-badge { display: none; }
  .hero { padding: 36px 0 30px; }
}

/* ===== Bilingual directory ===== */
.lang-switch {
  font-size: 12px; font-weight: 700; color: var(--accent); text-decoration: none;
  border: 1px solid var(--accent); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.lang-switch:hover { background: var(--accent-soft); }

/* ===== Detail pages ===== */
.detail-page { padding: 32px 20px 64px; max-width: 880px; }
.back-link { margin: 0 0 14px; }
.back-link a { color: var(--muted); text-decoration: none; font-size: var(--fs-md); }
.back-link a:hover { color: var(--accent); }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.detail-card h1 { font-size: 26px; margin: 0 0 12px; letter-spacing: -.4px; line-height: 1.25; }
.detail-name-zh { font-weight: 500; color: var(--muted); font-size: 17px; margin-left: 8px; }
.detail-block { margin-top: 26px; }
.detail-block h2 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 10px; font-weight: 650; }
.detail-block p { margin: 0; font-size: var(--fs-base); line-height: 1.65; }
.caution-box, .note-box, .notice-box {
  margin-top: 20px; border-radius: 10px; padding: 13px 15px; font-size: var(--fs-base); line-height: 1.6;
}
.caution-box { background: var(--caution-bg); border: 1px solid #f2d9b8; color: #7c3d00; }
.note-box { background: #f1f5f9; border: 1px solid var(--border); color: var(--muted); }
.notice-box { background: var(--accent-soft); border: 1px solid #c9dcf8; color: #1e4e8c; }
.detail-facts { margin: 0; display: grid; grid-template-columns: 180px 1fr; gap: 0; }
.detail-facts dt {
  font-size: var(--fs-xs); font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .4px;
  padding: 11px 14px 11px 0; border-bottom: 1px solid #eef1f5; line-height: 1.5;
}
.detail-facts dd { margin: 0; padding: 11px 0; border-bottom: 1px solid #eef1f5; font-size: var(--fs-base); word-break: break-word; line-height: 1.6; }
.detail-facts dd a { color: var(--accent); text-decoration: none; }
.detail-facts dd a:hover { text-decoration: underline; }
.detail-facts dt:last-of-type, .detail-facts dd:last-of-type { border-bottom: 0; }
.install-code {
  display: inline-block; background: #101828; color: #d7e3f4; border-radius: 6px;
  padding: 5px 9px; font-size: var(--fs-sm); overflow-x: auto; white-space: nowrap; max-width: 100%;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.evidence-note { color: var(--muted); font-size: var(--fs-sm); display: inline-block; margin-top: 4px; line-height: 1.5; }

/* ===== Ecosystem page ===== */
.page-body { padding: 36px 20px 64px; max-width: 960px; }
.page-body h1 { font-size: 26px; margin: 0 0 8px; }
.lead { font-size: 15px; color: var(--muted); max-width: 720px; margin: 0 0 30px; }
.eco-section { margin-bottom: 34px; }
.eco-section h2 { font-size: 17px; margin: 0 0 14px; }

/* ===== Submit page ===== */
.submit-guide { font-size: var(--fs-base); line-height: 1.6; max-width: 720px; margin: 4px 0 24px; color: var(--text); }
.issue-template { position: relative; margin-top: 10px; }
.issue-template code {
  display: block; background: #101828; color: #d7e3f4; border-radius: 10px;
  padding: 16px; font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}
.issue-template .copy-btn { position: absolute; top: 8px; right: 8px; }
.checklist { margin: 10px 0 0; padding-left: 20px; font-size: 14px; color: var(--text); }
.checklist li { margin: 6px 0; }

/* PH-style submission form + live preview */
.submit-flow { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 28px; align-items: start; margin-top: 8px; }
.submit-form { display: flex; flex-direction: column; gap: 10px; }
.submit-form-title { font-size: 17px; margin: 0 0 2px; }
.submit-privacy { margin: 0 0 8px; }
.field-label { font-size: var(--fs-md); font-weight: 600; color: var(--text); margin-top: 4px; }
.field {
  width: 100%; padding: 10px 12px; font-size: var(--fs-base); font-family: var(--font-sans);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
textarea.field { resize: vertical; }
.form-errors {
  background: var(--caution-bg); border: 1px solid #f2d9b8; color: #7c3d00;
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: var(--fs-sm); line-height: 1.5; margin-top: 4px;
}
.submit-btn { align-self: flex-start; margin-top: 6px; }
.submit-preview { position: sticky; top: 76px; }
.submit-preview h3 { font-size: 15px; margin: 0 0 2px; }
.submit-preview-note { font-size: var(--fs-sm); margin: 0 0 12px; }
.preview-card .card-install { margin-top: 10px; }
.submit-result { scroll-margin-top: 20px; }
.submit-instruct { margin-top: 10px; }
.submit-pending { margin-top: 12px; }
.submit-remember { margin-top: 16px; }
.submit-review h2 { margin-bottom: 10px; }
@media (max-width: 820px) {
  .submit-flow { grid-template-columns: 1fr; gap: 24px; }
  .submit-preview { position: static; }
  .submit-preview { order: -1; }
}

/* ===== Search form (hero + category pages) ===== */
.search-form { display: flex; gap: 10px; align-items: stretch; max-width: 620px; }
.search-form .search-box { flex: 1; max-width: none; }
.search-btn {
  border: 0; border-radius: 10px; padding: 0 20px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s ease;
}
.search-btn:hover { background: #095cd0; }

/* ===== Discover sort tabs (tab buttons; container lives in Hero) ===== */
.sort-tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 6px 16px; font-size: var(--fs-md); cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  font-weight: 500;
}
.sort-tab:hover { border-color: var(--accent); color: var(--accent); }
.sort-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ===== Header persistent search ===== */
.header-search { display: flex; align-items: center; gap: 6px; }
.header-search input {
  width: 150px; padding: 6px 10px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.header-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.header-search button {
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 8px; padding: 6px 11px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.header-search button:hover { background: #095cd0; }

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); margin: 0 0 14px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.crumb-sep { color: var(--muted); }
.crumb-current { color: var(--text); font-weight: 600; }

/* ===== Detail page CTA group ===== */
.cta-group { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 14px; }
.cta-btn, .cta-link {
  border-radius: var(--radius-sm); padding: 8px 16px; font-size: var(--fs-md); font-weight: 600;
  text-decoration: none; cursor: pointer; line-height: 1.4;
}
.cta-btn { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
.cta-btn:hover { background: #095cd0; }
.cta-btn:active { transform: translateY(1px); }
.cta-link { border: 1px solid var(--border); background: var(--surface); color: var(--accent); display: inline-block; }
.cta-link:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ===== Category pages ===== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.cat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; text-decoration: none; color: var(--text);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  box-shadow: var(--shadow); transition: border-color .15s ease, transform .15s ease;
}
.cat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cat-name { font-weight: 700; font-size: var(--fs-base); }
.cat-card:hover .cat-name { color: var(--accent); }
.cat-count { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cat-lead-note { margin: 0 0 20px !important; max-width: 720px; }

/* ===== Category pages: stacked toolbar on mobile ===== */
@media (max-width: 720px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-form, .search-form .search-box { max-width: none; width: 100%; }
  .sort-label { justify-content: space-between; }
  .header-search { order: 5; width: 100%; }
  .header-search input { flex: 1; width: auto; }
  .cat-grid { grid-template-columns: 1fr; }
}

/* ===== Responsive card grid: desktop multi-column, tablet 2, mobile 1 ===== */
@media (max-width: 960px) {
  .plugin-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .toolbar { flex-direction: row; align-items: center; justify-content: flex-start; }
  .search-form, .search-form .search-box { max-width: none; }
  .sort-label { justify-content: flex-start; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

  /* header keeps exactly 2 rows on mobile:
     row 1 = brand + compact search + lang-switch; row 2 = full-width nav */
  .header-inner { flex-wrap: wrap; gap: 8px 14px; padding: 10px 16px; }
  .brand { margin-right: auto; }
  .header-search { order: 0; margin-left: auto; justify-content: flex-end; }
  .header-search input { width: 128px; }
  .brand-name { font-size: 16px; }
  .site-nav { order: 2; width: 100%; margin-left: 0; gap: 16px; padding-top: 6px; border-top: 1px solid var(--border); }
  .site-nav a { font-size: 14px; }
}

@media (max-width: 480px) {
  .header-search input { width: 96px; }
  .header-search button { padding: 6px 8px; font-size: 11px; }
}

@media (max-width: 640px) {
  .plugin-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 6px 12px; justify-content: flex-start; }
  .detail-facts { grid-template-columns: 1fr; }
  .detail-facts dt { padding-bottom: 0; border-bottom: 0; }
  .detail-facts dd { padding-top: 3px; }
  .detail-card { padding: 22px 18px; }
  .page-body, .detail-page { padding-top: 24px; }
  .lang-switch { display: none; }
  /* on phones keep the command on one line and truncate with an ellipsis so the
     Copy button stays right, never overlapping the text */
  .card-install code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 9px 4px 9px 11px; }
}

/* ===== Minimal mobile (<= 360px) ===== */
@media (max-width: 360px) {
  .cta-btn, .cta-link { padding: 8px 12px; font-size: 12px; }
  .brand-name { font-size: 15px; }
  .site-nav { gap: 12px; }
}

/* ===== Reduced motion: keep interactions, drop animation ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card-anim .plugin-card { animation: none; }
  .plugin-card { transition: none; }
  #search-input, .search-btn, .sort-tab, .chip { transition: none; }
}
