/* ==========================================================================
   Payan — design system
   ========================================================================== */

@font-face { font-family: "Payan Sans"; src: url("../fonts/Vazirmatn-FD-ExtraLight.woff2") format("woff2"); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: "Payan Sans"; src: url("../fonts/Vazirmatn-FD-Light.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Payan Sans"; src: url("../fonts/Vazirmatn-FD-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Payan Sans"; src: url("../fonts/Vazirmatn-FD-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
	/* Color */
	--c-bg: #222224;          /* page */
	--c-bg-deep: #1b1b1d;     /* framed media */
	--c-surface: #2b2b2e;     /* tiles, empty media */
	--c-line: #3b3b3f;        /* frame borders, bar track */
	--c-text: #ececec;        /* primary text */
	--c-text-2: #9d9da2;      /* secondary text */
	--c-accent: #c6e4b1;      /* green: logo dot, gallery name, highlights */
	--c-overlay: rgba(14, 14, 15, 0.72);

	/* Type */
	--font: "Payan Sans", Vazirmatn, Tahoma, system-ui, sans-serif;
	--fs-xs: 0.75rem;     /* 12 */
	--fs-sm: 0.8125rem;   /* 13 */
	--fs-base: 0.875rem;  /* 14 */
	--fs-md: 1rem;        /* 16 */
	--fs-lg: clamp(1.1875rem, 1.05rem + 0.6vw, 1.5rem);    /* 19 → 24 */
	--fs-xl: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);       /* 28 → 40 */
	--fs-display: clamp(2.75rem, 1.9rem + 3.4vw, 4.5rem);  /* 44 → 72 */
	--lh-tight: 1.5;
	--lh-body: 2;

	/* Space (4px scale) */
	--s-1: 4px;
	--s-2: 8px;
	--s-3: 12px;
	--s-4: 16px;
	--s-5: 24px;
	--s-6: 32px;
	--s-7: 48px;
	--s-8: 64px;
	--s-9: 96px;
	--s-10: 128px;

	/* Layout */
	--gutter: clamp(24px, 11vw, 200px);
	--maxw: 1600px;
	--grid-gap: 3px;

	--ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (min-width: 1024px) {
	:root { --fs-base: 0.9375rem; } /* 15 */
}

/* Base ------------------------------------------------------------------- */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	background: var(--c-bg);
	color-scheme: dark;
	scrollbar-gutter: stable; /* no layout jump when the popup locks scrolling */
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100svh;
	direction: rtl;
	text-align: right;
	font-family: var(--font);
	font-size: var(--fs-base);
	font-weight: 400;
	line-height: var(--lh-body);
	color: var(--c-text);
	background: var(--c-bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	padding-bottom: env(safe-area-inset-bottom, 0px);
}

h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; }
h1, h2, h3, h4 { font-weight: 400; }
ul[role="list"] { list-style: none; padding: 0; }
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
em { font-style: normal; color: var(--c-accent); }
::selection { background: var(--c-accent); color: var(--c-bg); }

:focus-visible { outline: 1px solid var(--c-accent); outline-offset: 4px; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
.skip-link:focus {
	clip: auto; width: auto; height: auto; margin: 0;
	top: var(--s-3); right: var(--s-3);
	z-index: 2000;
	padding: var(--s-2) var(--s-4);
	background: var(--c-text); color: var(--c-bg);
}

.container {
	width: 100%;
	max-width: calc(var(--maxw) + 2 * var(--gutter));
	margin-inline: auto;
	padding-inline: var(--gutter);
}

/* Logo ------------------------------------------------------------------- */

.logo { width: 100%; height: auto; }
svg.logo { color: var(--c-text); fill: currentColor; }
.logo__dot { fill: var(--c-accent); }

/* Text links ("ورود به پایان", "ارتباط با ما") ---------------------------- */

.link {
	display: inline-block;
	padding-bottom: var(--s-2);
	border-bottom: 1px solid currentColor;
	font-size: var(--fs-base);
	line-height: var(--lh-tight);
	transition: color 0.2s ease;
}
.link--primary { color: var(--c-text); }
.link--secondary { color: var(--c-text-2); }
.link--primary:hover { color: var(--c-accent); }
.link--secondary:hover { color: var(--c-accent); }

/* Icon buttons ----------------------------------------------------------- */

.icon-btn {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin-inline-end: -10px; /* optical alignment with the content edge */
	color: var(--c-text);
	transition: color 0.2s ease;
}
.icon-btn:hover { color: var(--c-accent); }
.icon { width: 24px; height: 24px; }

/* Header ----------------------------------------------------------------- */

.site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--s-4);
	padding-top: max(var(--s-5), env(safe-area-inset-top, 0px));
	min-height: 72px;
}
.site-header__logo { display: block; width: clamp(128px, 36vw, 150px); }
.site-header__logo img.logo { max-height: 36px; width: auto; }

/* Splash ----------------------------------------------------------------- */

.splash {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: grid;
	place-items: center;
	background: var(--c-bg);
	animation: splash-out 0.5s var(--ease) var(--splash-duration, 3s) forwards;
}
.no-splash .splash { display: none; }
html.is-splashing { overflow: hidden; }

.splash__inner { width: clamp(240px, 66vw, 360px); }
.splash__bar {
	margin-top: var(--s-5);
	height: 1px;
	background: var(--c-line);
	overflow: hidden;
}
.splash__bar span {
	display: block;
	height: 100%;
	background: var(--c-text);
	transform: scaleX(0);
	transform-origin: right center; /* fills right → left, like the text */
	animation: splash-bar var(--splash-duration, 3s) cubic-bezier(0.45, 0.05, 0.35, 1) forwards;
}

@keyframes splash-bar { to { transform: scaleX(1); } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }

/* Home ------------------------------------------------------------------- */

.home {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100svh;
}
.home__main {
	flex: 1;
	display: flex;
	align-items: center;
	padding-block: var(--s-9) var(--s-7);
}
.home__content { max-width: 34rem; }
.home__logo { width: clamp(210px, 58vw, 300px); }

.home__title {
	margin-top: var(--s-6);
	font-size: var(--fs-lg);
	line-height: 1.85;
	max-width: 22em;
}
.home__desc {
	margin-top: var(--s-6);
	max-width: 28em;
}
.home__venue {
	margin-top: var(--s-4);
	font-size: var(--fs-sm);
	color: var(--c-text-2);
}
.home__venue-name { color: var(--c-accent); }
.home__venue .sep { margin-inline: var(--s-2); color: var(--c-text-2); }
.home__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s-5) var(--s-7);
	margin-top: var(--s-7);
}
.home__footer {
	padding-bottom: max(var(--s-6), env(safe-area-inset-bottom, 0px));
	font-size: var(--fs-sm);
	color: var(--c-text-2);
}

