/**
 * ToyTool — header, navigation, footer, shop layout.
 * Mobile-first.
 */

/* ---------- Top utility bar ---------- */
.tt-topbar {
	background: var(--tt-background);
	border-bottom: 1px solid var(--tt-border);
	font-size: 0.75rem;
	display: none;
}
@media (min-width: 640px) {
	.tt-topbar { display: block; }
}
.tt-topbar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 36px;
}
.tt-topbar__links {
	list-style: none;
	display: flex;
	gap: 1.25rem;
	margin: 0;
	padding: 0;
}
.tt-topbar__links a {
	color: var(--tt-text);
}
.tt-topbar__links a:hover {
	color: var(--tt-primary);
}
.tt-topbar__social {
	list-style: none;
	display: flex;
	gap: 0.9rem;
	margin: 0;
	padding: 0;
}
.tt-topbar__social a {
	display: inline-flex;
	color: var(--tt-text);
}
.tt-topbar__social a:hover {
	color: var(--tt-primary);
}

/* ---------- Header ---------- */
.tt-header {
	background: linear-gradient(120deg, var(--tt-light-blue) 0%, var(--tt-light-purple) 100%);
	position: relative;
	z-index: 50;
}
.tt-header__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-block: 1rem;
}

.tt-logo {
	font-family: var(--tt-font-heading);
	font-weight: 800;
	font-size: 1.25rem;
	color: var(--tt-heading);
	flex-shrink: 0;
}
.tt-logo img { max-height: 40px; width: auto; }

.tt-header__actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }

.tt-icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--tt-touch-target);
	height: var(--tt-touch-target);
	border-radius: 50%;
	color: var(--tt-heading);
	background: transparent;
	border: 0;
	cursor: pointer;
	position: relative;
}
.tt-icon-button:hover { background: rgba(255,255,255,0.6); }
/* The account icon is the only .tt-icon-button that's also
   .tt-desktop-only (shown at desktop, hidden on mobile in favour of the
   off-canvas menu). base.css's .tt-desktop-only{display:block!important}
   at this same breakpoint was overriding .tt-icon-button's own
   display:inline-flex, so the button stopped being a flex container —
   its SVG then just sat at the inline top-left of a block box instead
   of centred, visibly off-centre only on this one icon. Restored with
   higher specificity (2 classes) so it wins over that !important rule
   regardless of source order. */
@media (min-width: 1024px) {
	.tt-icon-button.tt-desktop-only { display: inline-flex !important; }
}

