/* ==========================================================================
   Kossela — galeria autorska
   ========================================================================== */

:root {
	--wall: #f3efe8;          /* ciepła „ściana galerii” */
	--wall-2: #ebe5db;
	--ink: #24201c;
	--ink-soft: #6d655c;
	--accent: #865a32;        /* ochra / złoto ramy — 5.2:1 na tle --wall (WCAG AA) */
	--accent-light: #d9b48a;  /* akcent na ciemnym tle — 9.7:1 */
	--dark: #14110f;
	--serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
	--sans: "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
	--ease: cubic-bezier(.22, .61, .36, 1);
	--gutter: clamp(1.25rem, 4vw, 3.5rem);
}

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

html {
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--wall);
	color: var(--ink);
	font: 400 1rem/1.6 var(--sans);
	-webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

button { font: inherit; color: inherit; }

:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* cele skoków (np. z linku „Przejdź do galerii”) nie potrzebują obwódki */
[tabindex="-1"]:focus { outline: none; }

.visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: fixed;
	top: .75rem;
	left: .75rem;
	z-index: 100;
	padding: .75rem 1.25rem;
	background: var(--ink);
	color: #fff;
	font-size: .9rem;
	text-decoration: none;
	transform: translateY(-200%);
	transition: transform .2s var(--ease);
}

.skip-link:focus { transform: none; }

/* ---------- Pasek górny ---------- */

.topbar {
	position: fixed;
	inset: 0 0 auto 0;
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: space-between;
	/* Domyślnie (także bez JS) pasek jest jasny i nieprzezroczysty;
	   przezroczysty z białym tekstem jest tylko nad hero, gdy działa JS. */
	padding: .7rem var(--gutter);
	background: rgba(243, 239, 232, .96);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	color: var(--ink);
	box-shadow: 0 1px 0 rgba(36, 32, 28, .08);
	transition: background-color .4s var(--ease), color .4s var(--ease), padding .4s var(--ease), box-shadow .4s var(--ease);
}

.js .topbar.is-over-hero {
	padding-block: 1.1rem;
	background: linear-gradient(to bottom, rgba(20, 17, 15, .4), rgba(20, 17, 15, 0));
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	color: #fff;
	box-shadow: none;
}

.topbar__brand {
	display: inline-block;
	padding: .4rem 0;
	font: 500 1.35rem/1 var(--serif);
	letter-spacing: .28em;
	text-transform: uppercase;
	text-decoration: none;
}

.topbar__nav { display: flex; gap: clamp(1rem, 3vw, 2.25rem); }

.topbar__nav a {
	position: relative;
	display: inline-block;
	padding: .55rem 0;
	font-size: .78rem;
	letter-spacing: .2em;
	text-transform: uppercase;
	text-decoration: none;
}

.topbar__nav a::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: .3rem;
	height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: right;
	transition: transform .35s var(--ease);
}

.topbar__nav a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Hero ---------- */

.hero {
	position: relative;
	height: 100vh;
	height: 100svh;
	min-height: 520px;
	overflow: hidden;
	background: var(--dark);
	color: #fff;
	display: grid;
	place-items: center;
	text-align: center;
}

.hero__slides { position: absolute; inset: 0; }

.hero__slide {
	position: absolute;
	inset: -2%;
	background: center / cover no-repeat;
	opacity: 0;
	transform: scale(1.04);
	transition: opacity 1.8s var(--ease);
}

.hero__slide.is-active {
	opacity: 1;
	animation: kenburns 14s linear forwards;
}

.hero.is-paused .hero__slide { animation-play-state: paused; }

@keyframes kenburns {
	from { transform: scale(1.04) translate3d(0, 0, 0); }
	to   { transform: scale(1.14) translate3d(-1.5%, -1%, 0); }
}

.hero::after {
	content: "";
	position: absolute;
	inset: 0;
	/* Ciemniejsze tło pod tekstem: biały tekst ma ≥ 4.5:1 nawet na jasnym niebie obrazu */
	background:
		radial-gradient(ellipse 60% 50% at center, rgba(20, 17, 15, .38) 0%, rgba(20, 17, 15, 0) 100%),
		linear-gradient(to bottom, rgba(20, 17, 15, .45) 0%, rgba(20, 17, 15, 0) 22%, rgba(20, 17, 15, 0) 60%, rgba(20, 17, 15, .7) 100%),
		rgba(20, 17, 15, .3);
	pointer-events: none;
}

