/* Gallery 500 — тёмный музейный зал, картина в центре внимания */
:root {
  --bg: #141517;
  --panel: #1d1f22;
  --line: #2c2e33;
  --text: #e9e5db;
  --muted: #a29c8f;
  --dim: #6d685e;
  --accent: #b98f3e;
  --accent-soft: #8a6c33;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */
header {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.logo {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: .04em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.logo b { color: var(--accent); font-weight: 400; }
nav { display: flex; gap: 18px; flex-wrap: wrap; margin-left: auto; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14.5px;
  letter-spacing: .03em;
  padding: 4px 2px;
  border-bottom: 1px solid transparent;
}
nav a:hover, nav a:focus-visible { color: var(--text); }
nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.lang-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font: 13px var(--sans);
  padding: 5px 10px;
  cursor: pointer;
  letter-spacing: .06em;
}
.lang-toggle:hover { color: var(--text); border-color: var(--dim); }

/* ---------- viewer (index) ---------- */
.viewer { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 22px 28px 40px; }
.stage {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40vh;
}
.stage img {
  max-width: 100%;
  max-height: 74vh;
  box-shadow: 0 12px 60px rgba(0,0,0,.55);
  opacity: 0;
  transition: opacity .6s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.stage img.shown { opacity: 1; }
.stage .shield { position: absolute; inset: 0; } /* глушит long-press/drag поверх картины */
.next-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(29,31,34,.85);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  z-index: 2;
}
.next-btn:hover, .next-btn:focus-visible { border-color: var(--accent); color: var(--accent); }
.caption { max-width: 860px; width: 100%; margin-top: 26px; }
.caption h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.3;
  text-wrap: balance;
}
.caption h1 .artist { color: var(--accent); }
.caption .meta { color: var(--dim); font-size: 13.5px; margin-top: 6px; letter-spacing: .04em; }
.caption .desc { color: var(--muted); font-size: 14.5px; margin-top: 16px; max-width: 72ch; }
.caption details { margin-top: 14px; max-width: 72ch; }
.caption summary {
  cursor: pointer;
  color: var(--accent-soft);
  font-size: 14px;
  letter-spacing: .03em;
  list-style: none;
}
.caption summary::before { content: "▸ "; }
.caption details[open] summary::before { content: "▾ "; }
.caption summary:hover { color: var(--accent); }
.caption .bio { color: var(--muted); font-size: 14.5px; margin-top: 8px; }
.counter { color: var(--dim); font-size: 12.5px; margin-top: 18px; }

/* ---------- works list ---------- */
.works-wrap { flex: 1; padding: 24px 28px 48px; max-width: 1280px; margin: 0 auto; width: 100%; }
.works-controls { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.works-controls input, .works-controls select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font: 14.5px var(--sans);
  padding: 9px 12px;
}
.works-controls input { flex: 1; min-width: 220px; }
.works-controls input:focus, .works-controls select:focus { outline: 1px solid var(--accent-soft); }
.works-count { color: var(--dim); font-size: 13px; align-self: center; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px 16px;
}
.card { text-decoration: none; color: inherit; }
.card .ph {
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  overflow: hidden;
}
.card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-touch-callout: none;
  transition: transform .25s ease;
}
.card:hover img { transform: scale(1.03); }
.card .t { font-family: var(--serif); font-size: 14.5px; margin-top: 9px; line-height: 1.35; }
.card .a { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- text pages ---------- */
.page { flex: 1; max-width: 760px; margin: 0 auto; padding: 40px 28px 60px; width: 100%; }
.page h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin-bottom: 22px; text-wrap: balance; }
.page h2 { font-family: var(--serif); font-weight: 400; font-size: 21px; margin: 28px 0 10px; color: var(--accent); }
.page p { color: var(--muted); margin-bottom: 14px; max-width: 68ch; }
.page a { color: var(--accent); }
.page .mail {
  display: inline-block;
  font-family: var(--serif);
  font-size: 22px;
  margin: 10px 0 4px;
}

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 16px 28px;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.6;
}
footer a { color: var(--dim); }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  header { padding: 12px 16px; gap: 10px; }
  .logo { font-size: 17px; }
  nav { gap: 12px; margin-left: 0; width: 100%; order: 3; }
  nav a { font-size: 13.5px; }
  .lang-toggle { margin-left: auto; }
  .viewer { padding: 12px 12px 32px; }
  .stage img { max-height: 60vh; }
  .next-btn {
    position: static;
    transform: none;
    margin-top: 16px;
    width: 100%;
    border-radius: 6px;
    height: 46px;
  }
  .stage { flex-direction: column; }
  .caption h1 { font-size: 20px; }
  .works-wrap { padding: 16px 14px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px 10px; }
  .card .ph { height: 130px; }
  .page { padding: 28px 18px 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .stage img, .card img { transition: none; }
}
