/*
 * Story Time — archive + single styles.
 * Uses the child theme's existing custom properties so it inherits the brand.
 */

/* ---------------- Shared ---------------- */

.story-eyebrow {
	text-transform: uppercase;
	letter-spacing: .12em;
	font-weight: 700;
	font-size: 14px;
	margin-bottom: .5rem;
	opacity: .85;
}

.story-hero .story-hero-meta {
	display: flex;
	flex-wrap: wrap;
	gap: .75rem;
	align-items: center;
	margin-top: 1.25rem;
}

.story-hero .story-client {
	font-size: 20px;
	font-weight: 700;
}

.story-hero .story-amount,
.story-card-amount {
	display: inline-block;
	background: var(--accent-color);
	color: var(--font-color-alt);
	font-weight: 700;
	padding: .35rem 1rem;
	border-radius: 999px;
	line-height: 1.4;
}

.story-hero-intro {
	max-width: 46ch;
	margin-top: 1rem;
}

.story-section {
	margin-top: 3rem;
}

.story-section > h2 {
	margin-bottom: 1.5rem;
}

/* ---------------- Archive grid ---------------- */

.story-grid {
	row-gap: 2rem;
	margin-top: 2rem;
}

.story-card {
	height: 100%;
	background: var(--body-color);
	border-radius: var(--border-radius);
	box-shadow: 0 20px 47px 0 rgba(0, 0, 0, .08);
	overflow: hidden;
	transition: var(--transition);
}

.story-card:hover,
.story-card:focus-within {
	transform: translateY(-4px);
	box-shadow: 0 24px 55px 0 rgba(0, 0, 0, .14);
}

.story-card-link {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: inherit;
	text-decoration: none;
}

.story-card-img {
	position: relative;
	aspect-ratio: 16 / 10;
	background: var(--gradient-4) no-repeat center / cover;
}

.story-card-img .story-card-amount {
	position: absolute;
	left: 1rem;
	bottom: 1rem;
	font-size: 16px;
}

.story-card-body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding: 1.5rem;
}

.story-card-client {
	text-transform: uppercase;
	letter-spacing: .08em;
	font-size: 13px;
	font-weight: 700;
	color: var(--accent-color);
	margin-bottom: .35rem;
}

.story-card-title {
	font-size: var(--h5-size);
	line-height: var(--h5-line-height);
	margin-bottom: .75rem;
}

.story-card-excerpt {
	flex: 1 1 auto;
	margin-bottom: 1rem;
}

.story-card-media {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	font-size: 15px;
	opacity: .75;
	margin-bottom: 1rem;
}

.story-card-more {
	font-weight: 700;
	color: var(--accent-color);
}

.story-empty {
	margin: 3rem 0;
}

/* ---------------- Photo gallery ---------------- */

.story-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 1rem;
}

.story-thumb {
	display: block;
	padding: 0;
	border: 0;
	background: var(--gradient-4);
	border-radius: var(--border-radius);
	overflow: hidden;
	cursor: pointer;
	aspect-ratio: 1 / 1;
}

.story-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: var(--transition);
}

.story-thumb:hover img,
.story-thumb:focus-visible img {
	transform: scale(1.05);
}

/* ---------------- Video gallery ---------------- */

.story-videos {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 1.5rem;
}

.story-video {
	margin: 0;
}

.story-video-trigger {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: var(--gradient-4);
	border-radius: var(--border-radius);
	overflow: hidden;
	cursor: pointer;
	aspect-ratio: 16 / 9;
	box-shadow: 0 20px 47px 0 rgba(0, 0, 0, .08);
}

.story-video-trigger img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: var(--transition);
}

.story-video-trigger:hover img {
	transform: scale(1.03);
}

.story-play {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 68px;
	height: 68px;
	border-radius: 50%;
	background: rgba(0, 0, 0, .55);
	transition: var(--transition);
}

.story-play::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 12px 0 12px 20px;
	border-color: transparent transparent transparent #fff;
}

.story-video-trigger:hover .story-play,
.story-video-trigger:focus-visible .story-play {
	background: var(--accent-color);
	transform: scale(1.08);
}

.story-video figcaption {
	margin-top: .75rem;
	font-weight: 700;
}

/* ---------------- Google review ---------------- */

.story-review-card {
	position: relative;
	background: var(--gradient-4);
	border-radius: var(--border-radius);
	padding: 2.5rem 2rem 2rem;
	margin: 0;
	border-left: 5px solid var(--accent-color);
}

.story-review-mark {
	position: absolute;
	top: -.25rem;
	left: 1.25rem;
	font-size: 90px;
	line-height: 1;
	color: var(--accent-color);
	opacity: .2;
	font-family: var(--serif-font);
}