.hero__content {
	position: relative;
	z-index: 2;
	padding: 0 var(--gutter);
	text-shadow: 0 2px 30px rgba(0, 0, 0, .35);
	animation: rise 1.4s .2s var(--ease) both;
}

@keyframes rise {
	from { opacity: 0; transform: translateY(24px); }
	to   { opacity: 1; transform: none; }
}

.hero__eyebrow,
.section-head__eyebrow {
	margin: 0 0 1rem;
	font-size: .75rem;
	letter-spacing: .38em;
	text-transform: uppercase;
}

.hero h1 { margin: 0; font-weight: inherit; }

.hero__title {
	display: block;
	margin: 0;
	font: 300 clamp(3.5rem, 13vw, 9.5rem)/.9 var(--serif);
	letter-spacing: .14em;
	margin-right: -.14em; /* wyrównanie optyczne dla letter-spacing */
	text-transform: uppercase;
}

.hero__subtitle {
	display: block;
	margin: 1.4rem 0 2.4rem;
	font: italic 300 clamp(1.15rem, 2.4vw, 1.6rem)/1.3 var(--serif);
	opacity: .92;
}

.hero__cta {
	display: inline-block;
	padding: .95rem 2.2rem;
	border: 1px solid rgba(255, 255, 255, .7);
	font-size: .75rem;
	letter-spacing: .3em;
	text-transform: uppercase;
	text-decoration: none;
	transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}

.hero__cta:hover { background: #fff; color: var(--ink); border-color: #fff; }

.hero__controls {
	position: absolute;
	z-index: 2;
	left: var(--gutter);
	bottom: 2rem;
	display: flex;
	align-items: center;
	gap: 1.25rem;
}

.hero__pause {
	order: -1;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .6);
	border-radius: 50%;
	background: rgba(20, 17, 15, .3);
	color: #fff;
	cursor: pointer;
	transition: background-color .25s;
}

.hero__pause[hidden] { display: none; }
.hero__pause:hover { background: rgba(20, 17, 15, .6); }
.hero__pause svg { width: 16px; height: 16px; fill: currentColor; }
.hero__pause .icon-play,
.hero.is-paused .hero__pause .icon-pause { display: none; }
.hero.is-paused .hero__pause .icon-play { display: block; }

.hero__caption {
	padding: .25rem 0;
	border: 0;
	background: none;
	cursor: pointer;
	text-align: left;
	font: italic 1.05rem/1.2 var(--serif);
	color: #fff;
}

.hero__caption[hidden] { display: none; }
.hero__caption:hover .hero__caption-title { text-decoration: underline; text-underline-offset: 3px; }

.hero__caption-label {
	display: block;
	margin-bottom: .3rem;
	font: normal .65rem/1 var(--sans);
	letter-spacing: .3em;
	text-transform: uppercase;
	opacity: .85;
}

.hero__caption-title { transition: opacity .6s; }
.hero__caption-title.is-fading { opacity: 0; }

.hero__scroll {
	position: absolute;
	z-index: 2;
	left: 50%;
	bottom: 1.75rem;
	width: 26px;
	height: 42px;
	margin-left: -13px;
	border: 1px solid rgba(255, 255, 255, .6);
	border-radius: 13px;
}

.hero__scroll span {
	position: absolute;
	left: 50%;
	top: 8px;
	width: 2px;
	height: 8px;
	margin-left: -1px;
	border-radius: 1px;
	background: #fff;
	animation: scrollhint 2s var(--ease) 4; /* skończona liczba powtórzeń (WCAG 2.2.2) */
}

@keyframes scrollhint {
	0%   { opacity: 0; transform: translateY(0); }
	30%  { opacity: 1; }
	100% { opacity: 0; transform: translateY(14px); }
}

/* ---------- Nagłówki sekcji ---------- */

.section-head {
	max-width: 40rem;
	margin: 0 auto clamp(3rem, 7vw, 5.5rem);
	text-align: center;
}

.section-head__eyebrow { color: var(--accent); }

.section-head__title {
	margin: 0;
	font: 300 clamp(2.6rem, 6vw, 4.25rem)/1 var(--serif);
	letter-spacing: .04em;
}

.section-head__title::after {
	content: "";
	display: block;
	width: 48px;
	height: 1px;
	margin: 1.6rem auto;
	background: var(--accent);
}

