/* =========================================================================
 * Suggestions Board — list / single / FAB
 * vars: --bg-lighter, --bg-lighter-2, --tt, --tt-darker, --bdc-lighter, --accent
 * ========================================================================= */

/* ---------- FAB (above-the-fold critical, also inlined in fab.tpl) ----- */
.sgf-fab {
	position: fixed;
	right: 120px;
	bottom: 16px;
	z-index: 1005;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--accent, #ffa332);
	color: #000;
	border: none;
	box-shadow:
		0 2px 16px rgba(0, 0, 0, .28),
		0 0 0 .5px rgba(255, 255, 255, .06);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
	contain: layout;
	-webkit-tap-highlight-color: transparent;
}
.sgf-fab:hover,
.sgf-fab:focus-visible {
	transform: translateY(-2px);
	background: var(--accent-darker, #f39b2e);
	outline: none;
}
.sgf-fab:focus-visible {
	box-shadow:
		0 2px 16px rgba(0, 0, 0, .28),
		0 0 0 3px rgba(255, 163, 50, .45);
}
.sgf-fab svg {
	width: 22px;
	height: 22px;
	pointer-events: none;
	display: block;
}
.sgf-fab .sgf-fab__tip {
	position: absolute;
	right: calc(100% + 10px);
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, .85);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	padding: 6px 10px;
	border-radius: 6px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity .15s ease;
}
.sgf-fab:hover .sgf-fab__tip,
.sgf-fab:focus-visible .sgf-fab__tip {
	opacity: 1;
}
@media (max-width: 600px) {
	.sgf-fab {
		right: 100px;
		bottom: 12px;
		width: 42px;
		height: 42px;
	}
	.sgf-fab .sgf-fab__tip {
		display: none;
	}
}

/* ---------- Site-layout integration ----------------------------------
 * /suggestions/ board doesn't need the right "Top-rated / Just added"
 * sidebar — it's a meta-discussion page, not consumption. We collapse
 * .cols to a single column when .sgf-page is inside .col-main.
 * Native :has() — Chrome 105+, Safari 15.4+, FF 121+ (>97% global).
 * Also hide the empty parent speedbar (it only contains "Home" because
 * DLE doesn't know the /suggestions/ route) — we render our own.
 * --------------------------------------------------------------------- */
.cols:has(.sgf-page) {
	grid-template-columns: minmax(0, 1fr);
	grid-gap: 0;
}
.cols:has(.sgf-page) > .col-side {
	display: none;
}
/* .col-main has hard-coded `grid-column: 2 / 3` in styles.css — that
   forces an implicit track even when we collapse to single column.
   Reset to auto so .col-main occupies the only track. */
.cols:has(.sgf-page) > .col-main {
	grid-column: 1 / -1;
}
.col-main:has(.sgf-page) > .speedbar:not(.sgf-speedbar) {
	display: none;
}

