:root {
  /* Core theme colors - light mode default */
  --theme: #fff;
  --entry: #fff;
  --primary: rgba(0, 0, 0, 0.88);
  --secondary: rgba(0, 0, 0, 0.56);
  --tertiary: rgba(0, 0, 0, 0.16);
  --content: rgba(0, 0, 0, 0.74);
  --border: #eee;
  --code-bg: #f5f5f5;
  --radius: 8px;
  --gap: 24px;
  /* Fonts */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --font-title: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --shadow: rgba(0, 0, 0, 0.05);
  --link-hover: #2850ad;
  /* Responsive variables */
  --content-width: 750px;
  /* Add transition variables for theme changes */
  --theme-transition: background 0.3s ease, background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* System preference for dark mode - update to use .dark-theme class */
@media (prefers-color-scheme: dark) {
  :root:not(.light-theme) {
    --theme: rgb(29, 30, 32);
    --entry: rgb(46, 46, 51);
    --primary: rgb(218, 218, 219);
    --secondary: rgb(155, 156, 157);
    --tertiary: rgb(65, 66, 68);
    --content: rgb(196, 196, 197);
    --border: rgb(51, 51, 51);
    --shadow: rgba(0, 0, 0, 0.2);
    --link-hover: #6b8edb;
    --code-bg: rgb(40, 42, 48);
  }
}

/* Manual dark mode - use the standard class name */
.dark-theme {
  --theme: rgb(29, 30, 32);
  --entry: rgb(46, 46, 51);
  --primary: rgb(218, 218, 219);
  --secondary: rgb(155, 156, 157);
  --tertiary: rgb(65, 66, 68);
  --content: rgb(196, 196, 197);
  --border: rgb(51, 51, 51);
  --shadow: rgba(0, 0, 0, 0.2);
  --link-hover: #6b8edb;
  --code-bg: rgb(40, 42, 48);
}

/* Manual light mode - this overrides system preference */
.light-theme {
  --theme: #fff;
  --entry: #fff;
  --primary: rgba(0, 0, 0, 0.88);
  --secondary: rgba(0, 0, 0, 0.56);
  --tertiary: rgba(0, 0, 0, 0.16);
  --content: rgba(0, 0, 0, 0.74);
  --border: #eee;
  --code-bg: #f5f5f5;
  --shadow: rgba(0, 0, 0, 0.05);
  --link-hover: #2850ad;
}

/* Basic reset with improved transitions */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Apply transitions to all properties that change with themes */
  transition: var(--theme-transition);
}

/* Force color-specific elements to use the theme colors */
*:not(svg *) {
  color: var(--primary);
  border-color: var(--border);
}

/* Optimize body with content-visibility for better rendering */
body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--primary);
  background: var(--theme);
  width: 92%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 20px;
  transition: var(--theme-transition);
}

/* Fix specific elements that might not transition properly */
a, button, input, textarea, select {
  color: var(--primary);
  transition: var(--theme-transition);
}

pre, code {
  background-color: var(--code-bg) !important;
  transition: var(--theme-transition);
}

/* Ensure all borders use theme colors */
*[style*="border"] {
  border-color: var(--border) !important;
}

/* Ensure all backgrounds use theme colors where appropriate */
.post-card, .post-entry, .list-item, article, section, .taxonomy-container {
  background-color: var(--entry) !important;
  transition: var(--theme-transition);
}

/* Dark mode toggle styling with improved transition handling */
.dark-mode-toggle {
  margin-left: auto;
  padding: 4px 10px;
  color: var(--secondary) !important;
  background: var(--code-bg) !important;
  font-size: 14px;
  text-decoration: none;
  border-radius: var(--radius);
  transition: var(--theme-transition);
}

.dark-mode-toggle:hover {
  color: var(--link-hover) !important;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover);
}

/* Header styling */
header {
  margin-bottom: var(--gap);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  transition: var(--theme-transition);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

/* New title and logo wrapper */
.title-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative; /* Create stacking context */
}