.section-head__lead {
	margin: 0;
	color: var(--ink-soft);
	font: 1.2rem/1.55 var(--serif);
}

/* ---------- Galeria ---------- */

.gallery {
	padding: clamp(5rem, 11vw, 9rem) var(--gutter) clamp(4rem, 8vw, 7rem);
}

.gallery__grid {
	max-width: 1500px;
	margin: 0 auto;
	columns: 3 300px;
	column-gap: clamp(1.5rem, 3.5vw, 3.25rem);
}

.gallery__grid.is-masonry {
	display: flex;
	align-items: flex-start;
	gap: clamp(1.5rem, 3.5vw, 3.25rem);
	columns: auto;
}

.gallery__col { flex: 1 1 0; min-width: 0; }

.work {
	break-inside: avoid;
	margin: 0 0 clamp(2.25rem, 4.5vw, 3.75rem);
}

.work__link {
	position: relative;
	display: block;
	overflow: hidden;
	background: var(--wall-2);
	box-shadow:
		0 1px 2px rgba(36, 32, 28, .12),
		0 14px 30px -14px rgba(36, 32, 28, .45);
	cursor: zoom-in;
	transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}

.work__link img {
	width: 100%;
	transition: transform 1.2s var(--ease), filter .6s var(--ease);
}

.work__link::after {
	/* delikatny refleks światła przy najechaniu */
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(120deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .18) 50%, rgba(255, 255, 255, 0) 70%);
	transform: translateX(-100%);
	transition: transform 1.1s var(--ease);
	pointer-events: none;
}

.work__link:hover,
.work__link:focus-visible {
	transform: translateY(-4px);
	box-shadow:
		0 2px 4px rgba(36, 32, 28, .12),
		0 26px 48px -18px rgba(36, 32, 28, .55);
}

.work__link:hover img { transform: scale(1.035); }
.work__link:hover::after { transform: translateX(100%); }

.work figcaption {
	padding-top: 1.05rem;
}

.work__title {
	margin: 0;
	font: 400 1.4rem/1.2 var(--serif);
}

.work__meta {
	margin: .3rem 0 0;
	color: var(--ink-soft);
	font-size: .82rem;
	line-height: 1.5;
}

.work__size {
	white-space: nowrap;
	color: var(--accent);
}

.work__size::before { content: "· "; color: var(--ink-soft); }

/* Pojawianie się przy przewijaniu (tylko z JS) */
.js .work {
	opacity: 0;
	transform: translateY(28px);
	transition: opacity .9s var(--ease), transform .9s var(--ease);
}

.js .work.is-visible { opacity: 1; transform: none; }

/* ---------- Kontakt / stopka ---------- */

.contact {
	padding: clamp(5rem, 10vw, 8rem) var(--gutter);
	background: var(--dark);
	color: #f3efe8;
	text-align: center;
}

.contact .section-head__eyebrow { color: var(--accent-light); }

.contact__title {
	margin: 0;
	font: 300 clamp(2.2rem, 5vw, 3.5rem)/1.1 var(--serif);
}

.contact__lead {
	margin: 1rem 0 2rem;
	color: rgba(243, 239, 232, .65);
	font: italic 1.2rem/1.5 var(--serif);
}

.contact__mail {
	display: inline-block;
	padding-bottom: .3rem;
	border-bottom: 1px solid var(--accent-light);
	font: 400 clamp(1.3rem, 3vw, 1.9rem)/1.2 var(--serif);
	letter-spacing: .03em;
	text-decoration: none;
	transition: color .3s;
}

.contact__mail:hover { color: var(--accent-light); }

.contact__elsewhere {
	margin: 2.75rem 0 0;
	color: rgba(243, 239, 232, .7);
	font: italic 1.05rem/1.5 var(--serif);
}

.contact__elsewhere a {
	color: var(--accent-light);
	text-underline-offset: 3px;
}

.contact__elsewhere a:hover { text-decoration-thickness: 2px; }

.footer {
	padding: 1.5rem var(--gutter);
	background: var(--dark);
	border-top: 1px solid rgba(243, 239, 232, .08);
	color: rgba(243, 239, 232, .62);
	font-size: .75rem;
	letter-spacing: .12em;
	text-align: center;
}

.footer p { margin: 0; }

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

.lightbox {
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: #0c0a09;
	color: #f3efe8;
	overflow: hidden;
	opacity: 0;
	transition: opacity .35s var(--ease);
}

