/*
 * Sangeet Jagat — App shell (M2 Step 2)
 * Mobile-first. Desktop layout from 1024px. Values follow the approved M2 screens
 * and use only Step 1 tokens.
 */

/* ---------- Header: mobile top bar (default) ---------- */
.sj-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background-color: var(--sj-surface);
	border-bottom: 1px solid var(--sj-border);
}

/* Keep the sticky bar below the WordPress admin bar for logged-in users */
.admin-bar .sj-header { top: 32px; }
@media (max-width: 782px) {
	.admin-bar .sj-header { top: 46px; }
}
@media (max-width: 600px) {
	.admin-bar .sj-header { top: 0; } /* admin bar scrolls away at this width */
}

.sj-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--wp--custom--chrome--header-mobile); /* 56px */
	padding: 0 4px 0 16px;
	box-sizing: border-box;
}

.sj-brand {
	display: flex;
	flex-direction: column;
	line-height: 1.1;
	text-decoration: none;
}
.sj-brand:hover { text-decoration: none; }

.sj-brand__name {
	font-family: var(--sj-font-ui);
	font-size: 19px;
	font-weight: 700;
	color: var(--sj-primary);
}

.sj-brand__sub {
	font-family: var(--sj-font-content-heading);
	font-size: 12px;
	font-weight: 400;
	color: var(--sj-text-2);
}

.sj-header__actions {
	display: flex;
	align-items: center;
}

.sj-iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 24px;
	color: var(--sj-text);
	text-decoration: none;
}
.sj-iconbtn:hover {
	color: var(--sj-text);
	background-color: var(--wp--preset--color--tint-primary);
}

/* Desktop-only parts are hidden on mobile */
.sj-desknav,
.sj-header__donate,
.sj-header__account {
	display: none;
}

/* ---------- Bottom navigation (mobile and tablet) ---------- */
.sj-bottomnav {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100;
	background-color: var(--sj-surface);
	border-top: 1px solid var(--sj-border);
	padding: 4px 8px calc(8px + env(safe-area-inset-bottom, 0px));
}

.sj-bottomnav__list {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	height: 60px; /* 72px bar = 4px + 60px + 8px */
	margin: 0;
	padding: 0;
	list-style: none;
}

.sj-bottomnav__list li {
	margin: 0;
}

.sj-bottomnav__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	height: 100%;
	border-radius: var(--sj-radius-sm);
	color: var(--sj-text-2);
	font-family: var(--sj-font-ui);
	font-size: 12px;
	font-weight: 400;
	line-height: 1.2;
	text-decoration: none;
}
.sj-bottomnav__link:hover {
	color: var(--sj-primary);
}

.sj-bottomnav__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 30px;
	border-radius: 15px;
}

.sj-bottomnav__link.is-active {
	color: var(--sj-primary);
	font-weight: 600;
}
.sj-bottomnav__link.is-active .sj-bottomnav__icon {
	background-color: var(--wp--preset--color--tint-primary);
}

/* Focus ring drawn inside the tab so it is never cut off by the screen edge */
.sj-bottomnav__link:focus-visible {
	outline-offset: -2px;
}

/* Page content never hides behind the bar */
@media (max-width: 1023px) {
	body {
		padding-bottom: calc(var(--wp--custom--chrome--bottom-nav) + env(safe-area-inset-bottom, 0px));
	}
}

/* ---------- Desktop header (1024px and wider) ---------- */
@media (min-width: 1024px) {
	.sj-header__inner {
		justify-content: flex-start;
		gap: 36px;
		height: var(--wp--custom--chrome--header-desktop); /* 72px */
		max-width: calc(var(--wp--style--global--wide-size, 1152px) + 128px);
		margin: 0 auto;
		padding: 0 64px;
	}

	.sj-brand__name { font-size: 22px; }
	.sj-brand__sub { font-size: 13px; }

	.sj-desknav {
		display: block;
		flex-grow: 1;
	}

	.sj-desknav__list {
		display: flex;
		align-items: center;
		gap: 2px;
		margin: 0;
		padding: 0;
		list-style: none;
	}
	.sj-desknav__list > li {
		margin: 0;
	}

	.sj-desknav__link {
		display: flex;
		align-items: center;
		gap: 4px;
		min-height: 44px;
		padding: 0 14px;
		border-radius: var(--sj-radius-sm);
		color: var(--sj-text);
		font-family: var(--sj-font-ui);
		font-size: 15px;
		font-weight: 400;
		text-decoration: none;
		cursor: pointer;
	}
	.sj-desknav__link:hover {
		color: var(--sj-primary);
	}
	/* Active: maroon + semibold (M2) with the M0 gold underline as an extra cue */
	.sj-desknav__link.is-active {
		color: var(--sj-primary);
		font-weight: 600;
		text-decoration: underline;
		text-decoration-color: var(--sj-accent);
		text-decoration-thickness: 2px;
		text-underline-offset: 8px;
	}

	.sj-header__actions {
		gap: 36px;
	}
	.sj-iconbtn {
		width: 44px;
		height: 44px;
		border-radius: 22px;
	}

	.sj-header__donate,
	.sj-header__account {
		display: inline-flex;
	}

	/* Donate: teal outline (approved desktop header) */
	.sj-header__donate.sj-btn--secondary {
		border-color: var(--sj-secondary);
		color: var(--sj-secondary);
		font-size: 14px;
	}
	.sj-header__donate.sj-btn--secondary:hover {
		background-color: var(--wp--preset--color--tint-secondary);
		border-color: var(--sj-secondary);
		color: var(--sj-secondary);
	}
	.sj-header__account.sj-btn {
		font-size: 14px;
	}

	/* Logged-in account circle */
	.sj-avatar {
		align-items: center;
		justify-content: center;
		width: 40px;
		height: 40px;
		border-radius: 50%;
		background-color: var(--wp--preset--color--tint-accent);
		color: var(--sj-accent-safe);
		font-weight: 600;
		text-decoration: none;
	}

	.sj-bottomnav {
		display: none;
	}
}

