@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

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

/* ========== DARK THEME (DEFAULT) ========== */
:root, [data-theme="dark"] {
  --color-bg: #0b0b0b;
  --color-surface: #151515;
  --color-surface-elevated: #1c1c1c;
  --color-text: #e2e8f0;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  --color-primary: #10b981;
  --color-primary-dark: #059669;
  --color-primary-glow: rgba(16, 185, 129, 0.15);
  --color-accent: #34d399;
  --color-border: #222222;
  --color-border-hover: #333333;
  --color-footer-bg: #050505;
  --color-footer-text: #94a3b8;
  --color-code-bg: #1a1a2e;
  --color-header-bg: rgba(11, 11, 11, 0.92);
  --color-card-hover: #1a1a1a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -2px rgba(0,0,0,0.3);
  --radius: 8px;
  --radius-lg: 12px;
  --container: 720px;
  --container-wide: 1100px;
}

/* ========== LIGHT THEME ========== */
[data-theme="light"] {
  --color-bg: #ffffff;
  --color-surface: #f8fafc;
  --color-surface-elevated: #ffffff;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-primary: #10b981;
  --color-primary-dark: #059669;
  --color-primary-glow: rgba(16, 185, 129, 0.08);
  --color-accent: #059669;
  --color-border: #e2e8f0;
  --color-border-hover: #cbd5e1;
  --color-footer-bg: #0f172a;
  --color-footer-text: #cbd5e1;
  --color-code-bg: #1e293b;
  --color-header-bg: rgba(255, 255, 255, 0.92);
  --color-card-hover: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--color-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-accent); }
img { max-width: 100%; height: auto; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
.container-wide { max-width: var(--container-wide); margin: 0 auto; padding: 0 1.5rem; }

/* ========== HEADER ========== */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-header-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.3s, border-color 0.3s;
}
.site-header .container-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-text);
  text-decoration: none;
}
.logo:hover { color: var(--color-text); }
.logo .logo-mark { width: 36px; height: 36px; flex-shrink: 0; object-fit: contain; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text .name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-text);
  font-stretch: semi-expanded;
}
.logo-text .name .green { color: var(--color-primary); }
.logo-text .inc {
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 2px;
}
.logo-text .inc::before,
.logo-text .inc::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background: var(--color-primary);
  opacity: 0.85;
}
.header-right { display: flex; align-items: center; gap: 0.25rem; }
.site-nav { display: flex; gap: 0.25rem; }
.site-nav a {
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.2s;
}
.site-nav a:hover { color: var(--color-text); background: var(--color-surface); }
.site-nav a.active { color: var(--color-primary); background: var(--color-primary-glow); }

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 0.5rem;
}
.theme-toggle:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-glow);
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ========== HERO ========== */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
}
.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  line-height: 1.2;
}
.hero p {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

/* ========== SECTION ========== */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-border);
}

/* ========== POST CARDS ========== */
.posts-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 3rem; }

.post-card {
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all 0.2s;
  background: var(--color-surface-elevated);
}
.post-card:hover {
  border-color: var(--color-border-hover);
  background: var(--color-card-hover);
  box-shadow: var(--shadow-md);
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}
.post-meta .author { color: var(--color-text-secondary); font-weight: 500; }
.post-meta .separator { color: var(--color-border); }
.post-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}
.post-card h2 a { color: var(--color-text); }
.post-card h2 a:hover { color: var(--color-primary); }
.post-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--color-primary-glow);
  color: var(--color-primary);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.tag:hover { background: rgba(16,185,129,0.25); border-color: var(--color-primary); }
.post-excerpt {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}
.read-more {
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--color-primary);
}
.read-more::after { content: '\2192'; transition: transform 0.2s; }
.read-more:hover::after { transform: translateX(3px); }

/* ========== TAG CLOUD ========== */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}
.tag-cloud .tag {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}
.tag-cloud .tag .count {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.3rem;
  background: var(--color-primary-glow);
  border-radius: 3px;
  font-size: 0.7rem;
}

/* ========== SINGLE POST ========== */
.post-header { padding: 3rem 0 2rem; }
.post-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.post-header .post-meta { margin-bottom: 1rem; font-size: 0.9rem; }

