/* -------------------------------------------------------------------------
 * Nadir Gallery — front end
 * Tweak the variables below to change the look of the filter.
 * ---------------------------------------------------------------------- */

.nadir-gallery {
	--ng-gap: 14px;
	--ng-columns: 3;
	--ng-ratio: 1 / 1;

	/* Filter before hover */
	--ng-brightness: 0.72;
	--ng-contrast: 1.22;

	/* Grain: χοντρός κόκκος film */
	--ng-grain-opacity: 0.4;
	--ng-grain-size: 220px;


	/* Fine: ψιλός σκούρος κόκκος */
	--ng-fine-opacity: 0.25;
	--ng-fine-size: 100px;

	/* Ανά φωτογραφία μεταβολή του κόκκου (βλ. nth-child παρακάτω) */
	--ng-scale: 1;
	--ng-shift-x: 0px;
	--ng-shift-y: 0px;

	/* Φθορά: άνιση φωτεινότητα, vignette, dropout μπάντες
	   (--ng-wear-strength: 0 = εντελώς εκτός) */
	--ng-wear-strength: 1;
	--ng-vignette: 0.45;

	/* CRT scanlines */
	--ng-scanline-opacity: 0.09;
	--ng-scanline-gap: 3px;

	/* Filter on hover */
	--ng-hover-brightness: 1;
	--ng-hover-contrast: 1;
	--ng-transition: 600ms cubic-bezier(0.22, 0.61, 0.36, 1);

	--ng-bg: #050505;

	/* Load more link */
	--ng-more-underline: 1px;
	--ng-more-tracking: 0.14em;

	width: 100%;
}

.nadir-gallery *,
.nadir-gallery *::before,
.nadir-gallery *::after {
	box-sizing: border-box;
}

.nadir-gallery__grid {
	display: grid;
	grid-template-columns: repeat(var(--ng-columns), minmax(0, 1fr));
	gap: var(--ng-gap);
}

.nadir-gallery__item {
	position: relative;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.nadir-gallery__item.is-hidden {
	display: none;
}

.nadir-gallery__trigger {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: var(--ng-bg);
	overflow: hidden;
	cursor: pointer;
	line-height: 0;
	-webkit-appearance: none;
	appearance: none;
	aspect-ratio: var(--ng-ratio);
}

.nadir-gallery--auto .nadir-gallery__trigger {
	aspect-ratio: auto;
}

.nadir-gallery__trigger:focus {
	outline: none;
}

.nadir-gallery__trigger:focus-visible {
	outline: 1px solid rgba(255, 255, 255, 0.7);
	outline-offset: 2px;
}

.nadir-gallery__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: grayscale(1) contrast(var(--ng-contrast)) brightness(var(--ng-brightness));
	transition: filter var(--ng-transition), transform var(--ng-transition);
	will-change: filter;
}

.nadir-gallery--auto .nadir-gallery__img {
	height: auto;
	object-fit: contain;
}

/* ---- Layers -------------------------------------------------------------
 * Κάθε layer κάνει blend απευθείας πάνω στη φωτογραφία, όχι μεταξύ τους.
 * 1. .nadir-gallery__grain          → χοντρός κόκκος            (overlay)
 * 2. .nadir-gallery__trigger::before→ ψιλός κόκκος              (multiply)
 * 3. .nadir-gallery__trigger::after → μπάντα dropout           (screen)
 * 4. .nadir-gallery__item::after    → άνιση φωτεινότητα + vignette (multiply)
 * -------------------------------------------------------------------- */

.nadir-gallery__grain,
.nadir-gallery__trigger::before,
.nadir-gallery__trigger::after,
.nadir-gallery__item::before,
.nadir-gallery__item::after {
	position: absolute;
	inset: 0;
	pointer-events: none;
	transition: opacity var(--ng-transition);
}

.nadir-gallery__trigger::before,
.nadir-gallery__trigger::after,
.nadir-gallery__item::before,
.nadir-gallery__item::after {
	content: "";
}

