.filters-section {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.loading-state {
  margin: 2rem 0;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2.5rem;
}

.skeleton-card {
  background: var(--vp-c-bg);
  border: 1px solid var(--vp-c-border);
  border-radius: 1rem;
  overflow: hidden;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.skeleton-image {
  aspect-ratio: 2 / 1;
  background: var(--vp-c-bg-mute);
}

.skeleton-content {
  padding: 1.75rem;
}

.skeleton-line {
  height: 1rem;
  background: var(--vp-c-bg-mute);
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
}

.skeleton-line.short {
  width: 60%;
}

.error-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--vp-c-text-2);
}

.error-state h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--vp-c-text-1);
  margin-bottom: 0.75rem;
}

.load-more-container {
  text-align: center;
  margin-top: 4rem;
  padding: 2.5rem;
}

.loading-more-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  color: var(--vp-c-text-2);
  font-size: 0.9375rem;
  font-weight: 500;
}

.loading-more-indicator .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--vp-c-border);
  border-top-color: var(--vp-c-brand-1);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.resource-page {
  padding: 3rem 0 0;
  min-height: calc(100vh - 200px);
  background: var(--vp-c-bg);
}

/* Align back-link with page content */
.resource-header-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: var(--vp-c-text-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color 0.2s;
  padding-left: 0;
}

.back-link:hover {
  color: var(--vp-c-brand-1);
}

.resource-detail {
  max-width: 1280px;
  margin: 0 auto;
}

.resource-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
  padding: 1.5rem 0 2rem;
  border-bottom: none;
}

.resource-header > * {
  position: relative;
  z-index: 1;
}

@media (max-width: 968px) {
  .resource-header {
    padding: 4rem 0 3rem;
    gap: 2.5rem;
  }
}

.resource-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 1.5rem;
  overflow: hidden;
  background: var(--vp-c-bg-alt);
  border: 1px solid var(--vp-c-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  order: 2;
}

@media (max-width: 968px) {
  .resource-image {
    order: 1;
  }
}

.resource-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(1.05);
}

.resource-image:hover img {
  transform: scale(1.1);
}

/* Improve image layout stability for resource pages: ensure media has an aspect ratio
   and scales responsively. This reduces CLS when images load. */
.resource-media img,
.resource-image img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.resource-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  order: 1;
}

@media (max-width: 968px) {
  .resource-info {
    order: 2;
  }
}

.resource-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.25rem;
  background: linear-gradient(135deg, var(--vp-c-brand-1) 0%, var(--vp-c-brand-2) 100%);
  color: white;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 700;
  width: fit-content;
  box-shadow: 0 4px 16px rgba(34, 140, 244, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.resource-info h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 900;
  color: var(--vp-c-text-1);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.resource-tagline {
  font-size: 1.375rem;
  color: var(--vp-c-text-2);
  margin: 0;
  line-height: 1.6;
  font-weight: 400;
}

.resource-stats {
  display: inline-flex;
  align-self: flex-start;
  gap: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.resource-stats .stat:not(:first-child) {
  display: none;
}

@media (max-width: 768px) {
  .resource-stats {
    width: auto;
    padding: 0;
  }
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
  padding: 0;
  border-radius: 0.5rem;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--vp-c-text-1);
  line-height: 1;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--vp-c-text-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.resource-stats .stat-label {
  display: none;
}

.resource-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.resource-actions .btn {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.resource-actions .btn-secondary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.resource-actions .btn-secondary:hover::before {
  width: 300px;
  height: 300px;
}


/* Secondary style for Live Demo and Documentation buttons */
.resource-actions .btn-demo,
.resource-actions .btn-docs {
  background: color-mix(in srgb, var(--vp-c-brand-1) 14%, transparent);
  color: var(--vp-c-brand-1);
  border: 1px solid color-mix(in srgb, var(--vp-c-brand-1) 45%, transparent);
  display: inline-flex;
}

.resource-actions .btn-demo:hover,
.resource-actions .btn-docs:hover {
  background: color-mix(in srgb, var(--vp-c-brand-1) 24%, transparent);
}

.resource-actions .btn-primary:hover {
  background: var(--vp-c-brand-2);
}

 .resource-actions .btn-secondary {
  background: var(--vp-c-brand-1);
  color: white;
  box-shadow: none;
  /* Ensure visibility in all themes/layouts */
  display: inline-flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 2;
}

.resource-actions .btn-secondary:hover {
  background: var(--vp-c-brand-2);
}

.resource-actions .btn > * {
  position: relative;
  z-index: 1;
}

.resource-content {
  display: grid;
  gap: 3rem;
  max-width: 100%;
}

.resource-description,
.resource-version {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}


@media (max-width: 768px) {
  .resource-description,
  .resource-version {
    padding: 0;
  }
}

.resource-description h2,
.resource-version h2 {
  display: none;
}

.description-text {
  color: var(--vp-c-text-2);
  line-height: 1.9;
  font-size: 1.0625rem;
}

.description-text img {
  display: block !important;
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0.75rem !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
  aspect-ratio: auto;
  object-fit: contain;
}

.description-text br {
  display: none;
}

.description-text a {
  display: block;
  margin: 1rem 0;
}

.description-text a img {
  display: block;
  margin: 0;
}

.description-text a {
  color: var(--vp-c-brand-1);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.description-text a:hover {
  text-decoration: underline;
  color: var(--vp-c-brand-2);
}

.description-text ul,
.description-text ol {
  margin: 1.5rem 0;
  padding-left: 2.5rem;
}

.description-text li {
  margin: 0.75rem 0;
  line-height: 1.8;
}

.description-text code {
  background: var(--vp-c-bg-soft);
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  border: 1px solid var(--vp-c-border);
}

.description-text pre {
  background: var(--vp-c-bg-soft);
  padding: 1.5rem;
  border-radius: 0.75rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--vp-c-border);
}

.description-text pre code {
  background: none;
  padding: 0;
  border: none;
}

.description-text blockquote {
  border-left: 4px solid var(--vp-c-brand-1);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  color: var(--vp-c-text-2);
  font-style: italic;
  background: var(--vp-c-bg-soft);
  padding: 1.5rem;
  border-radius: 0.5rem;
}

@media (max-width: 768px) {
  .resources-hero {
    padding: 4rem 1.5rem 3rem;
  }

  .filters-section {
    flex-direction: column;
    align-items: flex-start;
  }

  .skeleton-grid {
    grid-template-columns: 1fr;
  }

  .resource-header {
    gap: 2rem;
    padding: 3rem 0 2.5rem;
  }

  .resource-info h1 {
    font-size: 2rem;
  }

  .resource-tagline {
    font-size: 1.125rem;
  }

  .resource-stats {
    width: auto;
    padding: 0;
  }

  .resource-actions {
    flex-direction: column;
  }

  .resource-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .resource-content {
    padding: 0 1rem;
  }

  .description-text img {
    margin-left: -0.9rem !important;
    margin-right: -0.9rem !important;
    width: calc(100% + 1.8rem) !important;
    max-width: calc(100% + 1.8rem) !important;
    border-radius: 0 !important;
  }
}