/* ============================================================
   Keng Downloads — frontend styles
   ============================================================ */
.kengdl-wrap {
	/* Accent: prefer the theme's primary-ish palette colours. Seed4 and many
	   block themes expose accent-1 / accent-2 (not "primary"), so try several. */
	--kengdl-accent: var(--wp--preset--color--accent-1, var(--wp--preset--color--primary, #074488));
	--kengdl-accent-hover: var(--wp--preset--color--accent-2, var(--wp--preset--color--accent-1, #005ABA));
	--kengdl-text: var(--wp--preset--color--contrast, inherit);
	--kengdl-border: var(--wp--preset--color--line-alt, #e5e7eb);

	width: 100%;
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-left: auto;
	margin-right: auto;
	padding: 24px 0 60px;
	color: var(--kengdl-text);
	font-family: inherit;
	box-sizing: border-box;
}

/* Theme-width containers used by our single/archive templates. They reuse the
   theme's content/wide sizes so our pages line up with the rest of the site. */
.kengdl-constrain {
	box-sizing: border-box;
	margin-left: auto;
	margin-right: auto;
	width: 100%;
	padding-left: var(--wp--preset--spacing--50, 20px);
	padding-right: var(--wp--preset--spacing--50, 20px);
}
.kengdl-constrain--content { max-width: var(--wp--style--global--content-size, 750px); }
.kengdl-constrain--wide { max-width: var(--wp--style--global--wide-size, 1200px); }
.kengdl-main-wrap { margin-top: 0; padding: var(--wp--preset--spacing--50, 32px) 0; }

/* Carry the accent variables on the injected single + archive roots too. */
.kengdl-single, .kengdl-archive {
	--kengdl-accent: var(--wp--preset--color--accent-1, var(--wp--preset--color--primary, #074488));
	--kengdl-accent-hover: var(--wp--preset--color--accent-2, var(--wp--preset--color--accent-1, #005ABA));
	--kengdl-border: var(--wp--preset--color--line-alt, #e5e7eb);
	font-family: inherit;
}

/* ---------- Buttons ---------- */
.kengdl-btn {
	display: inline-block;
	background: var(--kengdl-accent);
	color: #fff;
	padding: 11px 26px;
	border-radius: 8px;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.2;
	transition: filter .15s ease, background .15s ease;
	white-space: nowrap;
	border: none;
	cursor: pointer;
}
.kengdl-btn:hover { filter: brightness(0.92); color: #fff; }
.kengdl-btn--block { display: block; text-align: center; margin: 16px 0; }

.kengdl-link { color: var(--kengdl-accent); text-decoration: none; font-weight: 600; }
.kengdl-link:hover { text-decoration: underline; }

/* ============================================================
   ARCHIVE / GRID
   ============================================================ */
.kengdl-archive__title {
	font-size: 30px;
	margin: 0 0 18px;
}

.kengdl-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 28px;
	border-bottom: 1px solid #e5e7eb;
	padding-bottom: 16px;
}
.kengdl-filter__item {
	padding: 6px 14px;
	border-radius: 999px;
	background: #f3f4f6;
	color: #374151;
	text-decoration: none;
	font-size: 14px;
	transition: all .15s ease;
}
.kengdl-filter__item:hover { background: #e5e7eb; }
.kengdl-filter__item.is-active { background: var(--kengdl-accent); color: #fff; }

.kengdl-grid {
	display: grid;
	gap: 22px;
}
.kengdl-cols-2 { grid-template-columns: repeat(2, 1fr); }
.kengdl-cols-3 { grid-template-columns: repeat(3, 1fr); }
.kengdl-cols-4 { grid-template-columns: repeat(4, 1fr); }

.kengdl-card {
	display: flex;
	flex-direction: column;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	overflow: hidden;
	background: #fff;
	text-decoration: none;
	color: inherit;
	transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.kengdl-card:hover {
	box-shadow: 0 12px 28px rgba(0,0,0,.10);
	transform: translateY(-3px);
	border-color: #c7d2fe;
}
.kengdl-card__thumb {
	aspect-ratio: 16 / 9;
	background: linear-gradient(135deg, #1e3a8a, #2563eb);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.kengdl-card__img { width: 100%; height: 100%; object-fit: cover; }
.kengdl-card__placeholder { color: #fff; font-size: 42px; opacity: .85; }

.kengdl-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kengdl-card__title { font-size: 18px; margin: 0; line-height: 1.3; }
.kengdl-card__excerpt { margin: 0; font-size: 14px; color: #6b7280; line-height: 1.5; flex: 1; }
.kengdl-card__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 4px;
}
.kengdl-card__version { font-size: 13px; color: #6b7280; font-weight: 600; }

/* ---------- Stars ---------- */
.kengdl-stars { display: inline-flex; letter-spacing: 1px; }
.kengdl-star { color: #d1d5db; font-size: 16px; line-height: 1; }
.kengdl-star.is-full { color: #f59e0b; }
.kengdl-star.is-half {
	background: linear-gradient(90deg, #f59e0b 50%, #d1d5db 50%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.kengdl-pagination {
	margin-top: 36px;
	display: flex;
	justify-content: center;
}
.kengdl-pagination .page-numbers {
	display: inline-block;
	padding: 8px 13px;
	margin: 0 3px;
	border-radius: 8px;
	background: #f3f4f6;
	color: #374151;
	text-decoration: none;
}
.kengdl-pagination .page-numbers.current { background: var(--kengdl-accent); color: #fff; }

.kengdl-empty { color: #6b7280; font-size: 15px; padding: 40px 0; text-align: center; }

/* ============================================================
   SINGLE / DETAIL
   ============================================================ */
.kengdl-single { padding-top: 0; }

.kengdl-hero {
	position: relative;
	height: 280px;
	border-radius: 0 0 16px 16px;
	margin: 0 0 0;
	background:
		var(--kengdl-hero, none),
		linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #2563eb 100%);
	background-size: cover;
	background-position: center;
	overflow: hidden;
}
.kengdl-hero__overlay {
	position: absolute; inset: 0;
	background: linear-gradient(180deg, rgba(15,23,42,.35), rgba(15,23,42,.55));
}

.kengdl-titlebar {
	display: flex;
	align-items: center;
	gap: 18px;
	padding: 22px 4px 18px;
	border-bottom: 1px solid #e5e7eb;
}
.kengdl-titlebar__icon {
	width: 72px; height: 72px;
	border-radius: 16px;
	overflow: hidden;
	flex: 0 0 auto;
	background: linear-gradient(135deg, #2563eb, #38bdf8);
	display: flex; align-items: center; justify-content: center;
}
.kengdl-titlebar__img { width: 100%; height: 100%; object-fit: cover; }
.kengdl-titlebar__placeholder { color: #fff; font-size: 34px; }
.kengdl-titlebar__info { flex: 1; min-width: 0; }
.kengdl-titlebar__name { font-size: 28px; margin: 0 0 4px; line-height: 1.2; }
.kengdl-titlebar__author { margin: 0; color: #6b7280; font-size: 15px; }
.kengdl-titlebar__author span { color: var(--kengdl-accent); }
.kengdl-titlebar__action { flex: 0 0 auto; }

/* Tabs */
.kengdl-tabs {
	display: flex;
	align-items: center;
	gap: 6px;
	border-bottom: 1px solid #e5e7eb;
	margin-bottom: 30px;
}
.kengdl-tab {
	padding: 14px 16px;
	text-decoration: none;
	color: #374151;
	font-size: 15px;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}
.kengdl-tab.is-active { border-bottom-color: var(--kengdl-accent); color: #111827; font-weight: 600; }
.kengdl-tab:hover { color: var(--kengdl-accent); }
.kengdl-tab--right { margin-left: auto; color: var(--kengdl-accent); }

/* Layout */
.kengdl-layout {
	display: grid;
	grid-template-columns: 1fr 320px;
	gap: 40px;
	align-items: start;
}
.kengdl-main { min-width: 0; }
.kengdl-section h2 { font-size: 24px; margin: 0 0 0px; }
.kengdl-content { font-size: 16px; line-height: 1.7; color: #374151; }
.kengdl-content h3 { font-size: 18px; margin: 24px 0 8px; }
.kengdl-content ul { padding-left: 22px; }
.kengdl-content li { margin: 6px 0; }

/* Sidebar */
.kengdl-side { position: sticky; top: 24px; }

.kengdl-infobox {
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	overflow: hidden;
}
.kengdl-inforow {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 13px 16px;
	border-bottom: 1px solid #f0f1f3;
	font-size: 14px;
}
.kengdl-inforow:last-child { border-bottom: none; }
.kengdl-info__label { color: #6b7280; }
.kengdl-info__value { color: #111827; font-weight: 600; text-align: right; }
.kengdl-info__value a { color: var(--kengdl-accent); text-decoration: none; }
.kengdl-inforow--tags { flex-direction: column; gap: 8px; }
.kengdl-inforow--tags .kengdl-info__value { text-align: left; font-weight: 400; }

.kengdl-tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.kengdl-pill {
	display: inline-block;
	padding: 4px 11px;
	background: #eef2ff;
	color: var(--kengdl-accent);
	border-radius: 6px;
	font-size: 12.5px;
}

.kengdl-ratingbox,
.kengdl-supportbox {
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 16px;
	margin-top: 16px;
}
.kengdl-ratingbox h3,
.kengdl-supportbox h3 { margin: 0 0 10px; font-size: 17px; }
.kengdl-rating__top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kengdl-rating__text { font-size: 13.5px; color: #6b7280; }
.kengdl-supportbox p { margin: 0 0 8px; color: #6b7280; font-size: 14px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
	.kengdl-layout { grid-template-columns: 1fr; }
	.kengdl-side { position: static; }
	.kengdl-cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
	.kengdl-cols-3, .kengdl-cols-4 { grid-template-columns: repeat(2, 1fr); }
	.kengdl-hero { height: 200px; }
	.kengdl-titlebar { flex-wrap: wrap; }
	.kengdl-titlebar__action { width: 100%; }
	.kengdl-btn { width: 100%; text-align: center; }
}
@media (max-width: 480px) {
	.kengdl-cols-2, .kengdl-cols-3, .kengdl-cols-4 { grid-template-columns: 1fr; }
}

/* ---------- Self-hosted file additions ---------- */
.kengdl-card__dl { font-size: 13px; color: #6b7280; font-weight: 600; }

.kengdl-dlcount { text-align: center; font-size: 13px; color: #6b7280; margin: -6px 0 16px; }
.kengdl-dlcount strong { color: #111827; }

.kengdl-shots {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 14px;
	margin-top: 8px;
}
.kengdl-shot-item {
	display: block;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	overflow: hidden;
	transition: box-shadow .15s ease, transform .15s ease;
}
.kengdl-shot-item:hover { box-shadow: 0 8px 20px rgba(0,0,0,.10); transform: translateY(-2px); }
.kengdl-shot-item img { width: 100%; height: auto; display: block; }

/* ---------- Tab panels ---------- */
.kengdl-tab {
	background: none;
	border: none;
	cursor: pointer;
	font-family: inherit;
}
.kengdl-panel { display: none; }
.kengdl-panel.is-active { display: block; }
