/* Galeria - ciemny motyw.
   Zasada: zdjęcia są najjaśniejszym elementem ekranu, interfejs się chowa.
   Bursztyn ("światło ciemni") oznacza wyłącznie zaznaczenie i fokus. */

@font-face {
  font-family: "Bricolage";
  src: url("/static/fonts/bricolage-grotesque-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage";
  src: url("/static/fonts/bricolage-grotesque-latin-ext-standard-normal.woff2") format("woff2");
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --black: #000;
  --raise: #17171a;          /* menu, okna dialogowe */
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .18);
  --paper: #f2efe9;          /* tekst */
  --dim: #8f8c86;            /* tekst pomocniczy */
  --safelight: #eba23c;      /* zaznaczenie, fokus, główna akcja */
  --danger: #ef5b47;
  --display: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  --ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(16px, 4vw, 48px);
  --bar: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--black); color: var(--paper); }
body { font: 15px/1.5 var(--ui); -webkit-font-smoothing: antialiased; min-height: 100vh; }
img { display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--safelight); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- przyciski */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: transparent;
  cursor: pointer; white-space: nowrap; font-size: 14px; font-weight: 500; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .3); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--paper); color: #000; border-color: var(--paper); }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-danger { color: var(--danger); border-color: rgba(239, 91, 71, .4); }
.btn-danger:hover { background: rgba(239, 91, 71, .1); border-color: var(--danger); }
.btn:disabled { opacity: .4; cursor: default; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--paper);
}
.icon-btn:hover { background: rgba(255, 255, 255, .09); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- górny pasek */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--bar);
  display: flex; align-items: center; gap: 12px; padding: 0 var(--pad);
  background: rgba(0, 0, 0, .72); backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.brand { font: 600 19px/1 var(--display); letter-spacing: -.02em; text-decoration: none; margin-right: auto; }
.brand-logo { height: 28px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #333;
  display: grid; place-items: center; font-weight: 600; font-size: 14px;
}
.avatar-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }

/* tryb zaznaczania zastępuje pasek */
.selbar { background: #000; border-bottom-color: var(--line); }
.selcount { font: 600 18px/1 var(--display); color: var(--safelight); margin-right: auto; }

/* ---------- menu rozwijane */
.menu {
  position: absolute; z-index: 60; min-width: 220px; padding: 6px; border-radius: 14px;
  background: var(--raise); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .7);
}
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head b { display: block; font-weight: 600; }
.menu-head span { color: var(--dim); font-size: 13px; }
.menu button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px;
  border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left;
}
.menu button:hover { background: rgba(255, 255, 255, .07); }
.menu button.danger { color: var(--danger); }
.menu svg { width: 18px; height: 18px; color: var(--dim); }

/* ---------- logowanie */
.login {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center;
  padding: var(--pad); gap: 32px; max-width: 880px; margin: 0 auto;
}
.login h1 {
  font: 300 clamp(56px, 12vw, 148px)/.88 var(--display); letter-spacing: -.055em; margin: 0;
}
.login p { color: var(--dim); font-size: 17px; max-width: 34ch; margin: 0; }
.login .btn { height: 52px; padding: 0 24px; font-size: 16px; justify-self: start; }
.google-g { width: 20px; height: 20px; }
.login-error {
  border-left: 2px solid var(--danger); padding: 4px 0 4px 14px; color: var(--paper); max-width: 52ch;
}

