/* ============================================================================
   Hub CSS v12.0 — Backlinko-inspired Content Hub Design
   Documatica Design System
   ========================================================================== */

/* ============================================================================
   1. HUB INDEX PAGE (/hub/)
   ========================================================================== */

/* Hero Section */
.hub-hero {
  padding: 80px 0 60px;
  position: relative;
}

.hub-hero-content {
  max-width: 900px;
}

.hub-breadcrumbs {
  margin-bottom: 32px;
}

/* Hub Cards Grid */
.hub-cards-section {
  padding: 80px 0;
  background: white;
}

.hub-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 32px;
}

/* Hub Card v12 */
.hub-card-v12 {
  position: relative;
  display: block;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 2.5rem;
  padding: 40px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.hub-card-v12:hover {
  transform: translateY(-8px);
  border-color: var(--docu-blue, #3b82f6);
  box-shadow: 0 20px 50px -10px rgba(59, 130, 246, 0.15);
}

.hub-card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 2.5rem 2.5rem 0 0;
}

.hub-card-icon {
  width: 64px;
  height: 64px;
  background: #f8fafc;
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  transition: transform 0.3s ease;
}

.hub-card-v12:hover .hub-card-icon {
  transform: scale(1.1);
}

.hub-card-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #0f172a;
  margin: 0 0 12px;
  line-height: 1.3;
}

.hub-card-description {
  font-size: 0.9375rem;
  color: #64748b;
  line-height: 1.6;
  margin: 0 0 20px;
}

