/* =====================================================================
   Раздел «Научные специальности» — /abitur/aspirantura/nauchnye-spetsialnosti/
   Префикс всех классов: ns-
   JS в разделе нет.
   ===================================================================== */

.ns {
    --blue:      #0072bc;
    --blue-dark: #044c7f;
    --blue-deep: #032f52;
    --cyan:      #01a3d4;
    --red:       #e01c24;
    --ink:       #16242e;
    --muted:     #5d6f7c;
    --line:      #e2eaf0;
    --bg:        #f4f8fb;

    --wrap: 1180px;
    --r:    14px;

    color: var(--ink);
    font-size: 16px;
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
}

/* =====================================================================
   ЗАЩИТА ОТ ОБЩИХ СТИЛЕЙ САЙТА
   Шаблон навешивает position/float на ИМЕНА ТЕГОВ (header{position:fixed}
   и т. п.). Возвращаем блокам раздела нормальный поток, контейнерам —
   position: relative, чтобы чужой absolute не вылезал за свою секцию.
   ===================================================================== */

.ns, .ns section, .ns div, .ns ul, .ns li,
.ns a, .ns p, .ns span,
.ns h1, .ns h2, .ns h3, .ns h4 {
    position: static !important;
    float: none !important;
    top: auto !important; right: auto !important;
    bottom: auto !important; left: auto !important;
    max-width: none;
}

.ns, .ns .ns-section, .ns .ns-wrap, .ns .ns-hero,
.ns .ns-card, .ns .ns-tile, .ns .ns-note, .ns .ns-contacts {
    position: relative !important;
}

/* Если шаблон сделает блок ВЫШЕ раздела плавающим (хлебные крошки,
   заголовок страницы), содержимое раздела начнёт обтекать его и поедет.
   clear уводит раздел под все предшествующие floats. */
.ns { clear: both !important; }

/* Декор внутри раздела: одного !important мало — у защитного блока выше
   специфичность, поэтому в селекторе перечислены предки. */
.ns .ns-hero .ns-hero__deco {
    position: absolute !important;
    top: -180px !important;
    right: -120px !important;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(1,163,212,.38), rgba(1,163,212,0) 70%);
    pointer-events: none;
}

/* Шаблон сайта рисует заголовок страницы над контентом. Мы гасим его
   через SetTitle(''), но шаблон всё равно может вывести пустой <h1>.
   Правило узкое и подключается только на этой странице.
   Вернуть заголовок шаблона: 'template_title' => true в data.php. */
h1:empty { display: none !important; }

/* ---------------------------------------------------------------------
   СБРОС ОТСТУПОВ И СПИСКОВ

   Тонкое место. На сайте подключён Bootstrap, а он навешивает стили
   на ИМЕНА ТЕГОВ:  ul { padding-left: 2rem }, p { margin-bottom: 1rem },
   h1–h4 { margin-bottom: .5rem }, a { color: #0056b3 }.

   Сброс вида  :where(.ns) :where(ul)  имеет специфичность (0,0,0)
   и такому правилу ПРОИГРЫВАЕТ: у сеток карточек и плиток (они свёрстаны
   на <ul>) появлялся отступ слева 40 px и настоящие маркеры-точки
   поверх наших.

   Правильная форма — класс раздела СНАРУЖИ :where():

       .ns :where(ul)      → (0,1,0)  бьёт  ul  (0,0,1)
       .ns-depts           → (0,1,0)  ничья, побеждает то, что ниже

   Поэтому сброс стоит ВЫШЕ компонентов: при равной специфичности
   выигрывает правило, объявленное позже, то есть сам компонент.
   Форму `.ns ul` (0,1,1) не использовать — она перебьёт компоненты.
   --------------------------------------------------------------------- */

.ns :where(p, ul, ol, li, h1, h2, h3, h4) { margin: 0; padding: 0; }
.ns :where(ul, ol) { list-style: none; }
.ns :where(img, svg) { max-width: 100%; }
.ns :where(a) { color: inherit; text-decoration: none; }

.ns * { box-sizing: border-box; }

.ns-wrap {
    width: 100%;
    max-width: var(--wrap) !important;
    margin: 0 auto;
    padding: 0 20px;
}

.ns-nw { white-space: nowrap; }

.ns .ns-i { flex: 0 0 auto; vertical-align: middle; }

/* =====================================================================
   ШАПКА РАЗДЕЛА
   ===================================================================== */

/* Раздел встаёт в бутстрапову колонку .col-md-12 шириной ~1200 px, а не
   во всю ширину экрана: полосы шапки и «альтернативных» секций — это
   блоки внутри колонки, поэтому им нужны скруглённые углы, иначе они
   выглядят обрезанными. Проверено на живой странице 28.08.2026. */

