@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #FFFFFF;
  --bg-tile: #FFFFFF;
  --ink: #161513;
  --ink-soft: #4A4742;
  --gray: #8A8780;
  --line: #EAEAEA; 
  --brand-blue: #0057FF; 
  --accent: #2A2F35;    
  --accent-dim: #EBF1FF;

  --font-display: 'Archivo', sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --container: 1280px;
  --gutter: 32px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-gallery-container img {
  image-rendering: -webkit-optimize-contrast;
  opacity: 0;
  animation: fadeInImage 0.35s ease forwards;
}

@keyframes fadeInImage {
  to {
    opacity: 1;
  }
}

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 4px;
  border-radius: 2px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 88px;
}

.brand {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-role {
  font-family: var(--font-body); 
  font-weight: 400;
  font-size: 13px;
  color: var(--gray);
  letter-spacing: 0;
}

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

nav.main-nav a {
  font-family: var(--font-body); 
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 10px 16px;
  border-radius: 100px;
  transition: color 0.2s ease, background 0.2s ease;
  position: relative;
}

nav.main-nav a:hover {
  color: var(--ink);
  background: var(--bg-tile);
}

nav.main-nav a.active {
  color: var(--ink);
}

nav.main-nav a.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 16px;
  right: 16px;
  height: 1px;
  background: var(--brand-blue);
}

/* ============================================
   STRONA GŁÓWNA & SIATKA WORK
   ============================================ */
.home-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  background: var(--bg);
}

.home-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  padding: 48px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg);
  align-items: flex-start;
}

.home-sidebar-top {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.home-sidebar-top .brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.home-sidebar-role {
  font-family: var(--font-body); 
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 36px;
  text-align: left;
}

.home-sidebar-desc {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 40px;
  text-align: left;
}

.home-nav {
  display: flex;
  flex-direction: column;
  gap: 8px; 
  width: 100%;
  align-items: flex-start;
}

.home-nav a {
  font-family: var(--font-body); 
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 8px 16px !important; 
  border-radius: 100px;
  border: 1px solid var(--line) !important; 
  background: var(--bg-tile) !important;
  background-image: none !important; 
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
}

.home-nav a:hover {
  color: var(--ink);
  border-color: var(--ink) !important;
}

.home-nav a.active {
  background: var(--brand-blue) !important;
  color: #FFFFFF !important;
  border-color: var(--brand-blue) !important;
  font-weight: 600;
}

.home-main {
  padding: 0 40px 80px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.home-main-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 48px;
  margin-bottom: 28px;
  gap: 24px;
}

.home-main-head h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.home-work-count {
  font-family: var(--font-body); 
  font-size: 12px;
  color: var(--gray);
}

.masonry {
  column-count: 2;
  column-gap: 32px;
  width: 100%;
  flex-grow: 1;
}

.masonry-item {
  display: block;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-tile);
  width: 100%;
  margin-bottom: 32px;
  break-inside: avoid;
}

.masonry-item img,
.masonry-item video {
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.masonry-item:hover img,
.masonry-item:hover video {
  opacity: 0.85; 
}

.masonry-item.type-poster { aspect-ratio: 1 / 1.4142; }
.masonry-item.type-logo { aspect-ratio: 16 / 10; }
.masonry-item.type-book { aspect-ratio: 4 / 5; }

.home-main::after {
  content: "© 2026 Patryk Malczewski";
  display: block;
  width: 100%;
  text-align: center; 
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--gray);
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* ============================================
   PODSTRONY PROJEKTÓW (GLOBALNE)
   ============================================ */
.project-wrap {
  width: 100%;
  max-width: 1400px;    
  margin: 0 auto;       
  padding: 0 40px;      
  background: var(--bg);
}

.project-shell {
  display: grid;
  grid-template-columns: 380px 1fr; 
  min-height: 100vh;
  background: var(--bg);
}

.project-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 48px 40px 48px 0; 
  border-right: 1px solid var(--line); /* Jedna z dwóch pożądanych linii: pionowa */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg);
  overflow-x: hidden; 
}

.project-unified-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 48px;
}

.project-unified-nav .back-link {
  font-family: var(--font-body); 
  font-size: 13px;
  font-weight: 500;
  color: var(--gray);
  transition: color 0.2s ease;
}
.project-unified-nav .back-link:hover { color: var(--ink); }

