@media (min-width: 576px)  { :root { --square-grid-cols: 2; } }
@media (min-width: 768px)  { :root { --square-grid-cols: 2; } }
@media (min-width: 992px)  { :root { --square-grid-cols: 2; } }
@media (min-width: 1200px) { :root { --square-grid-cols: 4; } }
@media (min-width: 1400px) { :root { --square-grid-cols: 4; } }

.sq-grid {
  display: grid;
  container-type: inline-size;
  grid-template-columns: repeat(var(--square-grid-cols), 1fr);
  --sq-unit: calc((100cqw - (var(--square-grid-cols) - 1) * var(--default-padding)) / var(--square-grid-cols));
  grid-auto-rows: var(--sq-unit);
  grid-auto-flow: dense;
  gap: var(--default-padding);
  width: 100%;
  
  /* Math: (Total Width - Total Gaps) / Number of Columns */
  

}

/* 2. The Base Cell */
.sq-cell {
  overflow: hidden;
  position: relative;
}
.sq-1x1 { grid-area: span 1 / span 1; }
.sq-1x2 { grid-area: span 2 / span 1; }
.sq-2x1 { grid-area: span 1 / span 2; }
.sq-2x2 { grid-area: span 2 / span 2; }
.sq-below { 
  grid-column-start: 1;
  /* grid-column: 1 / span 1; -> FROM CLAUDE */
}



/* 4. Content Handling */
.post-cnt {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.image-cnt {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.image-cnt img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  grid-column: 1;
  grid-row: 1;
}

.tags-overlay {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  justify-self: end;
  text-align: right;
  padding: calc(var(--default-padding) / 2);
  z-index: 1;
  display: flex;
  gap:calc(var(--default-padding) / 2);
}

.post-published-date {
  font-size: 0.667rem;
  font-weight: 500;
  line-height: 1.5rem;
}

.post-title {
  font-size: 1rem;
  font-weight: 500;
}

.post-title a,
.post-title a:hover,
.post-title a:active
{
  font-size: 1rem;
  color: var(--color-white);
}

/*Filters & Pagination */

.pagination-section {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}
.filter-cnt {
  display: flex;
  gap: var(--default-padding);
  align-items: center;
}
  .filter-label {
    font-size: 0.833rem;
    font-weight: 500;
    line-height: 0.833rem;
    text-align: right;
    color: rgb(255, 3, 255);
    text-wrap-mode: nowrap;
  }
  .filter-select-dropdown {
    background-color: rgb(0, 0, 0);
    color: rgb(255, 3, 255);
    border: 2px solid rgb(255, 3, 255);
    line-height: 0.833rem;
    cursor: pointer;
    width: 140px;
    
    display: inline-flex;
    font-size: 0.75rem;
    padding: 0.25rem 0.833rem;
    border-radius: 0.833rem;
  }

.pagination-cnt {
  display: flex;
  gap: var(--default-padding);
  align-items: center;
  color: rgb(255, 3, 255);
}
  .pagination-prev,
  .pagination-next {
    background-color: rgb(0, 0, 0);
    color: rgb(255, 3, 255);
    border: 2px solid rgb(128, 0, 128);
    padding: 0;
    margin: 0;
    border-radius: 50%;
    cursor: pointer;
    width: 1.7rem;
    height: 1.7rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .pagination-label {
    font-size: 0.833rem;
    font-weight: 500;
    line-height: 0.833rem;
    text-align: right;
  }

/* Small devices */
@media (min-width: 576px) {
  .sq-sm-1x1 { grid-area: span 1 / span 1; }
  .sq-sm-1x2 { grid-area: span 2 / span 1; }
  .sq-sm-2x1 { grid-area: span 1 / span 2; }
  .sq-sm-2x2 { grid-area: span 2 / span 2; }
  .sq-sm-below { grid-column-start: 1; }
}

/* Medium devices */
@media (min-width: 768px) {
  
  .sq-md-1x1 { grid-area: span 1 / span 1; }
  .sq-md-1x2 { grid-area: span 2 / span 1; }
  .sq-md-2x1 { grid-area: span 1 / span 2; }
  .sq-md-2x2 { grid-area: span 2 / span 2; }
  .sq-md-below { grid-column-start: 1; }
  
  .pagination-section {
    flex-direction: row;
  }
  
}

/* Large devices */
@media (min-width: 992px) {
  .sq-lg-1x1 { grid-area: span 1 / span 1; }
  .sq-lg-1x2 { grid-area: span 2 / span 1; }
  .sq-lg-2x1 { grid-area: span 1 / span 2; }
  .sq-lg-2x2 { grid-area: span 2 / span 2; }
  .sq-lg-below { grid-column-start: 1; }
}

/* X-Large devices */
@media (min-width: 1200px) {
  .sq-xl-1x1 { grid-area: span 1 / span 1; }
  .sq-xl-1x2 { grid-area: span 2 / span 1; }
  .sq-xl-2x1 { grid-area: span 1 / span 2; }
  .sq-xl-2x2 { grid-area: span 2 / span 2; }
  .sq-xl-below { grid-column-start: 1; }
}

/* XX-Large devices */
@media (min-width: 1400px) {
  .sq-xxl-1x1 { grid-area: span 1 / span 1; }
  .sq-xxl-1x2 { grid-area: span 2 / span 1; }
  .sq-xxl-2x1 { grid-area: span 1 / span 2; }
  .sq-xxl-2x2 { grid-area: span 2 / span 2; }
  .sq-xxl-below { grid-column-start: 1; }
}