/* «Полезные материалы» (/materials/, /materials/lectures/, /materials/organizers/).
   Перестройка по фидбэку 24.11.2026 (S4): шапка с поиском → плитки разделов (одна навигация,
   без описаний и стрелок) → разделы по теме. Карточка — одна сетка полей.
   Токены — из tokens.css; шрифты --disp и --body приходят оттуда же. */

.mt {
  --mt-phys: var(--teal-600);
  --mt-geog: var(--terra-600);
  --mt-math: var(--violet-600);
  --mt-ai: var(--coral-600);                  /* на белом 5,5:1 */
  --mt-btn: var(--accent-600);
  --mt-contour: color-mix(in srgb, var(--sky) 18%, transparent);   /* линии рисунка в шапке, materials.js */
  --mt-radius: 18px;
  overflow-x: clip;
}
/* Отступ под шапку при переходе по якорю и при докрутке к элементу в фокусе (WCAG 2.4.11).
   scroll-behavior: auto — с плавной прокруткой Chrome на Shift+Tab недоезжает; плавный
   переход по плиткам задаёт materials.js. */
/* Снизу — запас под кнопку чата: в альбомной ориентации она закрывала элемент в фокусе. */
html:has(.mt) { scroll-padding-top: calc(var(--head-h, 64px) + 12px); scroll-padding-bottom: 96px; scroll-behavior: auto; }
/* tokens.css даёт :target { scroll-margin-top: 84px } — здесь он сложился бы с отступом выше. */
.mt :target { scroll-margin-top: 0; }
/* Атрибут hidden должен побеждать display из правил ниже. */
.mt [hidden] { display: none !important; }
.mt-wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.mt svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mt h1, .mt h2, .mt h3 { text-wrap: balance; margin: 0; }
/* :where — нулевой вес: сброс не перебивает цвет закрашенных кнопок (.mt-btn белым по акценту). */
:where(.mt) button { font: inherit; color: inherit; cursor: pointer; }
.mt :focus-visible { outline: 2px solid var(--mt-btn); outline-offset: 3px; border-radius: 6px; }
.mt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── шапка ── */
.mt-top { position: relative; overflow: hidden;
  background:
    radial-gradient(60% 70% at 85% 10%, color-mix(in srgb, var(--sky) 16%, transparent), transparent 70%),
    radial-gradient(50% 60% at 10% 90%, color-mix(in srgb, var(--teal) 14%, transparent), transparent 70%); }
.mt-topo { color: var(--mt-contour); position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 40%, transparent 95%);
  mask-image: linear-gradient(180deg, #000 40%, transparent 95%); }
.mt-top > .mt-wrap { position: relative; z-index: 1; }
.mt-hero { padding-top: 56px; padding-bottom: 28px; display: grid; gap: 18px; }
.mt-top.is-sub .mt-hero { padding-bottom: 36px; gap: 12px; }
.mt-hero h1 { font: 800 clamp(40px, 6.6vw, calc(80px * var(--k)))/.98 var(--disp); letter-spacing: -.035em; color: var(--ink); padding-bottom: .06em; }
.mt-crumbs a { display: inline-flex; align-items: center; min-height: 44px; font-size: calc(15px * var(--k)); font-weight: 500;
  color: var(--ink);   /* на узоре шапки --ink-soft местами давал 4,2:1 */ text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.mt-crumbs a:hover { color: var(--ink); text-decoration-color: currentColor; }
.mt-search { position: relative; max-width: 560px; display: block; }
.mt-search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.mt-search input { width: 100%; box-sizing: border-box; font: 400 calc(16px * var(--k))/1.4 var(--body); padding: 14px 16px 14px 48px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); box-shadow: var(--sh-sm); }
.mt-search input:focus { outline: 2px solid var(--mt-btn); outline-offset: 1px; }
.mt-found { margin: 0; min-height: 1.4em; font-size: calc(15px * var(--k)); color: var(--ink-soft); }

/* ── плитки разделов: иконка, крупное название, число (М2) ── */
.mt-map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding-bottom: 44px; }
.mt-tile { display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 16px; row-gap: 4px;
  align-items: center; padding: 18px 20px; min-width: 0; min-height: 44px;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-sm);
  color: var(--ink); text-decoration: none; transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s; }
@media (hover: hover) { .mt-tile:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--mt-btn); text-decoration: none; } }
.mt-tile-ic { grid-row: span 2; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--mist); color: var(--ink); }
.mt-tile strong { font: 700 clamp(19px, 1.9vw, calc(23px * var(--k)))/1.15 var(--disp); letter-spacing: -.01em; align-self: end; }
.mt-tile .mt-n { font: 500 calc(14px * var(--k))/1.2 var(--mono); color: var(--ink-soft); align-self: start; }
.mt-tile.is-ix { background: radial-gradient(70% 90% at 100% 0%, color-mix(in srgb, var(--sky) 45%, transparent), transparent 70%), var(--band);
  border-color: var(--band); color: var(--band-ink); }
