/* Оформление текстов страниц (.pr) и разметки c-*, которую создаёт backend/content/tidy.py
   (python manage.py tidy_pages). Работает и для текста, набранного в визуальном редакторе админки. */

/* ---------- Базовая типографика ---------- */
.pr {
  line-height: 1.7;
}

.pr:has(.c-docs, .c-people, .c-proj, .c-feature, .c-org, .c-table) {
  max-width: none;
}

.pr > :first-child {
  margin-top: 0;
}

.pr h2 {
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.25;
  margin: 44px 0 14px;
}

.pr h3 {
  font-size: 20px;
  line-height: 1.3;
  margin: 32px 0 10px;
}

.pr h4 {
  font-size: 16.5px;
  margin: 22px 0 8px;
}

.pr a:not([class]) {
  color: var(--sky-d);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.pr a:not([class]):hover {
  text-decoration-thickness: 2px;
}

.pr ul:not([class]),
.pr ol:not([class]) {
  margin: 0 0 18px;
  padding-left: 0;
  list-style: none;
}

.pr ul:not([class]) > li,
.pr ol:not([class]) > li {
  position: relative;
  padding-left: 30px;
  margin-bottom: 8px;
}

.pr ul:not([class]) > li::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sky-d);
}

.pr ol:not([class]) {
  counter-reset: li;
}

.pr ol:not([class]) > li {
  counter-increment: li;
}

.pr ol:not([class]) > li::before {
  content: counter(li);
  position: absolute;
  left: 0;
  top: 0.15em;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--sky-d);
  font: 700 12px/1 Inter, system-ui, sans-serif;
}

/* Выделенный жирный абзац («ВАЖНО! …») */
.pr .c-note {
  margin: 22px 0;
  padding: 16px 20px;
  border-left: 4px solid var(--sand);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--soft);
  font-weight: 600;
}

.pr .c-small {
  font-size: 14.5px;
  color: var(--mute);
}

/* ---------- Списки документов ---------- */
.c-docs {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.c-doc {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.c-doc:not(.c-doc--nofile):hover {
  border-color: var(--sky-d);
  box-shadow: 0 10px 28px rgba(15, 42, 67, 0.08);
}

.c-doc-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 52px;
  border-radius: 8px 14px 8px 8px;
  background: linear-gradient(160deg, var(--sky-d), var(--navy));
  color: #fff;
  font: 800 11px/1 Inter, system-ui, sans-serif;
  letter-spacing: 0.04em;
}

.c-doc-t {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  line-height: 1.45;
}

/* Размер файла (карточки, вставленные кнопкой «Документ» в редакторе) */
.c-doc-s {
  margin-left: 8px;
  color: var(--mute);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.c-doc-a {
  flex: none;
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--btn);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.c-doc-a:hover {
  background: var(--btn-hover);
}

/* Документ, файл которого не сохранился при переносе со старого сайта */
.c-doc--nofile {
  padding-left: 22px;
  background: var(--soft);
  border-style: dashed;
}

.c-doc--nofile .c-doc-t {
  color: var(--mute);
}

/* Архив (например, завершённые объявления) */
.c-more {
  margin: 8px 0 24px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}

.c-more > summary {
  cursor: pointer;
  padding: 16px 20px;
  font-weight: 700;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.c-more > summary::-webkit-details-marker {
  display: none;
}

.c-more > summary::after {
  content: '+';
  font-size: 22px;
  line-height: 1;
  color: var(--sky-d);
}

.c-more[open] > summary::after {
  content: '−';
}

.c-more > .c-docs {
  padding: 0 14px 14px;
  margin: 0;
}

/* ---------- Люди (правление, совет директоров) ---------- */
.c-people {
  display: grid;
  gap: 22px;
}

.c-person {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.c-person + .c-person {
  margin-top: 22px;
}

.c-people > .c-person + .c-person {
  margin-top: 0;
}

.pr .c-person-ph {
  width: 200px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: top;
  border-radius: 12px;
  background: var(--soft);
}

.pr .c-person h3 {
  margin: 0 0 4px;
  font-size: 22px;
}

.pr .c-person-pos {
  display: inline-block;
  margin: 0 0 14px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--sky-d);
  font-weight: 600;
  font-size: 14px;
}

.c-person-bio p {
  margin: 0 0 8px;
  font-size: 15.5px;
  color: var(--mute);
}

.pr .c-person-doc {
  margin-top: 14px;
}

.pr .c-person-doc a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.pr .c-person-doc a::before {
  content: 'PDF';
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--navy);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
}

.pr .c-person-doc a:hover {
  border-color: var(--sky-d);
}

/* ---------- Проекты ---------- */
.c-proj {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 28px;
  margin: 0 0 24px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.c-proj:not(:has(.c-gallery)) {
  grid-template-columns: 1fr;
}

.c-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-content: start;
}

.c-gallery a {
  display: block;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
}

.c-gallery a:first-child {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
}

.pr .c-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  transition: transform 0.4s ease;
}

.c-gallery a:hover img {
  transform: scale(1.05);
}

.pr .c-proj h3 {
  margin: 0 0 14px;
  font-size: 21px;
}

.c-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.c-meta-i {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--soft);
}

.c-meta dt {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mute);
}

.c-meta dd {
  margin: 2px 0 0;
  font-weight: 600;
  line-height: 1.45;
}