/* Logo styling - fixed for visibility */
.site-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative; /* Ensure proper stacking context */
  z-index: 10; /* Higher z-index to prevent hiding */
  width: 32px;
  height: 32px;
  margin-right: 8px;
}

/* Special class for logo that should never be hidden */
.permanent-logo {
  width: 32px !important;
  height: 32px !important;
  color: var(--primary);
  transition: transform 0.3s ease, color 0.3s ease;
  display: block !important; /* Force display */
  position: relative; 
  z-index: 10 !important; /* Keep above other elements */
  visibility: visible !important;
  opacity: 1 !important;
  object-fit: contain !important; /* Preserve logo aspect ratio */
}

/* Ensure the logo container in header has proper stacking */
.logo-container {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  overflow: visible;
}

.site-logo svg,
.site-logo img {
  width: 32px;
  height: 32px;
  color: var(--primary);
  transition: transform 0.3s ease, color 0.3s ease;
  display: block; /* Ensure it's always a block element */
  position: relative; /* Create stacking context */
  z-index: 2; /* Keep above other elements */
}

.site-logo:hover svg,
.site-logo:hover img {
  transform: scale(1.1);
  color: var(--link-hover);
}

/* Site title should not overlap with logo */
.site-title {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--secondary);
  letter-spacing: 0.02em;
  margin: 0;
  flex-shrink: 0;
  position: relative; /* Create stacking context */
  z-index: 1; /* Lower than logo */
}

/* Ensure consistent site title appearance across all page types */
.single-post header .site-title,
.post-list header .site-title {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--secondary);
  letter-spacing: 0.02em;
  margin: 0;
}

.nav-wrapper {
  flex-grow: 1;
  display: flex;
  justify-content: flex-end;
}

/* Navigation styling */
nav ul {
  display: flex;
  list-style: none;
  gap: 24px;
}

nav a {
  font-size: 16px;
  text-decoration: none;
  color: var(--primary);
  padding: 5px 0;
  position: relative;
  transition: color 0.2s ease;
}

nav a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--link-hover);
  transition: width 0.3s ease;
}

nav a:hover::after {
  width: 100%;
}

nav a.active {
  font-weight: 500;
  color: var(--link-hover);
}

nav a.active::after {
  width: 100%;
  background-color: var(--link-hover);
}

/* Mobile responsive navigation */
@media (max-width: 650px) {
  .header-container {
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }
  
  .title-wrapper {
    justify-content: center;
  }
  
  .nav-wrapper {
    justify-content: center;
    width: 100%;
  }
  
  nav ul {
    justify-content: center;
    width: 100%;
  }
}

/* Main content */
main {
  margin-top: var(--gap);
}

/* Post entries styling */
main h2 {
  font-size: 24px;
  margin-bottom: 10px;
  font-family: var(--font-title);
}

main h2 a {
  color: var(--primary);
  text-decoration: none;
}

main h2 a:hover {
  text-decoration: underline;
}

/* Remove or comment out the problematic styling */
/* .post-list main > h2, 
.post-list main > p {
  background: var(--entry);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  margin-bottom: var(--gap);
} */

/* Update post-entry styling to handle both title and content */
.post-entry {
  position: relative;
  margin-bottom: var(--gap);
  padding: var(--gap);
  background: var(--entry);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px var(--shadow);
  content-visibility: auto;
  contain-intrinsic-size: 0 500px; /* Approximate height to prevent layout shift */
}

.post-entry h2 {
  margin-bottom: 1rem;
  font-family: var(--font-title);
}

.post-entry p {
  color: var(--content);
}

/* Posts list page styling */
.posts-list article {
  position: relative;
  margin-bottom: var(--gap);
  padding: var(--gap);
  background: var(--entry);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px var(--shadow);
}

.posts-list h2, .posts-list h3 {
  margin-bottom: 1rem;
}

.posts-list p {
  color: var(--content);
}

.posts-list .entry-content {
  margin-top: 0.5rem;
}

