/* ============================================================
   COVER FLOW CAROUSEL — Mobile & Tablet (< 1024px)
   Bloom-inspired: center card prominent, side cards scaled/dimmed
   Tap side cards to bring to center; only center card navigable
   ============================================================ */

/* Cover flow section — hidden on desktop, shown via media query */
.resources-coverflow-section {
  display: none;
  position: relative;
  z-index: 1;
  padding-bottom: 48px;
}

/* Section header */
.cf-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  max-width: min(1400px, 100%);
  margin: 0 auto;
  padding: 0 24px 16px;
}

.cf-section-head h2 {
  font-family: var(--resources-font-heading, 'Fraunces', serif);
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--resources-text-warm, #2D2726);
  margin: 0;
}

.cf-view-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--resources-coral, #FF6B5B);
  text-decoration: none;
  transition: color 0.2s;
}

.cf-view-all:hover {
  color: var(--resources-amber, #FFB347);
}

/* Hint arrows */
.cf-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 24px 18px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--resources-text-warm-secondary, #9B8E87);
}

.cf-arrow {
  font-size: 1rem;
  animation: cf-nudge 2s ease-in-out infinite;
}

.cf-arrow.right {
  animation-direction: reverse;
}

@keyframes cf-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-5px); }
}

/* Track — horizontal scroll with snap */
.cf-track {
  display: flex;
  align-items: center;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 40px 0 50px;
  perspective: 1000px;
  perspective-origin: 50% 50%;
  gap: 0;
  width: 100%;
  box-sizing: border-box;
}

.cf-track::-webkit-scrollbar {
  display: none;
}

/* Spacers to center first and last card — base width for mobile */
.cf-spacer {
  flex-shrink: 0;
  min-width: 45px;
}

/* Individual card wrapper — handles transform */
.cf-item {
  flex-shrink: 0;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.45s cubic-bezier(0.34, 1.2, 0.64, 1),
    opacity 0.45s ease,
    filter 0.45s ease;
  position: relative;
  transform: scale(0.78) rotateY(18deg) translateY(14px);
  opacity: 0.55;
  filter: brightness(0.88);
  cursor: pointer;
  will-change: transform, opacity, filter;
}

/* Active center card — clickable to navigate */
.cf-item.active {
  transform: scale(1) rotateY(0deg) translateY(0);
  opacity: 1;
  filter: brightness(1);
  cursor: pointer;
  z-index: 10;
}

/* Right-side cards tilt the other way */
.cf-item.right-of-center {
  transform: scale(0.78) rotateY(-18deg) translateY(14px);
}

/* The actual visible card face */
.cf-card {
  border-radius: 26px;
  padding: 30px 26px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.11);
  transition: box-shadow 0.45s ease;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.cf-item.active .cf-card {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
}

.cf-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
  pointer-events: none;
}

/* Glow ring on active */
.cf-item.active .cf-card::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 28px;
  background: transparent;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

/* Card content */
.cf-emoji {
  font-size: 3.2rem;
  display: block;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}

.cf-cat {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 6px;
}

.cf-card h3 {
  font-family: var(--resources-font-heading, 'Fraunces', serif);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.18;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.cf-card p {
  font-size: 0.82rem;
  line-height: 1.6;
  opacity: 0.78;
  margin-bottom: 16px;
  max-width: 240px;
}

.cf-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cf-count {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Light cards: dark badge */
.cf-card.cf-light .cf-count {
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 0, 0, 0.1);
}

.cf-explore {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 100px;
  padding: 8px 18px;
  font-family: var(--resources-font-base, 'DM Sans', sans-serif);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  color: inherit;
  transition: background 0.2s, transform 0.2s;
  opacity: 0;
  pointer-events: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

.cf-item.active .cf-explore {
  opacity: 1;
  pointer-events: auto;
}

.cf-explore:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.04);
}

/* Light cards: dark explore button */
.cf-card.cf-light .cf-explore {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.1);
}

.cf-card.cf-light .cf-explore:hover {
  background: rgba(0, 0, 0, 0.12);
}

/* Dark cards: light explore button (same as default) */
.cf-card.cf-dark .cf-explore {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Tap-to-center hint on inactive cards */
.cf-tap-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 26px;
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
}

.cf-item:not(.active):hover .cf-tap-hint {
  opacity: 1;
}

.cf-tap-hint span {
  background: rgba(0, 0, 0, 0.45);
  color: white;
  border-radius: 100px;
  padding: 8px 18px;
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

/* Dots indicator */
.cf-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding-top: 4px;
}

.cf-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(45, 39, 38, 0.09);
  transition: background 0.3s, transform 0.3s, width 0.3s;
  cursor: pointer;
}

.cf-dot.active {
  background: var(--resources-coral, #FF6B5B);
  width: 22px;
  border-radius: 100px;
  transform: scaleY(1);
}

/* Arc shadow at bottom (conveyor belt feel) */
.cf-arc {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 40px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* ============================================================
   RESPONSIVE — tablet & mobile show coverflow, hide bento
   ============================================================ */
@media (max-width: 1023px) {
  .categories-bento-grid {
    display: none !important;
  }

  .resources-coverflow-section {
    display: block;
  }

  .cf-section-head {
    padding: 32px 24px 16px;
  }

  .cf-section-head h2 {
    font-size: 1.6rem;
  }
}

/* TABLET: 3 cards visible, each card 280×380 */
@media (min-width: 600px) and (max-width: 1023px) {
  .cf-item {
    width: 280px;
    height: 380px;
    margin: 0 -14px;
  }

  .cf-spacer {
    width: calc(50vw - 140px);
  }
}

/* MOBILE: center card fills most viewport, sides peek */
@media (max-width: 599px) {
  .cf-item {
    width: calc(100vw - 90px);
    height: 420px;
    margin: 0 -26px;
  }

  .cf-spacer {
    width: 45px;
  }
}

/* Desktop: hide coverflow, show bento */
@media (min-width: 1024px) {
  .resources-coverflow-section {
    display: none !important;
  }

  .categories-bento-grid {
    display: block !important;
  }
}

/* Dark mode adjustments */
html.dark-mode .cf-hint {
  color: var(--resources-text-warm-secondary);
}

html.dark-mode .cf-dot {
  background: rgba(255, 255, 255, 0.2);
}

html.dark-mode .cf-dot.active {
  background: var(--resources-coral);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cf-item {
    transition: none;
  }

  .cf-arrow {
    animation: none;
  }
}
