/* Палитра: Брейгель, «Охотники на снегу» */
:root {
  --paper: #ebe4d6;      /* фон, бумага */
  --mat: #f5f1e8;        /* паспарту */
  --ink: #33291f;        /* тёмно-коричневый текст */
  --muted: #7d7466;      /* приглушённый текст */
  --ochre: #a8783e;      /* охра, акцент */
  --green: #626c55;      /* приглушённый зелёный */
  --winter: #c9c6bd;     /* зимний серый, линии */
  --display: "Unbounded", system-ui, sans-serif;  /* заголовки, как на афишах-образцах */
  --serif: "Cormorant Garamond", Georgia, serif;   /* только эпиграф и прощание */
  --sans: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 300 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: var(--display); font-weight: 300; text-transform: uppercase; letter-spacing: .02em; margin: 0; }
[hidden] { display: none !important; }

/* Вход */
.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 64px 20px; }
.entrance-inner { width: 100%; max-width: 460px; text-align: center; }
.kicker { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 0 0 24px; }
h1 { font-size: clamp(30px, 8vw, 52px); line-height: 1.15; }
.epigraph { margin: 40px 0 56px; font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.5; color: var(--muted); }
.epigraph p { margin: 0 0 8px; }
.epigraph cite { font: 300 12px var(--sans); letter-spacing: .08em; }