.ns-hero {
    overflow: hidden;
    border-radius: var(--r);
    background: linear-gradient(135deg, var(--blue-deep) 0%, var(--blue-dark) 45%, var(--blue) 100%);
    color: #fff;
}

.ns-hero__inner { padding: 26px 20px 30px; }

.ns-hero__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 6px 12px 6px 8px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 999px;
    color: rgba(255,255,255,.9) !important;
    font-size: 14px;
    transition: background .15s, border-color .15s;
}

.ns-hero__back:hover {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.5);
}

.ns .ns-hero__title {
    margin: 0 0 12px;
    color: #fff;
    font-size: 40px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -.01em;
}

.ns-hero__lead {
    max-width: 780px !important;
    margin: 0 0 22px !important;
    color: rgba(255,255,255,.88);
    font-size: 17px;
    line-height: 1.6;
}

.ns-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}

.ns-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    transition: background .15s, border-color .15s, transform .15s;
}

.ns-btn--primary {
    background: var(--red);
    color: #fff !important;
    border: 1px solid var(--red);
}
.ns-btn--primary:hover { background: #c8161d; border-color: #c8161d; }

.ns-btn--ghost {
    background: rgba(255,255,255,.08);
    color: #fff !important;
    border: 1px solid rgba(255,255,255,.35);
}
.ns-btn--ghost:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.6); }

/* полоса счётчиков */
.ns-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding-top: 22px;
    border-top: 1px solid rgba(255,255,255,.2);
}

.ns-stat { display: flex; flex-direction: column; gap: 2px; }

.ns-stat__num {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    color: #fff;
}

.ns-stat__cap {
    font-size: 13px;
    line-height: 1.35;
    color: rgba(255,255,255,.75);
}

/* =====================================================================
   СЕКЦИИ
   ===================================================================== */

.ns-section { padding: 40px 0; background: #fff; }
.ns-section--alt {
    padding: 34px 0;
    border-radius: var(--r);
    background: var(--bg);
}

.ns-head { margin-bottom: 24px; }

.ns .ns-head__title {
    margin: 0 0 6px;
    color: var(--blue-dark);
    font-size: 26px;
    line-height: 1.25;
    font-weight: 700;
}

.ns-head__sub {
    max-width: 760px !important;
    color: var(--muted);
    font-size: 15px;
}

/* =====================================================================
   ПОЛОСА «ВСТУПИТЕЛЬНОЕ ИСПЫТАНИЕ»
   ===================================================================== */

.ns-note {
    display: flex;
    gap: 16px;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--cyan);
    border-radius: var(--r);
    background: #f7fbfe;
}

.ns-note__icon { color: var(--cyan); line-height: 0; padding-top: 2px; }
.ns-note__body { min-width: 0; }

.ns-note__text {
    margin-bottom: 12px !important;
    font-size: 15px;
    line-height: 1.6;
}

.ns-note__links,
.ns-contacts__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
}

.ns-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    color: var(--blue) !important;
    font-size: 15px;
    font-weight: 600;
}
.ns-inline:hover { color: var(--blue-dark) !important; text-decoration: underline; }
.ns .ns-i--tail { transition: transform .15s; }
.ns-inline:hover .ns-i--tail { transform: translateX(3px); }

/* =====================================================================
   ОБЛАСТИ НАУКИ И КАРТОЧКИ СПЕЦИАЛЬНОСТЕЙ
   ===================================================================== */

.ns-area { margin-bottom: 36px; }
.ns-area:last-child { margin-bottom: 0; }

.ns-area__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--line);
}

.ns-area__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: #e8f3fa;
    color: var(--blue);
}

.ns .ns-area__title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 21px;
    line-height: 1.3;
    font-weight: 700;
    color: var(--blue-dark);
}

.ns-area__code {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 6px;
    background: var(--blue-dark);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .01em;
}

.ns-area__count {
    flex: 0 0 auto;
    min-width: 30px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}
