/* =========================================================================
   Vio — каталог свадебных платьев
   Белый фон, чистая фотогалерея, подписи появляются при наведении.
   ========================================================================= */

:root {
  --bg: #ffffff;
  --milk: #ffffff;
  --cream: #fbf7f5;
  --powder: #e7e4de;
  --beige: #efe2d5;
  --rose: #e7e4de;
  --blush: #211710;
  --rose-deep: #211710;
  --rose-ink: #211710;
  --accent: #211710;
  --favorite: #990033;
  --ink: #2f2729;
  --ink-soft: #8a7d80;
  --line: rgba(60, 40, 45, 0.12);
  --surface: #ffffff;
  --shadow-sm: 0 6px 18px rgba(80, 55, 60, 0.08);
  --shadow-md: 0 16px 42px rgba(80, 55, 60, 0.12);
  --radius: 10px;
  --radius-lg: 22px;
  --font-display: 'Cormorant Garamond', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Jost', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --header-h: 66px;
  --grid-gap: clamp(6px, 0.8vw, 14px);
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

body.no-scroll { overflow: hidden; }

img { max-width: 100%; }

/* Атрибут hidden должен побеждать любые авторские display-правила. */
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.2; margin: 0; }

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

button { font-family: inherit; }

.container {
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 0 clamp(12px, 2vw, 30px);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: -60px;
  transform: translateX(-50%);
  z-index: 200;
  padding: 10px 20px;
  border-radius: 0 0 14px 14px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }

/* --- Кнопки (используются и в админ-панели) ---------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blush), var(--rose-deep));
  color: #fff;
  box-shadow: 0 10px 24px rgba(33, 23, 16, 0.18);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(33, 23, 16, 0.26); }

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--blush); color: var(--rose-ink); }

.btn-quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn-quiet:hover { color: var(--rose-ink); border-color: var(--blush); }

/* --- Шапка ------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  border: 1px solid transparent;
  background: var(--accent);
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: #fff;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-family: var(--font-display); font-size: 1.22rem; letter-spacing: 0.08em; }
.brand-sub { font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); }

.site-nav { display: flex; align-items: center; gap: 12px; }

.lang-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.lang-btn {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.lang-btn:hover { color: var(--rose-ink); }
.lang-btn.is-active {
  background: linear-gradient(135deg, var(--blush), var(--rose-deep));
  color: #fff;
}

/* --- Панель поиска и фильтров ------------------------------------------ */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: clamp(14px, 2vw, 22px) 0;
}

.search-field { position: relative; display: flex; align-items: center; max-width: 460px; }

.search-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.6;
  stroke-linecap: round;
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 12px 46px 12px 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#search::placeholder { color: #b3a6a8; }
#search:focus {
  outline: none;
  border-color: var(--blush);
  box-shadow: 0 0 0 3px rgba(33, 23, 16, 0.12);
}
#search::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(33, 23, 16, 0.10);
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.search-clear:hover { background: rgba(33, 23, 16, 0.18); }

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.83rem;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.chip:hover { border-color: var(--blush); color: var(--rose-ink); }
.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chip-fav .heart { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.chip-fav.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-fav.is-active .heart { fill: #fff; stroke: #fff; }

.chip-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 0.72rem;
}
.chip.is-active .chip-count { background: rgba(255, 255, 255, 0.22); }

/* --- Состояния --------------------------------------------------------- */

.status { margin: 30px 0; text-align: center; color: var(--ink-soft); }

.state-box {
  margin: 30px 0;
  padding: clamp(30px, 5vw, 54px);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}
.state-box h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin-bottom: 10px; }
.state-box p { margin: 0 auto 22px; max-width: 440px; color: var(--ink-soft); }

.state-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 1px solid var(--line);
}
.state-icon svg {
  width: 24px; height: 24px;
  fill: none; stroke: var(--rose-deep);
  stroke-width: 1.6; stroke-linecap: round;
}

.result-count {
  margin: 0 0 12px;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* --- Сетка фотографий -------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
  padding-bottom: clamp(36px, 5vw, 72px);
}

.card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--cream);
}

.card-media {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: zoom-in;
}

.card-layer { position: absolute; inset: 0; }

