/*
 * Header (white, with the black-lettered logo), search row (white), collections picture
 * panel (evergreen) and footer (night).
 * Phone first; the split navigation either side of the logo starts at 64em (1024px).
 */

/* ---------- Header frame ---------- */

.tm-header {
	position: relative;
	z-index: 50;
	background-color: var(--tm-white);
	color: var(--tm-ink);
	border-bottom: 1px solid var(--tm-gold);
}

/*
 * Focus in the white bar and search row: the ink ring used on every white surface
 * (ink against white 16.81:1). Gold would be under 3:1 on white (2.92:1).
 * The collections panel below the bar stays dark and keeps the gold ring.
 */
.tm-bar,
.tm-search {
	--tm-focus-ring: var(--tm-ink);
}

.tm-header .wp-block-template-part {
	margin: 0;
}

.tm-bar {
	box-sizing: border-box;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	max-width: 90rem;
	min-height: 4.5rem;
	margin-inline: auto;
	padding: 0.5rem var(--tm-gutter);
}

.tm-bar > * {
	grid-row: 1;
}

/* ---------- Controls ---------- */

.tm-icon-button,
.tm-control {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	border: 0;
	background-color: transparent;
	/* Ink in the white bar, white on the evergreen collections panel. */
	color: inherit;
	font: inherit;
	text-decoration: none;
	cursor: pointer;
}

.tm-icon-button .tm-icon,
.tm-control .tm-icon {
	flex: none;
	width: 24px;
	height: 24px;
}

/*
 * Icons stay ink on white in every state. Hover and "open" are marked by a gold
 * hairline under the icon, which is decoration only (the state is in aria-expanded).
 */
.tm-icon-button::after,
.tm-control::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 4px;
	width: 22px;
	margin-left: -11px;
	border-top: 1px solid var(--tm-gold);
	transform: scaleX(0);
	transition: transform 200ms ease;
}

.tm-control::after {
	left: 0.5rem;
	right: 0.5rem;
	width: auto;
	margin-left: 0;
}

.tm-icon-button[aria-expanded="true"]::after,
.tm-control[aria-expanded="true"]::after {
	transform: scaleX(1);
}

/* Only on devices that really hover, so a tap never leaves a hover mark behind. */
@media (hover: hover) {
	.tm-icon-button:hover::after,
	.tm-control:hover::after {
		transform: scaleX(1);
	}
}

/* Menu / Close (phone only). */
.tm-bar__menu {
	grid-column: 1;
	justify-self: start;
	z-index: 1;
	padding-inline: 0.5rem 0.75rem;
	margin-inline-start: -0.5rem;
	font-family: var(--tm-font-display);
	font-size: 1.0625rem;
	letter-spacing: 0.08em;
}

.tm-bar__menu .tm-icon--close,
.tm-bar__menu[aria-expanded="true"] .tm-icon--menu {
	display: none;
}

.tm-bar__menu[aria-expanded="true"] .tm-icon--close {
	display: block;
}

.tm-bar__search {
	grid-column: 3;
	justify-self: end;
	z-index: 1;
	/* Sits to the left of the account and bag icons on phones. */
	margin-inline-end: calc(44px * 2);
}

.tm-bar__icons {
	grid-column: 3;
	justify-self: end;
	z-index: 1;
	display: flex;
	align-items: center;
	margin-inline-end: -0.5rem;
}

/* The bag count: real data, set quietly beside the bag rather than in a pill. */
.tm-bag__count {
	position: absolute;
	top: 4px;
	right: 0;
	min-width: 1ch;
	font-family: var(--tm-font-body);
	font-size: 0.9375rem;
	font-weight: 700;
	line-height: 1;
	color: var(--tm-ink);
}

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

/* ---------- Main navigation and logo ---------- */

.tm-nav {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
}

.tm-nav__list {
	display: none;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tm-logo {
	grid-column: 2;
	display: block;
	line-height: 0;
	padding: 0.25rem;
}

.tm-logo__img {
	display: block;
	width: auto;
	height: 56px;
}

.tm-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	min-height: 48px;
	padding: 0 0.25rem;
	border: 0;
	background-color: transparent;
	color: var(--tm-ink);
	font-family: var(--tm-font-display);
	font-size: 1.125rem;
	font-weight: 400;
	letter-spacing: 0.1em;
	text-decoration: none;
	cursor: pointer;
	position: relative;
}

/* A gold hairline that draws in under the link; it marks the open panel too. */
.tm-nav__link::after {
	content: "";
	position: absolute;
	left: 0.25rem;
	right: 0.25rem;
	bottom: 0.55rem;
	border-top: 1px solid var(--tm-gold);
	transform: scaleX(0);
	transition: transform 200ms ease;
}

