/* ===================================================================
   Кафедра неонатологии — стили
   Палитра: мятный (mint) основной акцент + коралловый и солнечный
   =================================================================== */
:root{
  --bg:        #FAFCFB;
  --surface:   #ffffff;
  --ink:       #1C2B24;   /* графит с зелёным подтоном */
  --ink-soft:  #5B6E64;
  --teal:      #12A17B;   /* основной акцент — мята (переменная не переименована, чтобы не трогать все селекторы) */
  --teal-deep: #0B7857;
  --teal-tint: #DDF6EC;
  --coral:     #F0855F;   /* тёплый акцент */
  --coral-deep:#D96B48;
  --coral-tint:#FDECE3;
  --sun:       #FFC34D;   /* солнечный акцент */
  --sun-deep:  #E8A317;
  --sun-tint:  #FFF4DC;
  --holiday:      #E23B3B; /* выходные/праздники в календаре занятий — отдельный от --coral true-red */
  --holiday-deep: #B92626;
  --holiday-tint: #FBE3E3;
  --line:      #E6EFEA;
  --line-soft: #EFF6F2;
  --line-strong:#CFE0D7;
  --shadow:    0 2px 8px rgba(20,50,40,.06), 0 12px 28px rgba(20,50,40,.07);
  --radius:    18px;
  --wrap:      1080px;
}
@font-face{font-family:'Nimbus Sans L'; src:url('fonts/nimbus-sans-regular.woff2') format('woff2'); font-weight:400; font-style:normal; font-display:swap}
@font-face{font-family:'Nimbus Sans L'; src:url('fonts/nimbus-sans-bold.woff2') format('woff2'); font-weight:700; font-style:normal; font-display:swap}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
/* Защита от горизонтальной прокрутки на мобильном: если какой-то элемент
   (например форма/ряд кнопок) всё же не впишется по ширине — контент
   обрежется по краю, а не растянет всю страницу вбок с "гуляющим" скроллом,
   который на телефоне гораздо заметнее и неприятнее.
   ВАЖНО: только на html, не на body — overflow-x:hidden на body превращает
   его в скролл-контейнер (per spec overflow-y computes to auto), а .site-head
   использует position:sticky относительно ближайшего скролл-контейнера —
   на body сработавший overflow-x сломал бы прилипание шапки при скролле. */
html{overflow-x:hidden}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:'Nimbus Sans L',system-ui,-apple-system,sans-serif;
  font-size:17px; line-height:1.65; -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{font-family:'Nimbus Sans L',Georgia,sans-serif; line-height:1.15; font-weight:700; color:var(--ink); margin:0 0 .5em}
