/* Reset and base styles */
:root {
  --primary-color: #2563eb;
  --text-color: #1f2937;
  --background-color: #ffffff;
  --footer-bg: #f3f4f6;
  --max-width: 1200px;
  --header-height: 80px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Container */
.container {
  width: 92%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header and Navigation */
header {
  background: var(--background-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
}

.header-content {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo {
  height: 40px;
  width: auto;
  flex-shrink: 0;
}

/* Mobile navigation */
.main-nav {
  position: relative;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-item {
  position: relative;
}

.nav-item a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.5rem 0;
  display: block;
  transition: color 0.2s;
}

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

/* Submenu styles */
.has-submenu {
  position: relative;
}

.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  min-width: 200px;
  padding: 0.5rem 0;
  border-radius: 4px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 100;
  list-style: none;
}

.has-submenu:hover .submenu {
  display: block;
}

.submenu li a {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
}

.submenu li a:hover {
  background: #f3f4f6;
}

/* Mobile menu button */
.mobile-menu-button {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
}

/* Footer styles */
footer {
  background: var(--footer-bg);
  padding: 3rem 0 1.5rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-section h3 {
  color: var(--text-color);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 0.4rem;
}

.footer-section ul li a {
  color: #4b5563;
  text-decoration: none;
  transition: color 0.2s;
  font-size: 0.9rem;
}

.footer-section ul li a:hover {
  color: var(--primary-color);
}

.footer-logo {
  margin-bottom: 1rem;
}

.footer-description {
  color: #4b5563;
  font-size: 0.9rem;
  max-width: 280px;
}

.copyright {
  color: #6b7280;
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* Page styles */
.page {
  margin-top: var(--header-height);
  padding: 2rem 0;
}

.page-container {
  max-width: 800px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 2rem;
  text-align: center;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 1rem;
}

.page-meta {
  color: #6b7280;
  font-size: 0.9rem;
}

.page-date {
  display: inline-block;
}

.page-content {
  font-size: 1.1rem;
  line-height: 1.7;
}

/* Block quote styles */
blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  border-left: 4px solid var(--primary-color);
  background-color: #f8fafc;
  border-radius: 0.375rem;
  font-style: italic;
  color: #4a5568;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

blockquote p {
  margin: 0;
  line-height: 1.75;
}

blockquote cite {
  display: block;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: #64748b;
  font-style: normal;
}

/* Main content */
main {
  margin-top: var(--header-height);
  flex: 1;
  padding: 2rem 0;
}

/* Page specific styles */
.page-content {
  width: 92%;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 1.5rem;
  line-height: 1.2;
}

.page-body {
  font-size: 1.125rem;
}

.page-body p {
  margin-bottom: 1.5rem;
}

.page-body strong {
  font-weight: 600;
}

/* Post styles */
.post-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0;
}

.post-header {
  margin-bottom: 2rem;
  text-align: center;
}

.post-title {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  font-size: 0.95rem;
  color: #666;
}

.post-cover-image {
  width: 100%;
  margin: 2rem 0;
}

.post-cover-image img {
  width: 100%;
  height: auto;
  max-height: 600px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--primary-color);
}

.tag a {
  color: #ffffff;
  text-decoration: none;
}

.tag {
  display: inline-block;
  background-color: var(--primary-color);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.tag:hover {
  opacity: 0.9;
}

.reading-time {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.reading-time svg {
  color: #666;
}

.post-content {
  font-size: 1.125rem;
  line-height: 1.8;
}

.post-content table,
.page-content table {
  width: 100%;
  margin: 2rem 0;
  border-collapse: collapse;
  font-size: 0.95em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.post-content th,
.page-content th {
  background: #f8f9fa;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: #1f2937;
  border-bottom: 2px solid #e5e7eb;
}

.post-content td,
.page-content td {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  color: #4b5563;
}

.post-content tr:last-child td,
.page-content tr:last-child td {
  border-bottom: none;
}

.post-content tr:nth-child(even),
.page-content tr:nth-child(even) {
  background: #f9fafb;
}

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

.post-content ul {
  list-style-type: none;
}

.post-content ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.4rem;
  line-height: 1.5;
}

.post-content ul li::before {
  content: "•";
  color: var(--primary-color);
  font-weight: bold;
  position: absolute;
  left: 0;
  font-size: 1.2em;
  top: -0.1em;
}

.post-content ol {
  list-style-type: none;
  counter-reset: item;
}

.post-content ol li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.4rem;
  line-height: 1.5;
  counter-increment: item;
}

.post-content ol li::before {
  content: counter(item) ".";
  color: var(--primary-color);
  font-weight: 600;
  position: absolute;
  left: 0;
  text-align: right;
  width: 1.5rem;
}

.post-content ul ul,
.post-content ol ol,
.post-content ul ol,
.post-content ol ul {
  margin: 0.4rem 0;
}

.post-content > * + * {
  margin-top: 1.5rem;
}

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

.post-content li p {
  margin: 0;
}

.post-content h2 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

.post-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.post-content pre {
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 0.5rem;
  overflow-x: auto;
}

.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95em;
  padding: 0.2em 0.4em;
  background: #f8f9fa;
  border-radius: 0.25rem;
}

.post-content pre code {
  padding: 0;
  background: none;
}

/* Author bio */
.post-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}

.author-bio {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.author-avatar {
  width: 60px;
  height: 60px;
  border-radius: 9999px;
  object-fit: cover;
}

.author-info {
  flex: 1;
}

.author-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.author-description {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.author-social {
  display: flex;
  gap: 1rem;
}

.author-social a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.875rem;
}

/* Related posts */
.related-posts {
  background: #f9fafb;
  padding: 4rem 0;
  margin-top: 4rem;
}

.related-posts h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  text-align: center;
}

.related-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.related-post {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.related-post h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.related-post h3 a {
  color: var(--text-color);
  text-decoration: none;
}

.related-post h3 a:hover {
  color: var(--primary-color);
}

.related-post p {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .post-title {
    font-size: 2rem;
  }

  .post-meta {
    flex-direction: column;
    gap: 0.75rem;
  }

  .author-bio {
    flex-direction: column;
    text-align: center;
  }

  .author-social {
    justify-content: center;
  }

  .related-posts {
    padding: 3rem 0;
  }

  .related-posts h2 {
    font-size: 1.75rem;
  }
}

/* Post tags */
.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.post-card-tag {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background: var(--primary-color);
  color: white;
  border-radius: 9999px;
  font-size: 0.875rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  transition: opacity 0.2s;
}

.post-card-tag:hover {
  opacity: 0.9;
}

.post-card-tag a {
  color: white;
  text-decoration: none;
}

/* Homepage */
.content-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  padding: 2rem 0;
}

.posts-grid {
  display: grid;
  gap: 2rem;
  padding: 0;
}

.post-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.2s ease;
}

.post-card-link:hover {
  transform: translateY(-2px);
}

.featured-posts {
  background: var(--footer-bg);
  padding: 1.5rem;
  border-radius: 8px;
}

.featured-posts h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.featured-post-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.featured-post-card:last-child {
  margin-bottom: 0;
}

.featured-post-thumbnail-link {
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 4px;
  overflow: hidden;
}

.featured-post-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.featured-post-thumbnail:hover {
  transform: scale(1.05);
}

.featured-post-title {
  font-size: 1rem;
  line-height: 1.4;
  margin: 0;
}

.featured-post-title a {
  color: var(--text-color);
  text-decoration: none;
}

.featured-post-title a:hover {
  color: var(--primary-color);
}

@media (max-width: 768px) {
  .content-with-sidebar {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) {
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Post card layout */
.post-card {
  display: flex;
  flex-direction: column;
}

.post-card-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-card-title {
  margin-bottom: 1rem;
}

.post-card-meta {
  margin-top: auto;
  padding-top: 1rem;
}

@media (min-width: 1024px) {
  .posts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.post-card {
  background: var(--background-color);
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.post-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.post-card-title a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

.post-card-title a:hover {
  color: var(--primary-color);
}

.post-card-description {
  color: #4b5563;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.post-card-meta {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: #6b7280;
}

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

.post-card-tag {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
}

.post-card-tag a {
  color: white;
  text-decoration: none;
}

/* Footer */
footer {
  background: var(--footer-bg);
  padding: 2rem 0;
  margin-top: auto;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.footer-logo {
  height: 30px;
  width: auto;
}

.footer-description {
  max-width: 600px;
  margin: 0 auto;
  font-size: 0.95rem;
}

.copyright {
  font-size: 0.875rem;
  color: #666;
}

/* Responsive design */
@media (min-width: 768px) {
  .footer-content {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
  
  .footer-left {
    flex: 1;
  }
  
  .footer-description {
    margin: 1rem 0;
  }
}

/* Pagefind custom search overlay styles */
#search {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.pagefind-ui__drawer {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 1.5px 4px rgba(0,0,0,0.08);
  padding: 1.25rem 1.5rem 1.5rem 1.5rem;
  z-index: 2000;
  max-width: 640px;
  margin-top: 0.5rem;
}

.pagefind-ui__drawer {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 1.5px 4px rgba(0,0,0,0.08);
  padding: 1.25rem 1.5rem 1.5rem 1.5rem;
  z-index: 2000;
  max-width: 640px;
  margin-top: 0.5rem;
}

.pagefind-ui__results {
  background: transparent;
}

.pagefind-ui__result {
  background: #f8fafc;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: background 0.15s;
}

.pagefind-ui__result:hover {
  background: #e0e7ef;
}

.pagefind-ui__search-input {
  background: #fff;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  width: 100%;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.pagefind-ui__search-clear {
  color: #888;
}

.pagefind-ui__result-title a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.pagefind-ui__result-title a:hover {
  text-decoration: underline;
}

.pagefind-ui__drawer {
  border: 1px solid #e5e7eb;
}

/* Responsive: keep overlay readable on mobile */
@media (max-width: 600px) {
  .pagefind-ui__drawer {
    max-width: 98vw;
    left: 1vw;
    right: 1vw;
    padding: 1rem 0.5rem 1rem 0.5rem;
  }
}

/* Responsive navigation */
@media (max-width: 768px) {
  .mobile-menu-button {
    display: block;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  }

  .main-nav.is-active {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
  }

  .submenu {
    position: static;
    box-shadow: none;
    padding-left: 1rem;
  }

  .has-submenu:hover .submenu {
    display: none;
  }

  .has-submenu.is-active .submenu {
    display: block;
  }
}