/* ========================================
   Pockgin – Static Plugin Registry
   Theme: White + Blue, minimal modern
   ======================================== */

:root {
  --bg-primary: #FFFFFF;
  --bg-surface: #F8FAFC;
  --border-default: #E5E7EB;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --brand-primary: #0A84FF;
  --brand-primary-hover: #0070E0;
  --badge-success: #16A34A;
  --badge-warning: #F59E0B;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition-fast: 150ms ease;
  --max-width: 1200px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  background: var(--bg-surface);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
}
a:hover {
  color: var(--brand-primary-hover);
}

img {
  max-width: 100%;
  height: auto;
}

img.image-loading {
  background: linear-gradient(
    90deg,
    #eef2f7 0%,
    #e2e8f0 45%,
    #eef2f7 100%
  );
  background-size: 220% 100%;
  animation: imageShimmer 1.1s linear infinite;
}

@keyframes imageShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -20% 0; }
}

/* ---- Layout ---- */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.home-main {
  padding-top: 24px;
}

/* ---- Header ---- */

.site-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-default);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}
.site-logo img {
  width: 32px;
  height: 32px;
}
.site-logo:hover {
  color: var(--text-primary);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.header-nav a:hover {
  color: var(--brand-primary);
}

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

.hero {
  text-align: center;
  padding: 56px 24px 40px;
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.hero .subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ---- Search & Filter ---- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}
.search-box input::placeholder {
  color: var(--text-secondary);
}
.search-box input:focus {
  border-color: var(--brand-primary);
}
.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  pointer-events: none;
}

.sort-dropdown {
  position: relative;
}

.sort-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 160px;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}
.sort-trigger:hover {
  border-color: #d5d9e1;
}
.sort-trigger:focus {
  border-color: var(--brand-primary);
}
.sort-trigger svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.sort-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  box-shadow: var(--shadow-card-hover);
  padding: 6px;
  z-index: 30;
  display: none;
}
.sort-menu.open {
  display: block;
}

.sort-option {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.sort-option:hover {
  background: var(--bg-surface);
}
.sort-option.active {
  background: #eaf3ff;
  color: #005ec2;
}

.stats-bar {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ---- Plugin Grid ---- */

.plugin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}

/* ---- Plugin Card ---- */

.plugin-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}
.plugin-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 0;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-surface);
}

.card-title-area {
  flex: 1;
  min-width: 0;
}
.card-title-area h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 2px;
  line-height: 1.3;
}
.card-title-area h3 a {
  color: var(--text-primary);
}
.card-title-area h3 a:hover {
  color: var(--brand-primary);
}
.card-author {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.meta-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-featured {
  background: #DCFCE7;
  color: #166534;
}
.badge-unapproved {
  background: #FEE2E2;
  color: #991B1B;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
}
.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-primary-hover);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.btn-outline:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* ---- Loading / Empty ---- */

.loading,
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.loading .spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-default);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Plugin Detail ── */

.pd-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--border-default);
}

.pd-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
}

.pd-header-info { flex: 1; min-width: 0; }

.pd-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pd-name {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

.pd-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.pd-author a {
  color: var(--text-secondary);
  font-weight: 600;
}

.pd-author a:hover { color: var(--brand-primary); }

.pd-author-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-default);
}

.pd-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-top: 8px;
}

/* Layout */
.pd-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 40px;
  align-items: start;
  padding: 28px 0 60px;
}

.pd-main { min-width: 0; }

.pd-sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Sidebar cards */
.pd-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px;
}

.pd-card-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.pd-card-divider {
  height: 1px;
  background: var(--border-default);
  margin: 12px 0;
}

/* Install card */
.pd-install-version {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pd-ver-tag {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pd-ver-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.pd-dl-btn {
  width: 100%;
  justify-content: center;
  margin-top: 10px;
  font-size: 0.82rem;
  padding: 8px 14px;
}

/* Repo card */
.pd-repo-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  word-break: break-all;
}

.pd-repo-link svg { flex-shrink: 0; }

.pd-repo-link:hover { color: var(--brand-primary); }

.pd-repo-archive { margin-top: 8px; }

/* Stat list */
.pd-stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pd-stat-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  font-size: 0.84rem;
}

.pd-stat-list li + li {
  border-top: 1px solid var(--border-default);
}

.pd-stat-label { color: var(--text-secondary); }

.pd-stat-value {
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.pd-stat-link {
  text-decoration: none;
  color: var(--brand-primary);
}

.pd-stat-link:hover { text-decoration: underline; }

/* Dep list */
.pd-dep-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 6px 0 4px;
}

.pd-dep-label:first-child { margin-top: 0; }

.pd-dep-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.84rem;
  color: var(--text-primary);
}

.pd-dep-list li { margin-bottom: 2px; }

/* Main column sections */
.pd-section { margin-bottom: 32px; }

.pd-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-default);
}

.pd-readme-content {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 24px;
}

