:root {
  /* Core Palette */
  --bg-color: #050505;
  --bg-secondary: #0a0a0a;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --accent: #d4af37; /* Gold */
  --accent-dim: rgba(212, 175, 55, 0.1);
  --border-color: #222;
  --code-bg: #111;

  /* Typography */
  --font-serif: 'Playfair Display', serif;
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Layout */
  --content-width: 840px;
  --sidebar-width: 240px;
  --gap: 2rem;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.7;
  font-size: 1.05rem;
  -webkit-font-smoothing: antialiased;
}

/* --- Progress Bar --- */
#progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 1000;
  background: transparent;
}

#progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s ease-out;
}

/* --- Navigation --- */
nav {
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

/* --- Main Layout Grid --- */
.post-grid {
  display: grid;
  grid-template-columns: 1fr var(--content-width) 1fr;
  gap: var(--gap);
  max-width: 1440px;
  margin: 0 auto;
  padding-top: 4rem;
  position: relative;
}

/* --- Left Sidebar (Back Link & More) --- */
.sidebar-left {
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
  position: sticky;
  top: 6rem;
}

.back-link:hover {
  color: var(--accent);
}

/* --- Author Details --- */
.author-details-section {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
  padding: 0;
  border-top: none;
}

/* --- Author Details (Wide Card) --- */
.author-details-section {
  display: block; /* Let the card take full width naturally */
  margin: 2rem 0;
  padding: 0;
  border-top: none;
}

.author-card-wide {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.02), transparent);
  max-width: 500px;
  margin: 0 auto;
}

.author-avatar-medium {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.author-info-stack {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.author-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.author-name-large {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.author-socials-row {
  display: flex;
  gap: 1rem;
  margin-top: 0.25rem;
}

.author-socials-row a {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.author-socials-row a:hover {
  border-bottom-color: var(--accent);
  opacity: 0.8;
}

@media (max-width: 600px) {
  .author-card-wide {
    padding: 1rem;
    gap: 1rem;
  }
  
  .author-avatar-medium {
    width: 50px;
    height: 50px;
    font-size: 1rem;
  }
  
  .author-name-large {
    font-size: 1.2rem;
  }
}

/* --- Post Navigation (Next/Prev) --- */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-color);
  background-color: rgb(15, 15, 15);
}
.nav-prev,
.nav-next {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid transparent;
}

.nav-next {
  text-align: right;
  align-items: flex-end;
}

.nav-prev:hover,
.nav-next:hover {
  background: var(--shadow);
  border-color: var(--border-color);
  transform: translateY(-2px);
}

.nav-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.nav-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.nav-prev:hover .nav-title,
.nav-next:hover .nav-title {
  color: var(--accent);
}

/* --- Article Content --- */
article {
  min-width: 0; /* Prevents grid blowout */
  padding-bottom: 6rem;
}

.article-content {
  font-size: 1.2rem;
  line-height: 1.8;
}

.post-header {
  text-align: center;
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.article-title {
  font-family: var(--font-serif);
  font-size: 3rem;
  line-height: 1.1;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* Typography Content */
.article-content h2 {
  font-family: var(--font-serif);
  font-size: 2rem;
  margin: 3rem 0 1.5rem;
  color: var(--text-primary);
}

.article-content h3 {
  font-family: var(--font-sans);
  font-size: 1.4rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  color: var(--text-primary);
}

.article-content p {
  margin-bottom: 1.5rem;
  color: #ccc;
  font-weight: 300;
}

.article-content strong {
  color: #fff;
  font-weight: 600;
}

.article-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

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

.article-content ul,
.article-content ol {
  margin-bottom: 2rem;
  padding-left: 1.5rem;
  color: #ccc;
}

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

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--text-secondary);
}

/* Code Blocks */
.article-content pre {
  background: var(--code-bg);
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border-color);
  position: relative;
}

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--accent);
  color: #000;
  padding: 0.1em 0.3em;
  border-radius: 0px;
  font-weight: 300;
}

