/* ==========================================================================
 * Teknodayim - compact sticky header
 *
 * Same visual values as the production header (Envo topnav v3): white,
 * blurred, sticky, 60px logo, pill navigation, orange "Hızlı Sipariş Ver",
 * 40px action buttons with an orange cart badge.
 *
 * Fixed compared with production:
 * - the WordPress admin bar is no longer hidden/overlapped: the header sits
 *   below it (32px desktop, 46px <=782px, scrolls away <=600px);
 * - the desktop grid no longer forces a 520px nav column (that caused a
 *   horizontal scrollbar between 821px and ~900px);
 * - nav labels can shrink with an ellipsis instead of overflowing on
 *   320-390px screens.
 * ========================================================================== */

.td-soft-header {
	position: sticky;
	top: 0;
	z-index: 9999;
	width: 100%;
	background: rgba(255, 255, 255, .97);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--td-line);
	box-shadow: 0 6px 18px rgba(15, 23, 42, .04);
}

/* WordPress admin bar offsets (matches core admin-bar breakpoints). */
.admin-bar {
	--td-adminbar-h: 32px;
}

.admin-bar .td-soft-header {
	top: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar {
		--td-adminbar-h: 46px;
	}

	.admin-bar .td-soft-header {
		top: 46px;
	}
}

@media screen and (max-width: 600px) {
	/* Core makes #wpadminbar position:absolute here, it scrolls away. */
	.admin-bar {
		--td-adminbar-h: 0px;
	}

	.admin-bar .td-soft-header {
		top: 0;
	}
}

.td-soft-header *,
.td-soft-header *::before,
.td-soft-header *::after {
	box-sizing: border-box;
}

/* --------------------------------------------------------------------------
 * Layout
 * Mobile-first: row 1 = brand + actions, row 2 = nav pills.
 * ----------------------------------------------------------------------- */
.td-soft-header-shell {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas:
		"brand actions"
		"nav nav";
	align-items: center;
	column-gap: 8px;
	row-gap: 6px;
	width: 100%;
	margin: 0 auto;
	padding: 8px 12px;
}

.td-soft-brand {
	grid-area: brand;
	display: flex;
	align-items: center;
	min-width: 0;
	min-height: 50px;
}

.td-soft-sticky-nav {
	grid-area: nav;
}

.td-soft-actions {
	grid-area: actions;
}

/* --------------------------------------------------------------------------
 * Brand
 * ----------------------------------------------------------------------- */
.td-soft-brand a {
	display: inline-flex;
	align-items: center;
	line-height: 1;
	text-decoration: none;
}

.td-soft-brand img {
	display: block;
	width: auto;
	height: 50px;
	max-width: 150px;
	object-fit: contain;
}

/* --------------------------------------------------------------------------
 * Actions (account / cart / checkout)
 * ----------------------------------------------------------------------- */
.td-soft-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 7px;
	white-space: nowrap;
}

