/* Styles for the Free Resources page. Builds on ../styles.css and ../tools/tools.css
   (this page reuses .tools-grid / .tool-card). Cards show a generated cover image
   and a short summary; the full resource opens in a popup (.resource-modal). */

.resources-grid {
  align-items: stretch;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.resource-card {
  cursor: pointer;
  padding: 0;
}
/* Cover replaces the left accent bar */
.resource-card::before { display: none; }
.resource-card:focus-visible {
  outline: 2px solid var(--tool-accent, var(--accent-violet));
  outline-offset: 3px;
}

/* ---- Generated cover image ---- */
.resource-cover {
  position: relative;
  height: 148px;
  background: var(--ti, var(--grad-brand));
  overflow: hidden;
  flex-shrink: 0;
}
.resource-cover-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* Soft vignette so the cover blends into the card */
.resource-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 3, 5, 0) 55%, rgba(3, 3, 5, 0.35));
  pointer-events: none;
}
.resource-cover-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(6px);
  color: #fff;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(.34, 1.56, .64, 1);
}
.resource-cover-icon i,
.resource-cover-icon svg { width: 26px; height: 26px; }
.resource-card:hover .resource-cover-icon { transform: scale(1.1) rotate(-5deg); }

/* ---- Card body ---- */
.resource-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 22px 20px;
}
.resource-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 12px;
}
.resource-keyword {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--tool-glow, rgba(139, 92, 246, 0.14));
  color: var(--tool-accent, var(--accent-violet));
  border: 1px solid var(--border-color);
  white-space: nowrap;
}
.resource-keyword i,
.resource-keyword svg { width: 11px; height: 11px; }
.resource-date {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  color: var(--text-muted);
}
.resource-date i,
.resource-date svg { width: 12px; height: 12px; }

.resource-card h3 {
  font-size: 1.12rem;
  line-height: 1.32;
  margin: 0 0 8px;
}
.resource-card .resource-desc {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.resource-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}
.resource-count {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.resource-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.18s, gap 0.18s;
}
.resource-open i,
.resource-open svg { width: 15px; height: 15px; }
.resource-card:hover .resource-open {
  color: var(--tool-accent, var(--accent-violet));
  gap: 10px;
}

/* ---- Detail popup ---- */
body.resource-modal-open { overflow: hidden; }

.resource-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.resource-modal.open { display: flex; }
.resource-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 5, 0.72);
  backdrop-filter: blur(6px);
  animation: resource-fade 0.25s ease;
}
.resource-modal-dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: min(86vh, 900px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--bg-card), var(--bg-surface));
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 100px -30px var(--tool-glow, rgba(0, 0, 0, 0.7)), 0 30px 80px -40px rgba(0, 0, 0, 0.8);
  animation: resource-pop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes resource-fade { from { opacity: 0; } }
@keyframes resource-pop {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.resource-modal-cover { height: 168px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.resource-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(3, 3, 5, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  transition: all 0.18s;
}
.resource-modal-close:hover {
  background: rgba(3, 3, 5, 0.7);
  transform: rotate(90deg);
}
.resource-modal-close i,
.resource-modal-close svg { width: 18px; height: 18px; }

.resource-modal-body { padding: 24px clamp(20px, 4vw, 32px) 30px; }
.resource-modal-body h2 {
  font-family: var(--font-display, 'Poppins', sans-serif);
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  line-height: 1.25;
  margin: 0 0 10px;
}
.resource-modal-body .resource-desc {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ---- Numbered content items (inside the popup) ---- */
.resource-items {
  list-style: none;
  margin: 0 0 22px;
  padding: 18px 0 0;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.resource-items li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.resource-item-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--tool-accent, var(--accent-violet));
  background: var(--tool-glow, rgba(139, 92, 246, 0.14));
  border: 1px solid var(--border-color);
  margin-top: 1px;
}
.resource-items h4 {
  margin: 0 0 3px;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.resource-items li > div > p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.resource-video-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--ti, var(--grad-brand));
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 10px 26px -12px var(--tool-glow, rgba(139, 92, 246, 0.6));
  transition: transform 0.18s, filter 0.18s;
}
.resource-video-link:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.resource-video-link i,
.resource-video-link svg { width: 16px; height: 16px; }

/* ---- Loading skeletons / empty / error states ---- */
.resource-skeleton {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  overflow: hidden;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 22px;
}
.resource-skeleton span {
  display: block;
  border-radius: 8px;
  background: linear-gradient(100deg, var(--bg-elevated) 30%, var(--bg-card-hover) 50%, var(--bg-elevated) 70%);
  background-size: 200% 100%;
  animation: resource-shimmer 1.2s linear infinite;
  margin: 0 22px;
}
.resource-skeleton .sk-cover { height: 148px; border-radius: 0; margin: 0 0 8px; }
.resource-skeleton .sk-title { height: 20px; width: 70%; }
.resource-skeleton .sk-line { height: 12px; }
.resource-skeleton .sk-line.short { width: 55%; }
@keyframes resource-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.resources-empty,
.resources-error {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}
.resources-error { color: #fca5a5; }
