/* ==========================================================================
   Nejat Office Masonry Widget
   BEM: .nejat-office-masonry
   Instagram-style masonry grid gallery with lightbox
   ========================================================================== */

/* Root — uses shared spacing tokens */
.nejat-office-masonry {
	padding-top: var(--nejat-section-pad-v);
	padding-bottom: var(--nejat-section-pad-v);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Inner container */
.nejat-office-masonry__inner {
	max-width: var(--nejat-max-width);
	margin: 0 auto;
	padding-left: var(--nejat-gutter);
	padding-right: var(--nejat-gutter);
}

/* --------------------------------------------------------------------------
   Location Tabs
   -------------------------------------------------------------------------- */

.nejat-office-masonry__tabs {
	display: flex;
	gap: 10px;
	margin-bottom: var(--nejat-gap-md);
	flex-wrap: wrap;
	justify-content: center;
}

.nejat-office-masonry__tab {
	background: #f0fafb;
	border: 2px solid #e0e0e0;
	border-radius: var(--nejat-radius);
	padding: 16px 24px;
	cursor: pointer;
	transition: all 0.3s ease;
	text-align: center;
	min-width: 200px;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	gap: 4px;
	box-sizing: border-box;
	overflow: hidden;
	color: #555555;
}

.nejat-office-masonry__tab:hover {
	border-color: #4ab3c8;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(74, 179, 200, 0.15);
}

.nejat-office-masonry__tab--active {
	background: #ffffff;
	border-color: #4ab3c8;
	color: #4ab3c8;
	box-shadow: 0 4px 12px rgba(74, 179, 200, 0.2);
}

.nejat-office-masonry__tab-name {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
}

.nejat-office-masonry__tab-address {
	font-size: 13px;
	opacity: 0.7;
	line-height: 1.4;
	word-break: break-word;
	overflow-wrap: anywhere;
	white-space: normal;
	max-width: 100%;
}

/* --------------------------------------------------------------------------
   Grid Container & Locations
   -------------------------------------------------------------------------- */

.nejat-office-masonry__grid-wrap {
	position: relative;
}

.nejat-office-masonry__location {
	display: none;
}

.nejat-office-masonry__location--active {
	display: block;
}

/* --------------------------------------------------------------------------
   Masonry Grid
   -------------------------------------------------------------------------- */

.nejat-office-masonry__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	grid-auto-rows: 220px;
	grid-auto-flow: dense;
}

/* Responsive columns */
@media (max-width: 1024px) {
	.nejat-office-masonry__grid {
		grid-template-columns: repeat(2, 1fr);
		grid-auto-rows: 200px;
	}
}

@media (max-width: 768px) {
	.nejat-office-masonry__grid {
		grid-template-columns: 1fr;
		grid-auto-rows: 280px;
	}
}

/* --------------------------------------------------------------------------
   Grid Items
   -------------------------------------------------------------------------- */

.nejat-office-masonry__item {
	position: relative;
	display: block;
	overflow: hidden;
	background: #e8e8e8;
	border-radius: 8px;
	cursor: pointer;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nejat-office-masonry__item:hover {
	box-shadow: 0 8px 20px rgba(74, 179, 200, 0.2);
	z-index: 2;
}

/* Tall items for visual variety — no wide (column-spanning) items */
.nejat-office-masonry__item:nth-child(4n+1) {
	grid-row: span 2;
}

.nejat-office-masonry__item:nth-child(11n+5) {
	grid-row: span 2;
}

/* Remove tall spans on mobile for simpler layout */
@media (max-width: 768px) {
	.nejat-office-masonry__item:nth-child(4n+1),
	.nejat-office-masonry__item:nth-child(11n+5) {
		grid-row: span 1;
	}
}

/* --------------------------------------------------------------------------
   Images
   -------------------------------------------------------------------------- */

/* Higher specificity than Elementor's `.elementor img { height: auto }` */
.elementor .nejat-office-masonry__image {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	object-position: center center; /* Center crop both horizontally and vertically */
	transition: transform 0.4s ease;
}

/* --------------------------------------------------------------------------
   Overlay & Captions
   -------------------------------------------------------------------------- */

.nejat-office-masonry__overlay {
	position: absolute;
	inset: 0;
	background: rgba(74, 179, 200, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
	padding: 20px;
}

.nejat-office-masonry__item:hover .nejat-office-masonry__overlay {
	opacity: 1;
}

.nejat-office-masonry__caption {
	color: #ffffff;
	font-size: 15px;
	line-height: 1.4;
	text-align: center;
	max-width: 100%;
	word-wrap: break-word;
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.nejat-office-masonry-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.95);
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	animation: fadeIn 0.25s ease;
}

.nejat-office-masonry-lightbox--active {
	display: flex;
}

@keyframes fadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.nejat-office-masonry-lightbox__inner {
	position: relative;
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nejat-office-masonry-lightbox__image {
	max-width: 100%;
	max-height: 90vh;
	width: auto;
	height: auto;
	display: block;
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Close button */
.nejat-office-masonry-lightbox__close {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 48px;
	height: 48px;
	background: rgba(255, 255, 255, 0.9);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	color: #1a1a1a;
	font-size: 24px;
	font-weight: 300;
	line-height: 1;
	z-index: 100001;
}

.nejat-office-masonry-lightbox__close:hover {
	background: #4ab3c8;
	color: #ffffff;
	transform: rotate(90deg);
}

/* Navigation arrows */
.nejat-office-masonry-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	background: rgba(255, 255, 255, 0.9);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	color: #1a1a1a;
	z-index: 100001;
}

.nejat-office-masonry-lightbox__nav:hover {
	background: #4ab3c8;
	color: #ffffff;
}

.nejat-office-masonry-lightbox__nav--prev {
	left: 20px;
}

.nejat-office-masonry-lightbox__nav--next {
	right: 20px;
}

.nejat-office-masonry-lightbox__nav svg {
	display: block;
	flex-shrink: 0;
}

/* Counter */
.nejat-office-masonry-lightbox__counter {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(255, 255, 255, 0.9);
	color: #1a1a1a;
	padding: 8px 16px;
	border-radius: 20px;
	font-size: 14px;
	font-weight: 600;
	z-index: 100001;
}

/* Hide navigation on mobile */
@media (max-width: 768px) {
	.nejat-office-masonry-lightbox__nav {
		display: none;
	}
}
