/* Законы Звезд — статический сайт */

/* ─── Переменные ─── */
:root {
  --bg:           #f9f7f4;
  --surface:      #ffffff;
  --text:         #2a2438;
  --muted:        #7a7090;
  --accent:       #7c5cbf;
  --accent-dark:  #5a3d99;
  --accent-light: #f2eefb;
  --gold:         #c5a03e;
  --border:       #e2daf0;
  --max-width:    900px;
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-ui:      'Inter', system-ui, -apple-system, sans-serif;
  --shadow-sm:    0 2px 10px rgba(90,61,153,.08);
  --shadow-md:    0 6px 28px rgba(90,61,153,.14);
  --shadow-lg:    0 14px 52px rgba(90,61,153,.2);
  --radius:       12px;
  --radius-lg:    20px;
  --ease:         .25s ease;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.72;
  font-size: 1.05rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; display: block; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Шапка ─── */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
}
.brand img {
  width: 52px;
  height: auto;
  filter: drop-shadow(0 2px 5px rgba(90,61,153,.2));
}
.brand-name {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: .02em;
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-tagline {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.73rem;
  color: var(--muted);
  letter-spacing: .09em;
  text-transform: uppercase;
  -webkit-text-fill-color: var(--muted);
}

nav.main-nav { font-family: var(--font-ui); }
nav.main-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}
nav.main-nav a {
  text-decoration: none;
  color: var(--text);
  padding: 6px 4px;
  border-bottom: 2px solid transparent;
  transition: color var(--ease), border-color var(--ease);
  font-weight: 500;
}
nav.main-nav a:hover,
nav.main-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--gold);
}

.lang-switch {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lang-switch a {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  transition: all var(--ease);
  font-weight: 500;
}
.lang-switch a:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}
.lang-switch .current {
  color: var(--muted);
  font-weight: 600;
  padding: 4px 12px;
}
.lang-switch span + a::before,
.lang-switch a + span::before { content: '/'; color: var(--border); margin-right: 2px; }

/* ─── Основной контент ─── */
main { padding: 52px 0 80px; }

.page-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--text);
  line-height: 1.2;
}
.page-lede {
  color: var(--muted);
  font-family: var(--font-ui);
  margin-bottom: 36px;
  font-size: 1.05rem;
}

/* ─── Изображения ─── */
main figure { margin: 2em 0; }
main figure img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
main figcaption {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
  font-style: italic;
}

/* ─── Заголовки с орнаментом ─── */
main :is(h2,h3,h4):not(.page-title) {
  font-family: var(--font-heading);
  color: var(--accent-dark);
  margin-top: 2.6em;
  padding-top: .9em;
  border-top: 1px solid var(--border);
  position: relative;
}
main :is(h2,h3,h4):not(.page-title)::before {
  content: '✦';
  position: absolute;
  top: -.6em;
  left: 0;
  font-size: .72em;
  color: var(--gold);
  background: var(--bg);
  padding: 0 8px 0 0;
  line-height: 1;
}
main h2:first-of-type,
main .page-lede + :is(h2,h3) {
  border-top: none;
  margin-top: 1.2em;
  padding-top: 0;
}
main h2:first-of-type::before,
main .page-lede + :is(h2,h3)::before { display: none; }
main h2 { font-size: 1.85rem; }
main h3 { font-size: 1.4rem; }

/* ─── Нумерованные шаги ─── */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9em;
  height: 1.9em;
  margin-right: .5em;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-family: var(--font-ui);
  font-size: .7em;
  font-weight: 700;
  vertical-align: middle;
  box-shadow: 0 3px 10px rgba(90,61,153,.35);
}

