:root {
  /* Jednostki "vw"/"vh" strony. Na telefonach/tabletach = prawdziwy ekran.
     Na desktopie app.js przełącza je na wymiary projektu bazowego
     (1440×900), a całość jest równo skalowana do okna — patrz niżej. */
  --vw: 1vw;
  --vh: 1vh;
  --white: #ffffff;
  --ink: #04121c;
  --panel-dark: rgba(4, 16, 28, 0.8);
  --dash-size: 3px;
  --dash-gap: 13px;
  --sidebar-w: 700px;
  --accent: #ffd76b;
  --h-gap: clamp(24px, calc(4 * var(--vw)), 56px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  color: var(--white);
  background: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ============================================================
   TŁO — podmień assets/background.webp na docelowe zdjęcie rafy.
   Do tego czasu widoczny jest gradient zastępczy w kolorach wody.
   ============================================================ */
.ocean-fallback {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(60% 50% at 20% 15%, rgba(31, 182, 201, 0.35), transparent 60%),
    radial-gradient(55% 45% at 85% 75%, rgba(255, 215, 107, 0.12), transparent 65%),
    linear-gradient(180deg, #04121c 0%, #073955 45%, #0b4d6e 75%, #04121c 100%);
  overflow: hidden;
}
.ocean-fallback .ray {
  position: absolute;
  top: -10%;
  width: 18vw;
  height: 140%;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), transparent 70%);
  transform: rotate(8deg);
  filter: blur(6px);
  animation: sway 12s ease-in-out infinite;
}
.ocean-fallback .ray.r2 { left: 30%; animation-duration: 16s; animation-delay: -4s; opacity: .7; }
.ocean-fallback .ray.r3 { left: 62%; animation-duration: 14s; animation-delay: -8s; opacity: .5; }
.ocean-fallback .ray.r1 { left: 5%; }
@keyframes sway {
  0%, 100% { transform: rotate(8deg) translateX(0); }
  50% { transform: rotate(3deg) translateX(4vw); }
}

#bg-photo {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Plik tła ma już wpalone rozmycie i "falowanie" wody. Ruch wody to
     bardzo powolne, płynne przesuwanie/przybliżanie zdjęcia — robi je
     karta graficzna, więc nie obciąża strony (w przeciwieństwie do
     wcześniejszego filtra liczonego na żywo, który powodował klatkowanie). */
  transform: scale(1.06);
  will-change: transform;
  animation: water-drift 28s ease-in-out infinite;
}
@keyframes water-drift {
  0%, 100% { transform: scale(1.06) translate3d(0, 0, 0); }
  33%      { transform: scale(1.08) translate3d(-0.9%, 0.6%, 0); }
  66%      { transform: scale(1.07) translate3d(0.7%, -0.5%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  #bg-photo { animation: none; }
}
/* gdy zdjęcie tła się wczyta, zapasowy gradient z promieniami (pod spodem)
   jest wyłączany — wcześniej animował się niewidoczny i zabierał moc */
html.bg-loaded .ocean-fallback { display: none; }

.vignette {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(0,6,14,0.32), rgba(0,6,14,0.32)),
    radial-gradient(120% 90% at 50% 30%, transparent 28%, rgba(0,0,0,0.6) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .ocean-fallback .ray { animation: none; }
}

/* ============================================================
   GRADIENT NA PODSTRONACH PROJEKTÓW — ciemno z lewej (pod tytułem
   i tekstem) → normalne tło z prawej (przy zdjęciach).
   Siłę przyciemnienia zmieniasz w wartościach rgba(…, 0.xx).
   ============================================================ */
.project-shade {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg,
    rgba(0, 6, 14, 0.78) 0%,
    rgba(0, 6, 14, 0.62) 30%,
    rgba(0, 6, 14, 0.30) 55%,
    rgba(0, 6, 14, 0) 80%);
  opacity: 0;
  transition: opacity .45s ease;
}
:root[data-view="project"] .project-shade { opacity: 1; }

/* Na telefonie tekst jest nad zdjęciami (jedna kolumna), więc
   przyciemnienie idzie z góry na dół zamiast od lewej do prawej. */
@media (max-width: 980px) {
  .project-shade {
    background: linear-gradient(180deg,
      rgba(0, 6, 14, 0.72) 0%,
      rgba(0, 6, 14, 0.55) 45%,
      rgba(0, 6, 14, 0.15) 100%);
  }
}

/* ============================================================
   SHELL / LAYOUT
   ============================================================ */
.app {
  position: relative;
  z-index: 1;
  min-height: var(--app-min-h, calc(100 * var(--vh)));
  padding: clamp(20px, calc(3.5 * var(--vw)), 44px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, calc(1.4 * var(--vw)), 18px);
}

#view-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.identity h1 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(1.6rem, calc(2.8 * var(--vw)), 2.4rem);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}
.identity p {
  margin: 2px 0 0;
  font-size: clamp(1rem, calc(1.55 * var(--vw)), 1.35rem);
  font-weight: 300;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.back-link {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  gap: 6px;
  margin-top: clamp(14px, calc(2.4 * var(--vw)), 22px);
  font-size: clamp(0.68rem, calc(1 * var(--vw)), 0.8rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  transition: color .2s ease, transform .2s ease;
}
.back-link:hover { color: var(--accent); transform: translateX(-2px); }
.back-link .arrow { font-size: 1.1em; }

/* ============================================================
   PRZERYWANE RAMKI — "marching ants", animowane jak gif
   ============================================================ */
.dashed-frame {
  position: relative;
  border-radius: 2px;
}
.dashed-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background-image:
    linear-gradient(90deg, var(--white) 50%, transparent 0),
    linear-gradient(90deg, var(--white) 50%, transparent 0),
    linear-gradient(0deg, var(--white) 50%, transparent 0),
    linear-gradient(0deg, var(--white) 50%, transparent 0);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-size:
    var(--dash-gap) var(--dash-size),
    var(--dash-gap) var(--dash-size),
    var(--dash-size) var(--dash-gap),
    var(--dash-size) var(--dash-gap);
  background-position: 0 0, 0 100%, 0 0, 100% 0;
  /* skokowo (jak gif), ~7 klatek/s zamiast 60 — ten sam wygląd i tempo,
     a przeglądarka przerysowuje ramki kilka razy rzadziej */
  animation: marching-ants 0.6s steps(4) infinite;
}
@keyframes marching-ants {
  to {
    background-position:
      var(--dash-gap) 0,
      calc(var(--dash-gap) * -1) 100%,
      0 calc(var(--dash-gap) * -1),
      100% var(--dash-gap);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dashed-frame::before { animation: none; }
}

.frame-title {
  align-self: center;
  margin: 0 0 clamp(14px, calc(2 * var(--vw)), 22px);
  background: var(--panel-dark);
  padding: 12px 30px;
  font-size: clamp(0.9rem, calc(1.3 * var(--vw)), 1.15rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 400;
  white-space: nowrap;
}

/* ============================================================
   FOLDER
   ============================================================ */
.folder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 6px;
  border-radius: 8px;
  transition: transform .2s ease, background-color .2s ease;
}
.folder:hover, .folder:focus-visible {
  transform: translateY(-4px);
  background: rgba(255,255,255,0.06);
  outline: none;
}
.folder:active { transform: translateY(-1px) scale(0.97); }

.folder-icon {
  width: clamp(70px, calc(7.4 * var(--vw)), 104px);
  aspect-ratio: 100 / 105;
  height: auto;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.45));
  transition: filter .2s ease;
}
.folder:hover .folder-icon { filter: drop-shadow(0 10px 18px rgba(0,0,0,0.6)) brightness(1.08); }

.folder-label {
  font-size: clamp(0.68rem, calc(0.95 * var(--vw)), 0.88rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 400;
  line-height: 1.25;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  max-width: 160px;
}

.folder.small .folder-icon { width: clamp(44px, calc(4.5 * var(--vw)), 60px); }
.folder.large .folder-icon { width: clamp(96px, calc(9.8 * var(--vw)), 142px); }
/* Duże foldery ("O mnie", "Kontakt", "Klienci") — delikatny pomarańczowy.
   Kolory zmienisz tutaj: f-back = tylna, ciemniejsza część; f-front = przód folderu. */
.folder.large .folder-icon .f-back { fill: #e0894a; }
.folder.large .folder-icon .f-front { fill: #ffc796; }
.folder.large .folder-label { font-size: clamp(0.8rem, calc(1.1 * var(--vw)), 1rem); max-width: 190px; font-weight: 700; }  /* "O mnie", "Kontakt" — pogrubione */

/* ============================================================
   WIDOK GŁÓWNY (PULPIT)
   ============================================================ */
.view-home {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: clamp(28px, calc(4 * var(--vw)), 56px);
  /* Wyśrodkowuje całą zawartość pulpitu w pionie, żeby odstęp od góry
     (pod nagłówkiem) i od dołu strony był taki sam, zamiast trzymać
     wszystko przyklejone do góry z pustą przestrzenią pod spodem. */
  align-items: center;
}

.home-folders {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, calc(1.4 * var(--vw)), 20px);
  flex: 0 0 auto;
}

.home-groups {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(24px, calc(3 * var(--vw)), 40px);
  /* Kontener rośnie razem z widokiem, ale nigdy ponad to, co dzieci
     (poniżej) faktycznie potrafią wykorzystać (suma ich max-width +
     odstęp) — dzięki temu nie zostaje "zgarnięte, ale niewykorzystane"
     miejsce, które wyglądałoby jak pusta przestrzeń w środku. */
  flex: 1 1 auto;
  max-width: 1760px;
}

.folder-group {
  /* Grupa "Eventy" ma 7 folderów w 3 kolumnach — rośnie na szerokich
     ekranach, żeby strona faktycznie wypełniała ekran, a nie zostawiała
     pustą przestrzeń z prawej. */
  flex: 1 1 420px;
  max-width: 1300px;
  padding: clamp(18px, calc(2.4 * var(--vw)), 28px) clamp(18px, calc(2.6 * var(--vw)), 32px) clamp(14px, calc(2 * var(--vw)), 20px);
  display: flex;
  flex-direction: column;
}
.folder-group[data-cols="1"] {
  /* Grupa "PR Box" ma tylko 2 foldery w 1 kolumnie — nie ma sensu, żeby
     rosła na szerokich ekranach (wyglądałoby to na sztucznie rozciągnięte
     puste pole), więc trzyma stałą, rozsądną szerokość. */
  flex: 0 0 420px;
  max-width: 420px;
}
.folder-group[data-cols="3"] { --cols: 3; }
.folder-group[data-cols="1"] { --cols: 1; }

.folder-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: clamp(14px, calc(2 * var(--vw)), 26px) clamp(10px, calc(1.4 * var(--vw)), 18px);
  justify-items: center;
  /* Wyśrodkowuje siatkę folderów w pionie w dostępnej przestrzeni boksu
     (pod etykietą grupy) — dzięki dwóm auto-marginesom odstęp nad i pod
     siatką zawsze jest równy i przeskalowuje się razem z wysokością boksu.
     Widoczne zwłaszcza w węższej grupie "PR Box", która ma mniej folderów
     niż "Eventy", więc box jest wyższy niż jego zawartość. */
  margin-top: auto;
  margin-bottom: auto;
}

/* ============================================================
   WIDOK STRONY (O MNIE / KONTAKT / PROJEKT) — wspólny szkielet
   ============================================================ */
.page-shell {
  display: flex;
  gap: var(--h-gap);
  flex: 1;
}

.page-sidebar {
  flex: 0 1 auto;
  max-width: min(var(--sidebar-w), 100%);
}

.page-title {
  font-weight: 400;
  margin: clamp(18px, calc(3 * var(--vw)), 30px) 0 0;
  font-size: clamp(2.1rem, calc(4.4 * var(--vw)), 3.4rem);
  line-height: 0.98;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  text-shadow: 0 3px 14px rgba(0,0,0,0.6);
  max-width: 280px;
  white-space: normal;
}

.about-header {
  display: flex;
  align-items: center;
  align-self: flex-start;
  flex-wrap: wrap;
  gap: var(--h-gap);
}
.about-header .page-title {
  margin: 0;
  max-width: none;
  white-space: nowrap;
}

/* Tytuł podstrony (i cały blok "O mnie"), zdjęcie oraz panel treści po
   prawej mają leżeć na tej samej poziomej osi — wyśrodkowane względem
   PEŁNEJ wysokości kolumny. Link powrotu jest wyjęty z tego przepływu
   (position:absolute), żeby nie przesuwał środka w dół. Wszystko zostaje
   w normalnym layoucie (bez position:fixed), więc kolumny nigdy na
   siebie nie nachodzą. */
@media (min-width: 981px) {
  .page-sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .page-sidebar > .back-link {
    position: absolute;
    top: 0;
    left: 0;
    margin-top: 0;
  }
  .page-sidebar > .page-title {
    margin: 0;
  }
  .page-content {
    align-items: center;
  }
}

.page-content {
  flex: 1 1 420px;
  display: flex;
  min-width: 0;
}

/* --- PODSTRONA PROJEKTU NA DESKTOPIE ---
   Układ (siatka):  [Wróć]   |
                    [Tytuł]  |  GALERIA (od linku "Wróć" w górze
                    [Tekst]  |  aż do stopki, do prawej krawędzi)
   Pole tekstu: szerokość w --project-text-w.
   Galeria: 2 zdjęcia obok siebie, przewijana w środku. */
@media (min-width: 981px) {
  :root[data-view="project"] {
    /* 653 px przy 1440 — lewa krawędź w linii z imieniem i "PROJECT MANAGER",
       prawa krawędź tam, gdzie wcześniej */
    --project-text-w: calc(45.35 * var(--vw));
    --project-col-gap: clamp(20px, calc(3 * var(--vw)), 36px);
  }
  /* strona projektu ma dokładnie wysokość ekranu — galeria i tekst
     przewijają się w środku, a nie cała strona */
  :root[data-view="project"] .app {
    height: var(--app-min-h, calc(100 * var(--vh)));
  }
  :root[data-view="project"] #view-root { min-height: 0; }
  :root[data-view="project"] .page-shell {
    display: grid;
    grid-template-columns: var(--project-text-w) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    column-gap: var(--project-col-gap);
    row-gap: 0;
    min-height: 0;
  }
  :root[data-view="project"] .page-sidebar,
  :root[data-view="project"] .page-content,
  :root[data-view="project"] .project-content { display: contents; }

  :root[data-view="project"] .page-sidebar > .back-link {
    grid-column: 1; grid-row: 1;
    position: static;
    margin-top: 0;
    justify-self: start;
  }
  :root[data-view="project"] .page-sidebar > .page-title {
    grid-column: 1; grid-row: 2;
    margin: clamp(8px, calc(1 * var(--vw)), 14px) 0 clamp(10px, calc(1.2 * var(--vw)), 18px);
    max-width: none;
    font-size: clamp(1.8rem, calc(3 * var(--vw)), 2.6rem);
  }
  :root[data-view="project"] .project-text {
    grid-column: 1; grid-row: 3;
    height: auto;
    min-height: 0;
    /* ramka dopasowuje się do ilości tekstu; przy dłuższym tekście
       rośnie najwyżej do dołu galerii, a dalej tekst się przewija */
    align-self: start;
    max-height: 100%;
  }
  :root[data-view="project"] .project-gallery {
    grid-column: 2; grid-row: 1 / 4;
    height: auto;
    min-height: 0;
  }

  /* dwa zdjęcia obok siebie, równa wysokość w rzędzie, bez wolnych pól */
  :root[data-view="project"] .gallery-row {
    display: flex;
    gap: clamp(14px, calc(2 * var(--vw)), 20px);
    flex: 0 0 auto;
  }
  :root[data-view="project"] .gallery-row .media-box {
    flex: var(--ar, 1.5) 1 0;
    min-width: 0;
  }
  /* zdjęcie samo w rzędzie: poziome na całą szerokość, pionowe/kwadratowe
     wyśrodkowane i nie wyższe niż ok. 460 px (żeby nie było ogromne) */
  :root[data-view="project"] .gallery-row.solo { justify-content: center; }
  :root[data-view="project"] .gallery-row.solo .media-box {
    flex: 0 1 auto;
    width: 100%;
    max-width: calc(var(--ar, 1.5) * 460px);
  }
}

/* Poza desktopem rzędy galerii "znikają" i zdjęcia lecą jedno pod drugim. */
.gallery-row { display: contents; }

/* --- O MNIE --- */
.avatar-circle {
  width: clamp(280px, calc(26 * var(--vw)), 360px);
  height: clamp(280px, calc(26 * var(--vw)), 360px);
  border-radius: 0;   /* zdjęcie profilowe jako kwadrat (dla koła wpisz 50%) */
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  border: 3px solid rgba(255,255,255,0.85);
  box-shadow: 0 10px 26px rgba(0,0,0,0.45);
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.text-panel {
  padding: clamp(22px, calc(3 * var(--vw)), 34px);
  width: 100%;
}
.text-panel p {
  margin: 0 0 1.3em;
  font-size: clamp(0.9rem, calc(1.15 * var(--vw)), 1.05rem);
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  overflow-wrap: break-word;
}
.text-panel p:last-child { margin-bottom: 0; }

/* --- O MNIE: tekst + zdjęcia w rzędzie pod spodem --- */
.about-main {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, calc(1.8 * var(--vw)), 26px);
  width: 100%;
  min-width: 0;
}
.text-panel .desc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: clamp(0.9rem, calc(1.15 * var(--vw)), 1.05rem);
  line-height: 1.5;
  text-transform: uppercase;
}
.text-panel .desc-list li { position: relative; padding-left: 1.1em; margin-bottom: 0.35em; }
.text-panel .desc-list li::before {
  content: ""; position: absolute; left: 0.15em; top: 0.6em;
  width: 0.38em; height: 0.38em; border-radius: 50%; background: currentColor;
}
.text-panel > :last-child { margin-bottom: 0; }

.about-photos {
  display: flex;
  gap: clamp(12px, calc(1.4 * var(--vw)), 20px);
}
.about-photo {
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.05);
}
.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  transition: opacity .2s ease;
}
.about-photo img:hover { opacity: 0.88; }

