/* TG2MAX Blog — ported from WordPress mu-plugin + layout */

:root {
  --tg2max-primary: #00a2ff;
  --tg2max-purple: #8b5cf6;
  --tg2max-dark: #0a1628;
  --tg2max-text: #1d1d1f;
  --tg2max-text-secondary: #6e6e73;
  --tg2max-bg: #fbfbfd;
  --tg2max-bg-alt: #f5f5f7;
  --tg2max-gradient: linear-gradient(135deg, #00a2ff, #8b5cf6);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--tg2max-text);
  background: var(--tg2max-bg);
  margin: 0;
  line-height: 1.6;
}

/* ============ HEADER ============ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 251, 253, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { text-decoration: none; display: flex; align-items: center; }

.logo-text {
  background: var(--tg2max-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  font-size: 1.4rem;
}

.logo-subtitle {
  color: var(--tg2max-text-secondary);
  font-size: 0.8rem;
  font-weight: 400;
  margin-left: 0.5rem;
}

.nav { display: flex; align-items: center; gap: 1.5rem; }

.nav-link {
  color: var(--tg2max-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--tg2max-primary); }

.nav-cta {
  background: var(--tg2max-gradient);
  color: #fff !important;
  padding: 8px 20px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 162, 255, 0.3);
}
.nav-cta:hover {
  box-shadow: 0 4px 16px rgba(0, 162, 255, 0.5);
  transform: translateY(-1px);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--tg2max-text);
  border-radius: 1px;
  transition: 0.2s;
}

@media (max-width: 640px) {
  .logo-subtitle { display: none; }
  .nav-link { display: none; }
  .nav-toggle { display: flex; }
  .nav-cta {
    padding: 6px 14px;
    font-size: 0.85rem;
  }
  .header.open .nav-link {
    display: block;
  }
  .header.open .nav {
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--tg2max-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    gap: 1rem;
  }
}

/* ============ MAIN ============ */
.main {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ============ LIST PAGE ============ */
.list-header { margin-bottom: 2rem; }

.list-title {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.gradient-text {
  background: var(--tg2max-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.list-description {
  color: var(--tg2max-text-secondary);
  font-size: 1.05rem;
  margin: 0;
}

.categories-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 6px 14px;
  background: var(--tg2max-bg-alt);
  border-radius: 20px;
  color: var(--tg2max-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}
.category-chip:hover {
  background: rgba(0, 162, 255, 0.1);
  color: var(--tg2max-primary);
}
.category-chip .count {
  font-size: 0.8rem;
  color: var(--tg2max-text-secondary);
}

/* ============ POST CARDS ============ */
.posts-list { display: flex; flex-direction: column; gap: 0; }

.post-card {
  border-bottom: 1px solid var(--tg2max-bg-alt);
  transition: background 0.2s;
}
.post-card:hover { background: rgba(0, 162, 255, 0.02); }

.post-card-link {
  display: block;
  padding: 1.5rem 0;
  text-decoration: none;
  color: inherit;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--tg2max-text-secondary);
  margin-bottom: 0.5rem;
}

.post-card-category {
  background: rgba(0, 162, 255, 0.08);
  color: var(--tg2max-primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.post-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--tg2max-text);
  line-height: 1.35;
}

.post-card-excerpt {
  color: var(--tg2max-text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0 0 0.5rem;
}

.post-card-more {
  color: var(--tg2max-primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.2s;
  display: inline-block;
}
.post-card:hover .post-card-more { transform: translateX(4px); }

/* ============ ARTICLE ============ */
.article-header { margin-bottom: 2rem; }

.article-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  line-height: 1.3;
  margin: 0.5rem 0;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--tg2max-text-secondary);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.article-category {
  background: rgba(0, 162, 255, 0.08);
  color: var(--tg2max-primary);
  padding: 2px 10px;
  border-radius: 4px;
  font-weight: 500;
  text-decoration: none;
}
.article-category:hover { background: rgba(0, 162, 255, 0.15); }

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--tg2max-text-secondary);
  margin-bottom: 0.5rem;
}
.breadcrumbs a {
  color: var(--tg2max-text-secondary);
  text-decoration: none;
}
.breadcrumbs a:hover { color: var(--tg2max-primary); }
.breadcrumbs .sep { margin: 0 0.4rem; }

/* TOC */
.toc {
  background: var(--tg2max-bg-alt);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
}
.toc summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--tg2max-text);
}
.toc ul { padding-left: 1.2rem; margin: 0.5rem 0 0; }
.toc li { margin: 0.3rem 0; }
.toc a {
  color: var(--tg2max-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}
.toc a:hover { color: var(--tg2max-primary); }
.toc a[href="#как-сделать-красивую-ссылку-на-канал-max"] {
  background: var(--tg2max-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
}

/* ============ CONTENT (ported from WP) ============ */
.article-content p {
  line-height: 1.8;
  margin-bottom: 1.2em;
}

.article-content a {
  color: var(--tg2max-primary);
  text-decoration: underline;
  text-decoration-color: rgba(0, 162, 255, 0.3);
  text-underline-offset: 3px;
  transition: all 0.2s;
}
.article-content a:hover {
  color: var(--tg2max-purple);
  text-decoration-color: var(--tg2max-purple);
}

.article-content h2, .article-content h3, .article-content h4 {
  color: var(--tg2max-text);
  font-weight: 600;
  margin-top: 2em;
  margin-bottom: 0.8em;
  scroll-margin-top: 80px;
}

.article-content h2 {
  font-size: 1.6rem;
  padding-bottom: 0.4em;
  border-bottom: 2px solid transparent;
  border-image: var(--tg2max-gradient) 1;
}

.article-content h3 { font-size: 1.3rem; }

.article-content ul, .article-content ol {
  padding-left: 1.5em;
  margin-bottom: 1.5em;
}

.article-content li {
  margin-bottom: 0.5em;
  line-height: 1.7;
}

.article-content ul li::marker { color: var(--tg2max-primary); }
.article-content ol li::marker { color: var(--tg2max-primary); font-weight: 600; }

/* Tables */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin: 2em 0;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.article-content thead tr { background: var(--tg2max-gradient); }

.article-content thead th {
  color: #fff;
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  border: none;
}

.article-content tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  background: #fff;
}

.article-content tbody tr:nth-child(even) td { background: var(--tg2max-bg-alt); }
.article-content tbody tr:hover td { background: rgba(0, 162, 255, 0.05); }

/* Code */
.article-content code {
  background: var(--tg2max-bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--tg2max-purple);
}

.article-content pre {
  background: var(--tg2max-dark) !important;
  color: #e0e0e0;
  padding: 1.5em;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5em 0;
}

.article-content pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* Blockquotes */
.article-content blockquote {
  border-left: 4px solid var(--tg2max-primary);
  padding: 1em 1.5em;
  margin: 1.5em 0;
  background: rgba(0, 162, 255, 0.04);
  border-radius: 0 8px 8px 0;
}

.article-content blockquote p {
  color: var(--tg2max-text-secondary);
  font-style: italic;
}

/* HR */
.article-content hr {
  border: none;
  height: 2px;
  background: var(--tg2max-gradient);
  margin: 2.5em 0;
  border-radius: 1px;
}

/* Images */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin: 1.5em 0;
}

/* ============ CTA BLOCK ============ */
.cta-block {
  background: var(--tg2max-gradient);
  color: #fff;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  margin: 2.5em 0;
}

.cta-block h3 {
  font-size: 1.4rem;
  margin: 0 0 0.5rem;
}

.cta-block p {
  opacity: 0.9;
  margin: 0 0 1.2rem;
}

.cta-button {
  display: inline-block;
  background: #fff;
  color: var(--tg2max-primary);
  padding: 12px 28px;
  border-radius: 24px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ============ TAGS ============ */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2rem 0;
}

.tag {
  padding: 4px 12px;
  background: var(--tg2max-bg-alt);
  border-radius: 16px;
  color: var(--tg2max-text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.tag:hover {
  background: rgba(0, 162, 255, 0.1);
  color: var(--tg2max-primary);
}

/* ============ RELATED POSTS ============ */
.related-posts {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--tg2max-bg-alt);
}

.related-posts h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.related-card {
  padding: 1rem;
  border-radius: 8px;
  background: var(--tg2max-bg-alt);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}
.related-card:hover {
  background: rgba(0, 162, 255, 0.06);
  transform: translateY(-2px);
}

.related-category {
  font-size: 0.8rem;
  color: var(--tg2max-primary);
  font-weight: 500;
}

.related-card h3 {
  font-size: 1rem;
  margin: 0.3rem 0;
  line-height: 1.35;
}

.related-card p {
  font-size: 0.85rem;
  color: var(--tg2max-text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--tg2max-bg-alt);
}

.page-item a, .page-item span {
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--tg2max-text);
  font-weight: 500;
  transition: all 0.2s;
}

.page-item a:hover {
  background: rgba(0, 162, 255, 0.1);
  color: var(--tg2max-primary);
}

.page-item.active span {
  background: var(--tg2max-gradient);
  color: #fff;
  font-weight: 600;
}

/* ============ FOOTER ============ */
.footer {
  background: var(--tg2max-dark);
  color: rgba(255, 255, 255, 0.7);
  padding: 2.5rem 1.5rem;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.footer-brand { margin-bottom: 1rem; }
.footer-brand .logo-text { font-size: 1.2rem; }
.footer-brand p {
  font-size: 0.9rem;
  margin: 0.3rem 0 0;
  opacity: 0.7;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--tg2max-primary); }

.footer-copy {
  font-size: 0.8rem;
  opacity: 0.5;
  margin: 1rem 0 0;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .article-content h2 { font-size: 1.4rem; }
  .article-content h3 { font-size: 1.2rem; }

  .article-content table { font-size: 0.9rem; }
  .article-content thead th,
  .article-content tbody td { padding: 8px 10px; }

  .related-grid { grid-template-columns: 1fr; }
}

/* ===== Cookie Notice ===== */
.cookie-notice {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(10, 22, 40, 0.92);
  color: rgba(255,255,255,0.8);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.8rem;
  z-index: 999;
  backdrop-filter: blur(8px);
}
.cookie-notice a { color: var(--tg2max-primary); text-decoration: underline; }
.cookie-notice button {
  background: rgba(255,255,255,0.15);
  border: none; color: #fff;
  padding: 4px 16px; border-radius: 12px;
  font-size: 0.8rem; cursor: pointer;
}
@media (max-width: 640px) {
  .cookie-notice { flex-direction: column; gap: 8px; text-align: center; font-size: 0.75rem; }
}
