/* -----------------------------------------------------------------------
   Redesigned single-product "Description" tab (see inc/product-story.php
   and woocommerce/single-product/tabs/description.php). Loaded on single
   product pages only.
   ----------------------------------------------------------------------- */

.su-product-story {
	max-width: 1120px;
	margin: 0 auto;
}

/* Scroll-reveal — fade + rise (or slide from a side, see --left/--right
   below). Hidden until .is-visible is added by product-story.js as each
   element scrolls into view; JS also adds .is-visible immediately (no
   animation) when the browser lacks IntersectionObserver or the visitor
   prefers reduced motion, so content is never actually hidden without JS. */
.su-reveal {
	opacity: 0;
	transform: translateY(18px);
	transition: opacity 0.6s ease, transform 0.6s ease;
	transition-delay: var(--su-reveal-delay, 0ms);
}
.su-reveal.is-visible {
	opacity: 1;
	transform: translateY(0) translateX(0);
}
.su-reveal--left {
	transform: translateX(-28px);
}
.su-reveal--right {
	transform: translateX(28px);
}

/* Intro narrative — kept at prose width even though the story wrapper is
   wider, so paragraphs stay comfortable to read */
.su-story-intro {
	max-width: 720px;
	margin: 0 auto var(--su-space-xl);
	font-size: 1.0625rem;
	line-height: var(--su-line-height-base);
	color: var(--su-text);
}
.su-story-intro p:first-of-type {
	font-size: 1.25rem;
	line-height: var(--su-line-height-tight);
	color: var(--su-text);
	font-weight: 500;
}
.su-story-intro p {
	margin: 0 0 var(--su-space-md);
}

.su-feature-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--su-radius-sm);
	background: var(--su-surface-raised);
	color: var(--su-accent);
	flex-shrink: 0;
}
.su-feature-icon svg {
	width: 22px;
	height: 22px;
}

/* Hero-image band: feature boxes flanking a centred product image either
   side, per the shelly.com-inspired layout. */
.su-story-feature-band {
	display: grid;
	grid-template-columns: 1fr minmax(240px, 340px) 1fr;
	gap: var(--su-space-lg);
	align-items: center;
	margin-bottom: var(--su-space-xl);
}
.su-feature-col {
	display: flex;
	flex-direction: column;
	gap: var(--su-space-md);
}
.su-feature-box {
	background: var(--su-surface);
	border: 1px solid var(--su-border);
	border-radius: var(--su-radius);
	padding: var(--su-space-md) var(--su-space-lg);
	display: flex;
	align-items: flex-start;
	gap: var(--su-space-sm);
}
.su-feature-box p {
	margin: 0;
	font-size: 0.9375rem;
	line-height: var(--su-line-height-base);
	color: var(--su-text);
}

/* Hero image — the inner .su-parallax element is the one product-story.js
   transforms on scroll; the outer wrapper clips it so the parallax offset
   never reveals empty space at the image's edges. */
.su-story-hero-image {
	position: relative;
	overflow: hidden;
	border-radius: var(--su-radius);
	background: var(--su-surface);
	aspect-ratio: 1 / 1;
}
.su-parallax {
	position: absolute;
	inset: -8% 0;
	will-change: transform;
	display: flex;
	align-items: center;
	justify-content: center;
}
.su-parallax img {
	width: 100%;
	height: auto;
	object-fit: contain;
}
@media (prefers-reduced-motion: reduce) {
	.su-parallax {
		position: static;
		inset: auto;
	}
}

/* Use cases */
.su-use-cases {
	margin-bottom: var(--su-space-xl);
}
.su-use-cases-heading {
	margin: 0 0 var(--su-space-lg);
}
.su-use-cases-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--su-space-md);
}
.su-use-case-card {
	background: var(--su-surface);
	border: 1px solid var(--su-border);
	border-radius: var(--su-radius);
	padding: var(--su-space-lg);
	display: flex;
	flex-direction: column;
	gap: var(--su-space-sm);
}
.su-use-case-card .su-feature-icon {
	margin-bottom: var(--su-space-xs);
}
.su-use-case-card h4 {
	margin: 0;
	font-size: 1rem;
	color: var(--su-text);
}
.su-use-case-card p {
	margin: 0;
	font-size: 0.9375rem;
	line-height: var(--su-line-height-base);
	color: var(--su-text-muted);
}

