/* ============================================
   TASKIF'S NOTEBOOK — Custom Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Noto+Sans+Bengali:wght@300;400;500;600&family=Hind+Siliguri:wght@300;400;500;600&display=swap');

/* ---- CSS Custom Properties ---- */
:root {
  --bg: #f7f6f3;
  --bg-secondary: #eeecea;
  --bg-card: #ffffff;
  --text-primary: #1a1917;
  --text-secondary: #5c5854;
  --text-muted: #9c9793;
  --border: #e0ddd9;
  --border-light: #eeecea;
  --accent: #3d7eff;
  --accent-soft: #e8efff;
  --accent-green: #2a7a4b;
  --accent-green-soft: #e4f2eb;
  --tag-bg: #f0eeed;
  --tag-text: #6b6560;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
  --radius: 6px;
  --radius-lg: 10px;
  --transition: all 0.2s ease;

  /* Typography */
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-bengali: 'Noto Sans Bengali', 'Hind Siliguri', sans-serif;

  /* Layout */
  --container-width: 1100px;
  --content-width: 800px;
}

[data-theme="dark"] {
  --bg: #141412;
  --bg-secondary: #1c1b19;
  --bg-card: #1f1e1c;
  --text-primary: #e8e5e0;
  --text-secondary: #a09c96;
  --text-muted: #6b6762;
  --border: #2e2c2a;
  --border-light: #252422;
  --accent: #5b9bff;
  --accent-soft: #1a2540;
  --accent-green: #4eca7a;
  --accent-green-soft: #102519;
  --tag-bg: #252422;
  --tag-text: #9c9793;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
}

/* ---- Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-mono);
  background-color: var(--bg);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ---- Bengali Font Detection ---- */
:lang(bn), .bengali-text,
*:has(> span[lang="bn"]) {
  font-family: var(--font-bengali);
}

/* Auto-detect Bengali characters */
.post-body p,
.post-body li,
.post-body blockquote {
  font-family: var(--font-mono);
}

/* ---- Selection ---- */
::selection {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Header & Nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: var(--transition);
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-color: var(--bg);
  opacity: 0.9;
  z-index: -1;
}

.header-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-title .title-accent {
  color: var(--accent);
}

.site-title .subtitle {
  font-size: 11px;
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Mobile nav */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 32px;
  height: 32px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  transition: var(--transition);
}

