/**
 * Netflix-Style Portfolio Showcase
 *
 * Styles for hero carousel, category rows, portfolio cards,
 * and Netflix-inspired hover interactions.
 *
 * @package OnyxData_Child
 */

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */

:root {
  /* Brand colours */
  --ddna-gold: #ffbb09;
  --ddna-gold-glow: rgba(255, 187, 9, 0.4);
  --ddna-dark: #141414;

  /* Card styles */
  --ddna-card-radius: 12px;
  --ddna-card-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --ddna-card-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.45);

  /* Transitions */
  --ddna-transition-fast: 0.2s ease;
  --ddna-transition-card: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* Header clearance (fixed header ~80px on desktop) */
  --ddna-header-height: 80px;
  --ddna-header-height-mobile: 60px;

  /* Section spacing system */
  --ddna-section-gap-sm: 40px;
  --ddna-section-gap-md: 60px;
  --ddna-section-gap-lg: 80px;
}

/* ==========================================================================
   Showcase Section Container
   ========================================================================== */

.ddna-showcase {
  background: #f8f9fa; /* Light background */
  padding-top: 60px;
  padding-bottom: 60px;
  margin-top: 0;
  position: relative;
  z-index: 1; /* Below header z-index of 11 */
}

/* Section Header */
.ddna-section-header {
  text-align: center;
  margin-bottom: 40px;
}

.ddna-section-header h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 12px 0;
}

.ddna-section-header h2 span {
  color: var(--ddna-gold);
}

.ddna-section-header p {
  font-size: 1.1rem;
  color: #666;
  margin: 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Row headers */
.ddna-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  margin-bottom: 16px;
}

.ddna-row-header h3 {
  font-size: 1.35rem;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0;
}

.ddna-see-all {
  color: var(--ddna-gold);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--ddna-transition-fast);
}

.ddna-see-all:hover {
  color: #1a1a2e;
  text-decoration: underline;
}

/* ==========================================================================
   Hero Carousel
   ========================================================================== */

.ddna-hero-swiper {
  position: relative;
  width: 100%;
  max-width: 1200px; /* Constrain to prevent over-scaling */
  height: auto;
  aspect-ratio: 16 / 9;
  max-height: 500px; /* Reasonable cap */
  margin: 0 auto 20px; /* Center */
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.ddna-hero-swiper .swiper-wrapper {
  width: 100%;
}

.ddna-hero-swiper .swiper-slide {
  width: 100%;
  height: 100%;
}

.ddna-hero-slide {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
}

.ddna-hero-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover; /* Fill container, crop if needed */
  object-position: center top; /* Focus on top of image */
}

/* Gradient overlay removed - clean image display per user request */

/* Hero content positioned bottom-left like Netflix */
.ddna-hero-content {
  position: absolute;
  bottom: 15%;
  left: 4%;
  z-index: 2;
  max-width: 40%;
}

.ddna-hero-title {
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 700;
  color: #fff;
  margin: 0 0 12px 0;
  line-height: 1.1;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

.ddna-hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(0.8rem, 1.2vw, 1rem);
}

.ddna-hero-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ddna-hero-author img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.ddna-hero-challenge {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.ddna-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 24px;
  background: #fff;
  color: #000;
  font-weight: 600;
  font-size: clamp(0.9rem, 1.2vw, 1.1rem);
  border: none;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ddna-transition-fast);
}

.ddna-hero-cta:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px var(--ddna-gold-glow);
  color: var(--ddna-dark);
  text-decoration: none;
}

/* Hero badge (score) positioned bottom-right like Netflix age rating */
.ddna-hero-badge {
  position: absolute;
  bottom: 15%;
  right: 4%;
  z-index: 3;
}

.ddna-hero-badge .score-badge {
  width: 48px;
  height: 48px;
  font-size: 1rem;
}

/* Swiper pagination (dots) */
.ddna-hero-swiper .swiper-pagination {
  bottom: 24px !important;
  z-index: 10;
}

.ddna-hero-swiper .swiper-pagination-bullet {
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.4);
  opacity: 1;
  margin: 0 5px !important;
  transition: background var(--ddna-transition-fast), transform var(--ddna-transition-fast);
}

.ddna-hero-swiper .swiper-pagination-bullet-active {
  background: var(--ddna-gold);
  transform: scale(1.2);
}

/* Swiper navigation arrows */
.ddna-hero-swiper .swiper-button-prev,
.ddna-hero-swiper .swiper-button-next {
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  color: #fff;
  transition: background var(--ddna-transition-fast), transform var(--ddna-transition-fast);
}

