/* Webcatalog — przeglądarka katalogu. Neutralny interfejs, bo treścią są zrzuty:
   im mniej koloru dookoła, tym uczciwiej widać kolorystykę katalogowanych stron. */

:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --line: #e2e2dd;
  --text: #16161a;
  --muted: #6c6c72;
  --accent: #2f5bd0;
  --accent-soft: #e8eefc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 8px 24px rgba(20, 20, 30, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --surface: #1c1c20;
    --line: #2c2c32;
    --text: #ecece9;
    --muted: #98989f;
    --accent: #7ea2ff;
    --accent-soft: #22283a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }

/* ── nagłówek ─────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 26px; line-height: 1; color: var(--accent); }
.brand h1 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.queued { color: var(--accent); }

.tabs { display: flex; gap: 4px; }
.tab {
  padding: 7px 15px; border-radius: 99px; font-size: 14px; font-weight: 500;
  color: var(--muted); border: 1px solid transparent;
}
.tab:hover { background: var(--surface); color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }

main { padding: 22px clamp(16px, 4vw, 40px) 60px; max-width: 1600px; margin: 0 auto; }

/* ── nagłówki i drobnica ──────────────────────────────────────────────── */
.section-title {
  margin: 30px 0 12px; font-size: 15px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  display: flex; align-items: center; gap: 10px; color: var(--text);
}
.section-title:first-child { margin-top: 6px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
s { text-decoration: none; font-size: 11.5px; font-weight: 600; color: var(--muted);
    background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px; }
.lead { margin: 0 0 16px; max-width: 70ch; color: var(--muted); font-size: 14px; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.warn { color: #c2410c; font-size: 13px; }
.crumbs { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.crumbs span { margin: 0 6px; }
.notes { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.pill { font-style: normal; font-size: 11px; background: var(--accent-soft); color: var(--accent);
        border-radius: 4px; padding: 1px 6px; }

/* ── chipsy kategorii / stylów ────────────────────────────────────────── */
.cat-switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 99px; font-size: 13px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.chip s { background: transparent; border: 0; padding: 0; }

/* ── kafle kategorii ──────────────────────────────────────────────────── */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cat-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); color: inherit; }
.cat-card.faded { opacity: .45; }
.cat-thumb { height: 110px; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.cat-thumb img { width: 100%; height: 110px; object-fit: cover; object-position: top center; display: block; }
.cat-body { padding: 10px 12px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cat-body b { font-size: 14px; }
.cat-body .notes { flex-basis: 100%; }
.no-img { color: var(--muted); font-size: 12px; }

/* ── siatka wycinków ──────────────────────────────────────────────────── */
.el-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 18px; }
.el-card {
  margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.el-img { background: var(--bg); max-height: 460px; overflow: hidden; display: block; }
.el-img img { width: 100%; display: block; }
.el-card figcaption { padding: 10px 13px 13px; display: flex; flex-wrap: wrap; gap: 5px 8px; align-items: baseline; }
.el-card figcaption b { font-size: 13.5px; font-weight: 600; }
.el-card .meta { font-size: 12.5px; color: var(--muted); flex-basis: 100%; }
.el-card .meta a { color: var(--accent); }
.tag { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
       color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 2px 7px; }

/* ── siatka zrzutów ───────────────────────────────────────────────────── */
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.shot-grid.wide { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.shot-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.shot-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); color: inherit; }
.shot-card.faded { opacity: .5; }
.shot-card img { width: 100%; height: 200px; object-fit: cover; object-position: top center; display: block; background: var(--bg); }
.shot-card .cap { display: flex; gap: 6px; align-items: baseline; justify-content: space-between; padding: 9px 11px 2px; font-size: 13px; }
.shot-card .notes { padding: 0 11px 10px; }

/* ── widok jednego zrzutu ─────────────────────────────────────────────── */
.shot-view { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.shot-full { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
             overflow: hidden; max-height: 78vh; }
.shot-full img { width: 100%; display: block; }
.shot-side h2 { margin: 0 0 6px; font-size: 19px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 16px; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ── płótno: ręczne wycinanie elementów ───────────────────────────────── */
.shot-full { overflow: auto; }
.canvas { position: relative; user-select: none; touch-action: none; }
.canvas img { width: 100%; display: block; }
/* Warstwa ramek przepuszcza kliknięcia w obraz, ale same ramki muszą je łapać —
   inaczej nie da się ich przeciągnąć. */
.boxes { position: absolute; inset: 0; pointer-events: none; }
.boxes[hidden] { display: none; }
.box {
  position: absolute; pointer-events: auto; cursor: grab;
  border: 1.5px solid rgba(47, 91, 208, .75); background: rgba(47, 91, 208, .07);
}
.box:hover { background: rgba(47, 91, 208, .16); border-width: 2px; }
.box.dragging { cursor: grabbing; background: rgba(47, 91, 208, .22); }
.box span { pointer-events: none; }
.box-del {
  position: absolute; top: -1px; right: -1px; width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 0 0 0 4px; cursor: pointer; opacity: 0; transition: opacity .1s ease;
  background: rgba(194, 65, 12, .92); color: #fff; font-size: 11px; line-height: 20px;
}
.box:hover .box-del { opacity: 1; }
.box-del:hover { background: #c2410c; }
.box.manual { border-color: rgba(16, 152, 106, .85); background: rgba(16, 152, 106, .08); }
.box.manual:hover { background: rgba(16, 152, 106, .18); }
.box.manual.dragging { background: rgba(16, 152, 106, .24); }
.box span {
  position: absolute; top: 0; left: 0; font-size: 10.5px; line-height: 1.4; padding: 1px 5px;
  background: rgba(47, 91, 208, .9); color: #fff; border-radius: 0 0 4px 0; white-space: nowrap;
}
.box.manual span { background: rgba(16, 152, 106, .92); }
.box .hd {
  position: absolute; width: 12px; height: 12px; background: #fff; border: 1.5px solid var(--accent);
  border-radius: 2px; opacity: 0; transition: opacity .1s ease;
}
.box:hover .hd, .box.dragging .hd { opacity: 1; }
.box.manual .hd { border-color: #10986a; }
.box .hd.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.box .hd.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.box .hd.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.box .hd.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.box .hd.n { left: 50%; top: -6px; margin-left: -6px; cursor: ns-resize; }
.box .hd.s { left: 50%; bottom: -6px; margin-left: -6px; cursor: ns-resize; }
.box .hd.w { top: 50%; left: -6px; margin-top: -6px; cursor: ew-resize; }
.box .hd.e { top: 50%; right: -6px; margin-top: -6px; cursor: ew-resize; }

.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.mini {
  font: inherit; font-size: 12.5px; padding: 5px 11px; border-radius: 99px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.mini:hover { border-color: var(--accent); color: var(--accent); }
.mini.on { background: #e7f6ef; border-color: #10986a; color: #0b6b4b; }
.mini.danger:hover { border-color: #c2410c; color: #c2410c; }
@media (prefers-color-scheme: dark) { .mini.on { background: #16302a; border-color: #1d7a58; color: #6fd7ab; } }

.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; }
.hint.bad { color: #c2410c; }
.el-card.flash { outline: 2px solid #10986a; outline-offset: -2px; }

.el-tools { display: flex; gap: 6px; align-items: center; flex-basis: 100%; margin-top: 4px; }
.el-tools select {
  font: inherit; font-size: 12px; padding: 3px 6px; max-width: 60%;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
}
.pill.ok { background: #e7f6ef; color: #0b6b4b; }
@media (prefers-color-scheme: dark) { .pill.ok { background: #16302a; color: #6fd7ab; } }

.shot-card { position: relative; }
.shot-card.todo { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.done-mark {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%;
  background: #10986a; color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.todo-mark {
  position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 99px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
}
.todo-mark.queue { background: var(--muted); }

/* ── schowek ──────────────────────────────────────────────────────────── */
.el-img { position: relative; }
.pin {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 50%; background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--muted); font-size: 14px; line-height: 1; opacity: 0; transition: opacity .12s ease;
}
.el-card:hover .pin, .pin.on { opacity: 1; }
.pin:hover { color: #d19a00; border-color: #d19a00; }
.pin.on { background: #ffd75e; border-color: #d19a00; color: #6b4c00; }
.pin-btn.on { background: #ffd75e; border-color: #d19a00; color: #6b4c00; }

.clip-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.prompt-box {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-bottom: 22px;
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.prompt-box label { display: flex; flex-direction: column; gap: 4px; width: 100%; font-size: 12.5px; color: var(--muted); }
.prompt-box input, .prompt-box textarea {
  font: inherit; font-size: 13px; width: 100%; padding: 8px 10px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
}
.prompt-box textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; }

.link-row { display: flex; gap: 6px; align-items: center; flex-basis: 100%; margin-top: 6px; }
.link-row input {
  flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;
  padding: 5px 8px; color: var(--muted); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px;
}

/* ── wrzucanie plików ─────────────────────────────────────────────────── */
.upload { margin: 0 0 18px; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
  padding: 22px; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--surface); transition: border-color .12s ease, background .12s ease;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { font-size: 14px; }
#up-state { white-space: pre-line; margin: 8px 0 0; }

/* ── lightbox ─────────────────────────────────────────────────────────── */
.lb {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 12, .88);
  display: flex; align-items: flex-start; justify-content: center; overflow: auto; padding: 24px;
}
.lb[hidden] { display: none; }
.lb img { max-width: min(1200px, 100%); height: auto; border-radius: 6px; }
.lb-close { position: fixed; top: 16px; right: 20px; width: 36px; height: 36px; border-radius: 50%;
            border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 16px; cursor: pointer; }

.foot { padding: 24px clamp(16px, 4vw, 40px) 40px; color: var(--muted); font-size: 12.5px;
        border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .shot-view { grid-template-columns: 1fr; }
  .el-grid { grid-template-columns: 1fr; }
}

/* ── schematy kolorystyczne ───────────────────────────────────────────── */
/* Paleta bywa i wąskim paskiem, i kwadratem — miniatura nie może być kadrowana
   do stałej wysokości, bo kadr ucina połowę kolorów. Stąd `contain` i tło
   w kolorze karty zamiast `cover`. */
.pal-card .el-img { max-height: 320px; display: flex; align-items: center; justify-content: center; padding: 10px; }
.pal-card .el-img img { width: 100%; max-height: 300px; object-fit: contain; }
.pal-title {
  font: inherit; font-size: 13.5px; font-weight: 600; flex-basis: 100%; padding: 4px 7px;
  color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px;
}
.pal-title:hover { border-color: var(--line); }
.pal-title:focus { outline: 0; background: var(--bg); border-color: var(--accent); }
.pal-title::placeholder { font-weight: 400; color: var(--muted); }
.el-tools a.mini { text-decoration: none; }
