/*
 * Shop styles: product archive, product cards, single product.
 * Uses the tokens from base.css.
 */

/* ------------------------------------------------------------ page heading */

.tm-pagehead {
	padding-block: clamp(20px, 3vw, 36px) clamp(20px, 2.6vw, 32px);
	background: #fff;
}

.tm-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 8px;
	margin-bottom: 8px;
	color: var(--c-muted);
	font-size: var(--fs-sm);
	line-height: 1.4;
}

.tm-breadcrumb > * {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	line-height: 1.2;
}

.tm-breadcrumb a {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	color: var(--c-link);
	text-decoration: none;
}

.tm-breadcrumb a:hover {
	text-decoration: underline;
}

.tm-pagehead .tm-label {
	margin-bottom: 4px;
}

.tm-shop__title {
	color: var(--c-navy);
	font-size: clamp(1.625rem, 1.15rem + 1.9vw, 2.5rem);
	line-height: 1.12;
	font-weight: 800;
	letter-spacing: -0.015em;
	text-transform: uppercase;
}

.tm-band {
	padding-block: clamp(24px, 3.4vw, 40px) var(--section-y);
	background: var(--c-grey);
}

/* ------------------------------------------------------------- pill tabs */

.tm-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 20px;
}

.tm-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	box-sizing: border-box;
	min-height: 44px;
	padding: 0 20px;
	border: 2px solid transparent;
	border-radius: var(--r-pill);
	background: var(--c-grey);
	color: var(--c-muted);
	font-family: var(--font);
	font-size: var(--fs-sm);
	line-height: 1;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.tm-tab:hover {
	background: var(--c-line);
	color: var(--c-navy);
}

.tm-tab.is-active {
	background: var(--c-mid);
	color: #fff;
}

.tm-tab .tm-ico {
	width: 18px;
	height: 18px;
}

@media (max-width: 768px) {
	.tm-pagehead .tm-tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		margin-inline: calc(var(--gutter) * -1);
		padding: 2px var(--gutter);
		scrollbar-width: none;
	}

	.tm-pagehead .tm-tabs::-webkit-scrollbar {
		display: none;
	}

	.tm-pagehead .tm-tab {
		flex: none;
	}
}

/* ------------------------------------------------------------ shop layout */

.tm-shop__layout {
	display: grid;
	grid-template-columns: 232px minmax(0, 1fr);
	gap: clamp(24px, 3vw, 40px);
	align-items: start;
}

.tm-aside__title {
	display: block;
	margin-bottom: 8px;
	color: var(--c-link);
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.tm-search__row {
	position: relative;
}

.tm-search input[type='search'] {
	width: 100%;
	box-sizing: border-box;
	min-height: 48px;
	padding: 0 48px 0 16px;
	border: 2px solid transparent;
	border-radius: var(--r-pill);
	background: #fff;
	color: var(--c-ink);
	font-family: var(--font);
	font-size: var(--fs-md);
}

.tm-search input[type='search']:focus {
	outline: none;
	border-color: var(--c-link);
}

.tm-search__btn {
	position: absolute;
	top: 2px;
	right: 2px;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--r-pill);
	background: none;
	color: var(--c-deep);
	cursor: pointer;
}

.tm-search__btn .tm-ico {
	width: 20px;
	height: 20px;
}

.tm-cats {
	margin-top: 20px;
}

.tm-cats__group {
	margin: 18px 0 6px;
	color: var(--c-muted);
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.tm-cats__list {
	display: grid;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tm-cats__list a {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	border-radius: var(--r-sm);
	background: #fff;
	color: var(--c-ink);
	font-size: var(--fs-sm);
	line-height: 1.3;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.tm-cats__list a:hover {
	background: var(--c-line);
}

.tm-cats__list a.is-active {
	background: var(--c-action);
	color: #fff;
}

.tm-shop__count {
	margin-bottom: 16px;
	color: var(--c-muted);
	font-size: var(--fs-sm);
	text-align: right;
}

@media (max-width: 900px) {
	.tm-shop__layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
	}

	.tm-shop__aside {
		display: grid;
		gap: 12px;
	}

	.tm-cats {
		margin-top: 0;
	}

	.tm-cats__group {
		display: none;
	}

	/* categories become a horizontally scrolling chip row */
	.tm-cats {
		display: flex;
		gap: 8px;
		overflow-x: auto;
		margin-inline: calc(var(--gutter) * -1);
		padding: 2px var(--gutter);
		scrollbar-width: none;
	}

	.tm-cats::-webkit-scrollbar {
		display: none;
	}

	.tm-cats__list {
		display: flex;
		gap: 8px;
	}

	.tm-cats__list a {
		min-height: 40px;
		padding: 0 16px;
		border-radius: var(--r-pill);
		white-space: nowrap;
	}

	.tm-shop__count {
		text-align: left;
	}
}

/* ------------------------------------------------------------- card grid */

.tm-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 640px) {
	.tm-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 16px;
	}
}

