/* ============================================================
   SkillMesh / 插台 — Global Styles
   ============================================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Noto Sans SC", sans-serif;
  background-color: #fafaf9;
  color: #1f2937;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  border-bottom: 1px solid rgba(229, 231, 235, 0.6);
  background: rgba(250, 250, 249, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.navbar-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-logo {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #111827;
}

.navbar-badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  background: #f3f4f6;
  color: #6b7280;
}

.navbar-lang {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.navbar-lang-sep {
  color: #d1d5db;
}

/* --- Language Button --- */
.lang-btn {
  font-size: 0.875rem;
  padding: 0.25rem 0.75rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #9ca3af;
}

.lang-btn:hover {
  color: #4b5563;
}

.lang-btn.active {
  color: #111827;
  font-weight: 600;
  border-bottom-color: #111827;
}

/* --- Main Content --- */
.main-container {
  max-width: 72rem;
  margin: 0 auto;
  padding: 5rem 1.5rem 4rem;
}

@media (max-width: 640px) {
  .main-container {
    padding: 3rem 1rem 2rem;
  }
}

/* --- Hero --- */
.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  color: #111827;
}

.hero-title-light {
  font-weight: 400;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: #6b7280;
  max-width: 36rem;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3rem;
  }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 1.75rem;
  }
  .hero-subtitle {
    font-size: 0.9375rem;
  }
}

/* --- Search --- */
.search-wrapper {
  max-width: 42rem;
  margin: 0 auto 2rem;
}

.search-container {
  position: relative;
}

