/* Wrapper & layout */
.ele-te * { box-sizing: border-box; } /* (safe guard when embedded) */
.epg-wrapper { position: relative; }

/* 1) STATE RESET (your block) */
.epg-wrapper :focus,
.epg-wrapper :focus-visible,
.epg-wrapper :focus-within,
.epg-wrapper :active,
.epg-wrapper :target,
.epg-wrapper button:focus,
.epg-wrapper button:focus-visible,
.epg-wrapper button:focus-within,
.epg-wrapper button:active,
.epg-wrapper button:target,
.epg-wrapper a:focus,
.epg-wrapper a:focus-visible,
.epg-wrapper a:focus-within,
.epg-wrapper a:link,
.epg-wrapper a:visited,
.epg-wrapper a:active,
.epg-wrapper a:target {
  outline: none;
  background: initial;
  color: initial;
}

/* main area with optional sidebar — use GRID consistently */
.epg-main {
  display: grid;
  grid-template-columns: 1fr;
}
.epg-main.has-sidebar{
  gap:24px;
}

.epg-sidebar-left,
.epg-sidebar-right {
  grid-area: filters;
}

/* Left sidebar (legacy key "sidebar") */
.epg-wrapper.epg-filter-sidebar .epg-main {
  grid-template-columns: 240px 1fr;
  grid-template-areas: "filters content";
}

/* Right sidebar (new) */
.epg-wrapper.epg-filter-right_sidebar .epg-main {
  grid-template-columns: 1fr 240px;
  grid-template-areas: "content filters";
}

.epg-sidebar {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 2px;
  padding: 14px;
  height: max-content;
  position: sticky;
  top: 20px;
}

/* ----- Filters + sort ----- */

.epg-filter {
  margin: 0 0 10px;
}

/* Sort dropdown */
.epg-sort {
  margin-bottom: 8px;
}

.epg-sort-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #555;
}

.epg-sort-label-text {
  font-weight: 500;
  flex-shrink:0;
}

.epg-sort-select {
  padding: 6px 12px;
  border-radius: 0;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 13px;
  outline: none;
}

.epg-sort-select:focus{
  border-color:#ddd;
}

/* Category chips container */
.epg-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0px;
}

.epg-sidebar .epg-filter-chips {
  gap: 0;
}

/* Sidebar filter chips vertically (desktop/tablet) */
.epg-filter.epg-filter-pos-left .epg-filter-chips,
.epg-filter.epg-filter-pos-right .epg-filter-chips,
.epg-filter.epg-filter-pos-sidebar .epg-filter-chips {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
}

/* Make sidebar filter items full-width */
.epg-filter.epg-filter-pos-left .epg-filter-item,
.epg-filter.epg-filter-pos-right .epg-filter-item,
.epg-filter.epg-filter-pos-sidebar .epg-filter-item {
  width: 100%;
  text-align: left;
}

