/**
 * Game search bar + Subscribe/Like/Share/Support action row + CTA
 * buttons — ported from Flight Log Video Hub's style.css (search bar,
 * .flv-meta-actions, .flv-btn family, .flv-cta-group, tooltip, and
 * support modal sections), renamed under a tkge- prefix and pointed at
 * this theme's own --tktt-* / --wp--preset--color--* design tokens
 * instead of the video plugin's --flv- bridge — same fallback pattern
 * game-filters.css already uses, so the two plugins' buttons and pills
 * render identically on this site without depending on each other.
 */

/* ----------------------------------------------------------------------
 * Search bar
 * -------------------------------------------------------------------- */

.tkge-search-bar {
	position: relative;
	margin: 0 auto 28px;
}

.tkge-search-centered {
	max-width: 480px;
}

.tkge-search-full {
	/* Explicit 1180px (rather than max-width:none) so this matches the
	   Game Portal page's own content width exactly — see contentSize on
	   that template's <main> — instead of stretching edge-to-edge across
	   the alignfull dark background behind it. */
	max-width: 1180px;
}

.tkge-search-input-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.tkge-search-icon {
	position: absolute;
	left: 16px;
	font-size: 16px;
	color: var( --tktt-text-muted, var(--wp--preset--color--paper-dim) );
	pointer-events: none;
}

.tkge-search-input {
	width: 100%;
	padding: 12px 16px 12px 42px;
	border: 1px solid var( --tktt-border, var(--wp--preset--color--steel) );
	border-radius: 999px;
	background: var( --tktt-bg-surface, var(--wp--preset--color--surface) );
	color: var( --tktt-text-primary, var(--wp--preset--color--paper) );
	font-family: var(--wp--preset--font-family--spec-mono);
	font-size: 14px;
	transition: border-color 0.15s ease;
}

.tkge-search-input::placeholder {
	color: var( --tktt-text-muted, var(--wp--preset--color--paper-dim) );
}

.tkge-search-input:focus {
	outline: none;
	border-color: var( --tktt-accent, var(--wp--preset--color--signature-red) );
}

.tkge-search-suggestions {
	position: absolute;
	z-index: 40;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var( --tktt-bg-surface, var(--wp--preset--color--surface) );
	border: 1px solid var( --tktt-border, var(--wp--preset--color--steel) );
	border-radius: 14px;
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.tkge-search-suggestions[hidden] {
	display: none;
}

.tkge-search-suggestions li + li {
	margin-top: 2px;
}

.tkge-search-suggestions a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 9px 12px;
	border-radius: 8px;
	color: var( --tktt-text-primary, var(--wp--preset--color--paper) );
	font-family: var(--wp--preset--font-family--spec-mono);
	font-size: 13px;
	text-decoration: none;
}

.tkge-search-suggestions a:hover,
.tkge-search-suggestions a:focus {
	background: var( --tktt-border, var(--wp--preset--color--steel) );
}

.tkge-suggest-tag {
	flex-shrink: 0;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --tktt-text-muted, var(--wp--preset--color--paper-dim) );
}

/* ----------------------------------------------------------------------
 * Subscribe / Like / Share / Support row + CTA group
 * -------------------------------------------------------------------- */

.tkge-game-actions-section {
	margin: 20px 0 8px;
}

/* On mobile, this section is a separate block sitting right under the
   Game Embed block, so the two normally also pick up the theme/pattern's
   own block gap on top of this margin — together often big enough that
   the game and its Like/Share/Support row stop reading as one group.
   Shrinking this side's contribution to (near) zero on mobile is the
   most this plugin can close that gap by itself; if the theme's own
   block-gap setting on the pattern wrapping these two blocks is still
   large, that's the other place to check. */
@media ( max-width: 782px ) {
	.tkge-game-actions-section {
		margin-top: 4px;
	}
}

.tkge-meta-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 16px;
	margin: 0 0 8px;
	padding-top: 0;
	border-top: 0;
}