/* Ensure all list items in post listings have consistent styling */
.list-item {
  position: relative;
  margin-bottom: var(--gap);
  padding: var(--gap);
  background: var(--entry);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px var(--shadow);
}

/* Single post content styling - flatter design */
.single-post main > h2,
.single-post main > p,
.single-post main > section {
  padding: 0;
  background: transparent;
  border: none;
  margin-bottom: 1.5rem;
}
.single-post main {
  max-width: 100%;
}

/* Make images more seamless in single posts */
.single-post img {
  margin: 2rem 0;
  max-width: 100%;
  display: block;
}
/* Update title styling in single posts */
.single-post h1 {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}
/* Additional typography improvements for single posts */
.single-post h1, .single-post h2, .single-post h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-family: var(--font-title);
}

.single-post p {
  margin-bottom: 1.5rem;
  line-height: 1.7;
  font-size: 18px;
  letter-spacing: 0.01em;
  font-family: var(--font-sans);
}

/* Add a drop cap to the first paragraph for a newspaper feel (optional) */
.single-post .content > p:first-of-type::first-letter {
  float: left;
  font-size: 3.5em;
  line-height: 0.8;
  margin-right: 0.1em;
  padding-top: 0.1em;
}
/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 15px 0;
}

/* Footer styling */
footer {
  margin-top: var(--gap);
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--secondary);
  font-size: 14px;
}

/* Improved code blocks */
pre {
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow-x: auto;
  border: 1px solid var(--border);
}

code {
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background: var(--code-bg);
  border-radius: 3px;
}

/* Posts list page styling */
.posts-container {
  display: grid;
  gap: var(--gap);
}

.post-card, .post-entry {
  position: relative;
  padding: var(--gap);
  background: var(--entry);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  content-visibility: auto;
  contain-intrinsic-size: 0 500px; /* Approximate height to prevent layout shift */
}

/* Enhanced featured image styling for cards */
.post-featured-image {
  margin: -24px -24px 20px -24px; /* Negative margin to extend to card edges */
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
  background-color: var(--tertiary); /* Background visible during loading */
  min-height: 180px;
  max-height: 300px;
  display: block; /* Ensure this is displayed as a block */
}

/* Responsive ratio box container for maintaining aspect ratio */
.image-ratio-box {
  position: relative;
  height: 0;
  overflow: hidden;
  width: 100%;
  background-color: var(--tertiary); /* Add background color visible during loading */
  /* Default aspect ratio will be overridden inline */
}

/* Card image styling - ensure always visible */
.card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  transition: transform 0.3s ease;
  opacity: 1 !important; /* Force visibility */
  opacity: 1; /* Make images visible by default */
  will-change: transform;
}

/* Hover effect */
.post-card:hover .card-image,
.post-entry:hover .card-image {
  transform: scale(1.05);
}


/* Improved lazy loading for images - CONSOLIDATED */
.card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  transition: transform 0.3s ease;
  opacity: 1; /* Make images visible by default */
}


/* Enhanced featured image styling for cards - FIX VISIBILITY */
.post-featured-image {
  margin: -24px -24px 20px -24px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
  background-color: var(--tertiary); 
  min-height: 180px;
  max-height: 300px;
  display: block; /* Ensure this is displayed as a block */
}

/* Fix image placeholders */
.image-ratio-box {
  position: relative;
  height: 0;
  overflow: hidden;
  width: 100%;
  background-color: var(--tertiary); /* Add background color visible during loading */
}

/* Prevent layout shift by setting fixed aspect ratios */
.post-featured-image .image-ratio-box {
  min-height: 0; /* Override any min-height that may cause shift */
}

/* Remove conflicting rules that hide or show images */
/* 
.placeholder-image {
  display: none;
}
*/

/* Fix layout shift by ensuring image placeholders have proper dimensions */
@media (max-width: 650px) {
  .post-featured-image {
    margin: -16px -16px 16px -16px;
    min-height: 150px;
  }

  /* Ensure image containers maintain proper size on mobile */
  .image-ratio-box {
    min-height: 0; /* Override any min-height */
  }
}