/* ---------- lista albumów */
.page { padding: 8px var(--pad) 96px; }
.page-head { display: flex; align-items: end; gap: 16px; margin: 28px 0 32px; flex-wrap: wrap; }
.page-head h1 { font: 400 clamp(40px, 6vw, 72px)/.95 var(--display); letter-spacing: -.045em; margin: 0 auto 0 0; }
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 40px 24px; }
.album-card { text-decoration: none; display: block; }
.album-cover {
  aspect-ratio: 4 / 5; border-radius: 6px; overflow: hidden; background: #111;
  position: relative;
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.album-card:hover .album-cover img { transform: scale(1.03); }
.album-cover .empty { position: absolute; inset: 0; display: grid; place-items: center; color: #444; }
.album-cover .empty svg { width: 42px; height: 42px; }
.album-card h2 { font: 500 21px/1.15 var(--display); letter-spacing: -.02em; margin: 14px 0 4px; }
.album-card .meta { color: var(--dim); font-size: 13.5px; }
.role-tag { color: var(--safelight); }

.empty-state { padding: 80px 0; max-width: 44ch; }
.empty-state h2 { font: 400 32px/1.1 var(--display); letter-spacing: -.03em; margin: 0 0 12px; }
.empty-state p { color: var(--dim); margin: 0 0 24px; }

/* ---------- widok albumu */
.hero { position: relative; margin-top: calc(-1 * var(--bar)); min-height: 52vh; display: flex; align-items: flex-end; overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; filter: saturate(.85); }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,.35) 65%, #000 100%);
}
.hero-inner { position: relative; z-index: 1; padding: calc(var(--bar) + 40px) var(--pad) 28px; width: 100%; }
.hero h1 {
  font: 300 clamp(48px, 10vw, 136px)/.86 var(--display); letter-spacing: -.055em; margin: 0 0 18px;
  max-width: 16ch; text-wrap: balance;
}
.hero .desc { max-width: 60ch; color: rgba(242, 239, 233, .82); margin: 0 0 14px; font-size: 16px; }
.hero .stats { color: var(--dim); font-size: 14px; display: flex; gap: 18px; flex-wrap: wrap; }
.hero.no-cover { min-height: 0; }
.hero.no-cover .hero-inner { padding-top: 48px; }

.album-actions { display: flex; gap: 8px; align-items: center; }

/* oś czasu */
.timeline { padding: 0 var(--pad) 120px; }
.day { margin-top: 36px; }
.day-head {
  position: sticky; top: var(--bar); z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 12px 0; background: linear-gradient(#000 70%, rgba(0,0,0,0));
}
.day-head h3 { font: 500 17px/1.2 var(--display); letter-spacing: -.01em; margin: 0; }
.day-head .n { color: var(--dim); font-size: 13px; }
.day-head .daycheck { margin-left: -6px; }
.rows { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; gap: 4px; }

.tile {
  position: relative; flex: none; overflow: hidden; background: #0f0f10; cursor: zoom-in;
  border: 0; padding: 0; border-radius: 2px;
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease, opacity .3s; opacity: 0; }
.tile img.loaded { opacity: 1; }
.tile::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.45), rgba(0,0,0,0) 38%); opacity: 0; transition: opacity .15s;
}
.tile:hover::after, .selecting .tile::after { opacity: 1; }
.check {
  position: absolute; top: 8px; left: 8px; z-index: 2; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.85); background: rgba(0,0,0,.2); display: grid; place-items: center;
  opacity: 0; transition: opacity .15s, background .15s, border-color .15s; cursor: pointer;
}
.check svg { width: 14px; height: 14px; color: #000; opacity: 0; }
.tile:hover .check, .selecting .check, .tile:focus-visible .check { opacity: 1; }
.selecting .tile { cursor: pointer; }
.tile.selected img { transform: scale(.88); border-radius: 3px; }
.tile.selected { background: rgba(235, 162, 60, .16); }
.tile.selected .check { background: var(--safelight); border-color: var(--safelight); opacity: 1; }
.tile.selected .check svg { opacity: 1; }
.tile.selected::after { opacity: 0; }

/* upuszczanie plików */
.dropzone {
  position: fixed; inset: 12px; z-index: 70; border: 2px dashed var(--safelight); border-radius: 18px;
  background: rgba(0, 0, 0, .82); display: none; place-items: center; text-align: center; pointer-events: none;
}
.dropzone.on { display: grid; }
.dropzone b { font: 400 clamp(28px, 4vw, 48px)/1.1 var(--display); letter-spacing: -.03em; display: block; }
.dropzone span { color: var(--dim); }

/* panel wgrywania */
.uploads {
  position: fixed; right: 16px; bottom: 16px; z-index: 65; width: min(380px, calc(100vw - 32px));
  background: var(--raise); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.7);
}
.uploads-head { display: flex; align-items: center; padding: 10px 8px 10px 16px; gap: 8px; border-bottom: 1px solid var(--line); }
.uploads-head b { margin-right: auto; font-weight: 600; font-size: 14px; }
.uploads-list { max-height: 260px; overflow: auto; padding: 6px 0; }
.up { padding: 8px 16px; font-size: 13px; }
.up-name { display: flex; justify-content: space-between; gap: 12px; }
.up-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-status { color: var(--dim); flex: none; }
.up.err .up-status { color: var(--danger); }
.up.ok .up-status { color: var(--paper); }
.bar { height: 2px; background: var(--line); margin-top: 6px; border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--safelight); transition: width .2s; }
.up.ok .bar, .up.err .bar { display: none; }