.post-content {
  padding-bottom: 3rem;
  font-size: 1.05rem;
  line-height: 1.8;
}
.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
}
.post-content h1 { font-size: 1.8rem; }
.post-content h2 { font-size: 1.5rem; }
.post-content h3 { font-size: 1.25rem; }
.post-content p { margin-bottom: 1.25rem; }
.post-content ul { margin-bottom: 1.25rem; padding-left: 1.5rem; list-style-type: disc; }
.post-content ol { margin-bottom: 1.25rem; padding-left: 1.5rem; list-style-type: decimal; }
.post-content ul ul { list-style-type: circle; }
.post-content li { margin-bottom: 0.4rem; display: list-item; }
.post-content li::marker { color: var(--color-primary); }
.post-content blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--color-surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--color-text-secondary);
  font-style: italic;
}
.post-content code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--color-surface);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid var(--color-border);
}
.post-content pre {
  background: var(--color-code-bg);
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--color-border);
}
.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  border: none;
}
.post-content img {
  border-radius: var(--radius);
  margin: 1.5rem 0;
}
.post-content img.is-zoomable {
  cursor: zoom-in;
  transition: opacity 0.2s, transform 0.2s;
}
.post-content img.is-zoomable:hover { opacity: 0.9; transform: scale(1.01); }
.post-content img.is-zoomable:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* ========== IMAGE LIGHTBOX ========== */
body.lightbox-open { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lightbox.is-open { display: flex; animation: lightboxFade 0.18s ease-out; }
@keyframes lightboxFade { from { opacity: 0; } to { opacity: 1; } }

.lightbox-figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.lightbox-img {
  max-width: min(1100px, 92vw);
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  cursor: zoom-out;
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s, border-color 0.2s;
  line-height: 1;
}
.lightbox-close:hover,
.lightbox-nav:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.lightbox-close {
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  font-size: 1.6rem;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 60px;
  font-size: 2rem;
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

@media (max-width: 768px) {
  .lightbox { padding: 1rem; }
  .lightbox-img { max-height: 74vh; }
  .lightbox-nav { width: 38px; height: 50px; font-size: 1.6rem; }
  .lightbox-prev { left: 0.4rem; }
  .lightbox-next { right: 0.4rem; }
}
.post-content strong { font-weight: 600; }

/* ========== ABOUT PAGE ========== */
.about-hero {
  text-align: center;
  padding: 3rem 0 2rem;
}
.about-hero .about-icon {
  width: 90px;
  height: 90px;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}
.about-hero .about-icon svg,
.about-hero .about-icon img { width: 90px; height: 90px; object-fit: contain; border-radius: 20px; }
.about-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.25rem; }
.about-brand { letter-spacing: 0.02em; }
.about-inc {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.about-inc span {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  color: var(--color-primary);
}
.about-inc::before,
.about-inc::after {
  content: '';
  width: 40px;
  height: 1px;
  background: var(--color-primary);
  opacity: 0.5;
}
.about-hero p {
  color: var(--color-text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}
.about-social {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.about-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  transition: all 0.2s;
  border: 1px solid var(--color-border);
}
.about-social a:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Contributors */
.contributors { padding: 2rem 0 4rem; }
.contributors h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  text-align: center;
}
.contributors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.contributor-card {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  transition: all 0.2s;
}
.contributor-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--color-border-hover);
}
.contributor-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
}
.contributor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.contributor-avatar .initials {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}
.contributor-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; }
.contributor-card .role { color: var(--color-text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }
.contributor-links {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}
.contributor-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  transition: all 0.2s;
}
.contributor-links a:hover { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* ========== PROJECTS PAGE ========== */
.projects-hero { text-align: center; padding: 4rem 0 3rem; }
.projects-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 1rem; }
.projects-hero p { color: var(--color-text-secondary); font-size: 1.05rem; }
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  padding-bottom: 4rem;
}
.project-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  background: var(--color-surface-elevated);
  transition: all 0.2s;
}
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--color-border-hover); }
.project-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.5rem; }
.project-card p { color: var(--color-text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }
.project-status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.project-status.active { background: rgba(16,185,129,0.15); color: #10b981; }
.project-status.development { background: rgba(99,102,241,0.15); color: #818cf8; }
.project-status.research { background: rgba(245,158,11,0.15); color: #fbbf24; }
[data-theme="light"] .project-status.active { color: #059669; }
[data-theme="light"] .project-status.development { color: #6366f1; }
[data-theme="light"] .project-status.research { color: #d97706; }

/* ========== FOOTER ========== */
.site-footer {
  margin-top: auto;
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: 2.5rem 0;
  text-align: center;
}
.footer-social {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: var(--color-footer-text);
  transition: all 0.2s;
}
.footer-social a:hover { background: var(--color-primary); color: white; }
.footer-social a svg { width: 18px; height: 18px; }
.site-footer p { font-size: 0.85rem; color: var(--color-text-muted); }

/* ========== 404 ========== */
.not-found {
  text-align: center;
  padding: 6rem 0;
}
.not-found h1 { font-size: 5rem; font-weight: 800; color: var(--color-border); }
.not-found p { font-size: 1.2rem; color: var(--color-text-secondary); margin: 1rem 0 2rem; }
.btn-primary {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: var(--color-primary);
  color: white;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--color-primary-dark); color: white; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .site-header .container-wide { height: 56px; }
  .logo svg { width: 26px; height: 26px; }
  .logo-text .name { font-size: 0.95rem; }
  .logo-text .inc { font-size: 0.45rem; }
  .site-nav a { padding: 0.35rem 0.6rem; font-size: 0.8rem; }
  .hero { padding: 3rem 0 2rem; }
  .hero h1 { font-size: 1.7rem; }
  .hero p { font-size: 1rem; }
  .post-header h1 { font-size: 1.7rem; }
  .contributors-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .about-hero h1 { font-size: 1.6rem; }
}