/* ---------- Page shell ------------------------------------------------ */
.sgf-page {
	max-width: 980px;
	margin: 0 auto;
	padding: 8px 0 64px;
	color: var(--tt);
}
.sgf-speedbar {
	margin: 0 0 14px;
}
.sgf-speedbar a {
	color: var(--tt-darker);
}
.sgf-speedbar a:hover {
	color: var(--accent);
}
.sgf-speedbar [aria-current="page"] {
	color: var(--tt);
}
.sgf-page__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 14px;
	margin-bottom: 18px;
}
.sgf-page__title {
	font-size: 26px;
	font-weight: 700;
	margin: 0 0 4px;
	line-height: 1.2;
}
.sgf-page__sub {
	margin: 0;
	font-size: 14px;
	color: var(--tt-darker);
	max-width: 640px;
}
.sgf-page__new {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 16px;
	border-radius: 20px;
	background: var(--accent, #ffa332);
	color: #000;
	font-weight: 700;
	font-size: 14px;
	border: none;
	cursor: pointer;
	white-space: nowrap;
}
.sgf-page__new:hover {
	background: var(--accent-darker, #f39b2e);
	color: #000;
}
.sgf-page__new[disabled] {
	opacity: .55;
	cursor: not-allowed;
}

/* ---------- Filters --------------------------------------------------- */
.sgf-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	padding: 10px;
	background: var(--bg-lighter, #171717);
	border-radius: 10px;
	margin-bottom: 16px;
}
.sgf-tabs {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
}
.sgf-tabs__btn {
	padding: 6px 12px;
	min-height: 32px;
	border-radius: 16px;
	border: 1px solid transparent;
	background: transparent;
	color: var(--tt-darker);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.sgf-tabs__btn:hover {
	color: var(--tt);
}
.sgf-tabs__btn.is-active {
	background: var(--bg-lighter-2, #212121);
	color: var(--tt);
	border-color: var(--bdc-lighter);
}
.sgf-select {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--tt-darker);
}
.sgf-select select {
	min-height: 32px;
	padding: 4px 8px;
	background: var(--bg-lighter-2, #212121);
	color: var(--tt);
	border: 1px solid var(--bdc-lighter);
	border-radius: 6px;
	font-size: 13px;
	width: auto;
	box-shadow: none;
}
.sgf-filters__spacer {
	flex: 1 1 auto;
}

/* ---------- Card ------------------------------------------------------ */
.sgf-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.sgf-card {
	display: grid;
	grid-template-columns: 72px 1fr;
	gap: 14px;
	padding: 14px;
	background: var(--bg-lighter, #171717);
	border-radius: 10px;
	border: 1px solid transparent;
	transition: background .15s ease, border-color .15s ease;
	contain: layout;
}
.sgf-card:hover {
	background: var(--bg-lighter-2, #212121);
	border-color: var(--bdc-lighter);
}

.sgf-vote {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	user-select: none;
}
.sgf-vote__btn {
	width: 56px;
	min-height: 56px;
	border-radius: 10px;
	border: 1px solid var(--bdc-lighter);
	background: var(--bg-lighter-2, #212121);
	color: var(--tt-darker);
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	font-weight: 700;
	font-size: 11px;
	letter-spacing: .04em;
	text-transform: uppercase;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
	padding: 6px 4px;
}
.sgf-vote__btn:hover,
.sgf-vote__btn:focus-visible {
	color: var(--accent);
	border-color: var(--accent);
	outline: none;
}
.sgf-vote__btn.is-voted {
	background: var(--accent);
	color: #000;
	border-color: var(--accent);
}
.sgf-vote__btn.is-voted:hover .sgf-vote__label,
.sgf-vote__btn.is-voted:focus-visible .sgf-vote__label {
	display: none;
}
.sgf-vote__btn.is-voted:hover::after,
.sgf-vote__btn.is-voted:focus-visible::after {
	content: 'Cancel';
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
}
.sgf-vote__btn[disabled] {
	opacity: .6;
	cursor: not-allowed;
}
.sgf-vote__icon {
	width: 14px;
	height: 14px;
	display: block;
}
.sgf-vote__count {
	font-size: 16px;
	font-weight: 800;
	line-height: 1;
}
.sgf-vote__label {
	font-size: 10px;
	font-weight: 700;
}

.sgf-body {
	min-width: 0;
}
.sgf-body__head {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-bottom: 6px;
}
.sgf-card__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	flex: 1 1 auto;
	min-width: 0;
}
.sgf-card__title a {
	color: var(--tt);
}
.sgf-card__title a:hover {
	color: var(--accent);
}
.sgf-card__desc {
	margin: 0 0 8px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--tt-darker-2, rgba(242, 242, 242, .85));
	word-wrap: break-word;
}
.sgf-card__more {
	color: var(--accent);
	font-weight: 600;
}
.sgf-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	align-items: center;
	font-size: 12px;
	color: var(--tt-darker);
}
.sgf-card__meta a {
	color: var(--tt-darker);
}
.sgf-card__meta a:hover {
	color: var(--tt);
}
.sgf-ava {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	object-fit: cover;
	vertical-align: middle;
	margin-right: 4px;
}

/* ---------- Badges ---------------------------------------------------- */
.sgf-badge {
	display: inline-flex;
	align-items: center;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	padding: 3px 8px;
	border-radius: 12px;
	color: #fff;
	white-space: nowrap;
	line-height: 1.4;
}
/* Type badges: solid fills. Contrast ratios verified ≥ 4.5:1 white-on-bg. */
.sgf-badge--type-bug { background: #c62828; }     /* 5.9:1 */
.sgf-badge--type-feature { background: #2a64c2; } /* 5.5:1 */
.sgf-badge--type-other { background: #595959; }   /* 7.0:1 */

/* Status badges: ringed style (lower visual weight than type, but still WCAG-AA). */
.sgf-badge--status-open { background: #2a64c2; }       /* 5.5:1 white */
.sgf-badge--status-planned { background: #7c3aed; }    /* 6.4:1 white */
.sgf-badge--status-in_progress { background: #f5a623; color: #1a1a1a; } /* 8.9:1 */
.sgf-badge--status-done { background: #1f7a3a; }       /* 5.5:1 white */
.sgf-badge--status-declined { background: #4a4a4a; }   /* 9.1:1 white — visually distinct from type-other */

/* ---------- Empty / sentinel / loader -------------------------------- */
/* SSR-list: hold space during JS hydration so the FAB / footer don't jump.
   data-sgf-ssr="1" + aria-busy="false" set in list.tpl tell JS not to refresh
   on first paint (server already rendered first page). */
.sgf-list[data-sgf-ssr] {
	min-height: 240px;
}
.sgf-list[data-sgf-ssr]:empty + .sgf-loading[hidden] {
	display: none;
}
.sgf-empty {
	padding: 40px 16px;
	min-height: 200px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	color: var(--tt-darker);
	background: var(--bg-lighter, #171717);
	border-radius: 10px;
}
.sgf-sentinel {
	min-height: 1px;
	contain: strict;
}
.sgf-loading {
	text-align: center;
	padding: 24px 16px;
	color: var(--tt-darker);
	font-size: 13px;
	min-height: 56px;
}
.sgf-end {
	text-align: center;
	padding: 16px 12px;
	color: var(--tt-darkest, #8d8d8d);
	font-size: 12px;
}

/* ---------- Modal create form ---------------------------------------- */
.sgf-modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	z-index: 99998;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.sgf-modal[hidden] { display: none; }
.sgf-modal__box {
	background: var(--bg-lighter, #171717);
	color: var(--tt);
	border-radius: 10px;
	max-width: 560px;
	width: 100%;
	max-height: 92dvh;
	overflow-y: auto;
	box-shadow: 0 8px 32px rgba(0, 0, 0, .45);
	position: relative;
	padding: 22px 22px 18px;
}
.sgf-modal__x {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: none;
	color: var(--tt-darker);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	width: 36px;
	height: 36px;
	border-radius: 6px;
}
.sgf-modal__x:hover { color: var(--tt); background: var(--bg-lighter-2); }
.sgf-modal__title {
	margin: 0 0 14px;
	font-size: 18px;
	font-weight: 700;
}
.sgf-form__row { margin-bottom: 12px; }
.sgf-form__label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .03em;
	text-transform: uppercase;
	color: var(--tt-darker);
	margin-bottom: 4px;
}
.sgf-form input[type="text"],
.sgf-form textarea {
	width: 100%;
	background: var(--bdc, #060606);
	color: var(--tt);
	border-radius: 6px;
	padding: 9px 11px;
	font-size: 14px;
	box-shadow: inset 0 0 0 1px var(--bdc), inset 1px 2px 5px rgba(0, 0, 0, .1);
}
.sgf-form textarea {
	min-height: 140px;
	resize: vertical;
	line-height: 1.5;
}
.sgf-form__counter {
	font-size: 11px;
	color: var(--tt-darker);
	text-align: right;
	margin-top: 2px;
}
.sgf-form__counter.is-bad { color: #e0443a; }
.sgf-radios {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.sgf-radio {
	flex: 1 1 140px;
	min-width: 130px;
	cursor: pointer;
}
.sgf-radio input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.sgf-radio__box {
	display: block;
	padding: 10px 12px;
	border: 1px solid var(--bdc-lighter);
	border-radius: 8px;
	background: var(--bg-lighter-2);
	transition: border-color .15s ease, background .15s ease;
}
.sgf-radio input:checked + .sgf-radio__box {
	border-color: var(--accent);
	background: rgba(255, 163, 50, .08);
}
.sgf-radio__title {
	display: block;
	font-size: 14px;
	font-weight: 700;
	margin-bottom: 2px;
}
.sgf-radio__hint {
	display: block;
	font-size: 11px;
	color: var(--tt-darker);
}
.sgf-form__actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 14px;
}
.sgf-btn {
	min-height: 38px;
	padding: 0 16px;
	border-radius: 20px;
	border: none;
	cursor: pointer;
	font-weight: 700;
	font-size: 14px;
}
.sgf-btn--primary {
	background: var(--accent);
	color: #000;
}
.sgf-btn--primary:hover { background: var(--accent-darker); }
.sgf-btn--primary[disabled] { opacity: .55; cursor: not-allowed; }
.sgf-btn--ghost {
	background: transparent;
	color: var(--tt-darker);
}
.sgf-btn--ghost:hover { color: var(--tt); }

/* ---------- Single ---------------------------------------------------- */
.sgf-single {
	background: var(--bg-lighter, #171717);
	border-radius: 10px;
	padding: 18px;
	margin-bottom: 16px;
}
.sgf-single__head {
	display: grid;
	grid-template-columns: 96px 1fr;
	gap: 16px;
	margin-bottom: 14px;
}
.sgf-single__title {
	margin: 0 0 8px;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.25;
}
.sgf-single__desc {
	font-size: 15px;
	line-height: 1.6;
	color: var(--tt);
	white-space: pre-wrap;
	word-wrap: break-word;
}
.sgf-single__meta {
	margin-top: 14px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	font-size: 12px;
	color: var(--tt-darker);
}
.sgf-single__admin {
	margin-top: 16px;
	padding: 12px;
	background: var(--bg-lighter-2);
	border-radius: 8px;
	border: 1px dashed var(--bdc-lighter);
}
.sgf-single__back {
	display: inline-block;
	margin-bottom: 12px;
	font-size: 13px;
	color: var(--tt-darker);
}
.sgf-single__back:hover { color: var(--tt); }
.sgf-adminNote {
	margin-top: 10px;
	padding: 10px 12px;
	background: var(--bg-lighter-2);
	border-left: 3px solid var(--accent);
	border-radius: 4px;
	font-size: 14px;
	color: var(--tt);
}
.sgf-adminNote__label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--tt-darker);
	margin-bottom: 4px;
}

/* ---------- Comments stub -------------------------------------------- */
.sgf-comments {
	background: var(--bg-lighter, #171717);
	border-radius: 10px;
	padding: 16px;
}
.sgf-comments__title {
	font-size: 16px;
	font-weight: 700;
	margin: 0 0 8px;
}
.sgf-comments__form { margin-top: 12px; }
.sgf-comments__form textarea {
	width: 100%;
	min-height: 90px;
	background: var(--bdc, #060606);
	color: var(--tt);
	border-radius: 6px;
	padding: 9px 11px;
	font-size: 14px;
	line-height: 1.5;
	box-shadow: inset 0 0 0 1px var(--bdc), inset 1px 2px 5px rgba(0, 0, 0, .1);
}
.sgf-comments__hint {
	font-size: 12px;
	color: var(--tt-darker);
	margin-top: 6px;
}

/* ---------- Toast ---------------------------------------------------- */
.sgf-toast {
	position: fixed;
	left: 50%;
	bottom: 80px;
	transform: translateX(-50%) translateY(20px);
	background: var(--bg-lighter-2, #212121);
	color: var(--tt);
	padding: 10px 18px;
	border-radius: 22px;
	font-size: 13px;
	font-weight: 600;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
	z-index: 99999;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease, transform .2s ease;
	max-width: calc(100vw - 24px);
	text-align: center;
}
.sgf-toast.is-show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}
.sgf-toast--err { border: 1px solid #e0443a; }

/* ---------- Mobile ---------------------------------------------------- */
@media (max-width: 900px) {
	.sgf-single__head { grid-template-columns: 72px 1fr; }
}
@media (max-width: 600px) {
	.sgf-page__title { font-size: 22px; }
	.sgf-card {
		grid-template-columns: 56px 1fr;
		gap: 10px;
		padding: 12px;
	}
	.sgf-vote__btn {
		width: 50px;
		min-height: 48px;
	}
	.sgf-single { padding: 14px; }
	.sgf-single__head {
		grid-template-columns: 56px 1fr;
		gap: 10px;
	}
	.sgf-single__title { font-size: 18px; }
	/* Filters stack vertically: tabs row, then status+sort row.
	   Tabs row gets horizontal scroll if it overflows (no breaking). */
	.sgf-filters {
		padding: 8px;
		gap: 8px;
		flex-direction: column;
		align-items: stretch;
	}
	.sgf-filters__spacer { display: none; }
	.sgf-tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}
	.sgf-tabs::-webkit-scrollbar { display: none; }
	.sgf-tabs__btn {
		padding: 6px 12px;
		font-size: 12px;
		flex: 0 0 auto;
	}
	.sgf-select {
		flex: 1 1 auto;
		min-width: 0;
	}
	.sgf-select select { flex: 1 1 auto; }
	.sgf-page__head { gap: 10px; }
	.sgf-page__new {
		min-height: 44px; /* touch target */
		padding: 0 14px;
	}
}

/* ---------- A11y reduce motion --------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.sgf-fab,
	.sgf-card,
	.sgf-toast,
	.sgf-vote__btn { transition: none; }
}

/* ---------- Visually hidden ------------------------------------------ */
.sgf-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}
