/* Reset and base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

:root {
  /* Harmonious Color Palette Based on Provided Colors */
  --primary-color: #0177b8; /* Bright blue as primary */
  --primary-dark: #015a8a;
  --secondary-color: #df7988; /* Soft pink as secondary */
  --accent-color: #6b69d6; /* Purple/blue as accent */
  --success-color: #8ea885; /* Muted green for success */
  --warning-color: #ffb900; /* Vibrant yellow/orange for warnings */
  --danger-color: #df7988; /* Soft pink for errors */
  
  /* Text Colors */
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --text-light: #718096;
  --text-lighter: #a0aec0;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f7fafc;
  --bg-accent: #edf2f7;
  --bg-gradient: linear-gradient(135deg, #0177b8 0%, #6b69d6 50%, #df7988 100%);
  --bg-card: #ffffff;
  
  /* Gradient Variations */
  --gradient-primary: linear-gradient(135deg, #0177b8 0%, #6b69d6 100%);
  --gradient-secondary: linear-gradient(135deg, #df7988 0%, #ffb900 100%);
  --gradient-accent: linear-gradient(135deg, #8ea885 0%, #0177b8 100%);
  --gradient-warm: linear-gradient(135deg, #ffb900 0%, #df7988 100%);
  
  /* Shadows with color tints */
  --shadow-sm: 0 1px 3px rgba(1, 119, 184, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(1, 119, 184, 0.15);
  --shadow-lg: 0 10px 15px -3px rgba(1, 119, 184, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(1, 119, 184, 0.2);
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* Layout */
  --main-top-padding: 35px;
  --section-separation: 40px;
  --container-padding: 15px;
  --tag-border-radius: 4px;
  --scrollbar-thumb: hsl(0, 0%, 85%);
  --scrollbar-track: var(--bg-secondary);
  
  /* Card Colors */
  --card-background: #ffffff;
  --card-background-selected: #f1f5f9;
  --card-text-color-main: #1e293b;
  --card-text-color-secondary: #64748b;
  --card-text-color-tertiary: #94a3b8;
  --card-separator-color: #e2e8f0;
  
  /* Typography */
  --article-font-family: var(--base-font-family);
  --article-font-size: 1.6rem;
  --article-line-height: 1.85;
  
  /* Code and Preformatted Text */
  --pre-background-color: #272822;
  --pre-text-color: #f8f8f2;
  --code-background-color: rgba(0, 0, 0, 0.12);
  --code-text-color: #808080;
  
  /* Other Elements */
  --blockquote-border-size: 4px;
  --blockquote-background-color: rgb(248 248 248);
  --heading-border-size: 4px;
  --link-background-color: 189, 195, 199;
  --link-background-opacity: 0.5;
  --link-background-opacity-hover: 0.7;
  --table-border-color: #dadada;
  --tr-even-background-color: #efefee;
  --kbd-border-color: #dadada;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #333;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 1000;
  border-radius: 4px;
}

.skip-link:focus {
  top: 6px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-family: 'Poppins', sans-serif;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
h2 { 
  font-size: 2rem; 
  color: var(--primary-color);
  font-weight: 600;
}
h3 { 
  font-size: 1.75rem;
  color: var(--text-primary);
}
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  font-weight: 400;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
}

a:hover {
  color: var(--accent-color);
  text-decoration: none;
  transform: translateY(-1px);
}

a:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Lists */
ul, ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Blockquotes */
blockquote {
  border-left: var(--blockquote-border-size) solid var(--accent-color);
  background-color: var(--blockquote-background-color);
  padding: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--card-text-color-secondary);
  border-radius: 0 var(--card-border-radius) var(--card-border-radius) 0;
}

/* Code */
code {
  background-color: var(--code-background-color);
  color: var(--code-text-color);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: var(--code-font-family);
  font-size: 0.875rem;
}

pre {
  background-color: var(--pre-background-color);
  color: var(--pre-text-color);
  border: 1px solid var(--card-separator-color);
  border-radius: 6px;
  padding: 1.5rem;
  margin: 2rem 0;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Header */
.header {
  background: var(--gradient-primary);
  color: white;
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1.5rem 0;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.site-title a {
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
}

.site-title a:hover {
  transform: scale(1.05);
}

.site-title strong {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  background: none;
  -webkit-background-clip: text;
  -webkit-text-fill-color: white;
  background-clip: text;
  font-family: 'Poppins', sans-serif;
}

.site-description {
  margin: 0.5rem 0 0 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
}

/* Header styles complete */

/* Home page */
.home-page {
  padding: 2rem 0;
}

.hero {
  text-align: center;
  margin-bottom: 4rem;
  padding: 2rem 0;
}

.hero-title {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.25rem;
  color: #6b7280;
  max-width: 600px;
  margin: 0 auto;
}

.section-title {
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
}

/* Posts grid */
.posts-grid {
  display: block;
  margin-bottom: 3rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-accent);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.post-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-color);
}

.post-card:hover::before {
  opacity: 1;
}

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

.post-title {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.post-icon {
  color: var(--primary-color);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.post-title a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.3;
}

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

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--card-separator-color);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--card-text-color-secondary);
  font-weight: 500;
}

.meta-item i {
  font-size: 0.9rem;
}

.meta-item.read-time i { color: var(--accent-color); }
.meta-item.word-count i { color: var(--warning-color); }
.post-author i { color: var(--success-color); }
.post-date i { color: var(--primary-color); }

.post-image {
  margin: 1rem 0;
}

.post-summary {
  margin-bottom: 1rem;
  flex-grow: 1;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
}

.tags-icon {
  color: var(--primary-color);
  font-size: 1rem;
}

.tag {
  background: var(--gradient-secondary);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: var(--shadow-sm);
}

.tag:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: white;
}

.tag i {
  font-size: 0.7rem;
}



/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}

.pagination-link {
  padding: 0.75rem 1.5rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.pagination-link:hover {
  background-color: #2563eb;
  color: #fff;
  border-color: #2563eb;
  text-decoration: none;
}

.pagination-info {
  font-size: 0.875rem;
  color: #6b7280;
}

/* Single post */
.single-post {
  padding: 2rem 0;
}

.post-content-wrapper {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3rem;
  margin: 2rem 0;
}

.post-content {
  max-width: none;
}

/* Table of contents */
.table-of-contents {
  background: var(--gradient-secondary);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.table-of-contents h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  color: white;
  text-align: center;
  font-weight: 600;
}

.table-of-contents ul {
  list-style: none;
  padding-left: 0;
}

.table-of-contents ul ul {
  padding-left: 1.5rem;
}

.table-of-contents li {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.3);
}

.table-of-contents li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.table-of-contents a {
  color: white;
  font-size: 0.95rem;
  text-decoration: none;
  position: relative;
  padding-left: 1.5rem;
  display: block;
  transition: all 0.3s ease;
}

.table-of-contents a:hover {
  color: var(--warning-color);
  transform: translateX(5px);
}

.table-of-contents a::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--warning-color);
  font-weight: bold;
}

