/* ==========================================================================
   Collection discovery hub
   Scoped under .collection-hub so nothing leaks into the rest of the theme.
   ========================================================================== */

.collection-hub {
	--ch-accent: #667eea;
	--ch-accent2: #764ba2;
	--ch-radius: 12px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 8px 0 48px;
}

/* ---------- Heading ---------- */
.collection-hub .ch-head { margin: 8px 4px 22px; }
.collection-hub .ch-title {
	margin: 0 0 8px;
	font-size: clamp(24px, 3.2vw, 34px);
	font-weight: 700;
	line-height: 1.15;
}
.collection-hub .ch-intro {
	margin: 0;
	max-width: 820px;
	font-size: 15px;
	line-height: 1.6;
	color: #5b6472;
}
body.dark .collection-hub .ch-intro { color: #aab2c0; }

/* ---------- Section heads ---------- */
.collection-hub .ch-section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 10px 4px 14px;
}
.collection-hub .ch-section-title { margin: 0; font-size: 19px; font-weight: 700; }
.collection-hub .ch-see-all {
	font-size: 13px; font-weight: 600; text-decoration: none;
	color: var(--ch-accent); white-space: nowrap;
}
.collection-hub .ch-see-all:hover { color: var(--ch-accent2); }

/* ---------- Hero ---------- */
.collection-hub .ch-hero { margin-bottom: 26px; }

/* ---------- Rolling pills ---------- */
.collection-hub .ch-rolling {
	display: flex; flex-wrap: wrap; gap: 10px;
	margin: 0 4px 26px;
}
.collection-hub .ch-pill {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 9px 16px; border-radius: 999px;
	background: linear-gradient(135deg, var(--ch-accent), var(--ch-accent2));
	color: #fff; text-decoration: none; font-weight: 600; font-size: 14px;
	box-shadow: 0 4px 14px rgba(102,126,234,.28);
	transition: transform .18s ease, box-shadow .18s ease;
}
.collection-hub .ch-pill:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(102,126,234,.4); color:#fff; }
.collection-hub .ch-pill__count {
	background: rgba(255,255,255,.22); border-radius: 999px;
	padding: 1px 9px; font-size: 12px; font-weight: 700;
}

