/* Article content styling */
.article-content {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--text);
}

/* Headings */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  color: var(--text);
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.article-content h1 { font-size: 2rem; }
.article-content h2 { font-size: 1.75rem; }
.article-content h3 { font-size: 1.5rem; }
.article-content h4 { font-size: 1.25rem; }

/* Paragraphs */
.article-content p {
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

/* Links */
.article-content a {
  color: var(--primary);
  text-decoration: none;
  transition: opacity 0.2s;
}

.article-content a:hover {
  opacity: 0.8;
}

/* External link indicator */
.article-content a[href^="http"]:not([href*="datnguyen.de"]):not([href*="localhost"]):not([href*="127.0.0.1"]):not([href*="://localhost"]):not([href*="://127.0.0.1"])::after {
  content: "\f08e";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 0.75em;
  margin-left: 0.25rem;
  opacity: 0.6;
  display: inline-block;
}

/* Inline code */
.article-content code {
  color: var(--primary);
  background: var(--background);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.75em !important;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', 'Consolas', 'Courier New', monospace !important;
}

/* Code blocks */
.article-content pre {
  background: #2d2d2d;
  color: #e5e5e5;
  padding: 1.5rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.8rem !important;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', 'Consolas', 'Courier New', monospace !important;
}

.article-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit !important;
  font-family: inherit !important;
}

/* Blockquotes */
.article-content blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  opacity: 0.8;
  font-style: italic;
}

/* Lists */
.article-content ul,
.article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
  opacity: 0.9;
}

.article-content ul {
  list-style-type: disc;
}

.article-content ol {
  list-style-type: decimal;
}

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

/* Header anchor copy buttons */
.header-anchor-copy {
  position: absolute;
  left: -2rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text);
  opacity: 0;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  z-index: 10;
}

.header-anchor-copy:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-50%) scale(1.1);
}

/* Show anchor copy button on header hover */
.article-content h2:hover .header-anchor-copy,
.article-content h3:hover .header-anchor-copy,
.article-content h4:hover .header-anchor-copy,
.article-content h5:hover .header-anchor-copy,
.article-content h6:hover .header-anchor-copy {
  opacity: 0.6;
}

.article-content h2:hover .header-anchor-copy:hover,
.article-content h3:hover .header-anchor-copy:hover,
.article-content h4:hover .header-anchor-copy:hover,
.article-content h5:hover .header-anchor-copy:hover,
.article-content h6:hover .header-anchor-copy:hover {
  opacity: 1;
}

/* Responsive: always show anchor buttons on mobile */
@media (max-width: 768px) {
  .header-anchor-copy {
    opacity: 0.6;
    display: block;
    top: 25%;
    left: -2.3rem;
  }
  
  /* Always visible on mobile, no hover needed */
  .article-content h2 .header-anchor-copy,
  .article-content h3 .header-anchor-copy,
  .article-content h4 .header-anchor-copy,
  .article-content h5 .header-anchor-copy,
  .article-content h6 .header-anchor-copy {
    opacity: 0.6;
  }
}

/* Horizontal rules */
.article-content hr {
  border: none;
  border-top: 1px solid var(--text);
  opacity: 0.2;
  margin: 2rem 0;
}

/* Images */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

/* Tables */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.article-content th,
.article-content td {
  border: 1px solid var(--border);
  padding: 0.75rem;
  text-align: left;
}

.article-content th {
  background: var(--card);
  font-weight: 600;
}

/* Table of contents styling */
.toc-nav {
  background: rgba(15, 15, 15, 0.5); /* var(--background) with opacity */
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.toc-nav h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s;
}

.toc-nav h2:hover {
  opacity: 0.8;
}

.toc-nav ul {
  list-style: none;
  padding: 0;
}

.toc-nav > ul > li {
  margin-bottom: 0.5rem;
}

.toc-nav ul ul {
  margin-left: 1rem;
  margin-top: 0.5rem;
}

.toc-nav a {
  color: var(--primary);
  text-decoration: none;
  transition: opacity 0.2s;
}

.toc-nav a:hover {
  opacity: 0.8;
}

/* Article metadata */
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  opacity: 0.7;
}

.article-meta time,
.article-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Article tags */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.article-tags span {
  font-size: 0.75rem;
  background: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
}

/* Article navigation */
.article-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
}

.article-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  text-decoration: none;
  transition: opacity 0.2s;
}

.article-nav a:hover {
  opacity: 0.8;
}

/* Share buttons */
.share-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.share-buttons a {
  color: var(--primary);
  transition: opacity 0.2s;
}

.share-buttons a:hover {
  opacity: 0.8;
}

/* In-article ads styling */
.in-article-ad {
  margin: 2rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.in-article-ad::before {
  content: "Advertisement";
  display: block;
  font-size: 0.75rem;
  color: var(--text);
  opacity: 0.5;
  text-align: center;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}