/* Deepcomet AI Custom Styles - Polished */

:root {
  --primary: #667eea;
  --primary-dark: #5a67d8;
  --accent: #764ba2;
  --text: #1a202c;
  --text-muted: #718096;
  --bg: #ffffff;
  --bg-muted: #f7fafc;
  --border: #e2e8f0;
  --radius: 14px;
  --nav-bg: #ffffff;
  --card-bg: #ffffff;
  --footer-bg: #f7fafc;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --input-bg: #ffffff;
}

[data-theme="dark"] {
  --primary: #8b9cf0;
  --primary-dark: #a5b4fc;
  --accent: #a78bfa;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --bg: #0f172a;
  --bg-muted: #1e293b;
  --border: #334155;
  --nav-bg: #0f172a;
  --card-bg: #1e293b;
  --footer-bg: #0f172a;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --input-bg: #1e293b;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  padding-top: 80px;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Navigation ===== */
.navbar {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  min-height: 60px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  background: var(--nav-bg) !important;
  transition: background-color 0.3s ease;
}

.navbar .nav-link {
  color: var(--text) !important;
  transition: color 0.2s ease;
}

.navbar .nav-link:hover {
  color: var(--primary) !important;
}

.navbar-toggler {
  border-color: var(--border);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle:hover {
  background: var(--bg-muted);
  border-color: var(--primary);
}

.mobile-menu-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
}

.mobile-menu-toggle.active .hamburger-line {
  background: white !important;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile navigation improvements */
@media (max-width: 991px) {
  .navbar-nav {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  
  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
  }
  
  .navbar-nav .nav-item {
    width: 100%;
  }
}

.hamburger {
  display: inline-block;
  width: 24px;
  height: 24px;
  position: relative;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  margin: 3px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.hamburger-line:first-child {
  margin-top: 0;
}

[data-theme="dark"] .hamburger-line {
  background: var(--text);
}

.logotext {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Navbar search */
.navbar .form-inline input.form-control {
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  width: 160px;
  transition: width 0.2s ease, box-shadow 0.2s ease;
}

.navbar .form-inline input.form-control:focus {
  width: 200px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
  border-color: var(--primary);
}

/* ===== Hero Section ===== */
.hero-section {
  padding-top: 3rem;
  padding-bottom: 2.5rem;
}

.hero-title {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 2.4rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-lead {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto;
}

/* ===== Section Title ===== */
.section-title {
  margin-bottom: 2.5rem;
}

.section-heading {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  display: inline-block;
  position: relative;
}

.section-heading span {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Blog Cards ===== */
.blog-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
  overflow: hidden;
  background: var(--card-bg);
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.1), 0 8px 16px rgba(0, 0, 0, 0.05);
}

.card-image {
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.card-gradient {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 2rem;
  text-align: center;
}

.card-gradient-text {
  color: white;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.4;
  text-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.blog-card .card-body {
  padding: 1.5rem 1.5rem 1rem;
}

.blog-card .card-title {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.blog-card .card-title a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.card-excerpt {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 0;
}

.blog-card .card-footer {
  padding: 1rem 1.5rem;
  background: transparent;
  border-top: 1px solid var(--border);
}

/* ===== Author Meta ===== */
.wrapfooter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.meta-footer-thumb {
  flex-shrink: 0;
}

.author-meta {
  flex: 1;
  min-width: 0;
}

.author-meta .post-name {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.3;
}

.author-meta .post-name a {
  color: var(--text);
  text-decoration: none;
}

.author-meta .post-name a:hover {
  color: var(--primary);
}

.author-meta .post-date {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.post-read-more {
  flex-shrink: 0;
}

.post-read-more a {
  color: var(--text-muted);
  transition: color 0.2s;
}

.post-read-more a:hover {
  color: var(--primary);
}

/* ===== Author Thumb ===== */
.author-thumb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

/* ===== Post Content ===== */
.article-post {
  font-size: 1.08rem;
  line-height: 1.85;
}

.article-post h1,
.article-post h2,
.article-post h3,
.article-post h4 {
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

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

.article-post code {
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
  background: var(--bg-muted);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--primary-dark);
}

.article-post pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.article-post pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.article-post blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1.5rem;
  margin: 2rem 0;
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg-muted);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-post a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid rgba(102, 126, 234, 0.3);
  transition: border-color 0.2s, color 0.2s;
}

.article-post a:hover {
  border-bottom-color: var(--primary);
  color: var(--primary-dark);
}

/* ===== Tags ===== */
.tags li a {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
}

.tags li a:hover {
  background: var(--primary);
  color: white;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg-muted);
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* ===== Featured Image ===== */
.featured-image {
  border-radius: var(--radius);
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ===== Share Buttons ===== */
.share {
  margin: 2rem 0;
}

.share p {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.share ul {
  display: flex;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.share ul li a {
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-muted);
}

.share ul li a:hover {
  color: var(--primary);
  background: rgba(102, 126, 234, 0.1);
}

/* ===== Pagination ===== */
.bottompagination {
  margin-top: 3rem;
  padding-top: 1.5rem;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.pagination span,
.pagination a {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

.pagination span {
  color: var(--text-muted);
}

.pagination a {
  color: var(--primary);
  background: var(--bg-muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.pagination a:hover {
  background: var(--primary);
  color: white;
}

/* ===== Post Author Box ===== */
.post-top-meta {
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg-muted) 0%, #fff 100%);
  border-radius: var(--radius);
  margin: 2.5rem 0;
  border: 1px solid var(--border);
}

.post-top-meta .author-thumb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ===== Page Title ===== */
.mainheading .posttitle {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.mainheading .lead {
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== Buttons ===== */
.btn-outline-primary {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

/* ===== Nav Scroll Hide/Show ===== */
.nav-down {
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.nav-up {
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

/* ===== Site Content Spacing ===== */
.site-content {
  min-height: calc(100vh - 300px);
  padding-bottom: 2rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  body {
    padding-top: 70px;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .hero-lead {
    font-size: 1rem;
  }

  .blog-card {
    margin-bottom: 1.25rem;
  }

  .mainheading .posttitle {
    font-size: 1.7rem;
  }

  .post-top-meta .author-thumb {
    width: 56px;
    height: 56px;
  }

  .article-post {
    font-size: 1rem;
  }

  .navbar .form-inline input.form-control {
    width: 120px;
  }

  .navbar .form-inline input.form-control:focus {
    width: 140px;
  }
}

/* ===== Theme Toggle Button ===== */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  margin-left: 0.5rem;
}

.theme-toggle-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.theme-toggle-btn .icon-sun,
.theme-toggle-btn .icon-moon {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-toggle-btn .icon-sun {
  opacity: 1;
  transform: scale(1);
}

.theme-toggle-btn .icon-moon {
  opacity: 0;
  transform: scale(0.5);
}

[data-theme="dark"] .theme-toggle-btn .icon-sun {
  opacity: 0;
  transform: scale(0.5);
}

[data-theme="dark"] .theme-toggle-btn .icon-moon {
  opacity: 1;
  transform: scale(1);
}

/* ===== Dark Mode Overrides ===== */
[data-theme="dark"] .blog-card:hover {
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.15), 0 8px 16px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .navbar .form-inline input.form-control {
  background: var(--input-bg);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .article-post pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
}

[data-theme="dark"] .post-top-meta {
  background: linear-gradient(135deg, var(--bg-muted) 0%, var(--card-bg) 100%);
}

[data-theme="dark"] .footer {
  border-color: var(--border);
}

/* ===== Archive Page ===== */
.archive-year {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 3rem 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}

.archive-year:first-child {
  margin-top: 1rem;
}

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

.archive-item {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
}

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

.archive-item:hover {
  background: var(--bg-muted);
  margin: 0 -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  border-radius: var(--radius);
}

.archive-date {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 90px;
  text-align: right;
  padding-top: 0.15rem;
}

.archive-content {
  flex: 1;
  min-width: 0;
}

.archive-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

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

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

.archive-excerpt {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}

/* ===== Search Modal ===== */
.search-btn {
  color: var(--text) !important;
  padding: 0.5rem;
  border: none;
  background: none;
  transition: color 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.search-btn:hover {
  color: var(--primary) !important;
  background: var(--bg-muted);
}

.search-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.search-modal-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.search-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.search-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.search-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.search-modal-close:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.search-modal-body {
  padding: 1.5rem;
}

#search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.2s ease;
}

#search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-results {
  margin-top: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
}

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

.search-result-item:hover {
  background: var(--bg-muted);
  margin: 0 -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  border-radius: var(--radius);
}

.search-result-item h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
}

.search-result-item h4 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.search-result-item h4 a:hover {
  color: var(--primary);
}

.search-result-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem 0;
}

.search-result-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.search-no-results {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-style: italic;
}

mark {
  background: var(--primary);
  color: white;
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
  font-weight: 500;
}

/* ===== Favicon ===== */
/* Favicon is handled via HTML link tags in default.html */