.tt-cart-count {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 16px;
	height: 16px;
	padding: 0 3px;
	background: var(--tt-primary);
	color: #fff;
	border-radius: 999px;
	font-size: 0.625rem;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

/* Desktop nav (hidden until 1024px) */
.tt-primary-nav { display: none; }
.tt-header__search--desktop { display: none; }

@media (min-width: 1024px) {
	.tt-header__bar { padding-block: 1.25rem; }
	.tt-menu-toggle { display: none; }
	.tt-header__search--mobile { display: none; }

	/* flex:1 lets the nav absorb the header row's leftover width instead
	   of .tt-header__bar's justify-content:space-between spreading that
	   space out AFTER the nav too — that was the gap stranding the
	   search box away from the account/cart icons. With nav taking the
	   slack, the menu centers within it and search+icons sit right next
	   to each other, spaced only by the header row's own base gap. */
	.tt-primary-nav { display: block; min-width: 0; flex: 1; }
	.tt-primary-menu {
		list-style: none;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-wrap: wrap;
		gap: 1.25rem;
		margin: 0;
		padding: 0;
	}
	.tt-primary-menu > li { position: relative; }
	.tt-primary-menu > li > a {
		display: flex;
		align-items: center;
		gap: 0.3rem;
		color: var(--tt-heading);
		font-weight: 500;
		font-size: 0.9375rem;
		min-height: var(--tt-touch-target);
	}
	.tt-primary-menu > li > a:hover { color: var(--tt-primary); }
	.tt-primary-menu li.menu-item-has-children > a::after {
		content: "";
		width: 6px;
		height: 6px;
		border-right: 1.5px solid currentColor;
		border-bottom: 1.5px solid currentColor;
		transform: rotate(45deg);
		margin-top: -4px;
		flex-shrink: 0;
	}

	/* Dropdowns (Product Types / More) */
	.tt-primary-menu .sub-menu {
		list-style: none;
		margin: 0;
		padding: 0.5rem;
		position: absolute;
		top: 100%;
		left: 0;
		min-width: 220px;
		background: #fff;
		border: 1px solid var(--tt-border);
		border-radius: var(--tt-radius-md);
		box-shadow: 0 12px 24px rgba(15,23,42,0.1);
		opacity: 0;
		visibility: hidden;
		transform: translateY(6px);
		transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
		z-index: 60;
	}
	.tt-primary-menu li.menu-item-has-children:hover > .sub-menu,
	.tt-primary-menu li.menu-item-has-children:focus-within > .sub-menu,
	.tt-primary-menu li.menu-item-has-children.is-open > .sub-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}
	.tt-primary-menu .sub-menu a {
		display: block;
		padding: 0.6rem 0.75rem;
		border-radius: var(--tt-radius-sm);
		color: var(--tt-text);
		font-size: 0.9375rem;
	}
	.tt-primary-menu .sub-menu a:hover { background: var(--tt-light-background); color: var(--tt-primary); }

	.tt-header__search--desktop {
		display: flex;
		align-items: center;
		position: relative;
		width: 280px;
		min-width: 140px;
		flex-shrink: 1;
	}
	.tt-header__search--desktop input {
		background: #fff;
		border: 1px solid var(--tt-border);
		border-radius: var(--tt-radius-pill);
		padding-left: 1.1rem;
		padding-right: 2.75rem;
		min-height: 42px;
		width: 100%;
	}
	.tt-header__search--desktop input:focus {
		border-color: var(--tt-primary);
	}
	.tt-header__search--desktop button {
		position: absolute;
		right: 4px;
		top: 50%;
		transform: translateY(-50%);
		width: 34px;
		height: 34px;
		background: var(--tt-primary);
		color: var(--tt-primary-contrast);
	}
	.tt-header__search--desktop button:hover {
		background: var(--tt-primary-hover);
	}
}

/* Mobile dropdown toggle (chevron button, shown < 1024px inside the mobile menu panel) */
.tt-submenu-toggle {
	background: transparent;
	border: 0;
	padding: 0.5rem;
	color: var(--tt-muted);
	cursor: pointer;
	min-width: var(--tt-touch-target);
	min-height: var(--tt-touch-target);
}

/* Mobile menu panel */
.tt-mobile-menu {
	position: fixed;
	inset: 0;
	z-index: 100;
	visibility: hidden;
}
.tt-mobile-menu.is-open { visibility: visible; }
.tt-mobile-menu__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15,23,42,0.45);
	opacity: 0;
	transition: opacity 0.2s ease;
}
.tt-mobile-menu.is-open .tt-mobile-menu__overlay { opacity: 1; }
.tt-mobile-menu__panel {
	position: absolute;
	top: 0; left: 0; bottom: 0;
	width: min(85vw, 360px);
	background: #fff;
	overflow-y: auto;
	transform: translateX(-100%);
	transition: transform 0.25s ease;
	padding: 1rem;
}
.tt-mobile-menu.is-open .tt-mobile-menu__panel { transform: translateX(0); }
.tt-mobile-menu__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.tt-mobile-menu .tt-primary-menu { list-style: none; margin: 0; padding: 0; }
.tt-mobile-menu .tt-primary-menu li { border-bottom: 1px solid var(--tt-border); }
.tt-mobile-menu .tt-primary-menu > li > a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--tt-touch-target);
	padding-block: 0.4rem;
	color: var(--tt-heading);
	font-weight: 600;
}
.tt-mobile-menu .sub-menu { list-style: none; margin: 0 0 0.5rem; padding: 0 0 0 1rem; display: none; }
.tt-mobile-menu li.is-open > .sub-menu { display: block; }
.tt-mobile-menu .sub-menu a { display: block; min-height: 40px; display: flex; align-items: center; color: var(--tt-muted); }

@media (min-width: 1024px) {
	.tt-mobile-menu { display: none; }
}

