/* ================================================================
   MFA - resources.css
   Resources page: Book shelf, newsletter cards, quick links, program updates
   ================================================================ */

/* ================================================================
   Resources Page — Book Shelf Showcase
   ================================================================ */

/* ── Book Shelf ── */
.bookshelf {
  margin-bottom: var(--space-8);
}

.bookshelf-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  padding: 0 var(--space-4);
  padding-bottom: 0;
  position: relative;
  z-index: 2;
}

/* Individual book spine on the shelf */
.book-spine {
  width: 90px;
  height: 130px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  border-radius: 4px 8px 4px 0;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom center;
  box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.15), inset -2px 0 4px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.book-spine img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-spine-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0c4d6c, #0a3a52);
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-spine-fallback span {
  font-family: var(--font-numbers);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: rgba(255, 255, 255, 0.7);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.book-spine-year {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  color: #fff;
  font-family: var(--font-numbers);
  font-size: 11px;
  font-weight: var(--font-bold);
  text-align: center;
  padding: 16px 4px 6px;
}

/* Hover & Active */
.book-spine:hover {
  transform: translateY(-10px) scale(1.04);
  box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 3;
}

.book-spine.active {
  transform: translateY(-18px) scale(1.08);
  box-shadow: 4px 12px 32px rgba(0, 0, 0, 0.3), 0 0 0 3px var(--color-accent);
  z-index: 4;
  border-radius: 4px;
}

.book-spine.active .book-spine-year {
  background: var(--color-accent);
  padding: 3px 4px;
}

/* Shelf Ledge — the physical shelf */
.bookshelf-ledge {
  height: 14px;
  background: linear-gradient(to bottom,
      #8b7355 0%,
      #a08968 30%,
      #7a6548 70%,
      #6b5840 100%);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), inset 0 2px 3px rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 1;
}

[data-theme="dark"] .bookshelf-ledge {
  background: linear-gradient(to bottom,
      #3d3528 0%,
      #4a4035 30%,
      #322c22 70%,
      #2a2520 100%);
}

/* ── Selected Book Detail Panel ── */
.book-detail {
  display: none;
  animation: bookDetailIn 0.4s ease;
}

.book-detail.active {
  display: block;
}

@keyframes bookDetailIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.book-detail-inner {
  display: flex;
  gap: var(--space-8);
  align-items: flex-start;
  max-width: 880px;
  margin: 0 auto;
  padding: var(--space-6) 0;
}

/* Cover — floating A4 with realistic shadow, NO border */
.book-detail-cover {
  width: 240px;
  flex-shrink: 0;
  position: relative;
}

.book-detail-cover img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px 8px 8px 2px;
  box-shadow:
    6px 6px 0 rgba(0, 0, 0, 0.06),
    12px 12px 0 rgba(0, 0, 0, 0.03),
    4px 8px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.book-detail-cover:hover img {
  transform: scale(1.02);
}

.book-detail-cover-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, #0c4d6c, #0a3a52);
  border-radius: 2px 8px 8px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.25);
  font-size: 3rem;
  box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.2);
}

.book-detail-cover-placeholder span {
  font-family: var(--font-numbers);
  font-size: 1.5rem;
  font-weight: var(--font-bold);
}

/* Info Panel */
.book-detail-info {
  flex: 1;
  padding-top: var(--space-2);
}

.book-detail-year-badge {
  display: inline-block;
  font-family: var(--font-numbers);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--color-accent);
  background: rgba(70, 183, 85, 0.1);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
  letter-spacing: 0.05em;
}

.book-detail-title {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  font-size: var(--text-2xl);
  color: var(--color-text);
  margin-bottom: var(--space-5);
  line-height: 1.3;
}

