/* Cards Grid Module - External Styles */
/* Minimal external CSS - most styles are inlined for performance */
/* Only non-critical, accessibility, and print styles here */

/* Print styles */
@media print {
  .c-cards-grid__container {
    display: block !important;
  }

  .c-card {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 1rem;
  }

  .c-card__btn,
  .c-card__link {
    text-decoration: underline !important;
  }

  /* Show URLs in print */
  .c-card__link::after,
  .c-card__btn::after {
    content: " (" attr(href) ")";
    font-size: 0.875em;
    opacity: 0.7;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .c-card {
    border-width: 2px !important;
  }

  .c-card__btn {
    border: 2px solid currentColor;
  }

  .c-card__badge {
    border: 1px solid;
  }
}

/* Forced colors mode (Windows High Contrast) */
@media (forced-colors: active) {
  .c-card {
    border: 1px solid;
  }

  .c-card__btn {
    border: 1px solid;
    forced-color-adjust: none;
  }
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible for keyboard navigation (fallback) */
@supports not selector(:focus-visible) {
  .c-card__btn:focus,
  .c-card__link:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
  }
}

/* Container query support for modern browsers */
@supports (container-type: inline-size) {
  @container (min-width: 400px) {
    .c-card__title {
      font-size: 1.125rem;
    }
  }

  @container (min-width: 600px) {
    .c-card__title {
      font-size: 1.25rem;
    }

    .c-card__text {
      font-size: 1rem;
    }
  }
}

/* Loading state for async content */
.c-cards-grid[data-loading] {
  position: relative;
  min-height: 400px;
}

.c-cards-grid[data-loading]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Skeleton loading for cards */
.c-card--skeleton {
  pointer-events: none;
}

.c-card--skeleton .c-card__media,
.c-card--skeleton .c-card__title,
.c-card--skeleton .c-card__text {
  background: linear-gradient(90deg,
    rgba(0, 0, 0, 0.05) 25%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.c-card--skeleton .c-card__title {
  height: 1.25em;
  width: 80%;
}

.c-card--skeleton .c-card__text {
  height: 3em;
}

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

/* Utility classes for responsive visibility */
@media (max-width: 640px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .hide-tablet {
    display: none !important;
  }
}

@media (min-width: 1025px) {
  .hide-desktop {
    display: none !important;
  }
}