/* --- KLIENCI --- */
.clients-grid {
  --cols: 4;
  --gap: clamp(10px, calc(1.2 * var(--vw)), 18px);
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
  align-content: start;
}
.client-tile {
  min-width: 0;
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9% 13%;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(4, 16, 28, 0.45);
  transition: background-color .2s ease, border-color .2s ease;
}
.client-tile:hover { background: rgba(4, 16, 28, 0.7); border-color: rgba(255,255,255,0.7); }
.client-tile img {
  position: absolute;
  inset: 17% 14%;
  width: 72%;
  height: 66%;
  object-fit: contain;
  transform: scale(var(--s, 1));   /* optyczne wyrównanie, patrz "scale" w data.js */
  /* każde logo → jednolicie białe (achromatyczne), niezależnie od kolorów pliku */
  filter: brightness(0) invert(1);
  opacity: 0.92;
}
.client-tile.has-logo .client-name { display: none; }
.client-tile:not(.has-logo) img { display: none; }
.client-name {
  text-align: center;
  font-size: clamp(0.7rem, calc(0.95 * var(--vw)), 0.9rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.3;
}
@media (max-width: 980px) { .clients-grid { --cols: 3; } }
@media (max-width: 420px) { .clients-grid { --cols: 2; } }

/* --- KONTAKT --- */
.kontakt-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(14px, calc(2 * var(--vw)), 22px);
  padding: clamp(10px, calc(2 * var(--vw)), 20px) 0;
}
.kontakt-content .line {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.45em;
  font-size: clamp(1.05rem, calc(1.85 * var(--vw)), 1.7rem);
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}
.kontakt-content .icon {
  display: inline-flex;
  width: 1.05em;
  height: 1.05em;
  margin-right: 0.15em;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}
