/* =============================================
   ПЕРИОДИКА — assets/periodika.css
   Подключается только в periodika.php
   ============================================= */

.periodika-wrap {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 30px 40px;
}

.per-page-head { padding-bottom: 10px; margin-bottom: 20px; }
.per-page-title { font-size: 26px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.per-page-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 12px; }

.per-years-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.per-year-anchor { font-size: 14px; font-weight: 600; color: var(--muted); }
.per-year-anchor:hover { color: var(--red); }
.per-years-sep { color: var(--border); font-size: 14px; }

/* Секция года */
.per-section { margin-bottom: 14px; }

/* Заголовок года — как .sec-head на главной */
.per-section-head {
  border-bottom: 2px solid var(--navy);
  padding-bottom: 7px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.per-section-title { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1; }
.per-top-link { font-size: 14px; color: var(--muted); line-height: 1; white-space: nowrap; }
.per-top-link:hover { color: var(--red); }

/* Белый блок с сеткой */
.per-grid-wrap {
  background: var(--white);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  padding: 16px;
}

/* Ссылка под последним блоком */
.per-bottom-link { display: flex; justify-content: flex-end; padding-top: 10px; }
.per-bottom-link a { font-size: 14px; color: var(--muted); }
.per-bottom-link a:hover { color: var(--red); }

/* Сетка карточек */
.per-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  column-gap: 16px;
  row-gap: 28px;
}

/* Карточка — прозрачная, без рамки, без тени на блоке */
.per-card {
  cursor: pointer;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.per-card:hover { transform: none; box-shadow: none; }

/* Обложка — анимируется только она */
.per-card-cover {
  width: 100%;
  aspect-ratio: 3/4;
  background: #e8e8e8;
  overflow: hidden;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow .2s, transform .15s;
}
.per-card:hover .per-card-cover {
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  transform: translateY(-3px);
}
.per-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.per-card-noimg { font-size: 36px; opacity: .25; }

/* Текст под обложкой — не двигается, по центру */
.per-card-body { padding: 8px 0 0; width: 100%; text-align: center; }
.per-card-name { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.35; margin-bottom: 3px; }
.per-card-meta { font-size: 11px; color: var(--muted); }

.per-empty { text-align: center; color: var(--muted); font-size: 16px; padding: 40px 0; }

/* =============================================
   МОДАЛЬНОЕ ОКНО
   ============================================= */

.per-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.per-modal.open { display: flex; }

.per-modal-box {
  display: flex;
  flex-direction: row;
  height: 90vh;
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 16px 60px rgba(0,0,0,.5);
  position: relative;
}

.per-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color .15s;
}
.per-modal-close:hover { color: var(--red); }

/* Картинка — вся высота окна минус отступы, ширина по пропорции А4 автоматически */
.per-modal-cover {
  flex: 0 0 auto;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}
.per-modal-cover img {
  max-height: 100%;
  width: auto;
  display: block;
  border-radius: 3px;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}

/* Правая панель */
.per-modal-body {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px 24px;
}
.per-modal-year { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.per-modal-name { font-size: 20px; font-weight: 700; color: var(--navy); line-height: 1.35; }
.per-modal-size { font-size: 14px; color: var(--muted); }
.per-modal-btn {
  display: inline-block;
  background: var(--red);
  color: var(--white) !important;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 4px;
  transition: opacity .15s;
  margin-top: 8px;
}
.per-modal-btn:hover { opacity: .88; }

@media (max-width: 600px) {
  .per-modal-box { flex-direction: column; height: auto; max-height: 96vh; width: 96vw; overflow-y: auto; }
  .per-modal-cover { height: auto; width: 100%; }
  .per-modal-cover img { width: 100%; height: auto; }
  .per-modal-body { width: 100%; padding: 16px; }
}

/* Адаптив сетки */
@media (max-width: 1100px) {
  .per-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
@media (max-width: 700px) {
  .periodika-wrap { padding: 10px 16px 30px; }
  .per-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); column-gap: 12px; row-gap: 22px; }
  .per-grid-wrap { padding: 12px; }
}
@media (max-width: 480px) {
  .periodika-wrap { padding: 10px 10px 24px; }
  .per-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); column-gap: 10px; row-gap: 18px; }
}

/* Адаптив модалки — на мобильном вертикально */
@media (max-width: 600px) {
  .per-modal { padding: 2vh 2vw; }
  .per-modal-box {
    flex-direction: column;
    width: 96vw;
    height: auto;
    max-height: 96vh;
    overflow-y: auto;
  }
  .per-modal-cover { flex: none; height: 60vw; }
  .per-modal-body { padding: 18px 16px; justify-content: flex-start; }
  .per-modal-name { font-size: 16px; }
}