:root {
  --ink: #23201e;
  --ink-soft: #6d635c;
  --paper: #fbf8f4;
  --accent: #9c6d56;
  --accent-deep: #6f4a38;
  --line: #e6dcd2;
  --shadow: 0 18px 46px rgba(70, 54, 42, .13);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(168deg, #f3ece4 0%, #e6dacd 55%, #dccdbe 100%);
  background-attachment: fixed;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-deep); }

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px max(4vw, 18px);
  background: rgba(255, 253, 250, .86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand { display: inline-flex; align-items: center; text-decoration: none; }
.logo { max-width: 168px; max-height: 46px; display: block; }
.logo[hidden] { display: none; }
.wordmark { font-weight: 800; letter-spacing: .22em; font-size: 19px; color: var(--ink); }

.contacts { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #f0e7de;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid #e5d9cd;
  transition: transform .12s ease, background .12s ease;
}
.chip:hover { background: #e8dbcf; transform: translateY(-1px); }
.chip-muted { opacity: .45; pointer-events: none; }

main { width: min(1180px, 92vw); margin: 30px auto 60px; }

.foot {
  text-align: center;
  color: #8b7f76;
  font-size: 13px;
  padding: 0 0 34px;
}

/* ---------- blocks ---------- */
.card {
  background: rgba(255, 253, 250, .94);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--radius);
  padding: 24px clamp(16px, 3vw, 30px);
  box-shadow: var(--shadow);
  margin: 18px 0;
}

.card > h1, .card > h2 { margin-top: 0; }
h1 { font-size: clamp(24px, 3.2vw, 34px); letter-spacing: -.02em; }
h2 { font-size: 21px; letter-spacing: -.01em; }
.muted { color: var(--ink-soft); font-size: .92em; }

.hero {
  position: relative;
  overflow: hidden;
  min-height: clamp(180px, 26vw, 300px);
  display: flex;
  align-items: flex-end;
  padding: 0;
  background-size: cover;
  background-position: center;
  border: 0;
}
.hero:before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(28, 22, 18, .05) 30%, rgba(28, 22, 18, .78) 100%);
}
.hero-body { position: relative; padding: clamp(18px, 3vw, 32px); width: 100%; }
.hero h1 { color: #fff; margin: 0; text-shadow: 0 2px 18px rgba(0, 0, 0, .35); }
.hero .hero-sub { color: rgba(255, 255, 255, .84); margin: 6px 0 0; font-size: 15px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.spacer { flex: 1 1 auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

/* ---------- controls ---------- */
button, .button {
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .12s ease, opacity .12s ease;
}
button:hover, .button:hover { transform: translateY(-1px); opacity: .93; }
button:disabled { opacity: .45; cursor: default; transform: none; }
.button-ghost { background: #efe6dd; color: var(--ink); border: 1px solid #e2d5c9; }
.button-sm { padding: 7px 14px; font-size: 14px; }
.danger { background: #96382f; }

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  margin: 5px 0 14px;
}
input[type=checkbox] { width: auto; margin: 0 6px 0 0; }
label { font-weight: 650; font-size: 14px; }

.flash {
  padding: 13px 16px;
  background: #fff3d4;
  border: 1px solid #f0dfae;
  border-radius: 14px;
  margin: 0 0 16px;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }

details summary { cursor: pointer; padding: 4px 0; }
details[open] summary { margin-bottom: 8px; }

/* ---------- breadcrumbs / toolbar ---------- */
.crumbs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 14px; color: var(--ink-soft); }
.crumbs a { text-decoration: none; font-weight: 600; }
.crumbs span.sep { opacity: .5; }

/* ---------- gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin: 4px 0 0;
}

.tile {
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform .14s ease, box-shadow .14s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(70, 54, 42, .17); }

.tile-art {
  all: unset;
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f2ece5;
  cursor: pointer;
  overflow: hidden;
}
.tile-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-art.is-static { cursor: default; }

.badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .08em;
  color: var(--accent-deep);
  background: linear-gradient(150deg, #f7f1ea, #e9ded2);
}
.badge small { display: block; font-size: 26px; line-height: 1; margin-bottom: 6px; letter-spacing: 0; }
.badge-inner { text-align: center; }

.tile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #f0e9e2;
  min-height: 46px;
}
.tile-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-sub { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.tile-act {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f2ebe4;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  border: 0;
  padding: 0;
}
.tile-act:hover { background: #e6d9cc; }
.act-form { display: contents; }

.empty { color: var(--ink-soft); padding: 22px 4px; text-align: center; }

/* ---------- dropzone ---------- */
.dropzone {
  margin-top: 18px;
  border: 2px dashed #d8c8ba;
  border-radius: 16px;
  background: #fdfaf6;
  padding: 22px;
  text-align: center;
  transition: background .12s ease, border-color .12s ease;
}
.dropzone.is-over { background: #f6ece2; border-color: var(--accent); }
.dropzone p { margin: 0 0 12px; color: var(--ink-soft); font-size: 14.5px; }
.dropzone input[type=file] { display: none; }
.dz-hint { font-size: 13px; color: #9a8d84; margin-top: 10px; }

.uploads { list-style: none; padding: 0; margin: 14px 0 0; text-align: left; }
.uploads li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; padding: 5px 0; }
.uploads .u-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads .u-bar { flex: 0 0 110px; height: 6px; border-radius: 99px; background: #ece2d9; overflow: hidden; }
.uploads .u-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .18s ease; }
.uploads .u-state { flex: 0 0 auto; font-size: 12px; color: var(--ink-soft); min-width: 62px; text-align: right; }
.uploads .ok .u-state { color: #3f7a48; }
.uploads .err .u-state { color: #a03a2f; }

/* ---------- lightbox ---------- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: rgba(24, 19, 16, .93);
  backdrop-filter: blur(6px);
}
.lb[hidden] { display: none; }
.lb-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  color: #fff;
}
.lb-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-count { font-size: 13px; opacity: .7; }
.lb-btn {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
}
.lb-btn:hover { background: rgba(255, 255, 255, .2); }
.lb-stage { flex: 1 1 auto; position: relative; display: flex; align-items: center; justify-content: center; padding: 0 12px 18px; }
.lb-stage img { max-width: min(96vw, 1500px); max-height: calc(100vh - 130px); object-fit: contain; border-radius: 10px; box-shadow: 0 30px 70px rgba(0, 0, 0, .5); }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.lb-nav:hover { background: rgba(255, 255, 255, .26); }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-nav[hidden] { display: none; }
.lb-strip { display: flex; gap: 8px; overflow-x: auto; padding: 0 18px 16px; }
.lb-strip[hidden] { display: none; }
.lb-strip img { height: 58px; width: 58px; object-fit: cover; border-radius: 8px; opacity: .5; cursor: pointer; flex: 0 0 auto; }
.lb-strip img.active { opacity: 1; outline: 2px solid #fff; }

@media (max-width: 640px) {
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .tile-sub { display: none; }  /* на узком экране имя важнее размера */
  .card { padding: 18px 15px; }
  .lb-nav { width: 42px; height: 42px; }
}
