/**
 * inc/mishnah-header-menu.php renders identical content for desktop and
 * mobile from one data source - this file is the only place the two are
 * allowed to look different, and that difference is deliberate (hover
 * megamenu vs. vertical accordion), not drift.
 *
 * Colors/type ride on the --mishnah-* tokens from mishnah-global.css so this
 * matches the rest of the site instead of inventing a parallel palette.
 */

.m-hdr {
	--m-hdr-radius-s: 6px;
	--m-hdr-radius-m: 10px;
	--m-hdr-shadow: 0 10px 30px -8px rgba(18, 20, 22, .16), 0 2px 8px -2px rgba(18, 20, 22, .08);
	--m-hdr-ease: cubic-bezier(.16, 1, .3, 1);
}

.m-hdr,
.m-hdr__panel,
.m-hdr__trigger,
.m-hdr__item--link,
.m-hdr__tab,
.m-hdr__charts-link,
.m-hdr__acc-trigger,
.m-hdr__seder-trigger {
	font-family: var(--mishnah-font-translation, inherit);
}


/* ---------------------------------------------------------------------------
 * Desktop
 * ------------------------------------------------------------------------- */

.m-hdr--desktop {
	display: flex;
	align-items: center;
	gap: 2px;
	position: relative;
}

.m-hdr__item {
	position: relative;
}

.m-hdr__trigger,
.m-hdr__item--link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border: none;
	background: transparent;
	border-radius: var(--m-hdr-radius-s);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	color: var(--mishnah-ink);
	cursor: pointer;
	text-decoration: none;
	transition: background-color .15s var(--m-hdr-ease), color .15s var(--m-hdr-ease);
}

.m-hdr__trigger:hover,
.m-hdr__item--link:hover,
.m-hdr__item.is-open .m-hdr__trigger {
	background: var(--mishnah-surface-sunken);
}

.m-hdr__chevron {
	width: 14px;
	height: 14px;
	flex: none;
	transition: transform .15s var(--m-hdr-ease);
}

.m-hdr__item.is-open .m-hdr__chevron {
	transform: rotate(180deg);
}

.m-hdr__panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 60;
	background: var(--mishnah-surface);
	border: 1px solid var(--mishnah-border);
	border-radius: var(--m-hdr-radius-m);
	box-shadow: var(--m-hdr-shadow);
	padding: 16px;
	opacity: 0;
	transform: translateY(-6px) scale(.98);
	pointer-events: none;
	transition: opacity .16s var(--m-hdr-ease), transform .16s var(--m-hdr-ease);
}

.m-hdr__item.is-open .m-hdr__panel {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.m-hdr__panel--learn {
	width: min(720px, 90vw);
}

.m-hdr__learn-head {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 12px;
}

.m-hdr__learn-body {
	display: flex;
	gap: 20px;
}

.m-hdr__tabs {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 0 0 160px;
	border-right: 1px solid var(--mishnah-border);
	padding-right: 16px;
}

.m-hdr__tab {
	text-align: left;
	padding: 8px 10px;
	border: none;
	background: transparent;
	border-radius: var(--m-hdr-radius-s);
	font-size: 14px;
	line-height: 1.3;
	color: var(--mishnah-ink-muted);
	cursor: pointer;
	transition: background-color .15s var(--m-hdr-ease), color .15s var(--m-hdr-ease);
}

.m-hdr__tab:hover {
	background: var(--mishnah-surface-sunken);
	color: var(--mishnah-ink);
}

.m-hdr__tab.is-active {
	background: var(--mishnah-surface-sunken);
	color: var(--mishnah-ink);
	font-weight: 600;
}

.m-hdr__tabpanels {
	flex: 1;
	min-width: 0;
}

.m-hdr__tabpanel {
	display: none;
}

.m-hdr__tabpanel.is-active {
	display: block;
	animation: m-hdr-fade .15s var(--m-hdr-ease);
}

.m-hdr__mas-list {
	margin: 0;
	padding: 0;
}

.m-hdr__panel--charts {
	min-width: 200px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.m-hdr__charts-link {
	padding: 8px 10px;
	border-radius: var(--m-hdr-radius-s);
	font-size: 14px;
	color: var(--mishnah-ink);
	text-decoration: none;
	transition: background-color .15s var(--m-hdr-ease);
}

.m-hdr__charts-link:hover {
	background: var(--mishnah-surface-sunken);
}

.m-hdr__yomi-cta {
	display: inline-flex;
	align-items: center;
	padding: 8px 16px;
	border-radius: 999px;
	background: var(--mishnah-accent);
	color: var(--mishnah-ink-inverse);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	transition: filter .15s var(--m-hdr-ease), transform .15s var(--m-hdr-ease);
}

.m-hdr__yomi-cta:hover {
	filter: brightness(1.08);
	transform: translateY(-1px);
}

.m-hdr__item-label {
	display: inline-flex;
}

.m-hdr__yomi-today {
	font-size: 11px;
	font-weight: 500;
	color: var(--mishnah-ink-muted);
	background: var(--mishnah-surface-sunken);
	border-radius: 999px;
	padding: 2px 8px;
	line-height: 1.4;
	white-space: nowrap;
}

.m-hdr__utility {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-left: 8px;
}

@keyframes m-hdr-fade {
	from { opacity: 0; transform: translateY(2px); }
	to   { opacity: 1; transform: translateY(0); }
}


/* ---------------------------------------------------------------------------
 * Mobile / off-canvas
 * ------------------------------------------------------------------------- */

.m-hdr--mobile {
	display: flex;
	flex-direction: column;
	gap: 0;
	width: 100%;
}

.m-hdr--mobile .m-hdr__yomi-today {
	white-space: normal;
}

.m-hdr__acc {
	border-bottom: 1px solid var(--mishnah-border);
}

.m-hdr__acc-trigger,
.m-hdr__seder-trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 4px;
	font-size: 16px;
	font-weight: 500;
	color: var(--mishnah-ink);
	cursor: pointer;
	list-style: none;
}

.m-hdr__acc-trigger::-webkit-details-marker,
.m-hdr__seder-trigger::-webkit-details-marker {
	display: none;
}

.m-hdr__acc[open] > .m-hdr__acc-trigger .m-hdr__chevron,
.m-hdr__seder[open] > .m-hdr__seder-trigger .m-hdr__chevron {
	transform: rotate(180deg);
}

.m-hdr__acc-body {
	padding: 4px 4px 16px;
	animation: m-hdr-fade .18s var(--m-hdr-ease);
}

.m-hdr__acc-body--links {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.m-hdr__seder {
	border-top: 1px solid var(--mishnah-border);
}

.m-hdr__seder-trigger {
	font-size: 14px;
	font-weight: 500;
	padding: 10px 4px;
}

.m-hdr__seder .m-hdr__mas-list {
	padding-bottom: 12px;
}

.m-hdr--mobile .m-hdr__item--link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 14px 4px;
	border-bottom: 1px solid var(--mishnah-border);
	color: var(--mishnah-ink);
	text-decoration: none;
	font-size: 16px;
	font-weight: 500;
}

.m-hdr__utility--mobile {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 12px;
	padding-top: 16px;
}


@media (prefers-reduced-motion: reduce) {
	.m-hdr__panel,
	.m-hdr__chevron,
	.m-hdr__tabpanel.is-active,
	.m-hdr__acc-body,
	.m-hdr__yomi-cta {
		transition: none;
		animation: none;
	}
}
