/*
 * Textielstudio Hero Grid – frontend styles
 * --------------------------------------------------------------
 * The grid is rotated 45deg to create diamond-shaped tiles.
 * Images inside tiles are counter-rotated -45deg so people
 * appear upright. The image element is sized 142% with -21%
 * offsets so it fully covers the diamond viewport after the
 * counter-rotation.
 */

.ts-hero {
	position: relative;
	width: 100%;
	height: 80vh;
	min-height: 480px;
	overflow: hidden;
	isolation: isolate;
}

.ts-hero *,
.ts-hero *::before,
.ts-hero *::after {
	box-sizing: border-box;
}

/* -------- Background grid -------- */
.ts-hero-bg {
	position: absolute;
	inset: 0;
	overflow: hidden;
	background-color: #dcdcdc; /* shows through the gap */
	z-index: 0;
}

.ts-hero-grid {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 150%;
	/* Square cells: derive height from aspect ratio cols/rows */
	aspect-ratio: calc(var(--cols, 6) / var(--rows, 4));
	transform: translate(-50%, -50%) rotate(45deg);
	transform-origin: center center;
	display: grid;
	grid-template-columns: repeat(var(--cols, 6), 1fr);
	grid-template-rows: repeat(var(--rows, 4), 1fr);
	gap: 8px;
	will-change: transform;
}

/* -------- Tiles -------- */
.ts-hero-tile {
	position: relative;
	overflow: hidden;
	background-color: transparent;
}

.ts-hero-tile--color {
	/* color set inline */
}

.ts-hero-tile--empty {
	background-color: transparent;
}

.ts-hero-tile--placeholder {
	background-color: #c8d4dc;
	background-image: linear-gradient(135deg, #b8c8d2 25%, transparent 25%, transparent 50%, #b8c8d2 50%, #b8c8d2 75%, transparent 75%, transparent);
	background-size: 20px 20px;
	opacity: 0.5;
}

/* Inner image holder is counter-rotated so the photo is upright.
   It is enlarged to sqrt(2) ≈ 142% and offset -21% so the upright
   square fully covers the diamond-shaped viewport. */
.ts-hero-tile-img {
	position: absolute;
	top: -21%;
	left: -21%;
	width: 142%;
	height: 142%;
	transform: rotate(-45deg);
	transform-origin: center center;
}

.ts-hero-tile-img img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity 0.8s ease;
	will-change: opacity;
	user-select: none;
	-webkit-user-drag: none;
}

/* The fade-in image (added by JS) starts hidden. */
.ts-hero-tile-img img.is-fading-out {
	opacity: 0;
}

/* -------- Overlay -------- */
.ts-hero-overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.18);
	pointer-events: none;
	z-index: 1;
}

/* -------- Content -------- */
.ts-hero-content {
	position: relative;
	z-index: 2;
	width: 100%;
	height: 100%;
	padding: 5% 6%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	pointer-events: none; /* let interactive children opt-in */
}

.ts-hero-content-inner {
	max-width: 800px;
	pointer-events: auto;
	width: 100%;
}

.ts-hero-eyebrow {
	color: #fff;
	font-size: 1.05rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	margin: 0 0 1rem 0;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.ts-hero-title {
	color: #fff;
	font-size: clamp(2.25rem, 6vw, 5.5rem);
	font-weight: 700;
	line-height: 1.05;
	margin: 0 0 2rem 0;
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
	word-break: break-word;
}

.ts-hero-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	justify-content: flex-start;
}

.ts-hero-btn {
	display: inline-block;
	background-color: #a4c83a;
	color: #fff;
	padding: 18px 40px;
	text-decoration: none;
	font-weight: 600;
	font-size: 1rem;
	letter-spacing: 0.02em;
	transition: background-color 0.2s ease, transform 0.2s ease;
	border: none;
	cursor: pointer;
	line-height: 1.2;
}

.ts-hero-btn:hover,
.ts-hero-btn:focus {
	background-color: #8aae2a;
	color: #fff;
	transform: translateY(-1px);
	text-decoration: none;
}

.ts-hero-btn:active {
	transform: translateY(0);
}

/* -------- Responsive -------- */
@media (max-width: 1024px) {
	.ts-hero {
		min-height: 420px;
	}
	.ts-hero-grid {
		width: 170%;
	}
}

@media (max-width: 768px) {
	.ts-hero {
		min-height: 380px;
	}
	.ts-hero-grid {
		width: 200%;
	}
	.ts-hero-content {
		padding: 8% 6%;
	}
	.ts-hero-buttons {
		gap: 0.75rem;
	}
	.ts-hero-btn {
		padding: 14px 28px;
		font-size: 0.95rem;
	}
}

@media (max-width: 480px) {
	.ts-hero-grid {
		width: 230%;
	}
}

/* Reduced motion: disable rotation transitions */
@media (prefers-reduced-motion: reduce) {
	.ts-hero-tile-img img {
		transition: none !important;
	}
}
