/* ===================================================================
   Git-Themed Portfolio — style.css
   sourabhmishra.in
   =================================================================== */

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

/* --- CSS Custom Properties --- */
:root {
  /* Dark mode (default) */
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2129;
  --border: #30363d;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent-green: #3fb950;
  --accent-red: #f85149;
  --accent-blue: #58a6ff;
  --accent-purple: #bc8cff;
  --accent-orange: #d29922;
  --badge-bg: rgba(56,139,253,0.15);
  --badge-border: rgba(56,139,253,0.4);
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);

  /* Typography */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.563rem;
  --text-3xl: 1.953rem;
  --text-4xl: 2.441rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --max-width: 1200px;
  --header-height: 56px;
  --footer-height: 32px;
  --radius: 6px;
  --radius-lg: 8px;
}

[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface-hover: #eef1f5;
  --border: #d0d7de;
  --text: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #8b949e;
  --accent-green: #1a7f37;
  --accent-red: #cf222e;
  --accent-blue: #0969da;
  --accent-purple: #8250df;
  --accent-orange: #9a6700;
  --badge-bg: rgba(9,105,218,0.1);
  --badge-border: rgba(9,105,218,0.3);
  --shadow: 0 1px 3px rgba(31,35,40,0.12);
  --shadow-lg: 0 8px 24px rgba(31,35,40,0.15);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Header / Top Bar --- */
.site-header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.repo-path {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.repo-path .separator {
  color: var(--text-muted);
  margin: 0 var(--space-xs);
}
.repo-path .current-page {
  color: var(--accent-blue);
}

/* Nav tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
}

.nav-tabs a {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.nav-tabs a:hover {
  color: var(--text);
  text-decoration: none;
}
.nav-tabs a.active {
  color: var(--text);
  border-bottom-color: var(--accent-orange);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: var(--text-base);
  text-decoration: none;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
  text-decoration: none;
}

/* Mobile hamburger */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  padding: var(--space-xs);
}

/* --- Main Content --- */
.site-main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

/* --- Footer / Status Bar --- */
.site-footer {
  height: var(--footer-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.footer-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-branch {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.footer-branch .branch-icon {
  color: var(--accent-green);
}

/* --- Page Header --- */
.page-header {
  margin-bottom: var(--space-2xl);
}
.page-header h1 {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}
.page-header p {
  color: var(--text-secondary);
  font-size: var(--text-lg);
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* --- Badges / Pills --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-green {
  color: var(--accent-green);
  background: rgba(63,185,80,0.12);
  border-color: rgba(63,185,80,0.4);
}
.badge-purple {
  color: var(--accent-purple);
  background: rgba(188,140,255,0.12);
  border-color: rgba(188,140,255,0.4);
}
.badge-blue {
  color: var(--accent-blue);
  background: var(--badge-bg);
  border-color: var(--badge-border);
}
.badge-orange {
  color: var(--accent-orange);
  background: rgba(210,153,34,0.12);
  border-color: rgba(210,153,34,0.4);
}

.tag-pill {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  background: var(--badge-bg);
  color: var(--accent-blue);
  border-radius: 999px;
  border: 1px solid var(--badge-border);
}

/* --- README Card (Home) --- */
.readme-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.readme-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.readme-header .file-icon {
  color: var(--text-muted);
}
.readme-body {
  padding: var(--space-xl);
}
.readme-body h1 {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: 700;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}
.readme-body h2 {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 600;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}
.readme-body p {
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.7;
  margin-bottom: var(--space-md);
}
.readme-body .badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.readme-body .toc-list {
  list-style: none;
  padding: 0;
}
.readme-body .toc-list li {
  padding: var(--space-xs) 0;
}
.readme-body .toc-list a {
  font-size: var(--text-base);
}
.readme-body .toc-list a::before {
  content: "→ ";
  color: var(--text-muted);
}

/* --- Pinned Repos Section --- */
.section-heading {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.section-heading .icon {
  color: var(--text-muted);
}

.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.repo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.repo-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.repo-card-name {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--accent-blue);
}
.repo-card-name a {
  color: inherit;
}
.repo-card-desc {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  flex: 1;
}
.repo-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.lang-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: var(--space-xs);
  vertical-align: middle;
}
.repo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

/* --- Commit Timeline (About) --- */
.commit-timeline {
  position: relative;
  padding-left: 2.5rem;
}
.commit-timeline::before {
  content: '';
  position: absolute;
  left: 0.65rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--border);
}

.commit-entry {
  position: relative;
  margin-bottom: var(--space-xl);
}
.commit-dot {
  position: absolute;
  left: -2.15rem;
  top: 0.35rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-green);
  border: 2px solid var(--bg);
  z-index: 1;
}
.commit-hash {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent-blue);
  margin-bottom: var(--space-xs);
}
.commit-title {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-xs);
}
.commit-company {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}
.commit-period {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}
.commit-desc {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.7;
}