/* 1. χοντρός κόκκος — δύο κλίμακες ώστε να μη δείχνει σαν μοτίβο */
.nadir-gallery__grain {
	opacity: var(--ng-grain-opacity);
	mix-blend-mode: overlay;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='ngn'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23ngn)' opacity='0.6'/%3E%3C/svg%3E"),
		url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='ngn2'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='3' seed='29' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23ngn2)' opacity='0.6'/%3E%3C/svg%3E");
	background-size:
		calc(var(--ng-grain-size) * var(--ng-scale)) calc(var(--ng-grain-size) * var(--ng-scale)),
		calc(var(--ng-grain-size) * var(--ng-scale) * 1.75) calc(var(--ng-grain-size) * var(--ng-scale) * 1.75);
	background-position:
		var(--ng-shift-x) var(--ng-shift-y),
		calc(var(--ng-shift-x) * -1.6 + 37px) calc(var(--ng-shift-y) * 1.4 + 53px);
	background-repeat: repeat, repeat;
}

/* 2. ψιλός κόκκος */
.nadir-gallery__trigger::before {
	z-index: 1;
	opacity: var(--ng-fine-opacity);
	mix-blend-mode: multiply;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='ngf'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='1.5' intercept='-0.15'/%3E%3CfeFuncG type='linear' slope='1.5' intercept='-0.15'/%3E%3CfeFuncB type='linear' slope='1.5' intercept='-0.15'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23ngf)' opacity='0.65'/%3E%3C/svg%3E"),
		url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='ngf2'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.05' numOctaves='2' seed='23' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23ngf2)' opacity='0.65'/%3E%3C/svg%3E");
	background-size:
		calc(var(--ng-fine-size) * var(--ng-scale)) calc(var(--ng-fine-size) * var(--ng-scale)),
		calc(var(--ng-fine-size) * var(--ng-scale) * 1.45) calc(var(--ng-fine-size) * var(--ng-scale) * 1.45);
	background-position:
		var(--ng-shift-x) var(--ng-shift-y),
		calc(var(--ng-shift-x) * -1.2 + 19px) calc(var(--ng-shift-y) * 1.8 + 67px);
	background-repeat: repeat, repeat;
}

/* 3. οριζόντια μπάντα dropout (tracking της ταινίας) */
.nadir-gallery__trigger::after {
	z-index: 2;
	opacity: var(--ng-wear-strength);
	mix-blend-mode: screen;
	background-image: linear-gradient(
		to bottom,
		rgba(255, 255, 255, 0) 0%,
		rgba(255, 255, 255, calc(var(--ng-dropout-opacity, 0) * 0.55)) 30%,
		rgba(255, 255, 255, var(--ng-dropout-opacity, 0)) 50%,
		rgba(255, 255, 255, calc(var(--ng-dropout-opacity, 0) * 0.45)) 68%,
		rgba(255, 255, 255, 0) 100%
	);
	background-size: 100% var(--ng-dropout-height, 14px);
	background-position: 0 var(--ng-dropout-y, 50%);
	background-repeat: no-repeat;
}

/* 4. scanlines οθόνης — δικό τους layer ώστε η ένταση να ρυθμίζεται μόνη της */
.nadir-gallery__item::before {
	z-index: 3;
	opacity: calc(var(--ng-scanline-opacity) * var(--ng-wear-strength));
	mix-blend-mode: multiply;
	background-image: repeating-linear-gradient(
		0deg,
		rgba(0, 0, 0, 1) 0,
		rgba(0, 0, 0, 1) 1px,
		rgba(0, 0, 0, 0) 1px,
		rgba(0, 0, 0, 0) var(--ng-scanline-gap)
	);
}

/* 5. άνιση φωτεινότητα οθόνης + vignette γωνιών */
.nadir-gallery__item::after {
	z-index: 4;
	opacity: var(--ng-wear-strength);
	mix-blend-mode: multiply;
	background-image:
		radial-gradient(
			ellipse var(--ng-blotch-size, 55%) calc(var(--ng-blotch-size, 55%) * 0.78)
			at var(--ng-blotch-x, 12%) var(--ng-blotch-y, 8%),
			rgba(0, 0, 0, var(--ng-blotch-opacity, 0)) 0%,
			rgba(0, 0, 0, calc(var(--ng-blotch-opacity, 0) * 0.45)) 42%,
			rgba(0, 0, 0, 0) 74%
		),
		radial-gradient(
			ellipse 78% 78% at 50% 50%,
			rgba(0, 0, 0, 0) 46%,
			rgba(0, 0, 0, var(--ng-vignette)) 100%
		);
}

