/* Individual Blog Post Styles */

/* Override sticky header on blog post pages */
header {
  position: static !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.blog-post-main {
  padding-top: 2rem;
  min-height: calc(100vh - 200px);
}

/* Breadcrumb */
.breadcrumb {
  padding: 2rem 1rem 1rem;
  font-size: 0.875rem;
  color: #666;
  max-width: 800px;
  margin: 0 auto;
}

.breadcrumb a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb a:hover {
  color: #1a1a1a;
}

.breadcrumb span {
  margin: 0 0.5rem;
}

/* Article Container */
.blog-post {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

/* Mobile responsive breadcrumb and container */
@media (max-width: 768px) {
  .breadcrumb {
    padding: 1.5rem 1.5rem 0.75rem;
  }
  
  .blog-post {
    padding: 0 1.5rem 3rem;
  }
}

@media (max-width: 480px) {
  .breadcrumb {
    padding: 1rem 1rem 0.5rem;
    font-size: 0.8rem;
  }
  
  .blog-post {
    padding: 0 1rem 2rem;
  }
}

/* Post Header */
.post-header {
  margin-bottom: 3rem;
  text-align: center;
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #888;
}

.post-reading-time::before {
  content: "•";
  margin-right: 0.5rem;
  color: #ccc;
}

.post-title {
  font-size: clamp(1.25rem, 3.5vw, 1.875rem);
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 1.5rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.post-summary {
  font-size: clamp(0.9rem, 2.5vw, 1.125rem);
  color: #666;
  line-height: 1.6;
  font-weight: 400;
  max-width: 100%;
  margin: 0 auto;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Mobile responsive post header */
@media (max-width: 768px) {
  .post-header {
    margin-bottom: 2rem;
    text-align: left;
  }
  
  .post-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .post-title {
    margin-bottom: 1rem;
    text-align: left;
  }
  
  .post-summary {
    text-align: left;
    margin: 0;
  }
  
  /* Mobile content improvements */
  .post-content p {
    text-align: left;
  }
  
  .post-content h1,
  .post-content h2,
  .post-content h3,
  .post-content h4 {
    margin-top: 2rem;
  }
  
  .post-content > * + h1,
  .post-content > * + h2 {
    margin-top: 2.5rem;
  }
  
  .post-content > * + h3,
  .post-content > * + h4 {
    margin-top: 2rem;
  }
}

@media (max-width: 480px) {
  .post-header {
    margin-bottom: 1.5rem;
  }
  
  .post-title {
    font-size: clamp(1.125rem, 4vw, 1.5rem);
    line-height: 1.25;
    margin-bottom: 1rem;
  }
  
  .post-summary {
    font-size: clamp(0.875rem, 3vw, 1rem);
    line-height: 1.5;
  }
  
  .post-meta {
    font-size: 0.8rem;
    gap: 0.5rem;
  }
}

@media (max-width: 360px) {
  .post-title {
    font-size: 1.125rem;
    line-height: 1.2;
  }
  
  .post-summary {
    font-size: 0.875rem;
    line-height: 1.4;
  }
}

/* Featured Image */
.post-featured-image {
  margin: 3rem 0;
  border-radius: 24px;
  overflow: hidden;
  aspect-ratio: 16/9;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.post-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile responsive featured image */
@media (max-width: 768px) {
  .post-featured-image {
    margin: 2rem 0;
    border-radius: 20px;
    aspect-ratio: 4/3;
  }
}

@media (max-width: 480px) {
  .post-featured-image {
    margin: 1.5rem 0;
    border-radius: 16px;
  }
}

/* Post Content */
.post-content {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  line-height: 1.8;
  color: #333;
  margin-bottom: 4rem;
  max-width: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  font-weight: 700;
  color: #1a1a1a;
  margin: 2.5rem 0 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-content h1 {
  font-size: clamp(1.5rem, 3.5vw, 1.875rem);
  border-bottom: 2px solid #e5e5e5;
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.post-content h2 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}

.post-content h3 {
  font-size: clamp(1.125rem, 2.5vw, 1.25rem);
  margin-bottom: 1rem;
}

.post-content h4 {
  font-size: clamp(1rem, 2vw, 1.125rem);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 1rem;
  color: #666;
}

.post-content p {
  margin-bottom: 1.75rem;
  line-height: 1.8;
  text-align: justify;
  text-justify: inter-word;
}

.post-content p:last-child {
  margin-bottom: 0;
}

.post-content p:first-of-type {
  font-size: 1.125em;
  font-weight: 500;
  color: #2a2a2a;
  margin-bottom: 2rem;
}

.post-content a {
  color: #1a1a1a;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.post-content a:hover {
  color: #666;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.post-content strong {
  font-weight: 700;
  color: #1a1a1a;
}

.post-content em {
  font-style: italic;
  color: #444;
}

.post-content ul,
.post-content ol {
  margin: 2rem 0;
  padding-left: 2rem;
}

.post-content li {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.post-content li:last-child {
  margin-bottom: 0;
}

.post-content ul li::marker {
  color: #666;
}

/* Article content formatting improvements */
#article-content {
  line-height: 1.7;
}

#article-content p {
  margin-bottom: 1.5rem;
}

#article-content p:empty {
  display: none;
}

/* Prevent overly long paragraphs from looking stacked */
#article-content p {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Add spacing between different content types */
#article-content h1 + p,
#article-content h2 + p,
#article-content h3 + p,
#article-content h4 + p {
  margin-top: 1rem;
}

#article-content ul + p,
#article-content ol + p {
  margin-top: 1.5rem;
}

#article-content p + ul,
#article-content p + ol {
  margin-top: 1rem;
}

#article-content ul,
#article-content ol {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
}