.ddna-hero-swiper .swiper-button-prev::after,
.ddna-hero-swiper .swiper-button-next::after {
  font-size: 1.25rem;
}

.ddna-hero-swiper .swiper-button-prev:hover,
.ddna-hero-swiper .swiper-button-next:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1.1);
}

/* ==========================================================================
   Category Rows
   ========================================================================== */

.ddna-category-section {
  padding: 20px 0;
  background: #f8f9fa;
}

.ddna-category-row {
  position: relative;
  margin-bottom: 48px; /* Extra space for hover panels */
  z-index: 1;
}

.ddna-category-row:hover {
  z-index: 50; /* Bring entire row forward on hover */
}

.ddna-category-row:last-child {
  margin-bottom: 0;
}

.ddna-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  margin-bottom: 12px;
}

.ddna-category-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0;
}

.ddna-category-see-all {
  color: var(--ddna-gold);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--ddna-transition-fast);
}

.ddna-category-see-all:hover {
  color: #fff;
  text-decoration: underline;
}

/* Category Swiper container */
.ddna-category-swiper {
  padding: 0;
  overflow: visible !important;
}

.ddna-category-swiper .swiper-wrapper {
  overflow: visible !important;
  padding: 8px 0;
}

.ddna-category-swiper .swiper-slide {
  overflow: visible;
  z-index: 1;
}

.ddna-category-swiper .swiper-slide:hover {
  z-index: 100;
}

/* ==========================================================================
   Portfolio Cards
   ========================================================================== */

.ddna-portfolio-card {
  display: block;
  position: relative;
  /* ~6 cards per row */
  width: calc((100vw - 8%) / 6 - 8px);
  min-width: 150px;
  max-width: 280px;
  border-radius: 8px;
  overflow: visible;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, z-index 0s 0.3s;
  text-decoration: none;
}

.ddna-card-image {
  position: relative;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.ddna-card-img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* Hover Panel - Hidden by default */
.ddna-card-hover {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #181818;
  padding: 12px;
  border-radius: 0 0 8px 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Hover Action Buttons */
.ddna-hover-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.ddna-hover-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-size: 14px;
}

.ddna-hover-btn:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.ddna-hover-btn-primary {
  background: #fff;
  border-color: #fff;
  color: #000;
}

.ddna-hover-btn-primary:hover {
  background: #e5e5e5;
}

/* Hover Meta (score, date) */
.ddna-hover-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ddna-hover-score {
  color: #46d369;
  font-weight: 700;
  font-size: 0.9rem;
}

.ddna-hover-date {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
}

/* Hover Title */
.ddna-hover-title {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 6px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hover Tags */
.ddna-hover-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.ddna-tag-separator {
  color: rgba(255, 255, 255, 0.4);
}

/* Card thumbnail */
.ddna-card-thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform var(--ddna-transition-card);
}

/* Card info strip - hidden by default, shown on hover like Netflix */
.ddna-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.7) 50%, transparent 100%);
  z-index: 2;
}

.ddna-card-info h4,
.ddna-card-title {
  font-size: clamp(0.75rem, 1vw, 0.9rem);
  font-weight: 600;
  color: #fff;
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ddna-card-author {
  font-size: clamp(0.65rem, 0.8vw, 0.8rem);
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Score badge on card - top right like Netflix Top 10 badge */
.ddna-card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
}

/* Reuse existing score-badge styles */
.ddna-card-badge .score-badge {
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
}

/* Hover overlay (hidden by default) */
.ddna-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.95) 0%,
    rgba(0, 0, 0, 0.7) 60%,
    rgba(0, 0, 0, 0.4) 100%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ddna-transition-card);
  z-index: 4;
}

.ddna-overlay-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.ddna-overlay-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ddna-overlay-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.ddna-overlay-author {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
}

.ddna-overlay-challenge {
  font-size: 0.8rem;
  color: var(--ddna-gold);
  margin-bottom: 12px;
}

.ddna-overlay-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: var(--ddna-gold);
  color: var(--ddna-dark);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 4px;
  text-decoration: none;
  transition: background var(--ddna-transition-fast);
}

.ddna-overlay-cta:hover {
  background: #fff;
  color: var(--ddna-dark);
  text-decoration: none;
}

/* ==========================================================================
   Hover Effects (Desktop Only)
   ========================================================================== */

