/**
 * Navrail Navigation — structural & behavioral styles.
 *
 * Mirrors the structural patterns already established in navrail-toc.css
 * (flex rail, hidden-but-functional scrollbar, RTL-safe edge fade,
 * accessible focus ring, reduced-motion) under its own `.navrail-nav`
 * namespace, so it never collides with `.htoc*` selectors and the two
 * widgets can be styled completely independently. Colors/spacing that a
 * user configures via the Style tab are injected by Elementor itself; this
 * file only contains the rules the widget needs to function correctly.
 */

.navrail-nav {
	--htoc-fade-color: #ffffff;
	--htoc-fade-width: 48px;
	--htoc-fade-opacity: 1;
	--htoc-fade-blur: 6px;
	--htoc-sticky-offset: 0px;
	--htoc-sticky-zindex: 999;
	--navrail-nav-title-spacing: 8px;
	--navrail-nav-media-direction: row;
	--navrail-nav-item-height: 0px;
	--navrail-nav-items-gap: 24px;
	--navrail-nav-item-padding-block: 8px;
	--navrail-nav-item-padding-inline: 16px;

	display: flex;
	align-items: center;
	width: 100%;
	min-height: 44px;
	box-sizing: border-box;
}

.navrail-nav *,
.navrail-nav *::before,
.navrail-nav *::after {
	box-sizing: inherit;
}

/* ------------------------------------------------------------------ */
/* Scrollable viewport                                                */
/* ------------------------------------------------------------------ */

.navrail-nav__viewport {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
}

.navrail-nav__track {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: var(--navrail-nav-items-gap);
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-x;
	scroll-behavior: auto;

	scrollbar-width: none;
	-ms-overflow-style: none;
}

.navrail-nav__track::-webkit-scrollbar {
	display: none;
	height: 0;
	width: 0;
}

.navrail-nav__item {
	flex: 0 0 auto;
	list-style: none;
}

.navrail-nav__link {
	display: flex;
	align-items: center;
	flex-direction: var(--navrail-nav-media-direction);
	gap: var(--navrail-nav-title-spacing);
	min-height: var(--navrail-nav-item-height);
	padding-block: var(--navrail-nav-item-padding-block);
	padding-inline: var(--navrail-nav-item-padding-inline);
	max-width: 100%;
	white-space: nowrap;
	text-decoration: none;
	cursor: pointer;
	transition-property: color, background-color, border-color, box-shadow;
	transition-timing-function: ease;
}

.navrail-nav__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.navrail-nav__link.is-active {
	font-weight: 600;
}

.navrail-nav__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}

.navrail-nav__icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.navrail-nav__image {
	display: block;
	flex: 0 0 auto;
	object-fit: cover;
}

.navrail-nav__title {
	display: inline-block;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	vertical-align: middle;
}

/* Visually-hidden but still accessible — used when "Show Title" is off
   for an icon-only/image-only presentation, so the title still provides
   the link's accessible name instead of being removed from the DOM. */
.navrail-nav__title--visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Used by the Gutenberg "Navrail Navigation" block only: since its Items
   are static, individually-saved child blocks that can't know the parent's
   "Show Titles" setting at save time (block context isn't available inside
   a static block's save()), the parent's own wrapper carries this class
   instead and hides every descendant title with one rule — functionally
   identical to the per-item class above that Elementor's PHP applies. */
.navrail-nav--hide-titles .navrail-nav__title {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ */
/* Edge fade (identical pattern to navrail-toc.css)                    */
/* ------------------------------------------------------------------ */

.navrail-nav__fade {
	position: absolute;
	top: 0;
	bottom: 0;
	width: var(--htoc-fade-width);
	max-width: 50%;
	pointer-events: none;
	opacity: 0;
	z-index: 2;
	transition: opacity 0.15s ease;
}

.navrail-nav__fade.is-visible {
	opacity: var(--htoc-fade-opacity);
}

.navrail-nav:not(.is-rtl) .navrail-nav__fade--start {
	inset-inline-start: 0;
	background: linear-gradient(to right, var(--htoc-fade-color), transparent);
}

.navrail-nav:not(.is-rtl) .navrail-nav__fade--end {
	inset-inline-end: 0;
	background: linear-gradient(to left, var(--htoc-fade-color), transparent);
}

.navrail-nav.is-rtl .navrail-nav__fade--start {
	inset-inline-start: 0;
	background: linear-gradient(to left, var(--htoc-fade-color), transparent);
}

.navrail-nav.is-rtl .navrail-nav__fade--end {
	inset-inline-end: 0;
	background: linear-gradient(to right, var(--htoc-fade-color), transparent);
}

.navrail-nav--fade-mode-blur .navrail-nav__fade,
.navrail-nav--fade-mode-gradient-blur .navrail-nav__fade {
	-webkit-backdrop-filter: blur(var(--htoc-fade-blur));
	backdrop-filter: blur(var(--htoc-fade-blur));
}

.navrail-nav--fade-mode-blur .navrail-nav__fade {
	background: none;
}

/* ------------------------------------------------------------------ */
/* Sticky fallback (only output when Elementor Pro is not active —    */
/* see NAVRAIL_Shared_Widget::get_sticky_wrapper_class())              */
/* ------------------------------------------------------------------ */

.navrail-nav--sticky-top {
	position: sticky;
	top: var(--htoc-sticky-offset, 0px);
	z-index: var(--htoc-sticky-zindex, 999);
}

.navrail-nav--sticky-bottom {
	position: sticky;
	bottom: var(--htoc-sticky-offset, 0px);
	z-index: var(--htoc-sticky-zindex, 999);
}

/* ------------------------------------------------------------------ */
/* Reduced motion                                                      */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.navrail-nav__link {
		transition: none;
	}
}
