/* ===== LangExchange — материалы ===== */

:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --ink: #111827;
  --muted: #4b5563;
  --line: #e5e7eb;
  --soft: #f9fafb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--soft);
  color: var(--ink);
}

.page { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Шапка ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  padding: 0 80px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 32px; height: 32px;
  background: var(--blue);
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 16px;
}
.brand-name { font-size: 20px; font-weight: 700; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 32px; height: 76px; }
.nav-link {
  display: inline-flex; align-items: center;
  height: 76px;
  font-size: 16px; font-weight: 500;
  color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent;
  box-sizing: border-box;
}
.nav-link:hover { color: var(--blue); }
.nav-link.is-active { color: var(--blue); font-weight: 600; border-bottom-color: var(--blue); padding-top: 2px; }

.header-actions { display: flex; align-items: center; gap: 24px; }
.login-link { font-size: 16px; font-weight: 500; color: var(--muted); text-decoration: none; }
.login-link:hover { color: var(--blue); }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px;
  background: var(--blue); color: #fff;
  border: 0; border-radius: 8px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background .15s, transform .05s;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:active { transform: translateY(1px); }

/* ---------- Контент ---------- */
.content { flex: 1; display: flex; justify-content: center; }
.content > .page-head,
.content > .filters,
.content > .lessons-grid { width: 100%; max-width: 1100px; }

/* Для lessons.html — обёртка */
.page > .content {
  flex-direction: column;
  align-items: center;
  padding: 48px 24px 80px;
  gap: 32px;
}
.page > .content > .page-head,
.page > .content > .filters,
.page > .content > .lessons-grid {
  max-width: 1100px;
}

/* Для lesson.html */
.content > .inner {
  width: 100%;
  max-width: 800px;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Заголовок страницы ---------- */
.page-head { display: flex; flex-direction: column; gap: 8px; }
.page-title {
  margin: 0; font-size: 36px; font-weight: 800;
  color: var(--ink); letter-spacing: -0.4px;
}
.page-subtitle { margin: 0; font-size: 16px; color: var(--muted); }

/* ---------- Фильтры ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: #cbd5e1; color: var(--ink); }
.chip.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- Сетка уроков ---------- */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.lesson-card-link {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 180px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.03);
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.lesson-card-link:hover {
  border-color: var(--blue);
  box-shadow: 0 12px 28px rgba(37,99,235,.1);
  transform: translateY(-2px);
}

.lesson-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.level-badge {
  display: inline-flex;
  padding: 4px 10px;
  background: var(--blue-soft);
  color: var(--blue);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}
.topic-tag {
  display: inline-flex;
  padding: 4px 10px;
  background: var(--soft);
  color: var(--muted);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
}

.lesson-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.lesson-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}
.lesson-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Страница урока ---------- */
.back-link {
  align-self: flex-start;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--blue); }

.lesson-card {
  padding: 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lesson-head-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lesson-h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.3px;
}
.lesson-lead {
  margin: 0;
  font-size: 17px;
  color: var(--muted);
  line-height: 1.55;
}
.lesson-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}
.lesson-body {
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  word-wrap: break-word;
}
.lesson-body p { margin: 0 0 16px; }
.lesson-body p:last-child { margin-bottom: 0; }
.lesson-body h2 {
  margin: 28px 0 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}
.lesson-body h3 {
  margin: 20px 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.lesson-body ul,
.lesson-body ol {
  margin: 0 0 16px;
  padding-left: 24px;
}
.lesson-body li { margin-bottom: 6px; }
.lesson-body code {
  padding: 2px 6px;
  background: var(--soft);
  border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 14px;
}
.lesson-body pre {
  padding: 16px;
  background: var(--soft);
  border-radius: 12px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.5;
}
.lesson-body blockquote {
  margin: 0 0 16px;
  padding: 10px 16px;
  background: var(--blue-soft);
  border-left: 3px solid var(--blue);
  border-radius: 4px 12px 12px 4px;
  color: var(--ink);
}

/* ---------- Состояния ---------- */
.state-box {
  grid-column: 1 / -1;
  padding: 48px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

/* ---------- Уведомление ---------- */
.lx-toast {
  position: fixed;
  left: 50%; bottom: 32px;
  transform: translate(-50%, 20px);
  background: var(--ink); color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 9999;
}
.lx-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.lx-toast.is-success { background: var(--green); }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .page > .content { padding: 40px 24px 64px; }
  .lessons-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .header { padding: 0 16px; height: 64px; }
  .brand-name { font-size: 17px; }
  .brand-mark { width: 28px; height: 28px; font-size: 14px; }
  .nav { display: none; }
  .login-link { display: none; }
  .header-actions { gap: 8px; }
  .btn-primary { padding: 8px 14px; font-size: 13px; height: 36px; }

  .page > .content { padding: 24px 12px 56px; gap: 24px; }
  .page-title { font-size: 26px; }
  .page-subtitle { font-size: 15px; }

  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -12px;
    padding: 0 12px 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; padding: 8px 16px; font-size: 13px; }

  .lessons-grid { grid-template-columns: 1fr; gap: 14px; }
  .lesson-card-link { min-height: 0; padding: 18px; gap: 12px; }
  .lesson-title { font-size: 17px; }
  .lesson-desc { font-size: 13px; }

  /* Урок */
  .content > .inner { padding: 24px 12px 56px; gap: 20px; }
  .lesson-card { padding: 22px 18px; border-radius: 14px; gap: 16px; }
  .lesson-h1 { font-size: 24px; }
  .lesson-lead { font-size: 15px; }
  .lesson-body { font-size: 15px; line-height: 1.7; }
  .lesson-body h2 { font-size: 19px; }
  .lesson-body h3 { font-size: 17px; }
  .lesson-body pre { font-size: 13px; padding: 12px; }
}
