/* Service Pages Builder — front end styles.
   Colors come from CSS variables printed in wp_head (see class-spb-frontend.php),
   so one accent color / style-mode setting reskins every page this plugin renders. */

.spb-service-page {
	--spb-space: clamp(20px, 4vw, 64px);
	color: var(--spb-text, #1a1a1a);
}

/* ---------- Theme-compatibility safety net ----------
   Most classic WordPress themes (Storefront, and anything built on the
   _s starter theme) open a two-column #content/#primary + #secondary
   (sidebar) layout in header.php/footer.php, outside our own template's
   control. body.spb-full-width is added only on pages using this
   plugin's template, so these rules never touch the rest of the site. */
body.spb-full-width #secondary,
body.spb-full-width .widget-area,
body.spb-full-width .sidebar {
	display: none !important;
}

body.spb-full-width #primary,
body.spb-full-width #content,
body.spb-full-width .content-area,
body.spb-full-width .site-main {
	width: 100% !important;
	max-width: 100% !important;
	float: none !important;
}

/* Break the hero out of whatever max-width container the theme still
   wraps page content in, so it's always full-bleed regardless of theme. */
.spb-hero {
	width: 100vw !important;
	margin-left: calc(50% - 50vw) !important;
	margin-right: calc(50% - 50vw) !important;
}

/* ---------- Hero ---------- */
.spb-hero {
	position: relative;
	min-height: 60vh;
	display: flex;
	align-items: flex-end;
	overflow: hidden;
	background-color: var(--spb-bg, #0d0d0d);
	background-size: cover;
	background-position: center;
}

.spb-hero__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.6) 100%);
	z-index: 1;
}

.spb-hero__content {
	position: relative;
	z-index: 2;
	padding: var(--spb-space);
	color: #fff;
	max-width: 900px;
}

.spb-hero__content h1 {
	font-size: clamp(28px, 4vw, 48px);
	line-height: 1.15;
	margin: 0 0 18px;
	color: #fff;
}

.spb-cta {
	display: inline-block;
	padding: 12px 28px;
	background: var(--spb-accent, #C9A227);
	color: #111;
	font-weight: 600;
	text-decoration: none;
	border-radius: 3px;
	transition: transform 0.15s ease, opacity 0.15s ease;
}

.spb-cta:hover,
.spb-cta:focus-visible {
	opacity: 0.9;
	transform: translateY(-1px);
	color: #111;
}

/* Slider */
.spb-hero--slider .spb-slides {
	position: absolute;
	inset: 0;
}

.spb-slide {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	opacity: 0;
	transition: opacity 0.9s ease;
}

.spb-slide.is-active {
	opacity: 1;
}

.spb-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	border: none;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 16px;
}

.spb-nav:hover,
.spb-nav:focus-visible {
	background: var(--spb-accent, #C9A227);
	color: #111;
}

.spb-nav--prev {
	left: 16px;
}

.spb-nav--next {
	right: 16px;
}

.spb-dots {
	position: absolute;
	z-index: 3;
	bottom: 18px;
	right: var(--spb-space);
	display: flex;
	gap: 8px;
}

.spb-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	border: 1px solid #fff;
	background: transparent;
	padding: 0;
	cursor: pointer;
}

