/* Внутренние страницы: новость, направление, документы, структура, контакты, формы, 404. */

/* --- Контент (CKEditor) ---------------------------------------------------- */

.prose { font-size: var(--fs-body); line-height: var(--lh-body); max-width: 78ch; }
.prose > * + * { margin-top: var(--s-4); }
.prose h2 { font-size: var(--fs-h2); margin-top: var(--s-8); }
.prose h3 { font-size: var(--fs-h3); margin-top: var(--s-6); }
.prose ul, .prose ol { padding-left: var(--s-6); }
.prose li + li { margin-top: var(--s-2); }
.prose a { color: var(--c-primary); text-decoration: underline; text-underline-offset: 3px; }
.prose img { border-radius: var(--r-md); }
.prose blockquote { padding-left: var(--s-5); border-left: 4px solid var(--c-primary); color: var(--c-text-muted); }
.prose table { border: 1px solid var(--c-border); }
.prose th, .prose td { border: 1px solid var(--c-border); padding: var(--s-2) var(--s-3); text-align: left; }
.prose figure.table { overflow-x: auto; }

.page-cover { margin-bottom: var(--s-8); border-radius: var(--r-lg); overflow: hidden; }
.page-cover img { width: 100%; max-height: 460px; object-fit: cover; }

/* --- Карточки-блоки (О колледже, Абитуриентам) ---------------------------- */

.info-cards { display: grid; gap: var(--s-4); grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; margin-top: var(--s-8); }
.info-card {
  display: flex; align-items: flex-start; gap: var(--s-4); height: 100%;
  padding: var(--s-5); border-radius: var(--r-lg); background: var(--c-surface);
  transition: box-shadow var(--t-fast), background-color var(--t-fast);
}
a.info-card:hover { background: var(--c-primary-50); box-shadow: var(--sh-card); }
.info-card__icon { font-size: 36px; color: var(--c-primary); stroke-width: 1.5; }
.info-card__body { display: grid; gap: 4px; }
.info-card__title { font-size: 1.0625rem; font-weight: var(--fw-b); line-height: 1.25; letter-spacing: 0; }
.info-card__text { font-size: var(--fs-sm); color: var(--c-text-muted); line-height: 1.4; }
.info-card .round-btn { margin-left: auto; align-self: center; }

.link-rows { list-style: none; margin-top: var(--s-8); border-top: 1px solid var(--c-border); max-width: 780px; }
.link-row {
  display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-2);
  border-bottom: 1px solid var(--c-border); transition: background-color var(--t-fast);
}
.link-row:hover { background: var(--c-primary-50); }
.link-row__icon { font-size: 32px; color: var(--c-primary); stroke-width: 1.5; }
.link-row__title { font-weight: var(--fw-b); }
.link-row__text { font-size: var(--fs-sm); color: var(--c-text-muted); }
.link-row .icon--chev { margin-left: auto; color: var(--c-text-muted); font-size: 20px; }

.subpages { margin-top: var(--s-10); }
.subpages ul { list-style: none; display: grid; gap: var(--s-2); margin-top: var(--s-4); }
.subpages a { color: var(--c-primary); font-weight: var(--fw-sb); }
.subpages a:hover { text-decoration: underline; }

/* --- Новости ---------------------------------------------------------------- */