/* Κύκλος 11 — πρώτος αριθμός, δεν συγχρονίζεται ούτε με τις στήλες ούτε με
   τον κύκλο 7 του κόκκου. Μηδενικά = καθαρή φωτογραφία. */
.nadir-gallery__item:nth-child(11n + 1)  { --ng-blotch-opacity: 0.4;  --ng-blotch-size: 58%; --ng-blotch-x: 96%;  --ng-blotch-y: 4%;   --ng-dropout-opacity: 0.16; --ng-dropout-y: 22%; --ng-dropout-height: 18px; }
.nadir-gallery__item:nth-child(11n + 2)  { --ng-blotch-opacity: 0;                                                                      --ng-dropout-opacity: 0; }
.nadir-gallery__item:nth-child(11n + 3)  { --ng-blotch-opacity: 0.22; --ng-blotch-size: 34%; --ng-blotch-x: -6%;  --ng-blotch-y: 66%;  --ng-dropout-opacity: 0.1;  --ng-dropout-y: 71%; --ng-dropout-height: 9px; }
.nadir-gallery__item:nth-child(11n + 4)  { --ng-blotch-opacity: 0.48; --ng-blotch-size: 72%; --ng-blotch-x: 104%; --ng-blotch-y: 92%;  --ng-dropout-opacity: 0; }
.nadir-gallery__item:nth-child(11n + 5)  { --ng-blotch-opacity: 0.15; --ng-blotch-size: 26%; --ng-blotch-x: 34%;  --ng-blotch-y: 104%; --ng-dropout-opacity: 0.2;  --ng-dropout-y: 48%; --ng-dropout-height: 24px; }
.nadir-gallery__item:nth-child(11n + 6)  { --ng-blotch-opacity: 0;                                                                      --ng-dropout-opacity: 0.08; --ng-dropout-y: 12%; --ng-dropout-height: 7px; }
.nadir-gallery__item:nth-child(11n + 7)  { --ng-blotch-opacity: 0.32; --ng-blotch-size: 46%; --ng-blotch-x: 2%;   --ng-blotch-y: 8%;   --ng-dropout-opacity: 0; }
.nadir-gallery__item:nth-child(11n + 8)  { --ng-blotch-opacity: 0.44; --ng-blotch-size: 64%; --ng-blotch-x: 88%;  --ng-blotch-y: 48%;  --ng-dropout-opacity: 0.13; --ng-dropout-y: 86%; --ng-dropout-height: 14px; }
.nadir-gallery__item:nth-child(11n + 9)  { --ng-blotch-opacity: 0;                                                                      --ng-dropout-opacity: 0; }
.nadir-gallery__item:nth-child(11n + 10) { --ng-blotch-opacity: 0.19; --ng-blotch-size: 30%; --ng-blotch-x: 56%;  --ng-blotch-y: -8%;  --ng-dropout-opacity: 0.11; --ng-dropout-y: 37%; --ng-dropout-height: 11px; }
.nadir-gallery__item:nth-child(11n + 11) { --ng-blotch-opacity: 0.36; --ng-blotch-size: 50%; --ng-blotch-x: 8%;   --ng-blotch-y: 98%;  --ng-dropout-opacity: 0.18; --ng-dropout-y: 60%; --ng-dropout-height: 20px; }