/* ---------- Tabs ---------- */
.collection-hub .ch-tabs {
	display: flex; gap: 6px; margin: 0 4px 18px;
	border-bottom: 1px solid rgba(0,0,0,.08);
}
body.dark .collection-hub .ch-tabs { border-bottom-color: rgba(255,255,255,.1); }
.collection-hub .ch-tab {
	appearance: none; border: 0; background: transparent; cursor: pointer;
	padding: 12px 18px; font-size: 15px; font-weight: 600; color: #6b7280;
	border-bottom: 3px solid transparent; margin-bottom: -1px;
	transition: color .15s ease, border-color .15s ease;
}
.collection-hub .ch-tab:hover { color: var(--ch-accent); }
.collection-hub .ch-tab.is-active { color: var(--ch-accent); border-bottom-color: var(--ch-accent); }
body.dark .collection-hub .ch-tab { color: #9ca3af; }
body.dark .collection-hub .ch-tab.is-active { color: #fff; border-bottom-color: var(--ch-accent); }

/* ---------- Filter bar ---------- */
.collection-hub .ch-filters {
	background: rgba(248,250,252,.8);
	border: 1px solid rgba(0,0,0,.06);
	border-radius: var(--ch-radius);
	padding: 16px; margin: 0 4px 18px;
	display: flex; flex-direction: column; gap: 14px;
}
body.dark .collection-hub .ch-filters { background: rgba(30,30,38,.7); border-color: rgba(255,255,255,.08); }

.collection-hub .ch-periods { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.collection-hub .ch-periods.is-dim { opacity: .45; }
.collection-hub .ch-period {
	appearance: none; cursor: pointer;
	border: 1px solid rgba(0,0,0,.1); background: #fff; color: #374151;
	padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
	transition: all .15s ease;
}
body.dark .collection-hub .ch-period { background: #2b2b33; color: #e5e7eb; border-color: rgba(255,255,255,.12); }
.collection-hub .ch-period:hover { border-color: var(--ch-accent); color: var(--ch-accent); }
.collection-hub .ch-period.is-active {
	background: linear-gradient(135deg, var(--ch-accent), var(--ch-accent2));
	color: #fff; border-color: transparent;
}

.collection-hub .ch-controls { display: flex; flex-wrap: wrap; gap: 12px; }
.collection-hub .ch-field { display: flex; flex-direction: column; gap: 4px; }
.collection-hub .ch-field--search { flex: 1 1 240px; }
.collection-hub .ch-field__label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #9ca3af; }
.collection-hub .ch-sort,
.collection-hub .ch-search,
.collection-hub .ch-coll-sort {
	appearance: none;
	border: 1px solid rgba(0,0,0,.12); border-radius: 10px;
	background: #fff; color: #1f2937;
	padding: 10px 14px; font-size: 14px; width: 100%;
}
body.dark .collection-hub .ch-sort,
body.dark .collection-hub .ch-search,
body.dark .collection-hub .ch-coll-sort { background: #1f1f27; color: #e5e7eb; border-color: rgba(255,255,255,.12); }
.collection-hub .ch-sort:focus,
.collection-hub .ch-search:focus,
.collection-hub .ch-coll-sort:focus { outline: 2px solid var(--ch-accent); outline-offset: 1px; }

/* ---------- Tag chips ---------- */
.collection-hub .ch-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.collection-hub .ch-chip {
	appearance: none; cursor: pointer;
	border: 1px solid rgba(0,0,0,.1); background: #fff; color: #4b5563;
	padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
	transition: all .15s ease;
}
body.dark .collection-hub .ch-chip { background: #2b2b33; color: #cbd2dc; border-color: rgba(255,255,255,.1); }
.collection-hub .ch-chip:hover { border-color: var(--ch-accent); color: var(--ch-accent); }
.collection-hub .ch-chip.is-active {
	background: var(--ch-accent); color: #fff; border-color: transparent;
}

/* ---------- Status ---------- */
.collection-hub .ch-status:not(:empty) {
	margin: 0 4px 14px; padding: 10px 14px;
	font-size: 13.5px; color: #6b7280;
	background: rgba(102,126,234,.08); border-radius: 8px;
}
body.dark .collection-hub .ch-status:not(:empty) { color: #aab2c0; background: rgba(102,126,234,.14); }

/* ---------- Grids ---------- */
.collection-hub .manga-listing,
.collection-hub .ch-hero-grid,
.collection-hub .ch-results {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
	gap: 16px;
	margin: 0 4px;
}
.collection-hub .ch-collections.listing {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 20px;
	margin: 0 4px;
}

/* Comic card safety styles (work in + out of the main loop) */
.collection-hub .ch-results .collection,
.collection-hub .ch-hero-grid .collection { position: relative; }
.collection-hub .collection .item_thumbnail img.image {
	width: 100%; height: auto; aspect-ratio: 11 / 16;
	object-fit: cover; border-radius: 8px; display: block;
}
.collection-hub .ch-results .title,
.collection-hub .ch-hero-grid .title {
	font-size: 13px; font-weight: 600; line-height: 1.3;
	margin: 8px 0 4px;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.collection-hub .item__meta__bottom {
	display: flex; flex-wrap: wrap; gap: 10px;
	font-size: 11.5px; color: #8b93a1;
}
.collection-hub .item__meta__bottom > div { display: inline-flex; align-items: center; gap: 4px; }

/* Collection (list) cards */
.collection-hub .ch-collections .collection {
	background: rgba(248,250,252,.7);
	border: 1px solid rgba(0,0,0,.06);
	border-radius: var(--ch-radius);
	padding: 16px;
	transition: transform .18s ease, box-shadow .18s ease;
}
body.dark .collection-hub .ch-collections .collection { background: rgba(30,30,38,.6); border-color: rgba(255,255,255,.07); }
.collection-hub .ch-collections .collection:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.1); }
.collection-hub .ch-collections .collection .title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.collection-hub .ch-collections .collection__desc { font-size: 12.5px; color: #8b93a1; margin-bottom: 10px; }
.collection-hub .ch-collections .collection-item-thumbnail-wrapper { display: flex; gap: 8px; margin-bottom: 10px; }
.collection-hub .ch-collections .collection-item-thumbnail-wrapper img.image {
	width: 100%; height: auto; aspect-ratio: 11 / 16; object-fit: cover; border-radius: 6px;
}
.collection-hub .ch-collections .collection .link {
	display: inline-block; font-size: 13px; font-weight: 600;
	color: var(--ch-accent); text-decoration: none;
}
.collection-hub .ch-collections .collection .link:hover { color: var(--ch-accent2); }

/* ---------- Coll controls + Load more ---------- */
.collection-hub .ch-coll-controls { margin: 0 4px 16px; }
.collection-hub .ch-coll-controls .ch-field { max-width: 220px; }

.collection-hub .ch-pagination-wrap { text-align: center; margin: 28px 0 6px; }
.collection-hub .ch-pagination {
	display: inline-flex; flex-wrap: wrap; justify-content: center;
	align-items: center; gap: 6px;
}
.collection-hub .ch-page {
	appearance: none; cursor: pointer;
	min-width: 38px; padding: 9px 12px; border-radius: 10px;
	border: 1px solid rgba(255,255,255,.12);
	background: rgba(255,255,255,.05);
	color: inherit; font-weight: 600; font-size: 14px; line-height: 1;
	transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.collection-hub .ch-page:hover:not(:disabled) {
	transform: translateY(-2px);
	background: rgba(255,255,255,.1);
	box-shadow: 0 6px 18px rgba(102,126,234,.3);
}
.collection-hub .ch-page.is-current {
	background: linear-gradient(135deg, var(--ch-accent), var(--ch-accent2));
	border-color: transparent; color: #fff; cursor: default;
	box-shadow: 0 4px 16px rgba(102,126,234,.3);
}
.collection-hub .ch-page-gap { padding: 0 2px; opacity: .55; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
	.collection-hub .manga-listing,
	.collection-hub .ch-hero-grid,
	.collection-hub .ch-results { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
	.collection-hub .ch-collections.listing { grid-template-columns: 1fr; }
	.collection-hub .ch-controls { flex-direction: column; }
	.collection-hub .ch-field--search { flex-basis: auto; }
}