.mt-tile.is-ix .mt-tile-ic { background: var(--card); color: var(--band); }
.mt-tile.is-ix .mt-n { color: var(--band-muted); }
/* «ИИ-симуляторы» не рвать по дефису: на телефоне переносилось «ИИ-» отдельной строкой. */
.mt-tile.is-ix strong { white-space: nowrap; }
/* 8 плиток: в три колонки «ИИ-симуляторы» шире (2 ячейки), в две — по одной, рядов без дыр.
   ponytail: держится на числе разделов (7 + симуляторы); при другом числе пересчитать span. */
.mt-tile.is-ix { grid-column: span 2; }
@media (max-width: 900px) { .mt-map { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mt-tile.is-ix { grid-column: auto; } }
/* Ряды одной высоты, когда название в две строки («Музеи и центры науки»); в одну колонку не нужно. */
@media (min-width: 561px) { .mt-map { grid-auto-rows: 1fr; } }
@media (max-width: 560px) {
  .mt-map { grid-template-columns: 1fr; gap: 10px; }
  /* «ИИ-симуляторы» не помещается рядом с числом на 360–375 px: число — второй строкой. */
  .mt-tile.is-ix { grid-template-columns: 44px minmax(0, 1fr); }
  .mt-tile.is-ix .mt-n { grid-column: 2; }
  .mt-tile { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-rows: auto; padding: 12px 16px; column-gap: 14px; }
  .mt-tile-ic { grid-row: auto; width: 44px; height: 44px; border-radius: 12px; }
  .mt-tile strong { font-size: calc(18px * var(--k)); align-self: center; }
  .mt-tile .mt-n { align-self: center; white-space: nowrap; font-size: calc(13px * var(--k)); }
}

/* ── разделы ── */
.mt-sec { padding: 64px 0; }
.mt-sec:nth-of-type(even) { background: var(--milk); }
.mt-sh { display: grid; gap: 8px; margin-bottom: 26px; max-width: 760px; }
.mt-sh h2 { font: 700 clamp(28px, 3.8vw, calc(42px * var(--k)))/1.1 var(--disp); letter-spacing: -.01em; color: var(--ink); }
/* Одна пометка о чужом материале — в шапке раздела, а не на каждой карточке (М4). */
.mt-mark { margin: 0; font-size: calc(16px * var(--k)); line-height: 1.5; color: var(--ink-soft); }
.mt-sub { font: 600 calc(18px * var(--k))/1.3 var(--disp); margin: 40px 0 16px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; color: var(--ink); }
.mt-sub small { font: 500 calc(13px * var(--k))/1.3 var(--mono); color: var(--ink-soft); }

/* темы лекций */
.mt-seg { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.mt-seg button { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; font-size: calc(14.5px * var(--k)); font-weight: 500; }
.mt-seg button i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.mt-seg button em { font-style: normal; font-size: calc(13px * var(--k)); color: var(--ink-soft); }
@media (hover: hover) { .mt-seg button:hover { border-color: var(--ink-soft); } }
.mt-seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); }
.mt-seg button[aria-pressed="true"] em { color: inherit; opacity: .8; }

/* ── карточки ── */
.mt-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); }
.mt-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--card); cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--mt-radius); box-shadow: var(--sh-sm);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
@media (hover: hover) { .mt-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); } }
.mt-card.is-flash { outline: 3px solid var(--mt-btn); outline-offset: 3px; }
/* Рамку фокуса обложки режет overflow карточки: рисуем её на самой карточке. */
.mt-thumb:focus-visible { outline: none; }
.mt-card:has(.mt-thumb:focus-visible) { outline: 2px solid var(--mt-btn); outline-offset: 3px; }
.mt-thumb { position: relative; display: block; aspect-ratio: 16 / 9; width: 100%; padding: 0; border: 0;
  overflow: hidden; cursor: pointer; text-decoration: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sky) 55%, var(--band)), var(--band)); }
.mt-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.mt-thumb.is-doc img { object-position: top center; }
@media (hover: hover) { .mt-card:hover .mt-thumb img { transform: scale(1.03); } }
/* Знак действия в левом нижнем углу (М9): по центру он закрывал лица на кадре. */
.mt-ico { position: absolute; z-index: 1; left: 12px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; background: var(--card); color: var(--ink);
  box-shadow: var(--sh-md); transition: transform .2s var(--ease); }
