/* *********
MENU
********** */

#cl-menu {
	position: fixed;
	inset: 0 auto 0 0; /* Sticks to the left edge */
	height: 100vh;
	width: 480px;
	max-width: 95vw;
	margin: 0;
	padding: 0;
	border: none;
	background-color: var( --bg-page );
	box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15); /* Shadow moves to the right side */
	overflow: hidden;
	
	/* 1. Closed state (where it slides out TO) */
	transform: translateX(-100%);
	opacity: 0;
	
	/* 2. Transition configuration for exit & entry */
	transition:
		transform 0.3s ease-out,
		opacity 0.3s ease-out,
		display 0.3s ease-out allow-discrete,
		overlay 0.3s ease-out allow-discrete;
}

/* Popover Base State */
#cl-menu:popover-open {
	transform: translateX(0);
	opacity: 1;
}

/* Entry Animation Initial State */
@starting-style {
	#cl-menu:popover-open {
		transform: translateX(-100%);
		opacity: 0;
	}
}

/* Backdrop Base State */
#cl-menu:popover-open::backdrop {
	background-color: rgba(0, 0, 0, 0.4);
}

/* Backdrop Entry Animation Initial State */
@starting-style {
	#cl-menu:popover-open::backdrop {
		background-color: rgba(0, 0, 0, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	#cl-menu,
	#cl-menu::backdrop {
		/* Disable movement, rely solely on quick opacity or no animation */
		transition: opacity 0.15s linear, display 0.15s allow-discrete, overlay 0.15s allow-discrete;
		transform: none !important;
	}
}

/* Disable transitions while actively dragging so the drawer follows the finger 1:1 */
#cl-menu.is-dragging {
	transition: none !important;
}

/* Container positioned on the left edge of the right-sliding drawer */
.menu-handle-container {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: grab;
	touch-action: none;
	user-select: none;
}

/* The visual pill element */
.menu-handle {
	width: 4px;
	height: 40px;
	background-color: #d1d5db;
	border-radius: 9999px;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

/* Subtle feedback on touch or hover */
.menu-handle-container:hover .menu-handle,
#cl-menu:active .menu-handle {
	background-color: #9ca3af;
	transform: scaleX(1.2);
}

/* Menu open is in site-nav css */

#cl-menu .cl-menu-content{
	display: flex;
	justify-content: flex-start;
	align-items: flex-start;
	flex-direction: column;
	height: 100vh;
	margin: 0;
}

#cl-menu .cl-menu-header {
	display: flex;
	justify-content: flex-end;
	align-items: flex-start;
	padding: 2rem;
	margin: 0 auto;
	flex-shrink: 0;
	background-color: var( --popover-header );
	width: 100%;
}

#cl-menu-close {
	display: block;
	border: none;
	background: none;
	cursor: pointer;
	width: 32px;
	height: 32px;
	background-image: url( '/icons/close-dark.svg' );
	background-position: center;
	background-repeat: no-repeat;
	background-size: contain;
}

#cl-menu .cl-menu-body{
	padding: 2rem 2rem 2rem 0 !important;
	width: 100%;
	margin: 0;
	flex: 1; /* Takes up remaining height between header and bottom */
	overflow-y: auto; /* Handles vertical scrolling */
	overscroll-behavior: contain; /* Prevents main page behind popover from scrolling */
	-webkit-overflow-scrolling: touch; /* Smooth momentum scrolling for iOS Safari */
}

#cl-menu .cl-menu-body-content{
	display: flex;
	flex-direction: column;
	row-gap: 3rem;
	padding: 0 2rem;
}

#cl-menu .cl-menu-header .titles{
	display: flex;
	flex-direction: column;
	row-gap: 0.5rem;
}

#cl-menu .cl-menu-header .title{
	font-family: var( --font-display );
	font-style: italic;
	font-weight: 400;
	font-size: 2rem;
	margin-top: 1rem;
	color: var( --text-dark );
}