/* ─── Карточки проблем ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 2em 0;
}
.card-grid .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--ease), box-shadow var(--ease);
}
.card-grid .card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}
.card-grid .card figure { margin: 0; }
.card-grid .card figure img {
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: 4/3;
  object-fit: cover;
  width: 100%;
}
.card-grid .card :is(h2,h3,h4) {
  border-top: none !important;
  margin: .8em 1.1em .3em !important;
  padding-top: 0 !important;
  font-size: 1.05rem;
}
.card-grid .card :is(h2,h3,h4)::before { display: none !important; }
.card-grid .card p { margin: 0 1.1em 1.1em; font-size: .93rem; }
.card-grid .card-1 { background: var(--text); }
.card-grid .card-2 { background: var(--accent); }
.card-grid .card-3 { background: var(--accent-dark); }
.card-grid .card-1 :is(h2,h3,h4,p),
.card-grid .card-2 :is(h2,h3,h4,p),
.card-grid .card-3 :is(h2,h3,h4,p) { color: #fff; }

/* ─── Quote Hero (цитата + фото) ─── */
.quote-hero {
  display: flex;
  background: linear-gradient(135deg, var(--accent-light) 0%, #fff 100%);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 2em 0;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.quote-hero .img-col { flex: 1 1 42%; }
.quote-hero .img-col figure { margin: 0; height: 100%; }
.quote-hero .img-col img {
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
}
.quote-hero .text-col {
  flex: 1 1 58%;
  display: flex;
  align-items: center;
  padding: 2.2em 2.6em;
}
.quote-hero blockquote {
  border: none;
  margin: 0;
  padding: 0;
  background: none;
}
.quote-hero blockquote p {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--accent-dark);
  line-height: 1.6;
  margin: 0 0 .8em;
}
.quote-hero blockquote footer {
  font-family: var(--font-ui);
  font-size: .88rem;
  color: var(--muted);
  font-style: normal;
  margin-top: 0;
}
.quote-hero blockquote footer::before { content: '— '; color: var(--gold); }
@media (max-width: 640px) {
  .quote-hero { flex-direction: column; }
}

/* ─── Слайдер ─── */
.slideshow {
  position: relative;
  margin: 1em 0 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-lg);
}
.slideshow-track { position: relative; aspect-ratio: 800/484; }
.slideshow-track img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .6s ease;
}
.slideshow-track img.active { opacity: 1; }
.slideshow-prev, .slideshow-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.88);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all var(--ease);
}
.slideshow-prev { left: 14px; }
.slideshow-next { right: 14px; }
.slideshow-prev:hover, .slideshow-next:hover {
  background: #fff;
  box-shadow: var(--shadow-md);
  transform: translateY(-50%) scale(1.1);
}
.slideshow-dots {
  position: absolute;
  left: 0; right: 0; bottom: 14px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.slideshow-dots button {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.65);
  padding: 0;
  background: transparent;
  cursor: pointer;
  transition: all var(--ease);
}
.slideshow-dots button.active {
  background: #fff;
  border-color: #fff;
  transform: scale(1.25);
}

/* ─── CTA-кнопка ─── */
p.cta {
  text-align: center;
  margin: 1.2em 0 2em;
}
p.cta a {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: .93rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-radius: 30px;
  padding: .72em 2.2em;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(90,61,153,.32);
  transition: all var(--ease);
  letter-spacing: .04em;
}
p.cta a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(90,61,153,.42);
  background: linear-gradient(135deg, var(--accent-dark) 0%, #3d2870 100%);
  color: #fff;
}

/* ─── Карточки статей ─── */
.post-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 20px;
  margin: 2em 0;
}
.post-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  transition: transform var(--ease);
}
.post-card:hover { transform: translateY(-5px); }
.post-card-img {
  display: block;
  aspect-ratio: 1/1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--accent-light);
  margin-bottom: .7em;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--ease);
}
.post-card:hover .post-card-img { box-shadow: var(--shadow-md); }
.post-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.post-card:hover .post-card-img img { transform: scale(1.08); }
.post-card-img .post-card-more {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent-light), #fff);
}
.post-card-title {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}
.post-card:hover .post-card-title { color: var(--accent-dark); }

/* ─── Текст + изображение в 2 колонки ─── */
.text-image-row {
  display: flex;
  gap: 36px;
  align-items: flex-start;
  margin: 2em 0;
}
.text-image-row .text-col { flex: 1 1 55%; min-width: 0; }
.text-image-row .img-col { flex: 1 1 35%; max-width: 40%; }
.text-image-row .img-col figure { margin: 0; }
.text-image-row .text-col :is(h2,h3,h4):first-child {
  border-top: none !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}