@media (hover: hover) and (pointer: fine) {
  .ddna-portfolio-card:hover {
    transform: scale(1.3);
    z-index: 200;
    transition: transform 0.3s ease, box-shadow 0.3s ease, z-index 0s;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  }

  .ddna-portfolio-card:hover .ddna-card-image {
    border-radius: 8px 8px 0 0;
  }

  .ddna-portfolio-card:hover .ddna-card-img {
    transform: scale(1);
  }

  .ddna-portfolio-card:hover .ddna-card-hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .ddna-portfolio-card:hover .ddna-card-badge {
    opacity: 0;
  }
}

/* ==========================================================================
   Mobile Styles
   ========================================================================== */

@media (hover: none) {
  /* No hover transforms on touch devices */
  .ddna-portfolio-card:hover {
    transform: none;
    z-index: auto;
  }

  /* Hide hover panel on touch devices */
  .ddna-card-hover {
    display: none;
  }

  /* Make entire card clickable on mobile */
  .ddna-portfolio-card {
    overflow: hidden;
  }

  .ddna-card-image {
    border-radius: 8px;
  }
}

@media (max-width: 1279px) {
  .ddna-hero-swiper {
    max-height: 450px;
  }

  .ddna-portfolio-card {
    /* ~5 cards per row on smaller desktop */
    width: calc((100vw - 8%) / 5 - 8px);
  }
}

@media (max-width: 1023px) {
  .ddna-hero-swiper {
    max-height: 400px;
  }

  .ddna-portfolio-card {
    /* ~4 cards per row on tablet */
    width: calc((100vw - 8%) / 4 - 8px);
  }

  .ddna-hero-content {
    bottom: 10%;
    max-width: 50%;
  }
}

@media (max-width: 767px) {
  .ddna-showcase {
    padding-top: 0;
    margin-top: 20px;
  }

  .ddna-hero-swiper {
    max-height: 300px;
    margin: 0 16px 20px;
    width: calc(100% - 32px);
  }

  .ddna-hero-content {
    bottom: 8%;
    left: 4%;
    max-width: 70%;
  }

  .ddna-portfolio-card {
    /* ~3 cards per row on mobile */
    width: calc((100vw - 8%) / 3 - 6px);
    min-width: 100px;
  }

  .ddna-hero-content {
    bottom: 40px;
    left: 20px;
    right: 20px;
  }

  .ddna-hero-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }

  .ddna-hero-meta {
    font-size: 0.85rem;
    gap: 12px;
  }

  .ddna-hero-cta {
    padding: 10px 20px;
    font-size: 0.9rem;
    margin-top: 16px;
  }

  .ddna-hero-badge {
    top: 16px;
    right: 16px;
  }

  .ddna-hero-badge .score-badge {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  /* Hide navigation arrows on mobile */
  .ddna-hero-swiper .swiper-button-prev,
  .ddna-hero-swiper .swiper-button-next {
    display: none;
  }

  .ddna-category-section {
    padding: 24px 0;
  }

  .ddna-category-header,
  .ddna-category-swiper {
    padding: 0 16px;
  }

  .ddna-category-title {
    font-size: 1.1rem;
  }

  .ddna-category-row {
    margin-bottom: 32px;
  }

}

@media (max-width: 479px) {
  .ddna-hero-swiper {
    height: 56vw;
    max-height: 45vh;
  }

  .ddna-portfolio-card {
    /* ~2.5 cards per row on small mobile */
    width: calc((100vw - 8%) / 2.5 - 6px);
    min-width: 120px;
  }

  .ddna-category-row {
    margin-bottom: 24px;
  }
}

/* Header height adjustment for mobile */
@media (max-width: 767px) {
  :root {
    --ddna-header-height: 60px;
  }
}

/* ==========================================================================
   Score Badge Integration
   ========================================================================== */

/* Ensure existing score-badge styles integrate well */
.ddna-hero-badge .score-badge,
.ddna-card-badge .score-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Override size for hero */
.ddna-hero-badge .score-badge {
  width: 48px;
  height: 48px;
}

/* Override size for card */
.ddna-card-badge .score-badge {
  width: 28px;
  height: 28px;
}

/* Ensure score badge colours match the existing pattern */
.ddna-hero-badge .score-badge--green,
.ddna-card-badge .score-badge--green {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
}

.ddna-hero-badge .score-badge--yellow,
.ddna-card-badge .score-badge--yellow {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #000;
}

.ddna-hero-badge .score-badge--grey,
.ddna-card-badge .score-badge--grey {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: #fff;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.ddna-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: rgba(255, 255, 255, 0.6);
}

.ddna-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--ddna-gold);
  border-radius: 50%;
  animation: ddna-spin 1s linear infinite;
}

@keyframes ddna-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.ddna-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 40px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.ddna-empty-state p {
  margin: 0;
  font-size: 1rem;
}
