/* ---------------------------------------
   Hanex Colours Page Layout
--------------------------------------- */

.hanex-page {
  padding: 10px;
}

.hanex-header h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.hanex-sub {
  margin: 0;
  opacity: .75;
}

.hanex-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  align-items: start;
  padding-top: 40px;
}

.hanex-layout--images-only {
  grid-template-columns: 1fr;
}

.hanex-layout--images-only .hanex-panel {
  display: none;
}

/* ---------------------------------------
   Filter Panel
--------------------------------------- */

.hanex-panel {
  position: sticky;
  top: 90px; /* adjust to your fixed nav height */
  border: 1px solid #e6e6e6;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.hanex-fs {
  border: 0;
  padding: 0;
  margin: 0 0 14px;
}

.hanex-fs legend {
  font-weight: 650;
  margin-bottom: 8px;
}

.hanex-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.hanex-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: #f7f7f7;
  cursor: pointer;
}

.hanex-count {
  margin: 10px 0 0;
  font-size: 14px;
  opacity: .75;
}

/* ---------------------------------------
   Swatch Grid
--------------------------------------- */

.hanex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.hanex-swatch {
  border: 1px solid #eee;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.hanex-link {
  display: grid;
  text-decoration: none;
  color: inherit;
}

/* Equal height thumbnails */
.hanex-img {
  width: 100%;
  height: 170px;
  object-fit: cover; /* change to contain if preferred */
  display: block;
}

/* Center caption text */
.hanex-cap {
  padding: 10px 12px 12px;
  text-align: center;
}

.hanex-name {
  font-size: 14px;
}

/* ---------------------------------------
   Modal
--------------------------------------- */

.hanex-modal[hidden] {
  display: none;
}

.hanex-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.hanex-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
}

/* Modal panel */
.hanex-modal__panel {
  position: relative;
  margin: 4vh auto;
  width: min(920px, 92vw);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  padding: 12px 16px 16px;
}

/* Header inline layout */
.hanex-modal__header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
  margin-bottom: 12px;
}

/* Perfectly centered title */
.hanex-modal__title {
  margin: 0;
  text-align: center;
  font-size: 22px;
  line-height: 1.2;
}

/* Close button inline */
.hanex-modal__close {
  border: 0;
  background: #f2f2f2;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

/* Image */
.hanex-modal__img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* ---------------------------------------
   Filters Toggle Button (Desktop hidden)
--------------------------------------- */

/* Hide the Filters button on desktop (sidebar stays visible) */
.hanex-filters-toggle {
  display: none;
}

@media (max-width: 900px) {
  .hanex-filters-toggle {
    display: block;
  }
}

/* ---------------------------------------
   Responsive
--------------------------------------- */

@media (max-width: 900px) {
  .hanex-layout {
    grid-template-columns: 1fr;
  }

  .hanex-panel {
    position: relative;
    top: 0;
  }

  /* Mobile Filters Toggle Button */
  .hanex-filters-toggle {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #ddd;
    background: #f7f7f7;
    cursor: pointer;
    font-weight: 600;
    text-align: left;
  }

  /* Wrap that we hide/show */
  .hanex-filters-wrap[hidden] {
    display: none;
  }

  .hanex-filters-wrap {
    margin-top: 10px;
  }

  .tc__media { display: none; }
}

/* ---------------------------------------
   Prevent scroll when modal open
--------------------------------------- */

html.hanex-modal-open,
html.hanex-modal-open body {
  overflow: hidden;
}
