/* ========== Article Page Styles ========== */
/* Editorial style matching the homepage design */

:root {
  --bg-primary: #f4f4f5;
  --bg-secondary: #ffffff;
  --text-primary: #1d1d1f;
  --text-secondary: #6b6b6b;
  --text-muted: #86868b;
  --accent: #0b57d0;
  --accent-light: #d3e3fd;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --radius: 24px;
  --radius-sm: 12px;
  --radius-full: 999px;
  --font-display: 'DM Serif Display', serif;
  --font-body: 'Google Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 720px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ========== Navigation ========== */
nav {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem;
}

.navbar {
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.navbar img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  margin-right: 8px;
}

.navbar a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.navbar a:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.navbar a:active {
  transform: scale(0.95);
}

/* ========== Article Container ========== */
.article-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 120px 24px 80px;
}

/* ========== Article Header ========== */
.article-header {
  margin-bottom: 4rem;
  text-align: center;
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.15;
  margin: 0 0 1.5rem;
  letter-spacing: -1px;
}

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

.article-meta time {
  font-family: var(--font-display);
  color: var(--text-primary);
}

.article-meta .category {
  background-color: var(--accent-light);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.article-meta .read-time::before {
  content: '·';
  margin-right: 1rem;
  color: var(--border);
}

/* ========== Article Content (Markdown Styles) ========== */
.article-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.article-content > * {
  margin-bottom: 1.5rem;
}

/* Headings */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  font-family: var(--font-display);
  color: var(--text-primary);
  margin-top: 3rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  letter-spacing: -0.5px;
}

.article-content h1 {
  font-size: 2rem;
  margin-top: 0;
}

.article-content h2 {
  font-size: 1.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

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

.article-content h4 {
  font-size: 1.25rem;
}

.article-content h5,
.article-content h6 {
  font-size: 1.1rem;
}

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

/* Links */
.article-content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.article-content a:hover {
  border-bottom-color: var(--accent);
}

/* Emphasis */
.article-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-content em {
  font-style: italic;
}

.article-content del {
  text-decoration: line-through;
  opacity: 0.6;
}

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

.article-content ul {
  list-style: none;
  padding-left: 0;
}

.article-content ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}

.article-content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  border-radius: 50%;
}

.article-content ol {
  list-style: decimal;
  padding-left: 1.5rem;
}

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

/* Blockquotes */
.article-content blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  background-color: rgba(11, 87, 208, 0.05);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}

.article-content blockquote p {
  margin: 0;
  color: var(--text-primary);
}

.article-content blockquote p::before {
  content: '"';
  font-size: 2rem;
  line-height: 0;
  vertical-align: -0.5rem;
  margin-right: 0.25rem;
  color: var(--accent);
  opacity: 0.5;
}

/* Code Blocks */
.code-block-wrapper {
  position: relative;
  margin: 2rem 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: #1d1d1f;
  padding-top: 2.5rem;
}

.code-lang {
  position: absolute;
  top: 0;
  left: 0;
  padding: 8px 16px;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom-right-radius: var(--radius-sm);
}

.code-block {
  margin: 0;
  padding: 0 1.5rem 1.5rem 1.5rem;
  overflow-x: auto;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  background-color: transparent;
}

.code-block code {
  color: #e2e2e2;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

/* Syntax Highlighting Tokens */
.token.comment {
  color: #676e95;
  font-style: italic;
}

.token.string {
  color: #c3e88d;
}

.token.keyword {
  color: #c792ea;
  font-weight: 600;
}

.token.boolean {
  color: #ff5370;
}

.token.function {
  color: #82aaff;
}

.token.builtin {
  color: #f78c6c;
}

.token.number {
  color: #f78c6c;
}

.token.operator {
  color: #89ddff;
}

/* HTML/XML Tokens */
.token.tag {
  color: #ff5370;
}

.token.attr-name {
  color: #c792ea;
}

.token.attr-value {
  color: #c3e88d;
}

/* CSS Tokens */
.token.selector {
  color: #ffcb6b;
}

.token.property {
  color: #82aaff;
}

.token.value {
  color: #c3e88d;
}

.token.color {
  color: #f78c6c;
}

/* Python/Bash Tokens */
.token.variable {
  color: #ffcb6b;
}

/* JSON Tokens */
.token.punctuation {
  color: #89ddff;
}

/* SQL Tokens */
.token.statement {
  color: #c792ea;
  font-weight: 600;
}

/* Inline Code */
.inline-code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
  font-size: 0.85em;
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* Copy Button */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: none;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  opacity: 0;
}

.code-block-wrapper:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.copy-btn.copied {
  background-color: #3ddc84;
  color: white;
}

/* Images */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 2rem 0;
  display: block;
  cursor: zoom-in;
  transition: transform 0.3s;
}

.article-content img:hover {
  transform: scale(1.01);
}

/* Horizontal Rule */
.article-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 3rem 0;
}

/* ========== Article Footer ========== */
.article-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.article-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: var(--radius-full);
  font-weight: 500;
  transition: all 0.3s;
  box-shadow: var(--shadow);
}

.back-btn:hover {
  transform: translateX(-4px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.share-btn {
  width: 48px;
  height: 48px;
  border: none;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.3s;
  box-shadow: var(--shadow);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

/* ========== Loading & Error States ========== */
.article-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.article-error {
  text-align: center;
  padding: 4rem 2rem;
}

.article-error i {
  font-size: 3rem;
  color: #ff3b30;
  margin-bottom: 1rem;
}

.article-error p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.back-link {
  display: inline-block;
  padding: 12px 24px;
  background-color: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-full);
  font-weight: 500;
  transition: all 0.3s;
}

.back-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(11, 87, 208, 0.3);
}

/* ========== Image Lightbox ========== */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.image-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.lightbox-img {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.image-lightbox.active .lightbox-img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border: none;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s;
}

.lightbox-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* ========== Cursor ========== */
#cursor {
  position: fixed;
  width: 18px;
  height: 18px;
  background: #000000;
  border-radius: 25px;
  opacity: 0.25;
  z-index: 10001;
  pointer-events: none;
  transition: 0.2s ease-in-out;
  transition-property: background, opacity, transform;
}

#cursor.hidden {
  opacity: 0;
}

#cursor.active {
  opacity: 0.5;
  transform: scale(0.5);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .article-container {
    padding: 100px 20px 60px;
  }

  .article-title {
    font-size: 2rem;
  }

  .article-content {
    font-size: 1rem;
  }

  .code-block {
    padding: 1rem;
    font-size: 0.8rem;
  }

  .article-actions {
    flex-direction: row;
  }

  .back-btn {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 4px 8px;
  }

  .navbar a {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .navbar a span {
    display: none;
  }

  .navbar a i {
    font-size: 1.1rem;
  }

  .article-header {
    margin-bottom: 2.5rem;
  }

  .article-meta {
    font-size: 0.8rem;
  }

  .article-content h2 {
    font-size: 1.5rem;
  }

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