.project-unified-nav .nav-right {
  display: flex;
  gap: 20px;
}
.project-unified-nav .nav-right a {
  font-family: var(--font-body); 
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 500;
  transition: color 0.2s ease;
}
.project-unified-nav .nav-right a:hover { color: var(--brand-blue); }

.sidebar-project-thumb {
  display: none !important; 
}

.project-sidebar-top {
  display: flex;
  flex-direction: column;
}

.project-detail-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 24px;
  order: 1; 
  margin-top: 24px;
}

.project-detail-desc {
  max-height: 48vh; 
  overflow-y: auto;
  overflow-x: hidden; 
  padding-right: 8px;
  order: 2; 
}

.project-detail-desc p {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 24px;
}

.project-detail-desc h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  margin-top: 24px;
  margin-bottom: 12px;
  padding-bottom: 4px;
}

.project-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  order: 3; 
  margin-top: 36px !important;
  margin-bottom: 0 !important;
  padding-top: 24px;
}

.meta-item { 
  display: flex; 
  flex-direction: column; 
  gap: 6px; 
  text-align: left;        
  align-items: flex-start; 
}

.meta-label {
  font-family: var(--font-body); 
  font-size: 11px;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  width: 100%;
}

.meta-value {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  width: 100%;
}

.project-specs-list {
  list-style: none;
  padding: 0;
  margin-bottom: 24px;
}

.project-specs-list li {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  padding: 8px 0 8px 16px;
  position: relative;
}

.project-specs-list li::before { content: "—"; position: absolute; left: 0; color: var(--brand-blue); }

/* DOLNY BLOK Z JEDYNĄ POZIOMĄ LINIĄ */
.project-sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line); /* Jedna z dwóch pożądanych linii: dolna pozioma */
}

.project-sidebar-bottom .project-footer,
.project-sidebar .project-footer {
  display: none !important; 
}

.project-inner-nav { display: flex; justify-content: space-between; }
.project-inner-nav a { font-family: var(--font-body); font-size: 13px; color: var(--ink); font-weight: 500; transition: color 0.2s ease; }
.project-inner-nav a:hover { color: var(--brand-blue); }

.project-gallery-container { 
  padding: 48px 0 48px 48px; 
  background: var(--bg); 
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 96px);
  justify-content: space-between;
}

.project-gallery-container::after {
  content: "© 2026 Patryk Malczewski";
  display: block;
  width: 100%;
  text-align: center; 
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--gray);
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* UKŁAD PLAKATÓW - OGRANICZENIE DO WYSOKOŚCI EKRANU */
.layout-posters .bento-card img,
.layout-posters img {
  max-height: calc(100vh - 120px) !important;
  width: auto !important;
  object-fit: contain !important;
  margin: 0 auto;
}

/* WSPÓLNY INTERAKTYWNY LIGHTBOX */
.custom-lightbox {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: #000000 !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.custom-lightbox.is-active {
  display: flex !important;
  opacity: 1 !important;
}

.lightbox-content-wrapper {
  position: relative !important;
  max-width: 90% !important;
  max-height: 85vh !important;
  display: flex !important;
  z-index: 100000 !important;
  transform: scale(0.97);
  transition: transform 0.25s ease;
}

.custom-lightbox.is-active .lightbox-content-wrapper {
  transform: scale(1) !important;
}

.custom-lightbox img {
  width: 100% !important;
  height: auto !important;
  max-height: 85vh !important;
  object-fit: contain !important;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.95) !important;
  border-radius: 2px !important;
  cursor: default !important;
}

.lightbox-close-btn {
  position: absolute !important;
  top: -40px !important;
  right: 0 !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #FFFFFF !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 32px !important;
  font-weight: 300 !important;
  cursor: pointer !important;
  opacity: 0.7 !important;
  z-index: 100010 !important;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lightbox-close-btn:hover {
  opacity: 1 !important;
  transform: scale(1.1) !important;
}

.lightbox-arrow {
  position: fixed !important;
  top: 50% !important;
  width: 56px !important;
  height: 56px !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #FFFFFF !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 10010 !important;
  cursor: pointer !important;
  opacity: 0.4 !important;
  transition: opacity 0.2s ease, transform 0.2s ease !important;
  user-select: none !important;
}

.lightbox-arrow span {
  font-family: -apple-system, sans-serif !important;
  font-size: 48px !important;
  font-weight: 200 !important;
  display: block !important;
}

.arrow-left { left: 32px !important; transform: translateY(-50%) !important; }
.arrow-right { right: 32px !important; transform: translateY(-50%) !important; }

/* GÓRNY BAR FILTRÓW */
.portfolio-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  width: 100%;
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--line) !important;
  padding: 8px 16px;
  border-radius: 100px;
  color: var(--ink-soft);
  background: var(--bg-tile);
  transition: all 0.25s ease;
}

