/* Минималистичная тема: белый фон, спокойная типографика */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --border: #e8e8e8;
  --accent: #1a73e8;
  --radius: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #fff;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.top-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
}

.top-bar .brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.top-bar .brand:hover {
  opacity: 0.85;
  text-decoration: none;
}

/* Ссылка только по размеру логотипа (не на всю левую/правую колонку) */
.top-bar .brand-itclub {
  justify-self: start;
  width: fit-content;
  max-width: 100%;
}

.top-bar .brand-mgimo {
  justify-self: end;
  width: fit-content;
  max-width: 100%;
}

.top-bar .brand img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(280px, 48vw);
  max-height: clamp(44px, 14vw, 76px);
  object-fit: contain;
}

.top-bar .brand-mgimo img {
  max-width: min(340px, 55vw);
  max-height: clamp(83px, 25vw, 140px);
}

.menu-toggle {
  justify-self: center;
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  min-width: 44px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.menu-toggle:hover {
  background: #fafafa;
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.menu-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(255, 255, 255, 0.98);
  overflow: auto;
  padding: 4.5rem 1.5rem 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.menu-panel.is-open {
  opacity: 1;
  visibility: visible;
}

.menu-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  z-index: 210;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text);
}

.menu-inner {
  max-width: 560px;
  margin: 0 auto;
}

.menu-inner h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 1.75rem 0 0.5rem;
}

.menu-inner h2:first-child {
  margin-top: 0;
}

.menu-inner ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-inner li {
  margin: 0.35rem 0;
}

.menu-inner a {
  color: var(--text);
  font-weight: 500;
}

.menu-inner .sub {
  padding-left: 1rem;
  font-size: 0.95rem;
}

.menu-inner .sub a {
  font-weight: 400;
  color: var(--muted);
}

/* Портрет Эстер — по центру главной (не в шапке) */
.ester-orb-frame {
  margin: 0 0 1.25rem;
  padding: 0;
  border: none;
}

.ester-orb {
  display: block;
  width: clamp(7.5rem, 32vw, 12.5rem);
  height: clamp(7.5rem, 32vw, 12.5rem);
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 3px solid var(--border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  margin: 0 auto;
}

/* Главная: блок поиска */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem 3rem;
  min-height: calc(100vh - 64px);
}

.hero-intro {
  text-align: center;
  max-width: 520px;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: clamp(0.9rem, 3.8vw, 0.95rem);
  padding: 0 0.25rem;
}

.search-wrap {
  width: 100%;
  max-width: 584px;
}

.search-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  background: #fff;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.08);
}

.search-row input {
  flex: 1 1 140px;
  border: none;
  font-size: 16px;
  padding: 0.65rem 0;
  min-height: 44px;
  background: transparent;
  outline: none;
  color: var(--muted);
}

.search-row input::placeholder {
  color: #9aa0a6;
}

.dev-badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #f3f3f3;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
  margin-left: auto;
}

.page-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.page-head {
  margin-bottom: 0.25rem;
}

.page-main h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 1rem;
  line-height: 1.25;
}

/* Оглавление внутри раздела (уровень навигации) */
.page-toc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 1.1rem;
  margin: 1.25rem 0 1.75rem;
  background: #fafafa;
}

.page-toc > .page-toc-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.page-toc ol {
  margin: 0;
  padding-left: 1.2rem;
}

.page-toc > ol > li {
  margin: 0.4rem 0;
  line-height: 1.4;
}

.page-toc > ol > li > a {
  font-weight: 500;
  color: var(--text);
}

.page-toc .toc-sub {
  list-style: disc;
  margin: 0.35rem 0 0.35rem;
  padding-left: 1.1rem;
  font-size: 0.92rem;
}

.page-toc .toc-sub a {
  font-weight: 400;
  color: var(--muted);
}

/* Крупный раздел страницы: уровень 1 под заголовком h1 */
.content-section {
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.content-section:first-of-type {
  margin-top: 1.5rem;
  border-top: none;
  padding-top: 0;
}

.content-section > h2 {
  margin-top: 0;
  margin-bottom: 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #eaeaea;
  font-size: 1.2rem;
}

/* Подблок внутри раздела (уровень 2): статьи, карточки подразделений */
.subsection,
.page-main article.subsection {
  margin: 1.25rem 0;
  padding: 0 0 0 0.85rem;
  border-left: 3px solid #e8e8e8;
}

.subsection > h3:first-child,
.page-main article.subsection > h3:first-child {
  margin-top: 0;
}

.page-main h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.page-main h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 1.35rem 0 0.45rem;
  color: var(--text);
}

.page-main h4 {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 1rem 0 0.35rem;
  color: var(--muted);
}

/* Блоки FAQ по уровням программы (бак/маг/колледж) */
.faq-tier {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.faq-tier:first-of-type {
  margin-top: 0.5rem;
  border-top: none;
  padding-top: 0;
}

.faq-tier > h2 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid #eaeaea;
  font-size: 1.2rem;
}

.page-main p,
.page-main li {
  color: var(--text);
  margin: 0.5rem 0;
}

.page-main ul {
  padding-left: 1.25rem;
}

.page-main .muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.page-main .card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  background: #fafafa;
}

.page-main pre,
.requisites {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.fiz-schedule {
  font-size: 0.95rem;
}

.fiz-schedule > h3 {
  margin: 1.1rem 0 0.35rem;
  font-size: 1rem;
}

.fiz-schedule > h3:first-of-type {
  margin-top: 0;
}

.fiz-schedule .slot-label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0.65rem 0 0.2rem;
}

details {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
}

summary {
  cursor: pointer;
  font-weight: 500;
}

.faq-a {
  margin-top: 0.5rem;
  color: var(--text);
  font-size: 0.95rem;
}

.faq-a a {
  word-break: break-word;
}

.back-home {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

body.layout-stretch {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ——— Адаптация под мобильные ——— */
@media (max-width: 640px) {
  .top-bar {
    padding: 0.65rem 0.75rem;
    gap: 0.5rem;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .top-bar .brand img {
    max-width: min(220px, 44vw);
    max-height: clamp(40px, 13vw, 64px);
  }

  .top-bar .brand-mgimo img {
    max-width: min(260px, 52vw);
    max-height: clamp(73px, 23.3vw, 117px);
  }

  .menu-panel {
    padding: 4rem 1rem 1.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .menu-close {
    min-width: 44px;
    min-height: 44px;
    font-size: 1.75rem;
  }

  .page-main {
    padding: 1.25rem 1rem 2.5rem;
  }

  .page-main h1 {
    font-size: 1.45rem;
  }

  .search-row {
    border-radius: 24px;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
  }

  .search-wrap {
    padding: 0 0.15rem;
  }
}

@media (max-width: 380px) {
  .menu-toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .menu-toggle::before {
    content: "☰";
    font-size: 1.25rem;
    line-height: 1;
  }

  .dev-badge {
    flex-basis: 100%;
    text-align: center;
    margin: 0.15rem auto 0;
  }
}

@media (min-width: 381px) {
  .menu-toggle::before {
    content: none;
  }
}
