/* Витрина графических материалов. Цвета — переменные в :root:
   сайт может переопределить их своим файлом, не трогая остальное. */
:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --text: #1b1f24;
  --muted: #687080;
  --line: #e1e4e9;
  --accent: #1764c0;
  --accent-text: #fff;
  --thumb-bg: #fff;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 1px 3px rgb(16 24 40 / .07);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --surface: #1b1e23;
    --text: #e8eaed;
    --muted: #9aa1ac;
    --line: #2b3038;
    --accent: #5b9bf0;
    --accent-text: #0b0d10;
    --thumb-bg: #f3f4f6;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
svg { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; }
.brand svg { width: 24px; height: 24px; color: var(--accent); }

main { padding-bottom: 48px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 6px; padding-top: 18px; color: var(--muted); font-size: 14px; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs .sep { opacity: .5; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 14px 0 22px; }
h1 { margin: 0; font-size: clamp(22px, 3vw, 30px); line-height: 1.2; font-weight: 650; overflow-wrap: anywhere; }
.meta, .lead { margin: 6px 0 0; color: var(--muted); }
.lead { max-width: 62ch; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; }
.btn small { font-weight: 400; opacity: .85; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled, .zip-mini:disabled { opacity: .6; cursor: progress; }

h2 { margin: 8px 0 12px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
h2 span { margin-left: 4px; opacity: .7; }
.block + .block { margin-top: 28px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.card { position: relative; display: flex; flex-direction: column; margin: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-link { display: flex; flex: 1; flex-direction: column; }
.card-link:hover .card-name { color: var(--accent); }
.card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 52px 12px 12px; }
.card-name { font-weight: 550; overflow-wrap: anywhere; }
.card-meta { color: var(--muted); font-size: 13px; }
.file .card-name { overflow: hidden; font-size: 14px; font-weight: 450; white-space: nowrap; text-overflow: ellipsis; }

.mosaic { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; aspect-ratio: 4 / 3; background: var(--line); }
.mosaic img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; background: var(--thumb-bg); }
.mosaic.n1 img { grid-area: 1 / 1 / 3 / 3; }
.mosaic.n2 img { grid-row: 1 / 3; }
.mosaic.n3 img:first-child { grid-row: 1 / 3; }
.mosaic.empty { display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); }
.mosaic.empty svg { width: 48px; height: 48px; stroke-width: 1.2; }

.thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; background: var(--thumb-bg); border-bottom: 1px solid var(--line); cursor: zoom-in; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.thumb.other { flex-direction: column; gap: 6px; color: #687080; cursor: pointer; }
.thumb.other svg { width: 44px; height: 44px; stroke-width: 1.2; }
.ext { font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.file figcaption { position: relative; }

.zip-mini, .dl { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.zip-mini:hover, .dl:hover { border-color: var(--accent); color: var(--accent); }
.empty-note { color: var(--muted); }

/* Страница товара из нескольких папок: раздел на папку */
.btn.ghost { padding: 7px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 500; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.part + .part { margin-top: 32px; }
.part-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.part-head h2 { margin: 0 0 2px; color: var(--text); font-size: 17px; letter-spacing: 0; text-transform: none; overflow-wrap: anywhere; }
.part-head h2 a:hover { color: var(--accent); text-decoration: underline; }
.part .grid + .grid { margin-top: 16px; }

/* Просмотр фото */
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0d0f12; color: #f1f3f5; }
.viewer::backdrop { background: rgb(0 0 0 / .85); }
.viewer[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.v-stage { display: flex; align-items: center; justify-content: center; min-height: 0; padding: 12px 72px; touch-action: pan-y pinch-zoom; }
.v-img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; user-select: none; -webkit-user-drag: none; }
.v-nav { position: absolute; top: calc(50% - 60px); display: flex; align-items: center; justify-content: center; width: 48px; height: 64px; border: 0; border-radius: 8px; background: rgb(255 255 255 / .08); color: #fff; cursor: pointer; }
.v-nav:hover { background: rgb(255 255 255 / .18); }
.v-nav svg { width: 28px; height: 28px; }
.v-prev { left: 12px; }
.v-next { right: 12px; }
.viewer.single .v-nav, .viewer.single .v-count { display: none; }
.v-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #16191e; }
.v-info { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.v-name { overflow: hidden; font-weight: 550; white-space: nowrap; text-overflow: ellipsis; }
.v-meta, .v-count { color: #9aa1ac; font-size: 13px; }
.v-dl { --accent-text: #fff; --accent: #1764c0; }
.v-close { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; }
.v-close:hover { background: rgb(255 255 255 / .12); }
html.viewer-open { overflow: hidden; }

@media (max-width: 520px) {
  .crumbs > :not(.up) { display: none; }
  .crumbs .up::before { content: "‹ "; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-text { padding: 8px 10px 10px; }
  .zip-mini { top: 6px; right: 6px; bottom: auto; }
  .file .dl { display: none; }
  .head .btn { justify-content: center; width: 100%; }
  .v-stage { padding: 8px; }
  .v-nav, .v-count { display: none; }
  .v-dl span { display: none; }
}
