/* ============================================================
   1. Переменные и базовые стили
   ============================================================ */
:root{
  /* темный синий цвет акцентов и заголовков */
  --primary-dark: #13587a; 
  --primary-hover: #0d415c;
  --sidebar-link: #577da8;
  
  --sidebar-width: 320px;
  --content-bg: rgba(255, 255, 255, 0.97);
  --text: #2c3e50;
  --text-light: #666;
  --shadow: 0 4px 20px rgba(0,0,0,.08);
}

*,*::before,*::after{box-sizing:border-box}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
body{
  margin:0;
  font-family:'Segoe UI',-apple-system,BlinkMacSystemFont,'Helvetica Neue',Arial,sans-serif;
  line-height:1.65;color:var(--text);min-height:100vh;
}

/* Бекграунд */
body.custom-background{
  background-color:#ededed;
  background-image:url("../images/Background.jpg");
  background-position:left top;background-size:cover;
  background-repeat:no-repeat;background-attachment:fixed;
}

/* ============================================================
   2. Каркас
   ============================================================ */
.site{display:flex;flex-direction:column;min-height:100vh}
.site-content{flex:1;padding:2rem 0 3rem}
.site-layout{max-width:1280px;margin:0 auto;padding:0 2rem}
.site-layout.has-sidebar{
  display:grid;
  grid-template-columns:minmax(0,1fr) var(--sidebar-width);
  gap:2rem;align-items:start;
}

/* Header */
.site-header{
  background:rgba(255,255,255,.97);
  box-shadow:0 2px 8px rgba(0,0,0,.06);
  position:sticky;top:0;z-index:100;
}
.header-content{
  max-width:1280px;margin:0 auto;padding:1rem 2rem;
  display:flex;align-items:center;justify-content:space-between;min-height:70px;
}
.site-title{margin:0;font-size:1.4rem;font-weight:700;color:var(--primary-dark);}
.site-title a{color:var(--primary-dark);text-decoration:none;}

/* Стили статей */
.article-single{
  background:var(--content-bg);border-radius:12px;box-shadow:var(--shadow);
  padding:2.5rem;overflow:hidden;
}
.article-header{margin-bottom:2rem;}

.article-title, 
.article-body h2 {
  margin:0 0 1.5rem 0;
  font-size:1.8rem;
  color:var(--primary-dark);
  line-height:1.3;
  position:relative;
  padding-bottom:15px;
}

/* Короткая темная линия */
.article-title::before, 
.article-body h2::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 65px; /* Длина линии */
  height: 3px;
  background-color: var(--primary-dark);
  z-index: 2;
}

/* Длинная светлая линия на всю ширину */
.article-title::after, 
.article-body h2::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px; /* Смещено на 1px */
  height: 1px;
  background-color: #e2e2e2;
  z-index: 1;
}

/* Текст в центре (для главной) */
.wp-block-heading.has-text-align-center {
  text-align: center;
  margin-bottom: 0;
  font-size: 1.8rem;
  color: var(--primary-dark);
  position: relative;
  padding-bottom: 15px;
}
.wp-block-heading.has-text-align-center::before {
  content:''; position:absolute; left:0; bottom:0; width:65px; height:3px; background:var(--primary-dark); z-index:2;
}
.wp-block-heading.has-text-align-center::after {
  content:''; position:absolute; left:0; right:0; bottom:1px; height:1px; background:#e2e2e2; z-index:1;
}

/* Стили для параграфов */
.article-body p {
  margin: 0 0 1.25rem; 
  font-size: 1.05rem;
}

.article-body figure {
  margin: 1.5rem 0;
  width: 100%;
}

.article-body img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 0;
}

/* Если max-width, центрируем */
.article-body img[style*="max-width"] {
  margin: 0 auto;
}

