/* Подключение Шрифтов */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-v16-latin_cyrillic-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-v16-latin_cyrillic-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-v16-latin_cyrillic-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-v16-latin_cyrillic-600.woff2') format('woff2');
}

html, body {
  width: 100%; height: 100%;
}

/* ===== Заставка ===== */
.splash {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 1.8s cubic-bezier(.4,0,.2,1);
  background: #F9F8F7;
}
.splash.fade-out { opacity: 0; pointer-events: none }

.splash::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(130,122,110,.15) 100%);
  pointer-events: none; z-index: 0;
}

.noise-layer {
  position: absolute; inset: 0;
  opacity: .03; pointer-events: none; z-index: 1;
}

.back-glow {
  position: absolute;
  width: 650px; height: 380px;
  background: radial-gradient(ellipse, rgba(195,180,155,.18) 0%, transparent 72%);
  pointer-events: none; z-index: 0;
}

.content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}

.title-svg { width: min(92vw, 900px) }
.line-svg { width: min(48vw, 340px) }
.sub-svg { width: min(78vw, 640px) }

.letter {
  font-family: 'Cormorant Garamond', serif;
  fill: #1C1310;
  fill-opacity: 0;
  stroke: #1C1310;
  stroke-width: .7;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
}
.letter.is-space {
  stroke: none;
  stroke-dasharray: 0;
  stroke-dashoffset: 0;
}
.letter.draw {
  animation: strokeDraw var(--dur) cubic-bezier(.65,0,.35,1) forwards;
  animation-delay: var(--d);
}
@keyframes strokeDraw { to { stroke-dashoffset: 0; } }

.letter.fill {
  fill: #1C1310;
  fill-opacity: 1;
  stroke-opacity: 0;
  transition: fill-opacity .65s ease, stroke-opacity .2s ease;
}

.deco-line {
  stroke: #9B7B3C;
  stroke-width: .8;
  stroke-linecap: round;
  stroke-dasharray: var(--l);
  stroke-dashoffset: var(--l);
}
.deco-line.draw {
  animation: lineDraw .9s ease forwards;
  animation-delay: var(--d);
}
@keyframes lineDraw { to { stroke-dashoffset: 0 } }

.deco-gem {
  fill: #9B7B3C;
  opacity: 0;
  transition: opacity .6s ease;
}
.deco-gem.show { opacity: 1 }

#dust-canvas {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 1;
}

