/* Jediná barva na stránce jsou fotky – vše ostatní jsou neutrální šedé. */
:root {
  --bg: #0d0d0d;
  --bg-2: #161616;
  --bg-3: #1f1f1f;
  --line: #262626;
  --fg: #e6e6e6;
  --fg-2: #9a9a9a;
  --fg-3: #666;
  --h: 240px;
  --gap: 6px;
  --side: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Rozvržení ---- */

.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side);
  padding: 28px 20px; border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand { display: block; font-size: 15px; letter-spacing: .02em; color: var(--fg); margin-bottom: 24px; }
.brand-top { margin: 0 0 28px; }
.albums a {
  display: block; padding: 7px 10px; margin: 0 -10px; border-radius: 6px;
  color: var(--fg-2); font-size: 14px; line-height: 1.35;
}
.albums a:hover { color: var(--fg); background: var(--bg-2); }
.albums a.on { color: var(--fg); background: var(--bg-3); }

.main { padding: 32px 28px 120px; min-height: 100vh; }
body.with-side .main { margin-left: var(--side); }

.head { margin: 4px 0 26px; }
.head h1 { font-size: 26px; font-weight: 400; letter-spacing: -.01em; margin: 0; }
.meta { color: var(--fg-2); font-size: 13px; margin: 4px 0 0; }
.msg { color: var(--fg-2); margin: 20vh auto; text-align: center; }

/* ---- Mřížka (zarovnané řádky, výška podle posuvníku) ---- */

.grid { display: flex; flex-wrap: wrap; gap: var(--gap); }
.grid::after { content: ""; flex-grow: 1e6; }

.ph {
  position: relative; overflow: hidden; background: var(--bg-2); cursor: zoom-in; margin: 0;
  flex: var(--ar) 1 calc(var(--ar) * var(--h)); min-width: 0;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}
.ph::before { content: ""; display: block; padding-bottom: calc(100% / var(--ar)); }
.ph img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .4s, transform .5s cubic-bezier(.2,.7,.2,1), filter .3s;
}
.ph img.ok { opacity: 1; }
.ph::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: linear-gradient(to bottom, rgba(0,0,0,.45), transparent 30%, transparent 70%, rgba(0,0,0,.45));
}
@media (hover: hover) {
  .ph:hover img { transform: scale(1.035); }
  .ph:hover::after { opacity: 1; }
  .ph:hover .sel, .ph:hover .dl { opacity: 1; }
}

.sel, .dl {
  position: absolute; z-index: 2; opacity: 0; transition: opacity .2s, transform .2s;
  width: 34px; height: 34px; display: grid; place-items: center;
}
.sel { top: 6px; left: 6px; }
.dl { bottom: 6px; right: 6px; color: #fff; }
.dl svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.ring {
  width: 22px; height: 22px; border-radius: 50%; border: 1.6px solid rgba(255,255,255,.9);
  box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.4);
  display: grid; place-items: center; transition: background .15s;
}
.ring::after {
  content: ""; width: 9px; height: 5px; border: solid #111; border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg); opacity: 0;
}
.sel:hover .ring { background: rgba(255,255,255,.25); }

.grid.selecting .sel { opacity: 1; }
.ph.on img { transform: scale(.9); filter: brightness(.85); }
.ph.on .ring, .on > .ring { background: #fff; border-color: #fff; }
.ph.on .ring::after, .on > .ring::after { opacity: 1; }

/* ---- Hlavní stránka: titulní fotky alb ---- */

.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 20px; }
.cover { display: block; }
.cover .img { aspect-ratio: 3 / 2; background: var(--bg-2); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.cover:hover img { transform: scale(1.03); }
.cover .t { margin-top: 10px; font-size: 15px; }
.cover .n { color: var(--fg-3); font-size: 13px; }

/* ---- Heslo ---- */

.pw { max-width: 320px; margin: 22vh auto 0; text-align: center; }
.pw h1 { font-size: 22px; font-weight: 400; margin: 0; }
.pw input {
  display: block; width: 100%; margin: 24px 0 10px; padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); font: inherit; text-align: center;
}
.pw input:focus { outline: none; border-color: var(--fg-3); }
.pw button, .primary {
  background: var(--fg); color: #111; border-radius: 999px; padding: 10px 20px; font-weight: 500;
}
.pw button { width: 100%; }
.err { color: var(--fg); font-size: 13px; }

