/*
 * PL / Works landing page — responsive v7.
 *
 * Desktop / tablet:
 *   kompozycja  [PEN]        [CAMERA]  film
 *
 * Mobile (<= 767px):
 *   [PEN]
 *   kompozycja
 *
 *   [CAMERA]
 *   film
 *
 * The desktop/tablet geometry is deliberately symmetrical: both labels have
 * the same column width and both icons have the same column width. This keeps
 * the complete composition visually centred. Mobile switches to the original
 * production-like vertical stack.
 */

body.page-template-page-pl-works {
	height: 100dvh;
	min-height: 100dvh;
	overflow: hidden;
}

body.page-template-page-pl-works .site-main {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.works-index {
	width: 100%;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	overflow: visible;
}

.works-index__content {
	--works-fit-scale: 1;

	width: 1500px;
	max-width: none;
	box-sizing: border-box;
	padding: 10px;

	display: grid;
	grid-template-rows: auto auto;
	align-content: center;
	row-gap: 32px;

	transform: scale(var(--works-fit-scale));
	transform-origin: center center;
}

.works-index__title {
	margin: 0;
	padding: 0;
	text-align: center;
	white-space: nowrap;
	font-family: "Futura", Arial, sans-serif;
	font-size: 76px;
	font-weight: 500;
	font-style: normal;
	line-height: 1.05;
	color: #fff;
}

/*
 * Symmetrical horizontal layout.
 * The larger 180px centre gap prevents the two icons from visually
 * converging as the whole composition scales down.
 */
.works-index__nav {
	display: grid;
	grid-template-columns: repeat(2, 630px);
	justify-content: center;
	align-items: center;
	column-gap: 180px;
}

.works-index__button {
	width: 630px;
	display: grid;
	align-items: center;
	box-sizing: border-box;
	padding: 0;

	font-family: "Futura", Arial, sans-serif;
	background: transparent;
	border: 0;
	color: #fff;
	text-decoration: none;
	cursor: pointer;

	transition: transform 0.3s ease;
}

/* Equal 300px label/icon columns on both sides = exact mirrored geometry. */
.works-index__button--composition {
	grid-template-columns: 300px 300px;
	column-gap: 30px;
}

.works-index__button--film {
	grid-template-columns: 300px 300px;
	column-gap: 30px;
}

.works-index__icon {
	display: block;
	width: 300px;
	height: auto;
	margin: 0;
	justify-self: center;
}

.works-index__label {
	display: block;
	width: 300px;
	white-space: nowrap;
	font-size: 50px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 6px;
	color: #fff;
	text-align: center;
	justify-self: center;
}

@media (hover: hover) and (pointer: fine) {
	.works-index__button:hover,
	.works-index__button:focus-visible {
		transform: scale(1.14);
	}
}

.works-index__button.is-activating {
	transform: scale(1.14);
}

/*
 * Phone layout: match production structurally.
 * Each category becomes a centred vertical icon+caption unit.
 */
@media (max-width: 767px) and (hover: none) and (pointer: coarse) {
	.works-index {
		align-items: center;
		padding-top: 0;
	}

	.works-index__content {
		width: 430px;
		padding: 0 12px;
		row-gap: 36px;
	}

	.works-index__title {
		font-size: 52px;
		line-height: 1;
	}

	.works-index__nav {
		grid-template-columns: 1fr;
		justify-items: center;
		row-gap: 52px;
		column-gap: 0;
	}

	.works-index__button,
	.works-index__button--composition,
	.works-index__button--film {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 16px;
	}

	/*
	 * Force the same order on both buttons:
	 * icon first, caption second.
	 */
	.works-index__button--composition .works-index__icon {
		order: 1;
	}

	.works-index__button--composition .works-index__label {
		order: 2;
	}

	.works-index__button--film .works-index__icon {
		order: 1;
	}

	.works-index__button--film .works-index__label {
		order: 2;
	}

	.works-index__icon {
		width: 96px;
	}

	.works-index__label {
		width: auto;
		font-size: 28px;
		letter-spacing: 5px;
		text-align: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.works-index__button {
		transition: none;
	}
}

/* Phone landscape: use stable, unscaled CSS layout for the full landing.
 * Header title starts at exactly the same vertical offset as archive headings.
 * Original fit script still controls header/footer zoom at tiny heights. */
@media (orientation: landscape) and (max-height: 600px) and (max-width: 1024px) and (hover: none) and (pointer: coarse) {
    body.page-template-page-pl-works .works-index {
        align-items: stretch;
        justify-content: flex-start;
        overflow: hidden;
    }
    body.page-template-page-pl-works .works-index__content {
        transform: none;
        width: 100%;
        height: 100%;
        max-width: none;
        padding: 2px 12px 8px;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        row-gap: 0;
        align-content: stretch;
    }
    body.page-template-page-pl-works .works-index__title {
        font-size: clamp(22px, 6dvh, 30px);
        line-height: 1.05;
        letter-spacing: 0;
        white-space: nowrap;
    }
    body.page-template-page-pl-works .works-index__nav {
        display:grid;
        grid-template-columns:repeat(2,minmax(0,1fr));
        justify-content:center;
        align-items:center;
        justify-items:stretch;
        column-gap:clamp(12px,2.4vw,22px);
        row-gap:0;
        width:100%;
        min-width:0;
        height:100%;
    }
    body.page-template-page-pl-works .works-index__button,
    body.page-template-page-pl-works .works-index__button--composition,
    body.page-template-page-pl-works .works-index__button--film {
        width:100%;
        display:grid;
        grid-template-columns:minmax(0,1fr) minmax(0,1fr);
        gap:clamp(4px,1.5vw,12px);
        align-items:center;
        justify-content:center;
    }
    body.page-template-page-pl-works .works-index__label,
    body.page-template-page-pl-works .works-index__icon {
        order:0;
    }
    body.page-template-page-pl-works .works-index__icon {
        width:clamp(48px,25dvh,130px);
        height:auto;
        max-width:100%;
        justify-self:center;
    }
    body.page-template-page-pl-works .works-index__label {
        width:auto;
        min-width:0;
        font-size:clamp(13px,4.2dvh,22px);
        letter-spacing:clamp(1px,.3vw,3px);
        white-space:nowrap;
        text-align:center;
    }
}