h1{font-size:clamp(2rem,4vw,3rem); letter-spacing:-.01em}
h2{font-size:clamp(1.5rem,2.6vw,2.1rem)}
h3{font-size:1.25rem}
a{color:var(--teal); text-decoration:none}
a:hover{color:var(--teal-deep)}
p{margin:0 0 1rem}
img{max-width:100%}
.wrap{max-width:var(--wrap); margin:0 auto; padding:0 24px}
.skip{position:absolute; left:-9999px; top:0; background:var(--teal); color:#fff; padding:10px 16px; z-index:100}
.skip:focus{left:8px; top:8px}

/* Мелкие однотонные SVG-иконки внутри текста (заменяют emoji вроде 🕐📍👤📅
   везде по сайту — emoji рендерятся цветными и разными по стилю на разных
   ОС/браузерах, что не сочетается с минималистичной однотонной графикой
   остального сайта). currentColor — цвет наследуется из текста. */
.ic-inline{vertical-align:-3px; margin-right:1px; flex-shrink:0}

/* ---------- Шапка ---------- */
/* Уменьшена: было min-height 74px + двухстрочный бренд (имя+подзаголовок) —
   на десктопе это разрасталось в шапку на 2 строки навигации, на мобильном
   съедало заметную часть первого экрана. Подзаголовок (brand-sub) убран из
   шапки — он дублирует текст в hero-блоке сразу под шапкой; сама метка и
   пункты меню компактнее. */
.site-head{position:sticky; top:0; z-index:50; background:rgba(255,255,255,.88); backdrop-filter:blur(10px); border-bottom:1px solid var(--line)}
.head-inner{display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:44px; padding:8px 0}
.brand{display:flex; align-items:center; gap:8px; color:var(--teal); flex-shrink:0}
/* Раньше знак сидел в круглой мятной подложке (как аватар) — с непрозрачным
   логотипом это скрывало явную белую подложку файла, но с настоящим
   прозрачным PNG сам знак смотрится самостоятельно, круг вокруг только
   обрезает и мешает — форма знака не круглая, а вытянутая "Н". Без подложки,
   размер задаётся высотой — ширина подстраивается под пропорции файла. */
.brand-mark{display:flex; align-items:center; justify-content:center; flex-shrink:0; color:var(--teal-deep)}
.brand-mark svg{width:19px; height:19px}
.brand-mark img{height:38px; width:auto; display:block}
.brand-txt{display:flex; flex-direction:column; line-height:1.15}
.brand-name{font-family:'Nimbus Sans L',sans-serif; font-weight:600; font-size:1rem; color:var(--ink); white-space:nowrap}
.brand-sub{display:none}
.site-nav{display:flex; align-items:center; gap:0; flex-wrap:wrap; row-gap:2px}
.site-nav a{padding:5px 6px; border-radius:8px; font-size:.78rem; font-weight:500; color:var(--ink-soft); white-space:nowrap}
.site-nav a:hover{background:var(--teal-tint); color:var(--teal-deep)}
.site-nav a.active{color:var(--teal-deep); background:var(--teal-tint)}
/* Метка роли вошедшего («Преподаватель», «Зав. кафедрой», «Администратор»)
   заметно шире прежнего слова «Вход». Замер на живой странице: в строке
   меню оставалось всего 22px свободного места, поэтому метка съезжала на
   вторую строку и ломала шапку. Поэтому пункты меню чуть плотнее (.78rem,
   padding 5px 6px), а сама метка компактнее — проверено на 1280 и 1100px:
   меню остаётся в ОДНУ строку с любой из ролей. Ниже 1020px шапка и так
   переключается в вертикальное мобильное меню. */
.nav-admin{margin-left:5px; border:1px solid var(--line); color:var(--teal)!important;
           font-size:.73rem; padding:4px 9px; white-space:nowrap}
.nav-toggle{display:none; flex-direction:column; gap:5px; background:none; border:0; cursor:pointer; padding:8px}
.nav-toggle span{width:24px; height:2px; background:var(--ink); border-radius:2px}

/* ---------- Главный экран ----------
   Светлый герой с декоративными кругами (мятным и солнечным) вместо
   прежнего сплошного цветного баннера — по образцу согласованного макета:
   переносит акцент с заливки фона на сам контент (пилюля-эйебров, крупный
   тёмный заголовок, залитая мятой основная кнопка). */
.hero{position:relative; overflow:hidden; background:var(--surface)}
.hero .wrap{position:relative; z-index:2; padding-top:32px; padding-bottom:28px}
.hero-blob{position:absolute; right:-60px; top:-70px; width:280px; height:280px; border-radius:50%; background:var(--teal-tint); z-index:1; pointer-events:none}
.hero::after{content:''; position:absolute; right:90px; bottom:-90px; width:170px; height:170px; border-radius:50%; background:var(--sun-tint); z-index:1; pointer-events:none}
/* max-width:16ch раньше обрывал строку прямо у логотипа — "Кафедра
   Неонатологии" (20 симв.) в него не помещалось, и слово "…еонатологии"
   переносилось на вторую строку отдельно от знака-«Н». Заголовку тут не
   нужно ограничение по ширине строки (это не абзац текста), достаточно
   ширины самого .wrap. */
.hero h1{color:var(--ink); font-size:clamp(2.4rem,6vw,4rem); white-space:nowrap}
/* Официальный логотип (стилизованная "Н") встаёт на место буквы Н в слове
   "Неонатологии" в заголовке главной страницы — вместо отдельного вводного
   текста используем сам фирменный знак как часть словесного знака. Реальный
   текст остаётся доступным для скринридеров/SEO через .sr-only,
   видимая часть — просто картинка вместо буквы, без рамок/подложки. Крупнее
   (.98em, было .82em) и с бОльшим отступом, чтобы знак был хорошо виден, а
   не терялся мелкой деталью на фоне текста. */
.sr-only{position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0}
.h1-mark{height:.98em; width:auto; vertical-align:-.16em; margin:0 -.01em; display:inline-block}
/* На узких экранах "Кафедра Неонатологии" целиком не помещается в одну
   строку даже без max-width — nowrap на всём h1 такого не чинит, браузер
   всё равно ищет ближайшую точку разрыва и находит её сразу после
   картинки (там нет пробела, но замена-по-ширине у img всё равно даёт
   браузеру право перенести строку прямо перед следующим текстом). Поэтому
   nowrap ставим не на весь заголовок, а именно на пару "картинка+еонатологии"
   — тогда если ширины не хватает, переносится "Кафедра" целиком на свою
   строку, а не разрывается сам знак-«Н» и хвост слова. */
.h1-mark-word{white-space:nowrap}
@media (max-width:520px){.hero h1{white-space:normal; font-size:clamp(2.1rem,8vw,2.6rem)}}
.hero-lead{font-size:1.2rem; color:var(--ink-soft); max-width:54ch; margin-top:14px}
.hero-actions{display:flex; gap:14px; flex-wrap:wrap; margin-top:20px}

.btn{display:inline-flex; align-items:center; gap:9px; padding:13px 24px; border-radius:14px; font-weight:600; font-size:.96rem; border:1px solid transparent; cursor:pointer; transition:.16s; font-family:inherit}
.btn-primary{background:var(--teal); color:#fff}
.btn-primary:hover{background:var(--teal-deep); color:#fff}
.btn-ghost{background:var(--bg); color:var(--ink); border-color:var(--line-strong)}
.btn-ghost:hover{background:var(--teal-tint); color:var(--teal-deep); border-color:var(--teal-tint)}
.btn-teal{background:var(--teal); color:#fff}
.btn-teal:hover{background:var(--teal-deep); color:#fff}
.btn-sm{padding:8px 15px; font-size:.85rem}
.btn-line{background:transparent; border-color:var(--line); color:var(--ink-soft)}
.btn-line:hover{border-color:var(--teal); color:var(--teal)}

/* ---------- Секции страниц ----------
   Шапка внутренних страниц (.page-hero) раньше выглядела как отдельный
   компонент — свой градиент, свой эйебров без подложки — из-за чего при
   переходе Главная → Библиотека/Календарь фон и типографика заголовка
   визуально "прыгали". Теперь .page-hero — тот же светлый фон с кругом,
   что и .hero на главной, а .eyebrow — тот же класс-пилюля, что и
   hero-eyebrow (раньше это были два похожих, но разных правила). */
.page-hero{position:relative; overflow:hidden; background:var(--surface); padding:26px 0 22px; border-bottom:1px solid var(--line)}
.page-hero::before{content:''; position:absolute; right:-70px; top:-70px; width:220px; height:220px; border-radius:50%; background:var(--teal-tint); z-index:0; pointer-events:none}
.page-hero .wrap{position:relative; z-index:1}
.eyebrow{display:inline-flex; align-items:center; gap:6px; font-size:.75rem; letter-spacing:.06em; color:var(--teal-deep); font-weight:700; background:var(--teal-tint); padding:7px 14px; border-radius:20px; margin-bottom:16px}
.lead{font-size:1.12rem; color:var(--ink-soft); max-width:60ch; margin-top:10px}
.section{padding:26px 0}
.section-tint{background:var(--surface); border-top:1px solid var(--line); border-bottom:1px solid var(--line)}
.section-head{display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:16px; flex-wrap:wrap}
.section-head p{color:var(--ink-soft); margin:6px 0 0}

/* ---------- Карточки/сетки ---------- */
.grid{display:grid; gap:6px}
.grid-2{grid-template-columns:repeat(2,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-4{grid-template-columns:repeat(4,1fr)}
.card{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:24px; box-shadow:var(--shadow); transition:.18s}
.card:hover{transform:translateY(-2px); border-color:var(--line-strong)}
.card h3{margin-bottom:8px}
.card p{color:var(--ink-soft); font-size:.95rem; margin:0}

/* Раньше .feature держался на трюке padding:18px + margin:-18px (площадка
   для ховера "росла" за пределы своей ячейки, оставаясь на месте в потоке).
   При маленьком gap (6px, см. .grid) это стало реально наслаиваться на
   соседние плитки и их текст — отрицательный margin больше самого зазора.
   Сделал обычной карточкой в границах своей ячейки, как .card. */
.feature{display:flex; flex-direction:column; gap:12px; color:inherit; cursor:pointer; padding:22px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); transition:.16s}
.feature:hover{border-color:var(--line-strong); box-shadow:var(--shadow); transform:translateY(-2px)}
.feature .ic{width:46px; height:46px; border-radius:12px; background:var(--teal-tint); color:var(--teal-deep); display:grid; place-items:center}
.feature .ic svg{width:24px; height:24px}
.feature:nth-child(2) .ic{background:var(--sun-tint); color:var(--sun-deep)}
.feature:nth-child(3) .ic{background:var(--coral-tint); color:var(--coral-deep)}

/* секции библиотеки */
.sec-card{display:flex; flex-direction:column; height:100%}
.sec-card .count{font-size:.82rem; color:var(--coral-deep); font-weight:600; margin-bottom:6px}
.sec-card .go{margin-top:auto; padding-top:14px; font-weight:600; color:var(--teal)}

/* разделы библиотеки — те же плитки, что были в "Разделы материалов" на
   главной (счётчик/заголовок/описание), но кликабельные: раскрытая плитка
   растягивается на всю ширину сетки и показывает материалы внутри, соседние
   плитки остаются на месте. Нужно, потому что при 20-30 материалах в разделе
   плоский список на странице сразу становится нечитаемым. */
/* align-items:start на .lib-grid + min-height на summary вместо
   align-items:stretch + height:100% — раньше раскрытая плитка (grid-column:
   1/-1) зависела от того, как браузер стретчит grid-item на всю высоту
   ряда, а overflow:hidden на .lib-sec в паре с этим в части браузеров
   схлопывал контейнер и прятал материалы внутри при раскрытии. Теперь
   каждая карточка сама определяет свою высоту (min-height держит визуальную
   одинаковость закрытых плиток), никакой зависимости от stretch/overflow. */
.lib-grid{align-items:start}
.lib-sec{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); transition:.18s}
/* Высота ЗАКРЫТОЙ плитки — фиксированная (не min-height), а не "плавающая"
   от длины заголовка/описания: раньше короткие карточки были 190px, а с
   длинным заголовком/описанием — заметно выше их, сетка выглядела неровной.
   Заголовок и описание обрезаются многоточием (line-clamp) вместо того чтобы
   раздвигать карточку — так высота гарантированно одинаковая у всех плиток
   независимо от текста. Раскрытая плитка (.lib-sec[open]) высоту не наследует
   от summary — там своя раскладка ниже, этого не касается. */
.lib-sec summary{display:flex; flex-direction:column; height:270px; padding:24px; cursor:pointer; list-style:none}
.lib-sec summary::-webkit-details-marker{display:none}
.lib-sec summary:hover{background:var(--teal-tint)}
.lib-sec .count{font-size:.82rem; color:var(--coral-deep); font-weight:600; margin-bottom:6px}
.lib-sec h2{margin:0 0 8px; font-size:1.1rem; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden}
.lib-sec summary p{flex:1; margin:0; color:var(--ink-soft); font-size:.92rem; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden}
.lib-sec .go{display:flex; align-items:center; gap:6px; margin-top:16px; padding-top:14px; border-top:1px solid var(--line); font-weight:600; color:var(--teal)}
.lib-sec .go svg{transition:transform .2s}
.lib-sec[open]{grid-column:1/-1}
.lib-sec[open] .go svg{transform:rotate(180deg)}
.lib-sec-body{padding:0 24px 24px}

/* Список материалов — раньше это была одна колонка строк, и раздел вроде
   "Клинические рекомендации" с тремя десятками файлов растягивался в очень
   длинный список вниз. Плюс строки без ограничения высоты заголовка:
   короткое название — одна строка, длинное — две, и плитки в списке
   получались вперемешку разной высоты. Сетка карточек в несколько колонок
   (auto-fill minmax) сокращает список по вертикали в разы, а
   line-clamp:2 на названии держит все карточки одной высоты независимо от
   длины текста (длинные названия обрезаются многоточием, полностью видны
   в title-подсказке и на странице скачивания). */
.mat-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(230px,1fr)); gap:12px}
.mat{display:flex; flex-direction:column; padding:16px 18px; background:var(--surface); border:1px solid var(--line); border-radius:12px; transition:.15s}
.mat:hover{border-color:var(--line-strong)}
.mat .badge{flex-shrink:0; width:40px; height:40px; border-radius:9px; background:var(--teal-tint); color:var(--teal-deep); display:grid; place-items:center; font-size:.62rem; font-weight:700; letter-spacing:.03em; margin-bottom:12px}
.mat .meta{flex:1; min-width:0}
.mat .meta b{display:block; font-weight:600; color:var(--ink); line-height:1.32}
.mat .meta span{display:block; margin-top:6px; font-size:.82rem; color:var(--ink-soft)}
.mat .dl{flex-shrink:0; margin-top:14px}
.mat .dl .btn{width:100%; justify-content:center}

/* ---------- Новости ---------- */
.news-item{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:24px; margin-bottom:18px; box-shadow:var(--shadow)}
.news-item.pinned{border-left:4px solid var(--coral)}
.news-top{display:flex; align-items:center; gap:12px; margin-bottom:10px; flex-wrap:wrap}
.tag{font-size:.72rem; font-weight:600; letter-spacing:.04em; text-transform:uppercase; padding:4px 11px; border-radius:30px}
.tag-Расписание{background:var(--teal-tint); color:var(--teal-deep)}
.tag-Экзамены{background:var(--coral-tint); color:var(--coral-deep)}
.tag-Пересдача{background:#fbeee8; color:#b85539}
.tag-Объявление{background:#eef0e9; color:#5c6748}
.tag-default{background:var(--line-soft); color:var(--ink-soft)}
.news-date{font-size:.85rem; color:var(--ink-soft)}
.news-event{display:inline-flex; align-items:center; gap:6px; font-size:.88rem; font-weight:600; color:var(--coral-deep); margin-top:8px}
.news-body{color:var(--ink-soft); margin-top:6px; white-space:pre-line}
.news-file{display:inline-flex; align-items:center; gap:9px; margin-top:14px; padding:10px 15px; background:var(--teal-tint); border-radius:10px; font-size:.9rem; font-weight:600; color:var(--teal-deep)}
.news-file:hover{background:#CBEEDF}
.pin-flag{font-size:.72rem; font-weight:600; color:var(--coral-deep); display:inline-flex; align-items:center; gap:5px}

/* ---------- Сотрудники ---------- */
/* Карточка сотрудника — ссылка на отдельную страницу профиля (staff-view.php),
   а не аккордеон: раньше био разворачивалось лентой прямо в списке и теряло
   форматирование исходного текста; теперь список — просто витрина, вся
   информация с сохранённым форматированием — на своей странице. */
.staff-card{text-align:center; padding:28px 24px; display:flex; flex-direction:column; align-items:center; color:inherit; cursor:pointer}
.staff-card:focus-visible{outline:2px solid var(--teal); outline-offset:4px; border-radius:var(--radius)}
.staff-photo{width:148px; height:148px; border-radius:50%; object-fit:cover; background:var(--teal-tint); margin-bottom:16px; display:grid; place-items:center; color:var(--teal-deep); font-family:'Nimbus Sans L',sans-serif; font-size:2.6rem; font-weight:600}
/* цвет подложки для карточек без фото чередуется по трём акцентам, как в макете */
.staff-card:nth-child(3n+2) .staff-photo{background:var(--coral-tint); color:var(--coral-deep)}
.staff-card:nth-child(3n+3) .staff-photo{background:var(--sun-tint); color:var(--sun-deep)}
.staff-card h3{transition:.15s}
.staff-card:hover h3{color:var(--teal-deep)}
.staff-card .pos{color:var(--coral-deep); font-weight:600; font-size:.9rem; margin:4px 0}
.staff-card .deg{color:var(--ink-soft); font-size:.88rem}

/* ---------- Страница сотрудника ---------- */
.staff-view{display:flex; gap:32px; align-items:flex-start}
.staff-view-photo{width:180px; height:180px; border-radius:50%; object-fit:cover; background:var(--teal-tint); color:var(--teal-deep); display:grid; place-items:center; font-family:'Nimbus Sans L',sans-serif; font-size:3.2rem; font-weight:600; flex-shrink:0}
.staff-view-info{min-width:0}
.staff-view-info .pos{color:var(--coral-deep); font-weight:600; font-size:1.02rem; margin-top:6px}
.staff-view-info .deg{color:var(--ink-soft); font-size:.96rem; margin-top:2px}
/* Раньше bio выводилась через white-space:pre-line — один сплошной блок
   бледного текста без разделения на разделы. Теперь render_bio() в
   inc/helpers.php разбирает исходный текст на настоящие блоки (см. ниже:
   вводный абзац, заголовки разделов, обычные абзацы, списки), тут — только
   их оформление. */
.staff-view-bio{margin-top:20px; padding-top:20px; border-top:1px solid var(--line); color:#000; line-height:1.65}
.staff-view-bio .bio-lede{color:#000; font-weight:600; font-size:1.02rem; margin:0 0 16px}
/* Мятная плашка (--teal-tint/--teal-deep) — те же цвета, что у тегов-пилюль
   по остальному сайту (.pill, .cal-tag), а не нейтрально-серая, чтобы
   заголовок раздела читался как акцент сайта, а не просто "потусклее".
   display:table (не inline-block) — чтобы заголовок раздела всегда начинал
   свою строку и два заголовка подряд без содержимого между ними не вставали
   в один ряд. max-width:100% обязателен: без него у table-элемента ширина
   считается по НЕРАЗБИТОМУ тексту — длинный заголовок ("Повышение
   квалификации и профессиональная переподготовка") на телефоне раздвигал
   страницу шире экрана вместо переноса на новую строку. */
.staff-view-bio .bio-h{
  display:table; max-width:100%; margin:22px 0 10px; padding:5px 12px;
  background:var(--teal-tint); color:var(--teal-deep); border-radius:7px;
  font-family:inherit; font-size:.78rem; font-weight:700;
  text-transform:uppercase; letter-spacing:.04em;
}
.staff-view-bio .bio-h:first-child{margin-top:0}
.staff-view-bio .bio-p{margin:0 0 12px}
.staff-view-bio .bio-list{margin:0 0 16px; padding-left:22px; display:flex; flex-direction:column; gap:7px}
.staff-view-bio .bio-list li{list-style:disc}
.staff-view-ct{margin-top:18px; display:flex; flex-direction:column; gap:6px; font-size:.95rem}
@media (max-width:640px){
  .staff-view{flex-direction:column; align-items:center; text-align:center}
  .staff-view-bio{text-align:left}
}

/* ---------- Наши базы ---------- */
.base-card{display:flex; flex-direction:column; color:inherit; cursor:pointer; padding:0; overflow:hidden}
.base-card:focus-visible{outline:2px solid var(--teal); outline-offset:4px}
.base-photo{width:100%; aspect-ratio:16/10; object-fit:cover; background:var(--teal-tint); display:block}
.base-photo-fallback{display:grid; place-items:center; color:var(--teal-deep)}
.base-card h3{margin:18px 24px 4px}
.base-card p{margin:0 24px 20px; color:var(--ink-soft); font-size:.92rem; display:flex; align-items:center; gap:6px}
.base-card:nth-child(3n+2) .base-photo-fallback{background:var(--coral-tint); color:var(--coral-deep)}
.base-card:nth-child(3n+3) .base-photo-fallback{background:var(--sun-tint); color:var(--sun-deep)}

/* Фото — отдельная ссылка на Яндекс.Карты (клик по картинке = открыть
   карту с готовым адресом), название/адрес под ней — отдельная ссылка на
   страницу базы. Бейдж-подсказка виден всегда (не только по hover), чтобы
   на телефоне без наведения было понятно, что фото кликабельно. */
.base-photo-link{position:relative; display:block; color:inherit; text-decoration:none}
.base-photo-hint{position:absolute; left:12px; bottom:12px; display:inline-flex; align-items:center; gap:5px; background:rgba(11,20,17,.7); color:#fff; font-size:.72rem; font-weight:600; padding:5px 10px; border-radius:20px}
.base-card-info{display:block; color:inherit; text-decoration:none}
.base-card-info:hover h3{color:var(--teal-deep)}

.base-view{display:grid; grid-template-columns:1.1fr 1fr; gap:36px; align-items:start}
.base-view-photo{width:100%; border-radius:var(--radius); object-fit:cover; aspect-ratio:4/3; background:var(--teal-tint); color:var(--teal-deep)}
.base-view-photo.base-photo-fallback{display:grid; place-items:center}
.base-view-photo-link{position:relative; display:block; color:inherit; text-decoration:none; border-radius:var(--radius); overflow:hidden}
.base-view-photo-hint{position:absolute; left:16px; bottom:16px; display:inline-flex; align-items:center; gap:6px; background:rgba(11,20,17,.7); color:#fff; font-size:.82rem; font-weight:600; padding:7px 14px; border-radius:20px}
.base-view-addr{display:flex; align-items:center; gap:8px; font-weight:600; color:var(--coral-deep)}
.base-view-descr{margin-top:16px; padding-top:16px; border-top:1px solid var(--line); white-space:pre-line; color:var(--ink-soft)}
@media (max-width:760px){.base-view{grid-template-columns:1fr}}

/* ---------- FAQ ---------- */
.faq-item{background:var(--surface); border:1px solid var(--line); border-radius:12px; margin-bottom:12px; overflow:hidden}
.faq-item summary{padding:18px 22px; font-weight:600; cursor:pointer; list-style:none; display:flex; justify-content:space-between; gap:14px; align-items:center}
.faq-item summary::-webkit-details-marker{display:none}
.faq-item summary::after{content:'+'; font-size:1.4rem; color:var(--teal); flex-shrink:0; transition:.2s}
.faq-item[open] summary::after{transform:rotate(45deg)}
.faq-item .ans{padding:0 22px 20px; color:var(--ink-soft); white-space:pre-line}

/* ---------- Контакты/проза ---------- */
.prose{max-width:70ch}
.prose p{color:var(--ink-soft)}
.contact-grid{display:grid; grid-template-columns:1fr 1fr; gap:24px}
.contact-card{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:26px}
.contact-card .lbl{font-size:.78rem; text-transform:uppercase; letter-spacing:.1em; color:var(--ink-soft); font-weight:600}
.contact-card .val{font-size:1.1rem; margin-top:6px}

/* ---------- Подвал ---------- */
.site-foot{background:var(--teal-deep); color:#CFE9DC; margin-top:28px}
.foot-inner{display:grid; grid-template-columns:2fr 1.4fr 1fr; gap:34px; padding-top:34px; padding-bottom:24px}
.foot-name{font-family:'Nimbus Sans L',sans-serif; font-weight:600; font-size:1.2rem; color:#fff; margin-bottom:10px}
.foot-addr{font-size:.9rem; color:#A9D9C6}
.foot-links{display:flex; flex-direction:column; gap:8px}
.foot-links a{color:#CFE9DC; font-size:.92rem}
.foot-links a:hover{color:#fff}
.foot-contact{display:flex; flex-direction:column; gap:8px}
.foot-contact a{color:#CFE9DC}
.foot-contact a:hover{color:#fff}
.foot-bottom{display:flex; align-items:center; justify-content:space-between; gap:20px; padding-top:22px; padding-bottom:26px; border-top:1px solid rgba(255,255,255,.12); flex-wrap:wrap}
.foot-uni{display:flex; align-items:center; gap:13px; color:#CFE9DC}
.foot-uni:hover{color:#fff}
.foot-uni .uni-mark{color:#7FD1AE; flex-shrink:0; display:flex}
.foot-uni .uni-logo{height:44px; width:auto; background:#fff; padding:5px; border-radius:8px}
.uni-txt{display:flex; flex-direction:column; line-height:1.2}
.uni-short{font-weight:700; color:#fff; font-size:.95rem; letter-spacing:.02em}
.uni-full{font-size:.78rem; color:#A9D9C6}
.foot-copy{font-size:.85rem; color:#8FC7AC}
.foot-social{display:flex; align-items:center; gap:10px}
.foot-social a{display:flex; align-items:center; justify-content:center; width:36px; height:36px; border-radius:50%; background:rgba(255,255,255,.1); color:#CFE9DC; overflow:hidden; flex-shrink:0}
.foot-social a:hover{background:rgba(255,255,255,.2); color:#fff}
.foot-social img{width:100%; height:100%; object-fit:cover}
.foot-social .social-fallback{font-weight:700; font-size:.85rem}

/* ---------- Утилиты ---------- */
.empty{text-align:center; padding:50px 20px; color:var(--ink-soft)}
.empty svg{width:46px; height:46px; color:var(--line); margin-bottom:12px}
.flash{background:#e7f4ec; border:1px solid #b7dcc4; color:#1d6b3e; padding:13px 18px; border-radius:10px; margin-bottom:20px; font-size:.92rem}
.divider{height:1px; background:var(--line); margin:24px 0}

/* ---------- Адаптив ---------- */
@media (max-width:860px){
  .grid-3,.grid-4{grid-template-columns:repeat(2,1fr)}
  .foot-inner{grid-template-columns:1fr 1fr}
  .contact-grid{grid-template-columns:1fr}
}
/* Шапка: 9 пунктов меню + бренд + переключатель потока + иконки не помещаются
   в одну строку уже примерно с 1020px (не только на телефоне) -- именно
   из-за этого шапка "плыла" при неполноразмерном окне браузера. */
@media (max-width:1020px){
  .nav-toggle{display:flex}
  .site-nav{display:none; position:absolute; top:100%; left:0; right:0; background:var(--surface); flex-direction:column; align-items:stretch; padding:8px 0 14px; border-bottom:1px solid var(--line); gap:0}
  body.nav-open .site-nav{display:flex}
  .site-nav a{padding:12px 24px}
  /* Раньше переключатель темы и ссылка-поиск были маленькими квадратными
     кнопками фиксированной ширины (32px) — в раскрытом мобильном меню они
     оставались мелкими и прижатыми к левому краю, а не растягивались как
     остальные пункты, из-за чего правый край списка получался неровным
     ("плывёт"). Теперь на мобильном это такие же полноширинные строки, как
     остальные пункты меню, с подписью рядом с иконкой — единый ровный список
     от края до края с одинаковыми отступами. */
  .site-nav .theme-toggle, .site-nav .search-link{
    width:auto; height:auto; display:flex; align-items:center; gap:10px;
    padding:12px 24px; border:0; border-radius:0; margin-left:0; justify-content:flex-start;
  }
  .site-nav .nav-ctrl-label{display:inline; font-size:.95rem; font-weight:500; color:var(--ink-soft)}
  .stream-select{margin:0; width:100%; box-sizing:border-box; padding:12px 24px; border:0; border-top:1px solid var(--line); border-radius:0; background:var(--surface)}
  .nav-admin{margin:0; width:100%; box-sizing:border-box; padding:12px 24px; border:0; border-top:1px solid var(--line); border-radius:0; text-align:left}
}
@media (max-width:680px){
  .grid-2,.grid-3,.grid-4{grid-template-columns:1fr}
  .foot-inner{grid-template-columns:1fr}
  .foot-bottom{flex-direction:column; align-items:flex-start}
  .lib-sec summary{padding:18px; height:auto}
  .lib-sec-body{padding:0 18px 18px}
  .staff-photo{width:120px; height:120px}
  /* На телефоне подряд идёт несколько .section — одинаковый с десктопом
     отступ 26px сверху/снизу у каждой на коротком экране складывается в
     заметный "воздух" между блоками. Также сокращаем крупный паддинг у
     карточек/герой-блоков и огромную цифру обратного отсчёта (4.5rem =
     72px), которая на телефоне к тому же переезжает в самый верх страницы
     (см. .countdown{order:-1} в блоке 760px). */
  .section{padding:16px 0}
  .hero .wrap{padding-top:20px; padding-bottom:18px}
  .page-hero{padding:18px 0 16px}
  .card,.feature{padding:16px}
  .news-item{padding:16px}
  .countdown{padding:18px 20px}
  .cd-num{font-size:3rem; margin:4px 0}
  .empty{padding:30px 16px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important; scroll-behavior:auto!important}}

/* ---------- Печать / «скачать как PDF» (расписание) ----------
   Раньше единственным способом "скачать расписание" был .ics-файл — формат
   для календарных приложений, а не для чтения/печати; человек, ожидавший
   обычный документ, получал файл, который не знал как открыть. Кнопка
   "Скачать / распечатать расписание" (schedule.php) вызывает системную
   печать; в диалоге печати можно выбрать "Сохранить как PDF" — работает
   на компьютере и на телефоне (Android/iOS), не требует серверных
   PDF-библиотек. .ics остаётся отдельно — он по-прежнему нужен для
   "добавить событие в календарь телефона", это другая задача. */
.print-only{display:none}


/* ---------- Список занятий: одна карточка на день ---------- */
.day-card{display:flex; gap:16px; background:var(--surface); border:1px solid var(--line);
          border-radius:12px; padding:16px 18px; margin-bottom:12px; box-shadow:var(--shadow);
          transition:box-shadow .25s, border-color .25s}
.day-date{flex:0 0 54px; text-align:center; background:var(--teal-tint);
          border-radius:10px; padding:8px 0; align-self:flex-start}
.day-num{display:block; font-family:'Nimbus Sans L',sans-serif; font-size:1.55rem;
         font-weight:600; color:var(--teal-deep); line-height:1}
.day-wd{display:block; font-size:.7rem; text-transform:uppercase; letter-spacing:.06em;
        color:var(--teal); margin-top:3px}
.day-body{flex:1; min-width:0; display:flex; flex-direction:column; gap:12px}
.day-item{min-width:0}
/* Занятия одного дня разделяем тонкой чертой: видно, где заканчивается одно
   и начинается другое, но день по-прежнему читается как единое целое. */
.day-item + .day-item{border-top:1px dashed var(--line); padding-top:12px}
.day-line{display:flex; flex-wrap:wrap; align-items:center; gap:5px 10px;
          margin-bottom:5px; font-size:.83rem; color:var(--ink-soft)}
.day-group{font-weight:700; color:var(--teal-deep)}
.day-title{font-weight:600; color:var(--ink); line-height:1.35}
.day-teacher{margin-top:4px; font-size:.83rem; color:var(--ink-soft)}
.day-ics{display:inline-block; margin-top:8px; font-size:.8rem;
         font-weight:600; color:var(--teal-deep)}
/* Подсветка после перехода из календаря — чтобы глаз сразу нашёл нужный день. */
.day-flash{border-color:var(--teal); box-shadow:0 0 0 3px var(--teal-tint)}
@media (max-width:640px){
  .day-card{gap:12px; padding:13px 14px}
  .day-date{flex:0 0 44px; padding:6px 0}
  .day-num{font-size:1.3rem}
  .day-wd{font-size:.64rem}
}

/* ---------- Отработки ---------- */
.otr-card{display:flex; gap:18px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:20px 22px; margin-bottom:14px; box-shadow:var(--shadow)}
.otr-card.otr-past{opacity:.62}
.otr-date{flex-shrink:0; width:64px; text-align:center; background:var(--teal-tint); border-radius:12px; padding:10px 0; align-self:flex-start}
.otr-day{display:block; font-family:'Nimbus Sans L',sans-serif; font-size:1.7rem; font-weight:600; color:var(--teal-deep); line-height:1}
.otr-mon{display:block; font-size:.74rem; text-transform:uppercase; letter-spacing:.05em; color:var(--teal); margin-top:3px}
.otr-body{flex:1; min-width:0}
.otr-line{display:flex; align-items:baseline; gap:14px; flex-wrap:wrap; margin-bottom:8px}
.otr-line b{font-size:1.08rem}
.otr-time{font-size:.9rem; color:var(--coral-deep); font-weight:600}
.otr-row{display:flex; gap:9px; align-items:flex-start; color:var(--ink-soft); font-size:.94rem; margin-top:5px}
.otr-row .otr-ic{flex-shrink:0}
.otr-note{margin-top:10px; padding:10px 14px; background:var(--line-soft); border-radius:9px; font-size:.9rem; color:var(--ink-soft)}

/* ---------- Календарь занятий ---------- */
.cal-head{display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:18px; flex-wrap:wrap}
.cal-legend{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px}
.cal-tag{font-size:.74rem; font-weight:600; padding:3px 10px; border-radius:20px}
.k-Лекция{background:var(--teal-tint); color:var(--teal-deep)}
.k-Практика{background:#eef3e2; color:#4f6312}
.k-Зачёт{background:var(--coral-tint); color:var(--coral-deep)}
.k-Экзамен{background:#fbe3dc; color:#b23a1f}
.k-other{background:var(--line-soft); color:var(--ink-soft)}
/* minmax(0,1fr), а не голый 1fr — у grid-колонок неявный min-width:auto,
   то есть без этого колонка не сжимается уже своего контента. С реальным
   расписанием (событие на каждый день) это раздвигало сетку шире экрана на
   телефоне, и суббота/пятница уезжали за край — приходилось вручную
   уменьшать масштаб страницы, чтобы увидеть всю неделю. */
.cal-grid{display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:6px}
.cal-weekdays{margin-bottom:6px}
.cal-wd{text-align:center; font-size:.78rem; font-weight:600; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.04em; padding:4px 0}
.cal-cell{min-height:96px; min-width:0; background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:6px 7px; display:flex; flex-direction:column; gap:3px}
.cal-empty{background:transparent; border:0}
.cal-today{border-color:var(--coral); box-shadow:0 0 0 1px var(--coral)}
/* Выходные/праздники (суббота-воскресенье по умолчанию + вручную добавленные
   даты, минус объявленные рабочими — см. is_day_off() в inc/helpers.php и
   раздел «Настройки» в админке) — светло-красный фон, номер дня красным. */
.cal-dayoff{background:var(--holiday-tint)}
.cal-dayoff .cal-num{color:var(--holiday-deep)}
.cal-dayoff.cal-today{border-color:var(--holiday); box-shadow:0 0 0 1px var(--holiday)}
.cal-num{font-size:.82rem; font-weight:600; color:var(--ink-soft); margin-bottom:2px}
.cal-today .cal-num{color:var(--coral-deep)}
/* Плашка занятия: время отдельной строкой, ниже — группа и база рядом.
   Раскладка «в ряд с переносом», а не жёсткий столбик: где колонка широкая
   (компьютер), «ОП-604 ЕКПЦ» помещается в одну строку и клетка не растёт;
   где узкая (телефон) — база сама переезжает на третью строку. */
.cal-ev{display:flex; flex-wrap:wrap; align-items:baseline; gap:0 4px;
        line-height:1.2; padding:3px 6px; border-radius:6px; font-size:.72rem;
        overflow:hidden; min-width:0}
.cal-ev-t{font-weight:600; font-size:.68rem; opacity:.85; flex:0 0 100%}
.cal-ev-x{white-space:nowrap; overflow:hidden; text-overflow:ellipsis; overflow-wrap:break-word}
/* База (ЕКПЦ / ОММ / Онлайн / Кафедра) — рядом с группой, когда показаны все
   группы сразу. В такие дни практика идёт у нескольких групп и на разных
   базах, и без неё по календарю не понять, куда идти. Шрифт мельче названия
   группы, но не «на пределе»: слово короткое и читается даже на телефоне. */
.cal-ev-b{font-size:.63rem; font-weight:700; letter-spacing:.02em; opacity:.72;
          white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.cal-ev-click{cursor:pointer; position:relative}
.cal-ev-pop{
  position:absolute; left:0; top:100%; margin-top:4px; z-index:210;
  background:var(--ink); color:#fff; padding:8px 10px; border-radius:8px;
  font-size:.78rem; line-height:1.35; white-space:normal; width:max-content;
  max-width:240px; box-shadow:var(--shadow);
}
.cal-ev-pop-title{font-weight:600; margin-bottom:3px}
.cal-ev-pop-meta{opacity:.75; margin-bottom:3px}
.cal-ev-pop-group{color:var(--teal); font-weight:700; margin-bottom:5px; font-size:.82rem}

@media (max-width:680px){
  .cal-cell{min-height:auto; padding:5px}
  .cal-wd{font-size:.66rem}
  /* Боковые отступы урезаны до 2px: на 42-пиксельной колонке каждый пиксель
     идёт на текст, иначе «ЕКПЦ» не помещается по ширине. */
  .cal-ev{font-size:.64rem; padding:2px 2px}
  .cal-ev-x{white-space:normal}
  /* Многоточие тут вредно: «ЕКПЦ» превращалось в «ЕК…», то есть пропадала
     именно та буква, ради которой строку и добавили. Разрешаем перенос. */
  .cal-ev-b{font-size:.55rem; opacity:.85; white-space:normal;
            overflow:visible; text-overflow:clip; letter-spacing:0}
  .cal-num{font-size:.74rem}
  .otr-card{flex-direction:row}
  .mat{padding:14px 16px}
  /* Клетки узкие (7 колонок на всю ширину экрана) — попап шириной
     max-content от левого края чипа почти всегда вылезал бы за правый
     край экрана. На мобильном показываем его как фиксированную панель
     внизу экрана, а не как всплывашку рядом с клеткой. */
  .cal-ev-pop{
    position:fixed; left:12px; right:12px; top:auto; bottom:16px;
    width:auto; max-width:none; font-size:.86rem; margin-top:0;
  }
}

/* ---------- Тёмная тема ---------- */
[data-theme="dark"]{
  --bg:        #10201A;
  --surface:   #17281F;
  --ink:       #E7F2EC;
  --ink-soft:  #9DB6AA;
  --teal:      #3ECF9A;
  --teal-deep: #6FE0B8;
  --teal-tint: #163227;
  --coral:     #F0855F;
  --coral-deep:#F5A183;
  --coral-tint:#3A2318;
  --sun:       #FFC34D;
  --sun-deep:  #FFD87A;
  --sun-tint:  #2E2712;
  --holiday:      #FF6B6B;
  --holiday-deep: #FF9494;
  --holiday-tint: #3A1818;
  --line:      #24382E;
  --line-soft: #1C2E25;
  --line-strong:#31483C;
  --shadow:    0 1px 2px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.3);
}
[data-theme="dark"] .site-head{background:rgba(16,32,26,.9)}
[data-theme="dark"] .tag-Расписание,[data-theme="dark"] .k-Лекция{background:#123528;color:#7fe0b8}
[data-theme="dark"] .tag-Экзамены,[data-theme="dark"] .k-Зачёт{background:#3a2318;color:#f5a892}
[data-theme="dark"] .tag-Пересдача{background:#3a2318;color:#e8a085}
[data-theme="dark"] .k-Практика{background:#24300f;color:#a8c95f}
[data-theme="dark"] .k-Экзамен{background:#3a1a10;color:#e89070}
[data-theme="dark"] .site-foot{background:#0B1712}
[data-theme="dark"] img.uni-logo{background:#e8eded}

/* Переключатель темы */
.theme-toggle{background:none;border:1px solid var(--line);border-radius:8px;cursor:pointer;width:32px;height:32px;color:var(--ink-soft);margin-left:6px;display:inline-flex;align-items:center;justify-content:center;transition:.15s}
.theme-toggle:hover{background:var(--teal-tint);color:var(--teal)}
.theme-toggle svg{width:16px;height:16px}
.nav-ctrl-label{display:none}
.theme-moon{display:none}
[data-theme="dark"] .theme-sun{display:none}
[data-theme="dark"] .theme-moon{display:inline-flex}

/* ---------- Поиск ---------- */
.search-link{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid var(--line);border-radius:8px;margin-left:6px;text-decoration:none;color:var(--ink-soft)}
.search-link:hover{background:var(--teal-tint)}
.search-link svg{width:16px;height:16px}
.search-big{display:flex;gap:10px;max-width:620px;flex-wrap:wrap}
@media (max-width:520px){.search-big{flex-direction:column} .search-big button{width:100%}}
.search-big input{flex:1;padding:15px 18px;border:1px solid var(--line);border-radius:11px;font-family:inherit;font-size:1.02rem;background:var(--surface);color:var(--ink)}
.search-big input:focus{outline:none;border-color:var(--teal);box-shadow:0 0 0 3px var(--teal-tint)}
.search-res{display:flex;align-items:flex-start;gap:15px;padding:16px 18px;background:var(--surface);border:1px solid var(--line);border-radius:12px;margin-bottom:11px;transition:.15s;color:var(--ink)}
.search-res:hover{border-color:var(--teal);transform:translateX(2px)}
.search-ic{flex-shrink:0;width:42px;height:42px;border-radius:10px;background:var(--teal-tint);display:grid;place-items:center;font-size:1.2rem}
.search-meta{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.search-top{display:flex;align-items:center;gap:9px}
.search-type{font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--teal);background:var(--teal-tint);padding:2px 9px;border-radius:20px}
.search-sub{font-size:.82rem;color:var(--ink-soft)}
.search-meta b{font-size:1rem;color:var(--ink)}
.search-extra{font-size:.88rem;color:var(--ink-soft)}
.search-arrow{flex-shrink:0;color:var(--teal);font-size:1.2rem;align-self:center}

/* ---------- Виджет "Ближайшее" + обратный отсчёт ---------- */
.upnext{display:grid;grid-template-columns:1.7fr 1fr;gap:24px;align-items:start}
.upnext-main{}
/* карточка-список вместо отдельно обведённых строк — по образцу макета */
.upnext-list{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:6px 18px}
/* align-items:flex-start, а не center: в плитке дня может быть несколько
   занятий, и дата должна держаться верха, а не уезжать в середину столбика. */
.upnext-item{display:flex;gap:14px;align-items:flex-start;padding:14px 0;border-bottom:1px solid var(--line)}
/* Занятия одного дня разделяем тонкой чертой — видно, где кончается одно. */
.upnext-one + .upnext-one{margin-top:10px;padding-top:10px;border-top:1px dashed var(--line)}
.upnext-item:last-child{border-bottom:0}
.upnext-date{flex-shrink:0;width:48px;height:48px;border-radius:12px;display:flex;flex-direction:column;align-items:center;justify-content:center;background:var(--teal-tint)}
.upnext-date .d{font-family:'Nimbus Sans L',sans-serif;font-size:1.3rem;font-weight:600;line-height:1;color:var(--teal-deep)}
.upnext-date .w{font-size:.64rem;text-transform:uppercase;color:var(--teal);margin-top:2px}
.upnext-info{min-width:0}
.upnext-info b{display:block;font-size:.98rem}
.upnext-info span{font-size:.85rem;color:var(--ink-soft)}
.countdown{background:var(--sun-tint);color:var(--ink);border-radius:var(--radius);padding:26px 24px;display:flex;flex-direction:column;align-items:center;text-align:center;box-shadow:var(--shadow)}
.countdown.cd-exam{background:var(--coral-tint)}
.cd-label{font-size:.74rem;text-transform:uppercase;letter-spacing:.1em;color:var(--ink-soft)}
.cd-num{font-family:'Nimbus Sans L',sans-serif;font-size:4.5rem;font-weight:700;line-height:1;margin:6px 0;color:var(--sun-deep)}
.countdown.cd-exam .cd-num{color:var(--coral-deep)}
.cd-days{font-size:.9rem;color:var(--ink-soft);margin-bottom:14px}
.cd-what{font-weight:600;font-size:1rem;line-height:1.3;color:var(--ink)}
.cd-date{font-size:.85rem;color:var(--ink-soft);margin-top:4px}
@media (max-width:760px){.upnext{grid-template-columns:1fr}.countdown{order:-1}}


/* ══════════════════════════════════════════════════════════════════════
   ПЕЧАТЬ — строго последним блоком в файле.

   Здесь он оказался не для красоты. Раньше @media print стоял в середине,
   ДО обычных правил календаря (.cal-cell, .cal-ev и мобильных). Специфичность
   у них одинаковая, а при равной специфичности побеждает то правило, которое
   идёт ниже, — то есть экранное. Печатные размеры не применялись вообще:
   лист печатался экранными, где у клетки min-height:96px, и месяц с
   несколькими группами в один день переставал влезать на страницу.

   Любые новые правила дописывать ВЫШЕ этого блока, иначе поломка вернётся.
   ══════════════════════════════════════════════════════════════════════ */
@media print{
  /* По умолчанию браузеры при печати/"Сохранить как PDF" вырезают все
     фоновые цвета (это экономия чернил для бумажной печати) — из-за этого
     цветные плашки Лекция/Практика/Зачёт/Экзамен пропадали, и расписание
     выглядело чёрно-белым. На телефоне (Android/iOS) системный "Печать в
     PDF" этого не делает, поэтому там всё было цветным, а с компьютера —
     нет. print-color-adjust:exact — явная просьба браузеру не резать цвета. */
  *{-webkit-print-color-adjust:exact!important; print-color-adjust:exact!important; color-adjust:exact!important}
  .no-print, .site-head, .stream-bar, .site-foot, .ai-fab, .ai-panel, .page-hero .lead, .stream-gate{display:none!important}
  .print-only{display:block}
  body{background:#fff; font-size:12pt; color:#000}
  .print-head{display:flex; align-items:center; gap:10px; margin:0 0 18px}
  .print-logo{height:34px; width:auto; flex-shrink:0}
  .print-title{font-family:'Nimbus Sans L',Georgia,sans-serif; font-weight:600; font-size:1.3rem; margin:0}
  .mat{border:1px solid #ccc; box-shadow:none; break-inside:avoid}
  a{color:#000}
  .wrap{padding:0; max-width:none}

  /* Календарь-сетка на печать — та же разметка/цвета, что и на экране
     (.cal-grid/.cal-cell/.cal-ev), просто плотнее по размерам, чтобы месяц
     с обычной нагрузкой занятий помещался на один лист A4, а не на 2-3
     страницы, как раньше со сплошным построчным списком. */
  /* Поля страницы задаём сами: у браузеров по умолчанию около 12-15 мм с
     каждой стороны, и на насыщенный месяц этого запаса не хватало. */
  @page{margin:9mm}

  .cal-grid{gap:1.5px; break-inside:avoid}
  .cal-weekdays{margin-bottom:2px}
  .cal-wd{font-size:7pt; padding:1px 0}
  .cal-cell{min-height:auto; padding:2px; border-radius:3px; border-color:#ccc; gap:0.5px}
  .cal-num{font-size:7pt; margin-bottom:0}

  /* Ключевое для плотных дней: на экране плашка — столбик (время, группа,
     база в три строки), и при пяти группах в одном дне клетка вырастала так,
     что месяц переставал влезать на лист. На печати кладём всё в ОДНУ строку:
     «09:00 ОП-604 ЕКПЦ». Высота дня падает втрое, а читаемость сохраняется —
     6pt это примерно шрифт сноски в учебнике. */
  .cal-ev{display:block; font-size:6pt; padding:0.5px 2px; border-radius:2px; line-height:1.25}
  .cal-ev-t{font-size:6pt; font-weight:700; margin-right:2.5px}
  .cal-ev-x{white-space:normal; margin-right:2.5px}
  .cal-ev-b{font-size:5.6pt; font-weight:700; opacity:1; white-space:normal}

  /* Заголовок печатной страницы был крупнее, чем нужно: он съедал место у
     самого календаря, ради которого лист и печатают. */
  .print-head{margin:0 0 8px}
  .print-logo{height:24px}
  .print-title{font-size:1.02rem}
}

/* ---------- Библиотека: панель материалов под рядом плиток ----------
   Раньше раскрытый <details> растягивался на всю ширину сетки (grid-column:1/-1):
   плитка перескакивала на отдельную строку, соседние съезжали, а шапка раздела
   высотой 270px на всю ширину занимала треть экрана — сами материалы уезжали вниз.
   Теперь (при включённом JS, класс .lib-js на сетке) плитки остаются на месте,
   выбранная подсвечивается, а материалы открываются отдельной панелью сразу под
   её рядом — с плавным раскрытием и поочерёдным появлением карточек.
   Без JS работает прежний <details>. См. assets/library.js. */
.lib-js .lib-sec[open]{grid-column:auto}
.lib-js .lib-sec{position:relative; transition:border-color .2s, box-shadow .2s, transform .2s}
.lib-js .lib-sec summary{transition:background-color .2s}
.lib-js .lib-sec:not(.is-active):hover{transform:translateY(-2px)}
.lib-sec.is-active{border-color:var(--teal); box-shadow:0 0 0 1px var(--teal), var(--shadow)}
.lib-sec.is-active summary{background:var(--teal-tint)}
.lib-sec.is-active .go svg{transform:rotate(180deg)}
/* «язычок» от активной плитки к панели */
.lib-sec.is-active::after{
  content:""; position:absolute; left:50%; bottom:-19px; width:16px; height:16px;
  margin-left:-8px; background:var(--surface); border-left:1px solid var(--teal); border-top:1px solid var(--teal);
  transform:rotate(45deg); z-index:2; animation:lib-tab-in .25s ease-out both;
}
@keyframes lib-tab-in{from{opacity:0; transform:translateY(6px) rotate(45deg)} to{opacity:1; transform:rotate(45deg)}}

.lib-panel{
  grid-column:1/-1; position:relative; overflow:hidden;
  background:var(--surface); border:1px solid var(--teal); border-radius:var(--radius);
  box-shadow:var(--shadow); margin-top:2px;
}
.lib-panel-in{padding:18px 22px 22px}
.lib-panel-head{display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px; padding-bottom:14px; border-bottom:1px solid var(--line)}
.lib-panel-head h3{margin:0; font-size:1.12rem; line-height:1.3; flex:1 1 auto; min-width:0}
.lib-panel-head .count{font-size:.8rem; font-weight:600; color:var(--coral-deep); background:var(--coral-tint); padding:3px 10px; border-radius:30px; white-space:nowrap}
.lib-panel-close{
  display:inline-flex; align-items:center; gap:6px; margin-left:auto; padding:7px 12px;
  border:1px solid var(--line-strong); border-radius:10px; background:transparent; color:var(--ink-soft);
  font:inherit; font-size:.88rem; cursor:pointer; transition:background-color .15s, color .15s, border-color .15s;
}
.lib-panel-close:hover{background:var(--teal-tint); color:var(--teal-deep); border-color:var(--teal)}
.lib-panel-close:focus-visible{outline:2px solid var(--teal); outline-offset:2px}
.lib-panel-close svg{transition:transform .2s}
.lib-panel-close:hover svg{transform:rotate(90deg)}
.lib-panel .mat{will-change:transform, opacity}
.lib-panel .mat:hover{transform:translateY(-2px); box-shadow:0 6px 16px rgba(20,50,40,.08)}
.lib-panel .mat{transition:transform .18s, box-shadow .18s, border-color .15s}

@media (max-width:680px){
  .lib-sec.is-active::after{bottom:-15px; width:12px; height:12px; margin-left:-6px}
  .lib-panel-in{padding:14px 16px 16px}
  .lib-panel-head h3{font-size:1rem}
}
@media (prefers-reduced-motion:reduce){
  .lib-sec.is-active::after{animation:none}
  .lib-js .lib-sec:not(.is-active):hover, .lib-panel .mat:hover{transform:none}
}