.tkge-meta-actions-left,
.tkge-cta-group {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.tkge-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 16px;
	border-radius: 999px;
	border: 1px solid transparent;
	font-family: var(--wp--preset--font-family--spec-mono);
	font-size: 13px;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tkge-btn-outline {
	border-color: var( --tktt-border, var(--wp--preset--color--steel) );
	color: var( --tktt-text-primary, var(--wp--preset--color--paper) );
	background: transparent;
}

.tkge-btn-outline:hover {
	border-color: var( --tktt-accent, var(--wp--preset--color--signature-red) );
	color: var( --tktt-accent, var(--wp--preset--color--signature-red) );
}

.tkge-btn-primary {
	background: var( --tktt-accent, var(--wp--preset--color--signature-red) );
	border-color: var( --tktt-accent, var(--wp--preset--color--signature-red) );
	color: var( --tktt-bg-primary, var(--wp--preset--color--night-flight) );
}

.tkge-btn-primary:hover {
	opacity: 0.88;
}

.tkge-btn-svg {
	flex-shrink: 0;
}

.tkge-btn.tkge-no-icon .tkge-btn-svg {
	display: none;
}

.tkge-like-count {
	font-size: 12px;
	color: var( --tktt-text-muted, var(--wp--preset--color--paper-dim) );
}

.tkge-btn[data-tkge-like].is-liked {
	border-color: var( --tktt-accent, var(--wp--preset--color--signature-red) );
	color: var( --tktt-accent, var(--wp--preset--color--signature-red) );
}

.tkge-btn[data-tkge-like].is-liked .tkge-btn-svg {
	fill: currentColor;
}

.tkge-btn[data-tkge-share].is-copied {
	border-color: var( --tktt-accent, var(--wp--preset--color--signature-red) );
	color: var( --tktt-accent, var(--wp--preset--color--signature-red) );
}

/* ----------------------------------------------------------------------
 * Expand/Fullscreen toggle
 * ----------------------------------------------------------------------
 * A standalone top-level child of .tkge-meta-actions (see
 * tkge_render_action_row() in tk-game-embed.php for why it isn't nested
 * inside .tkge-meta-actions-left or .tkge-cta-group). `margin-left:
 * auto` is what does the actual placement work: it eats all the row's
 * remaining space, so on a wide row this button lands flush against
 * .tkge-cta-group — reading as one right-hand cluster (Expand, then
 * Video, then Fold Guide) — while at the @media (max-width: 640px)
 * breakpoint below (left as-is), where .tkge-cta-group is wide enough
 * (visible labels + big padding) to wrap onto its own line, this
 * button is narrow enough (icon-only there, like Info/Like/Share/
 * Support) to still fit on the first line and gets pushed to that
 * line's right edge instead of wrapping down with the CTA row.
 *
 * The icon/label swap on click mirrors the same is-fullscreen-class
 * pattern game-fullscreen.css already uses for the fullscreen bar's
 * own Expand/Minimize toggle — game-fullscreen.js's bindControls()
 * applies that class to every [data-tkge-nav-action="expand"] button
 * on the page, this one included, with no extra JS needed.
 */
.tkge-game-expand {
	margin-left: auto;
}

.tkge-expand-icon--collapse,
.tkge-expand-label--collapse {
	display: none;
}

.tkge-game-expand.is-fullscreen .tkge-expand-icon--expand,
.tkge-game-expand.is-fullscreen .tkge-expand-label--expand {
	display: none;
}

.tkge-game-expand.is-fullscreen .tkge-expand-icon--collapse {
	display: inline-flex;
}

.tkge-game-expand.is-fullscreen .tkge-expand-label--collapse {
	display: inline;
}

/* Tooltip: a small label above each action-row button on hover/focus,
   built from the button's own data-tkge-tooltip attribute — CSS only,
   no JS needed. */
[data-tkge-tooltip] {
	position: relative;
}

[data-tkge-tooltip]::after {
	content: attr(data-tkge-tooltip);
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	padding: 4px 9px;
	border-radius: 6px;
	background: var( --tktt-text-primary, var(--wp--preset--color--paper) );
	color: var( --tktt-bg-primary, var(--wp--preset--color--night-flight) );
	font-family: var(--wp--preset--font-family--spec-mono);
	font-size: 11px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease, transform 0.15s ease;
	z-index: 20;
}

[data-tkge-tooltip]:hover::after,
[data-tkge-tooltip]:focus-visible::after {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
	.tkge-meta-actions {
		justify-content: flex-start;
	}
	.tkge-btn-label {
		display: none;
	}
	.tkge-btn {
		padding: 9px;
	}
	.tkge-btn[data-tkge-like] {
		padding: 9px 12px;
	}
	.tkge-like-count {
		display: inline;
	}
	/* CTA buttons keep their label even on small screens — an icon-only
	   primary CTA loses its whole point ("Get the Template", "Watch the
	   Build Video"). */
	.tkge-game-cta .tkge-btn-label,
	.tkge-game-secondary .tkge-btn-label {
		display: inline;
	}
	.tkge-btn.tkge-game-cta,
	.tkge-btn.tkge-game-secondary {
		padding: 12px 22px;
	}
}

/* ----------------------------------------------------------------------
 * Game CTA pair — "Play Now" + secondary — a bigger, bolder hero-style
 * pair distinct from the small Subscribe/Like/Share/Support icon row:
 * a clipped-corner solid primary and a rounded ghost-outline secondary,
 * both bold uppercase mono with wide letter-spacing. Scoped to
 * .tkge-game-cta / .tkge-game-secondary only, so the icon row above is
 * untouched. Colors/fonts still come from the site's --tktt-* tokens
 * (via the existing .tkge-btn-primary / .tkge-btn-outline rules above)
 * — this block only changes shape, size, and type treatment.
 * -------------------------------------------------------------------- */

.tkge-cta-group {
	gap: 14px;
}

.tkge-btn.tkge-game-cta,
.tkge-btn.tkge-game-secondary {
	padding: 13px 30px;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	gap: 9px;
}

/* Primary: solid fill, bottom-left corner clipped off — same motif as
   the TriKdanG "Watch the Latest Build" CTA elsewhere on the site. */
.tkge-btn.tkge-game-cta {
	border: none;
	border-radius: 0;
	clip-path: polygon(0 0, 100% 0, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.tkge-btn.tkge-game-cta:hover {
	opacity: 1;
	background: color-mix(in srgb, var( --tktt-accent, var(--wp--preset--color--signature-red) ) 82%, black);
	transform: translateY(-1px);
}

/* Secondary: capsule ghost outline, muted border that brightens on hover. */
.tkge-btn.tkge-game-secondary {
	border-radius: 999px;
	border-width: 2px;
}

/* ----------------------------------------------------------------------
 * Support modal
 * -------------------------------------------------------------------- */

.tkge-support-modal[hidden] {
	display: none;
}

.tkge-support-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.tkge-support-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
}

.tkge-support-modal-dialog {
	position: relative;
	width: min(720px, 100%);
	height: min(80vh, 640px);
	background: var( --tktt-bg-surface, var(--wp--preset--color--surface) );
	border: 1px solid var( --tktt-border, var(--wp--preset--color--steel) );
	border-radius: 16px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.tkge-support-modal-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: var( --tktt-bg-primary, var(--wp--preset--color--night-flight) );
	color: var( --tktt-text-primary, var(--wp--preset--color--paper) );
	cursor: pointer;
}

.tkge-support-modal-frame {
	flex: 1 1 auto;
	width: 100%;
	border: none;
	background: #fff;
}

.tkge-support-modal-fallback {
	padding: 10px 16px;
	text-align: center;
	font-family: var(--wp--preset--font-family--spec-mono);
	font-size: 12px;
	color: var( --tktt-text-muted, var(--wp--preset--color--paper-dim) );
	border-top: 1px solid var( --tktt-border, var(--wp--preset--color--steel) );
	text-decoration: none;
}

.tkge-support-modal-fallback:hover {
	color: var( --tktt-accent, var(--wp--preset--color--signature-red) );
}

body.tkge-modal-open {
	overflow: hidden;
}

