:root {
  --color-primary: #1c2a39; /* Deep navy */
  --color-accent: #d4a017; /* Gold/amber */
  --color-neutral: #f9f9f7; /* Warm white */
  --color-contrast: #4a4a4a; /* Slate gray */
  --font-header: "Merriweather", serif;
  --font-body: "Lato", sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-contrast);
  background: var(--color-neutral);
  font-size: 16px;
  line-height: 1.6;
}

/* Improve mobile readability */
@media (width <= 600px) {
  body {
    font-size: 15px;
    line-height: 1.65;
  }
}

.site-header {
  background: var(--color-primary);
  color: var(--color-neutral);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: box-shadow 0.3s ease;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-header.scrolled {
  box-shadow: 0 2px 10px rgb(0 0 0 / 15%);
}

/* Safe header fixes: constrain logo size and ensure header text uses header font */
.site-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-logo {
  max-height: 80px; /* cap very large images */
  height: auto;
  width: auto;
  display: block;
}

.site-title {
  margin: 0;
  font-family: var(--font-header);
}

.site-tagline {
  margin: 0;
  font-size: 0.95rem;
  color: #dcdcdc;
}

/* Reuse from About page */

/* Reuse from About page */

/* Blockquote (canonical at top) */

.site-nav a {
  margin-right: 1rem;
  font-weight: 600;
}

.site-nav .search-icon {
  font-size: 1.1rem;
  opacity: 0.9;
  transition: opacity 0.2s, transform 0.2s;
  text-decoration: none;
}

.site-nav .search-icon:hover {
  opacity: 1;
  transform: scale(1.15);
}

.site-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-footer {
  background: var(--color-primary);
  color: var(--color-neutral);
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
  border-radius: 0.5rem;
}

a {
  color: var(--color-accent);
}

a:hover {
  color: #b8860b; /* darker gold */
}

/* Centered site container */
.site-container {
  max-width: 900px; /* comfortable readable measure */
  margin: 0 auto; /* center horizontally */
  padding: 0 1rem; /* small side padding on narrow viewports */
  box-sizing: border-box;
}

@media (width >= 1200px) {
  .site-container {
    max-width: 1100px;
  }
}

/* Tablet improvements */
@media (width >= 601px) and (width <= 900px) {
  .site-header {
    padding: 0.85rem;
  }
  
  .site-nav a {
    font-size: 0.95rem;
    margin-right: 0.75rem;
  }
  
  .site-container {
    padding: 0 1.5rem;
  }
}

/* Prevent layout shift from scrollbar appearance */
html {
  overflow-y: scroll; /* Always show vertical scrollbar */
  scrollbar-gutter: stable; /* Reserve space for scrollbar even if not needed */
}

body {
  margin: 0; /* Ensure no default margins interfere */
}

/* about.php Styles */
.about-page {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: Georgia, serif;
  line-height: 1.7;
  color: #2c3e50;
}

/* page-header h1 and .tagline are defined earlier (canonical) */

.about-content section {
  margin-bottom: 3rem;
}

.about-content h2 {
  font-size: 1.8rem;
  color: #2c3e50;
  border-bottom: 3px solid #3498db;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  display: inline-block;
}

/* Blockquote Styling */

/* Blockquote Styling (canonical above) */

/* Lists */
.content-list,
.connect-list {
  list-style: none;
  padding-left: 0;
}

.content-list li,
.connect-list li {
  margin-bottom: 1rem;
  padding-left: 1.8rem;
  position: relative;
}

.content-list li::before {
  content: "→";
  color: #3498db;
  font-weight: bold;
  position: absolute;
  left: 0;
}

.connect-list a {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
}

.connect-list a:hover {
  text-decoration: underline;
}

/* CTA Box */

/* CTA Box removed (consolidated) */

.placeholder-form {
  font-style: italic;
  color: #7f8c8d;
  margin-top: 1rem;
}

/* Responsive */
@media (width <= 600px) {
  .page-header h1 {
    font-size: 2rem;
  }

  blockquote {
    padding: 1.5em 1.2em;
    font-size: 1rem;
  }

  blockquote::before {
    font-size: 4rem;
    left: 8px;
    top: -12px;
  }
  
  /* Mobile header fixes */
  .site-header {
    padding: 0.75rem;
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .site-brand {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  
  .site-logo {
    max-height: 48px;
  }
  
  .site-title {
    font-size: 1.3rem;
  }
  
  .site-tagline {
    font-size: 0.8rem;
  }
  
  .site-controls {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
  }
  
  .site-nav a {
    margin-right: 0;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
  
  #theme-toggle {
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
  }
}

/* === CONTACT & CATEGORIES PAGE STYLES === */
.contact-page,
.categories-page {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: Georgia, serif;
  line-height: 1.7;
  color: #2c3e50;
}

.page-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
  text-align: center;
}

.page-header .tagline {
  text-align: center;
  font-style: italic;
  color: #555;
  font-size: 1.2rem;
  margin: 0 0 2rem;
}

.contact-content section,
.categories-content section {
  margin-bottom: 3rem;
}

.contact-content h2,
.categories-content h2 {
  font-size: 1.8rem;
  color: #2c3e50;
  border-bottom: 3px solid #3498db;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  display: inline-block;
}

/* Contact List */
.contact-list {
  list-style: none;
  padding-left: 0;
  font-size: 1.1rem;
}

.contact-list li {
  margin-bottom: 1rem;
  padding-left: 1.8rem;
  position: relative;
}

.contact-list li::before {
  content: "→";
  color: #3498db;
  font-weight: bold;
  position: absolute;
  left: 0;
}

.contact-list a {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
}

.contact-list a:hover {
  text-decoration: underline;
}

/* Category Grid */
.category-grid .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.category-card {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 12px;
  text-decoration: none;
  color: #2c3e50;
  transition: all 0.3s ease;
  border: 1px solid #e9ecef;
  text-align: center;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgb(0 0 0 / 10%);
  border-color: #3498db;
}

.category-card h3 {
  margin: 0 0 0.5rem;
  color: #2c3e50;
  font-size: 1.4rem;
}

.category-card p {
  margin: 0;
  color: #555;
  font-size: 0.95rem;
}

/* connect-list links: canonical definition is above */

/* Blockquote (shared) */
blockquote {
  font-style: italic;
  margin: 2.5em 0;
  padding: 1.8em 2em;
  border-left: 6px solid #3498db;
  background: #f8f9fa;
  border-radius: 0 8px 8px 0;
  position: relative;
  font-size: 1.15rem;
  color: #2c3e50;
}

blockquote::before {
  content: "“";
  font-family: Georgia, serif;
  font-size: 5rem;
  color: #3498db;
  position: absolute;
  left: 10px;
  top: -15px;
  line-height: 1;
}

blockquote cite {
  display: block;
  margin-top: 1.2rem;
  font-style: normal;
  color: #7f8c8d;
  font-weight: 600;
  font-size: 0.95rem;
}

/* Pull Quotes - Eye-catching callouts from your own text */
.pullquote,
blockquote.pullquote {
  border-left: none;
  border-left: 4px solid #d4a017;
  border-right: 4px solid #d4a017;
  background: linear-gradient(135deg, #fffef0 0%, #fdfaec 100%);
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  font-style: normal;
  color: #1c2a39;
  padding: 1.5em 2em;
  margin: 2em auto;
  max-width: 85%;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pullquote::before,
blockquote.pullquote::before {
  display: none; /* No opening quote mark */
}

.pullquote cite,
blockquote.pullquote cite {
  display: none; /* Pull quotes don't have citations */
}

/* Dark mode pull quotes */
[data-theme="dark"] .pullquote,
[data-theme="dark"] blockquote.pullquote {
  background: linear-gradient(135deg, #2a3540 0%, #1f2933 100%);
  color: #f0c85a;
  border-color: #f0c85a;
}

/* Responsive */
@media (width <= 600px) {
  .page-header h1 {
    font-size: 2rem;
  }

  .category-grid .grid {
    grid-template-columns: 1fr;
  }

  blockquote {
    padding: 1.5em 1.2em;
    font-size: 1rem;
  }

  blockquote::before {
    font-size: 4rem;
    left: 8px;
    top: -12px;
  }
}

/* === CTA BOX (Markdown-friendly) === */
.cta-box {
  background: #ecf0f1;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  margin: 2.5rem 0;
  border: 1px solid #ddd;
  font-size: 1.1rem;
}

.cta-box p {
  margin: 0.6rem 0;
}

/* === POST SIGNATURE === */
.post-signature {
  text-align: center;
  font-style: italic;
  color: #7f8c8d;
  margin: 3rem 0 1rem;
  font-size: 1.1rem;
}

/* === HOME PAGE STYLES === */
.home-page {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: Georgia, serif;
  line-height: 1.7;
  color: #2c3e50;
}

/* Featured Post */
.featured-post {
  background: #f8f9fa;
  padding: 2.5rem;
  border-radius: 16px;
  margin-bottom: 3rem;
  border: 1px solid #e9ecef;
  box-shadow: 0 4px 12px rgb(0 0 0 / 5%);
}

.post-header .post-title {
  margin: 0 0 0.5rem;
  font-size: 2.2rem;
  font-weight: 700;
}

.post-header .post-title a {
  color: #1a1a1a;
  text-decoration: none;
  transition: color 0.2s;
}

.post-header .post-title a:hover {
  color: #3498db;
}

.post-date {
  display: block;
  color: #7f8c8d;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.post-excerpt {
  font-size: 1.1rem;
  color: #2c3e50;
  margin: 1.5rem 0;
}

.read-more {
  display: inline-block;
  background: #3498db;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.3s;
}

.read-more:hover {
  background: #2980b9;
}

/* Post Archive */
.post-archive {
  margin-top: 2rem;
}

.archive-title {
  font-size: 1.6rem;
  color: #2c3e50;
  border-bottom: 3px solid #3498db;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  display: inline-block;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-item {
  padding: 0.8rem 0;
  border-bottom: 1px dashed #ddd;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* post-item:last-child (canonical earlier) */

.post-link {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1rem;
  flex: 1;
}

.post-link:hover {
  color: #3498db;
  text-decoration: underline;
}

.post-meta {
  color: #7f8c8d;
  font-size: 0.9rem;
  white-space: nowrap;
}

.no-posts {
  color: #7f8c8d;
  font-style: italic;
  text-align: center;
  padding: 2rem;
}

/* Responsive */
@media (width <= 600px) {
  .featured-post {
    padding: 1.5rem;
    border-radius: 12px;
  }

  .post-header .post-title {
    font-size: 1.8rem;
  }

  .post-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-meta {
    font-size: 0.85rem;
  }
}

/* === SINGLE POST STYLES === */
.post-page {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: Georgia, serif;
  line-height: 1.8;
  color: #2c3e50;
}

.post-article {
  background: white;
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgb(0 0 0 / 6%);
  border: 1px solid #e9ecef;
}

.post-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.post-title {
  font-size: 2.6rem;
  margin: 0 0 0.5rem;
  color: #1a1a1a;
  font-weight: 700;
  line-height: 1.2;
}

.post-subtitle {
  font-size: 1.3rem;
  color: #555;
  font-style: italic;
  margin: 0 0 1rem;
}

.post-meta {
  color: #7f8c8d;
  font-size: 0.95rem;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-meta-separator {
  color: #ccc;
}

.post-content {
  font-size: 1.15rem;
  margin: 2rem 0;
}

.post-content > *:first-child {
  margin-top: 0;
}

.post-content h2 {
  font-size: 1.9rem;
  color: #2c3e50;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid #3498db;
  display: inline-block;
}

/* CTA Box (consolidated below) */

/* Post Signature (canonical above) */

/* Tags */
.post-tags {
  margin: 2.5rem 0;
  padding-top: 1.5rem;
  border-top: 1px dashed #ddd;
  text-align: center;
}

.post-tags strong {
  color: #2c3e50;
  margin-right: 0.5rem;
}

.tag-link {
  display: inline-block;
  background: #3498db;
  color: white;
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  text-decoration: none;
  margin: 0 0.3rem;
  transition: background 0.2s;
}

.tag-link:hover {
  background: #2980b9;
}

/* Post Navigation */
.post-navigation {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  margin: 3rem 0 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid #eee;
  font-size: 0.95rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-previous,
.nav-next,
.nav-home {
  flex: 1;
  min-width: 120px;
}

.nav-previous {
  text-align: left;
}

.nav-next {
  text-align: right;
}

.nav-home {
  text-align: center;
}

.post-navigation a {
  display: block;
  color: #2c3e50;
  text-decoration: none;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s;
}

.post-navigation a:hover {
  background: #f8f9fa;
  color: #3498db;
}

.nav-label {
  display: block;
  font-weight: 600;
  color: #7f8c8d;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-title {
  display: block;
  margin-top: 0.3rem;
  font-weight: 500;
}

/* Responsive */
@media (width <= 600px) {
  .post-page {
    padding: 0 1.5rem;
    margin: 1rem auto;
  }

  .post-article {
    padding: 2rem 1.5rem;
    border-radius: 12px;
  }

  .post-title {
    font-size: 1.75rem;
    line-height: 1.3;
    margin-bottom: 1rem;
  }

  .post-subtitle {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  .post-meta {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }

  .post-content {
    font-size: 1.05rem;
    line-height: 1.7;
  }

  .post-content h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
  }

  .post-content h3 {
    font-size: 1.25rem;
    margin-top: 1.75rem;
  }

  .post-content p {
    margin-bottom: 1.25rem;
  }

  .post-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1rem 1rem 1.25rem;
    font-size: 1rem;
  }

  .pullquote {
    margin: 2rem auto;
    padding: 1.5rem 1rem;
    font-size: 1.2rem;
    max-width: 90%;
  }

  .post-navigation {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .nav-previous,
  .nav-next {
    text-align: center;
    width: 100%;
  }

  .post-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
  }
}

/* === TAG ARCHIVE STYLES === */
.tag-page {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: Georgia, serif;
  line-height: 1.7;
  color: #2c3e40;
}

.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.tag-title {
  font-size: 2.4rem;
  margin: 0 0 0.5rem;
  color: #1a1a1a;
  font-weight: 700;
}

.tag-badge {
  display: inline-block;
  background: #3498db;
  color: white;
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-size: 1.1rem;
  font-weight: 600;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.tag-count {
  color: #7f8c8d;
  font-size: 1.1rem;
  margin: 0;
  font-style: italic;
}

/* Post List */
.post-list-section {
  margin: 2rem 0;
}

/* .post-list defined earlier (canonical) */

/* duplicated .post-item block removed (kept canonical instance earlier) */

.post-link {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.15rem;
  flex: 1;
  transition: color 0.2s;
}

.post-link:hover {
  color: #3498db;
  text-decoration: underline;
}

/* duplicated .post-meta removed (canonical earlier) */

.no-results {
  text-align: center;
  color: #7f8c8d;
  font-style: italic;
  padding: 2rem;
  font-size: 1.1rem;
}

.no-results a {
  color: #3498db;
  text-decoration: none;
}

.no-results a:hover {
  text-decoration: underline;
}

/* Footer */
.page-footer {
  text-align: center;
  margin: 3rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.back-link {
  display: inline-block;
  background: #2c3e50;
  color: white;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.3s;
}

.back-link:hover {
  background: #1a252f;
}

/* Responsive */
@media (width <= 600px) {
  .tag-title {
    font-size: 2rem;
  }

  .tag-badge {
    font-size: 1rem;
    padding: 0.3rem 0.7rem;
  }

  .post-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-meta {
    font-size: 0.85rem;
  }
}

/* === SEARCH PAGE STYLES === */
.search-page {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: Georgia, serif;
  line-height: 1.7;
  color: #2c3e50;
}

.search-form {
  max-width: 600px;
  margin: 2rem auto;
  display: flex;
  gap: 0.5rem;
}

.search-form input[type="search"] {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}

.search-form input[type="search"]:focus {
  outline: none;
  border-color: var(--color-accent);
}

.search-form button {
  padding: 0.75rem 1.5rem;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.search-form button:hover {
  background: #b8860b;
}

.search-info {
  text-align: center;
  margin: 2rem 0;
  color: #7f8c8d;
  font-size: 1.1rem;
}

.search-info strong {
  color: var(--color-contrast);
}

.search-info .no-results {
  color: #e74c3c;
}

.search-page .post-list {
  margin: 2rem 0;
}

.search-page .post-item {
  background: #f8f9fa;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 12px;
  border: 1px solid #e9ecef;
  transition: all 0.2s;
}

.search-page .post-item:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px rgb(0 0 0 / 5%);
}

.search-page .post-item h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.search-page .post-item h2 a {
  color: #2c3e50;
  text-decoration: none;
}

.search-page .post-item h2 a:hover {
  color: var(--color-accent);
}

.search-page .post-item time {
  display: block;
  color: #7f8c8d;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.search-page .post-item p {
  color: #555;
  line-height: 1.6;
  margin: 0.75rem 0;
}

.search-page .post-tags {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.search-page .post-tags .tag {
  display: inline-block;
  background: var(--color-accent);
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.2s;
}

.search-page .post-tags .tag:hover {
  background: #b8860b;
}

/* === ARCHIVE PAGE STYLES === */
.archive-page {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: Georgia, serif;
  line-height: 1.7;
  color: #2c3e40;
}

.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.archive-title {
  font-size: 2.4rem;
  margin: 0 0 0.5rem;
  color: #1a1a1a;
  font-weight: 700;
}

.archive-date {
  display: inline-block;
  background: #e74c3c;
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 1.1rem;
  font-weight: 600;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.archive-count {
  color: #7f8c8d;
  font-size: 1.1rem;
  margin: 0;
  font-style: italic;
}

/* Post List */
.post-list-section {
  margin: 2rem 0;
}

/* .post-list defined earlier (canonical) */

.post-item {
  padding: 1rem 0;
  border-bottom: 1px dashed #ddd;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-item:last-child {
  border-bottom: none;
}

.post-link {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.15rem;
  flex: 1;
  transition: color 0.2s;
}

.post-link:hover {
  color: #e74c3c;
  text-decoration: underline;
}

.post-meta {
  color: #7f8c8d;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Footer */
.page-footer {
  text-align: center;
  margin: 3rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.back-link {
  display: inline-block;
  background: #2c3e50;
  color: white;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.3s;
}

.back-link:hover {
  background: #1a252f;
}

/* Responsive */
@media (width <= 600px) {
  .archive-title {
    font-size: 2rem;
  }

  .archive-date {
    font-size: 1rem;
    padding: 0.3rem 0.7rem;
  }

  .post-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-meta {
    font-size: 0.85rem;
  }
}

/* === 404 ERROR PAGE STYLES === */
.error-page {
  max-width: 800px;
  margin: 3rem auto;
  padding: 0 1rem;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-container {
  text-align: center;
  background: #f8f9fa;
  padding: 3rem 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgb(0 0 0 / 6%);
  border: 1px solid #e9ecef;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: #3498db;
  margin: 0;
  line-height: 1;
  font-family: var(--font-header);
  text-shadow: 2px 2px 4px rgb(0 0 0 / 10%);
}

.error-title {
  font-size: 2.5rem;
  margin: 1rem 0;
  color: #2c3e50;
  font-family: var(--font-header);
}

.error-message {
  font-size: 1.2rem;
  color: #555;
  margin: 1.5rem 0 2rem;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s;
  font-family: var(--font-body);
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgb(52 152 219 / 30%);
}

.btn-secondary {
  background: white;
  color: #3498db;
  border: 2px solid #3498db;
}

.btn-secondary:hover {
  background: #3498db;
  color: white;
  transform: translateY(-2px);
}

.error-suggestions {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px dashed #ddd;
  text-align: left;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.error-suggestions p {
  margin: 0 0 1rem;
  color: #2c3e50;
  font-weight: 600;
}

.error-suggestions ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.error-suggestions li {
  padding: 0.5rem 0 0.5rem 1.5rem;
  position: relative;
  color: #555;
}

.error-suggestions li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #3498db;
  font-weight: bold;
}

.error-suggestions a {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
}

.error-suggestions a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (width <= 600px) {
  .error-code {
    font-size: 5rem;
  }

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

  .error-message {
    font-size: 1.1rem;
  }

  .error-container {
    padding: 2rem 1.5rem;
  }

  .error-actions {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}

/* Dark theme overrides using CSS variables. The JS toggles
  `data-theme` on <html> to switch themes. */
/* Header layout — restore rounded corners and brand layout (non-invasive)
   Placed here so it overrides the earlier minimal .site-header rule but
   does not interfere with dark-mode color overrides. */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: 12px; /* rounded corners the theme used to have */
  background: var(--color-primary); /* keep existing header color variable */
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.brand-link {
  display: inline-block;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.site-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

@media (width <= 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .site-nav {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
}
[data-theme="dark"] {
  --color-primary: #0a141b; /* darker navy (match footer) */
  --color-accent: #f0c85a; /* slightly brighter gold */
  --color-neutral: #0b0e10; /* near-black background */
  --color-contrast: #e6e6e6; /* light text */

  /* Improve readability */
  .page-header .tagline,
  .post-subtitle,
  .post-meta,
  blockquote cite,
  .post-meta,
  .tag-count,
  .archive-count {
    color: #d5dbdb; /* Brighter gray for meta/static text */
  }

  .post-content,
  .post-link,
  .post-title,
  h2,
  h3,
  .tag-badge {
    color: #f8f9fa; /* Near-white for main content/titles */
  }

  blockquote {
    background: #1c2831; /* Darker background for contrast */
    border-left-color: #f0c85a; /* Accent gold border */
    color: #d5dbdb; /* Lighter blockquote text */
  }

  blockquote::before {
    color: #f0c85a; /* Match accent */
  }

  /* Ensure blockquotes inside the full post content get the same dark-mode treatment
                 as blockquotes on the static pages (about/contact/categories). This selector
                 is more specific so it overrides later .post-content blockquote rules. */
  .post-content blockquote {
    background: #1c2831; /* Darker background for contrast */
    border-left-color: #f0c85a; /* Accent gold border */
    color: #d5dbdb; /* Lighter blockquote text */
  }

  .post-content blockquote::before {
    color: #f0c85a; /* Match accent for opening quote */
  }

  .post-content blockquote cite {
    color: #d5dbdb; /* Lighter cite text in dark mode */
  }

  .cta-box {
    background: #1c2831;
    border-color: #2c3e50;
  }

  .cta-box p {
    color: #f8f9fa; /* Brighter CTA text */
  }

  .post-signature,
  .no-results {
    color: #bdc3c7; /* Medium gray for italic/static */
  }

  .featured-post,
  .category-card {
    background: #1c2831 !important; /* Darker card backgrounds */
    border-color: #34495e;
    color: #f8f9fa; /* White text inside cards */
  }

  .post-navigation a:hover,
  .post-link:hover {
    background: #1c2831;
  }

  .site-header,
  .site-footer {
    background: #0a141b; /* Slightly darker for depth */
  }

  a,
  .read-more {
    color: #f0c85a;
  }

  a:hover,
  .read-more:hover {
    color: #d4a017; /* Original accent for hover */
  }

  .back-link {
    background: #1c2831;
  }

  .back-link:hover {
    background: #0f1a22;
  }

  .tag-link {
    background: #f0c85a;
    color: #0f1a22;
  }

  .tag-link:hover {
    background: #d4a017;
  }

  /* Static page headings (about, contact, categories) */
  .page-header h1,
  .archive-title,
  .tag-title {
    color: #f8f9fa !important; /* Bright white for all headings */
  }

  /* Static page body text: match index / post body readability in dark mode */
  .about-page,
  .contact-page,
  .categories-page {
    color: #ecf0f1 !important; /* match post/index body text color */
  }

  .about-page p,
  .contact-page p,
  .categories-page p,
  .about-page li,
  .contact-page li,
  .categories-page li {
    color: #ecf0f1 !important;
  }

  /* Ensure list items and links are visible */
  .content-list li::before,
  .contact-list li::before {
    color: #f0c85a; /* Accent for arrows */
  }

  .post-item {
    border-bottom-color: #34495e; /* Lighter dashed borders */
  }

  /* Body text and teaser/excerpt */
  .post-excerpt,
  .post-content p,
  .post-content li {
    color: #ecf0f1 !important; /* Brighter white for body text */
  }

  .post-content {
    color: #ecf0f1 !important; /* Override full post body */
  }

  /* Teaser title in dark mode */
  .featured-post .post-title a {
    color: #f8f9fa !important;
  }

  .featured-post .post-title a:hover {
    color: #f0c85a !important; /* Accent hover */
  }

  .featured-post .post-title {
    color: #f8f9fa !important; /* Bright white */
  }

  /* Full post page overrides */
  .post-page {
    color: #f8f9fa !important; /* Bright white body text */
  }

  .post-article {
    background: #1c2831 !important;
    border-color: #34495e !important;
  }

  .post-title,
  .post-subtitle,
  .post-meta {
    color: #f8f9fa !important; /* Bright white for all */
  }

  .post-content p,
  .post-content li,
  .post-content a {
    color: #ecf0f1 !important;
  }

  .post-content a:hover {
    color: #f0c85a !important;
  }

  .post-tags a {
    background: #f0c85a;
    color: #0f1a22;
  }

  .post-tags a:hover {
    background: #d4a017;
  }

  /* Search page dark mode */
  .search-form input[type="search"] {
    background: #1c2831;
    border-color: #34495e;
    color: #f8f9fa;
  }

  .search-form input[type="search"]:focus {
    border-color: #f0c85a;
  }

  .search-info {
    color: #bdc3c7 !important;
  }

  .search-info strong {
    color: #f8f9fa !important;
  }

  .search-page .post-item {
    background: #1c2831 !important;
    border-color: #34495e;
  }

  .search-page .post-item:hover {
    border-color: #f0c85a;
  }

  .search-page .post-item h2 a {
    color: #f8f9fa !important;
  }

  .search-page .post-item h2 a:hover {
    color: #f0c85a !important;
  }

  .search-page .post-item time {
    color: #bdc3c7 !important;
  }

  .search-page .post-item p {
    color: #ecf0f1 !important;
  }

  /* 404 Error page dark mode */
  .error-container {
    background: #1c2831 !important;
    border-color: #34495e;
  }

  .error-code {
    color: #f0c85a;
  }

  .error-title {
    color: #f8f9fa !important;
  }

  .error-message {
    color: #ecf0f1 !important;
  }

  .error-suggestions p {
    color: #f8f9fa !important;
  }

  .error-suggestions li {
    color: #ecf0f1 !important;
  }

  .error-suggestions li::before {
    color: #f0c85a;
  }

  .error-suggestions a {
    color: #f0c85a;
  }

  .error-suggestions a:hover {
    color: #d4a017;
  }

  .btn-secondary {
    background: #1c2831;
    color: #f0c85a;
    border-color: #f0c85a;
  }

  .btn-secondary:hover {
    background: #f0c85a;
    color: #0f1a22;
  }
}

/* Smooth transitions for theme changes */
[data-theme="dark"] * {
  transition: all 0.2s ease;
}

/* === SUBTLE ANIMATIONS === */

/* Fade-in animation for posts */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply fade-in to post items */
.featured-post,
.post-item,
.search-page .post-item,
.category-card,
.search-result-item {
  animation: fadeIn 0.5s ease-out;
}

/* Stagger animation for lists */
.post-list .post-item:nth-child(1) { animation-delay: 0.05s; }
.post-list .post-item:nth-child(2) { animation-delay: 0.1s; }
.post-list .post-item:nth-child(3) { animation-delay: 0.15s; }
.post-list .post-item:nth-child(4) { animation-delay: 0.2s; }
.post-list .post-item:nth-child(5) { animation-delay: 0.25s; }
.post-list .post-item:nth-child(6) { animation-delay: 0.3s; }
.post-list .post-item:nth-child(7) { animation-delay: 0.35s; }
.post-list .post-item:nth-child(8) { animation-delay: 0.4s; }
.post-list .post-item:nth-child(9) { animation-delay: 0.45s; }
.post-list .post-item:nth-child(10) { animation-delay: 0.5s; }

/* Search results stagger */
.search-page .post-list .post-item:nth-child(1) { animation-delay: 0.1s; }
.search-page .post-list .post-item:nth-child(2) { animation-delay: 0.2s; }
.search-page .post-list .post-item:nth-child(3) { animation-delay: 0.3s; }
.search-page .post-list .post-item:nth-child(4) { animation-delay: 0.4s; }
.search-page .post-list .post-item:nth-child(5) { animation-delay: 0.5s; }

/* Category grid stagger */
.category-grid .category-card:nth-child(1) { animation-delay: 0.1s; }
.category-grid .category-card:nth-child(2) { animation-delay: 0.15s; }
.category-grid .category-card:nth-child(3) { animation-delay: 0.2s; }
.category-grid .category-card:nth-child(4) { animation-delay: 0.25s; }
.category-grid .category-card:nth-child(5) { animation-delay: 0.3s; }
.category-grid .category-card:nth-child(6) { animation-delay: 0.35s; }

/* Enhanced hover transitions */
.post-item,
.featured-post,
.category-card,
.search-page .post-item,
.post-article,
.error-container {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Smooth link transitions */
a {
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

/* Button hover effects */
.read-more,
.btn-primary,
.btn-secondary,
.back-link,
.tag-link,
.search-form button {
  transition: all 0.3s ease;
}

.read-more:hover,
.btn-primary:hover,
.back-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Navigation link hover */
.site-nav a {
  position: relative;
  transition: color 0.2s ease;
}

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

.site-nav a:hover::after {
  width: 100%;
}

/* Theme toggle smooth rotation */
#theme-toggle {
  transition: transform 0.3s ease, background-color 0.2s ease;
}

#theme-toggle:hover {
  transform: rotate(180deg);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