.c-proj-bd p {
  font-size: 15.5px;
}

/* ---------- Блок «текст + картинка» ---------- */
.c-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin: 0 0 24px;
  padding: 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.pr .c-feature h2 {
  margin: 0 0 12px;
  font-size: 21px;
}

.c-feature-im {
  margin: 0;
}

.pr .c-feature-im img {
  width: 100%;
  border-radius: 12px;
}

/* ---------- Оргструктура ---------- */
.c-chips {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.c-chips li {
  padding: 10px 16px;
  border-radius: 12px;
  background: linear-gradient(160deg, var(--sky-d), var(--navy));
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}

.c-org {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

.c-org-group {
  padding: 20px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--sand);
  border-radius: var(--r);
}

.c-org-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: org;
}

.c-org-list li {
  counter-increment: org;
  display: flex;
  gap: 12px;
  padding: 8px 0;
  font-weight: 500;
  line-height: 1.45;
}

.c-org-list li + li {
  border-top: 1px solid var(--line);
}

.c-org-list li::before {
  content: counter(org, decimal-leading-zero);
  flex: none;
  color: var(--sky-d);
  font-weight: 800;
  font-size: 13px;
  padding-top: 2px;
}

/* ---------- Таблицы ---------- */
.c-table {
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.pr .c-table table {
  margin: 0;
  min-width: 520px;
}

.pr .c-table th,
.pr .c-table td {
  border: 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.pr .c-table tr:last-child td {
  border-bottom: 0;
}

.pr .c-table thead th {
  background: var(--navy);
  color: #fff;
  font-size: 14px;
}

.pr .c-table tbody tr:nth-child(even) td {
  background: var(--soft);
}

@media (max-width: 760px) {
  .c-person,
  .c-proj,
  .c-feature {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }
  .pr .c-person-ph {
    width: 140px;
  }
  .c-doc {
    flex-wrap: wrap;
    gap: 12px;
  }
  .c-doc-ic {
    width: 38px;
    height: 44px;
  }
  .c-doc-t {
    flex-basis: calc(100% - 54px);
  }
  .c-doc-a {
    margin-left: 50px;
  }
}

/* ---------- Пресс-центр → Новости с Instagram (js/pages/instagram.js) ---------- */
.ig-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--soft);
}

.ig-acc {
  font:
    700 18px Montserrat,
    Inter,
    sans-serif;
}

.ig-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 18px;
}

.ig-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.ig-card:hover {
  transform: translateY(-3px);
  border-color: var(--sky-d);
  box-shadow: 0 16px 40px rgba(15, 42, 67, 0.12);
}

.ig-card:focus-visible {
  outline: 3px solid var(--sky-d);
  outline-offset: 2px;
}

.ig-im {
  position: relative;
  display: block;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--sky), var(--sand));
  overflow: hidden;
}

.ig-im img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.ig-card:hover .ig-im img {
  transform: scale(1.04);
}

.ig-type {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(9, 27, 44, 0.6);
  color: #fff;
}

.ig-bd {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
}

.ig-bd time {
  font-size: 13px;
  color: var(--mute);
}

.ig-cap {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.5;
}

.ig-more-wrap {
  margin-top: 26px;
  text-align: center;
}

/* окно с постом */
.ig-modal {
  width: min(1000px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  overflow: hidden;
}

.ig-modal::backdrop {
  background: rgba(9, 27, 44, 0.72);
}

.ig-m-in {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  max-height: calc(100dvh - 32px);
}

.ig-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(9, 27, 44, 0.65);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.ig-m-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
  background: #091b2c;
}

.ig-m-media img {
  width: 100%;
  max-height: calc(100dvh - 32px);
  object-fit: contain;
}

.ig-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: #0f2a43;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.ig-nav[data-d='-1'] {
  left: 12px;
}

.ig-nav[data-d='1'] {
  right: 12px;
}

.ig-count {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(9, 27, 44, 0.65);
  color: #fff;
  font-size: 13px;
}

.ig-play {
  position: absolute;
  inset: auto 0 18px;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  margin: 0 auto;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(9, 27, 44, 0.75);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.ig-m-bd {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px 26px 26px;
  overflow-y: auto;
}

.ig-m-bd time {
  font-size: 14px;
  color: var(--mute);
}

.ig-m-cap {
  flex: 1;
  font-size: 15.5px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.ig-m-cap a {
  color: var(--sky-d);
}

.ig-m-bd .btn {
  align-self: flex-start;
}

@media (max-width: 760px) {
  .ig-m-in {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .ig-m-media {
    min-height: 0;
  }
  .ig-m-media img {
    max-height: 60vh;
  }
  .ig-m-bd {
    overflow: visible;
  }
}

/* телефон — две колонки, как сетка в самом Instagram */
@media (max-width: 640px) {
  .ig-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .ig-bd {
    padding: 10px 11px 12px;
    gap: 4px;
  }
  .ig-bd time {
    font-size: 12px;
  }
  .ig-cap {
    font-size: 13.5px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
}

/* версия для слабовидящих: одна колонка, подпись крупнее и длиннее */
html.a11y .ig-grid {
  grid-template-columns: 1fr;
}

/* версия для слабовидящих: подпись в карточке длиннее */
html.a11y .ig-cap {
  -webkit-line-clamp: 6;
  line-clamp: 6;
}