/* with the category sidebar showing (>= 901px) the grid is 2 wide, then 3 wide from 1100px */
@media (min-width: 901px) {
	.tm-shop__results .tm-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 20px;
	}
}

@media (min-width: 1100px) {
	.tm-shop__results .tm-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 340px) {
	.tm-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

.tm-card {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: clamp(12px, 1.4vw, 16px);
	border-radius: var(--r-md);
	background: #fff;
	list-style: none;
	transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}

.tm-card:hover {
	box-shadow: var(--shadow-md);
	transform: translateY(-2px);
}

.tm-card__media {
	display: grid;
	place-items: center;
	aspect-ratio: 1 / 0.82;
}

.tm-card__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	mix-blend-mode: multiply;
}

.tm-card__title {
	margin: 10px 0 16px;
	min-height: 2.7em;
	text-wrap: balance;
	font-size: var(--fs-sm);
	line-height: 1.35;
	font-weight: 600;
	text-align: center;
}

.tm-card__title a {
	color: var(--c-ink);
	text-decoration: none;
}

.tm-card__title a:hover {
	color: var(--c-link);
}

.tm-card {
	container: card / inline-size;
}

/* two buttons: stacked while the card is narrow, side by side once there is room */
.tm-card__actions {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 8px;
	margin-top: auto;
}