/* У документа надпись на титуле внизу слева — значок в правом верхнем углу. */
.mt-thumb.is-doc .mt-ico { left: auto; bottom: auto; right: 12px; top: 12px; }
.mt-ico svg { width: 20px; height: 20px; }
.mt-ico.is-play svg { fill: var(--ink); stroke: none; margin-left: 2px; }
@media (hover: hover) { .mt-thumb:hover .mt-ico { transform: scale(1.08); } }
.mt-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
/* Строка полей: тип · тема · длительность · год — у всех карточек в одном порядке (М5). */
.mt-facts { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; font: 500 calc(13px * var(--k))/1.4 var(--body); color: var(--ink-soft); }
/* Разделитель после поля, а не перед: при переносе строка не начинается с точки. */
.mt-facts > span:not(:last-child)::after { content: "·"; margin: 0 7px; color: var(--ink-soft); }
.mt-tag { display: inline-flex; align-items: center; font-weight: 600; color: var(--c); }
.mt-ct { font: 600 calc(17px * var(--k))/1.3 var(--body); color: var(--ink); margin: 0; text-wrap: balance; }
.mt-who { margin: 0; font-size: calc(14px * var(--k)); line-height: 1.4; color: var(--ink); font-weight: 500; }
.mt-note { margin: 0; font-size: calc(14.5px * var(--k)); line-height: 1.5; color: var(--ink-soft); }
.mt-actions { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.mt-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px;
  background: var(--mt-btn); color: var(--accent-ink); font-size: calc(14.5px * var(--k)); font-weight: 600; transition: filter .18s, transform .18s; }
.mt-btn svg { width: 17px; height: 17px; }
@media (hover: hover) { .mt-btn:hover { filter: brightness(1.12); transform: translateY(-1px); } }

/* Раздел с отдельной страницей: ссылка на весь список; «Показать ещё» — где такой страницы нет (М7). */
.mt [data-hide] { display: none !important; }
.mt-all, .mt-more { display: flex; width: fit-content; margin: 24px auto 0; min-height: 48px; padding: 0 24px; align-items: center;
  border-radius: 12px; border: 1px solid var(--ink); background: transparent; font-size: calc(15px * var(--k)); font-weight: 600; color: var(--ink); text-decoration: none; }
@media (hover: hover) { .mt-all:hover, .mt-more:hover { background: var(--ink); color: var(--card); text-decoration: none; } }

