/* ============================================================
   Раздел «Абитуриентам» — собственные стили.

   Не зависит от Tailwind: бандл сайта содержит только те утилиты,
   которые были нужны при его сборке, и добавить новые нельзя без
   пересборки. Поэтому здесь обычный CSS на токенах дизайн-системы
   (dexrf-2.css), подключаемой на всех страницах.

   Mobile-first: базовые правила — для телефона, расширения в @media.
   ============================================================ */

/* ---------- Каркас ---------- */
.ab-wrap {
  width: 100%;
  max-width: 1060px;
  margin-inline: auto;
  padding-inline: 1rem;
}
.ab-narrow { max-width: 760px; }

@media (min-width: 640px) {
  .ab-wrap { padding-inline: 1.5rem; }
}

.ab-main { padding-block: 2.25rem 4rem; }
@media (min-width: 640px) { .ab-main { padding-block: 3.5rem 5rem; } }

/* ---------- Шапка ---------- */
.ab-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
}
/* Раскладка шапки: на узком экране навигация переносится на свою строку
   и прокручивается вбок, на широком — встаёт в один ряд с логотипом.
   Так на телефоне остаётся доступ ко всем разделам без бургер-меню. */
.ab-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .75rem;
  min-height: 3.5rem;
  padding-block: .5rem;
}
.ab-brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: -.01em;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.ab-brand-mark {
  width: 1.9rem; height: 1.9rem;
  flex: none;
  border-radius: 8px;
  background: var(--surface-3) center/contain no-repeat;
  border: 1px solid var(--border-strong);
}
.ab-brand .dim { color: var(--faint); }
.ab-brand .dot { color: #e2564f; }

.ab-nav {
  order: 3;                 /* на мобильном — отдельная строка под логотипом */
  width: 100%;
  display: flex;
  align-items: center;
  gap: .1rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ab-nav::-webkit-scrollbar { display: none; }
.ab-nav a {
  display: inline-block;
  flex: none;
  padding: .35rem .55rem;
  border-radius: 8px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .78rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color .12s ease, background-color .12s ease;
}
.ab-nav a:hover { color: var(--accent-2); }
.ab-nav a[aria-current="page"] { color: var(--accent-2); background: var(--accent-soft); }

@media (min-width: 700px) {
  .ab-nav { order: 0; width: auto; margin-left: auto; overflow: visible; }
  .ab-nav a { font-size: .8rem; padding: .4rem .6rem; }
  /* На широком экране кнопку прижимает уже навигация, свой отступ ей не нужен */
  .ab-cta { order: 1; margin-left: .5rem; }
}

.ab-cta {
  margin-left: auto;
  display: inline-block;
  padding: .4rem .75rem;
  border-radius: 8px;
  background: var(--accent);
  color: #08131f;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: filter .12s ease;
}
.ab-cta:hover { filter: brightness(1.07); }
:root[data-theme="light"] .ab-cta { color: #fff; }

/* ---------- Типографика ---------- */
.ab-crumbs {
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.ab-crumbs a { color: inherit; text-decoration: none; }
.ab-crumbs a:hover { color: var(--text); }
.ab-crumbs .sep { color: var(--faint); margin-inline: .35rem; }

.ab-h1 {
  font-size: clamp(1.6rem, 5vw, 2.3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.022em;
  color: var(--text);
  margin: 0;
}
.ab-lead {
  margin: .85rem 0 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 62ch;
}
.ab-h2 {
  font-size: 1.2rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -.014em;
  color: var(--text);
  margin: 0 0 .75rem;
}
.ab-h3 {
  font-size: 1rem;
  font-weight: 620;
  color: var(--text);
  margin: 0 0 .4rem;
}
.ab-p { margin: 0 0 .9rem; line-height: 1.72; color: var(--body); }
.ab-section { margin-top: 2.75rem; }
@media (min-width: 640px) { .ab-section { margin-top: 3.5rem; } }

.ab-list { margin: .5rem 0 1rem; padding-left: 1.15rem; }
.ab-list li { margin-bottom: .45rem; line-height: 1.68; color: var(--body); }

/* ---------- Карточки ---------- */
.ab-card {
  display: block;
  padding: 1.05rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, transform .15s ease, background-color .15s ease;
}
a.ab-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--surface-2);
  transform: translateY(-2px);
}
.ab-grid {
  display: grid;
  gap: .8rem;
  grid-template-columns: 1fr;
}
@media (min-width: 620px)  { .ab-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 940px)  { .ab-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

.ab-card-eyebrow {
  display: flex; align-items: center; gap: .45rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .72rem;
  color: var(--accent-2);
  margin-bottom: .35rem;
}
/* Карточка целиком — ссылка, поэтому её части это span: задаём блочность явно */
.ab-card-title { display: block; font-size: .98rem; font-weight: 620; color: var(--text); line-height: 1.35; }
.ab-card-desc  { display: block; margin-top: .35rem; font-size: .84rem; line-height: 1.6; color: var(--muted); }

/* ---------- Иконки ---------- */
.ab-icon { width: 1em; height: 1em; flex: none; stroke: currentColor; fill: none;
           stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ab-icon-lg { width: 1.25rem; height: 1.25rem; }

/* ---------- Заметка / предупреждение ---------- */
.ab-note {
  display: flex; gap: .7rem;
  margin: 1.25rem 0;
  padding: .85rem 1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 9px 9px 0;
  background: var(--accent-soft);
  font-size: .875rem;
  line-height: 1.65;
  color: var(--body);
}
.ab-note .ab-icon { margin-top: .18rem; color: var(--accent); }
.ab-note strong { color: var(--text); font-weight: 620; }
.ab-note.warn { border-left-color: var(--amber); background: color-mix(in srgb, var(--amber) 9%, transparent); }
.ab-note.warn .ab-icon { color: var(--amber); }

/* ---------- Таблица ---------- */
.ab-table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.ab-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.ab-table th {
  padding: .7rem .9rem;
  text-align: left;
  font-size: .7rem;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.ab-table td {
  padding: .7rem .9rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  color: var(--body);
  vertical-align: top;
  line-height: 1.55;
}
.ab-table tr:last-child td { border-bottom: 0; }
.ab-table .nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); }

/* ---------- Формы и фильтры ---------- */
.ab-filters { display: grid; gap: .7rem; margin-bottom: 1.4rem; }
@media (min-width: 720px) { .ab-filters { grid-template-columns: 2fr 1fr 1fr; align-items: end; } }
@media (min-width: 980px) { .ab-filters { grid-template-columns: 2fr 1.2fr 1fr 1fr; } }

/* Где учат — список заведений под специальностью */
.ab-where { grid-column: 2; margin-top: .5rem; padding-top: .5rem;
            border-top: 1px dashed var(--border); font-size: .8rem; }
.ab-where-title { color: var(--faint); text-transform: uppercase;
                  letter-spacing: .05em; font-size: .68rem; margin-bottom: .3rem; }
.ab-where ul { list-style: none; margin: 0; padding: 0; }
.ab-where li { margin-bottom: .25rem; line-height: 1.5; color: var(--body); }
.ab-where a { color: var(--accent-2); text-decoration: none; }
.ab-where a:hover { text-decoration: underline; }
.ab-where .score { color: var(--muted); }
.ab-where .prov { font-size: .68rem; color: var(--faint); border: 1px solid var(--border);
                  border-radius: 4px; padding: 0 .3rem; margin-left: .3rem; }


.ab-field label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: .35rem;
}
.ab-input, .ab-select {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color .12s ease;
}
.ab-input:focus, .ab-select:focus { outline: none; border-color: var(--accent); }
.ab-input::placeholder { color: var(--faint); }

/* Чипы-переключатели */
.ab-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.ab-chip {
  padding: .35rem .7rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: .8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all .12s ease;
}
.ab-chip:hover { color: var(--text); border-color: var(--accent); }
.ab-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #08131f;
  font-weight: 600;
}
:root[data-theme="light"] .ab-chip[aria-pressed="true"] { color: #fff; }

/* ---------- Результаты каталога ---------- */
.ab-count { font-size: .82rem; color: var(--muted); margin-bottom: .8rem; }
.ab-count b { color: var(--text); font-variant-numeric: tabular-nums; }

.ab-results { display: flex; flex-direction: column; gap: .5rem; }
.ab-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .25rem .85rem;
  padding: .8rem .95rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}
.ab-row-code {
  grid-row: span 2;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent-2);
  padding-top: .1rem;
  font-variant-numeric: tabular-nums;
}
.ab-row-name { font-size: .93rem; color: var(--text); line-height: 1.45; }
.ab-row-meta { font-size: .78rem; color: var(--muted); line-height: 1.5; }
.ab-row-meta .tag {
  display: inline-block;
  padding: .05rem .4rem;
  margin-right: .3rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: .72rem;
}
.ab-row.has-guide { border-color: color-mix(in srgb, var(--accent-2) 40%, transparent); }
.ab-row-guide {
  grid-column: 2;
  margin-top: .35rem;
  font-size: .78rem;
}
.ab-row-guide a { color: var(--accent-2); text-decoration: none; font-weight: 600; }
.ab-row-guide a:hover { text-decoration: underline; }

.ab-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
}

