/*
 * Spike Blog base styles.
 * Fonts, headings and paragraph sizes come from the theme. This file only styles the
 * plugin's own parts, scoped to .spb (post body) and .spb-feed (.grid and .carousel).
 * Restyle per site by setting the variables below in the theme's stylesheet, for example:
 * .spb, .spb-feed { --spb-accent: #4b7a2a; }
 */

.spb,
.spb-feed {
	--spb-accent: #2f5d8a;
	--spb-accent-dk: #1f3f5f;
	--spb-ink: inherit;
	--spb-muted: #5c6670;
	--spb-bg: #f3f4f5;
	--spb-card-bg: #ffffff;
	--spb-line: #dde1e4;
	--spb-radius: 8px;
	--spb-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
	--spb-gap: 24px;
	--spb-show: 1;
}

/* Post body */

.spb .answer {
	margin: 0 0 32px;
	padding: 22px 24px;
	background: var(--spb-bg);
	border-left: 6px solid var(--spb-accent);
	border-radius: var(--spb-radius);
}

.spb .answer .label {
	display: block;
	margin-bottom: 6px;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--spb-accent-dk);
}

.spb .answer p {
	margin: 0;
}

.spb .answer p + p {
	margin-top: 10px;
}

.spb figure {
	max-width: 720px;
	margin: 32px auto;
}

.spb figure img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4/3;
	object-fit: cover;
	border-radius: var(--spb-radius);
}

.spb figure.whole img {
	aspect-ratio: auto;
	object-fit: contain;
}

.spb figcaption {
	margin-top: 10px;
	font-size: 16px;
	color: var(--spb-muted);
}

.spb .table-wrp {
	margin: 32px 0;
	overflow-x: auto;
}

.spb .compare {
	width: 100%;
	border-collapse: collapse;
}

.spb .compare th,
.spb .compare td {
	padding: 12px 14px;
	border-bottom: 1px solid var(--spb-line);
	text-align: left;
	vertical-align: top;
}

.spb .compare thead th {
	background: var(--spb-accent-dk);
	color: #ffffff;
}

.spb .faq-list {
	margin: 0 0 32px;
}

.spb .faq {
	display: block;
	margin-bottom: 12px;
	background: var(--spb-card-bg);
	border: 1px solid var(--spb-line);
	border-radius: var(--spb-radius);
}

.spb .faq summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 20px;
	font-weight: 700;
	list-style: none;
	cursor: pointer;
}

.spb .faq summary::-webkit-details-marker {
	display: none;
}

.spb .faq summary::after {
	content: "";
	flex: 0 0 auto;
	width: 10px;
	height: 10px;
	margin-top: -6px;
	border-right: 2px solid var(--spb-accent);
	border-bottom: 2px solid var(--spb-accent);
	transform: rotate(45deg);
	transition: transform 0.4s ease;
}

.spb .faq[open] summary::after {
	margin-top: 4px;
	transform: rotate(225deg);
}

.spb .faq.is-closing summary::after {
	margin-top: -6px;
	transform: rotate(45deg);
}

.spb .faq > :not(summary) {
	margin: 0;
	padding: 0 20px 20px;
}

.spb .cta {
	margin: 40px 0;
	padding: 32px 28px;
	background: var(--spb-bg);
	border-radius: var(--spb-radius);
	text-align: center;
}

.spb .cta h2 {
	margin-top: 0;
}

.spb .cta .btn,
.spb-feed .all {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 700;
	text-decoration: none;
}

.spb .cta .btn {
	margin-top: 8px;
	padding: 14px 24px;
	background: var(--spb-accent);
	border-radius: var(--spb-radius);
	color: #ffffff;
}

.spb .cta .btn:hover,
.spb .cta .btn:focus-visible {
	background: var(--spb-accent-dk);
}

/* Cards */

.spb-feed .cards {
	margin: 0;
	padding: 0;
	list-style: none;
}

.spb-feed.grid .cards {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--spb-gap);
}

.spb-card {
	margin: 0;
	padding: 0;
}

.spb-card .link {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	background: var(--spb-card-bg);
	border: 1px solid var(--spb-line);
	border-radius: var(--spb-radius);
	color: var(--spb-ink);
	text-decoration: none;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.spb-card .link:hover {
	transform: translateY(-4px);
	box-shadow: var(--spb-shadow);
}

.spb-card .img-box {
	display: block;
	aspect-ratio: 16/9;
	overflow: hidden;
}

.spb-card .img-box img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.spb-card .img-box.img-default {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--spb-bg);
}

.spb-card .img-default img {
	width: 50%;
	max-width: 220px;
	height: auto;
	object-fit: contain;
}

.spb-card .body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 10px;
	padding: 22px 22px 24px;
}

