/* Adaptive notch navigation: a dark frame around the viewport with islands
   that grow out of its bottom edge through inverted curves. */
:root {
	--notch-ink: #09090b;
	--notch-raised: #27272a;
	--notch-text: #fafafa;
	--notch-muted: #a1a1aa;
	--notch-frame: 8px;
	--notch-radius: 16px;
	--notch-curve: 16px;
	--notch-spring: cubic-bezier( 0.34, 1.4, 0.64, 1 );
}

.notch-root {
	position: fixed; inset: var(--notch-frame); z-index: 10;
	pointer-events: none;
	font: 500 14px/1 system-ui, sans-serif;
	-webkit-tap-highlight-color: transparent;
}
.notch-root :where(button) {
	font: inherit; color: inherit; background: none; border: 0; margin: 0; padding: 0;
	cursor: pointer; outline: none;
}
.notch-root :where(button):focus-visible { box-shadow: 0 0 0 2px #71717a; }
.notch-root svg.icon {
	width: 16px; height: 16px; flex-shrink: 0;
	fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* The frame itself: a huge shadow around a rounded, see-through window */
.notch-frame {
	position: absolute; inset: 0; border-radius: var(--notch-radius);
	box-shadow: 0 0 0 100vmax var(--notch-ink);
}

.notch-island {
	position: absolute; bottom: 0; display: flex; align-items: center;
	background: var(--notch-ink); color: var(--notch-text);
	pointer-events: auto; user-select: none;
}
.notch-curve {
	position: absolute; width: var(--notch-curve); height: var(--notch-curve);
	fill: var(--notch-ink); pointer-events: none; overflow: visible;
}
.notch-curve.at-left { right: 100%; bottom: 0; }
.notch-curve.at-right { left: 100%; bottom: 0; }
.notch-curve.above-left { left: 0; bottom: 100%; }
.notch-curve.above-right { right: 0; bottom: 100%; }

/* Brand (left) and action (right) islands */
.notch-side { height: 40px; padding: 0 20px; gap: 10px; }
.notch-side.left { left: 0; border-top-right-radius: 24px; }
.notch-side.right { right: 0; border-top-left-radius: 24px; }
.notch-badge {
	display: grid; place-items: center; width: 28px; height: 28px;
	border-radius: 999px; background: var(--notch-raised);
}
.notch-brand { font-weight: 700; letter-spacing: -0.01em; }

/* Home link back to the landing page */
.notch-home {
	display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 4px; border-radius: 999px;
	color: inherit; text-decoration: none; outline: none;
}
.notch-home:focus-visible { box-shadow: 0 0 0 2px #71717a; }
.notch-home .notch-badge { transition: background .2s; }
.notch-home:hover .notch-badge { background: #3f3f46; }

.notch-action { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px; border-radius: 999px; color: var(--notch-muted); transition: color .2s; }
.notch-action:hover, .notch-action[aria-pressed="true"] { color: var(--notch-text); }

/* Tabs (center island) */
.notch-center {
	left: 50%; transform: translateX( -50% );
	height: 44px; padding: 0 16px; border-radius: 24px 24px 0 0;
}
.notch-tabs { position: relative; display: flex; align-items: center; gap: 4px; }
.notch-pill {
	position: absolute; top: 0; left: 0; height: 36px; border-radius: 999px;
	background: var(--notch-raised); opacity: 0;
	transition: transform .5s var(--notch-spring), width .5s var(--notch-spring), opacity .2s;
}
.notch-tab {
	position: relative; display: flex; align-items: center; gap: 8px;
	height: 36px; padding: 0 14px; border-radius: 999px; white-space: nowrap;
	color: var(--notch-muted); transition: color .2s;
}
.notch-tab:hover { color: #e4e4e7; }
.notch-tab[aria-selected="true"] { color: var(--notch-text); }
.notch-live {
	font-size: 10px; font-weight: 700; letter-spacing: .04em;
	padding: 3px 6px; border-radius: 6px; background: var(--notch-raised); color: #e4e4e7;
}
.notch-live::before {
	content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 4px;
	border-radius: 50%; background: #22c55e; vertical-align: 1px;
}

/* Compact layout: one notch that opens into a drawer */
.notch-mobile {
	left: 50%; transform: translateX( -50% ); flex-direction: column; align-items: stretch;
	width: min( 380px, calc( 100vw - 2 * var(--notch-frame) - 2 * var(--notch-curve) - 8px ) );
	padding: 0 16px; border-radius: 24px 24px 0 0;
}
.notch-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; }
.notch-current { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; border-radius: 999px; }
.notch-current .chevron { transition: transform .35s var(--notch-spring); }
.notch-mobile.open .notch-current .chevron { transform: rotate( 180deg ); }
.notch-drawer { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--notch-spring); }
.notch-mobile.open .notch-drawer { grid-template-rows: 1fr; }
.notch-list { overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.notch-list > :last-child { margin-bottom: 8px; }
.notch-item {
	display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px;
	border-radius: 12px; color: var(--notch-muted); text-align: left; transition: background .2s, color .2s;
}
.notch-item:hover { background: #18181b; color: #e4e4e7; }
.notch-item[aria-selected="true"] { background: var(--notch-raised); color: var(--notch-text); }
.notch-item .grow { flex: 1; }
.notch-item .hint { margin-left: 6px; font-size: 12px; font-weight: 400; color: #71717a; }
.notch-item .check { visibility: hidden; }
.notch-item[aria-selected="true"] .check { visibility: visible; }

.notch-backdrop {
	position: absolute; inset: 0; border-radius: var(--notch-radius);
	background: rgba( 0, 0, 0, .2 ); backdrop-filter: blur( 2px );
	opacity: 0; transition: opacity .2s;
}
.notch-root.drawer-open { z-index: 1002; } /* above the lil-gui panel */
.notch-root.drawer-open .notch-backdrop { opacity: 1; pointer-events: auto; }

.notch-mobile, .notch-backdrop { display: none; }
@media ( max-width: 1199px ) {
	.notch-side, .notch-center { display: none; }
	.notch-mobile { display: flex; }
	.notch-backdrop { display: block; }
}
@media ( max-width: 767px ) {
	:root { --notch-frame: 0px; --notch-radius: 0px; --notch-curve: 10px; }
}