/* Filter buttons (space for icon + label) */
.epg-filter-item {
  appearance: none;
  border: 1px solid #eee;
  border-right-width: 0.5px;
  border-left-width: 0.5px;
  background: #fff;
  color: #333;
  border-radius: 0px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.epg-sidebar .epg-filter-item {
  border-radius: 0;
  border: 0;
  background: transparent;
  padding: 12px 0px;
  border-bottom: 1px solid #E0E0E0;
}

.epg-sidebar button.epg-filter-item.is-active,
.epg-sidebar button.epg-filter-item:hover,
.epg-sidebar button.epg-filter-item:active {
  border-color: #f26;
  color: #f26;
  background: transparent;
}

button.epg-filter-item.is-active,
button.epg-filter-item:hover,
button.epg-filter-item:active {
  border-color: #C7C7C7;
  color: #fff;
  background: #C7C7C7;
}

.epg-sidebar .epg-filter-item{
  margin-bottom:0;
}

/* Icon wrapper generated from Elementor Icons control */
.epg-filter-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.epg-filter-icon svg,
.epg-filter-icon i {
  width: 14px;
  height: 14px;
}

.epg-filter-icon svg {
  fill: currentColor;
}

/* Sticky filters inside sidebars */
.epg-wrapper .epg-sidebar-left .epg-filter,
.epg-wrapper .epg-sidebar-right .epg-filter {
  position: sticky;
  top: 0;
}

/* spacing helper for top strip */
.epg-wrapper .epg-filter.epg-filter-pos-top {
  margin-bottom: 16px;
}

/* ----- Top Strip: inline sort + categories ----- */

/* For Top Strip, the sort is injected as first chip (left of "All").
   Align chips center and remove extra bottom margin on sort. */
.epg-filter.epg-filter-pos-top .epg-filter-chips {
  align-items: center;
}

.epg-filter.epg-filter-pos-top .epg-sort {
  margin-bottom: 10px;
  margin-right: 10px;
}

/* Horizontal label + select for top strip */
.epg-filter.epg-filter-pos-top .epg-sort-label {
  flex-direction: row;
  align-items: center;
}

.epg-filter.epg-filter-pos-top .epg-sort-label-text {
  margin-right: 6px;
}

/* ----- Grid (cards area) ----- */
.epg-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(var(--epg-cols-desktop,3), minmax(0,1fr));
}
@media (max-width:1024px){
  .epg-grid {
    grid-template-columns: repeat(var(--epg-cols-tablet,2), minmax(0,1fr));
  }
}
@media (max-width:767px){
  .epg-grid {
    grid-template-columns: repeat(var(--epg-cols-mobile,1), minmax(0,1fr));
  }
}

/* cards */
.epg-card {
  display: flex;
  flex-direction: column;
  background:#fafafa;
  border:1px solid #eee;
  border-radius: 2px;
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.epg-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.08);
  transform: translateY(-1px);
}

/* media wrapper (thumb + overlay cats) */
.epg-media {
  position: relative;
  flex: 0 0 auto;
}

/* NEW: body wrapper for text area (title + meta + excerpt + readmore) */
.epg-body {
  flex: 1 1 auto;
  display: block;
}

/* thumbnail */
.epg-thumb {
  display:block;
  background:#f7f7f7;
  overflow:hidden;
  height:100%;
}
img.epg-thumb-img {
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

.epg-thumb .post .wp-post-image{
  object-fit: fill;
}


/* Categories */
.epg-cats {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding: 10px 14px 0 14px; /* default fallback if used outside overlay */
}
.epg-cat {
  display:inline-block;
  font-size:11px;
  padding:4px 8px;
  border-radius: 999px;
  background:#eef6ff;
  color:#0b5fff;
  text-decoration:none;
  border:1px solid #daebff;
}

a.epg-cat:visited,
a.epg-cat:link{
  background:#eef6ff;
  color:#0b5fff;
  text-decoration:none;
}

/* overlay cats on bottom of thumbnail */
.epg-media .epg-cats {
  position:absolute;
  left:14px;
  bottom:14px;
  padding:0;
  margin:0;
}

/* title + meta + content */
.epg-title {
  font-size: 18px;
  line-height: 1.35;
  margin: 10px 14px 6px 14px;
}
.epg-title a {
  text-decoration:none;
  color: inherit;
}

.epg-meta {
  display:flex;
  flex-wrap: wrap;
  gap:10px;
  align-items:center;
  color:#666;
  font-size:12px;
  margin: 0 14px 8px;
}
.epg-meta-item {
  display:inline-flex;
  gap:3px;
  align-items:center;
}
.epg-ic {
  fill: currentColor;
  flex: 0 0 auto;
}

.epg-excerpt {
  color:#444;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 14px 10px;
}
.epg-readmore {
  margin: 0 14px 20px;
}
.elementor-widget-elemate_post_grid .epg-card .epg-readmore{
 margin-top:0 !important;
}
.epg-wrapper .epg-readmore a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  background: #f26;
  padding: 4px 9px 6px 9px;
}

/* ----- NEW LIST LAYOUT: thumb left, text right ----- */

/* When widget setting "Card Layout" = List (epg-card-layout-list) */
.epg-card-layout-list .epg-card {
  flex-direction: row;
}

/* Make media a fixed column on the left */
.epg-card-layout-list .epg-media {
  flex: 0 0 38%;
  max-width: 38%;
}

/* Text body on the right as vertical stack */
.epg-card-layout-list .epg-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Slightly tighten vertical spacing for list layout if needed */
.epg-card-layout-list .epg-title {
  margin-top: 8px;
}

