:root {
  --bg: #f6f8fc;
  --text: #1f2937;
  --muted: #4b5563;

  --card: #ffffff;
  --border: rgba(15, 23, 42, 0.12);

  --link: #0b5bd3;
  --link-hover: #0747a6;

  --shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* Тема меняет всё, кроме шапки (header) */
html.dark {
  --bg: #191A1A;
  --text: #e5e7eb;
  --muted: #cbd5e1;

  --card: #1C1C1E;
  --border: rgba(255,255,255,0.14);

  --link: #7ab8ff;
  --link-hover: #a8d2ff;

  --shadow: 0 12px 32px rgba(0,0,0,0.35);
}

/* Картинки задач приходят в своём разрешении: у задач с kompege ширина задана
   в разметке, а у локальных нет — без этого правила они вылезают за контейнер. */
.task-text img {
  max-width: 100%;
  height: auto;
}

html.dark .task-text img {
  filter: invert(0.9) brightness(0.85) contrast(0.95) sepia(0.25) hue-rotate(190deg);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* --- Header / баннер (всегда как в тёмной теме) --- */
.site-header {
  background: #00072D;
  color: #F2F2F2;
  border-bottom: 1px solid rgba(255,255,255,0.14);
}

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
}

.brand {
  flex: 1 1 auto;
  min-width: 220px;
}

.brand-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.brand-subtitle {
  margin-top: 6px;
  font-size: 16px;
  color: #F2F2F2;
}

/* ссылки на соцсети (текстовые, кликабельные) */
.social {
  display: flex;
  flex-direction: column;   /* друг под другом */
  gap: 8px;                 /* расстояние между строками */
  align-items: flex-end;    /* прижать вправо (как было) */
  padding-right: 56px;      /* место под кнопку темы справа */
}

.social-link {
  padding: 0;
  border: 0;
  background: transparent;

  color: #F2F2F2;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.social-link:hover {
  color: #e8f3ff;  /* не уходим в тёмный hover */
  opacity: 0.7;
}

/* фокус для клавиатуры (полезно для доступности) */
.social-link:focus-visible {
  outline: 2px solid rgba(122, 184, 255, 0.75);
  outline-offset: 3px;
  border-radius: 6px;
}

/* --- Кнопка темы (в правом верхнем углу баннера) --- */
.theme-toggle {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 12px;

  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.12);
  color: #e8f3ff;

  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.18);
}

.theme-toggle:focus-visible {
  outline: 2px solid rgba(122, 184, 255, 0.75);
  outline-offset: 3px;
}

/* --- Контент --- */
.container {
  max-width: 980px;
  margin: 18px auto;
  padding: 0 16px 32px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 20px;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li {
  padding: 10px 0;
  border-top: 1px dashed var(--border);
}

.link-list li:first-child {
  border-top: none;
}

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

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* --- Адаптивность --- */
@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    /* боковые отступы в два раза меньше на мобильных (было 16px) */
    padding-left: 8px;
    padding-right: 8px;
  }

  /* боковые отступы контейнера в два раза меньше на мобильных (было 16px) */
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }

  .social {
    justify-content: flex-start;
    padding-right: 0;
  }

  .theme-toggle {
    top: 12px;
    right: 12px;
  }
}

/* "КЕГЭ 2" выглядит как social-link, но без подчёркивания */
.brand-link {
  display: inline-block;      /* чтобы нормально работали отступы/фокус */
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.1;

  text-decoration: none;      /* убрать подчёркивание */
}

.brand-link:hover {
  text-decoration: none;      /* чтобы не появлялось при hover */
}

.site-header .brand-link,
.site-header .brand-link:visited,
.site-header .brand-link:hover {
  color: inherit;
  text-decoration: none;
}

.site-header .brand-link:hover {
  opacity: 0.7;
}

.toc-link{
  color: inherit;
  text-decoration: none;
}

.toc-link:hover{
  color: inherit;
  opacity: 0.7;
  text-decoration: none;
}

.home-link{
  font-size: 20px; /* поставь 16/18/20 как нравится */
}

/* Ненавязчивый акцент для строки о наборе на индивидуальные занятия:
   мягкая подложка + цветная полоса слева, в тон ссылкам сайта. */
.link-list li.lessons-cta {
  padding: 0;
  margin-bottom: 14px;
  border-top: none;
}

.lessons-cta .home-link {
  display: block;
  padding: 12px 16px;
  border: 1px solid rgba(11, 91, 211, 0.22);
  border-left: 4px solid var(--link);
  border-radius: 12px;
  background: rgba(11, 91, 211, 0.06);
  font-weight: 500;
  line-height: 1.35;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.lessons-cta .home-link:hover {
  background: rgba(11, 91, 211, 0.10);
  border-color: rgba(11, 91, 211, 0.40);
  transform: translateY(-1px);
  opacity: 1;               /* не приглушаем, как обычные toc-ссылки */
  text-decoration: none;
}

html.dark .lessons-cta .home-link {
  background: rgba(122, 184, 255, 0.10);
  border-color: rgba(122, 184, 255, 0.28);
}

html.dark .lessons-cta .home-link:hover {
  background: rgba(122, 184, 255, 0.16);
  border-color: rgba(122, 184, 255, 0.45);
}

/* ===== layout ===== */

.layout-main {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
}

/* ===== sidebar (новости + контакты) ===== */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* ===== news panel ===== */

.news-panel {
  height: 70vh;
  display: flex;
  flex-direction: column;
}

/* ===== contacts panel ===== */

.contacts-panel {
  display: flex;
  flex-direction: column;
}

.contacts-text {
  margin: 10px 0 14px;
  text-align: center;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
}

.contacts-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contacts-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.contacts-link:hover {
  background: rgba(0, 91, 211, 0.08);
  transform: translateY(-1px);
}

.contacts-link:focus-visible {
  outline: 2px solid rgba(122, 184, 255, 0.75);
  outline-offset: 2px;
}

.contacts-icon {
  flex-shrink: 0;
}

.news-scroll {
  overflow-y: auto;
  padding-right: 6px;
}

/* Кастомный скроллбар для области новостей (адаптируется к теме) */
.news-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.35) transparent;
}

.news-scroll::-webkit-scrollbar {
  width: 8px;
}

.news-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.news-scroll::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.35);
  border-radius: 8px;
}

.news-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.55);
}

html.dark .news-scroll {
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

html.dark .news-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
}

html.dark .news-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}

/* ===== news item ===== */

.news-item {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.news-date {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

.news-text {
  font-size: 15px;
  line-height: 1.4;
}

/* ===== tasks panel ===== */

.tasks-panel {
  min-width: 0;
}

/* ===== mobile ===== */

@media (max-width: 900px) {

  .layout-main {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .sidebar {
    gap: 10px;
  }

  .news-panel {
    height: auto;
  }

  .news-scroll {
    max-height: 150px;
  }

  .card {
    padding: 14px;
  }

}