/*
 * Alfa Service Pages 1.0.0: additions on top of the theme's marble-services.css and the /our-work/ lightbox styles
 * (site-pages.css). Colours, fonts and tokens come from the theme (global.css); nothing here redefines them.
 * Every rule that changes with the screen has a desktop version and a < 768px version.
 */

/* Anchor jumps stop 4px under the bar (the bar is 56px high). The WordPress admin bar needs no allowance here: the
 * browser already starts the page below it. */
/* ---- Section bar: sticks to the top while scrolling, one row, scrolls sideways on a phone ---- */
.alfa-service-detail__nav {
	position: sticky;
	top: var(--alfa-wp-bar, 0px);
	z-index: 15;
	box-shadow: 0 1px 0 var(--alfa-line);
}
.alfa-service-detail__nav ul {
	flex-wrap: nowrap;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
}
.alfa-service-detail__nav ul::-webkit-scrollbar { display: none; }
.alfa-service-detail__nav li { flex: 0 0 auto; scroll-snap-align: center; }
.alfa-service-detail__nav a {
	position: relative;
	white-space: nowrap;
	transition: color .2s ease;
}
.alfa-service-detail__nav a::after {
	position: absolute;
	inset-inline: 0;
	inset-block-end: 4px;
	height: 2px;
	background: var(--alfa-gold);
	transform: scaleX(0);
	transition: transform .25s ease;
	content: '';
}
.alfa-service-detail__nav a.is-active { color: var(--alfa-gold); }
.alfa-service-detail__nav a.is-active::after { transform: scaleX(1); }
.alfa-service-chapter,
.alfa-service-card { scroll-margin-top: 60px; }

/* ---- Card display: consecutive «card» sections share one grid, equal heights ---- */
.alfa-service-cards {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-items: stretch;
	gap: 18px;
	padding-block: clamp(22px, 3.3vw, 48px);
	border-top: 1px solid var(--alfa-line);
}
.alfa-service-cards:first-child { padding-top: 0; border-top: 0; }
.alfa-service-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: clamp(18px, 2.2vw, 28px);
	border: 1px solid var(--alfa-line);
	border-block-start: 4px solid var(--alfa-gold);
	background: var(--alfa-stone);
}
.alfa-service-card h2 {
	margin: 0 0 10px;
	font-size: clamp(22px, 1.6vw + 12px, 28px);
	line-height: 1.25;
}
.alfa-service-card .alfa-service-chapter__content { flex: 1 1 auto; }
.alfa-service-detail--marble-waterjet .alfa-service-card { background: var(--alfa-ink-2); border-color: transparent; }
.alfa-service-detail--marble-waterjet .alfa-service-card h2 { color: var(--alfa-paper); }
.alfa-service-detail--marble-waterjet .alfa-service-card p { color: #ded8cd; }

/* ---- Works gallery: three columns on desktop and tablet, two on a phone; 3:4 tiles ---- */
.alfa-service-works { margin: 0 0 17px; }
.alfa-service-works__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.alfa-service-works__item {
	position: relative;
	min-width: 0;
	overflow: hidden;
	aspect-ratio: 3 / 4;
	background: #dbd6cc;
}
.alfa-service-works__item[hidden] { display: none; }
.alfa-service-works__open {
	display: block;
	width: 100%;
	height: 100%;
	cursor: zoom-in;
}
.alfa-service-works__open img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .55s ease, filter .55s ease;
}
.alfa-service-works__open:hover img,
.alfa-service-works__open:focus-visible img { transform: scale(1.045); filter: saturate(1.08); }
.alfa-service-works__item::after {
	position: absolute;
	inset: 50% 0 0;
	z-index: 1;
	background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .56) 55%, rgba(0, 0, 0, .72));
	content: '';
	pointer-events: none;
}
.alfa-service-works__cap {
	position: absolute;
	z-index: 2;
	inset-inline: 16px;
	inset-block-end: 14px;
	display: flex;
	gap: 10px;
	align-items: center;
	margin: 0;
	color: #fff;
	font-size: 1rem;
	line-height: 1.4;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
	pointer-events: none;
}
/* Both the label and the number are white. The gradient reaches 56% black where the label starts, so the label stays
 * above 4.5:1 even over the lightest pixel of a photo (measured on the page, see STATUS.md). */
.alfa-service-works__cap strong { color: #fff; font-weight: 600; }
.alfa-service-works__cap span { color: #fff; font-size: .76rem; font-variant-numeric: tabular-nums; }
.alfa-service-works__more {
	display: grid;
	justify-items: center;
	gap: 8px;
	margin-top: clamp(18px, 3vw, 30px);
}
.alfa-service-works__more[hidden] { display: none; }
.alfa-service-works__more button { min-width: 220px; cursor: pointer; font-family: inherit; }
.alfa-service-works__count { margin: 0; color: var(--alfa-muted); font-variant-numeric: tabular-nums; }

/* ---- Steps with a picture ---- */
.alfa-service-steps li img { display: block; width: 100%; aspect-ratio: 4 / 3; margin-bottom: 12px; object-fit: cover; }

/* ---- Phone ---- */
@media (max-width: 767px) {
	.alfa-service-detail__nav ul { gap: 0 14px; }
	.alfa-service-chapter,
	.alfa-service-card { scroll-margin-top: 60px; }
	.alfa-service-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
	.alfa-service-works__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
	.alfa-service-works__cap { inset-inline: 10px; inset-block-end: 9px; gap: 7px; font-size: .86rem; }
	.alfa-service-works__cap span { font-size: .68rem; }
	.alfa-service-works__more button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.alfa-service-detail__nav a,
	.alfa-service-detail__nav a::after,
	.alfa-service-works__open img { transition: none; }
	.alfa-service-works__open:hover img,
	.alfa-service-works__open:focus-visible img { transform: none; }
}
