:root {
  --iron: #14120f;
  --iron-2: #1e1b17;
  --parchment: #f3ecdd;
  --parchment-2: #e7dcc4;
  --ink: #2a2520;
  --muted: #6d6458;
  --gold: #c9a45c;
  --red: #9e2f26;
  --red-2: #b9382d;
  --radius: 4px;
  --wrap: 1120px;

  /* цвета, которые меняет тема */
  --bg: var(--parchment);          /* фон страницы */
  --bg-2: var(--parchment-2);      /* фон блока условий, шапки таблиц */
  --surface: #fff;                 /* карточки, плашки */
  --surface-2: var(--parchment);   /* форма, окно подробностей */
  --field: #fffdf8;                /* поля ввода */
  --field-border: #cbbd9f;
  --line: #d6c7a6;                 /* рамки таблиц */
  --text: var(--ink);
  --red-text: var(--red);          /* красный для текста и ссылок */
  --ok: #2f6b2a;
  --band: var(--iron);             /* тёмные полосы: мероприятия, заявка */
  --card-shadow: 0 1px 0 rgba(0,0,0,.06), 0 8px 24px rgba(42,37,32,.08);
  color-scheme: light;
}

/* тёмная тема */
:root[data-theme="dark"] {
  --bg: #181512;
  --bg-2: #211d18;
  --surface: #24201b;
  --surface-2: #1f1b17;
  --field: #15120f;
  --field-border: #4a4136;
  --line: #3d352c;
  --text: #ece4d4;
  --muted: #a99d8b;
  --red-text: #e57a6d;
  --ok: #8fcf7f;
  --band: #0e0c0a;
  --card-shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  transition: background .3s, color .3s;
  font: 17px/1.6 "PT Sans", system-ui, sans-serif;
}
img { display: block; max-width: 100%; }
a { color: inherit; }