@container card (min-width: 248px) {
	.tm-card__actions {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.tm-card__actions .tm-btn {
	width: 100%;
	min-width: 0;
	padding-inline: 12px;
	text-align: center;
}

@media (max-width: 480px) {
	.tm-card {
		padding: 10px;
	}
}

/* compact horizontal card: very small phones, and the single-column similar-products list */
@media (max-width: 359px) {
	.tm-grid .tm-card,
	.tm-grid--similar .tm-card {
		display: grid;
		grid-template-columns: 84px minmax(0, 1fr);
		grid-template-areas: 'media title' 'media actions';
		align-items: center;
		gap: 4px 12px;
	}
}

@media (max-width: 639px) {
	.tm-grid--similar .tm-card {
		display: grid;
		grid-template-columns: 96px minmax(0, 1fr);
		grid-template-areas: 'media title' 'media actions';
		align-items: center;
		gap: 4px 14px;
	}
}

@media (max-width: 359px), (max-width: 639px) {
	.tm-grid--similar .tm-card .tm-card__media,
	.tm-grid .tm-card .tm-card__media {
		grid-area: media;
	}
}

@media (max-width: 359px) {
	.tm-grid .tm-card .tm-card__media {
		aspect-ratio: 1;
	}

	.tm-grid .tm-card .tm-card__title {
		grid-area: title;
		margin: 0;
		min-height: 0;
		text-align: left;
	}

	.tm-grid .tm-card .tm-card__actions {
		grid-area: actions;
		grid-template-columns: minmax(0, 1fr);
		margin-top: 8px;
	}
}

@media (max-width: 639px) {
	.tm-grid--similar .tm-card .tm-card__media {
		aspect-ratio: 1;
	}

	.tm-grid--similar .tm-card .tm-card__title {
		grid-area: title;
		margin: 0;
		min-height: 0;
		text-align: left;
	}

	.tm-grid--similar .tm-card .tm-card__actions {
		grid-area: actions;
		grid-template-columns: minmax(0, 1fr);
		margin-top: 8px;
	}
}

/* ------------------------------------------------------- pagination, empty */

.tm-pagination {
	margin-top: 32px;
}

.tm-pagination ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tm-pagination .page-numbers {
	display: grid;
	place-items: center;
	min-width: 44px;
	height: 44px;
	padding: 0 6px;
	box-sizing: border-box;
	border-radius: var(--r-pill);
	background: #fff;
	color: var(--c-navy);
	font-size: var(--fs-sm);
	font-weight: 700;
	text-decoration: none;
}

.tm-pagination a.page-numbers:hover {
	background: var(--c-line);
}

.tm-pagination .page-numbers.current {
	background: var(--c-navy);
	color: #fff;
}

.tm-pagination .page-numbers.dots {
	background: none;
}

.tm-empty {
	max-width: 520px;
	margin: 24px auto;
	padding: 32px;
	border-radius: var(--r-lg);
	background: #fff;
	text-align: center;
}

.tm-empty h2 {
	margin-bottom: 8px;
	font-size: var(--fs-h3);
	font-weight: 800;
}

.tm-empty p {
	margin-bottom: 20px;
	color: var(--c-muted);
}

/* -------------------------------------------------------- single product */

.tm-product__hero {
	background: linear-gradient(90deg, var(--c-grey) 50%, #fff 50%);
}

.tm-product__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(24px, 5vw, 80px);
}

.tm-gallery {
	padding-block: clamp(24px, 3.5vw, 48px);
}

.tm-gallery__stage {
	display: grid;
	place-items: center;
	aspect-ratio: 4 / 3.2;
	padding: clamp(16px, 3vw, 40px);
	border-radius: var(--r-lg);
	background: #fff;
}

.tm-gallery__stage > * {
	grid-area: 1 / 1;
}

.tm-gallery__img {
	display: none;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.tm-gallery__img.is-active,
.tm-gallery__stage > img:only-child {
	display: block;
}

.tm-gallery__dots {
	display: flex;
	justify-content: center;
	gap: 2px;
	margin-top: 12px;
}

.tm-gallery__dot {
	position: relative;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.tm-gallery__dot::before {
	content: '';
	position: absolute;
	inset: 11px;
	border-radius: 50%;
	background: #fff;
	box-shadow: inset 0 0 0 2px var(--c-link);
	transition: background-color 0.2s var(--ease);
}

.tm-gallery__dot.is-active::before {
	background: var(--c-link);
}

.tm-summary {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 14px;
	padding-block: clamp(24px, 3.5vw, 48px);
}

.tm-summary .tm-breadcrumb {
	margin-bottom: 0;
}

.tm-summary__title {
	color: var(--c-navy);
	font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
	line-height: 1.15;
	font-weight: 800;
	letter-spacing: -0.015em;
}

.tm-summary__block {
	margin-top: 4px;
}

.tm-summary__heading {
	margin-bottom: 4px;
	color: var(--c-navy);
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.tm-summary__list {
	display: grid;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
	max-width: 58ch;
	color: var(--c-ink);
	font-size: var(--fs-md);
	line-height: 1.55;
}

.tm-summary__list li {
	position: relative;
	padding-left: 16px;
}

.tm-summary__list li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0.62em;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--c-blue);
}

.tm-buy {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-top: 6px;
}

@media (max-width: 480px) {
	.tm-details .tm-tab {
		min-height: 44px;
		padding: 0 14px;
		font-size: var(--fs-xs);
	}
}

@media (max-width: 900px) {
	.tm-product__hero {
		background: #fff;
	}

	.tm-product__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
	}

	.tm-gallery {
		margin-inline: calc(var(--gutter) * -1);
		padding: 20px var(--gutter);
		background: var(--c-grey);
	}

	.tm-gallery__stage {
		aspect-ratio: 4 / 3;
	}

	.tm-summary {
		padding-block: 24px 32px;
	}
}

/* ------------------------------------------------- product information */

.tm-details {
	padding-block: clamp(28px, 4vw, 56px);
}

.tm-details .tm-tabs {
	margin-top: 0;
}

.tm-details .tm-tab--link {
	background: transparent;
	border-color: var(--c-line);
}

.tm-details .tm-tab--link:hover {
	background: var(--c-grey);
}

.tm-panel {
	margin-top: 28px;
}

.tm-panel[hidden] {
	display: none;
}

.tm-spec {
	display: grid;
	grid-template-columns: minmax(200px, 300px) minmax(0, 1fr);
	gap: clamp(24px, 4vw, 56px);
	align-items: start;
}

.tm-facts {
	display: grid;
	gap: 18px;
	margin: 0;
}

.tm-facts dt {
	margin-bottom: 2px;
	color: var(--c-muted);
	font-size: var(--fs-sm);
	font-weight: 600;
}

.tm-facts dd {
	margin: 0;
	color: var(--c-navy);
	font-size: var(--fs-lg);
	font-weight: 700;
}

.tm-panel__title {
	margin-bottom: 14px;
	color: var(--c-navy);
	font-size: var(--fs-h3);
	font-weight: 800;
}

.tm-illustration {
	max-width: 560px;
	margin: 0 0 28px;
}

.tm-illustration img {
	display: block;
	width: 100%;
	height: auto;
}

/* Ninja Tables output, restyled to the design */
.tm-table-wrap {
	min-width: 0;
	overflow-x: auto;
}

.tm-table-wrap table {
	width: 100%;
	margin: 0;
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid var(--c-line);
	border-radius: var(--r-sm);
	overflow: hidden;
	font-family: var(--font);
	font-size: var(--fs-sm);
	background: #fff;
}

.tm-table-wrap th {
	padding: 12px 16px !important;
	border: 0 !important;
	background: var(--c-action) !important;
	color: #fff !important;
	font-family: var(--font) !important;
	font-size: var(--fs-sm) !important;
	font-weight: 700 !important;
	text-align: left !important;
}

.tm-table-wrap td {
	padding: 11px 16px;
	border: 0;
	border-top: 1px solid var(--c-line);
	color: var(--c-ink);
	background: #fff;
}

.tm-table-wrap tbody tr:nth-child(even) td {
	background: #f6f8fb;
}

/* ------------------------------------------------------ similar products */

.tm-similar {
	padding-block: clamp(32px, 4.6vw, 56px);
	background: var(--c-mid);
}

.tm-similar__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 20px;
}

.tm-main .tm-similar__title {
	color: #fff;
	font-size: var(--fs-h3);
	line-height: 1.2;
	font-weight: 800;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

@media (min-width: 640px) {
	.tm-grid--similar {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1100px) {
	.tm-similar__layout {
		grid-template-columns: 180px minmax(0, 1fr);
		align-items: center;
		gap: 32px;
	}
}

@media (max-width: 639px) {
	.tm-grid--similar {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 900px) {
	.tm-spec {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* spec sheet tab: A4 preview + download button */
.tm-spec-sheet {
	display: grid;
	justify-items: start;
	gap: 18px;
}

.tm-spec-sheet__img {
	display: block;
	max-width: 420px;
	border: 1px solid var(--c-line);
	border-radius: var(--r-sm);
	overflow: hidden;
	background: #fff;
	box-shadow: var(--shadow-sm);
}

.tm-spec-sheet__img img {
	display: block;
	width: 100%;
	height: auto;
}

.tm-spec-sheet p {
	margin: 0;
}

/* dimensions tab: drawing + table */
.tm-panel img.aligncenter {
	display: block;
	margin: 0 auto 24px 0;
	max-width: min(500px, 100%);
	height: auto;
}

.tm-panel .tm-panel__title {
	margin-top: 8px;
}

/* TOMMY: archive heading block is centred, as in the mock-up */
.tm-pagehead .tm-container {
	text-align: center;
}

.tm-pagehead .tm-breadcrumb {
	justify-content: flex-start;
	text-align: left;
}

.tm-pagehead .tm-tabs {
	justify-content: center;
}

/* Sidebar category buttons: same design as the OYA site (client request): rounded 52px buttons, larger text,
   6px gap; the active one keeps its colour with yellow text and a yellow bar. Brand colours: TOMMY blue. */
.tm-cats__list {
	gap: 6px;
}

.tm-cats__list a {
	min-height: 52px;
	padding: 0 20px;
	border-radius: var(--r-sm);
	background: var(--c-mid);
	color: #fff;
	font-size: var(--fs-lg);
	font-weight: 600;
	box-shadow: inset 0 0 0 0 var(--c-yellow);
}

.tm-cats__list a:hover {
	background: var(--c-royal);
	color: #fff;
}

.tm-cats__list a.is-active {
	background: var(--c-mid);
	color: var(--c-yellow);
	box-shadow: inset 5px 0 0 0 var(--c-yellow);
}