.search-input {
  width: 100%;
  height: 3.5rem;
  padding: 0 3rem 0 1.5rem;
  font-size: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  outline: none;
  background: #ffffff;
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.search-input:focus {
  border-color: #d1d5db;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  color: #9ca3af;
  pointer-events: none;
}

.search-hint {
  text-align: center;
  font-size: 0.875rem;
  margin-top: 0.75rem;
  color: #9ca3af;
}

/* --- Category Filter --- */
.category-filter {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.category-chip {
  font-size: 0.8125rem;
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.category-chip:hover {
  border-color: #d1d5db;
  color: #374151;
}

.category-chip.active {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

/* --- Card Grid --- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- Card --- */
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.625rem;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  position: relative;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.card:focus-visible {
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
  border-color: #9ca3af;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.card-title {
  font-weight: 600;
  font-size: 1rem;
  color: #111827;
  line-height: 1.4;
}

.card-desc {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-stars {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.card-stars svg {
  width: 0.875rem;
  height: 0.875rem;
}

.card-usage {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* --- New Capability Badge --- */
.badge-new {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  background: #dbeafe;
  color: #1e40af;
  letter-spacing: 0.02em;
}

/* --- Endpoint Tags --- */
.endpoint-tag {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag-http {
  background: #dbeafe;
  color: #1e40af;
}
.tag-mcp {
  background: #d1fae5;
  color: #065f46;
}
.tag-command {
  background: #f3f4f6;
  color: #374151;
}
.tag-prompt {
  background: #fef3c7;
  color: #92400e;
}
.tag-workflow {
  background: #e0e7ff;
  color: #3730a3;
}

/* --- Endpoint Icons --- */
.endpoint-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 5rem 0;
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: #d1d5db;
}

.empty-title {
  font-size: 1.125rem;
  color: #9ca3af;
}

.empty-sub {
  font-size: 0.875rem;
  margin-top: 0.25rem;
  color: #d1d5db;
}

/* --- Loading Skeleton --- */
.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .skeleton-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.skeleton-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.625rem;
  padding: 1.5rem;
}

.skeleton-line {
  height: 0.75rem;
  background: #e5e7eb;
  border-radius: 0.25rem;
  margin-bottom: 0.75rem;
  animation: shimmer 1.5s infinite;
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
}

.skeleton-line:last-child {
  margin-bottom: 0;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-line.medium {
  width: 80%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* --- Modal Overlay --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-container {
  width: 100%;
  max-width: 36rem;
  max-height: 90vh;
  margin: 0 1rem;
  overflow-y: auto;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.modal-container.enter {
  opacity: 0;
  transform: scale(0.95);
}

.modal-container.enter-active {
  opacity: 1;
  transform: scale(1);
}

.modal-container.exit {
  opacity: 0;
  transform: scale(0.95);
}

.modal-card {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
  .modal-card {
    padding: 1.5rem;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
}

.modal-close-btn {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: #f3f4f6;
  color: #6b7280;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: #e5e7eb;
}

.modal-close-icon {
  width: 1rem;
  height: 1rem;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-section-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 0.375rem;
}

.modal-section-text {
  font-size: 0.875rem;
  line-height: 1.625;
  color: #374151;
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .modal-grid-2 {
    grid-template-columns: 1fr;
  }
}

.modal-endpoint-code {
  display: block;
  font-size: 0.8125rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: #f9fafb;
  color: #111827;
  font-family: "JetBrains Mono", "Courier New", monospace;
  word-break: break-all;
  overflow-x: auto;
  white-space: pre-wrap;
}

.modal-provenance-link {
  font-size: 0.875rem;
  color: #2563eb;
  text-decoration: underline;
  text-decoration-color: #d1d5db;
  text-underline-offset: 2px;
  word-break: break-all;
}

.modal-provenance-link:hover {
  text-decoration-color: #2563eb;
}

/* --- Feature Tags --- */
.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.feature-tag {
  font-size: 0.75rem;
  padding: 0.1875rem 0.625rem;
  border-radius: 0.25rem;
  background: #f3f4f6;
  color: #374151;
  white-space: nowrap;
}

/* --- Trust Vector (Modal) --- */
.trust-vector {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.trust-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.trust-row-label {
  font-size: 0.75rem;
  width: 5.5rem;
  flex-shrink: 0;
  color: #6b7280;
}

.trust-row-bar {
  flex: 1;
  height: 0.25rem;
  border-radius: 0.125rem;
  background: #e5e7eb;
  overflow: hidden;
}

.trust-row-fill {
  height: 100%;
  border-radius: 0.125rem;
  transition: width 0.3s ease;
}

.trust-row-value {
  font-size: 0.75rem;
  font-family: "JetBrains Mono", "Courier New", monospace;
  width: 2.5rem;
  text-align: right;
  color: #374151;
}

/* --- Evidence Bar (Modal) --- */
.evidence-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border-radius: 0.375rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.evidence-count {
  font-size: 0.8125rem;
  color: #374151;
}

.evidence-uncertainty {
  font-size: 0.8125rem;
  color: #6b7280;
  font-family: "JetBrains Mono", "Courier New", monospace;
}

/* --- Footer --- */
.site-footer {
  width: 100%;
  border-top: 1px solid #e5e7eb;
  background: #fafaf9;
}

.footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
  }
}

.footer-copy {
  font-size: 0.875rem;
  color: #9ca3af;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  font-size: 0.875rem;
  color: #9ca3af;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: #4b5563;
}

/* --- Animations --- */
.fade-in {
  animation: fadeIn 0.4s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Routing Section
   ============================================================ */
.routing-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.routing-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.routing-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.routing-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.routing-btn:active {
  background: #f3f4f6;
}

.routing-btn-code {
  color: #059669;
  border-color: #a7f3d0;
}

.routing-btn-code:hover {
  background: #ecfdf5;
  border-color: #34d399;
}

.routing-btn-try {
  color: #2563eb;
  border-color: #bfdbfe;
}

.routing-btn-try:hover {
  background: #eff6ff;
  border-color: #60a5fa;
}

.routing-btn-export {
  color: #7c3aed;
  border-color: #ddd6fe;
}

.routing-btn-export:hover {
  background: #f5f3ff;
  border-color: #a78bfa;
}

/* Routing Panels */
.routing-panel {
  margin-top: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  animation: fadeIn 0.2s ease;
}

.routing-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.routing-panel-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
}

.routing-panel-tabs {
  display: flex;
  gap: 0.25rem;
}

.routing-tab {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.25rem;
  border: 1px solid transparent;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.routing-tab.active {
  background: #fff;
  border-color: #d1d5db;
  color: #111827;
}

.routing-copy-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.routing-copy-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.routing-code {
  margin: 0;
  padding: 0.875rem;
  font-size: 0.75rem;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  background: #1e293b;
  color: #e2e8f0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
}

/* Code Tab Bars */
.code-tab-bar {
  display: flex;
  gap: 0.25rem;
}

/* Try-It Panel */
.try-it-note {
  padding: 0.875rem;
  font-size: 0.8125rem;
  color: #6b7280;
  text-align: center;
  background: #fefce8;
  border-bottom: 1px solid #fde68a;
  margin: 0;
}

.try-it-row {
  padding: 0.5rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.try-it-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
}

.try-it-select {
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: #fff;
  color: #111827;
  font-family: inherit;
  width: 120px;
}

.try-it-textarea {
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: #fff;
  color: #111827;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
  line-height: 1.5;
}

.try-it-textarea:focus,
.try-it-select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.try-it-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin: 0.5rem 0.875rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  background: #4f46e5;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.try-it-send-btn:hover {
  background: #4338ca;
}

.try-it-send-btn:active {
  background: #3730a3;
}

.try-it-result {
  border-top: 1px solid #e5e7eb;
}

.try-it-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.875rem;
  background: #f9fafb;
}

.try-it-result-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
}

.try-it-result-meta {
  font-size: 0.6875rem;
  color: #6b7280;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
}

/* Export Panel */
.export-options {
  padding: 0.625rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.export-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.export-option:hover {
  background: #f9fafb;
}

.export-radio {
  accent-color: #4f46e5;
}

.export-option-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #111827;
  flex: 1;
}

.export-option-desc {
  font-size: 0.6875rem;
  color: #9ca3af;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
}

.export-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem 0.875rem;
  border-top: 1px solid #e5e7eb;
}

.export-gen-btn,
.export-copy-btn {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.export-gen-btn {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}

.export-gen-btn:hover {
  background: #4338ca;
}

.export-copy-btn {
  background: #fff;
  color: #374151;
}

.export-copy-btn:hover {
  background: #f9fafb;
}

/* DSH Install Section */
.dsh-install-section {
  padding: 0.75rem 0.875rem;
  border-top: 1px solid #e5e7eb;
  background: #faf5ff;
}

.dsh-install-hint {
  margin: 0 0 0.625rem;
  font-size: 0.75rem;
  color: #6b21a8;
  font-weight: 500;
}

.dsh-install-commands {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dsh-install-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dsh-install-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dsh-install-code {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 0.375rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.hidden {
  display: none !important;
}