h1, h2, h3, .logo {
  font-family: "Cormorant SC", Georgia, serif;
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2.3rem, 6vw, 4.2rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h3 { font-size: 1.45rem; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

.eyebrow {
  margin: 0 0 .6em;
  font-size: .8rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--red-text);
  font-weight: 700;
}
.lead { max-width: 46em; font-size: 1.08rem; }

/* buttons */
.btn {
  display: inline-block;
  padding: .8em 1.5em;
  border: 2px solid var(--red);
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  font: 700 1rem/1 "PT Sans", sans-serif;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--red-2); border-color: var(--red-2); }
.btn--ghost { background: transparent; border-color: var(--gold); color: var(--parchment); }
.btn--ghost:hover { background: rgba(201,164,92,.15); border-color: var(--gold); }
.btn--small { padding: .55em 1em; font-size: .9rem; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(20,18,15,.94);
  color: var(--parchment);
  border-bottom: 1px solid rgba(201,164,92,.3);
}
.top__in { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { margin: 0; font-size: 1.6rem; text-decoration: none; color: var(--gold); white-space: nowrap; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { text-decoration: none; opacity: .85; }
.nav a:hover { opacity: 1; color: var(--gold); }

/* переключатель темы: луна в светлой теме, солнце в тёмной */
.theme-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: 0 0 38px;
  padding: 0; border: 1px solid rgba(201,164,92,.4); border-radius: 50%;
  background: transparent; color: var(--gold); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.theme-toggle:hover { background: rgba(201,164,92,.15); border-color: var(--gold); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle__moon { fill: currentColor !important; stroke: none !important; }
.theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: block; }

/* hero */
.hero {
  position: relative;
  min-height: min(88vh, 760px);
  display: flex; align-items: flex-end;
  color: var(--parchment);
  background: var(--iron);
  overflow: hidden;
}
/* фото первого экрана сменяют друг друга: плавное растворение и медленное приближение */
.hero__slides { position: absolute; inset: 0; }
/* Приближение сделано переходом, а не анимацией: при смене фото уходящий кадр
   не прыгает обратно к исходному масштабу, а тает с того места, где был */
.hero__bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 60% 40%;
  opacity: 0;
  transform: scale(1);
  transition: opacity 1.8s ease-in-out, transform 9s linear;
  will-change: opacity, transform;
  backface-visibility: hidden;
}
.hero__bg.is-active { opacity: 1; transform: scale(1.07); }
@media (prefers-reduced-motion: reduce) {
  .hero__bg, .hero__bg.is-active { transition: none; transform: none; }
}
/* затемнение сильнее слева и снизу, где лежит текст, справа фото остаётся ярким */
.hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(14,12,10,.82) 0%, rgba(14,12,10,.6) 40%, rgba(14,12,10,.15) 75%, rgba(14,12,10,0) 100%),
    linear-gradient(180deg, rgba(14,12,10,.35) 0%, rgba(14,12,10,.2) 35%, rgba(14,12,10,.85) 100%);
}
.hero__in { position: relative; z-index: 1; padding-top: 120px; padding-bottom: 64px; }
.hero .eyebrow { color: var(--gold); text-shadow: 0 1px 6px rgba(0,0,0,.8); }
.hero h1 { max-width: 12em; text-shadow: 0 2px 4px rgba(0,0,0,.55), 0 4px 24px rgba(0,0,0,.6); }
.hero__lead { max-width: 34em; font-size: 1.12rem; color: #f7f1e3; text-shadow: 0 1px 3px rgba(0,0,0,.8), 0 2px 14px rgba(0,0,0,.6); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* sections */
.section { padding: 88px 0; }
.section--dark { background: var(--band); color: var(--parchment); }
.section--dark .eyebrow { color: var(--gold); }

/* rent cards */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin: 40px 0 32px;
}
.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--card-shadow); display: flex; flex-direction: column; }
.card img { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; }
.card__body { padding: 16px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.card__body p { margin: 0 0 12px; color: var(--muted); font-size: .95rem; }
.card h3 { font-size: 1.3rem; }
.price { margin: auto 0 0 !important; font-weight: 700; font-size: 1.15rem; color: var(--red-text) !important; }
.price--ask { color: var(--gold) !important; }

/* условия аренды, блок перед заявкой */
.section--terms { background: var(--bg-2); padding: 64px 0; }
.terms {
  list-style: none; margin: 28px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  color: var(--muted); font-size: .95rem;
}
.terms li { background: var(--surface); border-left: 3px solid var(--red); border-radius: var(--radius); padding: 16px 18px; }
.terms b { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 2px; }

/* events */
.events { display: grid; gap: 28px; margin-top: 44px; }
.event {
  display: grid; grid-template-columns: 380px 1fr; gap: 28px;
  background: var(--iron-2);
  border: 1px solid rgba(201,164,92,.18);
  border-radius: var(--radius);
  overflow: hidden;
}
.event img { width: 100%; height: 100%; min-height: 240px; object-fit: cover; }
.event__body { padding: 26px 28px 26px 0; display: flex; flex-direction: column; }
.event__body p { margin: 0 0 14px; opacity: .88; }
.event .price { color: var(--gold) !important; }
.opts { margin: 0; padding-left: 1.1em; opacity: .92; }
.opts li { margin-bottom: 6px; }
.opts b { color: var(--gold); }

/* gallery */
.gallery {
  display: grid; gap: 12px; margin-top: 36px;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 260px;
}
.gallery img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.gallery .wide { grid-column: span 2; grid-row: span 2; }
/* если широкое фото не помещается в ряд, свободные клетки заполняют следующие фото */
.gallery { grid-auto-flow: dense; }

/* order */
.order { display: grid; grid-template-columns: 1fr 1.15fr; gap: 56px; align-items: start; }
.msgr { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.form {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  background: var(--surface-2); color: var(--text);
  padding: 28px; border-radius: var(--radius);
}
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .92rem; font-weight: 700; }
.form .full { grid-column: 1 / -1; }
.form input, .form select, .form textarea {
  font: 400 1rem "PT Sans", sans-serif;
  padding: .65em .75em;
  border: 1px solid var(--field-border); border-radius: var(--radius);
  background: var(--field); color: var(--text);
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form__status { margin: 0; min-height: 1.4em; font-size: .95rem; }
.form__status.err { color: var(--red-text); }
.form__status.ok { color: var(--ok); }
.form__status .btn { display: table; margin-top: 10px; }
.invalid { border-color: var(--red) !important; }

/* footer */
.foot { background: #0d0c0a; color: rgba(243,236,221,.75); padding: 28px 0; font-size: .95rem; }
.foot__in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.foot p { margin: 0; }
.foot__links { display: flex; gap: 20px; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--gold); }

/* кнопка «Подробнее» на карточках; сама карточка тоже открывает окно */
[data-detail] { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.card[data-detail]:hover { transform: translateY(-3px); box-shadow: 0 2px 0 rgba(0,0,0,.06), 0 14px 30px rgba(42,37,32,.16); }
.event[data-detail]:hover { border-color: rgba(201,164,92,.5); }
.more {
  align-self: flex-start;
  margin-top: 14px; padding: 0;
  border: 0; background: none;
  font: 700 .95rem/1.2 "PT Sans", sans-serif;
  color: var(--red-text); cursor: pointer;
  border-bottom: 1px solid currentColor;
}
.more::after { content: " →"; }
.event .more { color: var(--gold); }

/* окно с подробностями */
.detail {
  width: min(1040px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0; border: 0; border-radius: var(--radius);
  background: var(--surface-2); color: var(--text);
  /* minmax(0, …): иначе полоса превью растягивает колонку шире окна */
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  overflow: hidden;
}
.detail:not([open]) { display: none; }
.detail::backdrop { background: rgba(10,9,7,.78); }
.detail__close {
  position: absolute; top: 8px; right: 10px; z-index: 2;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(20,18,15,.75); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.detail__media { background: var(--iron); display: flex; flex-direction: column; min-height: 0; }
.detail__stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.detail__main { width: 100%; height: 100%; max-height: 72vh; object-fit: contain; }
.detail__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 56px; border: 0; background: rgba(20,18,15,.55); color: #fff;
  font-size: 30px; cursor: pointer;
}
.detail__nav--prev { left: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.detail__nav--next { right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.detail__thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; }
.detail__thumbs button { flex: 0 0 64px; height: 48px; padding: 0; border: 2px solid transparent; border-radius: 2px; background: none; cursor: pointer; opacity: .6; }
.detail__thumbs button[aria-current="true"] { border-color: var(--gold); opacity: 1; }
.detail__thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail__body { padding: 32px 28px 28px; overflow-y: auto; }
.detail__body h3 { font-size: 1.7rem; padding-right: 36px; }
.detail__body p, .detail__body li { font-size: .98rem; }
.detail__body ul { padding-left: 1.2em; }
.detail__body .price { margin: 0 0 14px !important; font-size: 1.25rem; }
.detail__body .opts b { color: var(--red-text); }
.detail__cta { margin-top: 22px; }

/* «Показать ещё» в галерее */
.gallery--more { margin-top: 12px; }
.gallery__toggle { text-align: center; margin: 28px 0 0; }
.btn--outline { background: transparent; color: var(--red-text); }
.btn--outline:hover { background: var(--red); color: #fff; }

/* страница-документ (политика) */
.doc__in { max-width: 820px; }
.doc h1 { font-size: clamp(2rem, 5vw, 3rem); }
.doc h2 { font-size: 1.6rem; margin: 2em 0 .5em; }
.doc p, .doc li { max-width: 46em; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: 4px; }
.doc a:not(.btn) { color: var(--red-text); }
.doc__meta { color: var(--muted); }
.doc__table { overflow-x: auto; margin: 16px 0 20px; }
.doc table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: .95rem; background: var(--field); }
.doc th, .doc td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.doc th { background: var(--bg-2); }
.doc__back { margin-top: 48px; }
/* поля, которые нужно заполнить реквизитами */
mark.fill { background: #ffe58a; color: var(--ink); padding: 0 .2em; border-radius: 2px; }
.form__note { margin: -4px 0 0; font-size: .85rem; color: var(--muted); }
.form__note a { color: var(--red-text); }

/* кнопка чата в правом нижнем углу */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px 12px 16px;
  border: 0; border-radius: 999px;
  background: var(--red); color: #fff;
  font: 700 .95rem/1 "PT Sans", sans-serif;
  box-shadow: 0 6px 20px rgba(0,0,0,.28);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.chat-fab:hover { background: var(--red-2); transform: translateY(-2px); }
.chat-fab svg { width: 22px; height: 22px; fill: currentColor; }
.chat-fab svg circle { fill: var(--red); }
/* лёгкое покачивание кнопки через несколько секунд после загрузки, один раз */
@media (prefers-reduced-motion: no-preference) {
  .chat-fab { animation: chat-nudge 1s ease-in-out 6s 1; }
}
@keyframes chat-nudge {
  0%, 100% { transform: none; }
  25% { transform: translateY(-4px) rotate(-3deg); }
  50% { transform: translateY(0) rotate(2deg); }
  75% { transform: translateY(-2px) rotate(-1deg); }
}

[hidden] { display: none !important; }

/* tablet */
@media (max-width: 960px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .terms { grid-template-columns: repeat(2, 1fr); }
  .event { grid-template-columns: 1fr; gap: 0; }
  .event img { height: 260px; min-height: 0; }
  .event__body { padding: 22px; }
  .order { grid-template-columns: 1fr; gap: 32px; }
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 220px; }
}

/* phone */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav { display: none; }
  .top__in { justify-content: space-between; gap: 10px; }
  .theme-toggle { margin-left: auto; }
  /* на телефоне кнопка чата — только значок */
  .chat-fab { right: 14px; bottom: 14px; padding: 14px; }
  .chat-fab__text { display: none; }
  .logo { font-size: 1.35rem; }
  .section { padding: 60px 0; }
  .hero__in { padding-bottom: 44px; }
  .hero__cta .btn { flex: 1 1 100%; }
  .cards { gap: 12px; }
  .card__body { padding: 12px 12px 14px; }
  .card h3 { font-size: 1.1rem; }
  .card__body p:not(.price) { display: none; }
  .form { grid-template-columns: 1fr; padding: 20px; }
  .gallery { grid-auto-rows: 180px; gap: 8px; }
  .gallery--more { margin-top: 8px; }
  /* окно подробностей: фото сверху, текст под ним, прокручивается целиком */
  .detail { grid-template-columns: minmax(0, 1fr); width: calc(100% - 16px); max-height: calc(100% - 16px); overflow-y: auto; }
  .detail__main { max-height: 46vh; }
  .detail__body { padding: 20px 16px 24px; overflow: visible; }
  .detail__body h3 { font-size: 1.4rem; }
}