/* ---- Lišta výběru ---- */

.selbar {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 18px; white-space: nowrap;
  padding: 8px 8px 8px 20px; border-radius: 999px;
  background: rgba(30,30,30,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.5); font-size: 14px;
}
.link { color: var(--fg-2); }
.link:hover { color: var(--fg); }
.primary:disabled { opacity: .5; cursor: default; }

/* ---- Posuvník velikosti ---- */

.sizer {
  position: fixed; right: 20px; bottom: 20px; z-index: 10;
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
  background: rgba(22,22,22,.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); color: var(--fg-3);
}
.sizer svg { width: 16px; height: 16px; }
.sizer input { width: 120px; accent-color: var(--fg-2); }

/* ---- Lightbox ---- */

.lb { position: fixed; inset: 0; z-index: 50; background: #000; display: grid; place-items: center; touch-action: pan-y pinch-zoom; }
.lb img { max-width: calc(100vw - 140px); max-height: calc(100vh - 110px); object-fit: contain; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body.has-selection .lb img { max-height: calc(100vh - 190px); }
.lb-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px 22px;
}
.lb-actions { display: flex; gap: 4px; }
.icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--fg-2); }
.icon:hover { color: var(--fg); background: rgba(255,255,255,.08); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 60px; height: 100px; display: grid; place-items: center; color: var(--fg-3); }
.lb-nav:hover { color: var(--fg); }
.lb-nav svg { width: 30px; height: 30px; }
.prev { left: 6px; }
.next { right: 6px; }

.toast {
  position: fixed; left: 50%; top: 20px; transform: translateX(-50%); z-index: 60;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px; font-size: 14px;
}

/* ---- iPhone: příprava a uložení do Fotek ---- */

.sheet {
  position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 70;
  max-width: 420px; margin: 0 auto; padding: 18px 18px 14px; border-radius: 16px;
  background: rgba(30,30,30,.96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.sheet p { margin: 0 0 12px; font-size: 14px; }
.sheet .bar { height: 3px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.sheet .bar i { display: block; height: 100%; width: 0; background: var(--fg); transition: width .2s; }
.sheet-actions { display: flex; justify-content: flex-end; align-items: center; gap: 18px; margin-top: 14px; }

/* ---- Mobil ---- */

@media (max-width: 800px) {
  :root { --gap: 3px; }
  .side {
    position: static; width: auto; border: 0; border-bottom: 1px solid var(--line);
    padding: 14px 16px 10px; overflow: visible;
  }
  .brand { margin-bottom: 8px; }
  .albums { display: flex; gap: 4px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .albums a { flex: none; margin: 0; white-space: nowrap; }
  body.with-side .main { margin-left: 0; }
  .main { padding: 20px 3px 120px; }
  .head { padding: 0 13px; margin-bottom: 18px; }
  .brand-top { padding: 0 13px; margin-bottom: 18px; }
  .head h1 { font-size: 22px; }
  .covers { padding: 0 13px; grid-template-columns: 1fr; }
  .lb img { max-width: 100vw; max-height: calc(100vh - 140px); }
  body.has-selection .lb img { max-height: calc(100vh - 210px); }
  .lb-nav { display: none; }
  .selbar { gap: 14px; padding-left: 16px; font-size: 13px; }
  .selbar #selAll { display: none; }
}
@media (hover: none) {
  .dl { display: none; }
  .sel { opacity: 1; width: 44px; height: 44px; top: 0; left: 0; }
}