/* Framed media (installation banner) ------------------------------------- */

.frame {
	position: relative;
	display: block;
	overflow: hidden;
	background: var(--c-bg-deep);
	border: 1px solid var(--c-line);
}
.frame--hero { aspect-ratio: 16 / 7; }
.frame > img,
.frame > video,
.frame > .placeholder {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
a.frame > img, a.frame > video { transition: opacity 0.3s ease; }
a.frame:hover > img, a.frame:hover > video { opacity: 0.88; }

@media (min-width: 768px) {
	.frame--hero { aspect-ratio: 8 / 3; }
}

.placeholder { fill: none; stroke: #4a4a4f; stroke-width: 0.4; background: var(--c-surface); }

/* Works ------------------------------------------------------------------ */

.works { padding-block: var(--s-6) var(--s-9); }

.statement {
	margin-top: var(--s-8);
	max-width: 38em;
	line-height: 2.1;
}
.statement p + p { margin-top: 0; }

@media (min-width: 1024px) {
	.statement { font-size: var(--fs-sm); max-width: 44em; }
}

.art-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--grid-gap);
	margin-top: var(--s-8);
}
.art-grid__item a {
	position: relative;
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	background: var(--c-surface);
}
.art-grid__item img,
.art-grid__item .placeholder {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: opacity 0.3s ease;
}
.art-grid__item a:hover img { opacity: 0.82; }

@media (min-width: 640px)  { .art-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .art-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1440px) { .art-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.empty { margin-top: var(--s-8); color: var(--c-text-2); }

/* Shared detail blocks --------------------------------------------------- */

.specs li { line-height: 2.2; }
.prose { max-width: 40em; }
.prose p + p { margin-top: var(--s-3); }
.prose a { border-bottom: 1px solid currentColor; }

.page-cta {
	display: flex;
	justify-content: flex-start; /* right edge in RTL */
	margin-top: var(--s-9);
}

/* Installation ----------------------------------------------------------- */

.installation { padding-block: var(--s-6) var(--s-8); }
.installation__body { margin-top: var(--s-8); }

.display {
	font-size: var(--fs-display);
	font-weight: 300;
	line-height: 1.25;
}
.installation__date {
	margin-top: var(--s-3);
	font-size: var(--fs-sm);
	color: var(--c-text-2);
}
.installation .specs { margin-top: var(--s-6); }
.installation .prose { margin-top: var(--s-6); }
.note {
	margin-top: var(--s-6);
	max-width: 40em;
	font-size: var(--fs-sm);
	color: var(--c-text-2);
}

.gallery {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--grid-gap);
	margin-top: var(--s-8);
}
.gallery__item {
	position: relative;
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	background: var(--c-surface);
	border: 1px solid var(--c-line);
}
.gallery__item img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.gallery__item:first-child { grid-column: 1 / -1; aspect-ratio: 4 / 3; }
.gallery__item:nth-child(even):last-child { grid-column: 1 / -1; aspect-ratio: 4 / 3; }

