/* Колекція листівок — тёплый «почтовый» стиль: бумага, марки, штемпели, почерк. Те же классы, что в шаблонах.
   Шрифты подключаются в base.html: Source Serif 4 (заголовки), Inter (текст), Caveat (почерк). */
:root {
  --bg: #f4eee4;
  --surface: #fffdf9;
  --surface-solid: #fffdf9;
  --sunk: #eae2d5;
  --ink: #1d2330;
  --muted: #6b6156;
  --faint: #8a7f72;
  --line: #e6ddcf;
  --line-strong: #d8cfc0;
  --accent: #2c4a9a;
  --accent-hover: #1e3570;
  --accent-soft: #e3e8f4;
  --accent-ink: #fff;
  --warm: #b4442f;
  --warm-soft: #f3d9c9;
  --brown: #8a5a3c;
  --night: #1f2a44;
  --gold: #f2c48d;
  --warn: #7a5418;
  --warn-soft: #f5e8d2;
  --ok: #3f6537;
  --ok-soft: #e2ecdd;
  --bad: #9e3a27;
  --bad-soft: #f6ddd7;
  --focus: #2c4a9a;
  --have: #3f7a45;
  --want: #b07a12;
  --want-dot: #d9a441;
  --trade: #2f6f8e;
  --like: #b4442f;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-photo: 3px;
  --pill: 999px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06);
  --shadow-photo: 0 1px 2px rgba(60, 40, 20, .08), 0 4px 14px rgba(60, 40, 20, .06);
  --shadow-lift: 0 2px 4px rgba(60, 40, 20, .08), 0 18px 36px rgba(60, 40, 20, .16);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --hand: "Caveat", "Comic Sans MS", cursive;
  --spring: cubic-bezier(.2, .9, .3, 1.2);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --tap: 44px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16130f;
    --surface: #221d18;
    --surface-solid: #221d18;
    --sunk: #1c1814;
    --ink: #efe7db;
    --muted: #b0a291;
    --faint: #85796b;
    --line: #3a322a;
    --line-strong: #4e453b;
    --accent: #9db4f0;
    --accent-hover: #bccbf6;
    --accent-soft: #243152;
    --accent-ink: #16130f;
    --warm: #e38a78;
    --warm-soft: #3a231e;
    --brown: #d9a982;
    --night: #2a3554;
    --gold: #f2c48d;
    --warn: #e8b54a;
    --warn-soft: #3a2f17;
    --ok: #7fc48e;
    --ok-soft: #1b3324;
    --bad: #e8707c;
    --bad-soft: #3d1e21;
    --have: #7fc48e;
    --want: #e8b54a;
    --want-dot: #e8b54a;
    --trade: #6fafcc;
    --like: #e8707c;
    --focus: #9db4f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3);
    --shadow-photo: 0 0 0 1px var(--line), 0 8px 20px rgba(0, 0, 0, .4);
    --shadow-lift: 0 14px 36px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
/* тема, выбранная вручную (кнопка в шапке), сильнее системной */
:root[data-theme="dark"] {
  --bg: #16130f;
  --surface: #221d18;
  --surface-solid: #221d18;
  --sunk: #1c1814;
  --ink: #efe7db;
  --muted: #b0a291;
  --faint: #85796b;
  --line: #3a322a;
  --line-strong: #4e453b;
  --accent: #9db4f0;
  --accent-hover: #bccbf6;
  --accent-soft: #243152;
  --accent-ink: #16130f;
  --warm: #e38a78;
  --warm-soft: #3a231e;
  --brown: #d9a982;
  --night: #2a3554;
  --gold: #f2c48d;
  --warn: #e8b54a;
  --warn-soft: #3a2f17;
  --ok: #7fc48e;
  --ok-soft: #1b3324;
  --bad: #e8707c;
  --bad-soft: #3d1e21;
  --have: #7fc48e;
  --want: #e8b54a;
  --want-dot: #e8b54a;
  --trade: #6fafcc;
  --like: #e8707c;
  --focus: #9db4f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-photo: 0 0 0 1px var(--line), 0 8px 20px rgba(0, 0, 0, .4);
  --shadow-lift: 0 14px 36px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); font: 17px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.18; letter-spacing: -.005em; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.6rem); margin: 0 0 .4em; }
h2 { font-size: 1.55rem; margin: 0 0 .7em; }
h3 { font-size: 1.2rem; }
p { text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: .88em; display: block; }
.lead { font-size: 1.15em; margin: -.2em 0 .4em; }
.error { color: var(--bad); display: block; }
.hp { position: absolute; left: -9999px; }
.inline { display: inline; }
.plain { list-style: none; padding: 0; }
.columns { columns: 3 240px; }
.columns li { break-inside: avoid; padding: .2em 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.notice { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); padding: .7em 1em; border-radius: var(--radius-sm); }
.notice.wanted { background: var(--accent-soft); color: var(--accent); }

/* Шапка */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: .5em 2.2em; align-items: center; min-height: 76px;
  padding: .6em max(20px, calc((100vw - 1440px) / 2 + 40px));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--display); font-size: 1.35em; font-weight: 600; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand { display: inline-flex; align-items: center; gap: .6em; }
.logo { width: 56px; height: 56px; flex: none; }
@media (max-width: 560px) { .logo { width: 44px; height: 44px; } }
.top nav { display: flex; gap: 1.6em; flex-wrap: wrap; align-self: stretch; }
.top nav a { display: flex; align-items: center; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.top nav a:hover, .top nav a[aria-current=page] { color: var(--ink); border-bottom-color: var(--accent); }
.account { margin-left: auto; display: flex; gap: 1em; align-items: center; flex-wrap: wrap; font-size: .95em; }
.account a { color: var(--ink); text-decoration: none; }
.account .button.primary { color: var(--accent-ink); }
main { padding: 24px 20px 48px; max-width: 1440px; margin: 0 auto; }
@media (min-width: 900px) { main { padding: 24px 40px 64px; } }

/* Кнопки і поля */
button, .button {
  font: inherit; font-size: 1rem; font-weight: 500; cursor: pointer; line-height: 1.2;
  min-height: var(--tap); padding: 0 1.15em; display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius);
  text-decoration: none; transition: background .15s, border-color .15s;
}
button:hover, .button:hover { border-color: var(--ink); color: var(--ink); }
button:disabled { background: var(--line); border-color: var(--line); color: var(--faint); cursor: default; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
button.wide { width: 100%; margin-top: 8px; }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
button.linklike { min-height: 0; border: 0; background: none; padding: 0; color: var(--accent); font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
button.linklike:hover { color: var(--accent-hover); }
input, select, textarea {
  font: inherit; font-size: 1rem; min-height: var(--tap); padding: .5em .8em; max-width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
input[type=file] { padding: 6px; width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-size: .94rem; min-height: 32px; margin-right: 12px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); cursor: pointer; }
textarea { width: 100%; min-height: 6em; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 20px; height: 20px; accent-color: var(--ink); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 2.2em; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235e554b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7em center; background-size: 1em;
}
label { display: block; font-size: .92em; color: var(--muted); margin-top: .7em; }
label.check { display: flex; gap: .6em; align-items: center; font-size: 1em; color: var(--ink); min-height: 40px; margin: 0; }

.messages { list-style: none; padding: 0; margin: 0 0 1em; }
.messages li { background: var(--surface); border: 1px solid var(--line); padding: .7em 1em; margin-bottom: .5em; border-radius: var(--radius-sm); }
.messages li.success { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.messages li.error { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

/* Пошук */
.catalog { margin-bottom: 1.2em; }
.hero { text-align: center; padding: 2.2em 0 1.2em; }
.hero-title { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); margin-bottom: .55em; }
.search { position: relative; display: flex; align-items: center; max-width: none; margin: 0; }
.search svg { position: absolute; left: 18px; width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.search input { width: 100%; height: 56px; padding: 0 52px; font-size: 1.1rem; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--surface); }
.spinner { position: absolute; right: 18px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); opacity: 0; transition: opacity .15s; }
.loading .spinner { opacity: 1; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading .spinner { animation-duration: 2s; } }

/* Чипи */
.toolbar-row { display: flex; flex-wrap: wrap; gap: .75em; align-items: center; justify-content: space-between; margin: .6em 0 0; }
.chip {
  font: inherit; font-size: .94rem; font-weight: 400; display: inline-flex; align-items: center; gap: .45em;
  min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; line-height: 1.2;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { color: var(--muted); font-size: .88em; font-variant-numeric: tabular-nums; }
.chip.on .n { color: inherit; opacity: .75; }
.chip.ghost { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.removable { background: var(--ink); border-color: var(--ink); color: var(--bg); padding-right: 5px; }
.chip.removable span { width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 16%, transparent); font-size: 1.1em; line-height: 1; }
.chip .count:not(:empty) { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--ink); color: var(--bg); font-size: .8em; font-weight: 600; display: inline-grid; place-items: center; }
.chip[hidden] { display: none; }
.chip.toggle svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.segmented { display: inline-flex; background: var(--sunk); border-radius: var(--radius); padding: 3px; }
.segmented label { margin: 0; font-size: .95em; color: var(--muted); cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; min-height: 38px; padding: 0 1em; border-radius: var(--radius-sm); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); }

/* Фасети */
.advanced { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 1em; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.advanced[hidden] { display: none; }
.facet { border: 0; margin: 0; padding: 0; min-width: 0; }
.facet legend { font-size: .8em; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .5em; }
.facet .chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 15em; overflow-y: auto; padding: 2px 4px 2px 0; align-content: flex-start; }
.facet-filter, .facet-lookup { width: 100%; min-height: 40px; margin-bottom: .5em; font-size: .94rem; }
.lookup { position: relative; margin-bottom: .5em; }
.lookup-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 4; display: flex; flex-wrap: wrap; gap: 6px; max-height: 16em; overflow-y: auto; padding: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lift); }
.lookup-results[hidden] { display: none; }
.years { display: flex; align-items: center; gap: .6em; }
.years input { width: 0; flex: 1; }

.results-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }

/* Сітка: фото без рамок, пропорції зберігаються */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 32px 22px; align-items: end; }
.card { display: flex; flex-direction: column; gap: 10px; color: var(--ink); position: relative; text-decoration: none; }
.card:hover { color: var(--ink); }
.card img, .card .noimg { width: 100%; height: auto; aspect-ratio: auto; max-height: 300px; object-fit: contain; object-position: bottom; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); background: var(--sunk); transition: box-shadow .2s; }
.card:hover img { box-shadow: 0 2px 4px rgba(30, 26, 22, .18), 0 14px 30px rgba(30, 26, 22, .14); }
.card .caption { font-size: 1rem; font-weight: 500; line-height: 1.35; }
.card .caption .muted, .card .caption .small { font-weight: 400; font-size: .94rem; }
.noimg { aspect-ratio: 3 / 2; background: var(--sunk); }
.noimg.big { width: 100%; border-radius: var(--radius); }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 2em 0; }
.pager a { min-height: var(--tap); padding: 0 1em; display: inline-flex; align-items: center; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); text-decoration: none; }
.pager a:hover { border-color: var(--ink); }

.badge { display: inline-flex; align-items: center; font-size: .82em; font-weight: 500; min-height: 26px; padding: 0 10px; border-radius: 13px; background: var(--sunk); color: var(--ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.status-approved { background: var(--ok-soft); color: var(--ok); }
.badge.status-rejected { background: var(--bad-soft); color: var(--bad); }
.type-badge { position: absolute; left: 10px; bottom: 44px; min-height: 26px; padding: 0 10px; border-radius: 13px; font-size: .8rem; font-weight: 500; display: inline-flex; align-items: center; background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink); }
.wanted-badge { position: absolute; top: 10px; right: 10px; min-height: 26px; padding: 0 10px; border-radius: 13px; font-size: .8rem; font-weight: 600; display: inline-flex; align-items: center; background: var(--accent-soft); color: var(--accent); }

/* Точки «маю / шукаю» */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: .45em; vertical-align: .02em; }
.dot.have { background: var(--have); }
.dot.want { background: var(--want-dot); }

/* Вибір і масові дії */
.selecting .card { cursor: pointer; }
.selecting .card::after { content: ""; position: absolute; top: 10px; left: 10px; width: 28px; height: 28px; border-radius: 6px; border: 2px solid var(--muted); background: color-mix(in srgb, var(--surface) 90%, transparent); }
.selecting .card.picked img { outline: 3px solid var(--accent); outline-offset: 4px; }
.selecting .card.picked::after { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 18px no-repeat; border-color: var(--accent); }
.selectable .card input[type=checkbox] { position: absolute; top: 10px; left: 10px; width: 24px; height: 24px; z-index: 1; }
.selectable .card:has(input:checked) img { outline: 3px solid var(--accent); outline-offset: 4px; }
.bulk-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 8; width: max-content; max-width: calc(100vw - 24px);
  display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 10px 10px 10px 20px;
  background: #1e1a16; color: #fffdf9; border-radius: 12px; box-shadow: var(--shadow-lift);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar button { background: none; color: #fffdf9; border-color: rgba(255, 253, 249, .3); }