.kontakt-content .icon svg {
  width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.kontakt-content .line a { transition: color .2s ease; overflow-wrap: anywhere; }
.kontakt-content .line a:hover { color: var(--accent); }
.kontakt-content .label { font-weight: 300; opacity: 0.85; }
/* telefon: bez etykiet (ikonka wystarcza) i adresy małymi literami,
   żeby e-mail i LinkedIn nie łamały się w połowie słowa */
@media (max-width: 640px) {
  .kontakt-content .line { grid-template-columns: auto minmax(0, 1fr); font-size: 1.05rem; }
  .kontakt-content .label { display: none; }
  .kontakt-content .line a { text-transform: none; overflow-wrap: break-word; }
}

/* --- PROJEKT --- */
.project-content {
  display: flex;
  gap: clamp(20px, calc(3 * var(--vw)), 36px);
  width: 100%;
  min-width: 0;
  align-items: stretch;
}

/* Zewnętrzny blok to WYŁĄCZNIE statyczna, animowana ramka — sam nigdy się
   nie przewija. Przewija się tylko wewnętrzny "-scroll" wrapper, więc
   ramka pozostaje nieruchoma niezależnie od scrolla treści w środku. */
.project-text {
  flex: 1 1 280px;
  min-width: 0;
  height: min(calc(70 * var(--vh)), 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.project-text-scroll {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(22px, calc(3.2 * var(--vw)), 36px);
}
.project-text-scroll p {
  margin: 0 0 1.2em;
  font-size: clamp(0.9rem, calc(1.15 * var(--vw)), 1.05rem);
  line-height: 1.55;
  text-transform: uppercase;
  overflow-wrap: break-word;
}
.project-text-scroll > :last-child { margin-bottom: 0; }

/* lista punktowana w opisie projektu */
.project-text-scroll .desc-list {
  margin: 0 0 1.2em;
  padding: 0;
  list-style: none;
  font-size: clamp(0.9rem, calc(1.15 * var(--vw)), 1.05rem);
  line-height: 1.55;
  text-transform: uppercase;
  overflow-wrap: break-word;
}
.project-text-scroll .desc-list li {
  position: relative;
  padding-left: 1.1em;
  margin-bottom: 0.7em;
}
.project-text-scroll .desc-list li:last-child { margin-bottom: 0; }
.project-text-scroll .desc-list li::before {
  content: "";
  position: absolute;
  left: 0.15em;
  top: 0.62em;
  width: 0.38em;
  height: 0.38em;
  border-radius: 50%;
  background: currentColor;
}

/* link pod opisem (np. do filmu na YouTube) — pogrubiony, żeby był widoczny */
.project-text-scroll .desc-link { font-weight: 700; }
.project-text-scroll .desc-link a {
  font-weight: 700;
  text-transform: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
  transition: color .2s ease;
}
.project-text-scroll .desc-link a:hover { color: var(--accent); }

.project-gallery {
  flex: 1.6 1 420px;
  min-width: 0;
  height: min(calc(70 * var(--vh)), 640px);
  overflow: hidden;
}
.project-gallery-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(16px, calc(2 * var(--vw)), 22px);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, calc(2 * var(--vw)), 20px);
}

/* czytelny, "aktywny" pasek przewijania dla galerii zdjęć */
.project-text-scroll, .project-gallery-scroll {
  scrollbar-width: thin;
  scrollbar-color: #ffffff rgba(255,255,255,0.18);
}
.project-text-scroll::-webkit-scrollbar,
.project-gallery-scroll::-webkit-scrollbar { width: 8px; }
.project-text-scroll::-webkit-scrollbar-track,
.project-gallery-scroll::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
}
.project-text-scroll::-webkit-scrollbar-thumb,
.project-gallery-scroll::-webkit-scrollbar-thumb {
  background: #ffffff;
  border-radius: 999px;
}