@media (min-width: 768px) {
	/* One large (2:1) beside two small (2:1) stacked — repeats every 3 images. */
	.gallery { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
	.gallery__item,
	.gallery__item:first-child { grid-column: auto; aspect-ratio: 2 / 1; }
	.gallery__item:nth-child(even):last-child { grid-column: auto; aspect-ratio: 2 / 1; }
	.gallery__item:nth-child(3n + 1) { grid-row: span 2; aspect-ratio: auto; min-height: 100%; }
	.gallery__item:nth-child(3n + 1):last-child { grid-column: 1 / -1; grid-row: auto; aspect-ratio: 3 / 1; }
}

/* Artwork ---------------------------------------------------------------- */

.artwork { padding-block: var(--s-7) var(--s-8); }

.artwork__layout {
	display: grid;
	gap: var(--s-7);
}
.artwork__media img {
	width: 100%;
	max-height: 82svh;
	object-fit: contain;
	object-position: center top;
}
.artwork__placeholder {
	aspect-ratio: 1;
	background: var(--c-surface);
}
.artwork__placeholder .placeholder { width: 100%; height: 100%; }

.artwork__title {
	font-size: var(--fs-xl);
	line-height: 1.4;
}
.artwork__artist {
	margin-top: var(--s-3);
	color: var(--c-text-2);
}
.artwork__desc { margin-top: var(--s-7); }
.artwork__specs { margin-top: var(--s-6); }

.next-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--s-4);
	margin-top: var(--s-8);
	padding-block: var(--s-2);
}
.next-link__label {
	display: block;
	font-size: var(--fs-xs);
	color: var(--c-text-2);
}
.next-link__title {
	display: block;
	font-size: var(--fs-md);
	line-height: 1.7;
	transition: color 0.2s ease;
}
.next-link__icon { color: var(--c-text-2); transition: transform 0.3s var(--ease), color 0.2s ease; }
.next-link:hover .next-link__title { color: var(--c-accent); }
.next-link:hover .next-link__icon { color: var(--c-text); transform: translateX(-6px); }

@media (min-width: 900px) {
	.artwork { padding-top: var(--s-8); }
	.artwork__layout {
		grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
		gap: clamp(48px, 7vw, 112px);
		align-items: start;
	}
	.artwork__info { max-width: 26rem; padding-top: var(--s-2); }
	.artwork__desc, .artwork__specs { font-size: var(--fs-sm); }
	.artwork__artist { font-size: var(--fs-sm); }
	.artwork .page-cta { margin-top: var(--s-8); }
}

/* Plain pages ------------------------------------------------------------ */

.page { padding-block: var(--s-8) var(--s-9); }
.page__entry + .page__entry { margin-top: var(--s-8); }
.page__title { font-size: var(--fs-xl); line-height: 1.4; margin-bottom: var(--s-4); }
.page__lead { color: var(--c-text-2); }
.page__actions { margin-top: var(--s-7); }

/* Popup (Creativity Club) ------------------------------------------------
   Opened/closed with a class toggle (.is-open) and plain CSS transitions:
   mobile = sheet sliding up from the bottom, desktop = centered window. */

.popup {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	color: var(--c-text);
	overflow: hidden;
	overflow: clip; /* the off-screen panel must never be scrolled into view by focus */
	background-color: rgba(14, 14, 15, 0);
	transition: background-color 0.28s ease;
}
.popup[open] {
	display: flex;
	align-items: flex-end;
	justify-content: center;
}
.popup::backdrop { background: transparent; }
.popup.is-open { background-color: var(--c-overlay); transition-duration: 0.4s; }
.popup.is-fallback { z-index: 900; }
html.is-locked { overflow: hidden; }

