/* ============================================================
   TOKENS
   ============================================================ */
:root{
  --accent: #c9a227;
  --accent-soft: #c9a22733;
  --radius: 3px;
  --gap: 3px;
  --header-h: 134px;
  --ease: cubic-bezier(.4,0,.2,1);
  --dur: .28s;
}

[data-theme="dark"]{
  --bg: #0c0c0d;
  --bg-elevated: #141416;
  --text: #ededec;
  --text-dim: #8d8d90;
  --border: #232326;
  --overlay: rgba(8,8,9,.94);
  --thumb-bg: #1a1a1c;
}

[data-theme="light"]{
  --bg: #f5f5f3;
  --bg-elevated: #ffffff;
  --text: #17171a;
  --text-dim: #6b6b6f;
  --border: #e2e2df;
  --overlay: rgba(245,245,243,.97);
  --thumb-bg: #eaeae7;
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body{
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  overflow-x: hidden;
}

img{
  max-width: 100%;
  display: block;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none; /* wyłącza menu "Zapisz zdjęcie" po długim przytrzymaniu na iOS */
}

button{ font-family: inherit; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header{
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.logo{
  display: flex;
  align-items: center;
  height: 100%;
}

.logo-img{
  height: 106px;
  width: auto;
  display: none;
}

/* logo-light.png ma ciemny tekst -> pokazujemy je na jasnym tle,
   logo-dark.png to sama ikona -> pokazujemy je na ciemnym tle */
[data-theme="light"] .logo-img-light{ display: block; }
[data-theme="dark"] .logo-img-dark{ display: block; }

.header-actions{
  display: flex;
  align-items: center;
  gap: 22px;
}

.icon-group{
  display: flex;
  gap: 12px;
}

.header-actions .icon-btn{
  width: 68px;
  height: 68px;
}
.header-actions .icon{
  width: 28px;
  height: 28px;
}

.site-nav{
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
  padding-right: 18px;
  border-right: 1px solid var(--border);
}

.nav-link{
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 64px;
  padding: 0 20px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: 999px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav-link:hover{ color: var(--text); background: var(--border); }
.nav-link.active{
  color: var(--accent);
  background: transparent;
}
.nav-link.active::after{
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 8px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.icon-btn{
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform .15s var(--ease), background var(--dur) var(--ease);
}
.icon-btn:hover{
  border-color: var(--accent);
  background: var(--accent-soft);
}
.icon-btn:active{ transform: scale(.92); }

.icon{
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* theme icon swap */
.icon-moon{ display: none; }
[data-theme="dark"] .icon-sun{ display: none; }
[data-theme="dark"] .icon-moon{ display: block; }

/* fullscreen icon swap */
.icon-collapse{ display: none; }
.is-fullscreen .icon-expand{ display: none; }
.is-fullscreen .icon-collapse{ display: block; }

/* ============================================================
   GRID
   ============================================================ */
main{ padding: var(--gap); }

.status-message{
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
  font-size: .95rem;
  display: none;
}
.status-message.visible{ display: block; }

.grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
}

/* ============================================================
   PAGINACJA
   ============================================================ */
.pagination{
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 32px 16px 12px;
}

.page-btn{
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.page-btn:hover:not(:disabled){
  border-color: var(--accent);
  background: var(--accent-soft);
}
.page-btn:disabled{
  opacity: .35;
  cursor: default;
}
.page-btn.active{
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1305;
}

.page-dots{
  color: var(--text-dim);
  padding: 0 4px;
  font-size: .85rem;
  user-select: none;
}

.thumb{
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--thumb-bg);
  cursor: pointer;
  border: none;
  padding: 0;
  display: block;
}

.thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease), opacity .4s var(--ease);
  opacity: 0;
}
.thumb img.loaded{ opacity: 1; }

.thumb:hover img{ transform: scale(1.045); }

.thumb-caption{
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px 8px;
  font-size: .78rem;
  letter-spacing: .01em;
  color: #f2f2f0;
  background: linear-gradient(to top, rgba(0,0,0,.72), transparent);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  pointer-events: none;
}
.thumb:hover .thumb-caption,
.thumb:focus-visible .thumb-caption{
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   VIEWER (shared shell for lightbox + cinema)
   ============================================================ */
.viewer{
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--overlay);
  display: none;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.viewer.open{ display: block; }
.viewer.open.show{ opacity: 1; }

/* ---------- LIGHTBOX ---------- */
.lb{
  position: absolute;
  inset: 0;
  display: none;
  grid-template-rows: 1fr auto auto;
  padding: 24px clamp(16px, 4vw, 64px) 20px;
}
.viewer.mode-lightbox .lb{ display: grid; }

.lb-close{
  position: absolute;
  top: 20px;
  right: clamp(16px, 4vw, 64px);
  z-index: 5;
}

.lb-stage{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.lb-figure{
  position: relative;
  margin: 0;
  height: 80vh;
  max-height: 80vh;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-image{
  max-height: 80vh;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  opacity: 0;
  transform: scale(.985);
  transition: opacity .28s var(--ease), transform .28s var(--ease);
}
.lb-image.loaded{ opacity: 1; transform: scale(1); }

.lb-nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  transition: opacity .2s var(--ease), border-color var(--dur), background var(--dur), transform .15s;
}
.lb-nav .icon{ width: 22px; height: 22px; }
.lb-nav:hover{ border-color: var(--accent); background: var(--accent-soft); }
.lb-nav:active{ transform: translateY(-50%) scale(.92); }
.lb-prev{ left: 16px; }
.lb-next{ right: 16px; }

.lb-tools{
  position: absolute;
  right: 100px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 4;
  transition: opacity .2s var(--ease);
}
.lb-tools .icon-btn{
  width: 46px;
  height: 46px;
  background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
}
.lb-tools .icon-btn .icon{ width: 20px; height: 20px; }

/* Na desktopie (urządzenia z myszką) strzałki i narzędzia są
   niewidoczne, dopóki użytkownik nie najedzie na zdjęcie —
   dzięki temu sam podgląd zdjęcia jest czystszy. Na urządzeniach
   dotykowych (bez prawdziwego hover) zostają zawsze widoczne. */
@media (hover: hover) and (pointer: fine){
  .lb-nav,
  .lb-tools{
    opacity: 0;
    pointer-events: none;
  }
  .lb-figure:hover .lb-nav,
  .lb-figure:hover .lb-tools,
  .lb-nav:focus-visible,
  .lb-tools:focus-within{
    opacity: 1;
    pointer-events: auto;
  }
}

.lb-caption{
  text-align: center;
  padding: 14px 10px 10px;
  font-size: .92rem;
  color: var(--text-dim);
  font-family: 'Fraunces', serif;
  font-style: italic;
  min-height: 1.4em;
}

.lb-thumbstrip{
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
}
.lb-thumbstrip::-webkit-scrollbar{ height: 5px; }
.lb-thumbstrip::-webkit-scrollbar-thumb{ background: var(--border); border-radius: 3px; }

.lb-thumb{
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: .5;
  transition: opacity var(--dur), border-color var(--dur);
  padding: 0;
  background: var(--thumb-bg);
}
.lb-thumb img{ width: 100%; height: 100%; object-fit: cover; }
.lb-thumb:hover{ opacity: .85; }
.lb-thumb.active{ opacity: 1; border-color: var(--accent); }

/* ---------- CINEMA ---------- */
.cinema{
  position: absolute;
  inset: 0;
  display: none;
  background: #000;
}
.viewer.mode-cinema .cinema{ display: block; }

.cinema-tools{
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 6;
  display: flex;
  gap: 8px;
}
.cinema-tools .icon-btn{
  background: rgba(20,20,20,.5);
  border-color: rgba(255,255,255,.18);
  color: #f2f2f0;
}
.cinema-tools .icon-btn:hover{ background: rgba(20,20,20,.75); }

.cinema-track{
  position: absolute;
  inset: 0;
  display: flex;
  height: 100%;
  will-change: transform;
}
.cinema-track.dragging{ transition: none; }
.cinema-track:not(.dragging){ transition: transform .32s var(--ease); }

.cinema-slide{
  flex: 0 0 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 0 4px;
}
.cinema-slide img{
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.cinema-caption{
  position: absolute;
  left: 0; right: 0; bottom: 22px;
  text-align: center;
  color: #e8e8e6;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: .9rem;
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
  padding: 0 16px;
  pointer-events: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px){
  .lb-tools{
    right: auto;
    left: 50%;
    top: auto;
    bottom: 14px;
    transform: translateX(-50%);
    flex-direction: row;
  }
  .lb-nav{ top: auto; bottom: 14px; transform: none; }
  .lb-prev{ left: 14px; }
  .lb-next{ right: 14px; }
}

@media (max-width: 640px){
  .site-header{
    height: auto;
    flex-wrap: nowrap;
    align-items: center;
    padding: 10px 12px;
  }

  .logo-img{ height: 38px; }

  /* pierwszy rząd: logo + przyciski jasności/fullscreen;
     menu galerii przechodzi do własnego, pełnej szerokości
     rzędu poniżej — dzięki temu nic się nie ściska ani nie
     wychodzi poza ekran */
  .header-actions{
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 8px;
    gap: 8px;
  }

  .icon-group{ order: 1; gap: 8px; }
  .header-actions .icon-btn{ width: 38px; height: 38px; }
  .header-actions .icon{ width: 17px; height: 17px; }

  .site-nav{
    order: 2;
    flex-basis: 100%;
    justify-content: flex-end;
    margin-right: 0;
    padding-right: 0;
    border-right: none;
    gap: 2px;
  }
  .nav-link{ height: 38px; padding: 0 10px; font-size: 14px; }
  .nav-link.active::after{ left: 10px; right: 10px; bottom: 5px; }

  .grid{ grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); }
  .thumb-caption{ display: none; }
}

@media (max-width: 400px){
  .logo-img{ height: 34px; }
  .header-actions .icon-btn{ width: 34px; height: 34px; }
  .header-actions .icon{ width: 15px; height: 15px; }
  .site-nav{ justify-content: center; flex-wrap: wrap; }
  .nav-link{ padding: 0 8px; font-size: 12px; }
  .nav-link.active::after{ left: 8px; right: 8px; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ============================================================
   BANER COOKIE
   ============================================================ */
.cookie-banner{
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
  padding: 20px 20px 18px;
  display: none;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  opacity: 0;
  transform: translateY(16px) scale(.98);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.cookie-banner.visible{ display: grid; }
.cookie-banner.show{ opacity: 1; transform: translateY(0) scale(1); }

.cookie-icon{
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.cookie-icon .icon{ width: 19px; height: 19px; }

.cookie-text{ grid-column: 2; }

.cookie-title{
  margin: 4px 0 6px;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.02rem;
}

.cookie-desc{
  margin: 0;
  font-size: .83rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.cookie-actions{
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.cookie-btn{
  border-radius: 999px;
  padding: 9px 18px;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform .15s var(--ease);
}
.cookie-btn:active{ transform: scale(.96); }

.cookie-btn-ghost{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.cookie-btn-ghost:hover{ border-color: var(--text-dim); }

.cookie-btn-solid{
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #1a1305;
}
.cookie-btn-solid:hover{ filter: brightness(1.08); }

@media (max-width: 460px){
  .cookie-banner{
    right: 16px;
    left: 16px;
    bottom: 16px;
    width: auto;
  }
}

/* ============================================================
   STOPKA
   ============================================================ */
.site-footer{
  padding: 40px 28px 32px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: .82rem;
  line-height: 1.7;
}

.site-footer p{ margin: 0; }

.footer-email{
  color: var(--text-dim);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}
.footer-email:hover{
  color: var(--accent);
  text-decoration-color: var(--accent);
}
/* dopóki JS nie złoży adresu z powrotem, link jest pusty —
   ta minimalna wysokość zapobiega "skoczeniu" layoutu stopki */
.footer-email:empty::before{
  content: "\2026";
  opacity: .4;
}

@media (max-width: 640px){
  .site-footer{ padding: 32px 16px 24px; font-size: .78rem; }
}