.tm-nav__link[aria-expanded="true"]::after,
.tm-nav__link[aria-current="page"]::after {
	transform: scaleX(1);
}

@media (hover: hover) {
	.tm-nav__link:hover::after {
		transform: scaleX(1);
	}
}

.tm-nav__toggle .tm-icon {
	width: 18px;
	height: 18px;
	transition: transform 200ms ease;
}

.tm-nav__toggle[aria-expanded="true"] .tm-icon {
	transform: rotate(180deg);
}

@media (min-width: 64em) {
	.tm-bar {
		min-height: 7rem;
		padding-block: 0.75rem;
	}

	.tm-bar__menu {
		display: none;
	}

	.tm-bar__search {
		grid-column: 1;
		justify-self: start;
		margin-inline: -0.5rem 0;
	}

	.tm-icon-button {
		min-width: 48px;
		min-height: 48px;
	}

	.tm-bag__count {
		top: 6px;
		right: 2px;
	}

	.tm-nav__list {
		display: flex;
		align-items: center;
		gap: clamp(1.5rem, 2.6vw, 2.75rem);
	}

	.tm-nav__list--start {
		grid-column: 1;
		justify-self: end;
		padding-inline-end: clamp(2rem, 3.5vw, 3.5rem);
	}

	.tm-nav__list--end {
		grid-column: 3;
		justify-self: start;
		padding-inline-start: clamp(2rem, 3.5vw, 3.5rem);
	}

	.tm-logo__img {
		height: 88px;
	}
}

/* ---------- Search row ---------- */

/* White like the bar, set off from it by a gold rule; the field keeps its moss border. */
.tm-search {
	border-top: 1px solid var(--tm-gold);
	background-color: var(--tm-white);
	padding: 1.5rem var(--tm-gutter) 1.75rem;
}

.tm-search__form {
	max-width: 40rem;
	margin-inline: auto;
}

.tm-search__label {
	display: block;
	margin-block-end: 0.6rem;
	font-family: var(--tm-font-display);
	font-size: 1.125rem;
	letter-spacing: 0.08em;
}

.tm-search__row {
	display: flex;
	gap: 0.75rem;
}

.tm-search__field {
	flex: 1 1 auto;
	min-width: 0;
}

/* ---------- Collections picture panel ---------- */

/* While the panel is open the page behind it stays still. */
html.tm-scroll-locked {
	overflow: hidden;
	padding-right: var(--tm-scrollbar, 0);
}

.tm-collections {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	/* Starts below the gold rule, so the rule stays as the lid line between bar and panel. */
	margin-top: 1px;
	/* --tm-panel-top is the visible header height, set by collections-menu.js on open. */
	max-height: calc(100vh - var(--tm-panel-top, 4.5rem) - 1px);
	max-height: calc(100dvh - var(--tm-panel-top, 4.5rem) - 1px);
	overflow-y: auto;
	overscroll-behavior: contain;
	background-color: var(--tm-evergreen);
	color: var(--tm-white);
	box-shadow: var(--tm-shadow);
	border-bottom: 1px solid var(--tm-gold);
}

.tm-collections:not([hidden]) {
	animation: tm-panel-in 220ms ease-out;
}

@keyframes tm-panel-in {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
}

.tm-collections__inner {
	position: relative;
	box-sizing: border-box;
	max-width: 76rem;
	margin-inline: auto;
	padding: 1.25rem var(--tm-gutter) 2.5rem;
}

.tm-collections__close {
	display: none;
	font-family: var(--tm-font-display);
	font-size: 1.0625rem;
	letter-spacing: 0.08em;
	padding-inline: 0.75rem 0.5rem;
}

.tm-collections__pages ul {
	margin: 0 0 2rem;
	padding: 0;
	list-style: none;
}

.tm-collections__pages a {
	display: flex;
	align-items: center;
	min-height: 56px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.14);
	color: var(--tm-white);
	font-family: var(--tm-font-display);
	font-size: 1.375rem;
	letter-spacing: 0.08em;
	text-decoration: none;
}

.tm-collections__pages a:hover {
	text-decoration: underline;
	text-decoration-color: var(--tm-gold);
}

.tm-collections__title {
	margin: 0 0 1.25rem;
	font-size: 1.375rem;
	letter-spacing: 0.08em;
}

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

.tm-collections__item a {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	color: var(--tm-white);
	text-decoration: none;
}

.tm-collections__img,
.tm-collections__placeholder {
	--tm-cartouche-r: 12px;
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	background-color: var(--tm-moss);
}