.book-detail-highlights {
  margin-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-highlight-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

.book-highlight-item i {
  color: var(--color-accent);
  font-size: 0.65rem;
  margin-top: 6px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(70, 183, 85, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Action Buttons */
.book-detail-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.book-btn-read {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  background: var(--color-orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-btn-read:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232, 145, 58, 0.35);
  color: #fff;
  background: #d17a2e;
}

[data-theme="dark"] .book-btn-read,
[data-theme="dark"] .book-btn-read:hover {
  color: #fff !important;
}

.book-btn-download {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-full);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: all 0.2s ease;
}

.book-btn-download:hover {
  background: var(--color-primary);
  color: #fff;
}

/* ── Responsive ── */
@media (max-width: 991px) {
  .book-spine {
    width: 75px;
    height: 110px;
  }

  .bookshelf-row {
    gap: 8px;
  }
}

@media (max-width: 767px) {
  .bookshelf-row {
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0;
  }

  .bookshelf-row::-webkit-scrollbar {
    display: none;
  }

  .book-spine {
    width: 68px;
    height: 100px;
  }

  .book-detail-inner {
    flex-direction: column;
    align-items: center;
    gap: var(--space-5);
    text-align: center;
  }

  .book-detail-cover {
    width: 200px;
  }

  .book-detail-actions {
    justify-content: center;
    flex-direction: column;
  }

  .book-btn-read,
  .book-btn-download {
    width: 100%;
    justify-content: center;
  }

  .book-highlight-item {
    text-align: start;
  }
}



/* ── Newsletter Cards (Premium) ── */
.nl-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.nl-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 calc(33.333% - 14px);
  max-width: calc(33.333% - 14px);
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  text-decoration: none;
  position: relative;
  border: 1px solid var(--color-border);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.35s ease,
    border-color 0.3s ease;
}

/* Reset flex width when placed inside Bootstrap grid columns */
[class*="col-"] > .nl-card,
.nl-grid-item > .nl-card {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
}

/* Branded gradient ribbon — uses category color if available */
.nl-card-ribbon {
  height: 5px;
  background: linear-gradient(90deg, var(--cat-color, var(--color-primary)), color-mix(in srgb, var(--cat-color, var(--color-primary)) 60%, white));
  flex-shrink: 0;
}

.nl-card-body {
  padding: var(--space-6) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.nl-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

/* Category icon — uses category color */
.nl-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--cat-color, var(--color-primary)), color-mix(in srgb, var(--cat-color, var(--color-primary)) 60%, var(--color-light-blue)));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.nl-card:hover .nl-card-icon {
  transform: scale(1.12) rotate(-5deg);
}

/* Category name badge */
.nl-card-category {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: var(--font-bold);
  color: var(--cat-color, var(--color-primary));
  background: color-mix(in srgb, var(--cat-color, var(--color-primary)) 12%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--cat-color, var(--color-primary)) 25%, transparent);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
  letter-spacing: 0.02em;
  transition: all 0.25s ease;
}

.nl-card-category i {
  font-size: 0.68rem;
}

.nl-card:hover .nl-card-category {
  background: var(--cat-color, var(--color-primary));
  color: #ffffff;
  border-color: var(--cat-color, var(--color-primary));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--cat-color, var(--color-primary)) 30%, transparent);
}

.nl-card-date {
  font-family: var(--font-numbers);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  background: rgba(var(--color-primary-rgb), 0.06);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.nl-card-title {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  color: var(--color-text);
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  margin: 0 0 auto;
  padding-bottom: var(--space-4);
  transition: color 0.2s ease;
}

.nl-card:hover .nl-card-title {
  color: var(--color-primary);
}

.nl-card-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
  transition: gap 0.3s ease;
}

.nl-card-arrow {
  transition: transform 0.3s ease;
  font-size: 0.75rem;
}

.nl-card:hover .nl-card-action {
  gap: 14px;
}

.nl-card:hover .nl-card-arrow {
  transform: translateX(4px);
}

[dir="rtl"] .nl-card:hover .nl-card-arrow {
  transform: translateX(-4px);
}

/* Hover state */
.nl-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(12, 77, 108, 0.14), 0 0 0 1px rgba(12, 77, 108, 0.08);
  border-color: rgba(12, 77, 108, 0.15);
}

