/* ═══════════════════════════════════════
   references.css — Card grid, modal, source badges
   ═══════════════════════════════════════ */

/* ── Hero (rich KB-style) ── */
.ref-hero {
  position: relative;
  text-align: center;
  padding: 120px 24px 48px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, rgba(244,64,65,.06) 0%, transparent 60%),
              linear-gradient(180deg, rgba(244,64,65,.03) 0%, transparent 40%);
}
.ref-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(139,92,246,.04) 0%, transparent 50%);
  pointer-events: none;
}
.ref-hero-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px; height: 72px;
  border-radius: 20px;
  font-size: 2.2rem;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--brand-soft), rgba(139,92,246,.15));
  border: 1px solid rgba(244,64,65,.15);
  box-shadow: 0 8px 32px rgba(244,64,65,.15), inset 0 1px 0 rgba(255,255,255,.05);
  backdrop-filter: blur(8px);
}
.ref-hero h1 {
  position: relative;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 900;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
}
.ref-hero h1 .accent {
  background: linear-gradient(135deg, var(--brand), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ref-hero p {
  position: relative;
  font-size: 1.1rem;
  color: var(--dim);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── Stats bar (rich, matching KB) ── */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 28px 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  max-width: 900px;
  margin: 0 auto 48px;
}
.stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand);
  text-align: center;
  line-height: 1;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--dimmer);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: center;
  margin-top: 6px;
}

/* ── Section label / title ── */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--brand);
  margin-bottom: 8px;
}
.section-title {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.section-sub {
  color: var(--dim);
  font-size: 0.9rem;
}

/* ── Card Grid ── */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1140px;
  margin: 0 auto;
}
@media (max-width: 1024px) { .ref-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  { .ref-grid { grid-template-columns: 1fr; } }

/* ── Reference Card ── */
.ref-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: none;
  background: var(--bg2);
  box-shadow: 0 0 0 1px var(--border);
  transition: all .35s var(--ease-spring);
  cursor: pointer;
}
.ref-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 40px rgba(244,64,65,.08);
}

/* Top accent line on hover */
.ref-card::after {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  width: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  transition: all .35s cubic-bezier(.23,1,.32,1);
  transform: translateX(-50%);
  border-radius: 0 0 6px 6px;
}
.ref-card:hover::after { width: 40%; }

/* Thumbnail */
.ref-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg3);
}
.ref-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s, opacity .5s;
  opacity: .88;
}
.ref-card:hover .ref-thumb img {
  transform: scale(1.03);
  opacity: 1;
}

/* Play icon for video platforms */
.ref-thumb .play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: opacity .3s;
  opacity: 0;
}
.ref-thumb .play-icon::before {
  content: '';
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(244,64,65,.9);
  box-shadow: 0 0 24px rgba(244,64,65,.4);
  transition: all .3s;
}
.ref-card:hover .play-icon { opacity: 1; }
.ref-card:hover .play-icon::before {
  transform: scale(1.1);
  box-shadow: 0 0 36px rgba(244,64,65,.6);
}
.ref-thumb .play-icon::after {
  content: '';
  position: absolute;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid #fff;
  margin-left: 3px;
}

/* Platform badge */
.platform-badge {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 3;
  background: rgba(8,8,10,.8);
  backdrop-filter: blur(8px);
  color: var(--dim);
  font-size: .65rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  text-transform: capitalize;
  border: 1px solid var(--border);
}
.platform-badge.youtube  { color: #ff0000; border-color: rgba(255,0,0,.3); }
.platform-badge.instagram{ color: #e1306c; border-color: rgba(225,48,108,.3); }
.platform-badge.vimeo    { color: #1ab7ea; border-color: rgba(26,183,234,.3); }
.platform-badge.twitter,
.platform-badge.x        { color: #1da1f2; border-color: rgba(29,161,242,.3); }
.platform-badge.web,
.platform-badge.blog     { color: var(--blue); border-color: var(--blue-soft); }
.platform-badge.github   { color: var(--green); border-color: var(--green-soft); }

/* Card body */
.ref-body {
  padding: 18px 20px 20px;
}
.ref-title {
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ref-desc {
  font-size: .78rem;
  color: var(--dim);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 12px;
}

/* Meta row: difficulty + price */
.ref-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.diff-badge {
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: .2px;
}
.diff-beginner     { background: var(--green-soft);  color: var(--green); }
.diff-intermediate { background: var(--blue-soft);   color: var(--blue); }
.diff-advanced     { background: var(--purple-soft); color: var(--purple); }
.diff-all          { background: var(--brand-soft);  color: var(--brand); }
.price-badge {
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--dim);
}
.price-free { color: var(--green); border-color: rgba(52,211,153,.2); }

/* Category chips */
.ref-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ref-tags span {
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--bg3);
  color: var(--dim);
}

/* ── Filter Bar ── */
.ref-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 1140px;
  margin: 0 auto 32px;
  padding: 0 24px;
}
.ref-filter-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  background: var(--bg2);
  color: var(--dim);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s;
  font-family: 'Inter', sans-serif;
}
.ref-filter-btn:hover { border-color: var(--brand); color: var(--brand); }
.ref-filter-btn.active {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: rgba(244,64,65,.3);
}

/* Search input */
.ref-search-box {
  max-width: 1140px;
  margin: 0 auto 20px;
  padding: 0 24px;
}
.ref-search-box input {
  width: 100%;
  max-width: 400px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-size: .9rem;
  font-family: 'Inter', sans-serif;
  transition: border-color .2s;
}
.ref-search-box input:focus {
  outline: none;
  border-color: var(--brand);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8,8,10,.85);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(.95) translateY(12px);
  transition: transform .35s var(--ease-spring);
}
.modal-overlay.open .modal-container {
  transform: scale(1) translateY(0);
}

/* Modal header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header-info {
  flex: 1;
  min-width: 0;
}
.modal-header-info h3 {
  font-size: 1.1rem;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-author {
  font-size: .78rem;
  color: var(--dim);
}
.modal-close {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--dim);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
  margin-left: 12px;
}
.modal-close:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Modal body — scrollable */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Embed area */
.modal-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}
.modal-embed iframe {
  width: 100%; height: 100%;
  border: none;
}
.modal-embed-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--dim);
  text-align: center;
  padding: 24px;
}
.modal-embed-placeholder .ext-icon {
  font-size: 2rem;
}
.modal-external-link {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-size: .85rem;
  transition: all .2s;
}
.modal-external-link:hover { background: var(--brand); color: #fff; }

/* Modal info panel */
.modal-info {
  padding: 20px 24px;
}
.modal-meta-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.modal-info p {
  font-size: .84rem;
  color: var(--dim);
  line-height: 1.6;
  margin-bottom: 16px;
}
.modal-info .ref-tags {
  margin-bottom: 20px;
}

/* Related resources */
.related-section {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
}
.related-title {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--dimmer);
  margin-bottom: 14px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.related-card {
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg3);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .25s;
  text-decoration: none;
}
.related-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}
.related-card .rel-thumb {
  aspect-ratio: 16/9;
  overflow: hidden;
}
.related-card .rel-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .8;
  transition: opacity .3s;
}
.related-card:hover .rel-thumb img { opacity: 1; }
.related-card .rel-title {
  padding: 8px 10px;
  font-size: .72rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

@media (max-width: 768px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-container { width: 96%; max-height: 94vh; }
}