/* ============================================================
   ZDJĘCIA / PLACEHOLDERY
   ============================================================ */
.media-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.85);
  flex: 0 0 auto;
}
.media-box img { width: 100%; height: 100%; object-fit: cover; }
/* Prawdziwe zdjęcia (nie placeholdery) pokazujemy w ich naturalnych
   proporcjach — pionowe zdjęcia nie są przycinane do 16:10. */
.media-box:not(.is-placeholder) { aspect-ratio: auto; }
.media-box:not(.is-placeholder) img { height: auto; }

.placeholder-hint {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 10px;
  background: repeating-linear-gradient(
    45deg, rgba(255,255,255,0.04), rgba(255,255,255,0.04) 10px,
    rgba(255,255,255,0.08) 10px, rgba(255,255,255,0.08) 20px
  );
  border: 1px dashed rgba(255,255,255,0.4);
}
.media-box.is-placeholder .placeholder-hint { display: flex; }
.placeholder-hint .plus {
  font-size: 1.6rem;
  font-weight: 800;
  opacity: 0.8;
}
.placeholder-hint small {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.7;
  word-break: break-all;
  text-transform: none;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.avatar-circle .placeholder-hint { border-radius: 0; border: none; }
.avatar-circle .placeholder-hint .plus { font-size: 2.2rem; }

/* ============================================================
   PRZEŁĄCZNIK JĘZYKA PL / EN — prawy górny róg, na każdej podstronie
   ============================================================ */
.lang-switch {
  position: absolute;
  z-index: 20;
  top: clamp(20px, calc(3.5 * var(--vw)), 44px);
  right: clamp(20px, calc(3.5 * var(--vw)), 44px);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1.5px solid rgba(255,255,255,0.85);
  border-radius: 999px;
  background: rgba(4, 16, 28, 0.6);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: background-color .2s ease, border-color .2s ease;
}
.lang-switch:hover { background: rgba(4, 16, 28, 0.85); border-color: #fff; }
.lang-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.lang-switch .ls-opt { opacity: 0.5; transition: opacity .2s ease, color .2s ease; }
.lang-switch .ls-opt.is-active { opacity: 1; color: var(--accent); }
.lang-switch .ls-track {
  position: relative;
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.6);
}
.lang-switch .ls-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.lang-switch.is-en .ls-knob { transform: translateX(20px); }
@media (max-width: 640px) {
  .lang-switch { padding: 6px 10px; gap: 7px; font-size: 0.78rem; }
  .lang-switch .ls-track { width: 34px; height: 18px; }
  .lang-switch .ls-knob { width: 12px; height: 12px; }
  .lang-switch.is-en .ls-knob { transform: translateX(16px); }
  #identity-slot { padding-right: 120px; }   /* imię nie wchodzi pod przełącznik */
}

/* ============================================================
   STOPKA — "© rok Imię Nazwisko. Wszelkie prawa zastrzeżone."
   ============================================================ */
.site-footer {
  margin-top: clamp(16px, calc(2.5 * var(--vw)), 28px);
  text-align: center;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.55);
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* ============================================================
   FILM NA GÓRZE GALERII (format 16:9, pełna szerokość galerii)
   ============================================================ */
.gallery-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  border: 2px solid rgba(255,255,255,0.85);
  background: #000;
  overflow: hidden;
}
.gallery-video video, .gallery-video iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000;
}
.video-placeholder { display: none; }
.gallery-video.is-empty { background: rgba(255,255,255,0.05); border-style: dashed; }
.gallery-video.is-empty .video-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 10px;
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.04), rgba(255,255,255,0.04) 10px, rgba(255,255,255,0.08) 10px, rgba(255,255,255,0.08) 20px);
}
.video-placeholder .plus { font-size: 1.8rem; opacity: 0.85; }
.video-placeholder small { font-size: 0.62rem; opacity: 0.65; text-transform: none; letter-spacing: 0.02em; font-family: "SFMono-Regular", Consolas, monospace; word-break: break-all; }