.filters { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-6); }
.news-grid { display: grid; gap: var(--s-6); grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; }
.news-card {
  position: relative; display: flex; flex-direction: column; height: 100%;
  border: 1px solid var(--c-border-soft); border-radius: var(--r-lg); overflow: hidden; background: #fff;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.news-card:hover { box-shadow: var(--sh-lift); transform: translateY(-2px); }
.news-card__media img, .news-card__placeholder { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--c-surface); }
.news-card__body { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5); flex: 1; }
.news-card__meta { display: flex; gap: var(--s-3); font-size: var(--fs-xs); color: var(--c-text-muted); }
.news-card__cat { color: var(--c-primary); font-weight: var(--fw-sb); }
.news-card__title { font-size: 1.125rem; line-height: 1.25; letter-spacing: 0; }
.news-card__title a::after { content: ""; position: absolute; inset: 0; }
.news-card__excerpt { font-size: var(--fs-sm); color: var(--c-text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); margin-top: var(--s-8); list-style: none; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
  padding: 0 var(--s-3); border-radius: var(--r-md); border: 1px solid var(--c-border); font-weight: var(--fw-sb);
}
.pagination a:hover { background: var(--c-primary-50); }
.pagination [aria-current="page"] { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

.empty { padding: var(--s-12) var(--s-4); text-align: center; color: var(--c-text-muted); }

.article { display: grid; gap: var(--s-6); max-width: 860px; }
.article__meta { display: flex; gap: var(--s-4); color: var(--c-text-muted); font-size: var(--fs-sm); align-items: center; }
.article__cover img { width: 100%; border-radius: var(--r-lg); max-height: 520px; object-fit: cover; }
.gallery { display: grid; gap: var(--s-3); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery a { display: block; border-radius: var(--r-md); overflow: hidden; }
.gallery img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; transition: transform var(--t-base); }
.gallery a:hover img { transform: scale(1.03); }
.other-news { margin-top: var(--s-12); }

/* --- Направления ------------------------------------------------------------ */

.dir-list { display: grid; gap: var(--s-5); grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; }
.dir-hero { display: grid; gap: var(--s-8); grid-template-columns: 1.1fr 1fr; align-items: start; }
.dir-hero__media img { width: 100%; border-radius: var(--r-lg); aspect-ratio: 3 / 2; object-fit: cover; }
.facts { display: grid; gap: 0; border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; margin-top: var(--s-6); }
.fact { display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-4) var(--s-5); }
.fact + .fact { border-top: 1px solid var(--c-border); }
.fact dt { color: var(--c-text-muted); }
.fact dd { margin: 0; font-weight: var(--fw-sb); text-align: right; }

/* --- Документы -------------------------------------------------------------- */

.doc-list { list-style: none; border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; }
.doc-row { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); transition: background-color var(--t-fast); }
.doc-row + .doc-row { border-top: 1px solid var(--c-border); }
.doc-row:hover { background: var(--c-primary-50); }
.doc-row__icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px;
  border-radius: var(--r-md); background: var(--c-primary-50); color: var(--c-primary); font-size: 24px;
}
.doc-row__title { font-weight: var(--fw-sb); }
.doc-row__meta { font-size: var(--fs-sm); color: var(--c-text-muted); }
.doc-row__dl { margin-left: auto; flex: none; color: var(--c-primary); font-size: 22px; line-height: 0; }

/* --- Структура -------------------------------------------------------------- */

.staff-grid { display: grid; gap: var(--s-5); grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; }
.staff-card {
  position: relative; display: flex; flex-direction: column; height: 100%;
  border: 1px solid var(--c-border-soft); border-radius: var(--r-lg); overflow: hidden; background: #fff;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.staff-card:hover { box-shadow: var(--sh-lift); transform: translateY(-2px); }
.staff-card__photo img, .staff-card__placeholder { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--c-surface); }
.staff-card__body { padding: var(--s-4) var(--s-5) var(--s-5); display: grid; gap: 4px; }
.staff-card__position { font-size: var(--fs-xs); color: var(--c-primary); font-weight: var(--fw-b); text-transform: uppercase; letter-spacing: 0.04em; }
.staff-card__name { font-size: 1.0625rem; font-weight: var(--fw-b); line-height: 1.25; }
.staff-card a::after { content: ""; position: absolute; inset: 0; }

.dept-list { display: grid; gap: var(--s-4); grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; }
.dept-card { padding: var(--s-6); border-radius: var(--r-lg); background: var(--c-surface); height: 100%; display: grid; gap: var(--s-3); align-content: start; }
.dept-card__title { font-size: 1.125rem; letter-spacing: 0; }
.dept-card__head { font-size: var(--fs-sm); color: var(--c-text-muted); }