.spb-dot.is-active {
	background: var(--spb-accent, #C9A227);
	border-color: var(--spb-accent, #C9A227);
}

/* ---------- Description ---------- */
.spb-service-content {
	background: var(--spb-bg, #fff);
	color: var(--spb-text, #1a1a1a);
}

.spb-service-content__inner {
	max-width: 820px;
	margin: 0 auto;
	padding: var(--spb-space) 20px;
	font-size: 17px;
	line-height: 1.7;
}

.spb-service-content__inner h2,
.spb-service-content__inner h3 {
	color: var(--spb-text, #1a1a1a);
}

/* ---------- Portfolio ---------- */
.spb-portfolio {
	background: var(--spb-bg-alt, #f6f5f2);
	padding: var(--spb-space) 20px;
}

.spb-portfolio__title {
	text-align: center;
	max-width: 1100px;
	margin: 0 auto 28px;
	color: var(--spb-text, #1a1a1a);
	font-size: clamp(22px, 3vw, 32px);
}

.spb-portfolio__grid {
	max-width: 1100px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 18px;
}

.spb-portfolio__item {
	margin: 0;
}

.spb-portfolio__item a {
	display: block;
	position: relative;
	border-radius: 4px;
	overflow: hidden;
	text-decoration: none;
	border: 1px solid var(--spb-border, rgba(0, 0, 0, 0.1));
}

.spb-portfolio__item img {
	width: 100%;
	height: 240px;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.spb-portfolio__item a:hover img,
.spb-portfolio__item a:focus-visible img {
	transform: scale(1.05);
}

.spb-portfolio__item figcaption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 10px 12px;
	font-size: 13px;
	color: #fff;
	background: linear-gradient(0deg, rgba(0, 0, 0, 0.65), transparent);
}

/* ---------- Lightbox ---------- */
.spb-lightbox {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	background: rgba(0, 0, 0, 0.9);
	z-index: 9999;
	padding: 40px 20px;
}

.spb-lightbox.is-open {
	display: flex;
}

.spb-lightbox img {
	max-width: 92vw;
	max-height: 80vh;
	object-fit: contain;
	border-radius: 4px;
}

.spb-lightbox__caption {
	color: #fff;
	margin-top: 14px;
	font-size: 14px;
}

.spb-lightbox__close {
	position: absolute;
	top: 20px;
	right: 26px;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
}

.spb-lightbox__close:hover,
.spb-lightbox__close:focus-visible {
	color: var(--spb-accent, #C9A227);
}

/* ---------- Empty portfolio (editor-only nudge) ---------- */
.spb-portfolio--empty {
	background: transparent;
	border: 1px dashed var(--spb-border, rgba(0, 0, 0, 0.2));
	max-width: 1100px;
	margin: var(--spb-space) auto;
	padding: 24px;
	text-align: center;
	color: var(--spb-muted, #777);
	font-size: 14px;
}

/* ---------- Benefits ---------- */
.spb-benefits {
	background: var(--spb-bg, #fff);
	padding: 0 20px var(--spb-space);
}

.spb-benefits__inner {
	max-width: 820px;
	margin: 0 auto;
}

.spb-benefits__inner h2 {
	font-size: clamp(22px, 3vw, 30px);
	margin-bottom: 20px;
	color: var(--spb-text, #1a1a1a);
}

.spb-benefits__inner ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px 24px;
}

.spb-benefits__inner li {
	position: relative;
	padding-left: 28px;
	line-height: 1.5;
}

.spb-benefits__inner li::before {
	content: "\2713";
	position: absolute;
	left: 0;
	top: 0;
	color: var(--spb-accent, #C9A227);
	font-weight: 700;
}

/* ---------- FAQ ---------- */
.spb-faq {
	background: var(--spb-bg, #fff);
	padding: 0 20px var(--spb-space);
}

.spb-faq__inner {
	max-width: 820px;
	margin: 0 auto;
}

.spb-faq__inner h2 {
	font-size: clamp(22px, 3vw, 30px);
	margin-bottom: 20px;
	color: var(--spb-text, #1a1a1a);
}

.spb-faq__item {
	border-bottom: 1px solid var(--spb-border, rgba(0, 0, 0, 0.12));
}

.spb-faq__question {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	background: none;
	border: none;
	text-align: left;
	padding: 16px 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--spb-text, #1a1a1a);
	cursor: pointer;
}

.spb-faq__icon {
	flex-shrink: 0;
	color: var(--spb-accent, #C9A227);
	font-size: 20px;
	transition: transform 0.2s ease;
}

.spb-faq__question[aria-expanded="true"] .spb-faq__icon {
	transform: rotate(45deg);
}

.spb-faq__answer {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.25s ease;
}

.spb-faq__answer p {
	margin: 0 0 16px;
	color: var(--spb-muted, #555);
	line-height: 1.6;
}

/* ---------- Related services ---------- */
.spb-related {
	background: var(--spb-bg-alt, #f6f5f2);
	padding: var(--spb-space) 20px;
}

.spb-related__inner {
	max-width: 1100px;
	margin: 0 auto;
}

.spb-related__inner h2 {
	text-align: center;
	font-size: clamp(22px, 3vw, 30px);
	margin-bottom: 24px;
	color: var(--spb-text, #1a1a1a);
}

.spb-related__grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
}

.spb-related__card {
	display: block;
	text-decoration: none;
	border-radius: 4px;
	overflow: hidden;
	border: 1px solid var(--spb-border, rgba(0, 0, 0, 0.1));
	background: var(--spb-bg, #fff);
}

.spb-related__card img,
.spb-related__placeholder {
	width: 100%;
	height: 130px;
	object-fit: cover;
	display: block;
	background: var(--spb-bg-alt, #eee);
}

.spb-related__title {
	display: block;
	padding: 10px 12px;
	font-size: 14px;
	font-weight: 600;
	color: var(--spb-text, #1a1a1a);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.spb-portfolio__grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.spb-related__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	.spb-hero {
		min-height: 50vh;
	}
	.spb-nav {
		width: 36px;
		height: 36px;
	}
	.spb-benefits__inner ul {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	.spb-portfolio__grid {
		grid-template-columns: 1fr;
	}
	.spb-portfolio__item img {
		height: 200px;
	}
	.spb-related__grid {
		grid-template-columns: 1fr;
	}
}

/* Respect users who've asked for reduced motion. */
@media (prefers-reduced-motion: reduce) {
	.spb-slide {
		transition: none;
	}
	.spb-portfolio__item img {
		transition: none;
	}
}