.lightbox[open] { display: grid; grid-template-rows: 1fr auto; }
.lightbox.is-shown { opacity: 1; }
.lightbox::backdrop { background: transparent; }
.lightbox:focus { outline: none; }

.lightbox__stage {
	position: relative;
	min-height: 0;
	--pad-y: clamp(1rem, 4vh, 3rem);
	--pad-x: clamp(1rem, 7vw, 6.5rem);
	touch-action: pan-y pinch-zoom;
}

.lightbox__img {
	position: absolute;
	inset: var(--pad-y) var(--pad-x) 0;
	margin: auto;
	max-width: calc(100% - 2 * var(--pad-x));
	max-height: calc(100% - var(--pad-y));
	width: auto;
	height: auto;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
	opacity: 0;
	transform: scale(.985);
	transition: opacity .45s var(--ease), transform .6s var(--ease);
	user-select: none;
	-webkit-user-drag: none;
}

.lightbox__img.is-loaded { opacity: 1; transform: none; }

.lightbox__spinner {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 2px solid rgba(243, 239, 232, .15);
	border-top-color: rgba(243, 239, 232, .7);
	border-radius: 50%;
	animation: spin .9s linear infinite;
	opacity: 0;
	transition: opacity .3s .25s;
	pointer-events: none;
}

.lightbox.is-loading .lightbox__spinner { opacity: 1; }

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

.lightbox__bar {
	display: grid;
	grid-template-columns: 1fr auto auto;
	align-items: center;
	gap: 1.5rem;
	padding: 1.1rem clamp(1rem, 7vw, 6.5rem) 1.4rem;
}

.lightbox__title {
	margin: 0;
	font: 400 clamp(1.25rem, 2.2vw, 1.6rem)/1.2 var(--serif);
}

.lightbox__meta {
	margin: .25rem 0 0;
	color: rgba(243, 239, 232, .6);
	font-size: .82rem;
}

.lightbox__meta .work__size { color: var(--accent-light); }
.lightbox__meta .work__size::before { color: rgba(243, 239, 232, .6); }

.lightbox__counter {
	margin: 0;
	color: rgba(243, 239, 232, .65);
	font: italic 1.05rem/1 var(--serif);
	font-variant-numeric: tabular-nums;
}

.lightbox__controls { display: flex; gap: .5rem; }

.lb-btn {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(243, 239, 232, .4);
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: background-color .25s, border-color .25s;
}

.lb-btn:hover { background: rgba(243, 239, 232, .1); border-color: rgba(243, 239, 232, .45); }

.lb-btn svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.lightbox__play svg { fill: currentColor; stroke: none; width: 18px; height: 18px; }
.lightbox__play .icon-pause,
.lightbox.is-playing .lightbox__play .icon-play { display: none; }
.lightbox.is-playing .lightbox__play .icon-pause { display: block; }

.lb-nav {
	position: absolute;
	top: calc(50% - 40px);
	width: 54px;
	height: 54px;
	background: rgba(12, 10, 9, .35);
}

.lb-nav svg { width: 24px; height: 24px; }
.lightbox__prev { left: clamp(.5rem, 2vw, 1.75rem); }
.lightbox__next { right: clamp(.5rem, 2vw, 1.75rem); }

.lightbox__progress {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: 2px;
	background: transparent;
}

.lightbox__progress span {
	display: block;
	height: 100%;
	width: 100%;
	background: var(--accent);
	transform: scaleX(0);
	transform-origin: left;
}

.lightbox.is-playing .lightbox__progress span.is-running {
	transform: scaleX(1);
	transition: transform linear var(--slide-duration, 5s);
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
	.topbar__nav a { font-size: .7rem; letter-spacing: .14em; }
	.hero__caption { display: none !important; }
	.hero__controls { bottom: 1.5rem; }
	.lightbox__stage { --pad-y: 1rem; --pad-x: .5rem; }
	.lightbox__bar { grid-template-columns: 1fr auto; gap: .75rem 1rem; padding: 1rem 1rem 1.25rem; }
	.lightbox__counter { grid-column: 1; grid-row: 2; font-size: .9rem; }
	.lightbox__controls { grid-column: 2; grid-row: 1 / span 2; }
	.lb-nav { display: none; } /* na telefonie: przesuwanie palcem */
}

@media (hover: none) {
	.work__link:hover { transform: none; }
	.work__link:hover img { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
	.js .work { opacity: 1; transform: none; }
}