.td-soft-action {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 1px solid var(--td-line);
	border-radius: 12px;
	background: #fff;
	color: var(--td-dark);
	line-height: 1;
	text-decoration: none;
	transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.td-soft-action:hover,
.td-soft-action:focus {
	border-color: rgba(232, 80, 2, .22);
	background: var(--td-orange-soft);
	color: var(--td-orange);
	text-decoration: none;
	transform: translateY(-1px);
}

.td-soft-action.is-primary {
	border-color: var(--td-orange);
	background: var(--td-orange);
	color: #fff;
}

.td-soft-action.is-primary:hover,
.td-soft-action.is-primary:focus {
	border-color: var(--td-orange-dark);
	background: var(--td-orange-dark);
	color: #fff;
}

.td-soft-icon {
	display: block;
	width: 17px;
	height: 17px;
}

.td-soft-icon svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.td-soft-badge {
	position: absolute;
	top: -6px;
	right: -5px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border: 2px solid #fff;
	border-radius: 999px;
	background: var(--td-orange);
	color: #fff;
	font-size: 10px;
	font-weight: 900;
	line-height: 1;
}

.td-soft-badge[data-empty="1"] {
	display: none;
}

/* --------------------------------------------------------------------------
 * Navigation pills
 * ----------------------------------------------------------------------- */
.td-soft-sticky-nav {
	display: grid;
	grid-template-columns: 1fr 1fr 1.05fr 1.4fr;
	gap: 5px;
	align-items: center;
	width: 100%;
	min-width: 0;
}

.td-soft-sticky-nav a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-width: 0;
	min-height: 34px;
	padding: 0 6px;
	border: 1px solid var(--td-line);
	border-radius: 14px;
	background: #fff;
	color: var(--td-dark);
	font-size: 11px;
	font-weight: 900;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.td-soft-sticky-nav a:hover,
.td-soft-sticky-nav a:focus {
	border-color: rgba(232, 80, 2, .22);
	background: var(--td-orange-soft);
	color: var(--td-orange);
	text-decoration: none;
	transform: translateY(-1px);
}

.td-soft-sticky-nav a[aria-current="page"] {
	border-color: rgba(232, 80, 2, .28);
}

.td-soft-sticky-nav a.is-fast {
	border-color: var(--td-orange);
	background: var(--td-orange);
	color: #fff;
}

.td-soft-sticky-nav a.is-fast:hover,
.td-soft-sticky-nav a.is-fast:focus {
	border-color: var(--td-orange-dark);
	background: var(--td-orange-dark);
	color: #fff;
}

.td-soft-nav-icon {
	flex: 0 0 auto;
	font-size: 13px;
	line-height: 1;
}

.td-soft-nav-label {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
 * Desktop (>= 821px): single row, nav centred between logo and actions.
 * Side columns never shrink below their content; only the nav column
 * shrinks, so nothing can push the page wider than the viewport.
 * ----------------------------------------------------------------------- */
@media (min-width: 821px) {
	.td-soft-header-shell {
		grid-template-columns: minmax(max-content, 1fr) minmax(0, 720px) minmax(max-content, 1fr);
		grid-template-areas: "brand nav actions";
		column-gap: 18px;
		padding: 6px 14px;
	}

	.td-soft-brand {
		min-height: 60px;
	}

	.td-soft-brand img {
		height: 60px;
		max-width: 200px;
	}

	.td-soft-actions {
		gap: 8px;
	}

	.td-soft-action {
		width: 40px;
		height: 40px;
		border-radius: 13px;
	}

	.td-soft-icon {
		width: 18px;
		height: 18px;
	}

	.td-soft-sticky-nav {
		gap: 6px;
	}

	.td-soft-sticky-nav a {
		gap: 5px;
		min-height: 32px;
		padding: 0 8px;
		border-radius: 999px;
	}
}

/* --------------------------------------------------------------------------
 * Small phones
 * ----------------------------------------------------------------------- */
@media (max-width: 480px) {
	.td-soft-header-shell {
		column-gap: 6px;
		row-gap: 5px;
		padding: 6px 10px;
	}

	.td-soft-brand {
		min-height: 46px;
	}

	.td-soft-brand img {
		height: 46px;
		max-width: 135px;
	}

	.td-soft-actions {
		gap: 6px;
	}

	.td-soft-action {
		width: 36px;
		height: 36px;
		border-radius: 11px;
	}

	.td-soft-icon {
		width: 16px;
		height: 16px;
	}

	.td-soft-sticky-nav {
		gap: 4px;
	}

	.td-soft-sticky-nav a {
		gap: 3px;
		min-height: 36px;
		padding: 0 5px;
		font-size: 10.5px;
	}

	.td-soft-nav-icon {
		font-size: 12px;
	}

	.td-soft-badge {
		min-width: 17px;
		height: 17px;
		font-size: 9.5px;
	}
}

@media (max-width: 380px) {
	.td-soft-header-shell {
		padding: 5px 8px;
	}

	.td-soft-brand img {
		height: 42px;
		max-width: 118px;
	}

	.td-soft-actions {
		gap: 5px;
	}

	.td-soft-action {
		width: 36px;
		height: 36px;
	}

	.td-soft-sticky-nav a {
		padding: 0 4px;
		font-size: 10px;
	}
}

/* Below ~420px the icons push "Kategoriler" / "Hızlı Sipariş Ver" into an
 * ellipsis; the labels are more useful than the glyphs. */
@media (max-width: 420px) {
	.td-soft-nav-icon {
		display: none;
	}
}

@media (max-width: 340px) {
	.td-soft-brand img {
		height: 38px;
		max-width: 108px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.td-soft-action,
	.td-soft-sticky-nav a {
		transition: none;
	}

	.td-soft-action:hover,
	.td-soft-action:focus,
	.td-soft-sticky-nav a:hover,
	.td-soft-sticky-nav a:focus {
		transform: none;
	}
}