.story-review-rating {
	position: relative;
	margin-bottom: 1rem;
}

.story-stars {
	color: #F5A623;
	letter-spacing: .1em;
}

.story-review-text {
	position: relative;
}

.story-review-text p:last-child {
	margin-bottom: 0;
}

.story-review-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem;
	margin-top: 1.25rem;
}

.story-review-name {
	font-style: normal;
	font-weight: 700;
}

.story-review-link {
	font-weight: 700;
	color: var(--accent-color);
}

.story-back {
	margin: 3rem 0 1rem;
	font-weight: 700;
}

/* ---------------- Lightbox ---------------- */

.story-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 4rem 1.5rem;
	background: rgba(8, 20, 32, .92);
	opacity: 0;
	visibility: hidden;
	transition: opacity 250ms ease, visibility 250ms ease;
}

.story-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.story-lightbox-stage {
	position: relative;
	max-width: min(1100px, 100%);
	max-height: 100%;
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
}

.story-lightbox-stage img {
	max-width: 100%;
	max-height: 78vh;
	width: auto;
	height: auto;
	border-radius: var(--border-radius);
	display: block;
}

.story-lightbox-frame {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	max-height: 78vh;
	border-radius: var(--border-radius);
	overflow: hidden;
	background: #000;
}

.story-lightbox-frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.story-lightbox-caption {
	color: #fff;
	text-align: center;
	margin: 0;
	max-width: 70ch;
}

.story-lightbox button {
	position: absolute;
	border: 0;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: var(--transition);
	display: flex;
	align-items: center;
	justify-content: center;
}

.story-lightbox button:hover,
.story-lightbox button:focus-visible {
	background: var(--accent-color);
}

.story-lightbox-close {
	top: 1rem;
	right: 1rem;
}

.story-lightbox-prev {
	top: 50%;
	left: 1rem;
	transform: translateY(-50%);
}

.story-lightbox-next {
	top: 50%;
	right: 1rem;
	transform: translateY(-50%);
}

.story-lightbox-counter {
	position: absolute;
	top: 1.35rem;
	left: 1.5rem;
	color: rgba(255, 255, 255, .7);
	font-size: 15px;
}

body.story-lightbox-open {
	overflow: hidden;
}

@media (max-width: 767px) {
	.story-lightbox {
		padding: 3.5rem .75rem;
	}

	.story-lightbox-prev {
		left: .25rem;
	}

	.story-lightbox-next {
		right: .25rem;
	}

	.story-gallery {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	}
}

@media (prefers-reduced-motion: reduce) {
	.story-card,
	.story-thumb img,
	.story-video-trigger img,
	.story-play,
	.story-lightbox {
		transition: none;
	}
}

/* ---------------- Story layout with Instagram aside ---------------- */

.story-layout.has-aside {
	display: grid;
	/* 380px less the card's 1.25rem padding leaves a 340px frame, clear of
	   Instagram's 326px minimum embed width. */
	grid-template-columns: minmax(0, 1fr) var(--story-aside-width, 380px);
	gap: 3rem;
	align-items: start;
}

/* The aside tracks the reader down the page, holding clear of the top of the
   viewport and starting the same distance below the breadcrumb. */
.story-aside {
	position: sticky;
	/* The site header is Bootstrap .fixed-top and stays on screen, so the pin
	   point has to clear it. story.js measures the header and sets
	   --story-header-height, since it grows to ~194px when the nav wraps; the
	   fallback covers the no-JS case. */
	top: calc(var(--story-header-height, 152px) + var(--story-aside-gap, 75px));
	margin-top: var(--story-aside-gap, 75px);
}

.story-ig {
	background: var(--gradient-4);
	border-radius: var(--border-radius);
	padding: 1.25rem;
}

.story-ig-title {
	font-size: var(--h5-size);
	line-height: var(--h5-line-height);
	margin-bottom: 1rem;
}

.story-ig-frame {
	position: relative;
	width: 100%;
	/* Instagram cannot be measured cross-origin, so this is the starting
	   height; story.js tightens it if Instagram reports its own. */
	height: var(--story-ig-height, 660px);
	background: var(--body-color);
	border-radius: var(--border-radius);
	overflow: hidden;
}

.story-ig-frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.story-ig-link {
	display: inline-block;
	margin-top: 1rem;
	font-weight: 700;
	color: var(--accent-color);
}

/* Below the grid breakpoint the aside stacks under the story, centred and
   capped so it never stretches to full page width. */
@media (max-width: 991px) {
	.story-layout.has-aside {
		display: block;
	}

	.story-aside {
		position: static;
		margin: 3rem auto 0;
		max-width: 380px;
	}
}