.hub-card-articles {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hub-card-article-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.hub-card-article-item svg {
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.6;
  transition: all 0.2s ease;
}

.hub-card-v12:hover .hub-card-article-item {
  color: #0f172a;
}

.hub-card-v12:hover .hub-card-article-item svg {
  opacity: 1;
  transform: translateX(2px);
}

.hub-card-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.hub-card-stat {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.hub-card-stat-divider {
  color: #cbd5e1;
}

.hub-card-arrow {
  position: absolute;
  right: 40px;
  bottom: 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--docu-blue, #3b82f6);
  transition: all 0.3s ease;
}

.hub-card-v12:hover .hub-card-arrow {
  background: var(--docu-blue, #3b82f6);
  color: white;
  transform: translateX(4px);
}

.hub-empty-state {
  text-align: center;
  padding: 80px 20px;
}

.hub-empty {
  color: #94a3b8;
  font-size: 1rem;
}

/* ============================================================================
   2. HUB VIEW PAGE (/hub/{slug}/) — Backlinko Style
   ========================================================================== */

.hub-view-hero {
  padding: 80px 0 60px;
}

.hub-view-header {
  max-width: 900px;
}

.hub-view-intro {
  max-width: 720px;
  margin-bottom: 24px;
}

.hub-view-stats {
  margin-top: 24px;
}

/* Table of Contents */
.hub-toc {
  margin-top: 48px;
  padding: 32px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 2rem;
}

.hub-toc-title {
  font-size: 0.875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin: 0 0 16px;
}

.hub-toc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hub-toc-link {
  display: inline-block;
  padding: 8px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  text-decoration: none;
  transition: all 0.2s ease;
}

.hub-toc-link:hover {
  background: var(--docu-blue, #3b82f6);
  border-color: var(--docu-blue, #3b82f6);
  color: white;
}

.hub-toc-count {
  color: #94a3b8;
  font-weight: 400;
}

.hub-toc-link:hover .hub-toc-count {
  color: rgba(255, 255, 255, 0.8);
}

/* Section Group (каждая секция с превью статей) */
.hub-section-group {
  scroll-margin-top: 80px;
}

.hub-section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.hub-section-title-link {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

.hub-section-title-link:hover {
  color: var(--docu-blue, #3b82f6);
}

.hub-section-badge {
  padding: 6px 12px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 0.5rem;
  color: var(--docu-blue, #3b82f6);
}

.hub-section-description {
  margin-bottom: 32px;
  color: #64748b;
  max-width: 720px;
  line-height: 1.6;
}

/* Articles Grid in Section */
.hub-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.hub-section-more-link {
  display: inline-block;
  padding: 12px 24px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 1.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--docu-blue, #3b82f6);
  text-decoration: none;
  transition: all 0.3s ease;
}

.hub-section-more-link:hover {
  background: var(--docu-blue, #3b82f6);
  border-color: var(--docu-blue, #3b82f6);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -5px rgba(59, 130, 246, 0.3);
}

.hub-section-empty {
  text-align: center;
  padding: 60px 20px;
}

/* ============================================================================
   3. HUB SECTION PAGE (/hub/{slug}/{section}/)
   ========================================================================== */

.hub-section-view-hero {
  padding: 80px 0 60px;
}

.hub-section-view-header {
  max-width: 900px;
}

.hub-section-view-intro {
  max-width: 720px;
  margin-bottom: 24px;
}

.hub-section-view-stats {
  margin-top: 24px;
}

/* Layout: Sidebar + Main */
.hub-section-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 60px;
  align-items: start;
}

/* Sidebar Navigation */
.hub-sidebar-nav {
  position: sticky;
  top: 100px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 2rem;
  padding: 32px;
}

.hub-sidebar-nav-title {
  font-size: 0.875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin: 0 0 20px;
}

.hub-sidebar-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hub-sidebar-nav-list li {
  margin-bottom: 8px;
}

.hub-sidebar-nav-link {
  display: block;
  padding: 10px 16px;
  border-radius: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  transition: all 0.2s ease;
}

.hub-sidebar-nav-link:hover {
  background: #f8fafc;
  color: var(--docu-blue, #3b82f6);
}

.hub-sidebar-nav-back {
  display: inline-block;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.2s ease;
}

.hub-sidebar-nav-back:hover {
  color: var(--docu-blue, #3b82f6);
}

/* Main Content */
.hub-section-main {
  max-width: 900px;
}

.hub-section-full-content {
  margin-bottom: 48px;
  line-height: 1.7;
  color: #334155;
}

.hub-section-articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* ============================================================================
   4. HUB RELATED SECTION ("Вам будет полезно")
   ========================================================================== */

.hub-related-section {
  padding: 80px 0;
  background: #f8fafc;
}

.hub-related-section .container > div {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 3rem;
  padding: 60px;
  box-shadow: 0 20px 60px -10px rgba(15, 23, 42, 0.08);
}

/* ============================================================================
   5. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablets (1024px) */
@media (max-width: 1024px) {
  .hub-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
  }

  .hub-articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .hub-section-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hub-sidebar-nav {
    position: static;
    max-width: 600px;
  }
}

/* Mobile (768px) */
@media (max-width: 768px) {
  .hub-hero,
  .hub-view-hero,
  .hub-section-view-hero {
    padding: 60px 0 40px;
  }

  .hub-cards-grid {
    grid-template-columns: 1fr;
  }

  .hub-card-v12 {
    padding: 32px;
  }

  .hub-toc {
    padding: 24px;
  }

  .hub-articles-grid,
  .hub-section-articles-grid {
    grid-template-columns: 1fr;
  }

  .hub-related-section .container > div {
    padding: 40px 24px;
    border-radius: 2rem;
  }

  .hub-section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Small Mobile (480px) */
@media (max-width: 480px) {
  .hub-hero,
  .hub-view-hero,
  .hub-section-view-hero {
    padding: 40px 0 30px;
  }

  .hub-card-v12 {
    padding: 24px;
  }

  .hub-card-icon {
    width: 48px;
    height: 48px;
  }

  .hub-toc-links {
    flex-direction: column;
  }

  .hub-toc-link {
    display: block;
  }

  .hub-related-section .container > div {
    padding: 32px 20px;
    border-radius: 1.5rem;
  }
}

/* ============================================================================
   6. LEGACY STYLES (сохранены для совместимости)
   ========================================================================== */

.hub-page-section {
  padding-bottom: 2.5rem;
}

.hub-page-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  color: var(--docu-base, #0f172a);
  margin: 0 0 1rem;
  line-height: 1.3;
}

.hub-page-lead {
  color: #64748b;
  font-size: 1.125rem;
  margin: 0;
  max-width: 640px;
}

.content-body {
  line-height: 1.7;
  color: #334155;
  font-size: 1rem;
}

.content-body p {
  margin-bottom: 1.25rem;
}

.content-body h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  margin: 2.5rem 0 1rem;
  line-height: 1.3;
}

.content-body h3 {
  font-size: 1.375rem;
  font-weight: 700;
  color: #0f172a;
  margin: 2rem 0 0.875rem;
  line-height: 1.4;
}

.content-body h4 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin: 1.5rem 0 0.75rem;
}

.content-body ul,
.content-body ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
  color: #475569;
}

.content-body li {
  margin-bottom: 0.5rem;
}

.content-body a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.content-body a:hover {
  color: #2563eb;
  text-decoration: underline;
}

.content-body img {
  max-width: 100%;
  height: auto;
  border-radius: 1rem;
  margin: 1.5rem 0;
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.content-body table th,
.content-body table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.content-body table th {
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
}

/* Hub Content Intro */
.hub-view-intro,
.hub-section-view-intro {
  line-height: 1.7;
  color: #64748b;
}

.hub-section-full-content {
  background: white;
  border-radius: 2rem;
  padding: 40px;
  border: 1px solid #e2e8f0;
}

/* Color input styling */
.input-color {
  width: 80px;
  height: 40px;
  padding: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  cursor: pointer;
}
