/**
 * Promtel Post Grid & Category Filter Styles
 */

/* ==========================================================================
   Post Grid Container & Grid Layout
   ========================================================================== */
.promtel-post-grid-wrapper {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

.promtel-post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 32px;
  row-gap: 48px;
  width: 100%;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.promtel-post-grid-wrapper.is-loading .promtel-post-grid {
  opacity: 0.45;
  pointer-events: none;
}

/* ==========================================================================
   Post Card Layout
   ========================================================================== */
.promtel-post-card {
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

/* Newly loaded card animation */
.promtel-post-card.promtel-anim-fade-in {
  animation: promtelFadeUp 0.4s ease forwards;
}

@keyframes promtelFadeUp {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Featured Image (Default: 444px x 192px)
   ========================================================================== */
.promtel-post-thumb-wrapper {
  width: 100%;
  max-width: 444px;
  height: auto;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background-color: #e9ecef;
}

.promtel-post-thumb-link {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  text-decoration: none;
}

.promtel-post-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.promtel-post-card:hover .promtel-post-thumb {
  transform: scale(1.04);
}

.promtel-post-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f0f2f5 0%, #e2e6ea 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.promtel-post-thumb-placeholder::after {
  content: "";
  width: 36px;
  height: 36px;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230a142d'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* ==========================================================================
   Card Content & Metadata
   ========================================================================== */
.promtel-post-content {
  display: flex;
  flex-direction: column;
  padding-top: 16px;
}

.promtel-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #717b96;
  margin-bottom: 8px;
}

.promtel-meta-term {
  display: inline-block;
  transition: color 0.2s ease;
}

.promtel-meta-separator {
  display: inline-block;
  margin: 0 7px;
  color: #9aa1b3;
  user-select: none;
}

/* Post Title (Clamped to 2 lines inside grid cards) */
.promtel-post-card .promtel-post-title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  color: #0a142d;
  margin: 0;
  transition: color 0.2s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  box-sizing: border-box;
}

.promtel-post-card .promtel-post-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.promtel-post-card .promtel-post-title a:hover {
  color: #373e5b;
}

/* ==========================================================================
   Load More Button & Pagination
   ========================================================================== */
.promtel-grid-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 55px;
  width: 100%;
}

.promtel-load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 160px;
  background-color: transparent;
  color: #0a142d;
  border: 1.5px solid #0a142d;
  border-radius: 6px;
  padding: 13px 40px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  outline: none;
  transition: all 0.25s ease;
  user-select: none;
  position: relative;
}

.promtel-load-more-btn:hover {
  background-color: #0a142d;
  color: #ffffff;
  border-color: #0a142d;
}

.promtel-load-more-btn:active {
  transform: scale(0.98);
}

.promtel-load-more-btn:disabled,
.promtel-load-more-btn.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Spinner inside button */
.promtel-load-more-btn .btn-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: promtelSpinner 0.7s linear infinite;
}

.promtel-load-more-btn.is-loading .btn-spinner {
  display: inline-block;
}

@keyframes promtelSpinner {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Overlay Loader */
.promtel-grid-loading-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.promtel-post-grid-wrapper.is-loading .promtel-grid-loading-overlay {
  display: flex;
}

.promtel-overlay-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(10, 20, 45, 0.15);
  border-top-color: #0a142d;
  border-radius: 50%;
  animation: promtelSpinner 0.7s linear infinite;
}

/* Empty message */
.promtel-no-posts {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  font-size: 16px;
  color: #717b96;
}

/* ==========================================================================
   Category / Tag Filter Widget Styles
   ========================================================================== */
.promtel-category-filter-wrapper {
  width: 100%;
  margin-bottom: 30px;
  position: relative;
}

.promtel-filter-heading {
  font-size: 20px;
  font-weight: 700;
  color: #1b2a47;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 18px 0;
}

.promtel-filter-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.promtel-filter-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  background-color: transparent;
  color: #1b2a47;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  user-select: none;
}

.promtel-filter-item:hover {
  color: #0a142d;
  background-color: rgba(27, 42, 71, 0.06);
  border-color: #1b2a47;
}

.promtel-filter-item.active {
  background-color: #1b2a47;
  color: #ffffff;
  border-color: #1b2a47;
}

.promtel-filter-item:focus-visible {
  outline: 2px solid #1b2a47;
  outline-offset: 2px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
  .promtel-post-grid {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 24px;
    row-gap: 38px;
  }
}

@media (max-width: 768px) {
  .promtel-category-filter-wrapper {
    position: relative;
  }

  /* Mobile Horizontal Sliding Filter Bar */
  .promtel-filter-items {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    gap: 10px;
    padding: 2px 40px 6px 2px;
  }

  .promtel-filter-items::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  .promtel-filter-item {
    flex-shrink: 0;
    scroll-snap-align: start;
    white-space: nowrap;
    padding: 8px 18px;
    font-size: 12px;
    border: 1.5px solid #cbd5e1;
  }

  .promtel-filter-item.active {
    border-color: #1b2a47;
  }

  /* Right edge indicator showing more items exist on the right */
  .promtel-category-filter-wrapper::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 6px;
    width: 44px;
    height: 38px;
    background: linear-gradient(to right, rgba(244, 245, 247, 0) 0%, rgba(244, 245, 247, 0.95) 100%);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.25s ease;
  }

  .promtel-category-filter-wrapper.is-scrolled-end::after {
    opacity: 0;
  }
}

@media (max-width: 680px) {
  .promtel-post-grid {
    grid-template-columns: 1fr;
    column-gap: 16px;
    row-gap: 32px;
  }

  .promtel-post-thumb-wrapper {
    max-width: 100%;
  }

  .promtel-load-more-btn {
    width: 100%;
    max-width: 280px;
    padding: 12px 24px;
  }
}