/* Grouped spec sections */
.su-spec-groups-heading {
	margin: 0 0 var(--su-space-lg);
}
.su-spec-group {
	border: 1px solid var(--su-border);
	border-radius: var(--su-radius);
	margin-bottom: var(--su-space-md);
	overflow: hidden;
}

/* Two columns on wider screens. Multi-column flow (not grid) so groups of
   uneven height — a 6-row Connectivity card next to a 2-row Protection
   card — pack cleanly instead of leaving a gap under the shorter one;
   break-inside keeps each group intact rather than splitting a card's rows
   across the column break. */
@media (min-width: 900px) {
	.su-spec-groups-list {
		column-count: 2;
		column-gap: var(--su-space-md);
	}
	.su-spec-group {
		break-inside: avoid;
		-webkit-column-break-inside: avoid;
	}
}
.su-spec-group-header {
	display: flex;
	align-items: center;
	gap: var(--su-space-sm);
	padding: var(--su-space-md) var(--su-space-lg);
	background: var(--su-surface);
	border-bottom: 1px solid var(--su-border);
}
.su-spec-group-icon {
	display: inline-flex;
	color: var(--su-accent);
}
.su-spec-group-icon svg {
	width: 18px;
	height: 18px;
}
.su-spec-group-header h4 {
	margin: 0;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--su-text);
}
.su-spec-list {
	margin: 0;
}
.su-spec-row {
	display: grid;
	grid-template-columns: minmax(140px, 40%) 1fr;
	gap: var(--su-space-md);
	padding: 0.65rem var(--su-space-lg);
	border-bottom: 1px solid var(--su-border);
	font-size: 0.9375rem;
}
.su-spec-row:last-child {
	border-bottom: none;
}
.su-spec-row:nth-child(even) {
	background: var(--su-surface);
}
.su-spec-row dt {
	margin: 0;
	color: var(--su-text-muted);
	font-weight: 500;
}
.su-spec-row dd {
	margin: 0;
	color: var(--su-text);
}
.su-spec-row--full {
	grid-template-columns: 1fr;
}

/* Sticky mini add-to-cart bar, appended to <body> by product-story.js once
   the page's real add-to-cart button has scrolled out of view. */
.su-sticky-cart {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	transform: translateY(100%);
	transition: transform 0.25s ease;
	background: var(--su-bg);
	border-top: 1px solid var(--su-border-strong);
	box-shadow: var(--su-shadow-hover);
	z-index: 100;
}
.su-sticky-cart.is-visible {
	transform: translateY(0);
}
.su-sticky-cart-inner {
	max-width: 1200px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: var(--su-space-md);
	padding: var(--su-space-sm) var(--su-space-lg);
}
.su-sticky-cart-title {
	flex: 1;
	font-weight: 600;
	color: var(--su-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.su-sticky-cart-price {
	color: var(--su-text-muted);
	font-weight: 500;
}
.su-sticky-cart-btn {
	background: var(--su-accent);
	color: var(--su-accent-text-on);
	border: none;
	border-radius: var(--su-radius-sm);
	padding: 0.6rem 1.25rem;
	font-weight: 600;
	cursor: pointer;
}
.su-sticky-cart-btn:hover {
	background: var(--su-accent-hover);
}

/* Mobile — stale rules here used to target .su-feature-grid, a class that
   stopped existing once the layout became the image-flanked band + use-cases
   grid below, so none of this was actually collapsing to one column on a
   phone. Fixed: every multi-column piece of the story now explicitly stacks. */
@media (max-width: 782px) {
	.su-story-feature-band {
		grid-template-columns: 1fr;
		gap: var(--su-space-md);
	}
	.su-story-hero-image {
		max-width: 260px;
		margin: 0 auto;
	}
	.su-feature-box {
		padding: var(--su-space-sm) var(--su-space-md);
	}
	.su-use-cases-grid {
		grid-template-columns: 1fr;
	}
	.su-story-intro p:first-of-type {
		font-size: 1.125rem;
	}
	.su-spec-row {
		grid-template-columns: 1fr;
		gap: 0.15rem;
	}
	.su-sticky-cart-title {
		display: none;
	}
}

/* Narrower phones — two use-case/spec-row columns' worth of horizontal
   padding starts to feel tight, so trim card padding a bit further rather
   than reusing the 782px values verbatim. */
@media (max-width: 480px) {
	.su-feature-box,
	.su-use-case-card {
		padding: var(--su-space-sm) var(--su-space-md);
	}
	.su-story-hero-image {
		max-width: 200px;
	}
}