/* Результаты поиска с отдельных страниц: строка-ссылка, видна только при поиске. */
.mt-hits { display: grid; gap: 8px; margin-top: 12px; }
.mt-hits:not(:has(.mt-hit:not([data-hide]))) { display: none; }
.mt-hit { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 18px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
@media (hover: hover) { .mt-hit:hover { border-color: var(--mt-btn); text-decoration: none; } }
.mt-hit-t { display: grid; gap: 2px; min-width: 0; flex: 1; }
.mt-hit-t b { font-weight: 600; font-size: calc(15px * var(--k)); line-height: 1.35; }
.mt-hit-t small { font-size: calc(13.5px * var(--k)); line-height: 1.4; color: var(--ink-soft); }
.mt-hit svg { width: 20px; height: 20px; color: var(--ink-soft); }

/* ── «Организаторам»: оглавление по сессиям списком, без гармошки ── */
.mt-toc { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 2px; counter-reset: toc; max-width: 820px; }
.mt-toc li { counter-increment: toc; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.mt-toc li::before { content: counter(toc) "."; min-width: 1.6em; font: 500 calc(14px * var(--k))/1 var(--mono); color: var(--ink-soft); }
.mt-toc a { display: inline-flex; align-items: center; min-height: 44px; font-size: calc(16px * var(--k)); font-weight: 500; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.mt-toc a:hover { text-decoration-color: currentColor; }
.mt-toc small { font: 500 calc(13px * var(--k))/1.3 var(--mono); color: var(--ink-soft); }

/* ── поиск: пусто ── */
.mt-empty { padding-top: 32px; padding-bottom: 64px; color: var(--ink-soft); font-size: calc(16px * var(--k)); }
.mt-empty-sugg { display: flex; gap: 8px; flex-wrap: wrap; }
.mt-empty-sugg button { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }

/* Телефон: карточка строкой — обложка слева, текст справа (страница в 3–4 раза короче). */
@media (max-width: 600px) {
  .mt-wrap { padding-inline: 16px; }
  .mt-hero { padding-top: 32px; }
  .mt-sec { padding: 44px 0; }
  .mt-grid { grid-template-columns: 1fr; gap: 12px; }
  .mt-card { display: grid; grid-template-columns: 116px minmax(0, 1fr); }
  /* Кадр 4:3 сверху карточки: растянутый на всю высоту, он резал лица (М9). */
  .mt-thumb { aspect-ratio: 4 / 3; height: auto; align-self: start; }
  .mt-ico { left: 6px; bottom: 6px; width: 32px; height: 32px; }
  .mt-thumb.is-doc .mt-ico { right: 6px; top: 6px; }
  .mt-ico svg { width: 15px; height: 15px; }
  .mt-body { padding: 12px 14px; gap: 5px; }
  .mt-facts { font-size: calc(12.5px * var(--k)); }
  .mt-facts > span:not(:last-child)::after { margin: 0 5px; }
  .mt-ct { font-size: calc(16px * var(--k)); }
  .mt-note { font-size: calc(14px * var(--k)); }
}

/* ── просмотр по центру (видео, документ, интерактивная лекция) ──
   Перенесено из прежнего шаблона без изменения поведения: плеер ограничен и по
   высоте окна (замер 31.08.2026), документ и интерактив — в высоком окне. */
/* Выше кнопки и окна чата (bot.css: 9998/9999): иначе «Чем помочь?» лежит поверх плеера на телефоне. */
.vid-modal { position: fixed; inset: 0; z-index: 10000; display: none; align-items: center; justify-content: center;
  padding: 4vh 4vw; background: rgba(10, 20, 28, .94); }
.vid-modal.open { display: flex; animation: mtfade .22s var(--ease); }
@keyframes mtfade { from { opacity: 0 } to { opacity: 1 } }
.vid-modal-box { position: relative; width: min(1180px, 100%); max-width: calc((100dvh - 170px) * 16 / 9); }
.vid-modal-player { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: 14px; overflow: hidden; box-shadow: 0 30px 70px rgba(0,0,0,.5); }
.vid-modal-player iframe, .vid-modal-player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vid-modal-player video { object-fit: contain; background: #000; }
.vid-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; color: #fff; }
.vid-modal-head h3 { font: 500 calc(18px * var(--k))/1.3 var(--disp); color: #fff; margin: 0; }
.vid-modal-close { flex: none; width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center; }
.vid-modal-close:hover { background: rgba(255,255,255,.28); }
.vid-modal-close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }
.vid-modal-foot { margin-top: 12px; text-align: center; }
.vid-modal-foot a { color: rgba(255,255,255,.8); font: 400 calc(13px * var(--k))/1 var(--mono); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; }
.vid-modal-foot a:hover { color: #fff; }
.vid-modal.wide { padding: 1.5vh 1.5vw; }
.vid-modal.wide .vid-modal-box { width: min(1600px, 100%); max-width: none; }
.vid-modal.wide .vid-modal-head { margin-bottom: 8px; }
/* У документа нижняя ссылка «скачать файл» остаётся: Chrome на Android не показывает PDF в окне. */
.vid-modal.wide:not(.is-doc) .vid-modal-foot { display: none; }
/* Документ: колонка на высоту экрана — шапка, окно на остаток, ссылка «скачать файл» всегда видна. */
.vid-modal.is-doc .vid-modal-box { display: flex; flex-direction: column; height: calc(100dvh - 3vh); }
.vid-modal.is-doc .vid-modal-player.doc { flex: 1 1 auto; height: auto; min-height: 0; }
.vid-modal.is-doc .vid-modal-foot { flex: none; margin-top: 4px; }
@media (max-width: 700px) { .vid-modal.is-doc .vid-modal-box { height: 100dvh; } }
.vid-modal-player.tall, .vid-modal-player.doc { aspect-ratio: auto; height: calc(100dvh - 3vh - 64px); min-height: 420px; }
.vid-modal-player.doc, .vid-modal-player.doc iframe { background: var(--milk); }
.vid-modal-tools { display: flex; align-items: center; gap: 8px 14px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.vid-modal-tools a, .vid-modal-tools .vid-copy { color: rgba(255,255,255,.9); font: 400 calc(13px * var(--k))/1 var(--mono); text-decoration: none;
  background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
.vid-modal-tools a:hover, .vid-modal-tools .vid-copy:hover { color: #fff; text-decoration: underline; }
.vid-modal-tools[hidden], .vid-modal-tools a[hidden], .vid-modal-foot a[hidden] { display: none; }
@media (max-width: 700px) {
  .vid-modal, .vid-modal.wide { padding: 0; }
  .vid-modal-head { padding: 8px 10px 0 14px; }
  .vid-modal-head h3 { font-size: calc(16px * var(--k)); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  /* На телефоне из инструментов остаётся «скопировать ссылку»: учитель пересылает одну лекцию. */
  .vid-modal-tools a { display: none; }
  .vid-modal-player { border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mt-tile, .mt-card, .mt-thumb img, .mt-ico, .mt-btn { transition: none; }
  .mt-tile:hover, .mt-card:hover, .mt-btn:hover, .mt-thumb:hover .mt-ico { transform: none; }
  .mt-card:hover .mt-thumb img { transform: none; }
  .vid-modal.open { animation: none; }
}