/* ============================================================
   STRZAŁKA "PRZEWIŃ W DÓŁ" PRZY GALERII
   Na komputerze: po prawej stronie, tuż za ramką galerii.
   Na telefonie: w prawym dolnym rogu galerii.
   ============================================================ */
.project-gallery { position: relative; }
.scroll-hint {
  position: absolute;
  z-index: 3;
  right: 8px;
  bottom: 8px;
  width: 34px;
  height: 56px;
  padding: 0;
  border: none;
  background: none;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  /* cień, żeby strzałki były widoczne także na jasnych zdjęciach i tle */
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.85)) drop-shadow(0 0 8px rgba(0,0,0,0.45));
}
.scroll-hint.is-visible { opacity: 1; pointer-events: auto; }
.scroll-hint:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.scroll-hint svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.scroll-hint path { animation: hint-wave 1.5s ease-in-out infinite; }
.scroll-hint .c1 { animation-delay: 0s; }
.scroll-hint .c2 { animation-delay: .2s; }
.scroll-hint .c3 { animation-delay: .4s; }
.scroll-hint:hover path { stroke: var(--accent); }
@keyframes hint-wave {
  0%, 100% { opacity: .55; }
  40%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-hint path { animation: none; opacity: 1; }
}
@media (min-width: 981px) {
  /* ramka galerii nie przycina strzałek wystających na prawo */
  :root[data-view="project"] .project-gallery { overflow: visible; }
  :root[data-view="project"] .scroll-hint {
    /* na środku marginesu między ramką galerii a krawędzią strony */
    right: calc(-1 * (clamp(20px, calc(3.5 * var(--vw)), 44px) / 2 + 15px));
    bottom: 50%;
    transform: translateY(50%);
    width: 30px;
    height: 50px;
  }
}