/* README Tab Bar */
.pd-readme-tabs-section {
  margin-bottom: 32px;
}

.pd-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.pd-tab {
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.pd-tab:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.pd-tab.active {
  background: var(--bg-primary);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  font-weight: 600;
}

.pd-tab-panel.hidden {
  display: none;
}

.pd-muted {
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 24px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
}

/* Accordion */
.pd-accordion-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.pd-accordion-btn:hover { background: var(--bg-surface); }

.pd-chevron {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.pd-accordion-btn[aria-expanded="true"] .pd-chevron { transform: rotate(180deg); }

.pd-accordion-body {
  display: none;
  padding-top: 8px;
}

.pd-accordion-body.open { display: block; }

/* Build rows */
.pd-build-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.pd-build-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Comments */
.pd-comments { margin-bottom: 0; }

/* Version channel badges */
.version-channel {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.channel-stable {
  background: #DCFCE7;
  color: var(--badge-success);
}

.channel-dev {
  background: #DBEAFE;
  color: #1D4ED8;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

/* ---- Markdown Content ---- */

.markdown-content {
  width: 100%;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.75;
}
.markdown-content p {
  margin: 0 0 12px;
}
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 16px 0 8px;
  color: var(--text-primary);
  line-height: 1.35;
}
.markdown-content h3 { font-size: 1.1rem; }
.markdown-content h4 { font-size: 1rem; }
.markdown-content h5 { font-size: 0.95rem; }
.markdown-content h6 { font-size: 0.9rem; }
.markdown-content ul {
  margin: 8px 0 12px 20px;
  padding: 0;
}
.markdown-content li {
  margin-bottom: 6px;
}
.markdown-content .markdown-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.markdown-content .markdown-checklist-item input[type="checkbox"] {
  margin-top: 3px;
}
.markdown-content .markdown-checklist-item span {
  flex: 1;
}
.markdown-quote {
  margin: 12px 0 16px;
  padding: 10px 14px;
  border-left: 3px solid #cbd5e1;
  background: #f8fafc;
  color: var(--text-secondary);
  border-radius: 8px;
}
.markdown-content hr {
  border: 0;
  border-top: 1px solid var(--border-default);
  margin: 16px 0;
}
.markdown-content a {
  color: var(--brand-primary);
  text-decoration: underline;
}
.markdown-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  background: #eef2f7;
  color: #0f172a;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.86em;
}
.markdown-content pre {
  margin: 10px 0 14px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
}
.markdown-content pre code {
  background: transparent;
  color: inherit;
  border-radius: 0;
  padding: 0;
}
.markdown-image-wrap {
  margin: 12px 0 16px;
}
.markdown-image {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: #fff;
}
.markdown-inline-badge {
  display: inline-block;
  max-height: 28px;
  width: auto;
  vertical-align: middle;
  margin: 0 2px;
  border: 0;
  background: transparent;
}
.markdown-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 12px 0 16px;
}
.markdown-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  background: #fff;
}
.markdown-table th,
.markdown-table td {
  border: 1px solid var(--border-default);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.markdown-table th {
  background: #f8fafc;
  color: var(--text-primary);
  font-weight: 600;
}
.markdown-table td {
  color: var(--text-secondary);
}

/* ---- Comments Section ---- */

.comments-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border-default);
  margin-bottom: 60px;
}
.comments-disabled {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
}

/* ---- Back Link ---- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding-top: 32px;
}
.back-link:hover {
  color: var(--brand-primary);
}
.back-link svg {
  width: 16px;
  height: 16px;
}

/* ---- Footer ---- */

.site-footer {
  text-align: center;
  padding: 32px 24px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-default);
  background: var(--bg-primary);
}

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

@media (max-width: 768px) {
  .home-main {
    padding-top: 20px;
  }
  .toolbar {
    align-items: stretch;
    gap: 10px;
    margin-top: 6px;
    margin-bottom: 22px;
  }
  .search-box {
    width: 100%;
    min-width: 0;
  }
  .sort-dropdown {
    width: 100%;
  }
  .sort-trigger {
    width: 100%;
    min-width: 0;
  }
  .sort-menu {
    left: 0;
    right: 0;
    min-width: 0;
  }
  .hero h1 {
    font-size: 1.75rem;
  }
  .hero .subtitle {
    font-size: 1rem;
  }
  .plugin-grid {
    grid-template-columns: 1fr;
  }
  .pd-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .pd-name-row { justify-content: center; }
  .pd-author { justify-content: center; }
  .pd-layout {
    grid-template-columns: 1fr;
  }
  .pd-sidebar {
    position: static;
    order: -1;
  }
  .header-nav {
    display: none;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  .plugin-card {
    padding: 18px;
  }
  .toolbar {
    flex-direction: column;
    margin-top: 8px;
  }
  .search-box {
    width: 100%;
  }
  .sort-trigger {
    padding: 11px 12px;
  }
}
