/* Galeria QR — styl „Ciemnia” (grafit, krem i jeden czerwony akcent lampy ciemniowej) */
:root {
  --bg: #121214;
  --surface: #1b1b1f;
  --surface-2: #24242a;
  --ink: #ede9e1;
  --muted: #a29e97;
  --line: #34343b;
  --line-strong: #3f3f47;
  --accent: #ff4a2e;
  --accent-hover: #ff6249;
  --accent-ink: #140a08;
  --ember: #2a1714;
  --placeholder: #807c76;
  --error: #ff8a75;
  --ok: #8fd19e;
  --scrim: #0b0b0c;
  --r-sm: 6px;
  --r-md: 18px;
  --font-head: 'Clash Display', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Satoshi', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.05; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.2rem, 9vw, 4.2rem); }
h2 { font-size: clamp(1.4rem, 4.5vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.eyebrow { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.accent { color: var(--accent); }

.wrap { width: min(1240px, 100%); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 24px; } }

/* ---- Przyciski ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: transparent;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-quiet { border-color: var(--line-strong); }
.btn-quiet:hover { border-color: var(--ink); }
.btn-sm { min-height: 38px; padding: 0 16px; font-size: 0.9rem; }
.btn-danger { border-color: var(--line-strong); color: var(--error); }
.btn-danger:hover { border-color: var(--error); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-big { min-height: 58px; font-size: 1.05rem; padding: 0 28px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgb(18 18 20 / 70%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---- Formularze ---- */
.field { display: grid; gap: 6px; }
.field label { font-size: 0.9rem; color: var(--muted); }
.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  outline: none;
}
.input::placeholder { color: var(--placeholder); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(255 74 46 / 25%); }
textarea.input { min-height: 84px; resize: vertical; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); position: relative; margin: 0; flex: none; cursor: pointer; transition: background-color 0.15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform 0.15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- Ziarno filmowe ---- */
.grain::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.grain > * { position: relative; z-index: 1; }

/* ---- Powiadomienia ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  opacity: 0;
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Galeria (siatka zdjęć) ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
@media (min-width: 600px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(6, 1fr); gap: 8px; } }
.tile {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
  animation: tile-in 0.45s ease both;
}
@media (min-width: 600px) { .tile { border-radius: 10px; } }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease, opacity 0.3s; }
.tile:hover img { transform: scale(1.04); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile .noprev { display: grid; place-items: center; height: 100%; font-size: 0.75rem; color: var(--muted); padding: 8px; text-align: center; }
.tile.pending img { opacity: 0.45; }
.tile .badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}
@keyframes tile-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

/* ---- Podgląd pełnoekranowy ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--scrim);
  animation: fade-in 0.2s ease;
}
.lightbox .lb-top, .lightbox .lb-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}
.lightbox .lb-top { justify-content: space-between; padding-top: calc(12px + env(safe-area-inset-top)); }
.lightbox .lb-bottom { justify-content: space-between; padding-bottom: calc(14px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.lightbox .lb-stage { position: relative; overflow: hidden; touch-action: pan-y; min-height: 0; }
.lightbox .lb-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; transition: transform 0.2s ease; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox .lb-prev { left: 12px; }
.lightbox .lb-next { right: 12px; }
@media (hover: none) { .lightbox .lb-nav { display: none; } }
.lightbox .lb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- Okno dialogowe ---- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  align-items: end;
  justify-items: center;
  background: rgb(11 11 12 / 75%);
  animation: fade-in 0.2s ease;
}
@media (min-width: 600px) { .sheet-backdrop { align-items: center; } }
.sheet {
  width: min(460px, 100%);
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md) var(--r-md) 0 0;
  display: grid;
  gap: 16px;
  animation: sheet-in 0.25s ease;
}
@media (min-width: 600px) { .sheet { border-radius: var(--r-md); padding: 28px; } }
.sheet .row { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet .row .btn { flex: 1; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- Zakładki ---- */
.tabs { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.tab { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 500; }
.tab[aria-selected='true'] { background: var(--ink); color: var(--bg); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