/* Dark mode */
[data-theme="dark"] .nl-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .nl-card-date {
  background: rgba(255, 255, 255, 0.06);
}

/* Swiper pagination dots branding */
.nl-pagination {
  position: relative !important;
  bottom: auto !important;
  margin-top: var(--space-5);
}

.nl-pagination .swiper-pagination-bullet {
  background: var(--color-primary);
  opacity: 0.3;
  width: 8px;
  height: 8px;
}

.nl-pagination .swiper-pagination-bullet-active {
  opacity: 1;
  width: 24px;
  border-radius: 4px;
}

/* 5 cards: 3 top + 2 bottom centered */
@media (min-width: 768px) and (max-width: 991px) {
  .nl-card {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
  }
}

/* Mobile — Swiper handles layout */
.nl-swiper .nl-card {
  flex: none;
  max-width: none;
  height: 100%;
}


/* ── Resource Quick-Link Card ── */
.resource-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  border: 1px solid var(--color-border);
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
  position: relative;
}

.resource-link-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

.resource-link-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: var(--space-5);
}

.resource-link-card h4 {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.resource-link-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.resource-link-arrow {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  transition: background 0.3s ease, transform 0.3s ease;
}

.resource-link-card:hover .resource-link-arrow {
  background: var(--color-primary);
  color: #fff;
  transform: translateX(4px);
}


/* ── Program Update Cards ── */
.program-update-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--color-border);
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
}

.program-update-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

.program-update-cover {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-primary-dark), var(--color-accent));
}

.program-update-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.program-update-card:hover .program-update-cover img {
  transform: scale(1.08);
}

.program-update-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.2);
}

.program-update-badge {
  position: absolute;
  top: var(--space-3);
  inset-inline-start: var(--space-3);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.program-update-body {
  padding: var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.program-update-date {
  font-size: var(--text-xs);
  color: var(--color-accent);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-2);
}

.program-update-title {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  color: var(--color-text);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-3);
  transition: color 0.2s ease;
}

.program-update-card:hover .program-update-title {
  color: var(--color-primary);
}

.program-update-excerpt {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-4);
  flex: 1;
}

.program-update-link {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  margin-top: auto;
  transition: gap 0.3s ease;
  gap: 4px;
}

.program-update-card:hover .program-update-link {
  gap: 8px;
}

[dir="rtl"] .program-update-link i {
  transform: scaleX(-1);
}

/* ── Newsletters Archive Page Enhancements ── */
.nl-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all 0.25s ease;
}

.nl-filter-btn:hover {
  border-color: var(--cat-color, var(--color-primary));
  color: var(--cat-color, var(--color-primary));
  background: color-mix(in srgb, var(--cat-color, var(--color-primary)) 8%, transparent);
}

.nl-filter-btn.active {
  background: var(--cat-color, var(--color-primary));
  border-color: var(--cat-color, var(--color-primary));
  color: #ffffff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--cat-color, var(--color-primary)) 35%, transparent);
}

.nl-cta-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.nl-cta-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent), var(--color-light-blue));
}

.nl-cta-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--color-primary), var(--color-light-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.nl-cta-title {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  color: var(--color-text);
  font-size: var(--text-xl);
}

.nl-cta-subtitle {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.nl-feature-badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
}

/* ── Newsletter Stat Card ── */
.nl-stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  height: 100%;
}

.nl-stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--icon-accent, var(--color-primary)) 40%, transparent);
}

.nl-stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--icon-accent, var(--color-primary)) 12%, transparent);
  color: var(--icon-accent, var(--color-primary));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

.nl-stat-card:hover .nl-stat-icon {
  transform: scale(1.1);
  background: var(--icon-accent, var(--color-primary));
  color: #ffffff;
}

.nl-stat-number {
  font-family: var(--font-numbers);
  font-size: var(--text-3xl);
  font-weight: var(--font-extrabold);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.nl-stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: var(--font-medium);
  margin: 0;
}