.bulk-bar button.primary { background: #fffdf9; color: #1e1a16; border-color: #fffdf9; }
.bulk-bar button.linklike { color: #fffdf9; }
.bulk-bar select { background-color: #fffdf9; color: #1e1a16; max-width: 260px; }
.bulk-count { font-weight: 600; margin-right: 6px; }
.bulk-new { display: inline-flex; gap: .5em; align-items: center; }
.bulk-new[hidden] { display: none; }
.bulk-new .check { color: #fffdf9; }
.bulk-message { flex-basis: 100%; color: rgba(255, 253, 249, .75); }
.bulk-message:empty { display: none; }

/* Каталог: фільтри зліва */
.catalog-layout { display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 40px; align-items: start; }
.catalog-side { position: sticky; top: 92px; max-height: calc(100vh - 108px); overflow-y: auto; padding: 0 8px 24px 0; border-right: 1px solid var(--line); }
.catalog-side .catalog { margin: 0; }
.search.compact { margin: 0 0 12px; }
.search.compact svg { left: 12px; width: 18px; height: 18px; }
.search.compact input { height: var(--tap); font-size: 1rem; padding: 0 38px; border-width: 1px; border-color: var(--line-strong); border-radius: var(--radius-sm); }
.search.compact .spinner { right: 12px; width: 14px; height: 14px; }
.catalog-side .sorting { display: flex; gap: 0; margin-bottom: 16px; }
.catalog-side .sorting select { flex: 1; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.filters-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 0 12px; font-family: var(--display); font-size: 1.25rem; }
.filters-head .linklike { font-family: var(--font); font-size: .94rem; }
details.facet { border-top: 1px solid var(--line); }
details.facet:last-of-type { border-bottom: 1px solid var(--line); }
details.facet summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 50px; font-size: 1.02rem; }
details.facet summary::-webkit-details-marker { display: none; }
details.facet summary::after { content: "+"; margin-left: auto; width: 20px; text-align: center; font-size: 1.25rem; color: var(--muted); }
details.facet[open] summary::after { content: "−"; }
details.facet summary .count:not(:empty) { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: .8rem; display: inline-grid; place-items: center; }
details.facet > :not(summary) { margin: 0 0 14px; }
details.facet .chip { font-size: .94rem; }
.catalog-main .select-row { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.chip.sort-dir { min-width: var(--tap); min-height: var(--tap); justify-content: center; font-size: 1.1rem; padding: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.chip.sort-dir[hidden] { display: none; }
.sorting { display: inline-flex; gap: 0; align-items: center; }
@media (max-width: 860px) {
  .catalog-layout { grid-template-columns: 1fr; gap: 16px; }
  .catalog-side { position: static; max-height: none; border-right: 0; padding: 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
}

/* Каталог за макетом 2b: пошук зверху, сортування в рядку з кількістю, сітка-галерея */
.catalog-main > .search { margin-bottom: 18px; }
.catalog-main .search .spinner { right: 18px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.results-head .total { font-size: 1.05rem; }
.results-head .sorting { margin-left: auto; display: flex; height: var(--tap); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.results-head .sorting select { border: 0; border-radius: 0; min-height: 0; height: 100%; background-color: transparent; }
.results-head .sorting select:focus { box-shadow: none; }
.results-head .sort-dir { width: var(--tap); min-height: 0; height: 100%; padding: 0; border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; background: none; font-size: 1.1rem; }
.results-head .sort-dir[hidden] { display: none; }
#select-toggle.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.checks { display: flex; flex-direction: column; }
/* длинные названия переносятся: галочка и число держатся первой строки, а не середины блока */
.checks label.check { min-height: 40px; gap: 12px; align-items: flex-start; padding: 9px 0; line-height: 1.35; }
.checks label.check input { flex: none; margin: 0; margin-top: calc((1.35em - 20px) / 2); }
.checks label.check .n { margin-top: .1em; }
.checks label.check[hidden] { display: none; }
.checks label.check span:first-of-type { flex: 1; }
.checks .n { font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.facet .more { padding: 8px 0; font-size: .94rem; }
.facet .more[hidden] { display: none; }
.filters-head .sheet-close, .sheet-foot, .filters-open, .facet-chip { display: none; }

.grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
/* пустышка в конце забирает почти всё свободное место последней строки, чтобы её карточки не раздувались больше карточек выше */
.grid::after { content: ""; flex: 1000 1 0; }
.grid > .card { flex: var(--r, 1.4) 1 calc(var(--r, 1.4) * var(--card-h, 200px)); min-width: 0; }
#results[data-size=s] { --card-h: 100px; }
#results[data-size=s] .grid { gap: 10px; }
#results[data-size=s] .card .caption { font-size: .88rem; }
#results { --card-h: 165px; }
#results[data-size=l] { --card-h: 280px; }
/* Вид «Списком»: рядок — мініатюра, назва, художник, рік, видавництво */
.list-info { display: none; }
#results[data-size=list] .grid { display: block; border-top: 1px solid var(--line); }
#results[data-size=list] .grid::after { display: none; }
#results[data-size=list] .card { display: flex; flex-direction: row; align-items: center; gap: 18px; padding: 10px 8px; border-bottom: 1px solid var(--line); border-radius: 0; }
#results[data-size=list] .card:hover { background: var(--surface); }
#results[data-size=list] .card .photo { flex: none; width: 96px; height: 72px; display: grid; place-items: center; box-shadow: none; background: var(--sunk); border-radius: var(--radius-sm); }
#results[data-size=list] .card .photo img { width: auto; height: auto; max-width: 88px; max-height: 64px; aspect-ratio: auto; box-shadow: var(--shadow-photo); }
#results[data-size=list] .card .photo .dot { top: 4px; right: 4px; width: 10px; height: 10px; }
#results[data-size=list] .card .type-badge { display: none; }
#results[data-size=list] .list-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { display: flex; flex-wrap: wrap; gap: 0 14px; color: var(--muted); font-size: .94rem; }
.list-meta span + span::before { content: "·"; margin-right: 14px; color: var(--line-strong); }
.card-size { display: flex; height: var(--tap); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.card-size button { width: var(--tap); min-height: 0; height: 100%; padding: 0; border: 0; border-radius: 0; background: none; color: var(--muted); }
.card-size button + button { border-left: 1px solid var(--line-strong); }
.card-size button[aria-pressed=true] { background: var(--ink); color: var(--bg); }
.card-size svg { width: 18px; height: 18px; fill: currentColor; }
.sort-switch { display: flex; flex: none; margin-left: 12px; height: var(--tap); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.sort-switch button { height: 100%; min-height: 0; padding: 0 14px; border: 0; border-radius: 0; background: none; color: var(--muted); white-space: nowrap; }
.sort-switch button + button { border-left: 1px solid var(--line-strong); }
.sort-switch button[aria-pressed=true] { background: var(--ink); color: var(--bg); }
@media (max-width: 560px) { form.search.compact { flex-wrap: wrap; gap: 8px; } form.search.compact svg { top: calc(var(--tap) / 2 - 11px); } form.search.compact .sort-switch { margin-left: 0; } }
.grid.small > .card { flex: 0 0 calc(var(--r, 1.4) * 170px); min-width: 150px; max-width: 300px; }
.card .photo { position: relative; display: block; }
.card .photo img, .card .photo .noimg { display: block; width: 100%; max-height: none; aspect-ratio: var(--r, 1.4); object-fit: cover; }
.card .photo .type-badge { bottom: 10px; }
.card .photo .dot { position: absolute; top: 10px; right: 10px; width: 14px; height: 14px; margin: 0; box-shadow: 0 0 0 2.5px var(--surface); }
.card .caption { display: flex; flex-direction: column; gap: 2px; }
.card .caption .meta { font-size: .94rem; font-weight: 400; color: var(--muted); }
.card .photo { overflow: hidden; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); container-type: inline-size; }
.card .photo img { box-shadow: none; }
.selecting .card.picked .photo { outline: 3px solid var(--accent); outline-offset: 4px; overflow: visible; }
.copies .copy { display: flex; flex-direction: column; gap: 6px; }
.copies .copy.current .photo { outline: 3px solid var(--accent); outline-offset: 3px; }
.inscription { margin-top: 18px; }
.inscription p { white-space: normal; font-style: italic; }
.load-more { display: flex; width: max-content; margin: 32px auto 8px; min-width: 260px; }
.load-more[aria-busy] { opacity: .6; pointer-events: none; }
.grid-foot { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 32px 0 8px; }
.grid-foot .load-more { margin: 0; }
.pager.pages { margin: 0; flex-wrap: wrap; gap: 6px; }
.pager.pages a, .pager.pages span { min-width: var(--tap); justify-content: center; padding: 0 .6em; }
.pager.pages .cur { min-height: var(--tap); display: inline-flex; align-items: center; border-radius: var(--radius); background: var(--ink); color: var(--bg); }
.pager.pages .off { min-height: var(--tap); display: inline-flex; align-items: center; color: var(--muted); opacity: .5; }
.pager.pages .gap { color: var(--muted); }
.per-page { display: flex; align-items: center; gap: 8px; font-size: .94rem; color: var(--muted); }
.per-page select { width: auto; }
.empty { padding: 3em 0; text-align: center; }
.error-page { padding: 12vh 0; }
.error-code { font-family: var(--display); font-size: 4rem; line-height: 1; color: var(--line-strong); margin: 0 0 .2em; }
.empty h3 { font-size: 1.15rem; margin: 0 0 .3em; }

/* Масові дії: меню над панеллю */
.bulk-bar details.menu { position: relative; }
.bulk-bar details.menu summary { list-style: none; }
.bulk-bar details.menu summary::-webkit-details-marker { display: none; }
.bulk-bar summary.button { background: none; color: #fffdf9; border-color: rgba(255, 253, 249, .3); }
.bulk-bar summary.button.primary { background: #fffdf9; color: #1e1a16; border-color: #fffdf9; }
.menu-items { position: absolute; bottom: calc(100% + 10px); left: 0; min-width: 250px; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; padding: 6px; background: #fffdf9; color: #1e1a16; border-radius: 10px; box-shadow: var(--shadow-lift); }
.bulk-bar .menu-items button { justify-content: flex-start; gap: 10px; border: 0; border-radius: 6px; color: #1e1a16; text-align: left; font-weight: 400; }
.bulk-bar .menu-items button:hover { background: #f5f1ea; }
.bulk-bar .menu-items button.danger { color: #8a2e22; }
.menu-items hr { border: 0; height: 1px; background: #e3dcd0; margin: 4px 0; width: 100%; }
.menu-label { font-size: .8rem; color: #5e554b; padding: 8px 10px 4px; }
.menu-items .dot { margin: 0; }
.dot.trade { background: var(--trade); }
.dot.favorite { background: var(--like); }

@media (max-width: 860px) {
  /* каталог на телефоне — те же «резиновые» ряды, что на компьютере: каждая открытка в своих пропорциях, без пустот под короткими */
  #results { --card-h: 140px; }
  #results[data-size=s] { --card-h: 92px; }
  #results[data-size=l] .grid > .card { flex-basis: 100%; }
  .grid { gap: 12px; }
  /* блоки «серия / варианты» на странице открытки — по-прежнему две колонки */
  .grid.small > .card { flex: 0 0 calc((100% - 16px) / 2); }
  .filters-open { display: inline-flex; flex: none; }
  .filter-bar { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px 12px; padding: 2px 20px 6px; scrollbar-width: none; }
  .filter-bar::-webkit-scrollbar { display: none; }
  .facet-chip { display: inline-flex; flex: none; align-items: center; min-height: 40px; padding: 0 14px; border-radius: var(--pill); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font-size: .92rem; white-space: nowrap; }
  .catalog-side details.facet { scroll-margin-top: 72px; }
  .facet-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
  .filters-open .count:not(:empty) { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--ink); color: var(--bg); font-size: .8em; display: inline-grid; place-items: center; }
  .catalog-side { display: none; }
  .filters-shown { overflow: hidden; }
  .filters-shown .catalog-side { display: block; position: fixed; inset: 0; z-index: 20; max-height: none; overflow-y: auto; padding: 0 20px; background: var(--surface); }
  .filters-shown .filters-head { position: sticky; top: 0; z-index: 1; padding: 18px 0; margin: 0; background: var(--surface); align-items: center; gap: 16px; }
  .filters-shown .filters-head > span { flex: 1; font-size: 1.5rem; }
  .filters-shown .filters-head .sheet-close { display: inline-flex; border: 0; background: none; font-size: 1.8rem; padding: 0 4px; }
  .filters-shown .sheet-foot { display: block; position: sticky; bottom: 0; padding: 12px 0 16px; background: var(--surface); border-top: 1px solid var(--line); }
  .sheet-foot button { width: 100%; min-height: 54px; font-size: 1.1rem; }
  .active-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .active-filters .chip { flex: none; }
  .results-head .total { flex-basis: 100%; }
  .results-head .sorting { margin-left: 0; }
}

/* Сторінка листівки */
.postcard { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 56px; }
.photos { display: flex; flex-wrap: wrap; gap: 12px; align-content: start; }
.photos figure { margin: 0; width: 120px; }
.photos figure.main { width: 100%; background: var(--sunk); border-radius: var(--radius-sm); padding: 6%; }
.photos img { display: block; width: 100%; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); cursor: zoom-in; }
.photos figure:not(.main) img { aspect-ratio: 4 / 3; object-fit: contain; background: var(--sunk); padding: 8px; box-shadow: none; border-radius: var(--radius-sm); }
.photos figcaption { font-size: .9em; margin-top: .4em; }
.info { align-self: start; }
.info dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); margin: 0 0 1.2em; border-top: 1px solid var(--line); }
.info dt, .info dd { padding: 11px 0; border-bottom: 1px solid var(--line); }
.info dt { color: var(--muted); }
.info dd { margin: 0; display: flex; flex-direction: column; }
.info dd .small { font-size: .9em; color: var(--muted); }
.notes { max-width: 36em; }
.share { display: flex; flex-wrap: wrap; gap: 8px; margin: 1.2em 0; }
.share .permalink { flex: 1 1 100%; color: var(--muted); }
.private { border: 1px dashed var(--line-strong); padding: 4px 18px; border-radius: var(--radius); margin: 1em 0; }
.private h3 { font-family: var(--font); font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 400; }
.private dl { border-top: 0; }
.private dt, .private dd { border-bottom: 0; padding: 4px 0; }
.who { margin: .3em 0 0; color: var(--muted); }
@media (max-width: 760px) {
  .postcard { grid-template-columns: 1fr; gap: 24px; }
  .info dl { grid-template-columns: 1fr; }
  .info dt { border-bottom: 0; padding-bottom: 0; font-size: .88em; }
}

/* Сторінка листівки за макетом 2c */
.crumbs { display: flex; gap: 8px; font-size: .9rem; color: var(--muted); margin: -4px 0 20px; }
.crumbs a { color: var(--muted); }
.crumbs span:last-child { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photos { flex-direction: column; flex-wrap: nowrap; gap: 14px; }
.photos figure.main { padding: 0; }
/* фото целиком в экране: вертикальная открытка ограничена по высоте окна (шапка и крошки ~170px), горизонтальная — по ширине колонки */
.photos figure.main a { position: relative; display: grid; place-items: center; padding: 5%; cursor: zoom-in; }
/* место под фото резервируется по пропорциям до загрузки (--r = ширина/высота), чтобы страница не прыгала */
.photos figure.main img { --maxh: max(320px, calc(100svh - 190px)); aspect-ratio: var(--r, 1.4); width: min(100%, calc(var(--maxh) * var(--r, 1.4))); height: auto; object-fit: contain; }
.photos .fullscreen { position: absolute; right: 12px; bottom: 12px; min-height: 32px; padding: 0 12px; border-radius: 16px; display: inline-flex; align-items: center; font-size: .85rem; color: var(--ink); background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); }
.thumbs { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.thumbs .thumb { width: 120px; height: 88px; min-height: 0; padding: 8px; background: var(--sunk); border: 2px solid transparent; border-radius: var(--radius-sm); }
.thumbs .thumb[aria-current] { border-color: var(--ink); }
.thumbs .thumb img { width: 100%; height: 100%; object-fit: contain; border-radius: 2px; }
.thumb-caption { font-size: .94rem; margin-left: 6px; }
.info h1 { font-size: clamp(1.9rem, 1.4rem + 1.5vw, 2.6rem); margin: 0 0 18px; }
.kicker { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 6px; font-size: .94rem; color: var(--muted); }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.actions-row .my-lists { margin: 0; }
.actions-row .share { margin: 0 0 0 auto; }
.actions-row .share button { min-height: 40px; font-size: .94rem; }
.who { margin: 0 0 18px; font-size: .92rem; }
.info dd.tags { flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 8px 0; }
.info dd.tags .chip { min-height: 32px; text-decoration: none; }
.variants { margin-top: 2.5em; }
@media (max-width: 760px) {
  .actions-row .share { margin: 0; }
  .thumbs .thumb { width: 96px; height: 72px; }
}

/* Мої списки: іконки з підказкою */
.my-lists { display: flex; flex-wrap: wrap; gap: 10px; margin: 1em 0 .6em; }
.my-lists form { margin: 0; }
.icon-toggle { position: relative; width: 56px; height: 56px; min-height: 0; padding: 0; border-radius: 10px; border-width: 1.5px; color: var(--muted); --tone: var(--muted); }
.icon-toggle svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-toggle.kind-have { --tone: var(--have); }
.icon-toggle.kind-want { --tone: var(--want); }
.icon-toggle.kind-trade { --tone: var(--trade); }
.icon-toggle.kind-favorite { --tone: var(--like); }
.icon-toggle.kind-link { --tone: var(--accent); }
.icon-toggle:hover { color: var(--tone); border-color: var(--tone); }
.icon-toggle.on { color: var(--tone); border-color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, var(--surface)); }
.icon-toggle.kind-favorite.on svg { fill: currentColor; }
.icon-toggle[data-tip]:hover::after, .icon-toggle[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: .88rem; font-weight: 400; padding: 6px 10px; border-radius: 6px;
  background: var(--ink); color: var(--bg); pointer-events: none; z-index: 5;
}

/* Лайтбокс */
#lightbox { position: fixed; inset: 0; background: rgba(22, 19, 16, .96); display: flex; align-items: center; justify-content: center; z-index: 10; cursor: zoom-out; touch-action: pan-y; }
#lightbox[hidden] { display: none; }
#lightbox img { max-width: calc(100vw - 180px); max-height: calc(100vh - 140px); border-radius: var(--radius-photo); }
#lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 60px; height: 60px; border-radius: 30px; border: 0; background: rgba(255, 253, 249, .12); color: #fffdf9; font-size: 30px; line-height: 1; cursor: pointer; }
#lightbox .lb-nav:hover { background: rgba(255, 253, 249, .24); color: #fffdf9; }
#lightbox .lb-prev { left: 24px; }
#lightbox .lb-next { right: 24px; }
#lightbox .lb-count { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: rgba(255, 253, 249, .8); font-size: .95rem; }
#lightbox .lb-nav[hidden], #lightbox .lb-count[hidden] { display: none; }
@media (max-width: 760px) { #lightbox img { max-width: 100vw; } #lightbox .lb-nav { display: none; } }

/* Варіанти, пов'язане, коментарі */
.variants { margin: 3em 0; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.grid.small .caption { display: flex; flex-direction: column; gap: 2px; font-size: .94rem; }
.variants-edit { margin-top: 1em; }
.variants-edit .variant-row { display: flex; align-items: center; gap: .6em; margin: .3em 0; }
.comments { max-width: 820px; margin-top: 2.5em; padding-top: 2em; border-top: 1px solid var(--line); }
.comment { border-bottom: 1px solid var(--line); padding: .8em 0; }
.comment.hidden { opacity: .55; }
.comment p { margin: .2em 0; }
.comment p.muted { font-size: .9em; }
.comments form { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 1em; }

/* Художники, видавництва, альбоми */
.entity { display: flex; flex-wrap: wrap; gap: 1.5em; align-items: flex-start; justify-content: space-between; margin-bottom: 1.5em; }
.entity h1 { margin-bottom: .2em; }
.entity-main { flex: 1 1 320px; }
.portrait { margin: 0; width: 180px; flex: none; }
.portrait img { width: 180px; height: 220px; object-fit: cover; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); display: block; background: var(--sunk); }
.portrait figcaption { margin-top: .4em; font-size: .9em; color: var(--muted); }
.portrait-more { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.portrait .portrait-more img { width: 100%; height: auto; box-shadow: none; aspect-ratio: 1; object-fit: cover; border-radius: 4px; display: block; background: var(--sunk); }
.current-photo { display: flex; flex-direction: column; gap: 8px; margin: 1em 0; }
.photo-tile { position: relative; width: 96px; height: 96px; flex: none; }
.photo-tile img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); display: block; transition: opacity .15s; }
/* крестик — это галочка формы: удаление применяется при сохранении, до него можно вернуть */
.photo-remove { position: absolute; top: -8px; right: -8px; margin: 0; cursor: pointer; }
.photo-tile .photo-remove input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; margin: 0; }
.photo-remove .to-remove { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 18px; line-height: 1; box-shadow: var(--shadow-photo); }
.photo-remove:hover .to-remove { background: var(--bad); color: #fffdf9; }
.photo-remove:has(input:focus-visible) span { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-remove .to-undo { display: none; }
.photo-tile:has(input:checked) img { opacity: .25; }
.photo-tile:has(input:checked) .photo-remove { inset: 0; display: grid; place-items: center; }
.photo-remove:has(input:checked) .to-remove { display: none; }
.photo-remove:has(input:checked) .to-undo { display: block; padding: 3px 9px; border-radius: 13px; background: var(--ink); color: var(--bg); font-size: .82rem; }
.removed-note { display: none; color: var(--bad); }
.photo-tile:has(input:checked) + .removed-note { display: block; }
.artist-photos { border: 1px solid var(--line); border-radius: var(--radius); padding: 1em; margin: 1.5em 0; }
.artist-photo { display: flex; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.artist-photo-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.main-choice { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font-size: .94rem; width: max-content; }
.narrow .main-choice input { width: 20px; flex: none; margin: 0; }
.main-choice:has(input:checked) span { font-weight: 600; }
.artist-photo.is-cover .photo-tile img { outline: 3px solid var(--accent); outline-offset: 2px; }
.artist-photo:has(.photo-remove input:checked) .artist-photo-fields { opacity: .4; }
.add-photos { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.entity-text { margin: 0 0 2em; font-size: 1.05rem; }
/* Довідники: рядки з аватаркою, ім'ям, довідкою і кількістю */
.entries { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 40px; }
.entries li a { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.entries li a:hover .entry-name { color: var(--accent); }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; object-fit: cover; background: var(--sunk); color: var(--muted); display: grid; place-items: center; font-family: var(--display); font-size: 1.1rem; }
.entry-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entry-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entries .n { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
/* Альбоми: обкладинки однакового розміру */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 32px 24px; }
.album { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
.album .cover { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 12%; margin-bottom: 8px; background: var(--sunk); border-radius: var(--radius); }
.album .cover img { position: absolute; inset: 10%; width: 80%; height: 80%; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(30, 26, 22, .18)); transition: transform .2s; }
.album:hover .cover img { transform: translateY(-3px); }
.album .type-badge { bottom: 10px; }
.album-name { font-family: var(--display); font-size: 1.2rem; line-height: 1.25; }
.album:hover .album-name { color: var(--accent); }
.album-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.album .small { display: block; }
.album-block { margin-bottom: 2.5em; }
.album-block h2 { margin: 0; font-size: 1.35em; }
.album-block .toolbar.sticky { justify-content: space-between; }
.small-search { margin: 0; flex: 1 1 320px; max-width: 560px; }
.small-search input { height: var(--tap); font-size: 1rem; border-width: 1px; border-color: var(--line-strong); }
label.card { cursor: pointer; margin: 0; font-size: 1em; color: var(--ink); }
.section-title { margin: 1.6em 0 .6em; font-size: 1.4em; }
.profile-albums .toolbar { justify-content: space-between; }
.profile-albums .section-title { margin: 0; }
.segmented.tabs { margin: 0 0 1.4em; flex-wrap: wrap; }
.segmented.tabs a { display: flex; align-items: center; min-height: 40px; white-space: nowrap; padding: 0 1em; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; }
.segmented.tabs a:hover { color: var(--ink); }
.segmented.tabs a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented.tabs .n { color: var(--muted); font-size: .88em; margin-left: .35em; }

/* Робота з колекцією — щільно */
.subnav { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 1.4em; border-bottom: 1px solid var(--line); }
.subnav a { display: flex; align-items: center; min-height: var(--tap); padding: 0 .9em; color: var(--muted); text-decoration: none; font-size: .95em; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover, .subnav a[aria-current=page] { color: var(--ink); border-bottom-color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; color: var(--ink); text-decoration: none; }
a.tile:hover { border-color: var(--ink); color: var(--ink); }
.tile { display: flex; flex-direction: column; gap: 2px; min-height: 96px; justify-content: center; }
.tile span { color: var(--muted); font-size: .94rem; }
.tile strong { display: block; font-family: var(--display); font-weight: 500; font-size: 2em; line-height: 1.1; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 2.4em; text-align: center; margin-bottom: 1em; background: var(--surface); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone label { display: inline; font-size: 1em; }
.dropzone progress { width: 100%; accent-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 1em 0; }
/* Заголовок сторінки з дією праворуч */
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.tiles + h2, .rows + h2 { margin-top: 1.8em; }
/* Прості списки рядками: назва і пояснення ліворуч, статус праворуч */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows li { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rows .row-main { display: flex; flex-direction: column; min-width: 0; }
.rows li.muted { display: block; }
table.history td { vertical-align: top; }
table.history .change { padding: 2px 0; }
.nowrap { white-space: nowrap; }
@media (max-width: 760px) {
  table.history, table.history tbody, table.history tr, table.history td { display: block; }
  table.history tr:first-child { display: none; }
  table.history tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .subnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .subnav a { flex: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 84px; padding: 12px 14px; }
  .albums { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .album-name { font-size: 1.05rem; }
  table.diff.history td { border: 0; padding: 2px 12px; }
  table.history td:first-child { width: auto; text-align: left; color: var(--muted); font-size: .88rem; }
}
.toolbar .group { display: flex; gap: 4px; }
.sticky { position: sticky; top: 76px; background: var(--bg); padding: 8px 0; z-index: 2; border-bottom: 1px solid var(--line); }
.inline-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 1em; }
.inline-filters input[type=search], .inline-filters input[type=text] { grid-column: span 2; }
.inline-filters > * { width: 100%; min-width: 0; }
.bulk { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6em 1em; }
.bulk summary { cursor: pointer; font-weight: 500; min-height: 36px; display: flex; align-items: center; }
.bulk-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 1em; }
.narrow { max-width: 440px; margin: 2em auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2em; }
.narrow input { width: 100%; }
.narrow.wide { max-width: 760px; }
.feedback-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9em 1.2em; margin-bottom: .8em; }
.feedback-item.done { opacity: .6; }
.feedback-item p { margin: .3em 0; }
.proposals-list li { margin-bottom: .4em; }
.small-inline { font-size: .88em; }

/* Правка */
.edit-head { display: flex; flex-wrap: wrap; gap: 1em; align-items: baseline; }
.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.photo-card { display: grid; grid-template-columns: 200px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.photo-card img { width: 100%; border-radius: var(--radius-photo); }
.postcard-tools form { margin-bottom: .8em; }
.edit-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2em 1.4em; align-self: start; }
.edit-form label { margin-top: .9em; }
.edit-form label:first-child { margin-top: 0; }
.edit-form input:not([type=checkbox]), .edit-form select { width: 100%; }
@media (max-width: 900px) { .edit-layout { grid-template-columns: 1fr; } .photo-card { grid-template-columns: 1fr; } }
.tag-editor { margin-top: .25em; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: var(--tap); padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.tag-chips:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
.tag-chips input { flex: 1 1 10em; border: 0; box-shadow: none; min-height: 32px; padding: 0 .3em; background: transparent; min-width: 8em; }
.tag-chips input:focus { box-shadow: none; }
.tag-chips .chip { min-height: 30px; font-size: .9em; padding: 0 10px; }
.tag-suggest { display: flex; flex-direction: column; gap: 6px; margin-top: .5em; }
.tag-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-group > .muted { display: inline; margin-right: .3em; font-size: .9em; }
.tag-group .chip { min-height: 30px; font-size: .88em; padding: 0 10px; }
.link-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#add-drop { display: block; cursor: pointer; position: relative; }
#add-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.add-previews { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; list-style: none; margin: 0 0 1em; }
.add-previews li { width: 140px; display: flex; flex-direction: column; gap: .3em; font-size: .9em; }
.add-previews img { width: 140px; height: 100px; object-fit: contain; background: var(--sunk); border-radius: var(--radius-sm); }

/* Модальні вікна, обрізка, OCR */
.modal { position: fixed; inset: 0; background: rgba(22, 19, 16, .72); z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-body { background: var(--surface); padding: 20px; border-radius: 10px; width: min(96vw, 1000px); box-shadow: var(--shadow-lift); }
.crop-area { max-height: 75vh; }
.crop-area img { display: block; max-width: 100%; }
.recognize { margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .6em; align-items: center; }
.recognize-body { width: min(96vw, 1280px); max-height: 94vh; display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: 24px; }
.rec-image { overflow: auto; max-height: calc(94vh - 40px); border-radius: var(--radius-sm); background: var(--sunk); cursor: zoom-in; }
.rec-image img { display: block; width: 100%; }
.rec-image.zoomed { cursor: zoom-out; }
.rec-image.zoomed img { width: 220%; max-width: none; }
.rec-side { overflow-y: auto; max-height: calc(94vh - 40px); padding-right: 4px; }
.rec-side h2 { margin-top: 0; }
.rec-row { display: block; margin: 0 0 .8em; }
.rec-row input { display: block; width: 100%; margin-top: .25em; }
.rec-row.found input { border-color: var(--want); background: var(--warn-soft); }
.rec-row .was { display: block; font-size: .88em; margin-top: .2em; color: var(--muted); }
.rec-text pre { white-space: pre-wrap; font-size: .9em; background: var(--sunk); padding: .7em; border-radius: var(--radius-sm); }
@media (max-width: 800px) { .recognize-body { grid-template-columns: 1fr; overflow-y: auto; } .rec-image, .rec-side { max-height: none; } }

/* Модерація */
/* Модерація за макетом 2d: меню кабінету, черга, розбір */
.subnav a .n { margin-left: auto; padding-left: 12px; font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.mod-layout { display: grid; grid-template-columns: 232px 360px minmax(0, 1fr); height: calc(100vh - 76px - 48px); min-height: 560px; font-size: .94rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mod-layout .subnav { flex-direction: column; flex-wrap: nowrap; gap: 2px; margin: 0; padding: 16px 12px; border: 0; border-right: 1px solid var(--line); background: var(--bg); overflow-y: auto; }
.mod-layout .subnav a { min-height: 42px; padding: 0 12px; border: 0; margin: 0; border-radius: var(--radius-sm); color: var(--ink); }
.mod-layout .subnav a:hover { background: var(--sunk); }
.mod-layout .subnav a[aria-current=page] { background: var(--ink); color: var(--bg); }
.mod-layout .subnav a[aria-current=page] .n { color: inherit; opacity: .8; }
.mod-queue { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.queue-filter { display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); }
.queue-filter .chip { text-decoration: none; }
.queue { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.queue a { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; color: var(--ink); text-decoration: none; }
.queue a:hover { background: var(--bg); }
.queue a[aria-current] { background: var(--bg); border-left-color: var(--accent); }
.queue img, .queue .noimg { width: 56px; height: 40px; object-fit: cover; border-radius: 2px; flex: none; }
.queue-text { display: flex; flex-direction: column; min-width: 0; }
.queue-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-meta { color: var(--muted); font-size: .88rem; }
.queue-meta > span { display: inline-block; padding: 0 6px; margin-right: 4px; border-radius: 3px; font-size: .8rem; font-weight: 600; }
.tag-edit { background: color-mix(in srgb, var(--trade) 16%, var(--surface)); color: var(--trade); }
.tag-new { background: var(--ok-soft); color: var(--ok); }
.tag-photo { background: var(--warn-soft); color: var(--warn); }
.queue-empty { padding: 16px; }
.mod-review { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.review-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.review-head p { margin: 0; }
.review-head h1 { font-size: 1.35rem; margin: 2px 0 0; }
.review-nav { display: flex; gap: 8px; align-items: center; flex: none; }
.review-nav .button { width: var(--tap); padding: 0; }
.review-nav span.button { opacity: .4; }
.review-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.review-body { flex: 1; overflow-y: auto; padding: 18px 24px; }
.review-section { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.review-section .linklike { text-transform: none; letter-spacing: 0; font-size: .94rem; }
.review-section:first-child { margin-top: 0; }
.photo-groups { display: flex; flex-wrap: wrap; gap: 28px; }
.photo-groups .proposal-photos { margin: 0; }
.proposal-photos.same img { border-color: transparent; }
.review-foot { display: flex; gap: 10px; padding: 12px 24px; border-top: 1px solid var(--line); background: var(--bg); }
.review-foot input { flex: 1; }
button.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
button.dark:hover { background: var(--ink); color: var(--bg); opacity: .9; }
.notice.dup { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.notice.dup .button, .notice.dup button { min-height: 36px; }
.review-new { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.review-photos { display: flex; flex-direction: column; gap: 12px; }
.review-photos img { width: 100%; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); }
.review-fields { display: grid; grid-template-columns: 150px minmax(0, 1fr); margin: 0 0 12px; border-top: 1px solid var(--line); }
.review-fields dt, .review-fields dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.review-fields dt { color: var(--muted); }
@media (max-width: 1100px) {
  .mod-layout { grid-template-columns: minmax(0, 1fr); height: auto; overflow: visible; border: 0; background: none; }
  .mod-layout .subnav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; border: 0; background: none; padding: 0 0 12px; }
  .mod-layout .subnav a { flex: none; }
  .review-head { flex-direction: column-reverse; gap: 8px; padding: 12px 16px; }
  .review-body { padding: 16px; }
  .mod-queue { border: 1px solid var(--line); border-radius: var(--radius); max-height: 40vh; background: var(--surface); }
  .mod-review { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .review-body { overflow: visible; }
  .review-foot { position: sticky; bottom: 0; flex-wrap: wrap; }
  .review-new { grid-template-columns: 1fr; }
}
.mod-item { display: flex; gap: 18px; border-bottom: 1px solid var(--line); padding: 1em 0; }
.mod-item img { width: 160px; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); align-self: flex-start; }
.proposal { align-items: flex-start; }
.proposal-body { flex: 1; min-width: 0; }
.proposal-note { margin: .2em 0 .8em; padding: 10px 14px; background: var(--sunk); border-radius: var(--radius-sm); }
table.diff, table.list { border-collapse: collapse; width: 100%; margin: .5em 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; font-size: .94rem; }
table.diff td, table.diff th, table.list td, table.list th { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: middle; }
table.list th, table.diff th { font-size: .8rem; font-weight: 400; color: var(--muted); background: var(--bg); }
table.diff td:first-child { width: 48px; text-align: center; }
table.diff tr:has(input:not(:checked)) td { opacity: .55; }
table.diff del { background: var(--bad-soft); color: var(--bad); padding: 2px 6px; border-radius: 3px; text-decoration-thickness: 1px; }
table.diff ins { background: var(--ok-soft); color: var(--ok); padding: 2px 6px; border-radius: 3px; text-decoration: none; }
.chip.plus { border-color: var(--have); color: var(--ok); cursor: default; min-height: 28px; font-size: .88rem; }
.chip.minus { border-color: var(--bad); color: var(--bad); text-decoration: line-through; cursor: default; min-height: 28px; font-size: .88rem; }
.list img.mini { display: block; width: 64px; height: 46px; object-fit: contain; background: var(--sunk); border-radius: var(--radius-photo); }
.proposal-photos { margin: .8em 0; }
.proposal-photos .thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: .4em; }
.proposal-photos img { width: 140px; height: 98px; object-fit: contain; background: var(--sunk); border-radius: 4px; border: 3px solid var(--line); }
.proposal-photos.add .check { color: var(--ok); }
.proposal-photos.add img { border-color: var(--have); }
.proposal-photos.remove .check { color: var(--bad); }
.proposal-photos.remove img { border-color: var(--bad); opacity: .75; }
.menu-toggle { display: none; }
@media (max-width: 760px) {
  table.list { display: block; overflow-x: auto; }
  .filters-open { background: var(--ink); border-color: var(--ink); color: var(--bg); }
  .filters-open .count:not(:empty) { background: var(--bg); color: var(--ink); }
  .mod-item { flex-direction: column; }
}

/* ============================================================
   Тёплый «почтовый» слой: открытки в белой рамке, пилюли, почерк,
   мягкие анимации. Идёт последним и уточняет правила выше.
   ============================================================ */
body { font-size: 16px; line-height: 1.55; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; }
.hand-note { font-family: var(--hand); font-size: 1.6rem; line-height: 1.1; color: var(--warm); margin: 0 0 .15em; font-weight: 500; }
button.linklike.hand-note { font-size: 1.25rem; color: var(--brown); text-decoration: none; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes stamp-in { from { opacity: 0; transform: scale(1.9) rotate(-35deg); } to { opacity: .88; transform: scale(1) rotate(-12deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(18px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px); visibility: hidden; } }

/* Шапка: логотип с подписью от руки, меню пилюлями */
/* шапка непрозрачная и выше всего содержимого страницы (но ниже модальных окон): ничего не просвечивает и не вылезает поверх */
.top { background: var(--surface); z-index: 9; border-bottom-color: var(--line); gap: .5em 1.6em; }
.brand { font-size: 1.3em; }
.brand .logo { border-radius: 50%; box-shadow: var(--shadow-photo); transition: transform .5s var(--spring); }
.brand:hover .logo { transform: rotate(-8deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-sub { font-family: var(--hand); font-size: 1.05rem; font-weight: 500; color: var(--brown); }
.top nav { gap: 2px; align-self: center; }
.top nav a { min-height: 42px; padding: 0 14px; border-radius: var(--pill); border-bottom: 0; margin: 0; font-weight: 500; color: var(--ink); opacity: .85; transition: background .2s, color .2s; }
.top nav a:hover { background: var(--sunk); border-bottom: 0; opacity: 1; }
.top nav a[aria-current=page] { background: var(--accent-soft); color: var(--accent); border-bottom: 0; opacity: 1; }
.account a { font-weight: 500; }
/* Меню аккаунта под именем: иначе шапка с 7 пунктами не помещается в одну строку */
.acct { position: relative; }
.acct-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 42px; padding: 0 10px; border: 0; border-radius: var(--pill); background: none; font: inherit; font-weight: 500; color: var(--ink); cursor: pointer; }
.acct-btn:hover, .acct.open .acct-btn { background: var(--sunk); transform: none; box-shadow: none; }
.acct-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; transition: transform .2s; }
.acct.open .acct-btn svg { transform: rotate(180deg); }
.acct-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; flex-direction: column; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lift); z-index: 10; }
.acct.open .acct-menu { display: flex; }
.acct-menu a, .acct-menu .linklike { display: block; width: 100%; text-decoration: none; font-weight: 500; padding: 9px 12px; border-radius: 9px; text-align: left; color: var(--ink); }
.acct-menu a:hover, .acct-menu .linklike:hover { background: var(--sunk); }
@media (min-width: 1101px) and (max-width: 1399px) { .brand-text { display: none; } }
@media (max-width: 1100px) {
  .top { position: static; min-height: 64px; }
  .menu-toggle { display: inline-flex; margin-left: auto; width: var(--tap); padding: 0; border: 0; background: none; }
  .menu-toggle svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .top > nav, .top:has(.menu-toggle) > .account { display: none; }
  .top.open > nav, .top.open > .account { display: flex; flex-basis: 100%; flex-direction: column; gap: 0; margin: 0; align-items: stretch; }
  .top.open > nav a { min-height: var(--tap); border-bottom: 0; }
  .top.open > .account { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding: 8px 0 4px; border-top: 1px solid var(--line); }
  .top.open > .account a, .top.open > .account .linklike { min-height: var(--tap); display: inline-flex; align-items: center; }
  .acct-btn { display: none; }
  .acct-menu { display: flex; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 20px; min-width: 0; padding: 0; border: 0; background: none; box-shadow: none; }
  .acct-menu a, .acct-menu .linklike { width: auto; padding: 0; min-height: var(--tap); display: inline-flex; align-items: center; }
  .acct-menu a:hover, .acct-menu .linklike:hover { background: none; }
}

/* Кнопки, поля, чипы — мягкие пилюли с лёгким подъёмом */
button, .button { border-radius: var(--pill); font-weight: 600; transition: transform .2s ease, box-shadow .2s ease, background .2s, border-color .2s, color .2s; }
button:hover, .button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(60, 40, 20, .10); border-color: var(--accent); color: var(--accent); }
button.primary:hover, .button.primary:hover { color: var(--accent-ink); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent); }
button.linklike:hover, .card-size button:hover, .sort-switch button:hover, .results-head .sort-dir:hover, .menu-toggle:hover, .bulk-bar .menu-items button:hover, .thumbs .thumb:hover, .icon-toggle:hover { transform: none; box-shadow: none; }
button:disabled:hover { transform: none; box-shadow: none; }
input, select, textarea { border-radius: var(--radius-sm); background: var(--surface); transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.chip { border-radius: var(--pill); min-height: 38px; padding: 0 16px; transition: transform .2s, border-color .2s, color .2s, background .2s; text-decoration: none; }
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.chip.on, .chip.removable { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.ghost { background: var(--accent-soft); color: var(--accent); }
.badge { border-radius: var(--pill); }

/* Поиск — пилюля */
.search input { border: 1px solid var(--line-strong); border-radius: var(--pill); height: 54px; background: var(--surface); box-shadow: var(--shadow); }
.search input:focus { border-color: var(--accent); }
.search.compact input { border-radius: var(--pill); }

/* Главная: открытка дня и быстрый выбор */
.hero-warm { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 32px 48px; padding: 24px 0 36px; }
.hero-text { flex: 1 1 460px; max-width: 640px; }
.hero-text .hand-note { transform: rotate(-2deg); transform-origin: left; font-size: 1.8rem; }
.hero-warm .hero-title { font-size: clamp(2.2rem, 1.4rem + 2.6vw, 3.6rem); line-height: 1.04; margin: 0 0 .35em; }
.hero-title em { font-style: italic; color: var(--accent); }
.hero-text .lead { color: var(--muted); max-width: 32em; margin: 0 0 1.4em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-actions .button { min-height: 48px; padding: 0 22px; }
.dice-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform .5s var(--spring); }
.dice-link svg circle { fill: currentColor; stroke: none; }
.dice-link:hover svg { transform: rotate(180deg); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 36px; margin: 2em 0 0; }
.hero-stats dt { font-size: .85rem; color: var(--muted); }
.hero-stats dd { margin: 0; font-family: var(--display); font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.hero-side { flex: 0 1 440px; display: flex; flex-direction: column; align-items: center; }
.hero-stack { position: relative; width: min(420px, 90vw); height: 350px; animation: float 6s ease-in-out infinite; }
.stack-card { position: absolute; left: 50%; top: 24px; width: 72%; margin-left: -36%; padding: 10px; background: var(--surface-solid); border-radius: 6px; transition: transform .8s cubic-bezier(.2, .9, .25, 1.05), box-shadow .8s ease; }
.stack-card img { display: block; width: 100%; max-height: 240px; object-fit: contain; border-radius: 2px; background: var(--sunk); }
.stack-card[data-slot="0"] { z-index: 3; transform: rotate(-3deg); box-shadow: 0 2px 4px rgba(60, 40, 20, .12), 0 24px 44px rgba(60, 40, 20, .24); }
.stack-card[data-slot="1"] { z-index: 2; transform: translate(46px, 60px) rotate(7deg); box-shadow: 0 14px 28px rgba(60, 40, 20, .16); }
.stack-card[data-slot="2"] { z-index: 1; transform: translate(-44px, 84px) rotate(-11deg); box-shadow: 0 10px 20px rgba(60, 40, 20, .12); }
.hero-stack:hover .stack-card[data-slot="1"] { transform: translate(70px, 54px) rotate(11deg); }
.hero-stack:hover .stack-card[data-slot="2"] { transform: translate(-70px, 80px) rotate(-15deg); }
.postmark { position: absolute; right: -6px; top: -6px; z-index: 5; width: 118px; height: 118px; fill: none; stroke: var(--warm); stroke-width: 2; animation: stamp-in .6s var(--spring) .8s both; pointer-events: none; }
.postmark text { stroke: none; fill: var(--warm); }
.postmark .pm-arc { font: 600 11px var(--font); letter-spacing: 3px; }
.postmark .pm-hand { font: 500 22px var(--hand); }
.postmark .pm-waves { stroke-width: 1.5; }
.stack-caption { margin: 12px 0 0; text-align: center; color: var(--muted); position: relative; z-index: 2; }
.stack-caption a { font-family: var(--display); font-weight: 600; font-size: 1.1rem; text-decoration: none; }
.stack-caption a.fresh { animation: rise .5s var(--ease-out); display: inline-block; }
@media (max-width: 760px) { .hero-stack { height: 300px; } .stack-card img { max-height: 190px; } .hero-warm { padding-top: 8px; } }

/* Каталог: фильтры на «листе бумаги» */
.catalog-side { background: var(--surface); border-right: 0; border-radius: 18px; padding: 16px 20px 20px; box-shadow: var(--shadow); }
details.facet { border-top: 1px dashed var(--line-strong); }
details.facet:last-of-type { border-bottom: 0; }
details.facet summary .count:not(:empty), .chip .count:not(:empty) { background: var(--accent); color: var(--accent-ink); }
.results-head { border-bottom: 1px dashed var(--line-strong); }
.results-head .total { font-family: var(--display); font-size: 1.3rem; font-weight: 600; }
.results-head .sorting, .card-size, .sort-switch { border-radius: var(--pill); }
.card-size button[aria-pressed=true], .sort-switch button[aria-pressed=true], #select-toggle.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pager.pages a, .pager a { border-radius: var(--pill); }
.pager.pages .cur { border-radius: var(--pill); background: var(--night); color: #fff; }
.load-more { min-height: 50px; }

/* Карточка — открытка в белой рамке: появляется по очереди, при наведении приподнимается и чуть поворачивается */
.card .photo { padding: 8px; background: var(--surface-solid); border-radius: 8px; box-shadow: var(--shadow-photo); transition: transform .35s var(--spring), box-shadow .35s ease; }
.card .photo img, .card .photo .noimg { border-radius: 2px; }
/* Появление по очереди. Первые 16 карточек порции выезжают волной сразу (--i — номер в порции).
   Остальные (.later) скрыты, пока не окажутся на экране: тогда их показывает скрипт (.reveal) тоже волной.
   Так плавно появляется вся выдача, а не только верх, и не крутятся сотни анимаций за кадром. */
.grid > .card.enter { animation: deal .6s var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 15) * 45ms); }
.js .grid > .card.later { opacity: 0; }
.js .grid > .card.later.reveal { animation: deal .6s var(--ease-out) both; animation-delay: var(--d, 0ms); }
/* открытки «раздают на стол»: каждая ложится со своим наклоном и выравнивается */
.grid > .card { --tilt: -5deg; }
.grid > .card:nth-child(2n) { --tilt: 4deg; }
.grid > .card:nth-child(3n) { --tilt: 7deg; }
.grid > .card:nth-child(5n) { --tilt: -8deg; }
@keyframes deal { 0% { opacity: 0; transform: translateY(30px) rotate(var(--tilt)) scale(.93); } 55% { opacity: 1; } 75% { transform: translateY(-2px) rotate(calc(var(--tilt) * -.12)); } 100% { opacity: 1; transform: none; } }
/* наклон за курсором (класс .tilt ставит скрипт только для мыши и без «уменьшить движение») */
.tilt .card:not(.picked):hover .photo, .tilt .card:not(.picked):nth-child(even):hover .photo { transform: perspective(700px) translateY(-6px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .12s ease-out, box-shadow .35s ease; }
.card.vt-still { animation: none !important; opacity: 1 !important; }
.card:hover .photo { transform: translateY(-5px) rotate(-1deg); box-shadow: var(--shadow-lift); }
.card:nth-child(even):hover .photo { transform: translateY(-5px) rotate(1deg); }
.card .caption, .list-title { font-family: var(--display); font-weight: 600; }
.card .photo .dot { top: 14px; right: 14px; }
#results[data-size=s] .card .photo { padding: 4px; }
#results[data-size=list] .card, #results[data-size=list] .card.later { animation: none; opacity: 1; }
#results[data-size=list] .card .photo { padding: 0; background: var(--sunk); box-shadow: none; transform: none; }
#results[data-size=list] .card:hover { background: var(--surface); border-radius: var(--radius-sm); }
.selecting .card.picked .photo { outline-offset: 2px; transform: translateY(-4px); }
.selectable .card:has(input:checked) { transform: translateY(-3px); }
.empty h3 { font-family: var(--hand); font-size: 2rem; font-weight: 500; color: var(--brown); }

/* Страница открытки */
.photos figure.main { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); }
.photos figure.main a { perspective: 1600px; }
.photos figure.main img { background: var(--surface-solid); padding: 10px; border-radius: 6px; box-shadow: 0 2px 4px rgba(60, 40, 20, .10), 0 26px 50px rgba(60, 40, 20, .18); }
.photos figure.main a { touch-action: pan-y pinch-zoom; }
/* переворот в два приёма: открытка уходит ребром (скрипт), меняется сторона, и она возвращается с другой стороны */
.photos figure.main.turn img { animation: turn .5s cubic-bezier(.2, .9, .25, 1.08); }
@keyframes turn { 0% { transform: rotateY(calc(var(--dir, 1) * 90deg)); filter: brightness(.78); } 100% { transform: none; filter: none; } }
.photos .fullscreen { border-radius: var(--pill); }
.thumbs .thumb { border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); transition: transform .25s var(--spring), border-color .2s; }
.thumbs .thumb:hover { transform: translateY(-3px); }
.thumbs .thumb[aria-current] { border-color: var(--accent); }
.kicker { font-weight: 500; }
.info dl { border-top: 0; background: var(--surface); border-radius: 18px; padding: 4px 20px; box-shadow: var(--shadow); }
.info dt, .info dd { border-bottom: 1px dashed var(--line); }
.info dl > :nth-last-child(-n+2) { border-bottom: 0; }
.icon-toggle { border-radius: var(--pill); transition: background .2s, border-color .2s, color .2s, transform .25s var(--spring); }
.icon-toggle:hover { transform: translateY(-2px); }
.icon-toggle.on { color: var(--accent-ink); background: var(--tone); border-color: var(--tone); }
.icon-toggle.on svg { animation: pop .45s var(--spring); }
.icon-toggle[data-tip]:hover::after, .icon-toggle[data-tip]:focus-visible::after { border-radius: var(--pill); background: var(--night); color: #fff; padding: 6px 12px; }
.notes { font-size: 1.05rem; }
.inscription { background: color-mix(in srgb, var(--gold) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brown) 18%, transparent); border-radius: 16px; padding: 14px 20px; }
.inscription h3 { font-family: var(--font); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 4px; }
.inscription p { font-family: var(--hand); font-style: normal; font-size: 1.55rem; line-height: 1.3; color: var(--accent); margin: 0; }
.private { border-radius: 16px; border-width: 2px; border-color: color-mix(in srgb, var(--brown) 40%, transparent); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); }
.comments { border-top: 0; background: var(--surface); border-radius: 22px; padding: 24px 28px; box-shadow: var(--shadow); }
.comment { border-bottom: 1px dashed var(--line); animation: rise .5s var(--ease-out) both; }
.comment p:not(.muted) { background: var(--sunk); border-radius: 4px 16px 16px 16px; padding: 8px 14px; display: inline-block; }

/* Художники и издательства: имя на «марке» */
.entries { column-gap: 16px; row-gap: 12px; }
.entries li a { gap: 16px; padding: 12px 16px; margin: 0; border: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); transition: transform .3s var(--spring), box-shadow .3s; animation: rise .5s var(--ease-out) both; }
.entries li a:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.entries .avatar { width: 50px; height: 58px; border-radius: 3px; border: 2px dashed color-mix(in srgb, var(--brown) 45%, transparent); padding: 3px; background: var(--surface-solid) content-box; background-color: var(--warm-soft); background-clip: content-box; color: var(--warm); font-weight: 600; }
.entries .n { font-weight: 600; color: var(--accent); }
.portrait img { border: 10px solid var(--surface-solid); box-shadow: 0 2px 4px rgba(60, 40, 20, .12), 0 20px 40px rgba(60, 40, 20, .2); border-radius: 4px; transform: rotate(-1.5deg); }

/* Альбомы: при наведении открытки раскрываются веером */
.albums { gap: 40px 28px; }
.album .cover { background: none; overflow: visible; padding: 0; }
.album .cover::before, .album .cover::after { content: ""; position: absolute; inset: 12% 16%; background: var(--surface-solid); border-radius: 5px; box-shadow: var(--shadow-photo); transition: transform .5s var(--spring); }
.album .cover::before { transform: rotate(-9deg) translate(-18px, 8px); background-color: color-mix(in srgb, var(--accent) 10%, var(--surface-solid)); }
.album .cover::after { transform: rotate(8deg) translate(20px, 6px); background-color: color-mix(in srgb, var(--warm) 10%, var(--surface-solid)); }
.album .cover img { z-index: 1; inset: 8% 14%; width: 72%; height: 84%; padding: 8px; background: var(--surface-solid); border-radius: 5px; filter: none; box-shadow: 0 2px 4px rgba(60, 40, 20, .1), 0 14px 28px rgba(60, 40, 20, .16); transition: transform .5s var(--spring); }
.album:hover .cover::before { transform: rotate(-15deg) translate(-36px, 12px); }
.album:hover .cover::after { transform: rotate(13deg) translate(38px, 8px); }
.album:hover .cover img { transform: translateY(-8px) scale(1.02); }
.album .type-badge { z-index: 2; top: 6px; bottom: auto; }
.album-name { text-align: center; font-weight: 600; }
.album .small, .album .muted { text-align: center; }

/* Списки пользователя: вкладки с подчёркиванием */
.segmented.tabs { background: none; padding: 0; border-radius: 0; border-bottom: 1px solid var(--line); gap: 4px; }
.segmented.tabs a { position: relative; min-height: 52px; padding: 0 18px; border-radius: 0; font-weight: 600; }
.segmented.tabs a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px; background: var(--accent); transform: scaleX(0); transition: transform .4s var(--spring); }
.segmented.tabs a.active { background: none; box-shadow: none; }
.segmented.tabs a.active::after, .segmented.tabs a:hover::after { transform: scaleX(1); }
.segmented.tabs .n { padding: 1px 8px; border-radius: var(--pill); background: var(--sunk); }
.segmented.tabs a.active .n { background: var(--accent); color: var(--accent-ink); }

/* Работа с коллекцией */
.subnav { gap: 6px; padding: 8px; border: 0; border-radius: var(--pill); background: var(--surface); box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.subnav a { min-height: 40px; padding: 0 16px; border-radius: var(--pill); border-bottom: 0; margin: 0; color: var(--ink); }
.subnav a:hover { background: var(--sunk); border-bottom: 0; }
.subnav a[aria-current=page] { background: var(--night); color: #fff; border-bottom: 0; }
.subnav a .n { margin-left: 8px; padding: 0 7px; min-width: 20px; height: 20px; border-radius: var(--pill); background: var(--warm); color: #fff; font-size: .78rem; font-weight: 600; display: inline-grid; place-items: center; }
.mod-layout .subnav { width: auto; border-radius: 0; box-shadow: none; }
.tile { border: 0; border-radius: 20px; padding: 20px 24px; box-shadow: var(--shadow); animation: rise .6s var(--ease-out) both; transition: transform .3s var(--spring), box-shadow .3s; }
.tile:nth-child(2) { animation-delay: 80ms; } .tile:nth-child(3) { animation-delay: 160ms; } .tile:nth-child(4) { animation-delay: 240ms; }
a.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: transparent; }
.tile strong { font-size: 2.6em; font-weight: 600; }
.rows { border-top: 0; background: var(--surface); border-radius: 18px; padding: 4px 18px; box-shadow: var(--shadow); }
.rows li { border-bottom: 1px dashed var(--line); }
.rows li:last-child { border-bottom: 0; }
.dropzone { position: relative; overflow: hidden; border-radius: 24px; background: var(--surface); transition: border-color .3s, background .3s; }
.dropzone::before, .dropzone::after { content: ""; position: absolute; top: -60px; width: 60px; height: 42px; border-radius: 3px; background: var(--surface-solid); box-shadow: 0 6px 14px rgba(60, 40, 20, .16); opacity: 0; pointer-events: none; }
.dropzone::before { left: 22%; } .dropzone::after { left: 68%; animation-delay: .5s; background: var(--accent-soft); }
.dropzone.over::before, .dropzone.over::after, .dropzone:hover::before, .dropzone:hover::after { animation: fall 1.4s cubic-bezier(.3, .6, .4, 1) infinite; }
.dropzone:hover::after, .dropzone.over::after { animation-delay: .5s; }
@keyframes fall { 0% { opacity: 0; transform: translateY(0) rotate(-20deg); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(260px) rotate(25deg); } }
.selectable .card { transition: transform .25s var(--spring); }
.edit-form, .photo-card, .narrow, .feedback-item, .bulk, .artist-photos { border: 0; border-radius: 20px; box-shadow: var(--shadow); }
.mod-layout { border: 0; border-radius: 20px; box-shadow: var(--shadow); }
.queue a[aria-current] { border-left-color: var(--accent); background: var(--accent-soft); }
table.diff, table.list { border-radius: 14px; }

/* Вход, регистрация, письмо */
.narrow { padding: 2.2em 2.4em; box-shadow: 0 2px 4px rgba(60, 40, 20, .08), 0 26px 50px rgba(60, 40, 20, .14); }
.narrow.auth { position: relative; margin-top: 3em; }
.narrow.auth::before, .narrow.auth::after { content: ""; position: absolute; z-index: -1; width: 160px; height: 110px; border: 8px solid var(--surface-solid); border-radius: 4px; box-shadow: 0 10px 24px rgba(60, 40, 20, .14); animation: float 8s ease-in-out infinite; }
.narrow.auth::before { left: -150px; top: 30px; transform: rotate(-12deg); background: var(--accent-soft); }
.narrow.auth::after { right: -150px; bottom: 30px; transform: rotate(9deg); background: var(--warm-soft); animation-delay: -3s; }
@media (max-width: 760px) { .narrow.auth::before, .narrow.auth::after { display: none; } }
.narrow h1 { margin-top: 0; }
.letter-page { background: none; box-shadow: none; padding: 0; text-align: center; }
.letter-page > .muted { margin-bottom: 1.6em; }
.letter { text-align: left; background-color: var(--surface-solid); background-image: repeating-linear-gradient(transparent 0 37px, var(--line) 37px 38px); border-radius: 6px; padding: 28px 36px; box-shadow: 0 2px 4px rgba(60, 40, 20, .1), 0 26px 50px rgba(60, 40, 20, .16); transform: rotate(-.8deg); }
.letter textarea { font-family: var(--hand); font-size: 1.5rem; line-height: 38px; color: var(--accent); background: transparent; border: 0; box-shadow: none; padding: 0; }
.letter input:not([type=checkbox]) { background: transparent; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; box-shadow: none; font-family: var(--hand); font-size: 1.35rem; color: var(--accent); width: 100%; }
.letter button.primary { background: var(--warm); border-color: var(--warm); }

/* 404: открытка вернулась со штампом */
.lost { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 56px; padding: 8vh 0; }
.lost-card { position: relative; width: min(380px, 90vw); aspect-ratio: 3 / 2; display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; padding: 22px; background: var(--surface-solid); border-radius: 8px; box-shadow: 0 2px 4px rgba(60, 40, 20, .1), 0 30px 60px rgba(60, 40, 20, .2); animation: sway 5s ease-in-out infinite; transform-origin: 50% -40px; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(3deg); } }
.lost-note { margin: 0; padding-right: 14px; border-right: 1px solid var(--line-strong); font-family: var(--hand); font-size: 1.45rem; line-height: 1.2; color: var(--accent); }
.lost-address { display: flex; flex-direction: column; gap: 12px; }
.lost-address span:not(.lost-stamp) { border-bottom: 1px solid var(--line-strong); min-height: 24px; font-family: var(--hand); font-size: 1.2rem; color: var(--accent); }
.lost-stamp { align-self: flex-end; width: 56px; height: 66px; border: 2px dashed color-mix(in srgb, var(--brown) 50%, transparent); border-radius: 3px; background: var(--warm-soft); }
.lost-mark { position: absolute; left: 10%; bottom: 14%; padding: 8px 14px; border: 3px double var(--warm); border-radius: 8px; color: var(--warm); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: .95rem; animation: stamp-in .55s var(--spring) .6s both; }
.lost-text { max-width: 460px; }
.lost-text h1 { font-size: clamp(2rem, 1.4rem + 2vw, 3.2rem); }
.lost-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Сообщения — всплывающие «записки» внизу; успешные сами исчезают */
.messages { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; width: max-content; max-width: calc(100vw - 32px); margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.messages li { pointer-events: auto; margin: 0; padding: 12px 20px; border: 0; border-radius: var(--pill); background: var(--night); color: #fff; box-shadow: 0 14px 34px rgba(20, 25, 40, .3); animation: toast-in .5s var(--spring) both; }
.messages li.success { background: var(--night); color: #fff; animation: toast-in .5s var(--spring) both, toast-out .5s ease 5s forwards; }
.messages li.error { background: var(--bad); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Зона загрузки с невидимым input поверх: клик открывает проводник, файлы можно перетащить */
.dropzone.pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 1.6em 1em; cursor: pointer; border: 2px dashed var(--line-strong); }
.dropzone.pick input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone.pick svg { width: 34px; height: 34px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--spring); }
.dropzone.pick:hover svg, .dropzone.pick.over svg { transform: translateY(-4px); }
.dropzone.pick:hover, .dropzone.pick:focus-within { border-color: var(--accent); }

.photo-list .artist-photo { background: var(--surface); transition: opacity .15s; }
.photo-list .artist-photo.dragging { opacity: .45; }
.photo-list .artist-photo img { width: 96px; height: 120px; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.cover-badge { align-self: flex-start; font-size: .8rem; font-weight: 600; color: var(--accent-ink); background: var(--accent); border-radius: var(--pill); padding: 2px 10px; }
.cover-badge[hidden] { display: none; }
.photo-actions-row { display: flex; align-items: center; gap: 10px; }
.photo-actions-row button { min-width: 28px; }
.photo-actions-row button:disabled { opacity: .3; cursor: default; }
.drag-handle { cursor: grab; color: var(--muted); font-size: 1.2rem; line-height: 1; user-select: none; }

/* Пока грузится новая выдача, старая приглушается; потом карточки новой выдачи выезжают по очереди */
#results { transition: opacity .2s ease; }
body.loading #results { opacity: .45; }
.load-more[aria-busy] { cursor: progress; }

/* Кнопки «Сохранить / Отмена» в длинных формах всегда на виду: прилипают к нижнему краю окна, пока форма не закончилась */
.form-bar { position: sticky; bottom: 0; z-index: 4; margin-bottom: 0; padding: 28px 0 max(12px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--surface) 62%, transparent); border: 0; }
/* «Сохранить» красная, «Отмена» серая: с первого взгляда понятно, что где */
.form-bar button.primary { background: var(--save, #c0392b); border-color: transparent; color: #fff; }
.form-bar button.primary:hover { background: color-mix(in srgb, var(--save, #c0392b) 88%, #000); }
.form-bar .button.cancel { background: color-mix(in srgb, var(--muted) 24%, var(--surface)); border-color: transparent; color: var(--ink); }
.form-bar .button.cancel:hover { background: color-mix(in srgb, var(--muted) 34%, var(--surface)); }

/* Шапка прикреплена к верху и сжимается при прокрутке (класс head-compact ставит скрипт); высота в потоке постоянна (--head-h), так что содержимое не прыгает */
:root { --head-h: 76px; }
body { padding-top: var(--head-h); }
.top { position: fixed; top: 0; left: 0; right: 0; transition: min-height .3s ease, padding .3s ease, box-shadow .3s ease; }
.top .logo, .brand { transition: width .3s ease, height .3s ease, font-size .3s ease, transform .5s var(--spring); }
.brand-sub { display: block; max-height: 1.6em; overflow: hidden; transition: opacity .25s ease, max-height .3s ease; }
html.head-compact .top { min-height: 52px; padding-top: .2em; padding-bottom: .2em; box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .45); }
html.head-compact .top .logo { width: 36px; height: 36px; }
html.head-compact .brand { font-size: 1.1em; }
html.head-compact .brand-sub { opacity: 0; max-height: 0; }
@media (max-width: 560px) { html.head-compact .top .logo { width: 32px; height: 32px; } }
.catalog-side, .sticky { transition: top .3s ease; }
html.head-compact .catalog-side { top: 68px; max-height: calc(100vh - 84px); }
html.head-compact .sticky { top: 52px; }
html.no-anim *, html.no-anim *::before, html.no-anim *::after { transition: none !important; }

/* Кнопка правки — в строке статуса, справа сверху */
.kicker .edit-top { margin-left: auto; min-height: 36px; padding: 0 1em; font-size: .9rem; }

/* Фото на экране правки открытки: превью слева, справа сторона «таблетками», круглые кнопки действий, редкое — в «Ещё» */
.photo-card { grid-template-columns: 220px 1fr; align-items: start; gap: 18px; }
.photo-thumb { position: relative; }
.photo-thumb img { display: block; width: 100%; }
.split-pick { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 10px 4px 6px; border-radius: var(--pill); background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); font-size: .8rem; cursor: pointer; }
.split-pick input { width: 16px; height: 16px; margin: 0; flex: none; }
.photo-controls { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.role-pills { display: inline-flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.role-pills button { min-height: 36px; padding: 0 1em; border-radius: var(--pill); font-size: .92rem; background: transparent; }
.role-pills button[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.photo-actions .round { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; }
.photo-actions .round svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.photo-actions .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.photo-more { font-size: .94rem; }
.photo-more summary { cursor: pointer; color: var(--muted); width: max-content; }
.photo-more[open] summary { margin-bottom: 10px; }
.photo-more form { margin: 0 0 8px; }
.move-row { display: flex; align-items: center; gap: 8px; }
.move-row input { width: 90px; }
#add-photos-form { margin: 8px 0 16px; }
.dropzone.busy { opacity: .6; pointer-events: none; }
@media (max-width: 900px) { .photo-card { grid-template-columns: 1fr; } .photo-thumb { max-width: 320px; } }

/* Стрелки листания фото на странице открытки; видны, только когда есть куда листать (hidden) */
.photos figure.main { position: relative; }
.photo-nav { position: absolute; top: 50%; translate: 0 -50%; z-index: 2; width: var(--tap, 44px); height: var(--tap, 44px); min-height: 0; padding: 0 0 4px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.9rem; line-height: 1; background: color-mix(in srgb, var(--surface-solid, var(--surface)) 88%, transparent); color: var(--ink);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow); cursor: pointer; }
.photo-nav.prev { left: 10px; } .photo-nav.next { right: 10px; }
.photo-nav[hidden] { display: none; }

/* Страница открытки: левая колонка (фото + миниатюры) всегда целиком в высоте экрана, размеры считаются от высоты окна.
   Правая колонка (описание) течёт как раньше, прокручивается страницей, а фото остаётся на месте (sticky). */
.photos { --th: clamp(52px, 12svh, 128px); }
.photos .thumbs { flex-wrap: nowrap; gap: 10px; overflow-x: auto; flex: none; min-height: var(--th); padding: 2px 2px 6px; }
.photos .thumbs .thumb { flex: 0 1 auto; height: var(--th); width: auto; aspect-ratio: 4 / 3; min-width: 0; padding: 6px; }
.photos .thumbs .thumb-caption { flex: none; white-space: nowrap; }
.photos figure.main a { padding: 0; }
.photos figure.main img { --maxh: max(240px, calc(100svh - 190px - var(--th) - 14px)); }
@media (min-width: 761px) {
  .photos { position: sticky; top: 88px; align-self: start; height: max(380px, calc(100svh - 210px)); }
  .photos figure.main { flex: 1 1 0; min-height: 0; }
  .photos figure.main a { height: 100%; }
  @supports (container-type: size) {
    .photos figure.main { container-type: size; }
    /* картинка целиком: помещается и по ширине, и по высоте колонки; на большом мониторе растягивается */
    .photos figure.main img { --maxh: calc(100cqh - 28px); width: min(calc(100cqw - 28px), calc(var(--maxh) * var(--r, 1.4))); }
  }
}

/* Распознавание: галочка «сохранить» у каждого поля */
.rec-row { margin: 0 0 .8em; padding: .5em .6em; border: 1px solid transparent; border-radius: var(--radius-sm); }
.rec-row.changed { border-color: var(--line-strong); }
.rec-row.off.changed { opacity: .65; }
.rec-row .rec-head { display: flex; gap: .5em; align-items: center; font-size: .94rem; }
.rec-row .rec-check { display: inline-block; width: 20px; height: 20px; margin: 0; }
.rec-row .src { display: inline-block; margin-top: .2em; font-size: .8em; padding: 1px 8px; border-radius: 10px; background: var(--sunk); color: var(--muted); }
.rec-bulk { margin: 0 0 .6em; }
.rec-row.same { border-color: var(--ok); background: var(--ok-soft); }
.rec-row.same .was { color: var(--ok); }

/* Режим проверки: панель над открыткой */
.review-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 0 0 18px; padding: 12px 16px; border: 1px solid var(--ok); border-radius: var(--radius-sm); background: var(--ok-soft); }
.review-bar span { flex: 1 1 260px; font-weight: 500; }
.rec-row .rec-peek { margin-left: auto; min-height: 28px; padding: 0 10px; font-size: .8rem; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: zoom-in; }
/* фрагмент поля: по центру панели, без рамки панели (красная рамка вокруг строки уже на самой картинке) */
.rec-image.peeking { cursor: default; display: grid; place-items: center; }
.rec-image.peeking img { width: auto; max-width: 100%; max-height: 100%; height: auto; }
.rec-row .rec-peek.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* «Другие варианты» и экземпляры: карточки разной высоты выравниваем по верху, а не по низу как в каталоге-коллаже */
.grid.small { align-items: flex-start; }

/* Серии: заголовок блока открыток одной серии на страницах художника и издательства */
.grid > .series-head { flex: 0 0 100%; margin: 18px 0 0; font-size: 1.15rem; }
.grid > .series-head:first-child { margin-top: 0; }
.series-nav { display: flex; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
/* переключатель «Серии» и пустышка перед заголовком серии: как ::after в конце сетки, не даёт последней строке группы раздуться */
.series-toggle { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; text-decoration: none; cursor: pointer; }
.series-toggle[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.grid > .series-fill { flex: 1000 1 0; min-width: 0; height: 0; }
#results[data-size=list] .series-fill { display: none; }

details.extra-fields { margin: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 0; }
details.extra-fields summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-weight: 600; }
details.extra-fields > :not(summary) { margin-bottom: 10px; }

/* Страница открытки: сначала суть (кто, когда), потом что написали, реквизиты издания — в свёрнутом блоке */
.info h1 { margin-bottom: 8px; }
.byline { margin: 0 0 4px; font-size: 1.08rem; line-height: 1.5; }
.byline .sep { margin: 0 .45em; color: var(--faint); }
.byline-note { margin: 0 0 4px; font-size: .92rem; color: var(--muted); max-width: 40em; }
.info .actions-row { margin-top: 14px; }
.letter { position: relative; margin: 22px 0 18px; padding: 18px 22px 16px; background-color: #fbf6ea; color: #2a2620; border-radius: 6px;
  box-shadow: 0 1px 2px rgba(60, 40, 20, .12), 0 14px 30px -12px rgba(60, 40, 20, .35);
  background-image: repeating-linear-gradient(transparent 0 33px, rgba(44, 74, 154, .10) 33px 34px); background-position: 0 14px; }
.letter h2 { margin: 0 0 6px; font-family: var(--font); font-size: .78rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: #8a7f72; }
.letter .hand { margin: 0; font-family: var(--hand); font-size: 1.45rem; line-height: 34px; color: #23366e; overflow-wrap: anywhere; }
.letter .stamp-mark { position: absolute; top: 12px; right: 14px; margin: 0; transform: rotate(-6deg); }
.letter .stamp-mark a { display: inline-block; padding: 3px 10px; border: 2px solid rgba(180, 68, 47, .65); border-radius: 999px; color: rgba(180, 68, 47, .9);
  font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.tags-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.tags-row .chip { min-height: 32px; text-decoration: none; }
.specs { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 0 1.2em; }
.specs summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 0; cursor: pointer; list-style: none; }
.specs summary::-webkit-details-marker { display: none; }
.specs summary::after { content: "+"; margin-left: auto; color: var(--muted); font-size: 1.2rem; line-height: 1; }
.specs[open] summary::after { content: "−"; }
.specs-title { font-weight: 600; }
.specs-brief { color: var(--muted); font-size: .92rem; }
.specs[open] .specs-brief { display: none; }
.info .specs dl { border-top: 1px solid var(--line); margin: 0; }
.info .specs dl > :nth-last-child(-n+2) { border-bottom: 0; }
/* переворот лицо ↔ оборот */
.photos figure.main { position: relative; }
.photos .flip { position: absolute; left: 12px; bottom: 12px; min-height: 32px; padding: 0 14px; border-radius: var(--pill); font-size: .85rem;
  color: var(--ink); background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); border: 0; cursor: pointer; }
@media (max-width: 760px) {
  .letter { margin-left: -4px; margin-right: -4px; padding: 16px 16px 14px; }
  .letter .hand { font-size: 1.32rem; }
}
/* колонки открытки не растягиваются под ряд миниатюр (он прокручивается сам) */
.postcard > * { min-width: 0; }

/* Списки художников и издательств: обложка — открытка */
.entries .avatar.cover { width: 56px; height: 64px; padding: 0; border: 0; border-radius: 3px; object-fit: contain; background: transparent; box-shadow: 0 1px 2px rgba(0, 0, 0, .18), 0 6px 14px -6px rgba(0, 0, 0, .35); transform: rotate(-2deg); }
.entries li:nth-child(even) .avatar.cover { transform: rotate(2deg); }
.entries .years { font-variant-numeric: tabular-nums; }

/* «Що писали» */
.lead { max-width: 44em; margin: -6px 0 16px; }
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 20px; margin-top: 20px; }
.letter-card { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 14px; align-items: start; color: inherit; text-decoration: none; }
.letter-photo img { width: 84px; border-radius: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 8px 18px -8px rgba(0, 0, 0, .4); transform: rotate(-2deg); transition: transform .3s var(--spring); }
.letter-card:hover .letter-photo img { transform: rotate(0) translateY(-2px); }
.letter-paper { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 12px; background-color: #fbf6ea; color: #2a2620; border-radius: 6px;
  box-shadow: 0 1px 2px rgba(60, 40, 20, .12), 0 12px 24px -12px rgba(60, 40, 20, .35);
  background-image: repeating-linear-gradient(transparent 0 27px, rgba(44, 74, 154, .10) 27px 28px); background-position: 0 12px; }
.letter-paper .hand { font-family: var(--hand); font-size: 1.22rem; line-height: 28px; color: #23366e; overflow-wrap: anywhere; }
.letter-meta { font-size: .82rem; color: #6b6156; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.mini-stamp { padding: 1px 8px; border: 1.5px solid rgba(180, 68, 47, .6); border-radius: 999px; color: rgba(180, 68, 47, .9); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; }
.more-row { margin: 24px 0; text-align: center; }
@media (max-width: 560px) { .letter-card { grid-template-columns: 64px minmax(0, 1fr); } .letter-photo img { width: 64px; } }

/* «Скоро свято» на главной */
.holiday { margin: 8px 0 36px; }
.holiday-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin-bottom: 14px; }
.holiday-head .hand-note { flex-basis: 100%; margin: 0; }
.holiday-head h2 { margin: 0; font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); }
.holiday-all { margin-left: auto; white-space: nowrap; }
.holiday-row { display: flex; gap: 18px; overflow-x: auto; padding: 8px 4px 18px; scroll-snap-type: x proximity; }
.holiday-card { flex: none; scroll-snap-align: start; }
.holiday-card img { display: block; height: 170px; width: auto; max-width: 260px; object-fit: contain; border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 12px 24px -10px rgba(0, 0, 0, .45); transition: transform .3s var(--spring); }
.holiday-card:nth-child(odd) img { transform: rotate(-1.5deg); }
.holiday-card:nth-child(even) img { transform: rotate(1.5deg); }
.holiday-card:hover img { transform: translateY(-4px) rotate(0); }
@media (max-width: 560px) { .holiday-card img { height: 130px; } .holiday-all { margin-left: 0; } }
/* колонки каталога не растягиваются под прокручиваемые ряды (чипсы фильтров и т. п.) */
.catalog-layout > * { min-width: 0; }

/* «По десятиліттях» на главной */
.decades { margin: 0 0 36px; }
.decades h2 { margin: 0 0 12px; font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem); }
.decade-row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 4px 14px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.decade { flex: none; width: 118px; display: grid; grid-template-rows: 120px auto; gap: 8px; justify-items: center; text-align: center; color: var(--ink); text-decoration: none; scroll-snap-align: start; }
.decade-cover { display: grid; place-items: end center; width: 100%; height: 120px; }
.decade-cover img { max-width: 100%; max-height: 120px; border-radius: 3px; box-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 20px -10px rgba(0, 0, 0, .45); transform: rotate(-2deg); transition: transform .3s var(--spring); }
.decade:nth-child(even) .decade-cover img { transform: rotate(2deg); }
.decade:hover .decade-cover img { transform: translateY(-4px) rotate(0); }
.decade-label { font-family: var(--display); font-size: 1.15rem; line-height: 1.1; }
.decade-n { font-size: .85rem; color: var(--muted); margin-top: -6px; }

/* «Надіслати листівку» */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.send { margin: 6px 0 4px; }
.send summary { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: var(--pill); border: 1px solid var(--line-strong); cursor: pointer; list-style: none; font-size: .95rem; }
.send summary::-webkit-details-marker { display: none; }
.send[open] summary { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.send form { display: grid; gap: 10px; margin-top: 12px; max-width: 30em; }
.send textarea { font-family: var(--hand); font-size: 1.3rem; line-height: 1.3; }
.greeting { max-width: 760px; margin: 0 auto; text-align: center; }
.greeting-kicker { font-size: 1.6rem; margin: 6px 0 14px; }
.greeting-card { margin: 0 auto; }
.greeting-card img { display: block; margin: 0 auto; max-width: min(100%, 680px); max-height: 70svh; width: auto; height: auto; border-radius: 4px; background: #fbf6ea; padding: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2), 0 30px 60px -20px rgba(0, 0, 0, .55); }
.greeting-letter { text-align: left; max-width: 560px; margin: 26px auto 14px; }
.greeting-sign { text-align: right; margin: 6px 0 0; font-family: var(--hand); font-size: 1.4rem; color: #23366e; }
.greeting-about { color: var(--muted); font-size: .94rem; line-height: 1.6; }
.greeting-share { text-align: left; margin: 0 0 22px; padding: 16px 18px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.greeting-share p { margin: 0 0 10px; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-row input { flex: 1 1 260px; min-width: 0; }


/* Ощущение бумаги: едва заметная фактура фона (в обеих темах) */
body { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .25 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
/* Переключатель темы в шапке */
.theme-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .t-light, .theme-toggle .t-dark { display: none; }
:root[data-theme="light"] .theme-toggle .t-auto, :root[data-theme="dark"] .theme-toggle .t-auto { display: none; }
:root[data-theme="light"] .theme-toggle .t-light { display: inline; }
:root[data-theme="dark"] .theme-toggle .t-dark { display: inline; }
/* Подвал с «авиапочтовой» каймой */
.site-foot { margin-top: 48px; padding: 22px 20px 30px; text-align: center; color: var(--muted); font-size: .9rem;
  border-top: 6px solid transparent; border-image: repeating-linear-gradient(-45deg, #b4442f 0 14px, transparent 14px 20px, #2c4a9a 20px 34px, transparent 34px 40px) 6; }
.site-foot .hand-note { display: block; font-size: 1.3rem; margin-bottom: 4px; }
.site-foot a { color: var(--muted); }

/* Страница серии: прогресс и недостающие номера; художник/издательство — по десятилетиям */
.series-progress { margin: 10px 0 4px; max-width: 34em; }
.series-progress p { margin: 0 0 6px; }
.series-progress .bar { display: block; height: 8px; border-radius: 4px; background: var(--sunk); overflow: hidden; margin-bottom: 10px; }
.series-progress .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--warm)); border-radius: 4px; }
.wanted { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wanted-no { display: inline-grid; place-items: center; min-width: 44px; height: 30px; padding: 0 8px; border: 1.5px dashed var(--line-strong); border-radius: 4px; font-size: .88rem; color: var(--muted); }
.decade-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.decade-chips .chip { text-decoration: none; min-height: 32px; }

/* Редактор поля для текста на обороте */
.region-box { position: relative; margin: 8px 0; cursor: crosshair; touch-action: none; user-select: none; }
.region-box img { display: block; width: 100%; border-radius: 4px; }
.region-rect { position: absolute; border: 2px solid #b4442f; background: rgba(180, 68, 47, .12); border-radius: 2px; pointer-events: none; }

/* Переход между страницами: открытка из каталога «вырастает» в большое фото и возвращается обратно.
   Имя перехода ставит скрипт на одну нужную карточку (pageswap/pagereveal): одинаковые имена отменили бы переход целиком. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .top { view-transition-name: site-top; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
  /* пока идёт переход, появление блоков на новой странице ждёт: иначе вся страница перерисовывается каждый кадр */
  html.vt-run main * { animation-play-state: paused !important; }
  ::view-transition-group(card-photo) { animation-duration: .42s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  ::view-transition-old(card-photo), ::view-transition-new(card-photo) { height: 100%; object-fit: cover; }
}

/* ===== Редизайн 2026-11: галерея без рамок, фильтры панелью, страница открытки ===== */

/* Каталог: открытка без белой рамки, плотнее и крупнее; подпись появляется поверх фото при наведении */
.card .photo { position: relative; padding: 0; background: none; border-radius: 6px; overflow: hidden; }
.card .photo img, .card .photo .noimg { border-radius: 0; box-shadow: none; display: block; }
#results[data-size=s] .card .photo { padding: 0; }
.card .photo .dot { top: 8px; right: 8px; }
.grid { gap: 12px; }
#results { --card-h: 200px; }
@media (hover: hover) {
  #results:not([data-size=list]):not([data-size=s]) .grid > .card .list-info { display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; position: absolute; inset: 0; padding: 10px 12px; border-radius: 6px;
    background: linear-gradient(to top, rgba(22, 16, 10, .78), rgba(22, 16, 10, 0) 58%); color: #fff; opacity: 0; transition: opacity .2s, transform .12s ease-out; pointer-events: none; }
  #results:not([data-size=list]):not([data-size=s]) .grid > .card:hover .list-info, #results:not([data-size=list]):not([data-size=s]) .grid > .card:focus-visible .list-info { opacity: 1; }
  #results:not([data-size=list]) .list-title { font-size: .98rem; line-height: 1.25; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  #results:not([data-size=list]) .list-meta { color: rgba(255, 255, 255, .82); font-size: .82rem; gap: 0 8px; }
  #results:not([data-size=list]) .list-meta span + span::before { margin-right: 8px; color: rgba(255, 255, 255, .5); }
  #results:not([data-size=list]) .list-meta span:nth-child(n+3) { display: none; }
  /* подпись лежит ровно поверх фото и наклоняется вместе с ним */
  .tilt .card:not(.picked):hover .list-info { transform: perspective(700px) translateY(-6px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
}
@media (max-width: 860px) { #results { --card-h: 140px; } .grid { gap: 8px; } }

/* Фильтры (гибрид): четыре главных — кнопки с окошком под ними, остальные — в панели «Ще фільтри».
   Блоки фильтров остаются в форме; окошко — это тот же блок, показанный под своей кнопкой. */
.search-wrap { position: relative; margin-bottom: 14px; }
.catalog-main > .search-wrap > .search { margin-bottom: 0; }
.search-suggest { display: none; }
.search-wrap:focus-within .search-suggest:not(:empty) { display: block; position: absolute; z-index: 16; left: 0; right: 0; top: calc(100% + 6px); padding: 8px; border-radius: 16px; background: var(--surface-solid, var(--surface)); border: 1px solid var(--line); box-shadow: var(--shadow-lift); }
.search-suggest .suggestions { display: flex; flex-direction: column; align-items: stretch; gap: 2px; margin: 0; }
.search-suggest .suggestions > .muted { padding: 4px 10px; font-size: .82rem; }
.search-suggest .chip { justify-content: flex-start; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: none; font-size: .98rem; text-align: left; }
.search-suggest .chip:hover, .search-suggest .chip:focus-visible { background: var(--sunk); transform: none; box-shadow: none; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 18px; }
.chip-group { display: inline-flex; align-items: center; }
.filters-open, .facet-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: var(--pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: .94rem; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background .2s, border-color .2s; }
.facet-chip:hover, .filters-open:hover { background: var(--sunk); transform: none; box-shadow: none; }
.facet-chip .chip-val { max-width: 15em; overflow: hidden; text-overflow: ellipsis; font-weight: 600; margin-left: -6px; }
.facet-chip .chip-caret { font-size: .8em; opacity: .7; transition: transform .2s; }
.facet-chip[aria-expanded=true] { border-color: var(--ink); }
.facet-chip[aria-expanded=true] .chip-caret { transform: rotate(180deg); }
.facet-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); border-radius: var(--pill) 0 0 var(--pill); padding-right: 10px; }
.chip-clear { min-height: 40px; width: 34px; padding: 0; border: 1px solid var(--accent); border-left: 0; border-radius: 0 var(--pill) var(--pill) 0; background: var(--accent-soft); color: var(--accent); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.chip-clear:hover { background: var(--accent); color: var(--accent-ink, #fff); transform: none; box-shadow: none; }
.chip-clear[hidden] { display: none; }
.filters-open .count:not(:empty) { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--ink); color: var(--bg); font-size: .8em; display: inline-grid; place-items: center; }
.bar-reset { margin-left: 4px; font-size: .92rem; }
.bar-reset[hidden] { display: none; }
.active-filters { display: none; } /* выбранное видно в самих кнопках и в счётчике «Ще фільтри» */
.narrow-only { display: none; }
.decade-picks, .holiday-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.decade-picks .chip, .holiday-picks .chip { min-height: 34px; cursor: pointer; }
.decade-picks .chip .n { margin-left: 4px; color: var(--muted); font-size: .85em; font-variant-numeric: tabular-nums; }
.decade-picks .chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
@media (min-width: 861px) {
  .catalog-layout { position: relative; grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* форма с фильтрами на компьютере не занимает места: её блоки показываются окошками или панелью */
  .catalog-side, html.head-compact .catalog-side { position: static; top: auto; max-height: none; overflow: visible; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
  .catalog-side .filters-head, .catalog-side .sheet-foot, .catalog-side details.facet { display: none; }
  .catalog-side details.facet.pop { display: block; position: absolute; z-index: 15; width: 352px; max-height: min(70vh, 560px); overflow-y: auto; margin: 0; padding: 14px 16px 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-solid, var(--surface)); box-shadow: var(--shadow-lift); animation: toast-in .22s var(--ease-out) both; }
  .catalog-side details.facet.pop > summary { display: none; }
  .catalog-side details.facet.pop > :not(summary) { margin-bottom: 10px; }
  /* «Ще фільтри»: панель справа с остальными полями */
  .filters-shown { overflow: hidden; }
  .filters-shown::before { content: ""; position: fixed; inset: 0; z-index: 20; background: rgba(20, 15, 10, .38); animation: veil-in .25s ease both; }
  .filters-shown .catalog-side, html.head-compact .filters-shown .catalog-side { position: fixed; inset: 0 0 0 auto; z-index: 21; width: min(420px, 100vw); overflow-y: auto; padding: 0 24px; background: var(--surface-solid, var(--surface)); box-shadow: -24px 0 60px rgba(30, 20, 10, .28); animation: drawer-in .3s var(--ease-out) both; }
  .filters-shown .catalog-side details.facet:not(.primary) { display: block; }
  .filters-shown .catalog-side .filters-head { display: flex; position: sticky; top: 0; z-index: 1; align-items: center; gap: 16px; padding: 20px 0 14px; margin: 0; background: inherit; }
  .filters-shown .filters-head > span { flex: 1; font-family: var(--display); font-size: 1.4rem; font-weight: 600; }
  .filters-shown .filters-head .sheet-close { display: inline-flex; border: 0; background: none; font-size: 1.8rem; line-height: 1; padding: 0 4px; cursor: pointer; }
  .filters-shown .catalog-side .sheet-foot { display: block; position: sticky; bottom: 0; padding: 12px 0 18px; background: inherit; border-top: 1px solid var(--line); }
  .sheet-foot button { width: 100%; min-height: 50px; font-size: 1.05rem; }
}
@media (max-width: 860px) {
  .wide-only { display: none; }
  .narrow-only { display: inline; }
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px 12px; padding: 2px 20px 6px; scrollbar-width: none; }
  .filter-bar > * { flex: none; }
  .filters-open { order: -1; background: var(--ink); border-color: var(--ink); color: var(--bg); }
  .filters-open .count:not(:empty) { background: var(--bg); color: var(--ink); }
  .bar-reset { display: none; }
  /* в шторке главные поля идут первыми, шапка и кнопка «Показати» остаются на своих местах */
  .catalog-side .catalog { display: flex; flex-direction: column; }
  .catalog-side .filters-head { order: -5; }
  .catalog-side details.facet[data-facet=tag] { order: -4; }
  .catalog-side details.facet[data-facet=years] { order: -3; }
  .catalog-side details.facet[data-facet=artist] { order: -2; }
  .catalog-side details.facet[data-facet=publisher] { order: -1; }
  .catalog-side .sheet-foot { order: 9; }
}
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes veil-in { from { opacity: 0; } }

/* Страница открытки: фото на фоне из её собственных цветов (размытая миниатюра) */
.photos figure.main { overflow: hidden; isolation: isolate; background: var(--sunk); box-shadow: none; }
/* размытие считается на маленьком слое, который потом растягивается: большой blur на всю площадь давал рывки при открытии страницы */
.photos figure.main::before { content: ""; position: absolute; left: 37.5%; top: 37.5%; width: 25%; height: 25%; z-index: -1; background: var(--amb, none) center / cover no-repeat; filter: blur(11px) saturate(1.3); transform: scale(5.2); opacity: .6; }
/* под большим фото сразу лежит уже загруженная миниатюра: переход из каталога с первого кадра идёт по готовой картинке */
.photos figure.main img { padding: 8px; background: var(--surface-solid); }
.photos .fullscreen, .photos .flip { background: color-mix(in srgb, var(--surface-solid, var(--surface)) 92%, transparent); border: 0; box-shadow: var(--shadow); }

/* «Про видання» — паспорт: мелкая подпись над значением, в две колонки */
.info .specs dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; padding: 6px 20px 10px; }
.info .specs dl > div { padding: 10px 0; border-bottom: 1px dashed var(--line); min-width: 0; }
.info .specs dl > div.wide { grid-column: 1 / -1; }
.info .specs dl > div:last-child, .info .specs dl > div:nth-last-child(2):not(.wide):nth-child(odd) { border-bottom: 0; }
.info .specs dt, .info .specs dd { padding: 0; border: 0; }
.info .specs dt { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.info .specs dd { font-weight: 500; overflow-wrap: anywhere; }

/* Блоки «серия / варианты / похожие» — ленты, которые листаются вбок */
section.variants .grid.small { flex-wrap: nowrap; align-items: flex-start; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 2px 12px; margin: 0 -2px; scrollbar-width: thin; }
section.variants .grid.small::after { display: none; }
section.variants .grid.small > .card { flex: 0 0 auto; width: calc(var(--r, 1.4) * 170px); min-width: 0; max-width: none; scroll-snap-align: start; }
section.variants .grid.small .caption { font-size: .9rem; }
@media (max-width: 860px) { section.variants .grid.small > .card { flex: 0 0 auto; width: calc(var(--r, 1.4) * 130px); } }

/* Художник без портрета: заглушка-бульдог в берете вместо случайной открытки */
.entries .avatar.ph { width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%; object-fit: cover; background: #efe4d0; box-shadow: var(--shadow); }

/* Подвал прижат к низу окна на коротких страницах; на длинных он просто в конце, до него надо доскроллить */
body:not(.gx) { display: flex; flex-direction: column; min-height: 100dvh; box-sizing: border-box; }
body:not(.gx) > main { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
body:not(.gx) > .site-foot { margin-top: auto; }

/* Отправка открытки доступна после входа: гостю — ссылка в том же виде, что и кнопка */
.send-login { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: var(--pill); border: 1px solid var(--line-strong); color: var(--ink); text-decoration: none; font-size: .94rem; }
.send-login:hover { background: var(--sunk); color: var(--ink); }

/* Окно «Надіслати листівку»: превью открытки и поля рядом */
.send-open { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: var(--pill); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font-size: .95rem; cursor: pointer; }
.send-open:hover { background: var(--sunk); }
dialog.send-dialog { width: min(1000px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 20px; overflow: hidden; background: var(--surface-solid, var(--surface)); color: var(--ink); box-shadow: 0 30px 80px rgba(20, 15, 10, .45); }
dialog.send-dialog::backdrop { background: rgba(20, 15, 10, .55); }
dialog.send-dialog[open] { animation: toast-in .35s var(--ease-out) both; }
.send-body { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.send-dialog iframe { display: block; width: 100%; height: min(540px, calc(100dvh - 24px)); border: 0; background: #1d1712; }
.send-dialog form { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 24px; max-width: none; max-height: min(540px, calc(100dvh - 24px)); overflow-y: auto; }
.send-dialog h2 { margin: 0 0 2px; font-size: 1.35rem; }
.send-dialog p { margin: 0; }
.send-dialog textarea { font-family: var(--hand); font-size: 1.3rem; line-height: 1.3; resize: vertical; }
.send-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: auto; padding-top: 8px; }
@media (max-width: 760px) {
  dialog.send-dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .send-body { grid-template-columns: minmax(0, 1fr); }
  .send-dialog iframe { height: 36dvh; }
  .send-dialog form { max-height: calc(64dvh - 8px); padding: 16px 16px 20px; }
}

/* «Історії цієї листівки» и форма «Додати зворот» */
.stories { margin: 40px 0 0; }
.stories .letters { margin-bottom: 14px; }
.letter-card.story { cursor: default; }
.letter-card.story .letter-photo a { display: block; cursor: zoom-in; }
.back-form { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 560px); gap: 32px; align-items: start; }
.back-form .back-front { width: 100%; border-radius: 6px; box-shadow: var(--shadow-photo); }
.back-form form p { display: flex; flex-direction: column; gap: 4px; margin: 0 0 14px; }
.back-form form .send-actions { flex-direction: row; }
.back-form .error { color: var(--bad); font-size: .9rem; }
@media (max-width: 760px) { .back-form { grid-template-columns: 1fr; } .back-form .back-front { max-width: 160px; } }

/* Редактор закрашивания: участки поверх фото */
.mask-stage { position: relative; display: inline-block; max-width: 100%; touch-action: none; user-select: none; cursor: crosshair; line-height: 0; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-photo); }
.mask-stage img { display: block; max-width: 100%; max-height: 72vh; pointer-events: none; }
.mask-rect { position: absolute; min-height: 0; padding: 0; border: 2px solid var(--bad); border-radius: 2px; background: rgba(180, 60, 40, .45); cursor: pointer; }
.mask-rect:hover { background: rgba(180, 60, 40, .7); transform: none; box-shadow: none; }
.mask-rect.draft { pointer-events: none; border-style: dashed; }
.mask-form .send-actions { justify-content: flex-start; align-items: center; }

/* Логотип издательства: квадрат, вписан целиком на светлом поле (портреты художников по-прежнему обрезаются по рамке) */
.portrait.pub-logo img { height: 180px; object-fit: contain; background: #fff; padding: 12px; box-sizing: border-box; transform: none; }
.portrait.pub-logo .portrait-more img { padding: 4px; object-fit: contain; }
.entries .avatar.pub-logo { object-fit: contain; background: #fff; }

/* Скан получше: строка под миниатюрами и сравнение в модерации */
.scan-note { margin: 0; }
.scan-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.scan-compare figure { margin: 0; }
.scan-compare img { display: block; width: 100%; border-radius: 6px; box-shadow: var(--shadow-photo); }
.scan-compare figcaption { margin-top: 6px; font-size: .9rem; color: var(--muted); }

/* Карта путей открыток */
.route-map { height: min(70vh, 640px); min-height: 380px; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); background: var(--sunk); z-index: 0; }
.map-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 12px; }
.map-tools input { width: 6.5em; }
.map-list { margin: 6px 0 0; padding-left: 1.1em; }
.map-list li { margin: 2px 0; }
.leaflet-popup-content p { margin: 6px 0 0; }

/* «Цього дня» на главной: одна открытка с цитатой */
.this-day { margin: 8px 0 36px; }
.this-day .letter-card { max-width: 640px; }

/* Редактор открытки: слева закреплённый просмотр выбранного фото, редкие действия свёрнуты в «Фото и действия».
   Высоту .pv скрипт подгоняет под окно (edit.js), чтобы фото было видно целиком при любой прокрутке. */
.pv { position: sticky; top: 64px; height: calc(100svh - 78px); min-height: 380px; display: flex; flex-direction: column; gap: 10px; }
.pv-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; border-radius: 18px; background: var(--sunk); cursor: zoom-in; }
.pv-stage.zoomed { cursor: grab; touch-action: none; }
.pv-stage.zoomed:active { cursor: grabbing; }
.pv-img { display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.pv-reset { position: absolute; right: 10px; bottom: 10px; min-height: 32px; padding: 0 12px; border-radius: var(--pill); font-size: .85rem; background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); }
.pv-reset[hidden] { display: none; }
.pv-strip { flex: none; display: flex; gap: 8px; overflow-x: auto; padding: 2px; }
.pv-thumb { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 0; padding: 4px 6px; border: 2px solid transparent; border-radius: 10px; background: var(--surface); font-size: .78rem; color: var(--muted); }
.pv-thumb img { display: block; height: 52px; width: auto; max-width: 96px; object-fit: contain; border-radius: 4px; }
.pv-thumb[aria-current] { border-color: var(--accent); color: var(--ink); }
.pv-controls { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.pv-controls[hidden] { display: none; }
.pv-tools { flex: none; }
.pv-tools > summary { cursor: pointer; color: var(--muted); width: max-content; padding: 2px 0; }
.pv-tools[open] { flex: 1; min-height: 0; overflow-y: auto; padding-right: 6px; }
.pv-tools[open] > summary { margin-bottom: 12px; color: var(--ink); }
.pv:has(.pv-tools[open]) .pv-stage, .pv:has(.pv-tools[open]) .pv-controls:not([hidden]) { display: none; }
.pv-tools .photo-card { grid-template-columns: 120px 1fr; box-shadow: none; border: 1px solid var(--line); border-radius: 14px; }
.edit-status { display: inline-flex; align-items: center; gap: 12px; margin: 0 0 0 auto; }
@media (max-width: 900px) {
  .pv { position: static; height: auto !important; min-height: 0; }
  .pv-stage { flex: none; height: 62svh; }
  .pv-tools[open] { overflow: visible; }
  .pv:has(.pv-tools[open]) .pv-stage { display: block; }
  .pv:has(.pv-tools[open]) .pv-controls:not([hidden]) { display: flex; }
}

/* ───── Почтовые формы элементов управления (шаг 1: кнопки и статусы) ─────
   У каждой формы одна роль: марка с зубцами — главное действие; телеграфная лента — обычные кнопки;
   сургуч — кнопки-иконки; оттиск штампа — состояние. Особые кнопки (чипы, переключатели, миниатюры) пока прежние.
   Форма вырезается по самой кнопке (clip-path / mask), поэтому фокус рисуется внутри, а не снаружи. */
:root { --tape: #ecdfc6; --tape-hover: #e4d4b6; --type: "PT Mono", "Courier New", ui-monospace, monospace; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tape: #3a3025; --tape-hover: #463a2c; } }
:root[data-theme="dark"] { --tape: #3a3025; --tape-hover: #463a2c; }

:is(button:not([class]), button.primary, button.danger, button.wide, button.cancel, button.dark, button.small, .button):not(.linklike, .round, .chip):not(:where(.card-size, .sort-switch, .role-pills, .menu-items, .photo-actions-row, .gx, .pager, .thumbs, .pv-strip, .tag-editor, .acct) *) {
  border: 0; border-radius: 0; box-shadow: none; padding: 0 1.6em;
  font-family: var(--type); font-size: .84rem; font-weight: 400; letter-spacing: .07em; text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 12.5%, 100% 25%, calc(100% - 6px) 37.5%, 100% 50%, calc(100% - 6px) 62.5%, 100% 75%, calc(100% - 6px) 87.5%, 100% 100%, 0 100%, 6px 87.5%, 0 75%, 6px 62.5%, 0 50%, 6px 37.5%, 0 25%, 6px 12.5%);
}
:is(button:not([class]), button.danger, button.wide, button.cancel, button.small, .button):not(.primary, .dark, .linklike, .round, .chip):not(:where(.card-size, .sort-switch, .role-pills, .menu-items, .photo-actions-row, .gx, .pager, .thumbs, .pv-strip, .tag-editor, .acct) *) { background: var(--tape); }
:is(button:not([class]), button.danger, button.wide, button.cancel, button.small, .button):not(.primary, .dark, .linklike, .round, .chip):not(:where(.card-size, .sort-switch, .role-pills, .menu-items, .photo-actions-row, .gx, .pager, .thumbs, .pv-strip, .tag-editor, .acct) *):hover { background: var(--tape-hover); color: var(--ink); box-shadow: none; }
:is(button:not([class]), button.primary, button.danger, button.wide, button.cancel, button.dark, button.small, .button):not(.linklike, .round, .chip):not(:where(.card-size, .sort-switch, .role-pills, .menu-items, .photo-actions-row, .gx, .pager, .thumbs, .pv-strip, .tag-editor, .acct) *):focus-visible { outline: 0; box-shadow: inset 0 0 0 2px var(--focus), inset 0 0 0 4px var(--surface); }
:is(button:not([class]), button.danger, button.wide, button.small):disabled { background: none; color: var(--faint); box-shadow: inset 0 0 0 1px var(--line-strong); }
button.danger:not(.primary) { color: var(--bad); }

/* главное действие — марка: зубцы по краю, тонкая рамка внутри */
:is(button.primary, .button.primary):not(.linklike, .round, .chip):not(:where(.menu-items, .gx) *) {
  --perf: 9px; clip-path: none; min-height: 48px; padding: 0 1.7em;
  font-family: var(--display); font-size: 1rem; font-weight: 600; letter-spacing: 0; text-transform: none;
  -webkit-mask: radial-gradient(circle at center, #0000 2.6px, #000 3.1px) calc(var(--perf) / -2) calc(var(--perf) / -2) / var(--perf) var(--perf) round, linear-gradient(#000 0 0) center / calc(100% - var(--perf)) calc(100% - var(--perf)) no-repeat;
  mask: radial-gradient(circle at center, #0000 2.6px, #000 3.1px) calc(var(--perf) / -2) calc(var(--perf) / -2) / var(--perf) var(--perf) round, linear-gradient(#000 0 0) center / calc(100% - var(--perf)) calc(100% - var(--perf)) no-repeat;
  outline: 1px solid color-mix(in srgb, currentColor 55%, transparent); outline-offset: -8px;
}
:is(button.primary, .button.primary):not(.linklike, .round, .chip):not(:where(.menu-items, .gx) *):hover { box-shadow: none; transform: translateY(-1px) rotate(-.6deg); }
:is(button.primary, .button.primary):not(.linklike, .round, .chip):not(:where(.menu-items, .gx) *):active { transform: translateY(1px); filter: brightness(.92); }
:is(button.primary, .button.primary):not(.linklike, .round, .chip):not(:where(.menu-items, .gx) *):focus-visible { outline: 2px solid currentColor; outline-offset: -9px; box-shadow: none; }

/* кнопки-иконки — сургуч: края неровные, у соседних печатей разные */
.photo-actions .round { border: 0; background: var(--warm); color: #fff; border-radius: 58% 42% 55% 45% / 46% 57% 43% 54%; box-shadow: inset 0 0 0 3px color-mix(in srgb, #000 10%, transparent); }
.photo-actions .round:nth-of-type(2n) { border-radius: 44% 56% 47% 53% / 57% 45% 55% 43%; }
.photo-actions .round:nth-of-type(3n) { border-radius: 52% 48% 60% 40% / 43% 52% 48% 57%; }
.photo-actions .round:hover { color: #fff; border: 0; transform: rotate(-6deg) scale(1.05); box-shadow: inset 0 0 0 3px color-mix(in srgb, #000 16%, transparent); }
.photo-actions .round:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* состояния — оттиск штампа: двойная рамка, неровный край (фильтр #ink-rough в base.html) */
.badge, .badge.warn, .badge.status-approved, .badge.status-rejected {
  background: none; border: 3px double currentColor; border-radius: 2px; min-height: 0; padding: 2px 9px;
  font-family: var(--display); font-size: .72rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
  transform: rotate(-2deg); filter: url(#ink-rough);
}
.badge { color: var(--muted); }

/* ───── Почтовые формы, шаг 2: ярлыки, картотека, чернила ───── */
:root {
  --tag-shape: polygon(13px 0, 100% 0, 100% 100%, 13px 100%, 0 50%);
  --tab-shape: polygon(9px 0, calc(100% - 9px) 0, 100% 100%, 0 100%);
  --torn-shape: polygon(0 0, 100% 0, calc(100% - 6px) 12.5%, 100% 25%, calc(100% - 6px) 37.5%, 100% 50%, calc(100% - 6px) 62.5%, 100% 75%, calc(100% - 6px) 87.5%, 100% 100%, 0 100%, 6px 87.5%, 0 75%, 6px 62.5%, 0 50%, 6px 37.5%, 0 25%, 6px 12.5%);
  --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 20'%3E%3Cpath d='M3 10 L8 16 L19 3' fill='none' stroke='%232c4a9a' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --scribble: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 10'%3E%3Cpath d='M2 6 C9 2,15 9,22 4 S30 6,32 3' fill='none' stroke='%23b4442f' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  --waves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 16'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.6'%3E%3Cpath d='M0 3 q5 -4 10 0 t10 0'/%3E%3Cpath d='M0 8 q5 -4 10 0 t10 0'/%3E%3Cpath d='M0 13 q5 -4 10 0 t10 0'/%3E%3C/g%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 20'%3E%3Cpath d='M3 10 L8 16 L19 3' fill='none' stroke='%239db4f0' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --scribble: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 10'%3E%3Cpath d='M2 6 C9 2,15 9,22 4 S30 6,32 3' fill='none' stroke='%23e38a78' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
} }
:root[data-theme="dark"] {
  --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 20'%3E%3Cpath d='M3 10 L8 16 L19 3' fill='none' stroke='%239db4f0' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --scribble: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 10'%3E%3Cpath d='M2 6 C9 2,15 9,22 4 S30 6,32 3' fill='none' stroke='%23e38a78' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* фильтры, теги и выбор стороны — ярлыки: острый край с прорезью слева; выбранный залит чернилами */
.chip:not(.sort-dir), .facet-chip, .filters-open, .role-pills button {
  position: relative; border: 0; border-radius: 0; background: var(--tape); box-shadow: none; clip-path: var(--tag-shape); padding-left: 27px;
}
.chip:not(.sort-dir)::before, .facet-chip::before, .filters-open::before, .role-pills button::before {
  content: ""; position: absolute; left: 12px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; background: var(--bg); transform: rotate(45deg);
}
.chip:not(.sort-dir):hover, .facet-chip:hover, .filters-open:hover, .role-pills button:hover { background: var(--tape-hover); color: var(--ink); transform: translateX(2px); box-shadow: none; }
.chip.on:not(.sort-dir), .chip.removable, .role-pills button[aria-pressed=true], .chip.on:not(.sort-dir):hover, .chip.removable:hover, .role-pills button[aria-pressed=true]:hover { background: var(--ink); color: var(--bg); }
.chip.ghost:not(.sort-dir), .facet-chip.on, .facet-chip.on:hover { background: var(--accent-soft); color: var(--accent); }
.facet-chip[aria-expanded=true] { background: var(--tape-hover); }
.chip:not(.sort-dir):focus-visible, .facet-chip:focus-visible, .filters-open:focus-visible, .role-pills button:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px var(--focus); }
.chip-clear { border: 0; border-radius: 0; }
.chip .count:not(:empty), .chip.removable span { border-radius: 2px; }

/* разделы — карточки-разделители картотеки */
@media (min-width: 900px) { .top nav a { border-radius: 0; clip-path: var(--tab-shape); padding: 0 18px; } }
.subnav { border-radius: 4px; }
.subnav a { border-radius: 0; clip-path: var(--tab-shape); padding: 0 20px; }
.subnav a .n { border-radius: 2px; }
.mod-layout .subnav a { clip-path: none; padding: 0 12px; }

/* галочка — клетка с росчерком от руки */
input[type=checkbox] {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; min-height: 0; padding: 0; flex: none; vertical-align: middle; cursor: pointer;
  border: 1.5px solid var(--muted); border-radius: 2px; background: var(--surface) center / 18px 16px no-repeat;
}
input[type=checkbox]:checked { background-image: var(--tick); border-color: var(--ink); }
input[type=checkbox]:disabled { opacity: .5; cursor: default; }

/* страницы — цифры от руки, текущая подчёркнута чернилами; «дальше/назад» — лента */
.pager.pages a, .pager.pages span { border: 0; border-radius: 0; background: none; box-shadow: none; font-family: var(--hand); font-size: 1.6rem; }
.pager.pages a:hover { color: var(--accent); }
.pager.pages .cur { color: var(--ink); background: var(--scribble) center bottom 5px / 34px 10px no-repeat; }
.pager:not(.pages) a { border: 0; border-radius: 0; background: var(--tape); clip-path: var(--torn-shape); padding: 0 1.6em; font-family: var(--type); font-size: .84rem; letter-spacing: .07em; text-transform: uppercase; }
.pager:not(.pages) a:hover { background: var(--tape-hover); }

/* отметки коллекционера — цветной сургуч; подсказка — ценник */
.icon-toggle { border-radius: 62% 38% 54% 46% / 44% 60% 40% 56%; }
.icon-toggle.kind-want { border-radius: 42% 58% 46% 54% / 60% 43% 57% 40%; }
.icon-toggle.kind-trade { border-radius: 53% 47% 63% 37% / 41% 54% 46% 59%; }
.icon-toggle.kind-favorite { border-radius: 39% 61% 52% 48% / 56% 41% 59% 44%; }
.icon-toggle.on { background: var(--tone); border-color: transparent; color: #fff; box-shadow: inset 0 0 0 3px color-mix(in srgb, #000 12%, transparent); }
.icon-toggle.on:hover { color: #fff; border-color: transparent; }
.icon-toggle[data-tip]:hover::after, .icon-toggle[data-tip]:focus-visible::after { border-radius: 2px; background: var(--ink); color: var(--bg); font-family: var(--type); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }

.search input { border-radius: 4px; }

/* ───── Почтовые формы, шаг 3: телеграммы, авиакайма, штампы, гашение ───── */
.messages { filter: drop-shadow(0 10px 18px rgba(20, 25, 40, .28)); }
.messages li, .messages li.success, .messages li.error {
  border-radius: 0; background: var(--tape); color: var(--ink); box-shadow: none; padding: 13px 28px; clip-path: var(--torn-shape);
  font-family: var(--type); font-size: .86rem; letter-spacing: .05em; text-transform: uppercase;
}
.messages li.error { color: var(--bad); }
.notice { border-radius: 0; border-width: 3px 0 0; border-style: double; }
.modal-body, dialog.send-dialog { border-radius: 6px; border-top: 7px solid transparent; border-image: repeating-linear-gradient(135deg, var(--warm) 0 12px, transparent 12px 20px, var(--accent) 20px 32px, transparent 32px 40px) 7; }
.empty h3 {
  display: inline-block; margin: 0 0 1em; padding: 6px 16px; border: 3px double currentColor; color: var(--warm);
  font-family: var(--display); font-size: .95rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  transform: rotate(-4deg); filter: url(#ink-rough);
}
.spinner { width: 30px; height: 16px; border: 0; border-radius: 0; background: var(--ink); -webkit-mask: var(--waves) 0 0 / 20px 16px repeat-x; mask: var(--waves) 0 0 / 20px 16px repeat-x; }
.search.compact .spinner { width: 24px; height: 14px; }
.loading .spinner { animation: gash .6s linear infinite; }
@keyframes gash { to { -webkit-mask-position: -20px 0; mask-position: -20px 0; } }
.filters-open, .filters-open:hover { color: var(--ink); }
/* сдвоенные переключатели каталога — без «таблеток» */
.card-size, .sort-switch { border-radius: 3px; }
.results-head select { border-radius: 3px 0 0 3px; }
.chip.sort-dir { border-radius: 0 3px 3px 0; }

/* Тихая полоса на главной: один ряд из трёх спокойных ячеек — свежая почта, строчка с оборота, художник недели */
.quiet-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: 4px 0 28px; border-block: 1px solid var(--line); }
.qs-cell { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-height: 132px; padding: 14px 20px; color: var(--ink); text-decoration: none; transition: background .2s; }
.qs-cell + .qs-cell { border-left: 1px solid var(--line); }
.qs-cell:hover { background: color-mix(in srgb, var(--sunk) 55%, transparent); }
.qs-kicker { font-family: var(--type); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.qs-thumbs { display: flex; gap: 8px; align-items: flex-end; height: 58px; }
.qs-thumbs img { height: 100%; width: auto; max-width: 96px; object-fit: contain; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); }
.qs-line { font-size: .92rem; color: var(--muted); }
.qs-line strong { color: var(--ink); font-weight: 600; }
.qs-quote .hand { font-family: var(--hand); font-size: 1.45rem; line-height: 1.15; color: var(--accent); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
@media (max-width: 760px) {
  .quiet-strip { grid-auto-columns: 82%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-inline: -20px; padding-inline: 20px; }
  .qs-cell { scroll-snap-align: start; padding-inline: 16px; }
}

/* Страница открытки: художник, издательство и год — отдельными подписанными строками, а не одной строкой через точки */
.info dl.byline { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: 6px 16px; margin: 8px 0 10px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; font-size: 1.05rem; line-height: 1.4; }
.info dl.byline > div { display: contents; }
.info dl.byline dt { font-family: var(--type); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0; border: 0; }
.info dl.byline dd { display: block; margin: 0; padding: 0; border: 0; }  /* block: соавторы идут в одну строку через запятую */

/* Списки художников и издательств по имени: буквы-разделители и строка быстрых переходов */
/* Указатель по буквам — стопка разделителей картотеки слева: всегда на экране, текущая буква выдвинута и залита чернилами */
.az-layout { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 22px; align-items: start; }
.letter-nav { position: sticky; top: 66px; display: flex; flex-direction: column; gap: 2px; height: calc(100svh - 82px); max-height: 900px; padding-right: 6px; border-right: 2px solid var(--line-strong); }
.letter-nav a {
  flex: 1 1 0; min-height: 15px; max-height: 36px; display: grid; align-items: center; justify-items: start; padding-left: 17px; text-decoration: none;
  font-family: var(--display); font-weight: 600; font-size: 1rem; line-height: 1; color: var(--ink); background: var(--tape);
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--ink) 16%, transparent);  /* нижняя кромка: язычки лежат стопкой */
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 0 100%); transition: transform .2s var(--ease-out), background .2s, color .2s;
}
.letter-nav a:nth-child(3n+2) { margin-left: 8px; }   /* язычки стоят уступами, как в ящике картотеки */
.letter-nav a:nth-child(3n) { margin-left: 16px; }
.letter-nav a:hover { background: var(--tape-hover); color: var(--accent); transform: translateX(-3px); }
.letter-nav a[aria-current], .letter-nav a[aria-current]:hover { background: var(--ink); color: var(--bg); margin-left: 0; transform: translateX(-4px); }
@media (max-width: 760px) {
  .az-layout { display: block; }
  .letter-nav { top: 52px; z-index: 3; flex-direction: row; height: auto; gap: 3px; margin: 0 -20px 14px; padding: 8px 20px 0; border-right: 0; border-bottom: 2px solid var(--line-strong); background: var(--bg); overflow-x: auto; scrollbar-width: none; }
  .letter-nav a, .letter-nav a:nth-child(n) { flex: none; min-width: 34px; min-height: 36px; max-height: none; margin: 0; padding: 0 8px; justify-items: center; box-shadow: none; clip-path: var(--tab-shape); transform: none; }
}
.entries li.az-head { grid-column: 1 / -1; margin: 14px 0 0; padding-bottom: 4px; border-bottom: 3px double var(--line-strong); font-family: var(--display); font-size: 1.7rem; font-weight: 600; line-height: 1; scroll-margin-top: 90px; }
.entries li.az-head:first-child { margin-top: 0; }

/* Год на странице открытки — маленькая марка: зубцы, рамка, цифры как номинал. Нажатие открывает каталог за этот год.
   Красная, как на образце от жены; синяя марка на странице одна — главное действие «Надіслати». */
.year-stamp {
  --perf: 8px; display: inline-flex; align-items: center; width: fit-content; min-height: 42px; padding: 0 1.2em; text-decoration: none;
  background: var(--warm); color: #fff; font-family: var(--display); font-size: 1.25rem; font-weight: 600; letter-spacing: .04em; font-variant-numeric: lining-nums;
  -webkit-mask: radial-gradient(circle at center, #0000 2.3px, #000 2.8px) calc(var(--perf) / -2) calc(var(--perf) / -2) / var(--perf) var(--perf) round, linear-gradient(#000 0 0) center / calc(100% - var(--perf)) calc(100% - var(--perf)) no-repeat;
  mask: radial-gradient(circle at center, #0000 2.3px, #000 2.8px) calc(var(--perf) / -2) calc(var(--perf) / -2) / var(--perf) var(--perf) round, linear-gradient(#000 0 0) center / calc(100% - var(--perf)) calc(100% - var(--perf)) no-repeat;
  outline: 1px solid rgba(255, 255, 255, .6); outline-offset: -7px; transition: transform .2s ease, filter .2s;
}
.year-stamp:hover { color: #fff; transform: rotate(-2deg) translateY(-1px); filter: brightness(1.08); }
.year-stamp:focus-visible { outline: 2px solid #fff; outline-offset: -8px; }
.info dl.byline dd { justify-self: start; }

/* Спокойный режим (html.lite): включается сам, если переход между страницами дважды подряд шёл рывками (site.js),
   или вручную ссылкой в подвале. Лучше без анимации, чем с дёрганой: убираем всё, что нагружает слабый компьютер. */
html.lite .grid > .card.enter, html.lite .grid > .card.later, html.lite .grid > .card.later.reveal { animation: none; opacity: 1; }
html.lite .hero-stack, html.lite .tile, html.lite .entries li a { animation: none; }  /* страницу поздравления не трогаем: там анимация и есть содержание */
html.lite .card .photo, html.lite .entries li a, html.lite .tile, html.lite .stack-card { transition: none; }
html.lite .photos figure.main::before { display: none; }
html.lite .top, html.lite .top .logo, html.lite .brand, html.lite .brand-sub { transition: none; }
.no-artist { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 18px; }

/* Страница «Про колекцію і права»: спокойный текст, как письмо */
.about-page h2 { font-size: 1.2rem; margin: 1.6em 0 .4em; }
.about-page p { line-height: 1.6; max-width: 62ch; }
.rights-note { margin: 6px 0 0; }

/* Списки художников и издательств: длинное название — не больше двух строк (полное видно при наведении), карточки в ряду одной высоты */
.entries > li:not(.az-head) { display: flex; }
.entries > li:not(.az-head) > a { flex: 1; min-width: 0; }
.entry-text { min-width: 0; }
.entry-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }

/* «На странице: 50 100 150» — цифры от руки, как номера страниц; выбранное подчёркнуто чернилами */
.per-page { gap: 4px; }
.per-page > span { margin-right: 6px; }
.per-page label { margin: 0; cursor: pointer; }
.per-page input { position: absolute; opacity: 0; pointer-events: none; }
.per-page label span { display: inline-grid; place-items: center; min-width: var(--tap); min-height: var(--tap); padding: 0 .4em; font-family: var(--hand); font-size: 1.6rem; color: var(--muted); }
.per-page label:hover span { color: var(--accent); }
.per-page input:checked + span { color: var(--ink); background: var(--scribble) center bottom 5px / 34px 10px no-repeat; }
.per-page input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -4px; }

/* ───── Почтовые формы, шаг 4: оставшиеся «таблетки» и кружки ───── */
/* сортировка, вид сетки — сдвоенные планки с прямыми углами */
.results-head .sorting, .card-size, .sort-switch { border-radius: 3px; }
/* «Серії» — ярлык, как фильтры */
.series-toggle { position: relative; border: 0; border-radius: 0; background: var(--tape); clip-path: var(--tag-shape); padding-left: 27px; }
.series-toggle::before { content: ""; position: absolute; left: 12px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; background: var(--bg); transform: rotate(45deg); }
.series-toggle:hover { background: var(--tape-hover); color: var(--ink); }
.series-toggle[aria-pressed=true], .series-toggle[aria-pressed=true]:hover { background: var(--ink); color: var(--bg); }
/* подписи-кнопки поверх фото — кусочки телеграфной ленты */
.photos .fullscreen, .photos .flip { border-radius: 0; box-shadow: none; background: var(--tape); clip-path: var(--torn-shape); padding: 0 16px; font-family: var(--type); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.photos .flip:hover { background: var(--tape-hover); color: var(--ink); transform: none; box-shadow: none; }
/* стрелки листания фото — бумажные язычки по краям */
.photo-nav { border: 0; border-radius: 0; width: 34px; height: 56px; background: var(--tape); color: var(--ink); box-shadow: none; }
.photo-nav.prev { left: 0; clip-path: polygon(0 0, 100% 8px, 100% calc(100% - 8px), 0 100%); }
.photo-nav.next { right: 0; clip-path: polygon(0 8px, 100% 0, 100% 100%, 0 calc(100% - 8px)); }
.photo-nav:hover { background: var(--tape-hover); color: var(--accent); transform: none; box-shadow: none; }
/* «Увійдіть, щоб надіслати» — лента */
.send-login { border: 0; border-radius: 0; background: var(--tape); clip-path: var(--torn-shape); padding: 0 1.6em; font-family: var(--type); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
.send-login:hover { background: var(--tape-hover); }
/* переключатель темы — тёмный сургуч */
.theme-toggle { border: 0; border-radius: 58% 42% 55% 45% / 46% 57% 43% 54%; background: var(--night); color: #fff; box-shadow: inset 0 0 0 3px color-mix(in srgb, #000 14%, transparent); }
.theme-toggle:hover { color: #fff; border: 0; transform: rotate(-8deg); box-shadow: inset 0 0 0 3px color-mix(in srgb, #000 22%, transparent); }
@media (max-width: 899px) { .top nav a, .top nav a[aria-current=page] { border-radius: 3px; } }

/* Страница открытки: фото лежит на странице альбома — прямые углы и фотоуголки по углам листа */
.photos figure.main { border-radius: 4px; }
.photos figure.main::after {
  content: ""; position: absolute; inset: 8px; pointer-events: none; z-index: 1; --c: color-mix(in srgb, var(--ink) 78%, transparent);
  background: linear-gradient(135deg, var(--c) 50%, transparent 50%) 0 0 / 22px 22px no-repeat, linear-gradient(-135deg, var(--c) 50%, transparent 50%) 100% 0 / 22px 22px no-repeat,
              linear-gradient(45deg, var(--c) 50%, transparent 50%) 0 100% / 22px 22px no-repeat, linear-gradient(-45deg, var(--c) 50%, transparent 50%) 100% 100% / 22px 22px no-repeat;
}
.photos figure.main img { border-radius: 2px; }
.thumbs .thumb { border-radius: 3px; }
/* «Схожі листівки»: край ряда тает — видно, что его можно листать */
.similar .grid.small { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }

/* мелочи: служебные подписи пишущей машинкой чуть крупнее; год-марка скромнее главной кнопки */
.info dl.byline dt, .qs-kicker { font-size: .78rem; }
.year-stamp { --perf: 7px; min-height: 34px; padding: 0 1em; font-size: 1.05rem; }
/* каталог: под фото, пока оно грузится, бумага, а не пустота */
.card .photo { background: var(--tape); }

/* Нижняя панель на телефоне: четыре главных раздела язычками картотеки. На компьютере её нет. */
.dock { display: none; }
@media (max-width: 760px) {
  body:not(.gx) { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  body:not(.gx) .dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line-strong);
  }
  .dock a { display: grid; place-items: center; min-height: 44px; padding: 0 4px; text-align: center; text-decoration: none; color: var(--ink);
    font-family: var(--type); font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; background: var(--tape); clip-path: var(--tab-shape); }
  .dock a[aria-current=page] { background: var(--ink); color: var(--bg); }
  /* всё, что прилипало к низу экрана, встаёт над панелью */
  body:not(.gx) .form-bar, body:not(.gx) .review-foot { bottom: calc(58px + env(safe-area-inset-bottom)); }
  body:not(.gx) .messages { bottom: calc(70px + env(safe-area-inset-bottom)); }
  body.filters-shown .dock { display: none; }
}

/* Редактор: сторона фото выбирается под его миниатюрой (один способ); для пары «лицо + оборот» — кнопка обмена */
.pv-strip { overflow: visible; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
.pv-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pv-thumb { padding: 4px; }
.pv-role select, .pv-role-text { min-height: 28px; height: 28px; padding: 0 22px 0 8px; font-size: .8rem; border-radius: 3px; border: 1px solid var(--line-strong); background-color: var(--tape); max-width: 132px; }
.pv-role-text { display: inline-flex; align-items: center; padding: 0 8px; color: var(--muted); border: 0; background: none; }
.pv-role { margin: 0; }
.pv-swap { margin: 0 0 0 6px; align-self: center; }
.pv-swap button { min-height: 36px; padding: 0 1.4em; border: 0; border-radius: 0; background: var(--tape); box-shadow: none; clip-path: var(--torn-shape); font-family: var(--type); font-size: .74rem; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; }
.pv-swap button:hover { background: var(--tape-hover); color: var(--ink); transform: none; box-shadow: none; }

/* Модерация: меню раздела теперь сверху, как везде; в рамке остаются очередь и разбор выбранного */
.mod-layout { grid-template-columns: 360px minmax(0, 1fr); height: calc(100vh - 76px - 48px - 76px); }
@media (max-width: 1100px) { .mod-layout { grid-template-columns: minmax(0, 1fr); height: auto; } }
/* меню раздела: с числами пункты шире — делаем их компактнее, чтобы строка не переносилась */
.subnav a { padding: 0 15px; font-size: .92em; }
.mod-layout { height: calc(100vh - 76px - 48px - 76px - 64px); }
@media (max-width: 1100px) { .mod-layout { height: auto; } }