/* Ensure global numbering continues across multiple ol elements */
#article-content {
  counter-reset: global-list-counter;
}

#article-content ol {
  counter-reset: none !important;
  list-style: none !important;
  list-style-type: none !important;
}

#article-content ol li {
  counter-increment: global-list-counter;
  list-style: none !important;
  list-style-type: none !important;
  display: list-item;
}

#article-content ol li::before {
  content: counter(global-list-counter) ". ";
  font-weight: inherit;
  margin-right: 0.5rem;
  color: inherit;
}

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

#article-content ul li {
  display: list-item;
  list-style-position: outside;
}

#article-content ul li,
#article-content ol li {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

#article-content ul li:last-child,
#article-content ol li:last-child {
  margin-bottom: 0;
}

#article-content h1,
#article-content h2,
#article-content h3,
#article-content h4,
#article-content h5,
#article-content h6 {
  margin: 2rem 0 1rem;
  font-weight: 600;
  line-height: 1.3;
}

#article-content h1:first-child,
#article-content h2:first-child,
#article-content h3:first-child {
  margin-top: 0;
}

#article-content strong {
  font-weight: 600;
  color: #1a1a1a;
}

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

#article-content code {
  background: #f5f5f5;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9em;
}

/* Mobile responsive lists and content */
@media (max-width: 480px) {
  .post-content ul,
  .post-content ol {
    padding-left: 1.25rem;
    margin: 1.5rem 0;
  }
  
  #article-content ul,
  #article-content ol {
    padding-left: 1.25rem;
    margin: 1.25rem 0;
  }
  
  #article-content ul li,
  #article-content ol li {
    margin-bottom: 0.5rem;
  }
  
  #article-content h1,
  #article-content h2,
  #article-content h3,
  #article-content h4 {
    margin: 1.5rem 0 0.75rem;
  }
  
  #article-content p {
    margin-bottom: 1.25rem;
  }
  
  .post-content li {
    margin-bottom: 0.5rem;
  }
}