.filter-btn:hover {
  color: var(--ink);
  border-color: var(--ink) !important;
}

.filter-btn.active {
  background: var(--brand-blue) !important;
  color: #FFFFFF !important;
  border-color: var(--brand-blue) !important;
}

/* KOMPONENT INTERAKTYWNYCH POSTÓW INSTAGRAM (PEŁNE STYLE) */
.instagram-post {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  position: relative;
  width: 100%;
}

.instagram-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.instagram-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.instagram-avatar-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: #EAEAEA;
  flex-shrink: 0;
}

.instagram-avatar {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 50% !important;
}

.instagram-username {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.instagram-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5; 
  background: #000;
}

.instagram-slider {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  width: 100%;
  height: 100%;
  scrollbar-width: none;
  cursor: grab;
}

.instagram-slider:active { cursor: grabbing; }
.instagram-slider::-webkit-scrollbar { display: none; }

.instagram-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
}

.instagram-slide img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  display: block !important;
  object-fit: cover !important;
}

.instagram-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  border-radius: 50%;
  color: #000000;
  z-index: 10;
  transition: opacity 0.2s, background-color 0.2s;
  cursor: pointer;
  
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
}

.instagram-arrow span {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  display: inline-block !important;
  transform: translateY(-1px);
}

.instagram-arrow:hover { 
  background: #ffffff; 
}

.instagram-arrow.left { 
  left: 12px; 
}

.instagram-arrow.right { 
  right: 12px; 
}

.instagram-arrow.hidden { 
  opacity: 0; 
  pointer-events: none; 
}

.instagram-actions-bar {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  background: #fff;
}

.instagram-actions-left { display: flex; gap: 16px; align-items: center; }

.instagram-icon-pic {
  width: 22px !important;
  height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  object-fit: contain !important;
  cursor: pointer;
  display: inline-block !important;
}

.instagram-footer {
  padding: 0 16px 14px 16px;
  display: flex;
  justify-content: center;
  background: #fff;
}

.instagram-dots { display: flex; gap: 6px; }
.instagram-dot { width: 6px; height: 6px; background: #cccccc; border-radius: 50%; transition: background 0.2s ease; }
.instagram-dot.active { background: var(--brand-blue); }

/* RESPONSYWNOŚĆ DLA MOBILNYCH */
@media (max-width: 960px) {
  .project-wrap {
    padding: 0 20px;
  }

  .project-shell {
    grid-template-columns: 1fr !important;
    min-height: auto;
  }

  .project-sidebar {
    position: relative !important;
    top: auto;
    height: auto !important;
    padding: 32px 0 24px 0 !important;
    border-right: none !important;
    border-bottom: 1px solid var(--line);
  }

  .project-detail-desc {
    max-height: none !important;
    overflow-y: visible !important;
  }

  .project-gallery-container {
    padding: 32px 0 !important;
    min-height: auto;
  }

  .layout-posters img {
    max-height: none !important;
    width: 100% !important;
  }

  .home-shell {
    grid-template-columns: 1fr !important;
  }

  .home-sidebar {
    position: relative !important;
    top: auto;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    padding: 24px 20px !important;
    border-bottom: 1px solid var(--line);
  }

  .home-main {
    padding: 0 20px 40px !important;
  }

  .masonry {
    column-count: 1 !important;
  }

  .layout-fundacja-hybrid .project-asymmetric-row {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .mobile-menu-wrapper .home-nav a.active {
    display: none !important;
  }
}

@media (max-width: 720px) {
  .lightbox-arrow { display: none !important; }

  .project-detail-title {
    font-size: 26px !important;
  }

  .project-meta-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }

  .meta-label { font-size: 10px !important; }
  .meta-value { font-size: 12px !important; }
  
  .instagram-arrow { display: none !important; }
}