/* --- Skills (diff stat style) --- */
.skills-section {
  margin-top: var(--space-2xl);
}
.skill-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
.skill-name {
  min-width: 120px;
  color: var(--text);
  font-weight: 500;
}
.skill-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.skill-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease;
}
.skill-pct {
  min-width: 3rem;
  text-align: right;
  color: var(--text-secondary);
}

/* --- Blog / PR List --- */
.pr-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pr-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-lg);
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--surface);
  transition: background 0.2s;
}
.pr-item:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.pr-item:last-child {
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.pr-item:only-child {
  border-radius: var(--radius-lg);
  border-bottom: 1px solid var(--border);
}
.pr-item:hover {
  background: var(--surface-hover);
}

.pr-icon {
  flex-shrink: 0;
  margin-top: 2px;
}
.pr-icon svg {
  width: 20px;
  height: 20px;
}
.pr-icon.merged svg {
  fill: var(--accent-purple);
}
.pr-icon.open svg {
  fill: var(--accent-green);
}

.pr-body {
  flex: 1;
  min-width: 0;
}
.pr-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.pr-title a {
  color: var(--text);
}
.pr-title a:hover {
  color: var(--accent-blue);
  text-decoration: none;
}
.pr-meta {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}
.pr-number {
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.pr-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}
.pr-preview {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  line-height: 1.6;
}

/* --- Blog Post Detail --- */
.post-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}
.post-header h1 {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-md);
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.post-content {
  max-width: 48rem;
  line-height: 1.8;
}
.post-content h2 {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 600;
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}
.post-content h3 {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 600;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}
.post-content p {
  margin-bottom: var(--space-md);
}
.post-content ul, .post-content ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-xl);
}
.post-content li {
  margin-bottom: var(--space-xs);
}
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.15em 0.4em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.post-content pre {
  margin-bottom: var(--space-md);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}
.post-content pre code {
  display: block;
  padding: var(--space-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  line-height: 1.5;
}
.post-content blockquote {
  border-left: 3px solid var(--accent-blue);
  padding: var(--space-sm) var(--space-lg);
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.post-content img {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.post-content a {
  color: var(--accent-blue);
  text-decoration: underline;
}

/* Syntax highlighting wrapper */
.post-content .highlight {
  margin-bottom: var(--space-md);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  border: 1px solid var(--border);
}
.post-content .highlight pre {
  margin-bottom: 0;
  border: none;
}
.post-content .highlight pre code {
  border: none;
}

/* --- Projects Page --- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.project-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.project-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.project-card-header .repo-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}
.project-card-name {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 600;
}
.project-card-name a {
  color: var(--accent-blue);
}
.project-card-desc {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  flex: 1;
}
.project-card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--space-sm);
}

/* --- Contribution Graph (decorative) --- */
.contrib-graph {
  margin: var(--space-2xl) 0;
}
.contrib-grid {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: var(--space-sm);
}
.contrib-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.contrib-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.contrib-cell.l1 { background: rgba(63,185,80,0.2); border-color: transparent; }
.contrib-cell.l2 { background: rgba(63,185,80,0.4); border-color: transparent; }
.contrib-cell.l3 { background: rgba(63,185,80,0.6); border-color: transparent; }
.contrib-cell.l4 { background: var(--accent-green); border-color: transparent; }

[data-theme="light"] .contrib-cell.l1 { background: rgba(26,127,55,0.15); }
[data-theme="light"] .contrib-cell.l2 { background: rgba(26,127,55,0.3); }
[data-theme="light"] .contrib-cell.l3 { background: rgba(26,127,55,0.5); }
[data-theme="light"] .contrib-cell.l4 { background: var(--accent-green); }

/* --- Fade-in Animation --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in {
  animation: fadeIn 0.4s ease both;
}
.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }

/* --- Profile Section (About) --- */
.profile-section {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--border);
}
.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--accent-green);
}
.profile-info h1 {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}
.profile-info .role {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}
.profile-info .bio {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.7;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-secondary);
}
.empty-state p {
  font-size: var(--text-lg);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .site-header {
    padding: 0 var(--space-md);
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .nav-tabs {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--space-sm) 0;
    z-index: 99;
  }
  .nav-tabs.open {
    display: flex;
  }
  .nav-tabs a {
    padding: var(--space-sm) var(--space-lg);
    border-bottom: none;
    border-left: 2px solid transparent;
  }
  .nav-tabs a.active {
    border-bottom: none;
    border-left-color: var(--accent-orange);
  }

  .mobile-toggle {
    display: block;
  }

  .site-main {
    padding: var(--space-lg) var(--space-md);
  }

  .repo-grid,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .profile-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .readme-body h1 {
    font-size: var(--text-2xl);
  }

  .footer-inner .footer-center {
    display: none;
  }

  .pr-item {
    flex-direction: column;
    gap: var(--space-sm);
  }
}

@media (max-width: 480px) {
  .header-actions {
    gap: var(--space-xs);
  }
  .repo-path .current-page {
    display: none;
  }
  .repo-path .separator {
    display: none;
  }
}
