/* ==========================================================================
   AdSense slots — legacy-wow style layout
   ========================================================================== */

:root {
	--gw-ad-rail-width: 160px;
	--gw-content-max: 72rem;
	--gw-content-wide: 92rem;
}

.gw-ad {
	position: relative;
	z-index: 2;
	text-align: center;
}

.gw-ad__inner {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 50px;
	overflow: hidden;
}

.gw-ad__inner ins,
.gw-ad__inner iframe {
	max-width: 100%;
}

/* 1 — Top leaderboard */
.gw-ad--top {
	width: 100%;
	max-width: min(var(--gw-content-max), calc(100% - 2rem));
	margin: 0 auto;
	padding: 0.75rem 1rem 0;
}

body:not(.is-landing-page) .gw-ad--top {
	padding-top: calc(var(--gw-header-height) + 0.65rem);
}

body.is-landing-page .gw-ad--top {
	padding-top: 0.75rem;
}

/* 4 — Bottom sticky bar (fixed, follows scroll) */
.gw-ad--bottom.gw-ad--bottom-sticky {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 10020;
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	background: linear-gradient(180deg, rgba(6, 12, 24, 0.72) 0%, rgba(6, 12, 24, 0.96) 35%);
	border-top: 1px solid rgba(110, 184, 201, 0.28);
	box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transition: transform 0.28s ease, opacity 0.28s ease;
}

.gw-ad--bottom-sticky.is-dismissed {
	transform: translateY(100%);
	opacity: 0;
	pointer-events: none;
	visibility: hidden;
}

.gw-ad--bottom-sticky .gw-ad__bar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: min(var(--gw-content-wide), 100%);
	margin: 0 auto;
	padding: 0.4rem 2.75rem 0.4rem 0.65rem;
}

.gw-ad--bottom-sticky .gw-ad__inner {
	flex: 1 1 auto;
	min-height: 50px;
	max-height: 120px;
}

.gw-ad__close {
	position: absolute;
	top: 50%;
	right: 0.5rem;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	font-size: 1.35rem;
	line-height: 1;
	color: rgba(220, 235, 242, 0.85);
	background: rgba(8, 16, 32, 0.65);
	border: 1px solid rgba(110, 184, 201, 0.35);
	border-radius: 2px;
	cursor: pointer;
	transform: translateY(-50%);
	transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.gw-ad__close:hover {
	color: #f4fafc;
	border-color: rgba(110, 184, 201, 0.55);
	background: rgba(14, 26, 48, 0.85);
}

.gw-ad__close:focus-visible {
	outline: 2px solid var(--gw-accent, #6eb8c9);
	outline-offset: 2px;
}

body.has-gw-ad-bottom {
	padding-bottom: var(--gw-ad-bottom-height, 90px);
}

body.has-gw-ad-bottom .scroll-to-top {
	bottom: calc(var(--gw-ad-bottom-height, 90px) + 1rem);
}

body.has-gw-ad-bottom .gw-cookie-banner {
	padding-bottom: calc(var(--gw-ad-bottom-height, 90px) + 0.5rem);
}

@media (max-width: 640px) {
	body.has-gw-ad-bottom .scroll-to-top {
		bottom: calc(var(--gw-ad-bottom-height, 90px) + 0.65rem);
		right: 0.85rem;
	}
}

/* 2 & 3 — Side rails (wide screens) */
.gw-ad--left,
.gw-ad--sidebar {
	display: none;
	position: fixed;
	top: calc(var(--gw-header-height) + 5.5rem);
	width: var(--gw-ad-rail-width);
	z-index: 5;
	pointer-events: auto;
}

.gw-ad--left {
	left: max(0.5rem, calc((100vw - var(--gw-content-wide)) / 2 - var(--gw-ad-rail-width) - 1.25rem));
}

.gw-ad--sidebar {
	right: max(0.5rem, calc((100vw - var(--gw-content-wide)) / 2 - var(--gw-ad-rail-width) - 1.25rem));
}

@media (min-width: 1320px) {
	.gw-ad--left,
	.gw-ad--sidebar {
		display: block;
	}

	body.has-gw-ad-left .site-main:not(.site-main--landing),
	body.has-gw-ad-left .site-main--addons,
	body.has-gw-ad-left .site-main--profesiones,
	body.has-gw-ad-left .site-main--interfaces {
		margin-left: 0;
	}

	body.has-gw-ad-sidebar.has-gw-ad-left .content-area,
	body.has-gw-ad-sidebar.has-gw-ad-left .addons-directory__inner {
		max-width: min(calc(var(--gw-content-wide) - 2rem), calc(100% - 2rem));
	}
}

/* Hide left rail when guide TOC occupies the left column */
body.has-gw-ad-left:has(.guide-toc) .gw-ad--left {
	display: none !important;
}

@media (max-width: 1319px) {
	.gw-ad--left,
	.gw-ad--sidebar {
		display: none !important;
	}
}

/* Sticky side rails scroll with viewport */
@media (min-width: 1320px) {
	.gw-ad--left .gw-ad__inner,
	.gw-ad--sidebar .gw-ad__inner {
		position: sticky;
		top: calc(var(--gw-header-height) + 5.5rem);
		max-height: calc(100vh - var(--gw-header-height) - 6rem);
	}
}