.popup__panel {
	width: 100%;
	max-height: 90svh;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--c-bg);
	padding: var(--s-5) var(--s-5) calc(var(--s-7) + env(safe-area-inset-bottom, 0px));
	transform: translate3d(0, 100%, 0);
	/* Closing: accelerate downwards. */
	transition: transform 0.28s cubic-bezier(0.4, 0, 1, 1);
	will-change: transform;
}
/* Opening: standard bottom-sheet deceleration. */
.popup.is-open .popup__panel {
	transform: translate3d(0, 0, 0);
	transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.popup__top {
	display: flex;
	justify-content: flex-end; /* close button on the left in RTL */
	margin-bottom: var(--s-7);
}
.popup__title { font-size: var(--fs-lg); line-height: 1.6; }
.popup__desc { margin-top: var(--s-3); font-size: var(--fs-sm); line-height: 2; max-width: 34em; }

.popup__list {
	display: grid;
	gap: var(--s-5);
	margin-top: var(--s-7);
}
.popup__item {
	display: flex;
	align-items: center;
	gap: var(--s-4);
}
.popup__avatar {
	flex: none;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--c-surface);
}
.popup__text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	line-height: 1.6;
}
.popup__name { font-size: var(--fs-base); }
.popup__sub { font-size: var(--fs-sm); color: var(--c-text-2); }
.popup__ext { flex: none; color: var(--c-text-2); transition: color 0.2s ease; }
.popup__item:hover .popup__ext { color: var(--c-text); }
.popup__item:hover .popup__name { color: var(--c-accent); }

@media (min-width: 768px) {
	.popup[open] { align-items: center; }
	.popup__panel {
		width: min(540px, calc(100% - 2 * var(--s-6)));
		max-height: calc(100svh - 2 * var(--s-6));
		padding: var(--s-6) var(--s-7) var(--s-7);
		opacity: 0;
		transform: translate3d(0, 16px, 0);
		transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.4, 0, 1, 1);
	}
	.popup.is-open .popup__panel {
		opacity: 1;
		transform: translate3d(0, 0, 0);
		transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
	}
	.popup__top { margin-inline-end: calc(-1 * var(--s-3)); }
}

/* Page entrance: artwork + installation details fade in ------------------ */

main.installation,
main.artwork { animation: page-fade 0.5s ease-out both; }

@keyframes page-fade { from { opacity: 0; } }

/* Closing a detail page: fade out, then the works page fades in. */
main.is-leaving { animation: page-fade-out 0.5s ease-out forwards; }
@keyframes page-fade-out { from { opacity: 1; } to { opacity: 0; } }
html.fade-in-page main.works,
main.works.is-entering { animation: page-fade 0.5s ease-out both; }

/* Image viewer (full-screen preview) ------------------------------------- */

.artwork__media img,
main.installation .frame img,
.gallery__item img { cursor: zoom-in; }

html.is-viewing { overflow: hidden; background: #121214; }

.lightbox {
	position: fixed;
	inset: 0;
	z-index: 950;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
}
.lightbox[hidden] { display: none; }

.lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: #121214;
	opacity: 0;
	transition: opacity 0.3s ease;
}
.lightbox.is-open .lightbox__backdrop { opacity: 1; }

.lightbox__stage {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: max(64px, env(safe-area-inset-top, 0px)) 0 max(56px, env(safe-area-inset-bottom, 0px));
	overflow: hidden;
	opacity: 0;
	transform: scale(0.97);
	transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.lightbox.is-open .lightbox__stage { opacity: 1; transform: none; }

.lightbox__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	transform-origin: center center;
	transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.16s ease;
	will-change: transform;
	-webkit-user-drag: none;
	cursor: zoom-in;
}
.lightbox.is-zoomed .lightbox__img { cursor: grab; }
.lightbox.is-dragging .lightbox__img,
.lightbox.is-dragging .lightbox__backdrop { transition: none; }
.lightbox.is-switching .lightbox__img { opacity: 0; }

.lightbox__close {
	position: absolute;
	top: max(12px, env(safe-area-inset-top, 0px));
	left: max(12px, env(safe-area-inset-left, 0px));
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: var(--c-text);
	background: rgba(18, 18, 20, 0.55);
	opacity: 0;
	transition: color 0.2s ease, opacity 0.3s ease;
}
.lightbox.is-open .lightbox__close { opacity: 1; }
.lightbox__close:hover { color: var(--c-accent); }

@media (min-width: 768px) {
	.lightbox__stage { padding: 72px 88px; }
	.lightbox__close { top: 20px; left: 20px; }
}

/* Motion preferences ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: 0.01ms !important; }
	.splash { animation-duration: 0.01ms; }
	main.installation, main.artwork, main.works { animation: none !important; }
	main.is-leaving { animation: none !important; }
	.lightbox__img, .lightbox__stage, .lightbox__backdrop { transition-duration: 0.01ms !important; }
}
