/* TLAS Loop Grid — year navigation */

.tlas-loop-grid-wrapper {
	position: relative;
}

.tlas-loop-grid-year-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 32px;
}

/* The standalone year menu is a single element placed in a header; no stack margin. */
.tlas-year-menu {
	margin-bottom: 0;
}

/* Let the menu fill its widget box so it can be vertically aligned in a header.
   The "Vertical Alignment" control sets justify-content on this container. */
.elementor-widget-tlas-year-menu .elementor-widget-container {
	display: flex;
	flex-direction: column;
	justify-content: center;
	height: 100%;
}

/* Mobile: title on its own line, the two arrows (with their labels) together below.
   Scoped to the loop-grid nav so the standalone menu keeps its own alignment. */
@media (max-width: 767px) {
	.tlas-loop-grid-year-nav:not(.tlas-year-menu) .tlas-year-title-wrap {
		order: -1;
		flex-basis: 100%;
		text-align: center;
	}
}

/* Arrows */
.tlas-year-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Keep the default (SVG) arrow from inheriting a theme link-hover colour
   (the "default Elementor pink"). The Arrow Hover Color control overrides this. */
.tlas-year-arrow:hover,
.tlas-year-arrow:focus {
	color: inherit;
}

.tlas-year-arrow:hover {
	transform: scale( 1.1 );
}

.tlas-year-arrow svg,
.tlas-year-arrow img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
}

.tlas-year-arrow svg {
	transition: fill 0.2s ease, stroke 0.2s ease;
}

/* Adjacent year labels (shown on the outside of each arrow) */
.tlas-year-sublabel {
	cursor: pointer;
	white-space: nowrap;
	line-height: 1;
	user-select: none;
	transition: color 0.2s ease, opacity 0.2s ease;
}

.tlas-year-arrow.is-disabled,
.tlas-year-arrow[disabled] {
	opacity: 0.25;
	cursor: default;
	pointer-events: none;
}

/* Title */
.tlas-year-title-wrap {
	position: relative;
}

.tlas-year-title {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	margin: 0;
	cursor: default;
	user-select: none;
}

.tlas-loop-grid-year-nav.has-dropdown .tlas-year-title {
	cursor: pointer;
}

.tlas-year-caret {
	display: inline-flex;
	width: 0.7em;
	height: 0.7em;
	transition: transform 0.25s ease;
}

.tlas-year-caret svg {
	width: 100%;
	height: 100%;
}

.tlas-loop-grid-year-nav.is-open .tlas-year-caret {
	transform: rotate( 180deg );
}

/* Dropdown (modern popover) */
.tlas-year-dropdown {
	position: absolute;
	top: calc( 100% + 10px );
	left: 50%;
	transform: translate( -50%, -6px );
	display: flex;            /* flex column => items always stack, ignoring theme link styles */
	flex-direction: column;
	min-width: max( 100%, 180px );
	max-height: 320px;
	overflow-y: auto;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.16 );
	padding: 8px;
	z-index: 50;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.tlas-year-dropdown[hidden] {
	display: flex; /* override the HTML hidden attr so the transition can run */
}

.tlas-loop-grid-year-nav.is-open .tlas-year-dropdown {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translate( -50%, 0 );
}

.tlas-year-dropdown::before {
	content: "";
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX( -50% );
	border: 8px solid transparent;
	border-bottom-color: #fff;
}

.tlas-loop-grid-year-nav .tlas-year-dropdown button,
.tlas-loop-grid-year-nav .tlas-year-dropdown a {
	display: flex;             /* center the label, beat theme nav link styles */
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 0;
	text-align: center;
	margin: 0;
	padding: 10px 18px;
	border: 0;
	border-radius: 9px;
	background: transparent;
	color: inherit;
	font: inherit;
	line-height: 1.3;
	white-space: nowrap;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.tlas-year-dropdown button:hover,
.tlas-year-dropdown a:hover {
	background-color: rgba( 0, 0, 0, 0.06 );
}

.tlas-year-dropdown button.is-active,
.tlas-year-dropdown a.is-active {
	font-weight: 700;
	background-color: rgba( 0, 0, 0, 0.06 );
}

/* Loading state */
.tlas-loop-grid-wrapper.tlas-is-loading .tlas-loop-grid-body {
	opacity: 0.45;
	transition: opacity 0.2s ease;
	pointer-events: none;
}

.tlas-loop-grid-wrapper.tlas-is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid rgba( 0, 0, 0, 0.15 );
	border-top-color: rgba( 0, 0, 0, 0.55 );
	border-radius: 50%;
	animation: tlas-spin 0.7s linear infinite;
	z-index: 60;
}

@keyframes tlas-spin {
	to { transform: rotate( 360deg ); }
}