/* ---------- "More" dropdown ---------- */
.sj-more {
	position: relative;
}

.sj-more__toggle {
	list-style: none;
}
.sj-more__toggle::-webkit-details-marker {
	display: none;
}
.sj-more__toggle::marker {
	content: "";
}

.sj-more__details[open] .sj-more__toggle .sj-icon {
	transform: rotate(180deg);
}

.sj-more__menu {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 110;
	min-width: 220px;
	margin: 0;
	padding: 8px 0;
	list-style: none;
	background-color: var(--sj-surface);
	border: 1px solid var(--sj-border);
	border-radius: var(--sj-radius-card);
	box-shadow: var(--wp--preset--shadow--hover);
}
.sj-more__menu li {
	margin: 0;
}
.sj-more__menu a {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	color: var(--sj-text);
	font-size: 15px;
	text-decoration: none;
}
.sj-more__menu a:hover {
	background-color: var(--sj-bg);
	color: var(--sj-primary);
}
.sj-more__menu a[aria-current="page"] {
	color: var(--sj-primary);
	font-weight: 600;
}
.sj-more__menu a:focus-visible {
	outline-offset: -2px;
}

/* ---------- Print ---------- */
@media print {
	.sj-bottomnav,
	.sj-header__actions,
	.sj-desknav {
		display: none !important;
	}
	.sj-header {
		position: static;
	}
}

/* ---------- 0.15.1: header icon buttons as <button> (dark-mode switch, install) ----------
   GeneratePress styles every <button> (grey background, 10px 20px padding) — that squeezed the icon to a dot. */
button.sj-iconbtn {
	position: relative;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	color: var(--sj-text);
	font: inherit;
	line-height: 1;
	box-shadow: none;
	cursor: pointer;
}
button.sj-iconbtn:hover,
button.sj-iconbtn:focus {
	background-color: var(--wp--preset--color--tint-primary);
	color: var(--sj-text);
}
button.sj-iconbtn svg { width: 24px; height: 24px; flex: 0 0 24px; display: block; }
button.sj-iconbtn[hidden] { display: none; }
.sj-themebtn { color: var(--sj-accent-safe); }
button.sj-themebtn:hover, button.sj-themebtn:focus { color: var(--sj-accent-safe); }

/* install button: tinted circle, small gold dot, a short gentle nudge when it appears (3 × 1.2 s, then still) */
button.sj-installbtn { background-color: var(--wp--preset--color--tint-primary); color: var(--sj-primary); }
button.sj-installbtn:hover, button.sj-installbtn:focus { background-color: var(--wp--preset--color--tint-accent); color: var(--sj-primary); }
.sj-installbtn__dot {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--sj-accent);
	box-shadow: 0 0 0 2px var(--sj-surface);
}
@media (prefers-reduced-motion: no-preference) {
	.sj-installbtn.is-new svg { animation: sj-nudge 1.2s ease-in-out 0.6s 3; transform-origin: 50% 90%; }
	.sj-installbtn.is-new .sj-installbtn__dot { animation: sj-glow 1.2s ease-in-out 0.6s 3; }
}
@keyframes sj-nudge {
	0%, 100% { transform: translateY(0) rotate(0); }
	25% { transform: translateY(-2px) rotate(-6deg); }
	50% { transform: translateY(0) rotate(0); }
	75% { transform: translateY(-1px) rotate(5deg); }
}
@keyframes sj-glow {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(1.35); opacity: .75; }
}
@media (max-width: 380px) {
	button.sj-iconbtn { width: 42px; height: 42px; }
}