.text-image-row .text-col :is(h2,h3,h4):first-child::before { display: none !important; }
@media (max-width: 640px) {
  .text-image-row { flex-direction: column; }
  .text-image-row .img-col { max-width: 100%; }
}

/* ─── Выделенный блок (callout) ─── */
main p.callout {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--accent-dark);
  background: linear-gradient(135deg, var(--accent-light) 0%, #fff 100%);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.1em 1.8em;
  margin: 2em 0;
  box-shadow: var(--shadow-sm);
}
main p.lede-centered {
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-dark);
}

/* ─── Цитаты в тексте ─── */
main blockquote {
  border-left: 3px solid var(--gold);
  margin: 2em 0;
  padding: .8em 1.6em;
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-heading);
  background: var(--accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
}
main blockquote footer {
  margin-top: .6em;
  font-style: normal;
  font-family: var(--font-ui);
  font-size: .85rem;
}
main blockquote footer::before { content: '— '; color: var(--gold); }

/* ─── Статья блога ─── */
article.content :is(h1,h2,h3,h4) {
  font-family: var(--font-heading);
  color: var(--accent-dark);
  margin-top: 1.8em;
}
article.content p { margin: 1em 0; }
article.content figure { margin: 1.8em 0; }
article.content figure.figure-inline img { border-radius: var(--radius); }
@media (max-width: 640px) {
  article.content figure.figure-inline {
    float: none !important;
    width: 100% !important;
    margin: 0 0 1.4em !important;
  }
}
article.content .katex { font-size: 2em; }
article.content .katex-display { margin: 1.4em 0; overflow-x: auto; overflow-y: hidden; }
article.content figcaption {
  font-family: var(--font-ui);
  font-size: .82rem;
  color: var(--muted);
  margin-top: 8px;
  font-style: italic;
}
article.content blockquote {
  border-left: 3px solid var(--gold);
  background: var(--accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.8em 0;
  padding: .6em 1.4em;
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-heading);
}
article.content ul, article.content ol { padding-left: 1.6em; }

/* ─── Мета-информация поста ─── */
.post-meta {
  font-family: var(--font-ui);
  font-size: .84rem;
  color: var(--muted);
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.post-meta span + span::before { content: ' · '; color: var(--gold); }

/* ─── Фильтр публикаций по категориям ─── */
.post-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 24px;
}
.filter-btn {
  font-family: var(--font-ui);
  font-size: .86rem;
  font-weight: 500;
  color: var(--accent-dark);
  background: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 18px;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), box-shadow var(--ease);
}
.filter-btn:hover { box-shadow: var(--shadow-sm); }
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Список публикаций ─── */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
}
.post-list li {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--ease), transform var(--ease);
}
.post-list li:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.post-thumb {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--accent-light);
}
.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-thumb--empty { background: var(--accent-light); }
.post-list-body { min-width: 0; }
.post-list h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-family: var(--font-heading);
  color: var(--accent-dark);
  border-top: none !important;
  padding-top: 0 !important;
}
.post-list h2::before { display: none !important; }
.post-list h2 a { color: inherit; }
.post-list h2 a:hover { color: var(--accent); }
.post-list .post-list-meta {
  font-family: var(--font-ui);
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.post-list p.excerpt { margin: 0; font-size: .95rem; }

@media (max-width: 480px) {
  .post-thumb { width: 60px; height: 60px; }
  .post-list li { padding: 12px 16px; gap: 12px; }
}

/* ─── Подвал ─── */
footer.site-footer {
  border-top: 1px solid var(--border);
  background: var(--text);
  color: rgba(255,255,255,.65);
  font-family: var(--font-ui);
  font-size: .9rem;
}
footer.site-footer .wrap {
  padding: 36px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
}
footer.site-footer a { color: rgba(255,255,255,.65); }
footer.site-footer a:hover { color: #fff; }
footer.site-footer .copyright {
  width: 100%;
  font-size: .78rem;
  opacity: .45;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ─── Адаптивность ─── */
@media (max-width: 640px) {
  .brand .brand-tagline { display: none; }
  .page-title { font-size: 1.9rem; }
  main h2 { font-size: 1.45rem; }
  main { padding: 36px 0 56px; }
}