/* ============================================================
   PODGLĄD ZDJĘCIA NA CAŁY EKRAN (lightbox)
   ============================================================ */
.project-gallery .media-box img { cursor: zoom-in; transition: opacity .2s ease; }
.project-gallery .media-box img:hover { opacity: 0.88; }

html.lb-open, html.lb-open body { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 8, 16, 0.92);
  opacity: 0;
  transition: opacity .2s ease;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.lightbox[hidden] { display: none; }
.lightbox.is-visible { opacity: 1; }

.lb-stage {
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 88px;
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  user-select: none;
}

.lb-close, .lb-nav {
  position: absolute;
  z-index: 2;
  color: #fff;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .2s ease, transform .2s ease;
  line-height: 1;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,0.2); }
.lb-close:focus-visible, .lb-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lb-close { top: 16px; right: 16px; width: 44px; height: 44px; padding: 0; }
.lb-close svg, .lb-nav svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.lb-nav svg { width: 26px; height: 26px; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; padding: 0; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lightbox.is-single .lb-nav { display: none; }

.lb-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.75);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

@media (max-width: 640px) {
  .lb-stage { padding: 64px 12px; }
  .lb-nav { top: auto; bottom: 12px; transform: none; width: 44px; height: 44px; }
  .lb-nav svg { width: 22px; height: 22px; }
  .lb-prev { left: 12px; }
  .lb-next { right: 12px; }
}