#cl-menu .cl-menu-header .subtitle{
	font-family: var( --font-display );
	font-weight: 500;
	font-size: 0.95rem;
	opacity: 0.8;
	color: var( --text-dark );
}

#cl-menu .site-menu {
	color: var( --text-dark );
}

#cl-menu .titles {
	color: var( --text-dark );
	margin-bottom: 2rem;
}

#cl-menu .title {
	font-family: var( --font-display );
	font-size: 1.6rem;
	font-weight: 400;
}

#cl-menu .subtitle {
	font-family: var( --font-sans );
	font-style: normal;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 400;
}

#cl-menu .site-menu-list {
	display: flex;
	flex-direction: column;
	row-gap: 0.75rem;
	padding: 0 1rem 0 0;
	list-style-type: none;
}

#cl-menu .site-menu-item {
	font-family: var( --font-sans );
	font-size: 1rem;
	font-style: normal;
	font-weight: 500;
	padding-bottom: 0.5rem;
	color: var( --text-dark );
	border-bottom: solid 1px #1a1a1a22;
}

#cl-menu .site-menu-item LI A{
	color: inherit;
}

#cl-menu .site-menu-item LI A:hover{
	font-weight: 600;
}

#magazine-menu {
	margin-bottom: 3rem;
}

#magazine-menu .titles {
	color: var( --text-dark );
}

#magazine-menu .title {
	font-family: var( --font-display );
	font-size: 1.6rem;
	font-weight: 400;
}

#magazine-menu .subtitle {
	font-family: var( --font-sans );
	font-style: normal;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 400;
}

#magazine-menu .magazine-menu-list{
	display: flex;
	flex-direction: column;
	row-gap: 0;
	padding: 0;
	list-style-type: none;
	margin: 2rem 0;
}

#magazine-menu .magazine-menu-list LI{
	display: flex;
	align-items: flex-start;
	column-gap: 1rem;
	font-family: var( --font-sans );
	font-weight: 600;
	font-size: 0.9rem;
	color: var( --link-dark );
	font-style: normal;
	padding: 1rem 0;
	border-bottom: var( --thinner-line );
	position: relative;
	line-height: 1.4em;
	text-overflow: ellipsis;
	transition: all 0.3s ease;
}

#magazine-menu .magazine-menu-list LI:hover{
	font-weight: 700;
	margin-left: -1rem;
	padding-left: 0.5rem;
}

#magazine-menu .magazine-menu-list LI A{
	padding-top: 0rem;
}

#magazine-menu .magazine-menu-list LI[data-type='think-and-speak'] A{
	color: #696;
}
#magazine-menu .magazine-menu-list LI[data-type='english-sampler'] A{
	color: #069;
}
#magazine-menu .magazine-menu-list LI[data-type='record-and-report'] A{
	color: #A80;
}

#magazine-menu .magazine-menu-list LI .magazine-menu-item-number{
	display: flex;
	justify-content: center;
	align-items: center;
	color: var( --text-light );
	opacity: 1;
	font-size: 0.8em;
	font-weight: 800;
	font-style: normal;
	border-radius: 50%;
	width: 2em;
	aspect-ratio: 1/1;
	margin: 0;
	padding: 0;
	background-color: var( --link-dark );
	color: var( --text-light );
}
#magazine-menu .magazine-menu-list LI[data-type='think-and-speak'] .magazine-menu-item-number{
	background-color: var( --exercise-category-border );
}
#magazine-menu .magazine-menu-list LI[data-type='english-sampler'] .magazine-menu-item-number{
	background-color: var( --category-border );
#magazine-menu .magazine-menu-list LI[data-type='record-and-report'] .magazine-menu-item-number{
	background-color: var( --original-category-border );
}

#magazine-menu .magazine-menu-list LI[aria-current='page']{
	font-style: italic;
	color: var( --text-dark );
	font-weight: 550;
	margin-left: -1rem;
	padding-left: 0.5rem;
	background-color: var( --accent-light );
	border: none;
}

#magazine-menu .magazine-menu-list LI[aria-current='page'] A{
	color: var( --text-dark );
}