/* ==========================================================================
   Project Portfolio Grid [du_an_grid] - Architectural Editorial Style
   Flatsome Child Theme
   ========================================================================== */

.duan-grid-section {
  width: 100%;
  margin: 0 auto;
  scroll-margin-top: 110px;
}

/* --------------------------------------------------------------------------
   1. Typographic Filter Navigation (No clunky gray pills)
   -------------------------------------------------------------------------- */
.duan-filter-wrap {
  margin-bottom: 40px;
  display: flex;
  padding-bottom: 6px;
  scroll-margin-top: 110px;
}

.duan-filter--center {
  justify-content: center;
}

.duan-filter--left {
  justify-content: flex-start;
}

.duan-filter--right {
  justify-content: flex-end;
}

.duan-filter-tabs {
  display: flex;
  align-items: center;
  gap: 36px;
  background: transparent;
  padding: 0;
  margin: 0;
  max-width: 100%;
}

.duan-filter-btn {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.3px;
  padding: 10px 0 0px;
  position: relative;
  cursor: pointer;
  transition: color 0.22s ease;
  white-space: nowrap;
  outline: none;
  font-family: inherit;
  display: inline-block;
  margin: 0px;
  flex-shrink: 0;
}

/* Subtle line indicator under active tab */
.duan-filter-btn::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #0a2239;
  border-radius: 2px;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.26s ease;
}

.duan-filter-btn:hover {
  color: #0a2239;
}

.duan-filter-btn.is-active {
  color: #0a2239;
  font-weight: 700;
}

.duan-filter-btn.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

/* --------------------------------------------------------------------------
   2. Grid Layout & Responsive Columns
   -------------------------------------------------------------------------- */
.duan-grid-wrapper {
  position: relative;
  min-height: 200px;
}

.duan-grid {
  display: grid;
  gap: 38px 28px;
  transition: opacity 0.25s ease;
}

/* Desktop Columns */
.duan-cols-1 .duan-grid {
  grid-template-columns: 1fr;
}

.duan-cols-2 .duan-grid {
  grid-template-columns: repeat(2, 1fr);
}

.duan-cols-3 .duan-grid {
  grid-template-columns: repeat(3, 1fr);
}

.duan-cols-4 .duan-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* Tablet Breakpoint (max-width: 991px) */
@media (max-width: 991px) {
  .duan-cols-md-1 .duan-grid {
    grid-template-columns: 1fr !important;
  }

  .duan-cols-md-2 .duan-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .duan-cols-md-3 .duan-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .duan-filter-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    margin-bottom: 28px !important;
    padding-bottom: 8px !important;
    justify-content: flex-start !important;
  }

  .duan-filter-wrap::-webkit-scrollbar {
    display: none !important;
  }

  .duan-filter-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    width: max-content !important;
    min-width: 100% !important;
    gap: 24px !important;
    padding: 0 4px 6px 4px !important;
  }

  .duan-filter-btn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    font-size: 15px !important;
    padding: 6px 0 8px 0 !important;
  }
}

/* Mobile Breakpoint (max-width: 767px) */
@media (max-width: 767px) {
  .duan-cols-sm-1 .duan-grid {
    grid-template-columns: 1fr !important;
    gap: 32px 0;
  }

  .duan-cols-sm-2 .duan-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 22px 14px;
  }

  .duan-filter-wrap {
    margin-bottom: 22px !important;
    padding-bottom: 6px !important;
  }

  .duan-filter-tabs {
    gap: 18px !important;
    padding: 0 2px 4px 2px !important;
  }

  .duan-filter-btn {
    font-size: 14px !important;
    letter-spacing: 0.3px !important;
    padding: 5px 0 6px 0 !important;
  }

  .duan-filter-btn::after {
    bottom: -2px !important;
    height: 2px !important;
  }
}

/* --------------------------------------------------------------------------
   3. Frameless Architectural Showcase Card
   -------------------------------------------------------------------------- */
.duan-card-item {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

.duan-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none !important;
  color: inherit;
}

/* Media Showcase */
.duan-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10.5;
  overflow: hidden;
  border-radius: 12px;
  background: #0a2239;
  box-shadow: 0 6px 20px rgba(10, 34, 57, 0.06);
  transition: box-shadow 0.35s ease;
}

.duan-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.duan-card-item:hover .duan-card-media {
  box-shadow: 0 16px 36px rgba(10, 34, 57, 0.12);
}

.duan-card-item:hover .duan-card-media img {
  transform: scale(1.045);
}

/* Placeholder for missing image */
.duan-card-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a2239 0%, #13628e 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Subtle corner arrow badge on hover */
.duan-card-hover-overlay {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.duan-card-hover-arrow {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #0a2239;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(4px);
}

.duan-card-item:hover .duan-card-hover-overlay {
  opacity: 1;
  transform: translateY(0);
}

/* Card Body - Seamlessly below photo, no bulky white box */
.duan-card-body {
  padding: 16px 2px 6px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Meta Category & Specs row */
.duan-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #0e5f8a;
  margin-bottom: 6px;
}

.duan-card-cat {
  color: #000;
}

.duan-card-meta-sep {
  color: #cbd5e1;
  font-size: 11px;
}

.duan-card-spec {
  color: #64748b;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Title */
.duan-card-title {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.35;
  color: #0a2239;
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.22s ease;
}

.duan-card-item:hover .duan-card-title {
  color: #0e5f8a;
}

/* Explore CTA */
.duan-card-cta {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.22s ease, gap 0.22s ease;
}

.duan-card-cta svg {
  transition: transform 0.22s ease;
}

.duan-no-posts {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
  font-size: 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
}

/* --------------------------------------------------------------------------
   4. Loading State & Spinner
   -------------------------------------------------------------------------- */
.duan-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  border-radius: 12px;
}

.duan-grid-wrapper.is-loading .duan-loading-overlay {
  opacity: 1;
  pointer-events: auto;
}

.duan-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid #e2e8f0;
  border-top-color: #0a2239;
  border-radius: 50%;
  animation: duan-spin 0.8s linear infinite;
}

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

/* --------------------------------------------------------------------------
   5. Pagination Styling
   -------------------------------------------------------------------------- */
.duan-pagination-wrap {
  margin-top: 50px;
  display: flex;
  justify-content: center;
}

.duan-page-numbers {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.duan-page-item {
  display: inline-block;
  margin: 0px !important;
}

.duan-page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s ease;
  cursor: pointer;
  box-sizing: border-box;
}

.duan-page-link:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: #f8fafc;
}

.duan-page-item.is-current .duan-page-link,
.duan-page-link.current {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(10, 34, 57, 0.2);
  cursor: default;
}

.duan-page-item.is-dots .duan-page-link {
  border: none;
  background: transparent;
  cursor: default;
}