.profile { display: grid; gap: var(--s-8); grid-template-columns: 320px 1fr; align-items: start; }
.profile__photo img { width: 100%; border-radius: var(--r-lg); aspect-ratio: 3 / 4; object-fit: cover; }
.profile__position { color: var(--c-primary); font-weight: var(--fw-b); margin-top: var(--s-2); }
.profile__contacts { list-style: none; display: grid; gap: var(--s-2); margin-top: var(--s-5); }

/* --- FAQ -------------------------------------------------------------------- */

.faq { max-width: 860px; display: grid; gap: var(--s-3); }
.faq details { border: 1px solid var(--c-border); border-radius: var(--r-lg); background: #fff; }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); cursor: pointer;
  padding: var(--s-4) var(--s-5); font-weight: var(--fw-sb); list-style: none; min-height: var(--tap);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { color: var(--c-primary); transition: rotate var(--t-fast); flex: none; }
.faq details[open] summary .icon { rotate: 180deg; }
.faq details[open] { border-color: var(--c-primary-200); }
.faq__answer { padding: 0 var(--s-5) var(--s-5); color: var(--c-text-muted); }

/* --- Контакты ---------------------------------------------------------------- */

.contact-grid { display: grid; gap: var(--s-8); grid-template-columns: 1fr 1.2fr; align-items: start; }
.contact-list { list-style: none; display: grid; gap: var(--s-6); }
.contact-list li { display: flex; gap: var(--s-4); }
.contact-list .icon { font-size: 28px; color: var(--c-primary); margin-top: 2px; stroke-width: 1.5; }
.contact-list h2 { font-size: var(--fs-sm); color: var(--c-text-muted); font-weight: var(--fw-sb); margin-bottom: 4px; letter-spacing: 0; }
.contact-list p, .contact-list a { font-size: 1.0625rem; font-weight: var(--fw-sb); }
.contact-list .contact-note { font-size: var(--fs-sm); font-weight: var(--fw-m); color: var(--c-text-muted); margin-top: 2px; }
.contact-list a:hover { color: var(--c-primary); }
.map {
  min-height: 420px; border-radius: var(--r-lg); overflow: hidden;
  /* схематичная подложка видна сразу, пока Leaflet и тайлы OpenStreetMap ещё грузятся */
  background: var(--c-surface) url("../img/map-placeholder.svg") center / cover no-repeat;
  border: 1px solid var(--c-border); position: relative; z-index: 0;
}
.map__fallback { padding: var(--s-6); color: var(--c-text-muted); }

/* --- Заявка ----------------------------------------------------------------- */

.apply { display: grid; gap: var(--s-8); grid-template-columns: minmax(0, 560px) 1fr; align-items: start; }
.form { display: grid; gap: var(--s-5); }
.apply__aside { padding: var(--s-6); border-radius: var(--r-lg); background: var(--c-primary-50); display: grid; gap: var(--s-3); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Поиск ------------------------------------------------------------------ */

.search-page__form { display: flex; gap: var(--s-3); max-width: 640px; margin-bottom: var(--s-8); }
.search-page__form input { flex: 1; min-height: 48px; padding: 0 var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-md); }
.result-group + .result-group { margin-top: var(--s-8); }
.result-group h2 { font-size: var(--fs-h3); margin-bottom: var(--s-3); }
.result-list { list-style: none; display: grid; gap: var(--s-2); }
.result-list a { display: block; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid var(--c-border); font-weight: var(--fw-sb); }
.result-list a:hover { background: var(--c-primary-50); border-color: var(--c-primary-200); }

/* --- Ошибки ----------------------------------------------------------------- */

.error-page { text-align: center; padding-block: var(--s-20); display: grid; gap: var(--s-5); justify-items: center; }
.error-page__code { font-size: clamp(4rem, 12vw, 8rem); font-weight: var(--fw-xb); color: var(--c-primary); line-height: 1; }
.error-page p { color: var(--c-text-muted); max-width: 46ch; }

/* --- Адаптив ----------------------------------------------------------------- */

@media (max-width: 1279px) {
  .staff-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-cards, .dept-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dir-hero, .contact-grid, .apply, .profile { grid-template-columns: 1fr; }
  .staff-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .news-grid, .info-cards, .dept-list, .dir-list, .gallery { grid-template-columns: 1fr; }
  .staff-grid { grid-template-columns: 1fr; }
}

/* --- Направления на странице списка / детали ---------------------------------- */
.dir-grid--page { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dir-card--tall { min-height: 168px; }
.dir-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1023px) { .dir-grid--three { grid-template-columns: 1fr; } }

/* --- Иконка файла: красный «лист» с подписью формата ------------------------ */
.doc-row__icon {
  position: relative; display: inline-flex; align-items: flex-end; justify-content: center; flex: none;
  width: 40px; height: 48px; padding-bottom: 7px; border-radius: 6px; background: var(--c-primary); color: #fff;
  font-size: 0; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.doc-row__icon::after {
  content: attr(data-ext); font-size: 0.6875rem; font-weight: var(--fw-xb); letter-spacing: 0.02em; line-height: 1;
}
.doc-row__icon:not([data-ext])::after, .doc-row__icon[data-ext=""]::after { content: "FILE"; }

.page-lead { font-size: var(--fs-lead); line-height: 1.5; max-width: 70ch; margin-bottom: var(--s-6); }
.page-cover + .page-lead, .page-head + .page-lead { margin-top: 0; }

/* --- AJAX: чипы, скелетоны, состояния ---------------------------------------- */
.chips--spaced { margin-bottom: var(--s-6); }
.chips--spaced + .chips--spaced { margin-top: calc(-1 * var(--s-3)); }
[data-results][aria-busy="true"] { cursor: progress; }

.skeleton-grid { display: grid; gap: var(--s-5); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.skeleton-grid--rows { grid-template-columns: 1fr; gap: var(--s-2); }
.skeleton--card { height: 300px; border-radius: var(--r-lg); }
.skeleton--row { height: 72px; border-radius: var(--r-lg); }
.skeleton--field { height: 48px; margin-bottom: var(--s-4); }
.alert--retry { align-items: center; justify-content: space-between; gap: var(--s-4); }

.load-more { display: flex; justify-content: center; margin-top: var(--s-6); }
.load-more [aria-disabled="true"] { opacity: 0.65; pointer-events: none; }

/* --- Живой поиск -------------------------------------------------------------- */
.search__group {
  padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-xs); font-weight: var(--fw-b);
  color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.search__item {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3);
  min-height: var(--tap); padding: 10px var(--s-3); border-radius: var(--r-sm);
  font-size: 0.9375rem; font-weight: var(--fw-m);
}
.search__item:hover, .search__item[aria-selected="true"] { background: var(--c-primary-50); color: var(--c-primary); }
.search__meta { color: var(--c-text-muted); font-size: 0.8125rem; white-space: nowrap; }
.search__state { padding: var(--s-4) var(--s-3); color: var(--c-text-muted); font-size: var(--fs-sm); }
.search__all { margin-top: var(--s-1); border-top: 1px solid var(--c-border); border-radius: 0 0 var(--r-sm) var(--r-sm); color: var(--c-primary); font-weight: var(--fw-sb); }

/* --- Модальное окно ----------------------------------------------------------- */
.modal {
  padding: 0; border: 0; border-radius: var(--r-xl); width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto;
  box-shadow: 0 24px 64px rgba(17, 17, 17, 0.35); color: var(--c-text);
}
.modal::backdrop { background: rgba(17, 17, 17, 0.55); backdrop-filter: blur(2px); }
.modal__panel { padding: var(--s-6); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); }
.modal__title { font-size: var(--fs-h2); }
.modal__close {
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap);
  margin: calc(-1 * var(--s-2)); border-radius: var(--r-md); font-size: 2rem; line-height: 1; color: var(--c-text-muted);
}
.modal__close:hover { background: var(--c-primary-50); color: var(--c-primary); }
.modal .alert { margin-bottom: var(--s-4); }

@media (max-width: 1023px) { .skeleton-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) {
  .skeleton-grid { grid-template-columns: 1fr; }
  .modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
}