/* The Christmas photographs are still to come: a moss frame with the gold inner rule. */
.tm-collections__placeholder {
	color: var(--tm-gold);
}

.tm-collections__placeholder svg {
	display: block;
	width: 100%;
	height: 100%;
}

.tm-collections__name {
	font-family: var(--tm-font-display);
	font-size: 1.1875rem;
	line-height: 1.3;
	letter-spacing: 0.06em;
	text-align: center;
	text-wrap: balance;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.3em;
	transition: text-decoration-color 160ms ease;
}

@media (hover: hover) {
	.tm-collections__item a:hover .tm-collections__name {
		text-decoration-color: var(--tm-gold);
	}
}

.tm-collections__item a:focus-visible {
	outline-offset: 6px;
}

@media (min-width: 40em) {
	.tm-collections__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 2rem 1.5rem;
	}
}

@media (min-width: 64em) {
	.tm-collections__inner {
		padding-block: 1rem 3rem;
	}

	.tm-collections__close {
		display: flex;
		margin-inline-start: auto;
		margin-block-end: 0.75rem;
	}

	.tm-collections__pages {
		display: none;
	}

	/* Still names the panel for screen readers (aria-labelledby). */
	.tm-collections__title {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.tm-collections__grid {
		grid-template-columns: repeat(5, minmax(0, 1fr));
		gap: 2.25rem 1.75rem;
	}
}

/* ---------- Footer ---------- */

/* The same gold trellis as the home page's Christmas section (.pattern-bg, base.css). */
.tm-site-footer {
	position: relative;
	isolation: isolate;
	background-color: var(--tm-night);
	color: var(--tm-white);
	border-top: 1px solid var(--tm-gold);
}

.tm-footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2.25rem;
	max-width: 76rem;
	margin-inline: auto;
	padding: clamp(3.5rem, 8vw, 5.5rem) var(--tm-gutter) 2.5rem;
	text-align: center;
}

.tm-footer__logo {
	display: block;
	line-height: 0;
}

.tm-footer__logo .tm-logo__img {
	width: clamp(240px, 24vw, 320px);
	height: auto;
}

.tm-footer__nav ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0 clamp(1.5rem, 3vw, 2rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.tm-footer__nav a,
.tm-footer__nav .tm-footer__cookie-settings {
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	color: var(--tm-white);
	text-decoration: none;
}

/* The Cookie settings button looks like the links beside it. */
.tm-footer__nav .tm-footer__cookie-settings {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	cursor: pointer;
}

.tm-footer__nav a:hover,
.tm-footer__nav .tm-footer__cookie-settings:hover {
	text-decoration: underline;
	text-decoration-color: var(--tm-gold);
}

.tm-footer__social {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin-block: -0.75rem;
	color: var(--tm-gold);
	border-radius: 50%;
}

.tm-footer__social:hover {
	color: var(--tm-white);
}

/* The ways to pay: outline badges in the footer's white, only those the shop offers. */
.tm-payments {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--tm-white);
}

.tm-payments__item {
	margin: 0;
	line-height: 0;
}

.tm-payments__badge {
	display: block;
	width: 48px;
	height: 30px;
	opacity: 0.85;
}

.tm-footer__legal {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	padding-top: 1.75rem;
	border-top: 1px solid rgba(255, 255, 255, 0.14);
	color: var(--tm-white);
}

.tm-footer__legal p {
	margin: 0;
}

.tm-footer__company {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0 0.35em;
	max-width: 60rem;
	font-size: 0.875rem;
	line-height: 1.6;
	color: var(--tm-white);
}

.tm-footer__nb {
	white-space: nowrap;
}

.tm-footer__company strong {
	font-weight: 600;
	color: var(--tm-white);
}

/* CookieAdmin's banner and preferences window in the shop's palette and type. Its free version
   sets the button colours itself (wp tm setup-site) but not these. */
body .cookieadmin_law_container,
body .cookieadmin_cookie_modal {
	font-family: var(--tm-font-body);
}

body .cookieadmin_header .cookieadmin_act,
body .cookieadmin_close_pref {
	color: var(--tm-ink);
}

body .cookieadmin_slider {
	background-color: var(--tm-moss);
}

body input:checked + .cookieadmin_slider {
	background-color: var(--tm-evergreen);
}

body .cookieadmin_toggle input:focus-visible + .cookieadmin_slider {
	outline: 3px solid var(--tm-ink);
	outline-offset: 2px;
}

/* The site sets no functional cookies, so that category is left out. */
body .cookieadmin_types[aria-labelledby="cookieadmin-functional-heading"] {
	display: none;
}
