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

/* Default Light Theme variables */
:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #6b7280;
  --border: rgba(0, 0, 0, 0.08);
  --nav-border: rgba(0, 0, 0, 0.6);
  --blue-hover: #2563eb;
  --panel: #f9fafb;
  --accent: #000000;
  
  /* Light Syntax highlighting colors (No raw blue) */
  --sh-class: #7c3aed; /* violet */
  --sh-identifier: #111111;
  --sh-keyword: #ea580c; /* orange */
  --sh-string: #059669; /* green */
  --sh-sign: #4b5563;
  --sh-comment: #9ca3af;
  --sh-property: #ea580c;
}

/* System Dark Theme Preference */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0f;
    --fg: #f5f5f5;
    --muted: #a3a3a3;
    --border: rgba(255, 255, 255, 0.1);
    --nav-border: rgba(255, 255, 255, 0.35);
    --blue-hover: #60a5fa;
    --panel: #14141e;
    --accent: #ffffff;
    
    /* Dark Syntax highlighting colors (No raw blue) */
    --sh-class: #a78bfa; /* violet/purple */
    --sh-identifier: #ffffff;
    --sh-keyword: #f47067;
    --sh-string: #0fa295;
    --sh-sign: #8996a3;
    --sh-comment: #8b8b8b;
    --sh-property: #e25a1c;
  }
}

/* Explicit theme class overrides */
body.light-theme {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #6b7280;
  --border: rgba(0, 0, 0, 0.08);
  --nav-border: rgba(0, 0, 0, 0.6);
  --blue-hover: #2563eb;
  --panel: #f9fafb;
  --accent: #000000;
  
  --sh-class: #7c3aed;
  --sh-identifier: #111111;
  --sh-keyword: #ea580c;
  --sh-string: #059669;
  --sh-sign: #4b5563;
  --sh-comment: #9ca3af;
  --sh-property: #ea580c;
}

body.dark-theme {
  --bg: #0a0a0f;
  --fg: #f5f5f5;
  --muted: #a3a3a3;
  --border: rgba(255, 255, 255, 0.1);
  --nav-border: rgba(255, 255, 255, 0.35);
  --blue-hover: #60a5fa;
  --panel: #14141e;
  --accent: #ffffff;
  
  --sh-class: #a78bfa;
  --sh-identifier: #ffffff;
  --sh-keyword: #f47067;
  --sh-string: #0fa295;
  --sh-sign: #8996a3;
  --sh-comment: #8b8b8b;
  --sh-property: #e25a1c;
}

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

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  min-height: 100vh;
  font-size: 19px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Navigation bar */
nav {
  margin-bottom: 40px;
  border-bottom: 2px solid var(--nav-border);
  padding-bottom: 16px;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-links-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-link {
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
  padding: 8px 14px;
  border-radius: 6px;
  transition: all 160ms ease;
}

.nav-link:hover {
  color: var(--blue-hover);
}

.nav-link.active {
  color: var(--blue-hover);
  background-color: var(--panel);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 160ms ease;
}

.theme-toggle-btn:hover {
  color: var(--fg);
  background-color: rgba(255, 255, 255, 0.05);
}

body.light-theme .theme-toggle-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.theme-toggle-btn svg {
  stroke: currentColor;
  fill: none;
}

/* Toggle Sun/Moon icon visibility */
body.dark-theme .sun-icon {
  display: block;
}
body.dark-theme .moon-icon {
  display: none;
}

body.light-theme .sun-icon {
  display: none;
}
body.light-theme .moon-icon {
  display: block;
}

/* Typography styles */
h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 32px;
  line-height: 1.2;
}

p {
  color: var(--fg);
  margin-bottom: 16px;
  font-size: 19px;
}

.lead-p {
  color: var(--fg);
  margin-bottom: 24px;
  font-size: 20px;
}

.hl {
  background-color: #fef08a;
  color: #1c1917;
  padding: 1px 4px;
  border-radius: 3px;
}
body.dark-theme .hl {
  background-color: #a16207;
  color: #fef9c3;
}