.ns-section--alt .ns-area__count { background: #fff; }

.ns-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.ns-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.ns-card:hover {
    border-color: #c9dcea;
    box-shadow: 0 6px 20px rgba(4,76,127,.08);
}

.ns-card__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.ns-card__code {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 7px;
    background: #e8f3fa;
    color: var(--blue-dark);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .01em;
}

.ns-seats { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }

.ns-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    white-space: nowrap;
}
.ns-chip--budget { background: #fdeaeb; color: var(--red); }
.ns-chip--paid   { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

.ns .ns-card__title {
    margin: 0 0 14px;
    min-height: 2.6em;              /* выравнивает блоки ниже в соседних карточках */
    font-size: 17px;
    line-height: 1.35;
    font-weight: 700;
    color: var(--ink);
}

.ns-card__block { margin-bottom: 14px; }

.ns-card__label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.ns-depts { display: flex; flex-direction: column; gap: 5px; }

/* Предки в селекторе обязательны: защитный блок выше по специфичности
   (.ns li = 0,1,1) и одним !important его не перебить — маркер уедет
   в верхний левый угол карточки. */
.ns .ns-depts .ns-depts__item {
    position: relative !important;
    padding-left: 15px;
    font-size: 14.5px;
    line-height: 1.45;
}
.ns-depts__item::before {
    content: '';
    position: absolute;
    left: 2px;
    top: .62em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cyan);
}
.ns-depts__item a { color: var(--blue) !important; }
.ns-depts__item a:hover { color: var(--blue-dark) !important; text-decoration: underline; }

.ns-card__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.ns-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 26px;
    color: var(--blue-dark) !important;
    font-size: 14px;
    font-weight: 600;
}
.ns-link:hover { color: var(--blue) !important; text-decoration: underline; }

/* =====================================================================
   ПЛИТКИ
   ===================================================================== */

.ns-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.ns-tile {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    height: 100%;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #fff;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.ns-tile:hover {
    border-color: #c9dcea;
    box-shadow: 0 6px 20px rgba(4,76,127,.08);
}

.ns-tile__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #e8f3fa;
    color: var(--blue);
}

.ns-tile__body { display: block; min-width: 0; flex: 1 1 auto; }

.ns-tile__title {
    display: block;
    margin-bottom: 3px;
    color: var(--blue-dark);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.ns-tile__text {
    display: block;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.ns .ns-i--tile { color: #a9bfcf; margin-top: 9px; transition: transform .15s, color .15s; }
.ns-tile:hover .ns-i--tile { color: var(--blue); transform: translateX(3px); }

/* =====================================================================
   КОНТАКТЫ
   ===================================================================== */

.ns-contacts {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 26px 40px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: #fff;
}

.ns .ns-contacts__title {
    margin: 0 0 8px;
    color: var(--blue-dark);
    font-size: 26px;
    line-height: 1.25;
    font-weight: 700;
}

.ns-contacts__sub {
    margin-bottom: 16px !important;
    color: var(--muted);
    font-size: 15px;
}

.ns-contacts__list { display: flex; flex-direction: column; gap: 14px; }

.ns-contacts__row { display: flex; align-items: flex-start; gap: 12px; }

.ns-contacts__ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: #e8f3fa;
    color: var(--blue);
}

.ns-contacts__val { font-size: 15px; line-height: 1.45; min-width: 0; }
.ns-contacts__val a { color: var(--blue) !important; font-weight: 600; }
.ns-contacts__val a:hover { text-decoration: underline; }

.ns-contacts__note {
    display: block;
    color: var(--muted);
    font-size: 13.5px;
}

/* =====================================================================
   АДАПТИВ
   ===================================================================== */

@media (max-width: 1024px) {
    .ns-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ns .ns-hero__title { font-size: 34px; }
}

@media (max-width: 860px) {
    .ns-cards { grid-template-columns: minmax(0, 1fr); }
    .ns .ns-card__title { min-height: 0; }
    .ns-contacts { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
    .ns-section { padding: 30px 0; }
    .ns-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
    .ns-stat__num { font-size: 26px; }
    .ns .ns-hero__title { font-size: 28px; }
    .ns-hero__lead { font-size: 16px; }
    .ns .ns-head__title, .ns .ns-contacts__title { font-size: 22px; }
    .ns .ns-area__title { font-size: 18px; }
    .ns-contacts { padding: 20px; }
    .ns .ns-hero .ns-hero__deco {
        top: -140px !important;
        right: -160px !important;
        width: 340px;
        height: 340px;
    }
}

@media (max-width: 560px) {
    .ns-tiles { grid-template-columns: minmax(0, 1fr); }
    .ns-btn { width: 100%; }
    .ns-seats { margin-left: 0; width: 100%; }
    .ns-note { flex-direction: column; gap: 12px; padding: 18px; }
}

/* На сенсорных экранах поднимаем мелкие ссылки до 44 px.
   На десктопе не трогаем — иначе отступы разъезжаются. */
@media (hover: none) and (pointer: coarse) {
    .ns-inline, .ns-link, .ns-depts__item a,
    .ns-contacts__val a, .ns-hero__back { min-height: 44px; }
    .ns-depts__item a, .ns-contacts__val a { display: inline-flex; align-items: center; }
    .ns-card__foot { gap: 0 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .ns * { transition: none !important; }
}