.cashdesk { text-align: left; border-top: 1px solid var(--winter); padding-top: 32px; }
.cashdesk h2 { font-size: 22px; text-align: center; }
.hint { color: var(--muted); font-size: 14px; text-align: center; margin: 8px 0 28px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 18px; }
input, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px;
  font: 400 16px/1.5 var(--sans); color: var(--ink);
  background: var(--mat); border: 1px solid var(--winter); border-radius: 2px; resize: vertical;
}
input:focus, textarea:focus { outline: none; border-color: var(--ochre); }
button { font: 500 14px var(--sans); letter-spacing: .08em; cursor: pointer; }
.cashdesk button, .enter {
  display: block; width: 100%; padding: 14px; margin-top: 8px;
  background: var(--ink); color: var(--mat); border: 0; border-radius: 2px;
}
.cashdesk button:disabled { opacity: .5; cursor: default; }
.form-error { color: #8b3a2b; font-size: 14px; text-align: center; }

/* Билет */
.ticket {
  position: relative; display: flex; text-align: left; background: var(--mat);
  box-shadow: 0 1px 2px rgba(51,41,31,.08), 0 8px 24px rgba(51,41,31,.08);
  animation: rise .6s ease both;
}
/* Тонкая рамка-линия, как на афишах */
.ticket::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(125,116,102,.5); pointer-events: none; }
.ticket-main { flex: 1; padding: 24px; }
.ticket-museum { font-family: var(--display); font-weight: 300; text-transform: uppercase; font-size: 15px; margin: 0; }
.ticket-type { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 2px 0 20px; }
.ticket-no { font-family: var(--display); font-weight: 300; font-size: 32px; line-height: 1; margin: 0 0 12px; color: var(--ochre); }
.ticket-name { margin: 0; font-weight: 400; }
.ticket-date { margin: 0; font-size: 13px; color: var(--muted); }
.ticket-stub {
  width: 112px; padding: 24px 8px; border-left: 2px dashed var(--winter);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--green);
}
.enter { margin-top: 24px; animation: rise .6s .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* Навигация */
.topnav {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: center; gap: 28px;
  padding: 14px 16px; background: rgba(235,228,214,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(201,198,189,.6);
}
.topnav a { color: var(--ink); text-decoration: none; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.topnav a:hover { color: var(--ochre); }

/* Об авторе */
.about { max-width: 900px; margin: 0 auto; padding: 96px 20px; display: grid; gap: 40px; align-items: center; }
@media (min-width: 760px) { .about { grid-template-columns: 1fr 1fr; gap: 64px; } }
.about-photo { width: 100%; display: block; background: var(--mat); padding: 16px; box-shadow: 0 6px 20px rgba(51,41,31,.08); }
.about h2 { font-size: 24px; margin-bottom: 16px; }
.placeholder { color: var(--muted); font-style: italic; }

/* Залы */
.hall { padding: 64px 0 32px; }
.hall-head { text-align: center; padding: 64px 20px 72px; }
.hall-head h2 { font-size: clamp(44px, 12vw, 88px); line-height: 1; }
.hall-sub { margin: 8px 0 0; font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }

.works { display: flex; flex-direction: column; align-items: center; gap: clamp(72px, 14vh, 140px); padding: 0 16px; }
.work, .pair { margin: 0; width: 100%; }
.work { max-width: 820px; }
.work.portrait { max-width: 560px; }
.pair { max-width: 960px; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 3vw, 32px); align-items: center; }

/* Паспарту */
.mat {
  background: var(--mat); padding: clamp(12px, 3.5vw, 32px);
  box-shadow: 0 1px 2px rgba(51,41,31,.06), 0 10px 30px rgba(51,41,31,.08);
  cursor: zoom-in;
}
.mat img { display: block; width: 100%; height: auto; }
.work figcaption, .pair figcaption { margin-top: 14px; text-align: center; font-size: 12px; letter-spacing: .1em; color: var(--muted); }
.pair figcaption { grid-column: 1 / -1; margin-top: 0; }

.exit { text-align: center; padding: 120px 20px 160px; font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--muted); }

/* Просмотр */
.viewer {
  position: fixed; inset: 0; z-index: 10; background: #1d1813;
  display: flex; align-items: center; justify-content: center;
}
.viewer img { max-width: 94vw; max-height: 86vh; object-fit: contain; user-select: none; }
.viewer button { position: absolute; background: none; border: 0; color: #e9e2d4; font-size: 40px; font-weight: 300; padding: 16px 20px; opacity: .7; }
.viewer button:hover { opacity: 1; }
.v-close { top: 4px; right: 4px; }
.v-prev { left: 0; top: 50%; transform: translateY(-50%); }
.v-next { right: 0; top: 50%; transform: translateY(-50%); }
.v-caption { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; color: #a39a8a; font-size: 12px; letter-spacing: .1em; margin: 0; }
@media (max-width: 600px) { .v-prev, .v-next { display: none; } }

/* ---------- Вариант 2: одна работа на экран (открыть с ?v=2) ---------- */
.room { display: contents; }
/* Один свайп — одна остановка: быстрый жест переносит к следующей работе и ставит её по центру,
   медленный короткий — возвращает назад. Длинный текст «Об авторе» листается свободно. */
html.v2 { scroll-snap-type: y mandatory; }
.v2 .about { scroll-snap-align: start; }
.v2 .exit { scroll-snap-align: end; }
.v2 .room, .v2 .hall-head { scroll-snap-stop: always; }
.v2 body { background: #e2dacb; }  /* стена чуть темнее, чтобы был виден «свет» */
.v2 .topnav { background: rgba(226,218,203,.92); transition: transform .4s ease; }
.v2 .topnav.away { transform: translateY(-100%); }

.v2 .hall { padding: 0; }
.v2 .hall-head { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: 0 20px; scroll-snap-align: center; }
.v2 .works { gap: 0; padding: 0; }

/* Каждая работа — отдельная «стена» с тёплым пятном света */
.v2 .room {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 100svh; padding: 64px 16px;
  scroll-snap-align: center;
  background: radial-gradient(ellipse 62% 52% at 50% 48%, rgba(255,251,242,.8), rgba(255,251,242,0) 72%);
}
.v2 .room > figure { opacity: 0; transform: translateY(14px); transition: opacity 1.2s ease, transform 1.2s ease; }
.v2 .room.seen > figure { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .v2 .room > figure { opacity: 1; transform: none; transition: none; } }

/* Паспарту шире, нижнее поле больше верхнего */
.v2 .mat { --m: clamp(22px, 6.5vw, 60px); padding: var(--m) var(--m) calc(var(--m) * 1.3); }
.v2 .work, .v2 .work.portrait { width: auto; max-width: none; display: grid; justify-items: center; }
.v2 .work .mat img { width: auto; max-width: min(820px, calc(100vw - 32px - 2 * var(--m))); max-height: 66svh; }
.v2 .pair .mat { --m: clamp(10px, 3.5vw, 36px); }

/* Музейная этикетка: справа под работой */
.v2 .label {
  justify-self: end; text-align: left; margin-top: 18px;
  display: grid; gap: 2px; font-size: 12px; letter-spacing: .04em; color: var(--muted);
}
.v2 .label span:first-child { color: var(--ink); font-style: italic; font-family: var(--serif); font-size: 15px; letter-spacing: 0; }
.v2 .pair .label { grid-column: 1 / -1; margin-top: 4px; text-align: left; }

/* Заголовок входа: персональная выставка / имя / название / дата */
.entrance-inner .sub { margin: 18px 0 0; font-family: var(--display); font-weight: 300; text-transform: uppercase; letter-spacing: .12em; font-size: clamp(14px, 4vw, 18px); color: var(--muted); }
.entrance-inner .date { margin: 28px 0 0; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.about .sign { margin-top: 28px; text-align: right; font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--muted); }

/* Билет для сторис */
.story-btn { display: block; width: 100%; margin-top: 12px; padding: 12px; background: none; border: 1px solid var(--winter); border-radius: 2px; color: var(--ink); font-weight: 400; animation: rise .6s .45s ease both; }
.story-btn:hover { border-color: var(--ochre); }
.story-view { position: fixed; inset: 0; z-index: 20; background: #1d1813; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; }
.story-view img { max-height: 70vh; max-width: 86vw; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.story-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.story-actions button, .story-actions a { padding: 11px 18px; border-radius: 2px; font: 500 14px var(--sans); letter-spacing: .06em; text-decoration: none; cursor: pointer; }
.story-share, .story-save { background: var(--mat); color: var(--ink); border: 0; }
.story-close { background: none; color: #e9e2d4; border: 1px solid #5a5045; }
.story-hint { margin: 0; color: #a39a8a; font-size: 12px; text-align: center; max-width: 320px; }

/* Книга отзывов */
.book { max-width: 640px; margin: 0 auto; padding: 120px 20px 40px; }
.v2 .book { scroll-snap-align: start; }
.book h2 { font-size: 24px; text-align: center; }
.book-q { text-align: center; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 19px; margin: 10px 0 28px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin-bottom: 28px; }
.book-thumb { padding: 0; border: 0; background: var(--mat); aspect-ratio: 1; cursor: pointer; opacity: .85; outline: 2px solid transparent; outline-offset: 2px; transition: opacity .2s, outline-color .2s; }
.book-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-thumb:hover { opacity: 1; }
.book-thumb[aria-checked="true"] { opacity: 1; outline-color: var(--ochre); }
.book button[type=submit] { display: block; width: 100%; padding: 14px; margin-top: 8px; background: var(--ink); color: var(--mat); border: 0; border-radius: 2px; }
.book button[type=submit]:disabled { opacity: .5; }
.book-done { text-align: center; font-family: var(--serif); font-style: italic; font-size: 21px; color: var(--green); margin: 40px 0 0; }
.v2 .exit { padding-top: 80px; }
