/* Fotoarchiv Horní Slavkov — světlý archivní design */
:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #efe9dd;
  --ink: #23211c;
  --ink-soft: #5d574c;
  --ink-faint: #908871;
  --line: #ddd5c5;
  --accent: #9a3b2e;       /* cihlová — odkaz na historické město */
  --accent-soft: #c25a48;
  --accent-ink: #fff;
  --ok: #2f6f4f;
  --warn: #9a6b1f;
  --err: #9a2f2f;
  --shadow: 0 1px 3px rgba(40,33,20,.10), 0 6px 24px rgba(40,33,20,.06);
  --radius: 12px;
  --maxw: 1180px;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* --- Header --- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header .bar {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 20px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .logo {
  font-family: var(--serif); font-weight: 700; font-size: 22px;
  color: var(--ink); letter-spacing: .2px;
}
.brand .logo b { color: var(--accent); }
.brand .tag { font-size: 12px; color: var(--ink-faint); }
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a {
  color: var(--ink-soft); padding: 7px 13px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent); color: var(--accent-ink); }
.nav a.cta {
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.nav a.cta:hover { background: var(--accent-soft); }
.nav .admin-link { color: var(--ink-faint); font-size: 13px; }

/* --- Layout --- */
main { flex: 1; width: 100%; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 24px 20px 56px; }
.page-head { margin: 8px 0 22px; }
.page-head h1 { font-family: var(--serif); font-size: 30px; font-weight: 700; }
.page-head p { color: var(--ink-soft); margin-top: 4px; max-width: 60ch; }

/* --- Buttons / forms --- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 18px; border: 1px solid transparent; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-soft); text-decoration: none; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: var(--err); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { font-size: 14px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font-size: 15px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-soft); }
.field { margin-bottom: 16px; }
.hint { font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; font-weight: 400; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* --- Cards / panels --- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.muted { color: var(--ink-faint); }
.empty {
  text-align: center; padding: 60px 20px; color: var(--ink-faint);
}
.empty .big { font-size: 44px; margin-bottom: 10px; opacity: .6; }

/* --- Badges / chips --- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px;
  border-radius: 999px; background: var(--surface-2); color: var(--ink-soft);
  font-size: 12.5px; font-weight: 600; border: 1px solid var(--line);
}
.chip .x { cursor: pointer; opacity: .6; }
.year-badge {
  background: rgba(154,59,46,.10); color: var(--accent); border-color: rgba(154,59,46,.25);
}

/* --- Photo grid --- */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.tile {
  position: relative; background: var(--surface-2); border-radius: 10px; overflow: hidden;
  aspect-ratio: 4/3; cursor: pointer; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.tile:hover img { transform: scale(1.04); }
.tile .meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.6)); color: #fff;
  font-size: 13px; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px;
}
.tile .play {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.55); color: #fff;
  border-radius: 999px; width: 30px; height: 30px; display: grid; place-items: center; font-size: 14px;
}

/* --- Footer --- */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--line); color: var(--ink-faint);
  font-size: 13px;
}
.site-footer .inner {
  max-width: var(--maxw); margin: 0 auto; padding: 18px 20px;
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between;
}
.site-footer a { color: var(--ink-soft); }

