/* Catppuccin Latte (светлая) */
[data-theme="catppuccin"] {
  --bg: #eff1f5;
  --text: #4c4f69;
  --code-text: #acaeb2;
  --accent: #1e66f5;
  --card: #212631;
  --post-card: #29154529;
  --border: #ccd0da;
  --meta: #6c6f85;
}

/* Dracula (тёмная) */
[data-theme="dracula"] {
  --bg: #282a36;
  --text: #f8f8f2;
  --code-text: #ffffff;
  --accent: #bd93f9;
  --card: #44475a;
  --post-card: #44475a;
  --border: #6272a4;
  --meta: #f1fa8c;
}

/* Общие стили */
* {
  box-sizing: border-box;
}

img {
    width: 100%;
}

a {
  color: dodgerblue;
}

a:hover {
  color: darkgray;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  line-height: 2.0;
  transition: all 0.3s ease;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Шапка */
header {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-switcher {
  display: flex;
  gap: 0.5rem;
}

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

/* Главная страница */
.hero {
  text-align: center;
  padding: 4rem 0;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.hero p {
  font-size: 1.2rem;
  opacity: 0.8;
}

/* Карточки постов */
.posts-grid {
  display: grid;
  gap: 2rem;
  margin: 3rem 0;
}

.post-card {
  background: var(--post-card);
  padding: 2rem;
  border-radius: 8px;
  border-left: 4px solid var(--accent);
  transition: transform 0.2s ease;
}

.post-card:hover {
  transform: translateY(-2px);
}

.post-card h2 {
  margin-bottom: 0.5rem;
}

.post-card h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-card h2 a:hover {
  color: var(--accent);
}

.post-card img {
  border-radius: 4px;
}

.post-meta {
  color: var(--meta);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.post-summary {
  margin-bottom: 1rem;
}

.read-more {
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
}

/* Подвал */
footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  opacity: 0.7;
}

/* Стили для блоков кода */
pre {
  background: var(--card) !important;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem !important;
  margin: 1.5rem 0;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

code {
  background: var(--card);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  color: var(--code-text);
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Подсветка синтаксиса для Dracula */
[data-theme="dracula"] .highlight {
  background: #44475a !important;
}

[data-theme="dracula"] .highlight .hljs-keyword { color: #ff79c6; }
[data-theme="dracula"] .highlight .hljs-built_in { color: #50fa7b; }
[data-theme="dracula"] .highlight .hljs-string { color: #f1fa8c; }
[data-theme="dracula"] .highlight .hljs-number { color: #bd93f9; }
[data-theme="dracula"] .highlight .hljs-comment { color: #6272a4; }
[data-theme="dracula"] .highlight .hljs-function { color: #50fa7b; }
[data-theme="dracula"] .highlight .hljs-params { color: #f8f8f2; }
[data-theme="dracula"] .highlight .hljs-title { color: #ffb86c; }

/* Подсветка синтаксиса для Catppuccin */
[data-theme="catppuccin"] .highlight {
  background: #fafafa !important;
}

[data-theme="catppuccin"] .highlight .hljs-keyword { color: #8839ef; }
[data-theme="catppuccin"] .highlight .hljs-built_in { color: #40a02b; }
[data-theme="catppuccin"] .highlight .hljs-string { color: #df8e1d; }
[data-theme="catppuccin"] .highlight .hljs-number { color: #fe640b; }
[data-theme="catppuccin"] .highlight .hljs-comment { color: #8c8fa1; }
[data-theme="catppuccin"] .highlight .hljs-function { color: #1e66f5; }
[data-theme="catppuccin"] .highlight .hljs-params { color: #4c4f69; }
[data-theme="catppuccin"] .highlight .hljs-title { color: #d20f39; }

/* Номера строк (опционально) */
.highlight table td {
  padding: 0;
}

.highlight table pre {
  margin: 0;
}

/* Скроллбар для блоков кода */
pre::-webkit-scrollbar {
  height: 6px;
}

pre::-webkit-scrollbar-track {
  background: var(--bg);
}

pre::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

pre::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Специфичные стили для JSON/TOML/YAML */
[data-theme="dracula"] .highlight .hljs-attr { color: #50fa7b; }      /* ключи */
[data-theme="dracula"] .highlight .hljs-string { color: #f1fa8c; }    /* строки */
[data-theme="dracula"] .highlight .hljs-number { color: #bd93f9; }    /* числа */
[data-theme="dracula"] .highlight .hljs-literal { color: #ff79c6; }   /* true/false */
[data-theme="dracula"] .highlight .hljs-punctuation { color: #f8f8f2; } /* скобки */

[data-theme="catppuccin"] .highlight .hljs-attr { color: #40a02b; }    /* ключи */
[data-theme="catppuccin"] .highlight .hljs-string { color: #df8e1d; }  /* строки */
[data-theme="catppuccin"] .highlight .hljs-number { color: #fe640b; }  /* числа */
[data-theme="catppuccin"] .highlight .hljs-literal { color: #8839ef; } /* true/false */
[data-theme="catppuccin"] .highlight .hljs-punctuation { color: #4c4f69; } /* скобки */

/* Clojure-specific syntax highlighting */
[data-theme="dracula"] .highlight .hljs-keyword { color: #ff79c6; }      /* :keywords */
[data-theme="dracula"] .highlight .hljs-symbol { color: #50fa7b; }       /* symbols */
[data-theme="dracula"] .highlight .hljs-string { color: #f1fa8c; }       /* strings */
[data-theme="dracula"] .highlight .hljs-number { color: #bd93f9; }       /* numbers */
[data-theme="dracula"] .highlight .hljs-built_in { color: #8be9fd; }     /* built-ins */
[data-theme="dracula"] .highlight .hljs-comment { color: #6272a4; }      ;; comments
[data-theme="dracula"] .highlight .hljs-function { color: #ffb86c; }     /* functions */
[data-theme="dracula"] .highlight .hljs-special { color: #ff5555; }      /* special forms */

[data-theme="catppuccin"] .highlight .hljs-keyword { color: #8839ef; }    /* :keywords */
[data-theme="catppuccin"] .highlight .hljs-symbol { color: #40a02b; }     /* symbols */
[data-theme="catppuccin"] .highlight .hljs-string { color: #df8e1d; }     /* strings */
[data-theme="catppuccin"] .highlight .hljs-number { color: #fe640b; }     /* numbers */
[data-theme="catppuccin"] .highlight .hljs-built_in { color: #1e66f5; }   /* built-ins */
[data-theme="catppuccin"] .highlight .hljs-comment { color: #8c8fa1; }    ;; comments
[data-theme="catppuccin"] .highlight .hljs-function { color: #d20f39; }   /* functions */
[data-theme="catppuccin"] .highlight .hljs-special { color: #e64553; }    /* special forms */

/* Улучшения для лучшей читаемости скобок */
.highlight .hljs-punctuation {
  opacity: 0.7;
}

/* Подсветка парных скобок при наведении */
.highlight:hover .hljs-punctuation {
  opacity: 1;
}

/* Специфично для Clojure - выделение ключевых форм */
[data-theme="dracula"] .highlight .hljs-name { color: #ff79c6; }  /* defn, let, etc */
[data-theme="catppuccin"] .highlight .hljs-name { color: #8839ef; }

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 2rem 0;
}

.tag {
    background: var(--accent);
    color: var(--bg);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.post-tags {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.terms-page, .tag-page, .posts-page {
    max-width: 800px;
    margin: 0 auto;
}

.terms-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin: 2rem 0;
}

.post-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin: 0.5rem 0;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
}

.nav-links a:hover {
    color: var(--accent);
}

.breadcrumbs {
    font-size: 0.9rem;
    padding: 0.5rem 0;
    color: var(--meta);
    display: block;
}

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

.breadcrumbs a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.breadcrumbs .sep {
    margin: 0 0.5rem;
    opacity: 0.6;
}

.breadcrumbs .current {
    color: var(--accent);
    font-weight: 500;
}

#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), #ff79c6);
    z-index: 9999;
    transition: width 0.2s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    display: none;
}

/* Для Dracula темы */
[data-theme="dracula"] #reading-progress {
    background: #bd93f9;
}

/* Для Catppuccin темы */
[data-theme="catppuccin"] #reading-progress {
    background: #1e66f5;
}

.likes {
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.likes:hover {
    transform: scale(1.1);
}

.likes.liked {
    color: #ff4757 !important;
    font-weight: bold;
}

.likes.liked .count {
    color: #ff4757;
}

/* Анимация лайка */
@keyframes heartBeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.likes:active {
    animation: heartBeat 0.6s ease;
}

/* Desktop: показать */
.nav-links { display: flex; gap: 12px; }

/* Toggle button скрыт на десктопе */
.nav-toggle { display: none; }

/* Mobile */
@media (max-width: 780px) {
  .nav { position: relative; }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    font-size: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
  }
  /* Скрываем ссылки по умолчанию */
  .nav-links {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--post-card);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    flex-direction: column;
    padding: 8px;
    border-radius: 6px;
    min-width: 160px;
    z-index: 200;
  }
  .nav-links a { padding: 8px 12px; white-space: nowrap; display: block; }
  /* Класс для открытого состояния */
  .nav-links.open { display: flex; }
}

.stats-dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.stats-header {
  text-align: center;
  margin-bottom: 3rem;
}

.stats-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 2rem;
}

.stat-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent-color);
}

.table-container {
  overflow-x: auto;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#posts-table {
  width: 100%;
  border-collapse: collapse;
}

#posts-table th,
#posts-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

#posts-table th {
  background: var(--bg-secondary);
  font-weight: 600;
}

#posts-table tr:hover {
  background: var(--bg-secondary);
}

.chart-container {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.user-badge {
    display: inline-flex
;
    align-items: center;
    gap: 12px;
    padding: 5px 16px;
    background-color: var(--post-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: Arial, sans-serif;
    max-width: 300px;
}

.user-badge__avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.user-badge__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-badge__info {
  display: flex;
  flex-direction: column;
}

.user-badge__name {
    font-weight: bold;
    color: var(--text);
    font-size: 16px;
}

.user-badge__link {
    color: var(--accent);
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.user-badge__link:hover {
  color: #0d6efd;
  text-decoration: underline;
}