/* ---------- Search suggestions ---------- */
.tt-search-suggestions {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--tt-border);
	border-radius: var(--tt-radius-md);
	box-shadow: 0 12px 24px rgba(15,23,42,0.1);
	max-height: 60vh;
	overflow-y: auto;
	z-index: 70;
	display: none;
}
.tt-search-suggestions.is-open { display: block; }
.tt-search-suggestions__list { list-style: none; margin: 0; padding: 0.5rem; }
.tt-search-suggestions__item a { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; border-radius: var(--tt-radius-sm); color: var(--tt-text); }
.tt-search-suggestions__item a:hover { background: var(--tt-light-background); }
.tt-search-suggestions__thumb { width: 44px; height: 44px; flex-shrink: 0; border-radius: var(--tt-radius-sm); overflow: hidden; background: var(--tt-light-background); }
.tt-search-suggestions__thumb img { width: 100%; height: 100%; object-fit: contain; }
.tt-search-suggestions__info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.tt-search-suggestions__title { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-search-suggestions__price { font-size: 0.8125rem; color: var(--tt-muted); }
.tt-search-suggestions__empty { padding: 1rem; color: var(--tt-muted); font-size: 0.875rem; margin: 0; }

/* ---------- Shop layout (filters + grid) ---------- */
.tt-shop-hero {
	background: linear-gradient(120deg, var(--tt-light-blue) 0%, var(--tt-light-purple) 100%);
	padding-block: 2.5rem;
	text-align: center;
}
.tt-shop-hero .tt-breadcrumbs { justify-content: center; display: flex; }
.tt-shop-hero__title { margin-bottom: 0.5rem; }
.tt-shop-hero__desc { max-width: 640px; margin-inline: auto; color: var(--tt-muted); }

.tt-shop-layout { display: flex; flex-direction: column; gap: 2rem; padding-block: 2.5rem; }
@media (min-width: 1024px) {
	.tt-shop-layout { flex-direction: row; align-items: flex-start; gap: 2.5rem; }
}
.tt-shop-main { min-width: 0; flex: 1; }

.tt-filters-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: var(--tt-touch-target);
	padding: 0 1rem;
	margin-bottom: 1rem;
	background: #fff;
	border: 1px solid var(--tt-border);
	border-radius: var(--tt-radius-pill);
	font-weight: 600;
	cursor: pointer;
}
@media (min-width: 1024px) { .tt-filters-toggle { display: none; } }

.tt-shop-filters { flex-shrink: 0; width: 100%; }
@media (max-width: 1023px) {
	.tt-shop-filters { display: none; }
	.tt-shop-filters.is-open { display: block; }
}
@media (min-width: 1024px) { .tt-shop-filters { width: 260px; } }

/* ---------- Footer ---------- */
.tt-footer { background: var(--tt-footer); color: var(--tt-footer-text); }
.tt-footer__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 1rem;
	padding-block: 2rem;
	border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tt-footer__top .tt-logo { color: #fff; }

.tt-footer__columns {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
	padding-block: 2.5rem;
}
@media (min-width: 640px) {
	.tt-footer__columns { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
	.tt-footer__columns { grid-template-columns: 1.4fr repeat(4, 1fr); }
}
.tt-footer__col-title { color: #fff; font-size: 1rem; margin-bottom: 1rem; }
.tt-footer__desc { color: var(--tt-footer-text); font-size: 0.9375rem; max-width: 32ch; }
.tt-footer__columns ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.tt-footer__columns a { color: var(--tt-footer-text); font-size: 0.9375rem; }
.tt-footer__columns a:hover { color: #fff; }

.tt-footer__bottom {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;
	padding-block: 1.5rem;
	border-top: 1px solid rgba(255,255,255,0.08);
	font-size: 0.8125rem;
	color: var(--tt-footer-text);
}
@media (min-width: 640px) { .tt-footer__bottom { flex-direction: row; } }
.tt-payment-icons { display: flex; gap: 0.5rem; align-items: center; }
.tt-payment-icons span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 22px;
	background: #fff;
	border-radius: 4px;
	color: var(--tt-heading);
	font-size: 0.5625rem;
	font-weight: 700;
	padding: 0 0.3rem;
}

/* ---------- Cart drawer ---------- */
body.tt-no-scroll { overflow: hidden; }

.tt-cart-drawer {
	position: fixed;
	inset: 0;
	z-index: 110;
	visibility: hidden;
}
.tt-cart-drawer.is-open { visibility: visible; }
.tt-cart-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	opacity: 0;
	transition: opacity 0.25s ease;
}
.tt-cart-drawer.is-open .tt-cart-drawer__overlay { opacity: 1; }
.tt-cart-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(420px, 100vw);
	background: #fff;
	box-shadow: -8px 0 24px rgba(15, 23, 42, 0.12);
	transform: translateX(100%);
	transition: transform 0.3s ease;
}
.tt-cart-drawer.is-open .tt-cart-drawer__panel { transform: translateX(0); }

.tt-cart-drawer__content { display: flex; flex-direction: column; height: 100%; }

.tt-cart-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid var(--tt-border);
	flex-shrink: 0;
}
.tt-cart-drawer__header h2 { margin: 0; font-size: 1.125rem; }
.tt-cart-drawer__header h2 span { color: var(--tt-muted); font-weight: 500; font-size: 0.9375rem; }