.epg-card-layout-list .epg-readmore {
  margin-bottom: 16px;
}

/* ----- Pagination (first/prev/numbers/menu/next/last) ----- */

.epg-pagination {
  display: flex;
  justify-content: center; /* start from left */
  margin: 18px 0 0;
}

.epg-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Common style for page buttons */
.epg-page-control,
.epg-page-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 10px;
  border-radius: 2px;
  border: 1px solid #b1b1b1;
  background: #fff;
  color: #333;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.epg-page-last,
.epg-page-next,
.epg-page-first,
.epg-page-prev,
.epg-page-menu-toggle{
  font-size: 1.2em;
  padding: 10px 0;
}

.epg-page-control:hover,
.epg-page-num:not(.is-current):hover {
  background: #e2e2e2;
}

/* Current page */
.epg-page-num.is-current, 
.epg-page-num.is-current:active, 
.epg-page-num.is-current:focus, 
.epg-page-num.is-current:focus-within, 
.epg-page-num.is-current:focus-visible, 
.epg-page-num.is-current:target{
  background: #f26;
  border-color: #f26;
  color: #fff;
  cursor: default;
}

/* Disabled nav controls */
.epg-page-control.is-disabled,
.epg-page-control[disabled] {
  opacity: .4;
  cursor: not-allowed;
  box-shadow: none;
}

/* Page menu wrapper */
.epg-page-menu {
  position: relative;
}

/* Toggle button for menu uses same base style via .epg-page-control */

.epg-page-menu-svg {
  width: 0.9em;
  height: 0.9em;
  display: block;
}

/* Dropdown */
.epg-page-menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 80px;
  max-height: 220px;
  padding: 4px 0;
  border-radius: 4px;
  border: 1px solid #ddd;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  overflow-y: auto;          /* scrollable */
  z-index: 20;
  display: none;
}

.epg-page-menu.is-open .epg-page-menu-dropdown {
  display: block;
}

/* Items inside dropdown */
.epg-page-menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  color: #333;
}

.epg-page-menu-item:hover {
  background: #f5f5f5;
  color: #333;
}

/* loading */
.epg-wrapper.is-loading .epg-grid {
  opacity: .65;
  pointer-events: none;
  transition: opacity .2s ease;
}


/* When pagination = none and content exceeds rows×columns,
   JS adds .epg-grid-scroll and a max-height so this area scrolls */
.epg-grid.epg-grid-scroll {
  /* height is set inline via JS */
  overflow-y: auto;
  overflow-x: hidden;
}
/*
.epg-grid.epg-grid-scroll:hover {
  overflow-y: auto;
}
*/
/* ----- MOBILE BEHAVIOUR ----- */
@media (max-width: 767px) {

  /* Collapse left/right sidebars into a single column:
     filter block ABOVE the content block */
  .epg-wrapper.epg-filter-sidebar .epg-main,
  .epg-wrapper.epg-filter-right_sidebar .epg-main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "filters"
      "content";
  }

button.epg-filter-item.is-active, button.epg-filter-item:hover, button.epg-filter-item:active {
  border-color: #f26;
  color: #f26;
  background: transparent;
}

  /* On mobile, ALL filter positions use vertical, full-width chips */
  .epg-wrapper .epg-filter .epg-filter-chips {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap:0;
  }

	.epg-wrapper .epg-filter.epg-filter-pos-top{
	  margin-bottom: 16px;
	  background: #fafafa;
	  border: 1px solid #eee;
	  border-radius: 2px;
	  padding: 14px;
	  height: max-content;
	  position: relative;
    }

  .epg-wrapper .epg-filter .epg-filter-item {
    width: 100%;
    text-align: left;
    margin-bottom: 0;
  }

  .epg-wrapper .epg-filter .epg-sort {
    width: 100%;
  }

  .epg-filter-item {
    border-radius: 0;
    border: 0;
    background: transparent;
    padding: 12px 0px;
    border-bottom: 1px solid #E0E0E0;
  }

  .epg-sidebar{
    position: relative;
  }

  .epg-filter-item:hover {
    border-color: #f26;
    color:#fff;
  }

}