.table-of-contents a::after {
  content: "";
  position: absolute;
  left: 1.2rem;
  right: 0;
  bottom: 0.4rem;
  height: 1px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.3) 50%, transparent 50%);
  background-size: 4px 1px;
}

/* Sidebar */
.post-sidebar {
  position: sticky;
  top: 120px;
  height: fit-content;
}

.sidebar-section {
  background-color: #f9fafb;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.sidebar-section h4 {
  margin-bottom: 1rem;
  font-size: 1.125rem;
  color: #1f2937;
}

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

.sidebar-section li {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.sidebar-section li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.sidebar-section small {
  display: block;
  color: #9ca3af;
  font-size: 0.75rem;
}

/* Related posts */
.related-posts li {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.related-posts li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.related-posts small {
  display: block;
  color: #9ca3af;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Post navigation */
.post-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}

.nav-prev, .nav-next {
  flex: 1;
  max-width: 45%;
}

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

/* Tags at end of article */
.post-tags-end {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--gradient-accent);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.post-tags-end h4 {
  color: white;
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1.25rem;
}

.post-tags-end .tag {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
  display: inline-block;
  margin: 0.5rem 0.5rem 0.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.post-tags-end .tag:hover {
  background: white;
  color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

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

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

/* Contact form */
.contact-form-section {
  margin: 3rem 0;
  padding: 2rem;
  background-color: #f9fafb;
  border-radius: 8px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.submit-btn {
  background-color: #2563eb;
  color: #fff;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.submit-btn:hover {
  background-color: #1d4ed8;
}

/* Footer */
.footer {
  background: var(--gradient-primary);
  color: white;
  padding: 3rem 0 2rem;
  margin-top: 4rem;
  text-align: center;
  border-top: none;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--container-padding);
  text-align: center;
}

.footer-info p {
  margin: 0.5rem 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  font-weight: 400;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--container-padding);
  }
  
  .header {
    padding: 1rem 0;
  }
  
  .header-content {
    text-align: center;
  }
  
  .site-title strong {
    font-size: 1.75rem;
  }
  
  .site-description {
    font-size: 0.9rem;
  }
  
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .post-card {
    padding: 1.5rem;
  }
  
  .post-meta {
    gap: 1rem;
    flex-direction: column;
    align-items: flex-start;
  }
  
  .meta-item {
    font-size: 0.8rem;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-description {
    font-size: 1.125rem;
  }
  
  .post-content-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .post-sidebar {
    position: static;
  }
  
  .pagination {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .post-navigation {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-prev, .nav-next {
    max-width: 100%;
    text-align: center;
  }
  
  .share-buttons {
    justify-content: center;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  
  /* Adjust TOC for mobile */
  .table-of-contents a::after {
    display: none;
  }
  
  .table-of-contents a {
    padding-left: 1rem;
  }
  
  .table-of-contents a::before {
    left: 0;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.75rem;
  }
  
  .posts-grid {
    gap: 1.5rem;
  }
  
  .post-card {
    padding: 1rem;
  }
  
  .tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
  }
  
  .header-content {
    padding: 0 1rem;
  }
  
  .footer-content {
    padding: 0 1rem;
  }
  
  /* Adjust tags for mobile */
  .post-tags-end .tag {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    margin: 0.3rem 0.3rem 0.3rem 0;
  }
}

/* Print styles */
@media print {
  .header,
  .footer,
  .post-sidebar,
  .post-navigation,
  .pagination,
  .breadcrumbs {
    display: none;
  }
  
  .container {
    max-width: none;
    padding: 0;
  }
  
  .post-content-wrapper {
    grid-template-columns: 1fr;
  }
  
  a {
    color: #000;
    text-decoration: underline;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --body-background: #303030;
    --accent-color: #ecf0f1;
    --accent-color-darker: #bdc3c7;
    --accent-color-text: #000;
    --body-text-color: rgba(255, 255, 255, 0.7);
    --scrollbar-thumb: hsl(0, 0%, 40%);
    --scrollbar-track: var(--body-background);
    
    /* Card Colors */
    --card-background: #424242;
    --card-background-selected: rgba(255, 255, 255, 0.16);
    --card-text-color-main: rgba(255, 255, 255, 0.9);
    --card-text-color-secondary: rgba(255, 255, 255, 0.7);
    --card-text-color-tertiary: rgba(255, 255, 255, 0.5);
    --card-separator-color: rgba(255, 255, 255, 0.12);
    
    /* Code and Preformatted Text */
    --code-background-color: #272822;
    --code-text-color: rgba(255, 255, 255, 0.9);
    --pre-text-color: #f8f8f2;
    --pre-background-color: #272822;
    
    /* Other Elements */
    --blockquote-background-color: rgb(75 75 75);
    --table-border-color: #717171;
    --tr-even-background-color: #545454;
  }
}