/* Image hover effect */
.post-card:hover,
.post-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow);
}

/* When no image is present, add more top padding */
.post-card.no-image,
.post-entry.no-image {
  padding-top: var(--gap);
}

/* Fix for image cards - replace or update the current .post-featured-image style */
.post-featured-image {
  margin: -24px -24px 20px -24px; /* Negative margin to extend to card edges */
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
  background-color: var(--tertiary); /* Add background color to be visible during loading */
}

/* New ratio box container to maintain aspect ratio */
.image-ratio-box {
  position: relative;
  height: 0;
  overflow: hidden;
  width: 100%;
  /* Default aspect ratio will be overridden inline */
}

.card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  transition: transform 0.3s ease;
  opacity: 1 !important; /* Force image visibility */
}

.post-card:hover .card-image {
  transform: scale(1.05);
}

/* Fix conflicting image opacity rules */
img[data-src] {
  opacity: 1; /* Always start visible */
  transition: opacity 0.5s;
}

img[data-src].loaded {
  opacity: 1;
}

/* Improved lazy loading for images */
img[data-src] {
  opacity: 1; /* Change from 0 to 1 to avoid images being invisible */
  transition: opacity 0.5s;
}

img[data-src].loaded {
  opacity: 1;
}

/* Improved lazy loading for images */
img[data-src] {
  opacity: 0;
  transition: opacity 0.5s;
}

img[data-src].loaded {
  opacity: 1;
}

/* Image placeholders */
.image-placeholder {
  background: var(--tertiary);
  position: relative;
  overflow: hidden;
}

.image-placeholder::before {
  content: "";
  display: block;
  position: absolute;
  left: -150px;
  top: 0;
  height: 100%;
  width: 150px;
  background: linear-gradient(to right, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
  animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(100% + 150px));
  }
}

/* Mobile adjustments for images */
@media (max-width: 650px) {
  .post-featured-image {
    margin: -16px -16px 16px -16px;
    min-height: 150px; /* Ensure image area is visible on mobile */
  }

  /* Ensure images are visible on mobile */
  .image-ratio-box {
    min-height: 150px;
  }
}

/* Better handling of images in single post view */
.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
  border-radius: var(--radius);
}

/* Featured image for post cards */
.post-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  transition: transform 0.3s ease;
}

.post-card:hover .post-featured-image img {
  transform: scale(1.05);
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow);
}

/* When no image is present, add more top padding */
.post-card.no-image {
  padding-top: var(--gap);
}

.post-card h2 {
  margin-bottom: 0.5rem;
  font-family: var(--font-title);
}