/* ===== Основная страница ===== */
.main-page {
  display: block;
  width: 100%;
  height: 100vh;
  overflow-y: auto;
  color: #1C1310;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.main-page.visible { opacity: 1 }

@media (prefers-reduced-motion: reduce) {
  .letter.draw { animation: none; stroke-dashoffset: 0 }
  .letter { fill-opacity: 1; stroke-opacity: 0 }
  .deco-line.draw { animation: none; stroke-dashoffset: 0 }
  .deco-gem { opacity: 1 }
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box }
html { scroll-behavior: smooth }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #E8E4DF;
  color: #1A1918;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ═══════════ HEADER ═══════════ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  background: #FFFFFF;
  z-index: 10000;
  overflow: visible;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.header-hidden { transform: translateY(-100%) }

.header::before, .header::after {
  content: ''; position: absolute;
  top: 0; bottom: 0; width: 28px; z-index: 3;
  pointer-events: none;
  opacity: 0; transition: opacity .25s ease;
}
.header::before { left: 0; background: linear-gradient(to right, #FFF 20%, rgba(255,255,255,0) 100%) }
.header::after { right: 0; background: linear-gradient(to left, #FFF 20%, rgba(255,255,255,0) 100%) }
.header.can-scroll-left::before { opacity: 1 }
.header.can-scroll-right::after { opacity: 1 }

.header-scroll {
  display: flex; align-items: center;
  height: 100%; gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.header-scroll::-webkit-scrollbar { display: none }

.header-left {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; min-width: 160px;
}
.header-logo {
  width: 70px; height: 62px; object-fit: contain;
  border-radius: 8px;
}

.header-nav {
  flex: 1 0 auto; display: flex; align-items: center;
  gap: 6px; overflow-x: auto; scrollbar-width: none;
  -ms-overflow-style: none;
}
.header-nav::-webkit-scrollbar { display: none }

.nav-pill {
  flex: 0 0 auto;
  padding: 4px 18px;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 500;
  color: #767676;
  cursor: pointer;
  transition: all .18s ease;
  border: none;
  background: transparent;
  white-space: nowrap;
  font-family: inherit;
  position: relative;
  z-index: 2;
  isolation: isolate;
  will-change: padding-right;
}
.nav-pill.active { background: #1A1918; color: #FFFFFF; }
.nav-pill:not(.active):hover { background: #F0EDEA; color: #1A1918; }

.header-right {
  display: flex;
  align-items: center;
  position: relative;
  margin-left: auto;
  margin-right: 12px;
}
@media (min-width: 701px) {
  .header-right {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    margin-right: 0;
  }
}

.burger-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 38px; height: 38px;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.18s ease;
}
.burger-btn:hover { background: #F0EDEA; }
.burger-line {
  width: 20px; height: 2px;
  background-color: #1A1918;
  border-radius: 1px;
}

.dropdown-menu {
  display: none;
  position: fixed;
  top: 38px; right: 20px;
  min-width: 170px;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 6px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  z-index: 99999;
}
.dropdown-menu.open { display: block; }

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: #1A1918;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s ease;
}
.menu-item:hover { background: #F0EDEA; }
.menu-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  stroke: #1A1918;
}

.ekadashi-box {
  width: min(92vw, 720px);
  background: #FFFFFF;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 12px 40px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
}
.ekadashi-title {
  text-align: center;
  color: #767676;
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: .02em;
  margin-bottom: 4px;
}
.ekadashi-subtitle {
  text-align: center;
  color: #9A938B;
  font-size: 13px;
  margin-bottom: 28px;
}
.ekadashi-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 18px;
  background: #FFFDF9;
  border: 1px solid #D9D2C9;
}
.ekadashi-table th {
  background: #F7F4EF;
  color: #1A1918;
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
  font-weight: 600;
  padding: 1px 3px;
  border-bottom: 1px solid #D9D2C9;
}
.ekadashi-table td {
  background: #FFFCF7;
  color: #1A1918;
  text-align: center;
  padding: 2px 3px;
  font-size: 14px;
  line-height: 1.6;
  border-right: 1px solid #E4DDD3;
  border-bottom: 1px solid #E4DDD3;
  transition: background .18s ease;
}
.ekadashi-table tr:last-child td { border-bottom: none; }
.ekadashi-table td:last-child, .ekadashi-table th:last-child { border-right: none; }
.ekadashi-table td:hover { background: #F8F3EA; }
.ekadashi-name { display: block; font-weight: 600; color: #1A1918; margin-bottom: 6px; }
.ekadashi-date { display: block; font-size: 12px; color: #767676; }

.structure-box { border: 1px solid #1A1918; }
.structure-text { text-align: center; color: #1A1918; font-size: 16px; padding: 20px 0; font-weight: 500; }

.audio-player-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: margin 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-audio-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  background: #1A1918;
  color: #FFF;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  z-index: 1;
  width: 0; opacity: 0; padding: 0; pointer-events: none;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, transform 0.2s ease;
}
.nav-audio-nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-audio-nav:hover { background: #C5A880; }

.audio-player-container:hover .nav-audio-nav,
.audio-player-container.controls-open .nav-audio-nav {
  width: 34px; opacity: 1; pointer-events: auto;
}
.audio-player-container:hover .prev-btn,
.audio-player-container.controls-open .prev-btn { margin-right: 6px; }
.audio-player-container:hover .next-btn,
.audio-player-container.controls-open .next-btn { margin-left: 6px; }
#audioToggleBtn { position: relative; }

.main {
  padding: 80px 16px 40px;
  max-width: 1600px; margin: 0 auto;
}
.gallery { column-count: 6; column-gap: 24px; }
.image-card {
  break-inside: avoid; margin-bottom: 24px;
  border-radius: 16px; overflow: hidden;
  position: relative; cursor: pointer;
  background: #D5D0CA;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow .3s ease, transform .3s ease;
}
.image-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  transform: translateY(-3px);
}

.image-wrapper {
  position: relative;
  overflow: hidden;
  width: 100%;
  background: #c6b79d;
}
.gallery-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: normal;
  opacity: 0;
  transition: opacity 2s cubic-bezier(0.25, 1, 0.5, 1);
}
.gallery-image.loaded { opacity: 1; }

.image-wrapper:not(:has(.loaded))::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, #D5D0CA 25%, #DDD8D2 50%, #D5D0CA 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  z-index: 1;
}
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

.card-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; flex-direction: column; gap: 6px;
  opacity: 0; transition: opacity .2s ease; z-index: 10;
}
.image-card:hover .card-actions { opacity: 1 }
.ca-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.ca-btn:hover { background: #FFF; transform: scale(1.08) }
.ca-btn:active { transform: scale(.95) }
.ca-btn svg { width: 16px; height: 16px; pointer-events: none }

.mobile-zoom {
  display: none; position: absolute; bottom: 8px; right: 8px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  border: none; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease; z-index: 10;
}
.mobile-zoom svg {
  width: 18px; height: 18px; fill: none;
  stroke: #1A1918; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}

.empty-msg {
  text-align: center; padding: 100px 20px;
  color: #767676; font-size: 15px; font-weight: 400;
  column-span: all;
}

.lb-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.78);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.lb-overlay.open { opacity: 1; pointer-events: auto }
.lb-wrap {
  position: relative;
  max-width: 90vw; max-height: 82vh;
  display: flex; align-items: center; justify-content: center;
}
.lb-img {
  max-width: 90vw; max-height: 80vh;
  object-fit: contain; border-radius: 12px;
  transform: scale(.96);
  transition: transform .3s cubic-bezier(.16,1,.3,1);
}
.lb-overlay.open .lb-img { transform: scale(1) }
.lb-close {
  position: fixed; top: 16px; right: 16px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: none;
  color: #FFF; font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease; z-index: 10002;
}
.lb-close:hover { background: rgba(255,255,255,.25) }
.lb-bottom {
  display: flex; gap: 8px; margin-top: 14px;
  opacity: 0; transform: translateY(8px);
  transition: opacity .3s ease .1s, transform .3s ease .1s;
}
.lb-overlay.open .lb-bottom { opacity: 1; transform: translateY(0) }
.lb-dl-btn {
  padding: 10px 22px; border-radius: 24px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all .18s ease; border: none;
  display: inline-flex; align-items: center; gap: 8px;
  background: #C5A880; color: #FFF; font-family: inherit;
}
.lb-dl-btn:hover { background: #B3956E }
.lb-dl-btn svg { width: 16px; height: 16px }

.modal-ov {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 10001;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.modal-ov.open { opacity: 1; pointer-events: auto }
.modal-box {
  background: #FFF; border-radius: 12px;
  padding: 12px; max-width: 450px; width: 90%;
  position: relative;
  transform: translateY(16px) scale(.97);
  transition: transform .3s cubic-bezier(.16,1,.3,1);
}
.modal-ov.open .modal-box { transform: translateY(0) scale(1) }
.modal-x {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  background: #F0EDEA; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #767676; transition: background .15s ease;
}
.modal-x:hover { background: #E0DDD8 }
.modal-heading { font-size: 22px; font-weight: 600; margin-bottom: 24px; color: #1A1918 }
.modal-row { margin-bottom: 16px }
.modal-lbl {
  font-size: 14px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: #767676; margin-bottom: 4px;
}
.modal-a {
  font-size: 15px; color: #1A1918; text-decoration: none;
  transition: color .18s ease; line-height: 1.5;
}
.modal-a:hover { color: #C5A880 }

.footer {
  text-align: center; padding: 24px 16px 56px;
  max-width: 520px; margin: 0 auto;
}
.footer h1 {
  font-size: 15px; font-weight: 600; color: #1A1918;
  margin-bottom: 6px; letter-spacing: -0.01em;
}
.footer p { font-size: 13px; color: #767676; line-height: 1.65; }

@media (max-width: 1440px) { .gallery { column-count: 5 } }
@media (max-width: 1200px) { .gallery { column-count: 4 } }
@media (max-width: 960px) {
  .gallery { column-count: 3 }
  .header-left { min-width: auto }
}

/* ===== МОБИЛЬНЫЕ ===== */
@media (max-width: 700px) {
  .gallery { column-count: 2; column-gap: 16px }
  .image-card { margin-bottom: 18px; border-radius: 12px }
  .main { padding: 72px 10px 32px }
  .header { height: 56px }
  
  /* Фикс логотипа: уменьшаем, чтобы не ломал хедер 56px */
  .header-logo { width: 48px; height: 44px; }
  
  .header-scroll { padding: 0 12px; gap: 6px }
  .header-left { min-width: auto }
  .nav-pill { padding: 6px 14px; font-size: 13px }
  .h-btn { padding: 6px 12px; font-size: 13px }
  
  /* Фикс выпадающего меню: привязываем к низу хедера 56px */
  .dropdown-menu { top: 56px; right: 12px; }
  
  .card-actions { display: none !important }
  .mobile-zoom { display: flex }
  .lb-img { border-radius: 8px }
  
  /* Фикс таблицы Экадashi на маленьких экранах */
  .ekadashi-box { padding: 18px; border-radius: 18px; }
  .ekadashi-title { font-size: 22px; }
  .ekadashi-table th { padding: 12px 6px; font-size: 16px; }
  .ekadashi-table td { padding: 2px 3px; font-size: 13px; }
}

@media (max-width: 1024px) and (orientation: landscape) {
  .lb-wrap { max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh }
  .lb-img { max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; object-fit: cover; border-radius: 0 }
}

/* ═══════════ АНИМАЦИЯ ZIP ═══════════ */
.nav-pill {
  display: inline-flex !important; /* Гарантирует правильный Flex-поток */
  align-items: center !important;
  /* Убрали position: relative, overflow: hidden и padding-right, которые вызывали баг в Safari */
  transition: background-color 0.3s ease, color 0.3s ease !important;
}

.pill-zip-icon {
  /* Иконка часть Flex-потока, исчезает за счет width: 0 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0;
  opacity: 0;
  overflow: hidden;
  margin-left: 0;
  flex-shrink: 0;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  will-change: width, margin, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: scale(0);
  transition: width .35s cubic-bezier(.4, 0, .2, 1),
              margin-left .3s ease,
              opacity .3s ease,
              transform .35s cubic-bezier(.34,1.56,.64,1),
              background-color .2s ease;
}

.nav-pill.has-zip .pill-zip-icon {
  width: 26px;
  opacity: 1;
  margin-left: 6px; /* Отступ от текста, когда иконка видима */
  transform: scale(1);
  background: #C5A880;  /* ЦВЕТ ZIP иконки */
}

.pill-zip-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}
.pill-zip-icon:hover {
  background: rgba(255, 255, 255, 0.45);
}