.mobile-menu-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mobile-nav {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 1rem 1.5rem;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav .nav-link {
  font-size: 13px;
  padding: 6px 0;
}

/* ---- Main Layout ---- */
.main-content {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  min-height: calc(100vh - 56px - 80px);
}

/* ---- Hero Section ---- */
.hero-section {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-eyebrow::before {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--accent);
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.hero-description {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 800px;
  font-weight: 300;
}

/* ---- Section Headers ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.03em;
}

.section-link:hover { text-decoration: underline; }

/* ---- Post Container Grid ---- */
#posts-container,
#filtered-posts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

/* ---- Post Card ---- */
.post-card {
  padding: 1.5rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.post-card:last-child {
  border-bottom: 1px solid var(--border-light);
}

.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.post-card:hover .post-title-link {
  color: var(--accent);
}

.post-meta-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.post-category-tag {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-green);
  background: var(--accent-green-soft);
  padding: 2px 8px;
  border-radius: 3px;
}

.post-date {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.post-reading-time {
  font-size: 11px;
  color: var(--text-muted);
}

.post-reading-time::before {
  content: '· ';
}

.post-title-link {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.4;
  display: block;
  margin-bottom: 0.4rem;
  transition: color 0.2s;
}

.post-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  font-weight: 300;
}

/* ---- Category Filter ---- */
.category-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.03em;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ---- Post Page ---- */
.post-header {
  max-width: var(--content-width);
  margin: 0 auto 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-header-category {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-green);
  font-weight: 500;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-header-category::before {
  content: '';
  display: block;
  width: 16px;
  height: 1px;
  background: var(--accent-green);
}

.post-header-title {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.post-header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.meta-item {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-divider {
  color: var(--border);
  font-size: 10px;
}

/* ---- Post Body (Article) ---- */
.post-body {
  max-width: var(--content-width);
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.85;
  color: var(--text-primary);
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.post-body h1 { font-size: 1.4rem; }
.post-body h2 { font-size: 1.15rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.post-body h3 { font-size: 1rem; color: var(--text-secondary); }

.post-body p {
  margin-bottom: 1.25rem;
  font-weight: 300;
}

.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  transition: text-decoration-color 0.2s;
}

.post-body a:hover {
  text-decoration-color: var(--accent);
}

.post-body ul,
.post-body ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.post-body li {
  margin-bottom: 0.4rem;
  font-weight: 300;
}

.post-body ul li::marker {
  color: var(--accent);
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent);
  border: 1px solid var(--border);
}

.post-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 13px;
}

.post-body strong {
  font-weight: 600;
  color: var(--text-primary);
}

.post-body em {
  font-style: italic;
  color: var(--text-secondary);
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.post-body img {
  max-width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: block;
  margin: 0 auto;
}

/* ---- Images & Captions ---- */
.post-body figure {
  margin: 3rem auto;
  max-width: 550px;
  width: 95%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.post-body figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
}

.post-body figure img:hover {
  transform: scale(1.02);
}

.post-body figcaption {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-style: italic;
  text-align: center;
  line-height: 1.5;
  width: 100%;
  margin: 0;
  padding: 0 10px;
}

/* Bengali text in post */
.post-body .bengali-block {
  font-family: var(--font-bengali);
  line-height: 2;
  font-size: 16px;
}

/* ---- Post Navigation ---- */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-nav-link {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: var(--transition);
  background: var(--bg-card);
}

.post-nav-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

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

.post-nav-direction {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.post-nav-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ---- About Page ---- */
.about-content {
  max-width: var(--content-width);
}

.about-intro {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.about-avatar {
  width: 160px;
  height: 160px;
  border-radius: 20px;
  background: var(--accent-soft);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

.about-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.about-intro-text {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.about-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.about-role {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
}

.about-body {
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-secondary);
  font-weight: 300;
}

.about-body p { margin-bottom: 1.25rem; }

.about-body strong {
  color: var(--text-primary);
  font-weight: 500;
}

.interests-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.interest-tag {
  font-size: 11px;
  padding: 4px 12px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 20px;
  border: 1px solid var(--border);
  letter-spacing: 0.03em;
}

/* ---- Articles / Categories Page ---- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.category-card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.category-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.category-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.category-card-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Loading State ---- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  color: var(--text-muted);
  gap: 1rem;
}

.loading-dot {
  display: inline-block;
  animation: pulse 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.loading-dots {
  display: flex;
  gap: 5px;
  font-size: 24px;
  color: var(--accent);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
}

.footer-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-text {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer-link {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--accent);
}

/* ---- Social Icons ---- */
.social-icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: var(--transition);
  text-decoration: none;
}

.social-icon-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.portfolio-link {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff !important;
  border: 1px solid var(--accent);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-decoration: none;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
}

.portfolio-link svg {
  flex-shrink: 0;
}

.portfolio-link span {
  width: 0;
  opacity: 0;
  margin-left: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.portfolio-link:hover {
  width: 140px;
  background: var(--bg-card);
  color: var(--accent) !important;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.portfolio-link:hover span {
  width: auto;
  opacity: 1;
  margin-left: 10px;
}

[data-theme="dark"] .portfolio-link {
  color: var(--bg) !important;
}

[data-theme="dark"] .portfolio-link:hover {
  background: var(--accent);
  color: var(--bg) !important;
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.post-card {
  animation: fadeIn 0.4s ease forwards;
  opacity: 0;
}

.post-card:nth-child(1) { animation-delay: 0.05s; }
.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.15s; }
.post-card:nth-child(4) { animation-delay: 0.2s; }
.post-card:nth-child(5) { animation-delay: 0.25s; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .main-nav { display: none; }
  .mobile-menu-btn { display: flex; }

  .header-inner {
    gap: 0.75rem;
  }

  .site-title .subtitle {
    display: none;
  }

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

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

  .post-navigation {
    grid-template-columns: 1fr;
  }

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

  .about-intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .about-avatar {
    width: 128px;
    height: 128px;
    border-radius: 18px;
  }

  .about-intro-text {
    min-height: auto;
  }

  .footer-inner {
    justify-content: center;
    flex-direction: column;
    align-items: center;
  }

  /* Post Grid Responsiveness */
  #posts-container,
  #filtered-posts {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 2rem 1.25rem;
  }
}
