/* ==========================================================================
   ALMIR.SITE — Modern Engineering Blog & Media
   Habr / Tproger Premium Edition (Light & Dark Themes)
   ========================================================================== */

:root {
  /* Default: Dark Theme */
  --bg-body: #0d1117;
  --bg-surface: #161b22;
  --bg-card: #1c2128;
  --bg-card-hover: #222730;
  --bg-muted: #272d37;
  --bg-input: #12161c;

  --border-color: #30363d;
  --border-light: rgba(255, 255, 255, 0.08);

  --text-main: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --text-accent: #58a6ff;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-subtle: rgba(59, 130, 246, 0.15);

  --status-doing-bg: rgba(245, 158, 11, 0.15);
  --status-doing-text: #fbbf24;
  --status-doing-border: rgba(245, 158, 11, 0.35);

  --status-done-bg: rgba(16, 185, 129, 0.15);
  --status-done-text: #34d399;
  --status-done-border: rgba(16, 185, 129, 0.35);

  --status-plan-bg: rgba(99, 102, 241, 0.15);
  --status-plan-text: #818cf8;
  --status-plan-border: rgba(99, 102, 241, 0.35);

  --status-did-bg: rgba(168, 85, 247, 0.15);
  --status-did-text: #c084fc;
  --status-did-border: rgba(168, 85, 247, 0.35);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

[data-theme="light"] {
  --bg-body: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --bg-muted: #eef2f6;
  --bg-input: #f1f4f8;

  --border-color: #e2e8f0;
  --border-light: #edf2f7;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #2563eb;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: rgba(37, 99, 235, 0.1);

  --status-doing-bg: #fef3c7;
  --status-doing-text: #b45309;
  --status-doing-border: #fcd34d;

  --status-done-bg: #d1fae5;
  --status-done-text: #065f46;
  --status-done-border: #a7f3d0;

  --status-plan-bg: #e0e7ff;
  --status-plan-text: #3730a3;
  --status-plan-border: #c7d2fe;

  --status-did-bg: #f3e8ff;
  --status-did-text: #6b21a8;
  --status-did-border: #e9d5ff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 20px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.05em;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.1;
}

.brand-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-search {
  flex-grow: 1;
  max-width: 360px;
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px 8px 36px;
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
}

.search-icon-svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--text-muted);
}

.btn-telegram {
  background: #229ed9;
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease;
}

.btn-telegram:hover {
  background: #1b8ec5;
}

/* ==========================================================================
   BLOG HERO BANNER (Author introduction)
   ========================================================================== */
.blog-intro-banner {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 24px 0;
  margin-bottom: 24px;
}

.intro-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.intro-text-side {
  max-width: 760px;
}

.intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.intro-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--text-main);
}

.intro-lead {
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.intro-stats-chips {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.stat-chip {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-chip-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.stat-chip-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   MAIN LAYOUT (Feed + Sidebar)
   ========================================================================== */
.main-content-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  margin-bottom: 60px;
}

/* Left Feed: Filter Tabs */
.feed-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 10px;
}

.feed-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.feed-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.feed-tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-muted);
}

.feed-tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.feed-tab-btn .tab-count {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.15);
}

.feed-tab-btn.active .tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Post Cards */
.posts-feed {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.post-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .post-card:hover {
  border-color: #cbd5e1;
}

/* Post Author & Header Meta */
.post-header-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.post-author-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #10b981);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.author-details {
  display: flex;
  flex-direction: column;
}

.author-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.author-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
}

.author-badge {
  font-size: 0.68rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 4px;
}

.post-date-row {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Category Pillar Badge */
.post-pillar-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.post-pillar-badge.doing {
  background: var(--status-doing-bg);
  color: var(--status-doing-text);
  border: 1px solid var(--status-doing-border);
}

.post-pillar-badge.done {
  background: var(--status-done-bg);
  color: var(--status-done-text);
  border: 1px solid var(--status-done-border);
}

.post-pillar-badge.plan {
  background: var(--status-plan-bg);
  color: var(--status-plan-text);
  border: 1px solid var(--status-plan-border);
}

.post-pillar-badge.did {
  background: var(--status-did-bg);
  color: var(--status-did-text);
  border: 1px solid var(--status-did-border);
}

/* Post Content */
.post-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 12px;
  color: var(--text-main);
  cursor: pointer;
  transition: color 0.15s ease;
}

.post-title:hover {
  color: var(--primary);
}

.post-tags-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.post-tag {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-muted);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.post-media-preview {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  max-height: 340px;
  background: #000;
}

.post-preview-img {
  width: 100%;
  height: 340px;
  object-fit: cover;
  display: block;
}

.post-excerpt {
  font-size: 0.96rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 18px;
}

/* Post Highlights / Diagnostics Box */
.post-diagnostics-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  font-size: 0.8rem;
}

.diag-item {
  display: flex;
  flex-direction: column;
}

.diag-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.diag-val {
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* Post Footer Bar (Likes, Views, Comments, Read More) */
.post-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.post-interactions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.action-vote-btn, .action-comment-btn, .action-bookmark-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.action-vote-btn:hover {
  color: var(--status-done-text);
  background: var(--status-done-bg);
}

.action-vote-btn.voted {
  color: var(--status-done-text);
  background: var(--status-done-bg);
}

.action-comment-btn:hover, .action-bookmark-btn:hover {
  color: var(--primary);
  background: var(--primary-subtle);
}

.post-views-count {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.btn-read-article {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-read-article:hover {
  background: var(--primary);
  color: #fff;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: -0.01em;
}

/* Author Profile Widget */
.author-profile-card {
  text-align: center;
}

.author-big-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #10b981);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.author-card-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.author-card-role {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.author-bio {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.author-status-strip {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  margin-bottom: 16px;
}

.status-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 6px #10b981;
}

/* Live Workbench Queue Widget */
.workbench-queue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
}

.queue-title {
  font-weight: 600;
  color: var(--text-main);
}

.queue-progress {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 700;
}

/* Tags Cloud Widget */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-cloud-item {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-cloud-item:hover, .tag-cloud-item.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Telegram CTA Widget */
.telegram-widget {
  background: linear-gradient(135deg, #1e3a8a, #0f172a);
  color: #fff;
  border: 1px solid #3b82f6;
}

[data-theme="light"] .telegram-widget {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e3a8a;
  border-color: #bfdbfe;
}

.telegram-widget .widget-title {
  color: inherit;
}

.telegram-widget-text {
  font-size: 0.85rem;
  margin-bottom: 14px;
  line-height: 1.5;
  opacity: 0.9;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 40px 0;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-link:hover {
  color: var(--primary);
}

/* ==========================================================================
   MODAL / ARTICLE FULL-VIEW
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 960px) {
  .main-content-layout {
    grid-template-columns: 1fr;
  }
  .intro-banner-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-search {
    display: none;
  }
}

@media (max-width: 640px) {
  .post-diagnostics-box {
    grid-template-columns: 1fr;
  }
  .post-footer-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .intro-title {
    font-size: 1.35rem;
  }
}