/* --- Toast / flash --- */
.toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  padding: 11px 20px; border-radius: 10px; font-size: 14px; z-index: 4000;
  box-shadow: var(--shadow); display: none; max-width: 90vw;
}
.toast.show { display: block; }
.toast.success { background: var(--ok); color: #fff; }
.toast.error { background: var(--err); color: #fff; }
.toast.info { background: var(--ink); color: #fff; }

/* --- Lightbox --- */
/* z-index musí být nad Leaflet vrstvami/ovládáním (ty jdou až ~1000), jinak mapa prosvítá přes lightbox */
.lb { position: fixed; inset: 0; background: rgba(20,17,12,.92); z-index: 2000; display: none; }
.lb.show { display: flex; flex-direction: column; }
.lb-stage { flex: 1; display: grid; place-items: center; padding: 20px; min-height: 0; }
.lb-stage img, .lb-stage video { max-width: 95vw; max-height: 80vh; border-radius: 6px; }
.lb-stage iframe { width: min(95vw, 960px); aspect-ratio: 16/9; border: 0; border-radius: 6px; }
.lb-info { color: #f0ece3; padding: 14px 24px 22px; max-width: var(--maxw); margin: 0 auto; width: 100%; }
.lb-info h3 { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.lb-info .sub { color: #c9c2b4; font-size: 14px; margin-top: 3px; display: flex; gap: 14px; flex-wrap: wrap; }
.lb-info .tags { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.lb-close, .lb-nav {
  position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0;
  width: 46px; height: 46px; border-radius: 999px; cursor: pointer; font-size: 22px;
  display: grid; place-items: center;
}
.lb-close { top: 16px; right: 16px; }
.lb-nav { top: 45%; }
.lb-nav.prev { left: 16px; } .lb-nav.next { right: 16px; }
.lb-report { color: #d9b3ad; font-size: 13px; background: none; border: 0; cursor: pointer; margin-top: 10px; }

/* --- Reakce & komentáře --- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.reactions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.react-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  font-size: 14.5px; font-weight: 600; font-family: inherit; transition: background .15s, border-color .15s;
}
.react-btn:hover { background: var(--surface-2); }
.react-btn.on { background: rgba(154,59,46,.10); border-color: var(--accent-soft); color: var(--accent); }
.react-btn .rc { font-variant-numeric: tabular-nums; color: var(--ink-faint); }
.react-btn.on .rc { color: var(--accent); }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment .c-head { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.comment .c-body { margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.comment .c-report { background: none; border: 0; color: var(--ink-faint); font-size: 12px; cursor: pointer; margin-top: 4px; }
.comment .c-report:hover { color: var(--err); }

/* --- Timelapse přehrávač --- */
.tl-player { position: fixed; inset: 0; background: rgba(15,13,9,.96); z-index: 2500; display: none; flex-direction: column; }
.tl-player.show { display: flex; }
.tl-stage { flex: 1; display: grid; place-items: center; min-height: 0; padding: 16px; }
.tl-stage img { max-width: 96vw; max-height: 72vh; border-radius: 6px; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.tl-year { text-align: center; font-family: var(--serif); font-size: 40px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.tl-meta { text-align: center; color: #c9c2b4; font-size: 15px; margin-top: 2px; padding: 0 16px; }
.tl-ctrl { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 14px; flex-wrap: wrap; }
.tl-ctrl button { background: rgba(255,255,255,.12); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 999px; font-size: 18px; cursor: pointer; }
.tl-ctrl button:hover { background: rgba(255,255,255,.22); }
.tl-ctrl #tl-toggle { background: var(--accent); width: 52px; height: 52px; font-size: 20px; }
.tl-ctrl input[type=range] { width: min(40vw, 320px); accent-color: var(--accent-soft); }
.tl-ctrl select { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 8px; padding: 6px 8px; }
.tl-pos { color: #c9c2b4; font-size: 13px; min-width: 64px; text-align: center; }
.tl-note { text-align: center; color: #908871; font-size: 12.5px; padding-bottom: 10px; }
.tl-close { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 46px; height: 46px; border-radius: 999px; font-size: 20px; cursor: pointer; z-index: 2; }
@media (prefers-reduced-motion: reduce) { .tl-stage img { transition: none; } }

/* --- Token input (chip + našeptávač) --- */
.token-input { position: relative; }
.ti-chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  padding: 6px 8px; min-height: 42px;
}
.ti-chips:focus-within { border-color: var(--accent-soft); }
.ti-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  background: var(--accent); color: #fff; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.ti-chip.ti-new { background: var(--warn); }
.ti-chip b { cursor: pointer; opacity: .8; font-weight: 700; }
.ti-text { border: 0; flex: 1; min-width: 120px; padding: 4px; background: transparent; font-size: 14px; }
.ti-text:focus { outline: none; }
.ti-drop {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 60; margin-top: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow);
  max-height: 240px; overflow: auto;
}
.ti-opt { padding: 8px 12px; cursor: pointer; font-size: 14px; }
.ti-opt:hover, .ti-opt.on { background: var(--surface-2); }
.ti-opt.ti-create { color: var(--accent); font-weight: 600; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .brand .tag { display: none; }
  .page-head h1 { font-size: 24px; }
  .nav a { padding: 6px 10px; font-size: 13.5px; }
}
