/* ------------------------------------------------------------------ */
/*  Kacper Barzyński – portfolio                                       */
/*  Paleta: tylko biel, czerń i neutralne szarości                    */
/*  tło #FFFFFF, tekst #494A4A, akcent #111111, ciemny #2B2B2B,       */
/*  drugorzędny #7A7A7A                                                */
/* ------------------------------------------------------------------ */
:root {
  --bg: #ffffff;
  --text: #494a4a;
  --accent: #111111;
  --accent-hover: #333333;
  --muted: #2b2b2b;
  --secondary: #7a7a7a;
  --line: rgba(73, 74, 74, .14);
  --surface: #ffffff;
  --ease: cubic-bezier(.76, 0, .24, 1);
  --dur: 900ms;
  --container: 1200px;
  --pad: clamp(20px, 4vw, 56px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.is-locked { overflow: hidden; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.02em; line-height: 1.1; color: var(--muted); }
section[id] { scroll-margin-top: 72px; }

.skip { position: absolute; left: -999px; top: 10px; z-index: 50; background: #fff; padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 16px; }

/* ---------- Nawigacja ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px var(--pad);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.nav.is-scrolled { border-color: var(--line); }
.nav-brand { text-decoration: none; font-weight: 600; color: var(--muted); letter-spacing: -.01em; white-space: nowrap; }
.nav-links { display: flex; gap: 28px; }
.nav-links a { position: relative; text-decoration: none; font-size: 15px; color: var(--text); }
.nav-links a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -5px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.nav-links a:hover::after { transform: scaleX(1); }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang button {
  border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 500;
  padding: 5px 11px; border-radius: 999px; color: var(--secondary); cursor: pointer;
  transition: background-color .25s ease, color .25s ease;
}
.lang button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; padding: 13px 22px; border-radius: 999px;
  text-decoration: none; font-size: 15px; font-weight: 500; border: 1px solid transparent;
  transition: translate .35s var(--ease), background-color .25s ease, color .25s ease, border-color .25s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); translate: 0 -2px; }
.magnetic { will-change: transform; }
.btn-ghost { border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: 100svh; display: grid; align-items: center;
  padding: 112px 0 56px;
}
/* siatka 3D pod całym hero – tytuł, zdjęcie i przyciski leżą na niej */
.mesh { position: absolute; inset: 0; pointer-events: none; }
.mesh canvas { width: 100%; height: 100%; display: block; }
.hero-inner {
  position: relative; z-index: 1; width: 100%;
  max-width: var(--container); margin: 0 auto; padding: 0 var(--pad);
}
.hero-text { max-width: 680px; }
.claim {
  font-size: clamp(44px, 6.2vw, 104px); line-height: .96; letter-spacing: -.035em; font-weight: 500;
  color: var(--muted); max-width: 11ch; text-wrap: balance;
}
.lead {
  margin: 28px 0 0; max-width: 34ch;
  font-size: clamp(17px, 1.35vw, 22px); line-height: 1.45; color: var(--text);
  text-shadow: 0 0 14px #fff, 0 0 6px #fff;
}
.claim em {
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif; font-style: italic; font-weight: 400;
  font-size: 1.12em; letter-spacing: -.01em; color: var(--accent);
}
.claim .w {
  display: inline-block; will-change: transform;
  transition: opacity .9s cubic-bezier(.2, .7, .2, 1), translate .9s cubic-bezier(.2, .7, .2, 1);
  transition-delay: calc(var(--i, 0) * 40ms);
}
.hero:not(.is-ready) .claim .w { opacity: 0; translate: 0 .45em; }
.eyebrow { margin: 18px 0 0; color: var(--secondary); font-size: 14px; letter-spacing: .02em; text-shadow: 0 0 14px #fff, 0 0 6px #fff, 0 0 2px #fff; }
.claim { text-shadow: 0 0 18px rgba(255, 255, 255, .9); }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; }
.lead { transition: opacity .8s ease .4s, translate .8s cubic-bezier(.2, .7, .2, 1) .4s; }
.eyebrow, .hero-cta { transition: opacity .8s ease .55s, translate .8s cubic-bezier(.2, .7, .2, 1) .55s; }
.hero:not(.is-ready) :is(.lead, .eyebrow, .hero-cta) { opacity: 0; translate: 0 12px; }

/* ---------- Sekcje ---------- */
.section { max-width: var(--container); margin: 0 auto; padding: clamp(64px, 9vw, 128px) var(--pad); border-top: 1px solid var(--line); }
.section h2 { font-size: clamp(28px, 3vw, 40px); }

/* szeryfowe akcenty – ta sama gra krojów co w hero */
.section h2 em, .about-lead em, .about-text em, .contact-lead em {
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif; font-style: italic; font-weight: 400; color: var(--accent);
}
.section h2 em { font-size: 1.12em; }

/* O mnie: tytuł i zakres w lewej kolumnie, treść po prawej */
.about {
  display: grid; grid-template-columns: 1fr 1.6fr; grid-template-areas: "head body" "scope body";
  align-items: start; column-gap: clamp(32px, 6vw, 96px); row-gap: 8px;
}
.about-title { grid-area: head; }
.about-scope { grid-area: scope; }
.about-body { grid-area: body; }
.label { margin: 32px 0 10px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--secondary); }
.scope { list-style: none; margin: 0; padding: 0; }
.scope li { padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.about-lead {
  margin: 0 0 28px;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif; font-style: italic; font-weight: 400;
  font-size: clamp(30px, 3.1vw, 48px); line-height: 1.1; letter-spacing: -.01em; color: var(--muted);
  text-wrap: balance;
}
.about-text { margin: 0; font-size: clamp(17px, 1.3vw, 20px); line-height: 1.6; }
.about-text em { font-size: 1.1em; }

/* Portfolio – sekcja na pełnej szerokości w kolorze akcentu, karuzela 3D */
.portfolio { background: var(--accent); color: #fff; }
.portfolio .section { border-top: 0; }
.portfolio h2 { color: #fff; }
.portfolio-sum {
  margin: 0; font-family: "Instrument Serif", Georgia, "Times New Roman", serif; font-style: italic;
  font-size: clamp(20px, 2vw, 28px); color: rgba(255, 255, 255, .72);
}
.portfolio-stage { position: relative; height: clamp(540px, 92vh, 960px); overflow: hidden; }
.carousel { position: absolute; inset: 0; touch-action: pan-y; cursor: grab; outline: none; }
.carousel:focus-visible { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }
.carousel canvas { display: block; width: 100%; height: 100%; }
.carousel-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.screen-label {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  border: 0; background: none; padding: 6px 0; margin: 0;
  font: 500 clamp(14px, 1.2vw, 17px) Inter, system-ui, sans-serif; color: #fff; letter-spacing: -.01em;
  cursor: pointer; white-space: nowrap; will-change: transform;
}
.screen-label:hover { text-decoration: underline; text-underline-offset: 4px; }
.screen-plus {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; background: #fff; color: var(--accent); cursor: pointer;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .5); will-change: transform;
  transition: background-color .25s ease, color .25s ease;
}
.screen-plus:hover { background: var(--accent); color: #fff; }
.portfolio-head {
  position: absolute; left: var(--pad); right: var(--pad); top: clamp(28px, 4vh, 48px); z-index: 2;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; pointer-events: none;
}
.portfolio-head h2 { font-size: clamp(28px, 3vw, 40px); }
.carousel-ui {
  position: absolute; left: var(--pad); right: var(--pad); bottom: clamp(24px, 4vh, 40px); z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
}
.carousel-count { margin: 0; font-family: "Instrument Serif", Georgia, serif; font-style: italic; font-size: 22px; color: rgba(255, 255, 255, .8); }
.carousel-arrows { display: flex; gap: 10px; }
.carousel-arrows button {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35);
  background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer;
  transition: background-color .25s ease, border-color .25s ease;
}
.carousel-arrows button:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .6); }
.cats-fallback:not([hidden]) + .portfolio-stage, .portfolio-stage.is-hidden { display: none; }
.portfolio .cat-thumb { background: rgba(255, 255, 255, .1); }
.portfolio .cat-name { color: #fff; }
.portfolio .cat-count { color: rgba(255, 255, 255, .6); }
.portfolio .cat:focus-visible .cat-thumb { outline-color: #fff; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.cats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 24px; }
.cat {
  position: relative; display: block; text-align: left;
  border: 0; background: none; padding: 0; margin: 0; cursor: pointer; font: inherit; color: inherit;
}
.cat-thumb { position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; background: var(--surface); }
.cat-thumb img, .cat-thumb video { width: 100%; height: 100%; object-fit: cover; transform: scale(1.02); transition: transform .9s var(--ease); }
.cat:hover .cat-thumb img, .cat:hover .cat-thumb video { transform: scale(1.07); }
.cat-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .38), transparent 45%);
  opacity: 0; transition: opacity .4s ease;
}
.cat:hover .cat-thumb::after { opacity: 1; }
.cat-open {
  position: absolute; left: 18px; bottom: 16px; z-index: 1; color: #fff; font-size: 13px; font-weight: 500;
  opacity: 0; transform: translateY(6px); transition: opacity .4s ease, transform .4s var(--ease);
}
.cat:hover .cat-open { opacity: 1; transform: none; }
.cat-cap { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; }
.cat-name { font-weight: 500; color: var(--muted); }
.cat-count { font-size: 13px; color: var(--secondary); }
.cat:focus-visible { outline: none; }
.cat:focus-visible .cat-thumb { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Kontakt – tekst po lewej, zdjęcie na białym tle po prawej */
.contact-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: clamp(32px, 6vw, 96px); align-items: center; }
.contact-photo { margin: 0; }
.contact-photo img {
  display: block; width: 100%; height: auto; max-width: 440px; margin-left: auto;
  aspect-ratio: 1; object-fit: cover; object-position: 50% 15%;
  border-radius: 28px; box-shadow: 0 50px 90px -48px rgba(0, 0, 0, .35);
}
.contact .label { margin: 0 0 20px; }
.section .contact-lead {
  margin: 0 0 clamp(36px, 5vw, 64px); max-width: 15ch; text-wrap: balance;
  font-size: clamp(38px, 5.4vw, 88px); line-height: .98; letter-spacing: -.035em; color: var(--muted);
}
.section .contact-lead em { font-size: 1.1em; }
.contact-row {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 28px;
}
.contact-mail {
  display: inline-flex; align-items: center; gap: .5em;
  font-size: clamp(22px, 3vw, 44px); font-weight: 500; letter-spacing: -.02em;
  color: var(--accent); text-decoration: none; word-break: break-all;
}
.contact-mail-text {
  background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 92% / 0 2px;
  transition: background-size .5s var(--ease);
}
.contact-mail:hover .contact-mail-text { background-size: 100% 2px; }
.contact-arrow {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 1.5em; height: 1.5em; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent);
  transition: background-color .3s ease, color .3s ease, transform .5s var(--ease);
}
.contact-mail:hover .contact-arrow { background: var(--accent); color: #fff; transform: rotate(-45deg); }
.contact-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: border-color .25s ease, color .25s ease, background-color .25s ease;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.status { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; color: var(--secondary); flex-wrap: wrap; }
.status-sep { opacity: .5; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 2.2s ease-out infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 0, 0, .35); }
  70%  { box-shadow: 0 0 0 10px rgba(0, 0, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

/* Stopka */
.footer {
  max-width: var(--container); margin: 0 auto; padding: 28px var(--pad) 40px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: var(--secondary); border-top: 1px solid var(--line);
}
.footer p { margin: 0; }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linklike:hover { color: var(--accent); }

/* ---------- Galeria kategorii (odsłonięcie okręgiem) ---------- */
.gallery {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: var(--g-accent, var(--accent)); color: #fff;
  clip-path: circle(0% at 50% 50%); will-change: clip-path;
}
.gallery-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 28px var(--pad) 0; }
.gallery-title { font-size: clamp(26px, 3vw, 40px); color: #fff; }
.gallery-count { margin: 6px 0 0; font-size: 14px; color: rgba(255, 255, 255, .65); }
.gallery-close {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #fff;
  border-radius: 999px; padding: 10px 16px 10px 18px; font: inherit; font-size: 14px; cursor: pointer;
  transition: background-color .25s ease;
}
.gallery-close::after { content: '×'; font-size: 20px; line-height: 1; }
.gallery-close:hover { background: rgba(255, 255, 255, .12); }

.gallery-track {
  flex: 1; display: flex; align-items: center; gap: clamp(16px, 2vw, 28px);
  padding: 24px var(--pad); overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; cursor: grab; scroll-snap-type: x proximity; touch-action: pan-x;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.item { flex: 0 0 auto; margin: 0; scroll-snap-align: center; --h: min(62vh, 680px); }
.media {
  height: var(--h); aspect-ratio: var(--ar, 3 / 4);
  border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .22);
  transition: transform .6s var(--ease); cursor: pointer;
}
.item:hover .media { transform: scale(1.03); }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; }
.item.is-broken .media { display: grid; place-items: center; text-align: center; padding: 24px; font-size: 13px; line-height: 1.4; color: rgba(255, 255, 255, .75); cursor: default; }
.item.is-broken .media small { display: block; margin-top: 8px; opacity: .7; }
.item-cap { display: flex; justify-content: space-between; gap: 16px; margin-top: 12px; font-size: 14px; }
.item-cap .date { color: rgba(255, 255, 255, .6); white-space: nowrap; }
.gallery-hint { margin: 0; padding: 0 var(--pad) 24px; font-size: 13px; color: rgba(255, 255, 255, .55); }

/* Powiększenie materiału */
.lightbox {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 72px var(--pad) 40px; background: rgba(0, 0, 0, .86);
}
.lightbox[hidden] { display: none; }
.lightbox-media { display: flex; justify-content: center; max-width: 100%; }
.lightbox-media img, .lightbox-media video { max-width: 100%; max-height: calc(100vh - 170px); width: auto; height: auto; border-radius: 10px; object-fit: contain; }
.lightbox-caption { margin: 16px 0 0; font-size: 14px; color: rgba(255, 255, 255, .8); }
.lightbox-close {
  position: absolute; top: 24px; right: var(--pad); width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.lightbox-close::before { content: '×'; }

/* ---------- Okno polityki cookies ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, .5); }
.modal[hidden] { display: none; }
.modal-box { width: 100%; max-width: 560px; padding: 36px; border-radius: 20px; background: #fff; }
.modal-box h2 { font-size: 24px; margin-bottom: 14px; }
.modal-box p { margin: 0 0 12px; font-size: 15px; }
.modal-box .btn { margin-top: 14px; }

/* ---------- Responsywność ---------- */
@media (max-width: 900px) {
  /* hero: bryła u góry, tekst pod nią – nic się nie nakłada */
  .hero { padding: 0 0 40px; align-items: end; }
  .mesh { inset: 72px 0 auto 0; height: 44%; }
  .hero-text { max-width: none; }
  .claim { max-width: none; font-size: clamp(40px, 11vw, 64px); }
  .lead { font-size: 17px; margin-top: 18px; }
  .hero-cta { margin-top: 24px; }
  .hero-cta .btn { padding: 12px 18px; font-size: 14px; }
  /* o mnie: tytuł, treść, dopiero potem lista zakresu */
  .about { grid-template-columns: 1fr; grid-template-areas: "head" "body" "scope"; row-gap: 20px; }
  .about-scope .label { margin-top: 12px; }
  /* kontakt: zdjęcie jako kadr na górze */
  .contact-grid { grid-template-columns: 1fr; gap: 28px; }
  .contact-photo { order: -1; }
  .contact-photo img { max-width: 160px; margin-left: 0; border-radius: 20px; box-shadow: none; }
  .contact-row { gap: 20px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  /* karuzela: niższa scena, większa plansza */
  .portfolio-stage { height: min(600px, 86vh); }
  .portfolio-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .carousel-ui { bottom: 20px; }
  .cats {
    grid-auto-columns: 72vw; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad) 8px;
  }
  .cats::-webkit-scrollbar { display: none; }
  .cat { scroll-snap-align: start; }
}
@media (max-width: 600px) {
  /* menu w dwóch rzędach: marka + język, pod spodem linki */
  .nav { flex-wrap: wrap; row-gap: 6px; padding: 12px var(--pad) 10px; }
  .nav-brand { font-size: 15px; }
  .nav-links { order: 3; width: 100%; gap: 18px; }
  .nav-links a { font-size: 14px; }
  section[id] { scroll-margin-top: 92px; }
  .mesh { inset: 92px 0 auto 0; }
  .item { --h: 52vh; }
  .gallery-head { padding-top: 20px; }
  .lightbox { padding: 72px 16px 32px; }
}
@media (hover: none) {
  .cat-open { opacity: 1; transform: none; }
  .cat-thumb::after { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur: 1ms; }
  html { scroll-behavior: auto; }
  .cat-thumb img, .cat-thumb video, .media, .btn { transition: none; }
  .dot { animation: none; }
}