.ab-more {
  margin-top: 1rem;
  width: 100%;
  padding: .7rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--body);
  font-family: inherit;
  font-size: .87rem;
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease;
}
.ab-more:hover { border-color: var(--accent); color: var(--text); }

/* ---------- Кнопки ---------- */
.ab-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem 1.15rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #08131f;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 620;
  text-decoration: none;
  cursor: pointer;
  transition: filter .12s ease;
}
.ab-btn:hover { filter: brightness(1.07); }
.ab-btn:disabled { opacity: .45; cursor: not-allowed; }
:root[data-theme="light"] .ab-btn { color: #fff; }

.ab-btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--body);
}
.ab-btn-ghost:hover { border-color: var(--accent); color: var(--text); filter: none; }

/* ---------- Подвал ---------- */
.ab-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-block: 1.4rem;
  text-align: center;
  font-size: .7rem;
  line-height: 1.7;
  color: var(--faint);
}
.ab-footer a { color: inherit; text-decoration: underline; }
.ab-footer a:hover { color: var(--muted); }

/* ---------- Источники ---------- */
.ab-sources { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: 1.5rem; font-size: .75rem; }
.ab-sources .lbl { color: var(--faint); }
.ab-sources a {
  padding: .25rem .6rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--body);
  text-decoration: none;
}
.ab-sources a:hover { border-color: var(--accent); color: var(--text); }

/* ---------- Модалка «знаете заведение?» ---------- */
.ri-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  overflow-y: auto;
  background: color-mix(in srgb, #000 60%, transparent);
  backdrop-filter: blur(2px);
}
.ri-overlay.open { display: flex; }
.ri-modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 1.5rem 1.4rem 1.3rem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface, var(--bg));
  box-shadow: 0 20px 60px color-mix(in srgb, #000 35%, transparent);
}
.ri-close {
  position: absolute; top: .7rem; right: .8rem;
  width: 1.9rem; height: 1.9rem;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.ri-close:hover { background: var(--surface-2); color: var(--text); }
.ri-status { min-height: 1.2em; font-size: .82rem; color: var(--accent-2); margin: .6rem 0 0; }
.ri-alt { margin: 1rem 0 0; font-size: .78rem; color: var(--muted); }
.ri-alt a { color: var(--accent-2); text-decoration: none; }
.ri-alt a:hover { text-decoration: underline; }

/* ---------- Печать ---------- */
@media print {
  .ab-header, .ab-footer, .ab-filters, .ab-more { display: none !important; }
  .ab-main { padding: 0 !important; }
}