/* ---------- podgląd zdjęcia */
.viewer { position: fixed; inset: 0; z-index: 80; background: #000; display: flex; }
.viewer-stage { position: relative; flex: 1; min-width: 0; display: grid; place-items: center; }
.viewer-stage img {
  max-width: 100%; max-height: 100vh; object-fit: contain; user-select: none; -webkit-user-drag: none;
}
.viewer-stage img.low { filter: blur(6px); }
.viewer-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 4px;
  padding: 10px 12px; background: linear-gradient(rgba(0,0,0,.6), rgba(0,0,0,0));
}
.viewer-top .spacer { flex: 1; }
.viewer-top .counter { color: var(--dim); font-size: 13px; margin-left: 8px; }
.nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 52px; height: 52px;
  border-radius: 50%; border: 0; background: rgba(0,0,0,.35); color: #fff; display: grid; place-items: center;
  cursor: pointer; opacity: .75;
}
.nav:hover { opacity: 1; background: rgba(0,0,0,.6); }
.nav svg { width: 26px; height: 26px; }
.nav.prev { left: 16px; }
.nav.next { right: 16px; }
.info {
  width: 360px; flex: none; background: #000; border-left: 1px solid var(--line); padding: 64px 28px 28px;
  overflow: auto; display: none;
}
.viewer.with-info .info { display: block; }
.info h2 { font: 400 26px/1.1 var(--display); letter-spacing: -.03em; margin: 0 0 4px; }
.info .sub { color: var(--dim); margin: 0 0 28px; font-size: 14px; }
.info dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 18px; }
.info dt { color: var(--dim); font-size: 12.5px; margin-bottom: 2px; }
.info dd { margin: 0; overflow-wrap: anywhere; }
.info .exposure { display: flex; gap: 14px; flex-wrap: wrap; }
.info .note { color: var(--dim); font-size: 12.5px; }

/* ---------- okna dialogowe */
.modal-back {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.72); display: grid; place-items: center; padding: 16px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--raise);
  border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.8);
}
.modal.wide { width: min(760px, 100%); }
.modal h2 { font: 400 28px/1.1 var(--display); letter-spacing: -.03em; margin: 0 0 8px; }
.modal p { color: var(--dim); margin: 0 0 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--dim); }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: #000; outline: none;
}
textarea.input { height: auto; min-height: 88px; padding: 10px 14px; resize: vertical; }
.input:focus { border-color: var(--safelight); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form .input { flex: 1 1 220px; width: auto; }
.inline-form select.input { flex: 0 0 auto; width: 160px; }

.people { list-style: none; margin: 20px 0 0; padding: 0; border-top: 1px solid var(--line); }
.people li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.people .who { flex: 1; min-width: 0; }
.people .who b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .who span { color: var(--dim); font-size: 13px; }
.people select.input { width: 150px; height: 36px; font-size: 13px; }
.badge { font-size: 12px; color: var(--safelight); }
.muted { color: var(--dim); }

/* ---------- powiadomienia */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast {
  background: var(--paper); color: #000; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 40px rgba(0,0,0,.6); animation: toast-in .25s ease-out;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

.loading { padding: 120px var(--pad); color: var(--dim); }

.legal { max-width: 68ch; padding-top: 48px; }
.legal h1 { font: 400 clamp(36px, 5vw, 56px)/1 var(--display); letter-spacing: -.04em; margin: 0 0 24px; }
.legal h2 { font: 500 20px/1.2 var(--display); margin: 32px 0 8px; }
.legal p, .legal li { color: rgba(242, 239, 233, .85); }
.legal a { color: var(--paper); }

@media (max-width: 720px) {
  .info { position: absolute; inset: auto 0 0 0; width: auto; max-height: 62vh; border-left: 0; border-top: 1px solid var(--line); padding: 24px 20px; border-radius: 18px 18px 0 0; z-index: 4; }
  .nav { display: none; }
  .albums { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 12px; }
  .album-card h2 { font-size: 17px; }
  .btn .lbl { display: none; }
  .btn:has(.lbl) { padding: 0 11px; }
  .tile:hover .check { opacity: 0; }
  .selecting .tile .check { opacity: 1; }
}

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