.spb-card .title {
	margin: 0;
	line-height: 1.25;
}

.spb-card .desc {
	display: block;
}

.spb-card .more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: auto;
	padding-top: 6px;
	font-weight: 700;
	color: var(--spb-accent-dk);
}

.spb-card .link:hover .more {
	text-decoration: underline;
}

.spb-feed .head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	margin-bottom: var(--spb-gap);
}

.spb-feed .head .title {
	margin: 0;
}

.spb-feed .head .txt {
	margin: 8px 0 0;
}

.spb-feed .all {
	color: var(--spb-accent-dk);
}

.spb-feed .pages {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: 40px;
}

.spb-feed .pages .page-numbers {
	padding: 8px 14px;
	border: 1px solid var(--spb-line);
	border-radius: var(--spb-radius);
	text-decoration: none;
}

.spb-feed .pages .current {
	background: var(--spb-accent);
	border-color: var(--spb-accent);
	color: #ffffff;
}

.spb .icon,
.spb-card .icon,
.spb-feed .icon {
	flex: 0 0 auto;
}

/* Carousel */

.spb-feed.carousel .cards {
	display: flex;
	gap: var(--spb-gap);
	margin: -8px 0 0;
	padding: 8px 0 16px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
}

.spb-feed.carousel.is-ready .cards {
	scrollbar-width: none;
}

.spb-feed.carousel.is-ready .cards::-webkit-scrollbar {
	display: none;
}

.spb-feed.carousel .spb-card {
	flex: 0 0 calc((100% - (var(--spb-show) - 1) * var(--spb-gap)) / var(--spb-show));
	scroll-snap-align: start;
}

.spb-feed .controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 8px;
}

.spb-feed .controls[hidden] {
	display: none;
}

.spb-feed .controls .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: var(--spb-card-bg);
	border: 1px solid var(--spb-line);
	border-radius: 50%;
	color: var(--spb-accent-dk);
	cursor: pointer;
}

.spb-feed .controls .btn:hover,
.spb-feed .controls .btn:focus-visible {
	border-color: var(--spb-accent);
}

.spb-feed .play .icon-play,
.spb-feed.is-paused .play .icon-pause {
	display: none;
}

.spb-feed.is-paused .play .icon-play {
	display: block;
}

/* Phones: the dots get their own row above the buttons */
.spb-feed .dots {
	display: flex;
	flex: 0 0 100%;
	flex-wrap: wrap;
	justify-content: center;
	order: -1;
	gap: 4px;
}

.spb-feed .dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
}

.spb-feed .dot::before {
	content: "";
	width: 10px;
	height: 10px;
	background: var(--spb-line);
	border-radius: 50%;
}

.spb-feed .dot[aria-current="true"]::before {
	background: var(--spb-accent);
}

/* Posts per row: 1 on phones, up to 2 on tablets, up to 3 from 992px, the full number from 1170px */

@media (min-width: 768px) {
	.spb-feed.grid .cards {
		grid-template-columns: repeat(2, 1fr);
	}

	.spb-feed.grid.per-row-1 .cards {
		grid-template-columns: 1fr;
	}

	.spb-feed.carousel {
		--spb-show: 2;
	}

	.spb-feed.carousel.per-row-1 {
		--spb-show: 1;
	}

	.spb-feed .dots {
		flex: 0 1 auto;
		order: 0;
	}
}

@media (min-width: 992px) {
	.spb-feed.grid.per-row-3 .cards,
	.spb-feed.grid.per-row-4 .cards,
	.spb-feed.grid.per-row-5 .cards,
	.spb-feed.grid.per-row-6 .cards {
		grid-template-columns: repeat(3, 1fr);
	}

	.spb-feed.carousel.per-row-3,
	.spb-feed.carousel.per-row-4,
	.spb-feed.carousel.per-row-5,
	.spb-feed.carousel.per-row-6 {
		--spb-show: 3;
	}
}

@media (min-width: 1170px) {
	.spb-feed.grid.per-row-4 .cards {
		grid-template-columns: repeat(4, 1fr);
	}

	.spb-feed.grid.per-row-5 .cards {
		grid-template-columns: repeat(5, 1fr);
	}

	.spb-feed.grid.per-row-6 .cards {
		grid-template-columns: repeat(6, 1fr);
	}

	.spb-feed.carousel.per-row-4 {
		--spb-show: 4;
	}

	.spb-feed.carousel.per-row-5 {
		--spb-show: 5;
	}

	.spb-feed.carousel.per-row-6 {
		--spb-show: 6;
	}
}

@media (prefers-reduced-motion: reduce) {
	.spb .faq summary::after,
	.spb-card .link {
		transition: none;
	}

	.spb-card .link:hover {
		transform: none;
	}
}