/* Sidebar */
.widget-area{
  position:sticky;top:90px;
  display:flex;flex-direction:column;gap:.75rem;
}
.widget .wp-block-buttons{display:flex;flex-direction:column;gap:.5rem}
.widget .wp-block-button{width:100%}
.widget .wp-block-button__link{
  display:block;width:100%;
  padding:.9rem 1.2rem;border-radius:10px;
  background-color:var(--sidebar-link) !important;color:#fff !important;
  text-decoration:none;text-align:center;font-size:.95rem;line-height:1.4;
  transition:background-color .2s,transform .15s,box-shadow .2s;
  box-shadow:0 2px 6px rgba(87,125,168,.3);
  word-wrap:break-word;
}
.widget .wp-block-button__link:hover{
  background-color:#466a91 !important;transform:translateY(-1px);
}
.widget .wp-block-button__link.is-current{
  background-color:var(--primary-dark) !important; /* Темный цвет для активного пункта */
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.3),0 2px 6px rgba(0,0,0,.2);
}

/* Карта (Яндекс) и футер */
.map-wrapper{margin:2rem 0;border-radius:8px;overflow:hidden;box-shadow:var(--shadow);}
.map-wrapper iframe{display:block;width:100%;height:400px;border:0;}
.map-caption{text-align:center;font-size:.9rem;margin-top:.5rem;}

.site-footer{
  background:rgba(255,255,255,.95);padding:1.5rem 0;text-align:center;
  color:var(--text-light);border-top:1px solid rgba(0,0,0,.05);margin-top:auto;
}

/* Адаптив */
@media (max-width:900px){
  .site-layout.has-sidebar{grid-template-columns:1fr}
  .article-single{padding:1.5rem}
  .article-title::before, .article-body h2::before,
  .wp-block-heading.has-text-align-center::before { width: 50px; }
}


/* HOTLINK */
:root {
  --surface: #fbf8f2;
  --surface-strong: #e9e2d7;
  --text: #282622;
  --muted: #746f66;
  --primary: #24352f;
  --accent: #7a2f2f;
  --gold: #c9a227;
  --line: #d8d0c2;
  --shadow-lg: 0 30px 90px rgba(18,22,20,.22);
  --radius: 18px;
  --serif: Georgia, "Times New Roman", serif;
}

[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }

/* ---- Вьюер ---- */
.explore-viewer {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #1f2421;
  box-shadow: var(--shadow-lg);
  min-height: 520px;
}
.explore-viewer > img {
  width: 100%; height: 100%; min-height: 520px; object-fit: cover;
}
.explore-viewer .media-placeholder { position: absolute; inset: 0; min-height: 0; }

.media-placeholder {
  display: none;
  width: 100%; min-height: 420px; place-items: center; padding: 24px;
  text-align: center; color: var(--muted);
  font-family: var(--serif); font-size: 1.2rem;
  background:
    linear-gradient(135deg, rgba(255,255,255,.5), rgba(255,255,255,0)),
    repeating-linear-gradient(45deg, rgba(36,53,47,.03) 0, rgba(36,53,47,.03) 2px, transparent 2px, transparent 10px);
}
.media-missing .media-placeholder { display: grid; }