/* ============================================================
   404
   ============================================================ */
.not-found {
  padding: clamp(24px, calc(4 * var(--vw)), 48px);
}
.not-found h2 { text-transform: uppercase; }

/* ============================================================
   RESPONSYWNOŚĆ / MOBILE
   ============================================================ */
@media (max-width: 980px) {
  :root { --sidebar-w: 100%; }
  .page-shell { flex-direction: column; }
  .page-sidebar { display: flex; flex-direction: column; }
  .about-header { flex-direction: column; align-items: flex-start; }
  .page-title { max-width: none; }
  .project-content { flex-direction: column; }
  .project-text { flex: 0 0 auto; height: auto; max-height: none; }   /* telefon/tablet: cały tekst widoczny, przewija się strona */
  .project-gallery { flex: 0 0 auto; height: min(calc(48 * var(--vh)), 420px); }
}

@media (max-width: 860px) {
  .folder-group[data-cols="3"] { --cols: 2; }
}

@media (max-width: 640px) {
  .home-folders { flex-direction: row; flex-wrap: wrap; }
  .view-home { gap: 24px; }
  .folder-group[data-cols="1"] { flex-basis: 100%; }
  .avatar-circle { width: 110px; height: 110px; }
  .project-gallery { height: min(calc(42 * var(--vh)), 360px); }
  :root { --dash-gap: 10px; }
}

@media (max-width: 420px) {
  .folder-label { max-width: 100px; }
}

/* ============================================================
   SKALOWANIE NA DESKTOPIE
   Strona jest zaprojektowana dla ekranu 1440×900. Na komputerach
   (okno ≥ 1024 px szerokości) app.js dodaje klasę "is-scaled"
   i całość jest proporcjonalnie powiększana/pomniejszana tak,
   żeby zawsze wyglądała jak projekt bazowy. Wymiary bazowe
   i próg ustawiasz na górze app.js (DESIGN).
   ============================================================ */
:root.is-scaled {
  --vw: calc(var(--base-w) / 100);
  --vh: calc(var(--base-h) / 100);
}
:root.is-scaled .app {
  width: var(--base-w);
  margin: 0 auto;
  zoom: var(--scale);
}
