/* Galeria Rodzinna – style */
:root {
  --bg: #f6f1ea;
  --bg2: #efe7dc;
  --card: #fffdf9;
  --text: #2a2520;
  --muted: #7a6f63;
  --line: #e4d9cb;
  --accent: #b5552b;
  --accent2: #8f3f1d;
  --accent-soft: #f5e1d5;
  --ok: #2f7d4f;
  --bad: #b3261e;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .08);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1916; --bg2: #24211d; --card: #262320; --text: #efe8df; --muted: #a89c8e;
    --line: #3a352f; --accent: #e08a5c; --accent2: #f0a57c; --accent-soft: #3d2a20;
    --ok: #6cc28f; --bad: #ff8a80;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); }
svg { width: 1.15em; height: 1.15em; fill: currentColor; flex: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
h2 { font-size: 1.3rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
code { background: var(--bg2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1400px; margin: 0 auto; padding: 1rem clamp(.75rem, 3vw, 2rem) 2rem; flex: 1; }
.inline { display: inline; margin: 0; }

/* Przyciski */
.btn {
  display: inline-flex; align-items: center; gap: .45em; padding: .55em 1em; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: .95rem;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.small { padding: .3em .7em; font-size: .85rem; }
.btn.wide { width: 100%; justify-content: center; padding: .8em; font-size: 1rem; }
.btn.on { background: var(--accent-soft); color: var(--accent2); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Górny pasek */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .55rem clamp(.75rem, 3vw, 2rem); padding-top: max(.55rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }
.who { color: var(--muted); font-size: .9rem; margin-right: .5rem; }
.who strong { color: var(--text); font-weight: 600; }
@media (max-width: 760px) {
  .who { display: none; }
  .top-actions .label { display: none; }
  .top-actions .btn { padding: .55em .65em; }
  .brand span { font-size: 1.1rem; }
}
.push-hint {
  margin: .75rem auto 0; max-width: 1400px; width: calc(100% - 1.5rem); padding: .75rem 1rem; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--text); font-size: .92rem;
}

/* Komunikaty */
.alert { padding: .75rem 1rem; border-radius: 10px; margin: 0 0 1rem; font-size: .95rem; border: 1px solid; }
.alert.error { background: color-mix(in srgb, var(--bad) 10%, var(--card)); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.alert.ok { background: color-mix(in srgb, var(--ok) 10%, var(--card)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.alert.info { background: var(--accent-soft); border-color: transparent; }

/* Logowanie */
.page-login .wrap { display: grid; place-items: center; }
.login { width: 100%; display: grid; place-items: center; min-height: 80vh; }
.login-card {
  width: min(420px, 100%); background: var(--card); padding: 2rem 1.75rem; border-radius: 22px; box-shadow: var(--shadow); text-align: center;
}
.login-logo { display: block; margin: 0 auto 1rem; }
.form { display: grid; gap: 1rem; text-align: left; margin-top: 1.25rem; }
.form label { display: grid; gap: .35rem; font-size: .92rem; font-weight: 500; }
input[type=email], input[type=password], input[type=text], input[type=search], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .7em .85em;
}
textarea { resize: vertical; min-height: 8rem; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.pw { position: relative; display: block; }
.pw input { padding-right: 3rem; }
.pw-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: .5rem; cursor: pointer; }

/* Tablica ogłoszeń */
.board {
  display: flex; gap: 1rem; background: var(--card); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow);
  margin: .5rem 0 1.75rem; border-left: 4px solid var(--accent);
}
.board-icon { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.board-icon svg { width: 1.4rem; height: 1.4rem; }
.board h2 { margin-bottom: .25rem; }
.board-text { overflow-wrap: anywhere; }
.board-date { color: var(--muted); font-size: .8rem; margin: .5rem 0 0; }

/* Lista albumów */
.albums-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.albums-head h1 { margin: 0; }
.count { display: inline-block; font: 600 .8rem/1 var(--font); background: var(--bg2); color: var(--muted); padding: .35em .6em; border-radius: 999px; vertical-align: middle; }
.search { position: relative; display: block; width: min(320px, 100%); }
.search svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 2.4rem; border-radius: 999px; background: var(--card); }
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 1.25rem; }
@media (max-width: 520px) { .albums { grid-template-columns: 1fr 1fr; gap: .75rem; } }
.album-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s;
}
.album-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(60,40,20,.08), 0 14px 32px rgba(60,40,20,.14); }
.cover { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg2); }
.cover::before {
  content: ""; position: absolute; inset: -20px; background: var(--cover, none) center / cover no-repeat;
  filter: blur(18px) saturate(1.2); opacity: .55;
}
.cover img { position: relative; width: 100%; height: 100%; object-fit: contain; display: block; }
.nocover { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.nocover svg { width: 3rem; height: 3rem; opacity: .5; }
.badge {
  position: absolute; right: .5rem; bottom: .5rem; background: rgba(0,0,0,.6); color: #fff; font-size: .78rem; font-weight: 600;
  padding: .2em .6em; border-radius: 999px; backdrop-filter: blur(4px);
}
.meta { padding: .8rem 1rem 1rem; }
.meta h3 { font-size: 1.1rem; margin: 0 0 .2rem; overflow-wrap: anywhere; }
.meta p { margin: 0; color: var(--muted); font-size: .85rem; }
@media (max-width: 520px) { .meta { padding: .6rem .7rem .75rem; } .meta h3 { font-size: .98rem; } }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-search { text-align: center; color: var(--muted); }

/* Album */
.crumbs { margin: .25rem 0 1rem; }
.back { display: inline-flex; align-items: center; gap: .2rem; text-decoration: none; color: var(--muted); font-size: .95rem; }
.back:hover { color: var(--accent); }
.album-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.album-head p { margin: 0; }
.album-desc { margin-top: .5rem !important; max-width: 65ch; }
.album-tools { display: flex; gap: .5rem; flex-wrap: wrap; }

.masonry { --cols: 4; --gap: 10px; display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: var(--gap); }
.masonry.js-masonry { display: flex; align-items: flex-start; }
.masonry .col { flex: 1; display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
@media (max-width: 1100px) { .masonry { --cols: 3; } }
@media (max-width: 640px) { .masonry { --cols: 2; --gap: 6px; } }
.tile {
  position: relative; margin: 0; overflow: hidden; border-radius: 8px; background: var(--bg2); cursor: zoom-in;
  -webkit-tap-highlight-color: transparent; outline-offset: 2px;
}
.masonry:not(.js-masonry) .tile { aspect-ratio: 1 !important; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .35s, transform .35s; }
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.025); }
.play {
  position: absolute; left: .45rem; bottom: .45rem; display: inline-flex; align-items: center; gap: .2rem; color: #fff; background: rgba(0,0,0,.55);
  padding: .15rem .5rem .15rem .3rem; border-radius: 999px; font-size: .75rem; font-weight: 600; pointer-events: none;
}
.check {
  position: absolute; top: .45rem; right: .45rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 2px solid #fff;
  background: rgba(0,0,0,.25); display: none; place-items: center; color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.check svg { opacity: 0; width: 1.1rem; height: 1.1rem; }
.selecting .tile { cursor: pointer; }
.selecting .check { display: grid; }
.tile.sel .check { background: var(--accent); border-color: var(--accent); }
.tile.sel .check svg { opacity: 1; }
.tile.sel img { transform: scale(.92); border-radius: 6px; }
.selbar {
  position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: center;
  background: var(--card); padding: .55rem .75rem .55rem 1.1rem; border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,.25);
  width: max-content; max-width: calc(100% - 1.5rem);
}
@media (max-width: 520px) { .selbar { border-radius: 18px; } #sel-all { display: none; } }

/* Lightbox */
.lb {
  position: fixed; inset: 0; z-index: 100; background: #0c0b0a; display: flex; flex-direction: column;
  touch-action: none; user-select: none; -webkit-user-select: none; color: #f2ede6;
}
.lb-top, .lb-bottom { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; z-index: 2; }
.lb-top { justify-content: space-between; padding-top: max(.5rem, env(safe-area-inset-top)); }
.lb-bottom { justify-content: center; padding-bottom: max(.6rem, env(safe-area-inset-bottom)); font-size: .85rem; color: #c9c0b5; text-align: center; }
.lb-btn {
  background: rgba(255,255,255,.08); border: 0; color: #fff; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  display: inline-grid; place-items: center; cursor: pointer; text-decoration: none;
}
.lb-btn:hover { background: rgba(255,255,255,.18); }
.lb-btn svg { width: 1.4rem; height: 1.4rem; }
.lb-counter { font-variant-numeric: tabular-nums; font-size: .9rem; color: #c9c0b5; }
.lb-stage { position: relative; flex: 1; overflow: hidden; display: grid; place-items: center; min-height: 0; }
.lb-track { position: absolute; inset: 0; display: flex; will-change: transform; }
.lb-slide { flex: 0 0 100%; display: grid; place-items: center; padding: 0 .5rem; min-width: 0; }
.lb-slide img, .lb-slide video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; transform-origin: center; }
.lb-slide video { background: #000; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; }
.lb-prev { left: .75rem; }
.lb-next { right: .75rem; }
@media (hover: none) { .lb-nav { background: rgba(0,0,0,.35); width: 2.4rem; height: 2.4rem; } }
.lb-spinner { position: absolute; width: 2.5rem; height: 2.5rem; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Panel admina */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 1rem 0 1.25rem; overflow-x: auto; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.panel { background: var(--card); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.panel .form { margin-top: 0; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filters input { flex: 1 1 260px; width: auto; }
.filters select { width: auto; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table tbody tr:hover { background: var(--bg); }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: .6rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.checks { list-style: none; padding: 0; margin: 0 0 1rem; }
.checks li { display: flex; gap: .75rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.checks .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--ok); flex: none; }
.checks li.bad .dot { background: var(--bad); }
.checks strong { min-width: 15rem; font-weight: 600; }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); }
.page-album .foot { padding-bottom: 5rem; }

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