/* ---- Точки ---- */
.hotspot {
  --x: 50%; --y: 50%;
  position: absolute;
  left: var(--x); top: var(--y);
  width: 46px; height: 46px;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255,255,255,.96);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 8px rgba(201,162,39,.20), 0 6px 18px rgba(0,0,0,.28);
  color: #fff; font-weight: 800; z-index: 3;
  transition: transform .22s ease, box-shadow .22s ease;
}
.hotspot:hover,
.hotspot:focus-visible {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 0 0 10px rgba(201,162,39,.24), 0 8px 24px rgba(0,0,0,.34);
}
.hotspot-label {
  position: absolute;
  left: 50%; bottom: calc(100% + 13px);
  transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 220px;
  padding: 7px 10px; border-radius: 8px;
  background: rgba(18,22,20,.92); color: #fff;
  font-size: .75rem; line-height: 1.35; font-weight: 700;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.hotspot:hover .hotspot-label,
.hotspot:focus-visible .hotspot-label {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.viewer-help {
  position: absolute; left: 18px; bottom: 18px; z-index: 3;
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(18,22,20,.68);
  backdrop-filter: blur(10px);
  color: rgba(255,255,255,.9);
  font-size: .76rem;
}

/* ---- Модалка ---- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: none; place-items: center; padding: 20px;
  background: rgba(18, 22, 20, .68);
}
.modal.is-open { display: grid; }
.modal-panel {
  width: min(1040px, 100%);
  max-height: min(90vh, 920px);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: sticky; top: 16px; float: right;
  margin: 16px 16px 0 0;
  width: 42px; height: 42px;
  border: 1px solid var(--line); border-radius: 50%;
  background: rgba(251,248,242,.94);
  color: var(--primary); z-index: 2;
}
.modal-content {
  padding: 44px;
  display: grid; grid-template-columns: .95fr 1.05fr; gap: 32px;
}
.modal-image {
  aspect-ratio: 4 / 3;
  background: var(--surface-strong);
  border-radius: 14px; overflow: hidden;
  display: grid; place-items: center;
}
.modal-image img { width: 100%; height: 100%; object-fit: cover; }
.modal-image .media-placeholder { min-height: 100%; }
.modal-kicker { color: var(--accent); text-transform: uppercase; letter-spacing: .14em; font-size: .74rem; font-weight: 700; }
.modal-title { font-family: var(--serif); font-weight: 500; font-size: clamp(2rem, 4vw, 3.2rem); margin: 8px 0 18px; }
.modal-meta { color: var(--muted); margin-bottom: 22px; }
.modal-description { color: #4f4a43; white-space: pre-line; }
.modal-audio { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.modal-audio-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 9px; }
.modal-audio audio { width: 100%; }

@media (max-width: 900px) {
  .modal-content { grid-template-columns: 1fr; }
  .explore-viewer, .explore-viewer > img { min-height: 430px; }
}
@media (max-width: 600px) {
  .explore-viewer, .explore-viewer > img { min-height: 300px; }
  .hotspot { width: 40px; height: 40px; }
  .viewer-help { left: 10px; bottom: 10px; font-size: .7rem; }
  .modal-content { padding: 20px; }
  .modal-panel { max-height: 92vh; }
}

/* ============================================================
   ИНТЕРАКТИВНАЯ КАРТА (ХОТСПОТЫ)
   ============================================================ */
.interactive-map-container {
  margin: 2rem 0;
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.image-hotspots {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
}

.image-hotspots .main-image {
  width: 100%;
  height: auto;
  display: block;
}

/* Круглые маркеры */
.hotspot {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #d4b25e; /* Золотистый цвет как на макете */
  color: #fff;
  font-weight: bold;
  font-size: 16px;
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transform: translate(-50%, -50%);
  transition: transform 0.2s, background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hotspot:hover {
  transform: translate(-50%, -50%) scale(1.15);
  background: #c3a14d;
}

/* Легенда снизу */
.hotspots-legend {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #fcfcfc;
  border: 1px solid #eee;
  border-radius: 8px;
}

.hotspots-legend h3 {
  margin-top: 0;
  color: #333;
  font-family: Georgia, serif; /* Ближе к макету */
}

.legend-desc {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 1.5rem;
}

.legend-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.legend-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.legend-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: #d4b25e;
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
}

.legend-list strong { color: #333; }
.legend-list small { color: #888; }

/* ============================================================
   СТИЛИ ДЛЯ MEDIUM-ZOOM (ПЕРЕОПРЕДЕЛЕНИЕ)
   ============================================================ */
.medium-zoom-overlay {
  background: rgba(15, 15, 15, 0.85) !important;
  backdrop-filter: blur(5px) !important;
  -webkit-backdrop-filter: blur(5px) !important;
  z-index: 9999 !important;
}

.medium-zoom-image--opened {
  z-index: 10000 !important;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* Убираем старые стили лайтбокса, они больше не нужны */
.lightbox-overlay, .lightbox-close-btn, .lightbox-trigger {
  display: none !important;
}

/* ============================================================
   МОДАЛЬНОЕ ОКНО
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(40, 40, 40, 0.7);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background: #fdfdfc;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  transform: translateY(20px);
  transition: transform 0.3s;
  overflow: hidden;
  
  max-height: 90vh; 
  display: flex;
  flex-direction: column;
}

.modal-overlay.is-open .modal-window {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 15px; right: 15px;
  background: none;
  border: 1px solid #ccc;
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  z-index: 10;
  transition: background 0.2s;
}
.modal-close:hover { background: #eee; }

/* Сетка внутри окна */
.modal-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow-y: auto; 
}

.modal-image-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem; 
}

.modal-image-side img {
  width: 100%;
  height: 100%;
  
  object-fit: contain; 
  max-height: 500px; 
  border-radius: 8px;
}

.modal-text-side {
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
}

.modal-category {
  font-size: 0.8rem;
  letter-spacing: 1px;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.modal-text-side h2 {
  font-family: Georgia, serif;
  font-size: 2rem;
  color: #222;
  margin: 0 0 1rem 0;
  line-height: 1.2;
}

.modal-text-side p {
  color: #555;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Плеер */
.modal-audio-wrapper {
  margin-top: auto;
  border-top: 1px solid #eee;
  padding-top: 1.5rem;
}
.audio-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 0.8rem;
}
.modal-audio-wrapper audio {
  width: 100%;
  height: 40px;
  border-radius: 20px;
  background: #f0f2f5;
}

@media (max-width: 768px) {
  .modal-window {
    max-height: 95vh;
  }
  
  .modal-content {
    grid-template-columns: 1fr;
    padding: 1.5rem; 
  }
  
  .modal-image-side {
    padding: 0;
    margin-bottom: 1rem;
  }

  .modal-image-side img {
    height: auto;
    max-height: 300px;
    object-fit: contain;
  }
  
  .modal-text-side {
    padding: 0; 
  }
}

/* 2 изображения в ряд */
.wp-block-gallery {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important; /* 2 колонки */
  gap: 15px !important;                                      /* Промежуток между ними */
  margin: 2rem 0 !important;                                 /* Отступы сверху и снизу галереи */
}

.wp-block-gallery img {
  display: block !important;
  width: 100% !important;
  height: 280px !important;    /* Фиксированная высота, чтобы сетка была идеальной */
  object-fit: cover !important; /* Картинки будут подрезаться под размер, а не сжиматься */
  margin: 0 !important;        /* Сброс центрирования из .article-body */
  border-radius: 8px !important;
}

@media (max-width: 600px) {
  .wp-block-gallery {
    grid-template-columns: 1fr !important; /* На мобильных картинки станут друг под другом */
  }
  .wp-block-gallery img {
    height: auto !important; /* Убираем жесткую высоту, чтобы не обрезало */
    max-height: 300px;
  }
}

/* ============================================================
   МОБИЛЬНОЕ ВЫДВИЖНОЕ МЕНЮ (OFF-CANVAS) И КНОПКА
   ============================================================ */
.menu-toggle {
  display: none; /* Скрыта на десктопе */
  background: var(--primary-dark);
  color: #fff;
  border: none;
  padding: .6rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .95rem;
  align-items: center;
  gap: .5rem;
  font-family: inherit;
}

.menu-toggle-icon {
  display: inline-block; 
  width: 18px; 
  height: 2px; 
  background: #fff; 
  position: relative;
}
.menu-toggle-icon::before, 
.menu-toggle-icon::after {
  content: ''; 
  position: absolute; 
  left: 0; 
  width: 18px; 
  height: 2px; 
  background: #fff;
}
.menu-toggle-icon::before { top: -6px; }
.menu-toggle-icon::after { top: 6px; }

@media (max-width: 900px) {
  /* Меню мобил */
  .menu-toggle {
    display: flex;
  }

  /* сайдбар за правый край экрана */
  .widget-area {
    position: fixed !important;
    top: 0;
    right: -100%;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background: #f8f9fa;
    z-index: 200;
    transition: right 0.3s ease;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    gap: .75rem;
  }

  /* Класс, который добавляет JS при клике */
  .widget-area.is-open {
    right: 0;
  }

  /* Затемнение фона при открытом меню */
  body.menu-open::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    backdrop-filter: blur(2px);
  }

  /* Блокируем скролл страницы при открытом меню */
  body.menu-open {
    overflow: hidden;
  }

  /* Контент занимает всю ширину */
  .site-layout.has-sidebar {
    display: block; 
  }
}