.cooldrama-explore {
  width: 100%;
  overflow-x: hidden; /* prevent horizontal scroll on wide filter rows */
  background: var(--cooldrama-theme-page-bg);
  color: var(--template-color-body);
}
/* Some themes constrain .site-main to content width; allow Explore to use wide container */
.cooldrama-explore.site-main {
  max-width: none !important;
  background: var(--cooldrama-theme-page-bg);
}

/* Prevent Explore styles from being overridden by theme/global link styles */
.cooldrama-explore a { text-decoration: none !important; }

/* Fix header menu overlay/position on Explore/Country pages (responsive menu + dropdowns) */
/* CSS is only enqueued on Explore + country archives, so global selectors are safe here. */
.wp-block-template-part,
header {
  position: relative;
  z-index: 9998;
}

.wp-block-navigation__responsive-container,
.wp-block-navigation__submenu-container {
  z-index: 9999;
}

/* Match Cooldrama archive layout (wide container, like All Archives template) */
.cooldrama-explore-inner {
  width: 100%;
  max-width: none !important;
  margin-left: 0;
  margin-right: 0;
  /* Match Video Library container padding */
  padding-left: var(--wp--preset--spacing--40, clamp(16px, 2vw, 28px));
  padding-right: var(--wp--preset--spacing--40, clamp(16px, 2vw, 28px));
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  background: transparent;
  color: inherit;
}

/* Filter menus (no <br> / <p>) */
.cooldrama-explore-filters {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1rem;
  padding: 0.25rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.cooldrama-explore-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: center;
}

.cooldrama-explore-row-title {
  display: none;
}

.cooldrama-explore-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 100%;
  width: 100%;
  gap: 0;
}

.cooldrama-explore-menu li {
  max-width: 100%;
  margin: 2px;
}

.cooldrama-explore .cooldrama-explore-menu a {
  position: relative;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--pl-surface-border);
  border-radius: 16px;
  background-color: var(--pl-surface-soft);
  color: var(--pl-text);
  box-shadow: none;
  text-decoration: none !important;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: default;
  min-height: 32px;
  height: 1px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.cooldrama-explore .cooldrama-explore-menu a:hover {
  background-color: var(--pl-surface-soft-hover);
  border-color: var(--pl-surface-border-hover);
  color: var(--playlist-color);
}

.cooldrama-explore .cooldrama-explore-menu a.is-active {
  border-color: var(--cooldrama-theme-soft-active-border);
  background-color: var(--cooldrama-theme-soft-active-bg);
  color: var(--cooldrama-theme-soft-active-text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--playlist-color) 12%, transparent);
}

.cooldrama-explore .cooldrama-explore-menu a:focus-visible {
  outline: 2px solid var(--playlist-color);
  outline-offset: 2px;
}

/* Grid */
.cooldrama-explore .cooldrama-explore-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(5, minmax(0px, 1fr));
  width: 100%;
}

@media (max-width: 75rem) {
  .cooldrama-explore .cooldrama-explore-menu a {
    font-size: 0.8rem;
  }
}

@media (max-width: 62.5rem) {
  /* Keep selector specificity >= base rule so it actually overrides. */
  .cooldrama-explore .cooldrama-explore-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }

  .cooldrama-explore-row:has(.cooldrama-explore-menu) {
    display: flex;
    align-items: center;
  }

  .cooldrama-explore-menu {
    width: 100%;
    flex: none;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
  }

  .cooldrama-explore-menu li {
    flex: 0 0 auto;
    margin: 1px;
  }

  .cooldrama-explore .cooldrama-explore-menu a {
    white-space: nowrap;
  }
}

@media (max-width: 48rem) {
  .cooldrama-explore .cooldrama-explore-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 1rem;
  }

  .cooldrama-explore-filters {
    gap: 0.8rem;
    margin-bottom: 1.2rem;
    padding: 0.2rem 0;
  }

  .cooldrama-explore-row {
    gap: 0;
    display: block;
  }

  .cooldrama-explore-menu {
    width: 100%;
    flex-wrap: nowrap;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.15rem;
  }

  .cooldrama-explore-menu::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .cooldrama-explore-menu li {
    flex: 0 0 auto;
  }

  .cooldrama-explore .cooldrama-explore-menu a {
    font-size: 0.78rem;
  }

  .cooldrama-explore-title {
    padding: 0.75rem;
    font-size: 0.94rem;
    min-height: 0;
  }
}

@media (max-width: 37.5rem) {
  .cooldrama-explore-inner {
    padding-left: var(--wp--preset--spacing--10, 0.75rem);
    padding-right: var(--wp--preset--spacing--10, 0.75rem);
  }

  .cooldrama-explore-filters {
    gap: 0.7rem;
    padding: 0.15rem 0;
  }

  .cooldrama-explore .cooldrama-explore-menu a {
    font-size: 0.76rem;
  }

  .cooldrama-explore .cooldrama-explore-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 0.875rem; }
}

@media (max-width: 23rem) {
  .cooldrama-explore .cooldrama-explore-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .cooldrama-explore .cooldrama-explore-menu a {
    font-size: 0.78rem;
  }
}

/* Poster cards */
.cooldrama-explore-card {
  display: flex;
  border-radius: var(--wp--preset--border-radius--sm);
  overflow: hidden;
  background: var(--cooldrama-theme-card-bg);
  color: var(--cooldrama-theme-panel-text);
  box-shadow: var(--wp--preset--shadow--sm, 0 2px 4px rgba(0, 0, 0, 0.26));
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

.cooldrama-explore-card a {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.cooldrama-explore-poster {
  position: relative;
  aspect-ratio: 16 / 9 !important;
  background: var(--pl-surface-soft);
}

.cooldrama-explore-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover !important;
  display: block;
}

.cooldrama-explore-poster::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 1));
  pointer-events: none;
}

.cooldrama-explore-badge {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0.25rem 0.45rem;
  border-radius: 0.375rem;
  background: rgba(0,0,0,0.55);
  font-size: 0.75rem;
  line-height: 1;
}

.cooldrama-explore-title {
  padding: 0.875rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  display: block;
  min-height: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--cooldrama-theme-card-header-bg);
  color: var(--cooldrama-theme-panel-text);
}