.card-layer img,
.card-layer video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  pointer-events: none;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.card-layer video { background: #211710; }

/* Второй снимок (или видео) того же платья: проявляется при наведении.
   Увели курсор — снова виден первый. */
.card-layer-hover { opacity: 0; transition: opacity 0.45s ease; }
.card:hover .card-layer-hover { opacity: 1; }
.card:hover .card-layer img,
.card:hover .card-layer video { transform: scale(1.04); }

/* Значок «это видео»: лежит внутри слоя, поэтому появляется и исчезает вместе с ним */
.card-play {
  position: absolute;
  left: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.card-play svg { width: 14px; height: 14px; fill: #ffffff; }

.card-media:focus-visible { outline: none; }
.card-media:focus-visible::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--rose-deep);
  border-radius: var(--radius);
}

/* Подписи появляются только при наведении — по умолчанию только фотография */
.card-overlay {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 44px 14px 13px;
  background: linear-gradient(to top, rgba(24, 16, 18, 0.78), rgba(24, 16, 18, 0));
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}
.card:hover .card-overlay,
.card-media:focus-visible .card-overlay { opacity: 1; }

.card-cat {
  margin: 0;
  font-size: 0.63rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

.card-title {
  font-size: 1.18rem;
  color: #fff;
}

.card-demo {
  align-self: flex-start;
  margin-bottom: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--rose-ink);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.fav-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.fav-btn:hover { transform: scale(1.08); }
.fav-btn .heart { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.fav-btn.is-active { opacity: 1; color: var(--favorite); }
.fav-btn.is-active .heart { fill: var(--favorite); stroke: var(--favorite); }

.card:hover .fav-btn,
.card-media:focus-within .fav-btn { opacity: 1; }

/* На сенсорных экранах наведения нет — держим кнопку видимой */
@media (hover: none) {
  .fav-btn { opacity: 1; }
  .card-overlay { opacity: 1; background: linear-gradient(to top, rgba(24, 16, 18, 0.6), rgba(24, 16, 18, 0)); }
}

/* --- Кнопка связи: правый нижний угол, не двигается при прокрутке ------- */

.contact-fab {
  position: fixed;
  right: clamp(14px, 2vw, 26px);
  bottom: clamp(14px, 2vw, 26px);
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.contact-toggle {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(33, 23, 16, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.contact-toggle:hover { transform: scale(1.05); box-shadow: 0 16px 36px rgba(33, 23, 16, 0.36); }
.contact-toggle svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-menu { display: flex; flex-direction: column; gap: 8px; }

.contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(33, 23, 16, 0.16);
  transition: color 0.2s ease, transform 0.2s ease;
}
.contact-link:hover { color: var(--accent); transform: translateY(-1px); }
.contact-link svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Подвал ------------------------------------------------------------ */

.site-footer {
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.footer-brand { margin: 0 0 4px; font-family: var(--font-display); font-size: 1.15rem; letter-spacing: 0.08em; }
.footer-note { margin: 0; font-size: 0.78rem; color: var(--ink-soft); }

/* --- Полноэкранный просмотр фотографии ---------------------------------
   Вместо чёрного фона — размытие страницы за фотографией.
   ---------------------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  --lb-pad: clamp(6px, 1.4vw, 20px);
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: #000000;
}

.lightbox-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.lightbox-figure {
  margin: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: var(--lb-pad);
}

#lbImage,
#lbVideo {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 2 * var(--lb-pad));
  max-height: calc(100vh - 2 * var(--lb-pad));
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  background: #000000;
}

#lbImage {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.lightbox-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 48px clamp(16px, 4vw, 40px) 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
  text-align: center;
  pointer-events: auto;
}
.lb-cat { margin: 0 0 4px; font-size: 0.64rem; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255, 255, 255, 0.72); }
.lb-title { font-size: clamp(1.25rem, 2.4vw, 1.8rem); color: #ffffff; }
.lb-desc { margin: 8px auto 0; max-width: 620px; font-size: 0.9rem; color: rgba(255, 255, 255, 0.82); }
.lb-counter { margin: 10px 0 0; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }

/* --- Миниатюры снимков этой же серии ----------------------------------- */

.lightbox-thumbs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 14px auto 0;
  padding: 4px 2px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.lightbox-thumb {
  position: relative;
  flex: none;
  width: 56px;
  height: 74px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.lightbox-thumb:hover { opacity: 1; transform: translateY(-2px); }
.lightbox-thumb.is-active { opacity: 1; border-color: #ffffff; }

.lightbox-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.lightbox-thumb-video {
  position: absolute;
  left: 4px;
  bottom: 4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.lightbox-thumb-video svg { width: 8px; height: 8px; fill: #ffffff; }

.lightbox-btn {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.3); }

.lightbox-close { top: clamp(10px, 2vw, 22px); right: clamp(10px, 2vw, 22px); }
.lightbox-prev { left: clamp(8px, 1.6vw, 20px); top: 50%; transform: translateY(-50%); }
.lightbox-next { right: clamp(8px, 1.6vw, 20px); top: 50%; transform: translateY(-50%); }
.lightbox-prev:hover { transform: translateY(-50%) scale(1.06); }
.lightbox-next:hover { transform: translateY(-50%) scale(1.06); }

/* --- Адаптивность ------------------------------------------------------ */

@media (max-width: 760px) {
  :root { --header-h: 58px; --grid-gap: 4px; }

  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .header-inner { flex-wrap: wrap; row-gap: 6px; padding: 6px 0; }
  .brand-title { font-size: 1rem; letter-spacing: 0.02em; }
  .brand-mark { width: 34px; height: 34px; font-size: 1.1rem; }
  .brand-sub { font-size: 0.6rem; letter-spacing: 0.14em; }
  .site-nav { gap: 7px; }
  .btn-ghost { padding: 8px 13px; font-size: 0.78rem; }
  .lang-btn { padding: 5px 9px; font-size: 0.72rem; }

  .card { border-radius: 6px; }
  .card-overlay { padding: 30px 9px 9px; }
  .card-title { font-size: 1rem; }
  .card-cat { font-size: 0.56rem; letter-spacing: 0.12em; }
  .fav-btn { width: 32px; height: 32px; right: 7px; top: 7px; }
  .fav-btn .heart { width: 16px; height: 16px; }

  .search-field { max-width: none; }
  .chip { padding: 6px 12px; font-size: 0.78rem; }

  .lightbox-btn { width: 42px; height: 42px; font-size: 1.3rem; }
  .lb-desc { display: none; }

  .lightbox-thumbs { gap: 6px; justify-content: flex-start; }
  .lightbox-thumb { width: 44px; height: 58px; }

  .contact-toggle { width: 50px; height: 50px; }
  .contact-toggle svg { width: 21px; height: 21px; }
  .contact-link { padding: 10px 14px; font-size: 0.84rem; }

  /* На мобильных фотография раскрывается во весь экран, без полей */
  .lightbox-figure { padding: 0; }
  #lbImage,
  #lbVideo {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
