/*
 * PureCSS.com
 * https://purecss.com/off-canvas-navigation/
 * A slide-in navigation panel using a checkbox and CSS translate.
 */

.demo-off-canvas-navigation {
	position: relative;
	overflow: hidden;
	min-height: 260px;
}

/* the frame the panel slides inside; a theme token, so it follows the
   site's dark and light themes */
.demo-off-canvas-navigation .offcanvas-frame {
	position: relative;
	overflow: hidden;
	min-height: 260px;
	padding: 1.5rem;
	background: var(--surface-2);
	border-radius: 10px;
}

/* hidden by opacity rather than display: none, so the checkbox keeps its
   place in the tab order and the space bar toggles it */
.demo-off-canvas-navigation .offcanvas-check {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

.demo-off-canvas-navigation .offcanvas-open {
		display: inline-flex;
		align-items: center;
		gap: .5rem;
		padding: .55rem 1rem;
		background: var(--accent);
		color: var(--bg);
		border-radius: 8px;
		cursor: pointer;
		font-size: .9rem;
		user-select: none;
		position: relative;
		z-index: 2;
	}

.demo-off-canvas-navigation .offcanvas-panel {
		position: absolute;
		top: 0;
		left: 0;
		/* narrower than the frame, so a strip of backdrop stays
		   uncovered to click */
		width: 75%;
		max-width: 220px;
		height: 100%;
		background: var(--surface);
		transform: translateX(-100%);
		/* visibility flips at the end of the slide out, so the closed
		   panel's links leave the tab order without cutting the motion */
		visibility: hidden;
		transition: transform .3s ease, visibility .3s;
		z-index: 10;
		padding: 1.5rem 0;
	}

:is(.demo-off-canvas-navigation .offcanvas-panel) nav a {
			display: block;
			padding: .65rem 1.25rem;
			color: var(--text);
			font-size: .9rem;
			text-decoration: none;
			transition: background .15s;
		}

:is(:is(.demo-off-canvas-navigation .offcanvas-panel) nav a):hover {
				background: var(--border);
			}

.demo-off-canvas-navigation .offcanvas-check:checked ~ .offcanvas-panel {
		transform: translateX(0);
		visibility: visible;
	}

/* the checkbox is invisible, so its focus ring goes on the control the
   reader can see: the open button while closed, Close while open */
.demo-off-canvas-navigation .offcanvas-check:focus-visible:not(:checked) ~ .offcanvas-open {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.demo-off-canvas-navigation .offcanvas-check:focus-visible:checked ~ .offcanvas-panel .offcanvas-close {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}

/* drawn inside the link, because the frame clips anything past the
   panel's left edge */
.demo-off-canvas-navigation .offcanvas-panel nav a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}

.demo-off-canvas-navigation .offcanvas-close {
		display: block;
		padding: .65rem 1.25rem;
		color: var(--text-muted);
		font-size: .85rem;
		cursor: pointer;
		margin-bottom: .5rem;
		border-bottom: 1px solid var(--border);
	}

.demo-off-canvas-navigation .offcanvas-overlay {
		position: absolute;
		inset: 0;
		background: rgba(0,0,0,.45);
		opacity: 0;
		pointer-events: none;
		transition: opacity .3s;
		z-index: 9;
	}

.demo-off-canvas-navigation .offcanvas-check:checked ~ .offcanvas-overlay {
		opacity: 1;
		pointer-events: auto;
	}

/* ── Variant: right-hand drawer that pushes the content across ── */

.demo-off-canvas-navigation .oc-push {
	position: relative;
	overflow: hidden;
	width: 100%;
	min-height: 210px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
}

.demo-off-canvas-navigation .ocp-check {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.demo-off-canvas-navigation .ocp-shift {
	padding: 1.5rem;
	transition: transform .3s ease;
}

.demo-off-canvas-navigation .ocp-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.demo-off-canvas-navigation .ocp-count {
	font-family: var(--font-mono);
	font-size: .72rem;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.demo-off-canvas-navigation .ocp-shift p {
	max-width: 380px;
	margin-top: 1rem;
	font-size: .85rem;
	line-height: 1.6;
	color: var(--text-muted);
}

.demo-off-canvas-navigation .ocp-open {
	display: inline-flex;
	align-items: center;
	padding: .55rem 1rem;
	background: var(--accent);
	color: var(--bg);
	border-radius: var(--radius);
	font-size: .9rem;
	font-weight: 500;
	cursor: pointer;
	user-select: none;
}

.demo-off-canvas-navigation .ocp-check:focus-visible ~ .ocp-shift .ocp-open {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.demo-off-canvas-navigation .ocp-panel {
	position: absolute;
	top: 0;
	right: 0;
	width: 190px;
	height: 100%;
	padding: 1.25rem 0;
	background: var(--surface);
	border-left: 1px solid var(--border);
	transform: translateX(100%);
	/* the transition delays the visibility flip to the end of the
	   duration, so the slide out still plays in full */
	visibility: hidden;
	transition: transform .3s ease, visibility .3s;
}

/* same duration and easing on both, so the two moves read as one */
.demo-off-canvas-navigation .ocp-check:checked ~ .ocp-shift {
	transform: translateX(-190px);
}

.demo-off-canvas-navigation .ocp-check:checked ~ .ocp-panel {
	transform: translateX(0);
	visibility: visible;
}

.demo-off-canvas-navigation .ocp-panel a {
	display: block;
	padding: .6rem 1.25rem;
	color: var(--text);
	font-size: .875rem;
	text-decoration: none;
	transition: background .15s;
}

.demo-off-canvas-navigation .ocp-panel a:hover {
	background: var(--border);
}

.demo-off-canvas-navigation .ocp-close {
	display: block;
	margin-bottom: .5rem;
	padding: 0 1.25rem .6rem;
	border-bottom: 1px solid var(--border);
	color: var(--text-muted);
	font-size: .8rem;
	cursor: pointer;
	user-select: none;
}

/* ── Variant: hamburger that becomes a cross ── */

.demo-off-canvas-navigation .oc-burger-frame {
	position: relative;
	overflow: hidden;
	width: 100%;
	min-height: 230px;
	padding: 1.25rem;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
}

/* opacity rather than display, so the button keeps its place in the
   tab order and the space bar still toggles it */
.demo-off-canvas-navigation .ocb-check {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.demo-off-canvas-navigation .ocb-burger {
	position: relative;
	z-index: 12;
	display: block;
	width: 24px;
	height: 16px;
	cursor: pointer;
}

.demo-off-canvas-navigation .ocb-burger span {
	position: absolute;
	left: 0;
	width: 100%;
	height: 2px;
	border-radius: 2px;
	background: var(--text);
	transition: transform .3s ease, opacity .2s;
}

.demo-off-canvas-navigation .ocb-burger span:nth-child(1) { top: 0; }
.demo-off-canvas-navigation .ocb-burger span:nth-child(2) { top: 7px; }
.demo-off-canvas-navigation .ocb-burger span:nth-child(3) { top: 14px; }

/* translate first, then rotate: reversing the order pivots the bar
   around the wrong point and the cross comes out lopsided */
.demo-off-canvas-navigation .ocb-check:checked ~ .ocb-burger span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.demo-off-canvas-navigation .ocb-check:checked ~ .ocb-burger span:nth-child(2) {
	opacity: 0;
}

.demo-off-canvas-navigation .ocb-check:checked ~ .ocb-burger span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

.demo-off-canvas-navigation .ocb-check:focus-visible ~ .ocb-burger {
	outline: 2px solid var(--accent);
	outline-offset: 6px;
}

.demo-off-canvas-navigation .ocb-overlay {
	position: absolute;
	inset: 0;
	z-index: 9;
	background: rgba(0,0,0,.45);
	opacity: 0;
	pointer-events: none;
	transition: opacity .3s;
}

.demo-off-canvas-navigation .ocb-check:checked ~ .ocb-overlay {
	opacity: 1;
	pointer-events: auto;
}

.demo-off-canvas-navigation .ocb-panel {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 10;
	width: 200px;
	height: 100%;
	padding: 3.25rem 0 1rem;
	background: var(--surface);
	transform: translateX(-100%);
	visibility: hidden;
	transition: transform .3s ease, visibility .3s;
}

.demo-off-canvas-navigation .ocb-check:checked ~ .ocb-panel {
	transform: translateX(0);
	visibility: visible;
}

.demo-off-canvas-navigation .ocb-panel a {
	display: block;
	padding: .65rem 1.25rem;
	color: var(--text);
	font-size: .9rem;
	text-decoration: none;
	transition: background .15s;
}

.demo-off-canvas-navigation .ocb-panel a:hover {
	background: var(--border);
}

@media (prefers-reduced-motion: reduce) {
	.demo-off-canvas-navigation .ocp-panel,
	.demo-off-canvas-navigation .ocp-shift,
	.demo-off-canvas-navigation .ocb-panel,
	.demo-off-canvas-navigation .ocb-burger span,
	.demo-off-canvas-navigation .offcanvas-panel,
	.demo-off-canvas-navigation .offcanvas-overlay {
		transition: none;
	}
}