.article-content pre code {
  background: transparent;
  color: #e6e6e6;
  border: none;
  font-weight: 400;
  padding: 0;
}

/* Images */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 2.5rem auto;
  display: block;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* --- Right Sidebar (TOC) --- */
.sidebar-right {
  padding: 0 1rem;
}

.post-sidebar-heading {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

#post-toc {
  position: sticky;
  top: 6rem;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  padding-left: 1rem;
  border-left: 1px solid var(--border-color);
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

#post-toc::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.post-toc-list {
  list-style: none;
}

.post-toc-list li {
  margin-bottom: 0.8rem;
}

.post-toc-list a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: all 0.2s;
  display: block;
  line-height: 1.4;
}

.post-toc-list a:hover,
.post-toc-list a.active {
  color: var(--accent);
  transform: translateX(5px);
}

.toc-h3 {
  margin-left: 1rem;
  font-size: 0.8rem;
}

/* --- Custom Containers (Tips, Notes, Callouts) --- */
.custom-container {
  margin: 2.5rem 0;
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-left-width: 4px;
}

.custom-container-header {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.custom-container-icon {
  font-size: 1.1rem;
}

.custom-container-content p {
  margin-bottom: 0;
  color: #ddd;
  font-size: 1rem;
  line-height: 1.6;
}

/* Specific Types */
.custom-container-tip {
  border-left-color: #10b981; /* Emerald */
  background: rgba(16, 185, 129, 0.05);
}
.custom-container-tip .custom-container-header {
  color: #10b981;
}

.custom-container-info {
  border-left-color: #3b82f6; /* Blue */
  background: rgba(59, 130, 246, 0.05);
}
.custom-container-info .custom-container-header {
  color: #3b82f6;
}

.custom-container-warning {
  border-left-color: #f59e0b; /* Amber */
  background: rgba(245, 158, 11, 0.05);
}
.custom-container-warning .custom-container-header {
  color: #f59e0b;
}

.custom-container-danger {
  border-left-color: #ef4444; /* Red */
  background: rgba(239, 68, 68, 0.05);
}
.custom-container-danger .custom-container-header {
  color: #ef4444;
}

.custom-container-note {
  border-left-color: #8b5cf6; /* Violet */
  background: rgba(139, 92, 246, 0.05);
}
.custom-container-note .custom-container-header {
  color: #8b5cf6;
}

/* --- Share Links --- */
.share-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.share-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  background: var(--shadow);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.share-link svg {
  transition: transform 0.3s ease;
}

.share-link:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
}

.share-link:hover svg {
  transform: scale(1.1);
}

/* --- Like & Comments Section --- */
.like-section {
  text-align: center;
  padding: 3rem 0;
  margin-top: 2rem;
  border-top: none;
}

.like-section h3 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.like-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* --- Copy Button --- */
.copy-code-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-secondary);
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0;
}

.article-content pre:hover .copy-code-button {
  opacity: 1;
}

.copy-code-button:hover {
  background: var(--accent);
  color: #000;
}

/* --- Responsive Design --- */
@media (max-width: 1200px) {
  .post-grid {
    grid-template-columns: 80px 1fr 200px;
    gap: 1rem;
  }
  .sidebar-left span {
    display: none; /* Hide 'Back' text on smaller desktops */
  }
}

@media (max-width: 900px) {
  .post-grid {
    grid-template-columns: 1fr;
    display: block;
    padding: 0 1.5rem;
  }

  .sidebar-left,
  .sidebar-right {
    display: none; /* Hide sidebars on mobile/tablet */
  }

  /* Show back link at top differently on mobile */
  .sidebar-left {
    display: block;
    position: static;
    margin-bottom: 2rem;
    text-align: left;
    align-items: flex-start;
  }
  .sidebar-left span {
    display: inline;
  }

  .back-link {
    position: static;
  }

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

  nav {
    padding: 1rem;
  }
}