@media (hover: hover) and (pointer: fine) {
	.nadir-gallery__trigger:hover .nadir-gallery__img,
	.nadir-gallery__trigger:focus-visible .nadir-gallery__img {
		filter: grayscale(0) contrast(var(--ng-hover-contrast)) brightness(var(--ng-hover-brightness));
	}

	.nadir-gallery__trigger:hover .nadir-gallery__grain,
	.nadir-gallery__trigger:hover::before,
	.nadir-gallery__trigger:hover::after,
	.nadir-gallery__trigger:focus-visible .nadir-gallery__grain,
	.nadir-gallery__trigger:focus-visible::before,
	.nadir-gallery__trigger:focus-visible::after {
		opacity: 0;
	}

	.nadir-gallery__item:hover::before,
	.nadir-gallery__item:hover::after,
	.nadir-gallery__item:focus-within::before,
	.nadir-gallery__item:focus-within::after {
		opacity: 0;
	}
}

/* Load more */
.nadir-gallery__footer {
	display: flex;
	justify-content: center;
	margin-top: calc(var(--ng-gap) * 2.2);
}

.nadir-gallery__more {
	display: inline-block;
	padding: 0 0 var(--ng-more-underline);
	margin: 0 calc(var(--ng-more-tracking) * -1) 0 0;
	border: 0;
	border-bottom: 1px solid currentColor;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.8125rem;
	letter-spacing: var(--ng-more-tracking);
	text-transform: uppercase;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 250ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.nadir-gallery__more:hover,
.nadir-gallery__more:focus-visible {
	opacity: 1;
}

/* Responsive: 3 desktop / 2 tablet / 1 mobile */
@media (max-width: 1024px) {
	.nadir-gallery {
		--ng-columns: 2;
	}
}

@media (max-width: 640px) {
	.nadir-gallery {
		--ng-columns: 1;
	}
}

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

.nadir-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 320ms ease, visibility 0s linear 320ms;
	-webkit-tap-highlight-color: transparent;
}

.nadir-lightbox.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity 320ms ease, visibility 0s;
}

.nadir-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.82);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	cursor: pointer;
}

.nadir-lightbox__stage {
	position: relative;
	line-height: 0;
	max-width: 100vw;
	max-height: 100vh;
	transform: scale(0.985);
	transition: transform 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.nadir-lightbox.is-open .nadir-lightbox__stage {
	transform: scale(1);
}

.nadir-lightbox__img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100vw;
	max-height: 100vh;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	opacity: 1;
	transition: opacity 200ms ease;
}

.nadir-lightbox.is-loading .nadir-lightbox__img {
	opacity: 0.25;
}

.nadir-lightbox__close {
	position: absolute;
	top: 0;
	right: 0;
	width: 54px;
	height: 54px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	border: 0;
	background: none;
	color: #fff;
	cursor: pointer;
	opacity: 0.75;
	transition: opacity 200ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.nadir-lightbox__close:hover,
.nadir-lightbox__close:focus-visible {
	opacity: 1;
}

.nadir-lightbox__close svg {
	width: 18px;
	height: 18px;
	filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.7));
}

.nadir-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 64px;
	height: 64px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	border: 0;
	background: none;
	color: #fff;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 200ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.nadir-lightbox__nav:hover,
.nadir-lightbox__nav:focus-visible {
	opacity: 1;
}

.nadir-lightbox__nav svg {
	width: 22px;
	height: 22px;
	filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.7));
}

.nadir-lightbox__nav--prev {
	left: 4px;
}

.nadir-lightbox__nav--next {
	right: 4px;
}

.nadir-lightbox__nav[hidden] {
	display: none;
}

.nadir-lightbox__caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	margin: 0;
	padding: 40px 20px 16px;
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.8125rem;
	line-height: 1.5;
	text-align: center;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
	pointer-events: none;
}

.nadir-lightbox__caption:empty {
	display: none;
}

@media (max-width: 640px) {
	.nadir-lightbox__nav {
		width: 48px;
		height: 48px;
	}

	.nadir-lightbox__nav svg {
		width: 18px;
		height: 18px;
	}
}

.nadir-lightbox-open {
	overflow: hidden !important;
}

@media (prefers-reduced-motion: reduce) {
	.nadir-gallery__img,
	.nadir-gallery__grain,
	.nadir-gallery__trigger::before,
	.nadir-gallery__trigger::after,
	.nadir-gallery__item::before,
	.nadir-gallery__item::after,
	.nadir-lightbox,
	.nadir-lightbox__stage {
		transition-duration: 1ms !important;
	}
}