.tt-cart-drawer__items {
	flex: 1;
	overflow-y: auto;
	padding: 1.25rem 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}
.tt-cart-drawer__item { display: flex; gap: 0.9rem; }
.tt-cart-drawer__item-media {
	width: 72px;
	height: 72px;
	flex-shrink: 0;
	background: var(--tt-light-background);
	border-radius: var(--tt-radius-md);
	overflow: hidden;
}
.tt-cart-drawer__item-media img { width: 100%; height: 100%; object-fit: contain; padding: 0.4rem; }
.tt-cart-drawer__item-body { flex: 1; min-width: 0; }
.tt-cart-drawer__item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.tt-cart-drawer__item-title { color: var(--tt-heading); font-weight: 600; font-size: 0.9375rem; }
.tt-cart-drawer__item-total { color: var(--tt-heading); font-weight: 700; font-size: 0.9375rem; white-space: nowrap; }
.tt-cart-drawer__item-price { display: block; color: var(--tt-muted); font-size: 0.875rem; margin-top: 0.15rem; }
.tt-cart-drawer__item-desc {
	color: var(--tt-muted);
	font-size: 0.8125rem;
	margin: 0.4rem 0 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.tt-cart-drawer__item-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 0.75rem; }
.tt-cart-drawer__item-controls .quantity { transform: scale(0.85); transform-origin: left center; }
.tt-cart-drawer__item-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--tt-light-background);
	border: 0;
	color: var(--tt-sale);
	cursor: pointer;
	transition: background-color 0.15s ease;
}
.tt-cart-drawer__item-remove:hover { background: #FEF2F2; }

.tt-cart-drawer__empty { padding: 3rem 1.5rem; }

/* Empty-cart state (icon + heading) — shared by the cart page itself
   (inc/woocommerce.php's toytool_empty_cart_message(), which replaces
   WooCommerce core's plain text-only notice) and the cart drawer,
   which appears sitewide, including pages where woocommerce.css never
   loads — kept here in layout.css (loaded on every page) instead. */
.tt-cart-empty { text-align: center; padding: 3rem 1.5rem; }
.tt-cart-empty__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: var(--tt-primary);
	color: #fff;
	margin-bottom: 1.25rem;
}
.tt-cart-empty__text { font-weight: 700; font-size: 1.0625rem; color: var(--tt-heading); margin: 0 0 1.5rem; }

.tt-cart-drawer__footer { flex-shrink: 0; padding: 1.25rem 1.5rem; border-top: 1px solid var(--tt-border); }
.tt-cart-drawer__subtotal { display: flex; align-items: center; justify-content: space-between; font-size: 1rem; color: var(--tt-heading); margin-bottom: 0.5rem; }
.tt-cart-drawer__subtotal strong { font-size: 1.125rem; }
.tt-cart-drawer__note { color: var(--tt-muted); font-size: 0.8125rem; margin: 0 0 1.25rem; }
.tt-cart-drawer__actions { display: flex; gap: 0.75rem; }
.tt-cart-drawer__actions .tt-button { flex: 1; }