.post-meta {
  color: var(--secondary);
  font-size: 0.9em;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.post-meta time {
  background: var(--code-bg);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
}

.reading-time {
  background: var(--code-bg);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
}

.read-more {
  display: inline-block;
  font-weight: 500;
  margin-top: 0.5rem;
}

/* Single post title centering */
.post-title.centered {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Date styling with lighter background and rounded corners */
.post-date {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.post-date time {
  background: var(--code-bg);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--secondary);
  display: inline-block;
}

/* Improved tags styling */
.taxonomy-container {
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--entry);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.taxonomy-label {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

.taxonomy-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.taxonomy-item {
  background: var(--code-bg);
  border-radius: 20px;
  overflow: hidden;
  transition: background-color 0.2s ease;
}

.taxonomy-item:hover {
  background: var(--tertiary);
}

.taxonomy-item a {
  display: block;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
  color: var(--secondary);
  transition: color 0.2s ease;
}

.taxonomy-item a:hover {
  color: var(--primary);
}

/* 404 Error Page Styling */
.error-page {
  text-align: center;
  padding: 3rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.error-page h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.error-page p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: var(--secondary);
}

.error-image {
  margin: 3rem 0;
}

.large-emoji {
  font-size: 5rem;
  display: inline-block;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

.error-page a {
  color: var(--link-hover);
  text-decoration: underline;
  font-weight: 500;
}

/* Lazy loading and responsive image containers */
.lazy-image {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lazy-image.loaded {
  opacity: 1;
}

.image-placeholder {
  background: var(--tertiary);
  position: relative;
  overflow: hidden;
}

.image-placeholder::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Optimize images */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 15px 0;
  opacity: 1; /* Ensure images are visible by default */
}

/* Improve image handling in posts */
.responsive-image-container {
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* Lightbox styling */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  cursor: pointer;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  margin: 0;
  object-fit: contain;
}

/* Mobile responsive adjustments */
@media (max-width: 650px) {
  :root {
    --gap: 16px;
  }
  
  body {
    padding: 15px;
    width: 95%;
  }
  
  .header-container {
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }
  
  .nav-wrapper {
    justify-content: center;
    width: 100%;
  }
  
  nav ul {
    justify-content: center;
    width: 100%;
  }
  
  .post-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .dark-mode-toggle {
    margin: 10px auto 0;
  }
  
  /* Optimize post cards for mobile */
  .post-card {
    padding: 16px;
  }
  
  .post-featured-image {
    margin: -16px -16px 16px -16px;
    height: 180px;
  }
  
  /* Optimize typography for small screens */
  .single-post h1 {
    font-size: 1.8rem;
  }
  
  .single-post p {
    font-size: 16px;
  }
}

/* Small device optimizations */
@media (max-width: 400px) {
  :root {
    --gap: 12px;
  }
  
  body {
    padding: 12px;
    font-size: 15px;
  }
  
  .single-post h1 {
    font-size: 1.6rem;
  }
  
  .header-container {
    gap: 20px;
  }
}

/* Print styles for better printing */
@media print {
  body {
    background: white;
    color: black;
    max-width: 100%;
    width: 100%;
    padding: 0;
  }
  
  header, footer, .dark-mode-toggle, nav {
    display: none;
  }
  
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  p, li {
    page-break-inside: avoid;
  }
}

/* Improved font loading performance */
@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Libre Baskerville');
}

@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local('Libre Baskerville Bold');
}

/* Add support for modern image formats */
.avif .responsive-image-container img {
  width: 100%;
}

/* Enhanced lazy loading styles */
.lazyload,
.lazyloading {
  opacity: 0;
}

.lazyloaded {
  opacity: 1;
  transition: opacity 300ms;
}

/* Prevent layout shift for images */
img[loading] {
  aspect-ratio: attr(width) / attr(height);
}

@supports (font-size: clamp(1rem, 2vw, 2rem)) {
  h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }
  
  h2 {
    font-size: clamp(1.3rem, 3vw, 2rem);
  }
  
  body {
    font-size: clamp(16px, 2vw, 18px);
  }
}

/* Enable 'Back Forward Cache' optimization */
.single-post {
  scroll-behavior: smooth;
}

/* Fix image loading states */
img.broken-image {
  opacity: 0.5;
  filter: grayscale(100%);
}

.image-error-debug {
  background: rgba(255, 0, 0, 0.1);
  padding: 4px 8px;
  border-radius: var(--radius);
  color: var(--primary);
  font-size: 12px;
  text-align: center;
}

/* Empty featured image placeholder */
.empty-featured-image,
.placeholder-image {
  display: none;
}

.placeholder-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: bold;
  color: var(--entry);
  background-color: var(--tertiary);
  opacity: 0.7;
  text-transform: uppercase;
}

/* Post cards with and without images */
.post-card.no-image,
.post-entry.no-image {
  padding-top: var(--gap);
  /* Remove any styling that might create an empty space for images */
}

/* When no image is present, add more top padding for better spacing */
.post-card.no-image h2,
.post-entry.no-image h2 {
  margin-top: 0;
  padding-top: 0;
}

/* Remove the empty-featured-image class and styling */
.empty-featured-image,
.placeholder-image {
  display: none; /* Hide these elements completely */
}

/* Loading placeholder that shows before the image loads */
.post-featured-image::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--tertiary);
  z-index: -1;
}