/*
 * The by-stylist table (layout="people"). Loads after clarity-phorest-menu.css and uses its
 * --cpm-* tokens. Profile page styles live in clarity-phorest-menu-stylist.css.
 */

/*
 * People layout: a column per stylist with their photo on top, like the client's spreadsheet but
 * with people instead of levels. The service column stays put while the people scroll sideways.
 */
/* The frame draws the box so the scroll area inside it can fade at a cut-off edge without fading
   the border and shadow along with it. */
.cpm-people__frame {
	position: relative;
	border: 1px solid var(--cpm-line);
	background: var(--cpm-surface);
	box-shadow: 0 2px 18px rgba(0, 0, 0, 0.05);
}

.cpm-people .cpm-menu__scroll {
	/* When the people don't all fit, a swipe settles on a whole stylist column, lined up just right
	   of the sticky service column instead of half hidden under it. */
	scroll-snap-type: x mandatory;
	scroll-padding-left: var(--cpm-service-col);
	overscroll-behavior-x: contain;
}

/* The script sets cpm-more-left / cpm-more-right while there are stylists out of view that way. */
.cpm-people .cpm-menu__scroll.cpm-more-right {
	-webkit-mask-image: linear-gradient(to left, transparent, #000 3em);
	mask-image: linear-gradient(to left, transparent, #000 3em);
}

.cpm-people .cpm-menu__scroll.cpm-more-left {
	-webkit-mask-image: linear-gradient(to right, #000 var(--cpm-service-col), transparent var(--cpm-service-col), #000 calc(var(--cpm-service-col) + 3em));
	mask-image: linear-gradient(to right, #000 var(--cpm-service-col), transparent var(--cpm-service-col), #000 calc(var(--cpm-service-col) + 3em));
}

.cpm-people .cpm-menu__scroll.cpm-more-left.cpm-more-right {
	-webkit-mask-image: linear-gradient(to right, #000 var(--cpm-service-col), transparent var(--cpm-service-col), #000 calc(var(--cpm-service-col) + 3em), #000 calc(100% - 3em), transparent);
	mask-image: linear-gradient(to right, #000 var(--cpm-service-col), transparent var(--cpm-service-col), #000 calc(var(--cpm-service-col) + 3em), #000 calc(100% - 3em), transparent);
}

/* ‹ › on the stylist row. A zero-height strip that only the buttons take clicks on; the script sets
   its top to the middle of the photos, and this top is the fallback. */
.cpm-scroll-nav {
	position: absolute;
	top: calc(1.25em + 28px);
	right: 0;
	left: var(--cpm-service-col);
	z-index: 2;
	height: 0;
	pointer-events: none;
}

.cpm-menu .cpm-scroll-nav__btn {
	position: absolute;
	top: -17px;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--cpm-line);
	border-radius: 50%;
	background: var(--cpm-surface);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
	color: var(--cpm-button);
	cursor: pointer;
	pointer-events: auto;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.cpm-menu .cpm-scroll-nav__btn:hover {
	border-color: var(--cpm-tint-strong);
	color: var(--cpm-button-hover);
}

.cpm-menu .cpm-scroll-nav__btn--prev {
	left: 0.5em;
}

.cpm-menu .cpm-scroll-nav__btn--next {
	right: 0.5em;
}

.cpm-menu .cpm-scroll-nav__btn[hidden] {
	display: none;
}

.cpm-people {
	--cpm-service-col: 17em;
}

.cpm-menu .cpm-table--people [data-col] {
	scroll-snap-align: start;
}

.cpm-menu .cpm-menu__scroll table.cpm-table--people {
	border-collapse: separate;
	border-spacing: 0;
}

.cpm-menu .cpm-table--people th,
.cpm-menu .cpm-table--people td {
	padding: 1em 0.75em;
}

.cpm-menu .cpm-table--people th:first-child,
.cpm-menu .cpm-table--people td:first-child {
	padding-left: 1.25em;
}

.cpm-menu .cpm-table--people .cpm-table__service {
	position: sticky;
	left: 0;
	z-index: 1;
	width: var(--cpm-service-col);
	min-width: var(--cpm-service-col);
	max-width: var(--cpm-service-col);
	background: var(--cpm-surface);
	box-shadow: 1px 0 0 var(--cpm-line);
}

.cpm-menu .cpm-table--people thead th {
	border-bottom: 1px solid var(--cpm-tint-strong);
	background: var(--cpm-tint);
	vertical-align: bottom;
}

.cpm-menu .cpm-table--people thead .cpm-table__service {
	background: var(--cpm-tint);
}

/* Top-aligned so every column's photo, name and Book button sit on the same lines, whatever
   buttons a column has under them. */
.cpm-menu .cpm-table--people .cpm-person {
	vertical-align: top;
	min-width: 6.5em;
	padding-top: 1.25em;
	padding-bottom: 1em;
	color: var(--cpm-ink);
	font-size: 1em;
	letter-spacing: 0;
	text-align: center;
	text-transform: none;
	white-space: normal;
}

.cpm-person__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.2em;
	color: inherit;
	text-decoration: none;
}

.cpm-menu a.cpm-person__link:hover .cpm-person__name {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.cpm-person__photo {
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	margin-bottom: 0.3em;
	border-radius: 50%;
	background: var(--cpm-surface);
	box-shadow: 0 0 0 3px var(--cpm-surface), 0 0 0 4px var(--cpm-line);
	color: var(--cpm-muted);
	font-weight: 700;
	object-fit: cover;
}

.cpm-person__name {
	font-size: 0.95em;
	font-weight: 700;
	line-height: 1.2;
}

.cpm-person__level {
	color: var(--cpm-muted);
	font-size: 0.68em;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.cpm-person__actions {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.35em;
	width: 100%;
	max-width: 7.5em;
	margin: 0.65em auto 0;
}

.cpm-menu .cpm-person__book,
.cpm-menu .cpm-person__bio {
	display: block;
	padding: 0.45em 0.6em;
	border: 1px solid var(--cpm-button);
	font-size: 0.68em;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cpm-menu .cpm-person__book {
	background: var(--cpm-button);
	color: var(--cpm-button-ink);
}

.cpm-menu .cpm-person__book:hover {
	border-color: var(--cpm-button-hover);
	background: var(--cpm-button-hover);
	color: var(--cpm-button-ink);
}

.cpm-menu .cpm-person__bio {
	background: var(--cpm-surface);
	color: var(--cpm-button);
}

.cpm-menu .cpm-person__bio:hover {
	border-color: var(--cpm-button-hover);
	color: var(--cpm-button-hover);
}

.cpm-menu .cpm-table--people tbody .cpm-table__price {
	text-align: center;
}

.cpm-menu .cpm-table--people tbody tr:hover > * {
	background-color: var(--cpm-tint-soft);
}

.cpm-menu .cpm-table--people .is-active,
.cpm-menu .cpm-table--people tbody tr:hover > .is-active {
	background-color: var(--cpm-tint);
}

.cpm-menu .cpm-table--people thead .cpm-person.is-active {
	box-shadow: inset 0 -3px 0 var(--cpm-tint-strong);
}

/* Corner cell: the instruction that ties the two ways of booking together. */
.cpm-menu .cpm-table--people thead .cpm-corner {
	color: var(--cpm-ink);
	font-size: 1em;
	letter-spacing: 0;
	text-transform: none;
	white-space: normal;
}

.cpm-corner__title {
	display: block;
	font-family: inherit;
	font-size: 1.05em;
	font-weight: 700;
	line-height: 1.3;
}

.cpm-corner__hint {
	display: block;
	margin-top: 0.4em;
	color: var(--cpm-muted);
	font-size: 0.8em;
	font-weight: 400;
	line-height: 1.45;
}

/* "Any provider" sits between the services and the people, set apart by a soft rule each side. */
.cpm-menu .cpm-table--people .cpm-person--any,
.cpm-menu .cpm-table--people .cpm-any-cell {
	border-right: 1px solid var(--cpm-line);
	background-color: var(--cpm-tint-soft);
}

.cpm-menu .cpm-table--people thead .cpm-person--any {
	position: relative;
	/* Room for the pinned Book button: cell padding + actions margin + button height. */
	padding-bottom: calc(3.15em + 2px);
	background-color: var(--cpm-tint);
}

/* Any provider has no View bio, so its Book drops to the cell's bottom edge, level with the last
   button in the people columns. margin-top: auto has nothing to push against in a table cell. */
.cpm-menu .cpm-table--people thead .cpm-person--any .cpm-person__actions {
	position: absolute;
	right: 0;
	bottom: 1em;
	left: 0;
	margin: 0 auto;
}

.cpm-person__photo--any {
	color: var(--cpm-button);
}

.cpm-menu .cpm-table--people .cpm-any-cell {
	min-width: 8em;
}

.cpm-any-cell__price {
	display: block;
	font-weight: 600;
	white-space: nowrap;
}

.cpm-menu .cpm-any-cell__book {
	display: inline-block;
	margin-top: 0.45em;
	padding: 0.3em 0.9em;
	border: 1px solid var(--cpm-button);
	color: var(--cpm-button);
	font-size: 0.66em;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.cpm-menu .cpm-any-cell__book:hover {
	background: var(--cpm-button);
	color: var(--cpm-button-ink);
}

.cpm-table--people .cpm-service__desc {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

/* Phone-only pieces of the stylist table; the media query below turns them on. */
.cpm-people__hint,
.cpm-people__actions {
	display: none;
}

@media (max-width: 720px) {
	/* Without the script, phones keep the scrollable grid, just tighter. */
	.cpm-menu .cpm-table--people th,
	.cpm-menu .cpm-table--people td {
		padding: 0.9em 0.5em;
	}

	.cpm-people {
		--cpm-service-col: 9.5em;
	}

	.cpm-menu .cpm-table--people th:first-child,
	.cpm-menu .cpm-table--people td:first-child {
		padding-left: 0.85em;
	}

	/*
	 * With the script: a strip of people that stays pinned while the list of services scrolls under
	 * it, and a booking bar pinned to the bottom of the screen for whoever is chosen.
	 */
	.cpm-people.cpm-js .cpm-menu__picker {
		display: none;
	}

	.cpm-people.cpm-js .cpm-people__hint {
		display: block;
		margin: 0 0 0.35em;
		color: var(--cpm-muted);
		font-size: 0.85em;
	}

	.cpm-people.cpm-js .cpm-people__frame {
		border: 0;
		background: transparent;
		box-shadow: none;
	}

	.cpm-people.cpm-js .cpm-menu__scroll {
		overflow: visible;
		scroll-snap-type: none;
	}

	/* In the strip the buttons sit over the first and last photo. */
	.cpm-people.cpm-js .cpm-scroll-nav {
		top: calc(0.8em + 26px);
		left: 0;
	}

	.cpm-menu.cpm-people.cpm-js .cpm-scroll-nav__btn {
		top: -15px;
		width: 30px;
		height: 30px;
	}

	.cpm-menu.cpm-people.cpm-js .cpm-scroll-nav__btn--prev {
		left: 0;
	}

	.cpm-menu.cpm-people.cpm-js .cpm-scroll-nav__btn--next {
		right: 0;
	}

	.cpm-people.cpm-js .cpm-table--people thead tr.cpm-more-right {
		-webkit-mask-image: linear-gradient(to left, transparent, #000 2.5em);
		mask-image: linear-gradient(to left, transparent, #000 2.5em);
	}

	.cpm-people.cpm-js .cpm-table--people thead tr.cpm-more-left {
		-webkit-mask-image: linear-gradient(to right, transparent, #000 2.5em);
		mask-image: linear-gradient(to right, transparent, #000 2.5em);
	}

	.cpm-people.cpm-js .cpm-table--people thead tr.cpm-more-left.cpm-more-right {
		-webkit-mask-image: linear-gradient(to right, transparent, #000 2.5em, #000 calc(100% - 2.5em), transparent);
		mask-image: linear-gradient(to right, transparent, #000 2.5em, #000 calc(100% - 2.5em), transparent);
	}

	.cpm-people.cpm-js .cpm-menu__scroll table.cpm-table--people,
	.cpm-people.cpm-js .cpm-table--people tbody {
		display: block;
		width: 100%;
	}

	/* The thead is what sticks: a sticky element can't leave its parent, and the table is the parent
	   that spans the whole list. */
	.cpm-people.cpm-js .cpm-table--people thead {
		position: sticky;
		top: 0;
		z-index: 3;
		display: block;
		background: var(--cpm-surface);
		box-shadow: 0 1px 0 var(--cpm-line), 0 6px 12px -10px rgba(0, 0, 0, 0.25);
	}

	.cpm-people.cpm-js .cpm-table--people thead tr {
		display: flex;
		gap: 0.2em;
		padding: 0.6em 0 0.65em;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
	}

	.cpm-people.cpm-js .cpm-table--people thead tr::-webkit-scrollbar {
		display: none;
	}

	.cpm-menu.cpm-people.cpm-js .cpm-table--people thead .cpm-corner {
		display: none;
	}

	.cpm-menu.cpm-people.cpm-js .cpm-table--people thead .cpm-person {
		position: static;
		flex: 0 0 4.9em;
		width: 4.9em;
		min-width: 0;
		max-width: none;
		padding: 0.2em 0.1em;
		border: 0;
		background: transparent;
		box-shadow: none;
		cursor: pointer;
		scroll-snap-align: start;
	}

	.cpm-people.cpm-js .cpm-person__actions {
		display: none;
	}

	.cpm-people.cpm-js .cpm-person__photo {
		width: 52px;
		height: 52px;
		transition: box-shadow 0.15s ease;
	}

	/* In the phone strip the other people stay readable, just quieter than the chosen one. */
	.cpm-menu.cpm-people.cpm-js[data-cpm-picked] .cpm-table--people thead .cpm-person:not(.is-active) {
		opacity: 0.55;
	}

	.cpm-people.cpm-js .cpm-person.is-active .cpm-person__photo {
		box-shadow: 0 0 0 2px var(--cpm-surface), 0 0 0 4px var(--cpm-tint-strong);
	}

	.cpm-people.cpm-js .cpm-person__name {
		font-size: 0.78em;
	}

	.cpm-people.cpm-js .cpm-person.is-active .cpm-person__name {
		color: var(--cpm-accent);
	}

	.cpm-people.cpm-js .cpm-person__level {
		font-size: 0.56em;
	}

	/* Services as a list: name on the left, the chosen person's price on the right. */
	.cpm-people.cpm-js .cpm-table--people tbody tr {
		display: grid;
		grid-template-columns: 1fr auto;
		align-items: start;
		column-gap: 1em;
		padding: 1em 0;
		border-bottom: 1px solid var(--cpm-line);
	}

	.cpm-menu.cpm-people.cpm-js .cpm-table--people tbody th,
	.cpm-menu.cpm-people.cpm-js .cpm-table--people tbody td {
		position: static;
		display: block;
		width: auto;
		min-width: 0;
		max-width: none;
		padding: 0;
		border: 0;
		background: transparent;
		box-shadow: none;
		text-align: right;
	}

	.cpm-menu.cpm-people.cpm-js .cpm-table--people tbody th {
		text-align: left;
	}

	.cpm-menu.cpm-people.cpm-js .cpm-table--people tbody [data-col]:not(.is-active) {
		display: none;
	}

	.cpm-people.cpm-js .cpm-people__actions:not([hidden]) {
		position: sticky;
		bottom: 0;
		z-index: 3;
		display: flex;
		gap: 0.5em;
		margin-top: 0.75em;
		padding: 0.75em 0 calc(0.75em + env(safe-area-inset-bottom));
		background: var(--cpm-surface);
		box-shadow: 0 -1px 0 var(--cpm-line);
	}

	.cpm-menu.cpm-people.cpm-js .cpm-people__actions .cpm-book {
		flex: 1 1 auto;
		padding: 0.95em 1em;
		text-align: center;
	}

	.cpm-menu.cpm-people.cpm-js .cpm-people__actions .cpm-person__bio:not([hidden]) {
		display: flex;
		flex: 0 0 auto;
		align-items: center;
		padding: 0.95em 1.1em;
		font-size: 0.8em;
	}

	.cpm-menu.cpm-people.cpm-js .cpm-people__actions [hidden] {
		display: none;
	}
}