.post-content blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  background: #f8f8f8;
  border-left: 4px solid #1a1a1a;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.1em);
  color: #555;
}

/* Mobile responsive blockquotes */
@media (max-width: 480px) {
  .post-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left-width: 3px;
  }
}

.post-content blockquote p {
  margin-bottom: 0;
}

.post-content pre {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 2rem 0;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: clamp(0.75rem, 2vw, 0.875rem);
  line-height: 1.6;
}

/* Mobile responsive code blocks */
@media (max-width: 480px) {
  .post-content pre {
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 6px;
  }
}

.post-content code {
  background: #f0f0f0;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 0.875em;
  color: #e83e8c;
}

.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

.post-content img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 2rem 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Mobile responsive content images */
@media (max-width: 480px) {
  .post-content img {
    margin: 1.5rem 0;
    border-radius: 6px;
  }
}

.post-content hr {
  border: none;
  height: 1px;
  background: #e5e5e5;
  margin: 3rem 0;
}

/* Article section spacing */
.post-content > * + h1,
.post-content > * + h2 {
  margin-top: 3.5rem;
}

.post-content > * + h3,
.post-content > * + h4 {
  margin-top: 3rem;
}

/* Better quote styling */
.post-content blockquote {
  position: relative;
}

.post-content blockquote::before {
  content: '"';
  position: absolute;
  top: -0.5rem;
  left: -0.5rem;
  font-size: 4rem;
  color: #ddd;
  font-family: Georgia, serif;
  line-height: 1;
}

/* Code styling improvements */
.post-content :not(pre) > code {
  background: #f8f8f8;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
  color: #d63384;
  font-weight: 500;
}

/* Table of contents styling if present */
.post-content .toc {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.post-content .toc h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: #495057;
  border: none;
  padding: 0;
}

.post-content .toc ul {
  margin: 0;
  padding-left: 1.5rem;
}

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

/* Post Footer */
.post-footer {
  border-top: 1px solid #e5e5e5;
  padding-top: 2rem;
}

.post-footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  background: #f0f0f0;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: clamp(0.7rem, 2vw, 0.75rem);
  font-weight: 500;
  color: #555;
  transition: background-color 0.2s ease;
}

.tag:hover {
  background: #e0e0e0;
}

.back-to-blog-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: #f5f5f5;
  color: #1a1a1a;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: clamp(0.8rem, 2vw, 0.875rem);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.back-to-blog-btn:hover {
  background: #e5e5e5;
  transform: translateY(-1px);
}

/* Mobile responsive footer */
@media (max-width: 768px) {
  .post-footer {
    padding-top: 1.5rem;
  }
  
  .post-footer-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }
  
  .post-tags {
    order: 1;
  }
  
  .post-actions {
    order: 2;
    width: 100%;
  }
  
  .back-to-blog-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem 1.25rem;
  }
}

@media (max-width: 480px) {
  .post-footer-content {
    gap: 1rem;
  }
  
  .tag {
    padding: 0.2rem 0.6rem;
  }
  
  .back-to-blog-btn {
    padding: 0.875rem 1rem;
  }
}

/* Error State */
.error-state {
  text-align: center;
  padding: 6rem 0;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.error-state h2 {
  font-size: 2rem;
  color: #1a1a1a;
  margin-bottom: 1rem;
}

.error-state p {
  color: #666;
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .back-to-blog-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  .tag {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }
}

/* High DPI display optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .post-featured-image {
    image-rendering: -webkit-optimize-contrast;
  }
  
  .post-content img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Print styles */
@media print {
  .breadcrumb,
  .post-footer,
  .back-to-blog-btn {
    display: none;
  }
  
  .post-content {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
  }
  
  .post-title {
    font-size: 18pt;
    color: #000;
  }
  
  .post-content h1,
  .post-content h2,
  .post-content h3,
  .post-content h4 {
    color: #000;
    page-break-after: avoid;
  }
}