.email-link {
  color: var(--blue-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 150ms ease;
}

.email-link:hover {
  opacity: 0.8;
}

/* Blog List Pages */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 32px 0;
}

.post-item {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: opacity 150ms ease;
}

.post-item:hover {
  opacity: 0.8;
}

.post-row {
  display: flex;
  flex-direction: column;
}

@media (min-width: 640px) {
  .post-row {
    flex-direction: row;
    gap: 8px;
  }
}

.post-date {
  color: var(--muted);
  width: 120px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  margin-bottom: 2px;
}

@media (min-width: 640px) {
  .post-date {
    margin-bottom: 0;
  }
}

.post-title {
  color: var(--fg);
  font-weight: 400;
  letter-spacing: -0.015em;
  font-size: 17px;
}

/* Blog Detail / Markdown Prose */
.post-header-title {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
  line-height: 1.25;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  font-size: 15px;
  color: var(--muted);
}

.prose {
  font-size: 17.5px;
  color: var(--fg);
}

.prose p {
  margin: 16px 0;
  color: var(--fg);
  opacity: 0.9;
  line-height: 1.75;
  font-size: 17.5px;
}

.prose h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 32px 0 12px 0;
  position: relative;
  color: var(--fg);
}

.prose h2:hover .anchor {
  visibility: visible;
}

.prose .anchor {
  position: absolute;
  left: -20px;
  padding-right: 4px;
  text-decoration: none;
  color: var(--muted);
  visibility: hidden;
}

.prose .anchor::after {
  content: "#";
}

.prose strong {
  font-weight: 700;
  color: var(--fg);
}

.prose a {
  color: var(--blue-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 150ms ease;
}

.prose a:hover {
  opacity: 0.8;
}

.prose code {
  font-family: 'Geist Mono', monospace;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 13.5px;
}

.prose pre {
  background-color: #111118;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
}

.prose pre code {
  background-color: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  display: block;
  line-height: 1.6;
}

.prose ul, .prose ol {
  margin: 16px 0;
  padding-left: 24px;
}

.prose li {
  margin-bottom: 8px;
}

/* Sugar-high syntax coloring helper classes */
.sh-keyword { color: var(--sh-keyword); font-weight: 500; }
.sh-string { color: var(--sh-string); }
.sh-comment { color: var(--sh-comment); font-style: italic; }
.sh-class { color: var(--sh-class); }
.sh-identifier { color: var(--sh-identifier); }
.sh-sign { color: var(--sh-sign); }

/* CV Layouts */
.cv-section {
  margin-top: 32px;
}

.cv-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
  color: var(--fg);
}

.cv-item {
  margin-bottom: 24px;
}

.cv-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.cv-role {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}

.cv-date {
  font-size: 13px;
  font-family: 'Geist Mono', monospace;
  color: var(--muted);
}

.cv-org {
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.cv-desc {
  font-size: 14px;
  color: var(--fg);
  opacity: 0.85;
  line-height: 1.5;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  list-style: none;
}

.skill-badge {
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background-color: var(--panel);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--fg);
}

/* Projects layout */
.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 32px;
}

.project-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--panel);
  transition: all 200ms ease;
}

.project-card:hover {
  border-color: var(--fg);
  transform: translateY(-2px);
}

.project-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.015em;
  color: var(--fg);
}

.project-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.project-links {
  display: flex;
  gap: 16px;
  font-size: 13px;
  font-weight: 600;
}

.project-link {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  transition: text-decoration-color 150ms ease;
}

.project-link:hover {
  text-decoration-color: var(--fg);
}

/* Interactive Tabs & Detail Showcase */
.tab-container {
  margin: 32px 0 24px 0;
}
.tab-buttons {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-buttons::-webkit-scrollbar {
  display: none;
}
.tab-button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 200ms ease;
}
.tab-button:hover {
  color: var(--fg);
}
.tab-button.active {
  color: var(--blue-hover);
  border-bottom-color: var(--blue-hover);
}
.tab-content {
  display: none;
  animation: fadeIn 300ms ease-out;
}
.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin: 24px 0;
}
@media (min-width: 768px) {
  .grid-2col {
    grid-template-columns: 1fr 1fr;
  }
}

.showcase-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: all 200ms ease;
  position: relative;
  overflow: hidden;
}
.showcase-card:hover {
  border-color: var(--fg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}
body.dark-theme .showcase-card:hover {
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.02);
}

.showcase-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
}

.showcase-card p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}

.tech-section {
  margin-bottom: 24px;
}
.tech-section-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 700;
}
.tech-badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.tech-badge {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--fg);
}
.tech-badge-accent {
  border-color: var(--blue-hover);
  color: var(--blue-hover);
}

/* Roadmap Flow */
.roadmap-flow {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 24px 0;
  position: relative;
}
.roadmap-flow::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}
.roadmap-step {
  display: flex;
  gap: 16px;
  position: relative;
}
.roadmap-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.roadmap-step.active .roadmap-icon {
  border-color: var(--blue-hover);
  color: var(--blue-hover);
  background: var(--bg);
}
.roadmap-step.upcoming .roadmap-icon {
  border-color: var(--border);
  color: var(--muted);
}
.roadmap-info {
  padding-top: 6px;
}
.roadmap-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
}
.roadmap-desc {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}

/* Footer layout */
footer {
  margin-top: auto;
  padding-top: 48px;
  margin-bottom: 32px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .footer-links {
    flex-direction: row;
    gap: 16px;
  }
}

.footer-link-item a {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  transition: color 150ms ease;
  font-size: 14px;
}

.footer-link-item a:hover {
  color: var(--fg);
}

.footer-link-item p {
  margin: 0 0 0 8px;
  height: 28px;
  display: flex;
  align-items: center;
}

.footer-arrow {
  color: currentColor;
  flex-shrink: 0;
}

.copyright {
  color: var(--muted);
  font-size: 14px;
  margin-top: 24px;
}

/* Responsive Overrides */
@media (max-width: 640px) {
  .container {
    padding: 30px 20px;
  }
  nav {
    margin-bottom: 24px;
    padding-bottom: 12px;
  }
  .nav-links-left {
    gap: 4px;
  }
  .nav-link {
    font-size: 16px;
    padding: 6px 10px;
  }
  h1 {
    font-size: 26px;
    margin-bottom: 20px;
  }
  p, .lead-p {
    font-size: 16px;
    line-height: 1.6;
  }
  .post-date {
    width: auto;
    font-size: 14px;
    margin-bottom: 4px;
  }
  .post-title {
    font-size: 15px;
  }
  .post-header-title {
    font-size: 26px;
    margin-bottom: 16px;
  }
  .post-meta {
    margin-bottom: 24px;
    font-size: 14px;
  }
  .prose p {
    font-size: 16px;
    line-height: 1.6;
  }
  .prose h2 {
    font-size: 20px;
    margin: 24px 0 8px 0;
  }
  .prose pre {
    padding: 10px 12px;
    margin: 16px 0;
  }
  .prose code {
    font-size: 12.5px;
  }
  .cv-title {
    font-size: 18px;
    margin-bottom: 12px;
  }
  .cv-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .cv-role {
    font-size: 14px;
  }
  .cv-date {
    font-size: 12px;
  }
  .cv-org {
    font-size: 12.5px;
    margin-bottom: 4px;
  }
  .cv-desc {
    font-size: 13px;
  }
  .projects-grid {
    gap: 16px;
    margin-top: 24px;
  }
  .project-card {
    padding: 16px;
  }
  .project-title {
    font-size: 18px;
  }
  .project-desc {
    font-size: 14px;
  }
  .tab-button {
    padding: 6px 12px;
    font-size: 13.5px;
  }
  .showcase-card {
    padding: 16px;
  }
  .showcase-title {
    font-size: 16px;
  }
  .showcase-desc {
    font-size: 13.5px;
  }
  .roadmap-step {
    gap: 12px;
  }
  .roadmap-icon {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
  .roadmap-flow::before {
    left: 14px;
  }
  .roadmap-title {
    font-size: 14.5px;
  }
  .roadmap-desc {
    font-size: 13px;
  }
  footer {
    padding-top: 32px;
  }
}
