*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f2f1ed; /* Beautiful warm grey-stone tone, very calming and premium */
  --surface: #ffffff; /* Crisp white for cards/sections to layer on top */
  --text: #1c1c1a; /* Rich soft warm charcoal */
  --muted: #5e5e58; /* Clearer, high-contrast muted color for high readability */
  --faint: #e6e5dd; /* Softer, darker warm-grey for badges & accordions */
  --tag-bg: #eae8de; /* Slightly more defined warm paper tags */
  --tag-text: #3c3c38;
  --border: #d4d2c8; /* Warmer, softer border lines for elegant division */
  --accent: #1e6b24; /* Deeper, richer forest green with higher contrast */
  --accent-glow: rgba(30, 107, 36, 0.08);
  --mono: 'Geist Mono', monospace;
  --serif: 'Instrument Serif', serif;
  --gh-0: #dedcd5; --gh-1: #9be9a8; --gh-2: #40c463; --gh-3: #30a14e; --gh-4: #216e39;
  --nav-bg: rgba(242, 241, 237, 0.85);
}
:root.dark {
  --bg: #0d0d0c;
  --surface: #141413;
  --text: #eceae1;
  --muted: #8a8a83;
  --faint: #1a1a18;
  --tag-bg: #1a1a19;
  --tag-text: #c5c1b5;
  --border: #242422;
  --accent: #39d353;
  --accent-glow: rgba(57, 211, 83, 0.12);
  --gh-0: #242422; --gh-1: #0e4429; --gh-2: #006d32; --gh-3: #26a641; --gh-4: #39d353;
  --nav-bg: rgba(13, 13, 12, 0.85);
}

html {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--text);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}
body {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 28px 100px;
  position: relative;
}

/* Seamless color transitions when theme changes */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition: background-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  transition-property: background-color, border-color, color, fill, stroke, box-shadow !important;
}

/* Scroll Progress Bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  background: var(--accent);
  width: 0%;
  z-index: 1000;
}

/* IntersectionObserver reveal anims */
.reveal-section {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1), transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Navigation styling */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 0 0;
  margin-bottom: 80px;
  font-size: 13px;
}
.nav-logo { font-weight: 500; color: var(--text); letter-spacing: -0.02em; font-size: 14px; }
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a { color: var(--muted); text-decoration: none; transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }
.nav-links a.nav-resume {
  color: var(--text);
  border: 0.5px solid var(--border);
  padding: 4px 10px;
  border-radius: 4px;
}
.nav-links a.nav-resume:hover {
  background: var(--faint);
  border-color: var(--text);
}

/* Theme Switcher Button */
.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, background-color 0.15s, transform 0.25s;
}
.theme-toggle-btn:hover {
  color: var(--text);
  background-color: var(--faint);
  transform: scale(1.08);
}
.theme-toggle-btn svg {
  width: 14px;
  height: 14px;
  display: none;
  stroke: currentColor;
}
:root:not(.dark) .moon-icon { display: block; }
:root.dark .sun-icon { display: block; }

.hero { margin-bottom: 80px; }
.hero-greeting { font-size: 13px; color: var(--muted); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.hero-greeting::before { content: ''; display: inline-block; width: 24px; height: 1px; background: var(--muted); }
.hero-name { font-family: var(--serif); font-size: 58px; line-height: 1.04; letter-spacing: -0.03em; margin-bottom: 16px; color: var(--text); }
.hero-name em { font-style: italic; }
.counter { font-size: 11px; color: var(--muted); margin-bottom: 24px; letter-spacing: 0.05em; }
.hero-tagline { font-size: 13px; color: var(--muted); line-height: 1.75; max-width: 480px; margin-bottom: 32px; }
.hero-tagline strong { color: var(--text); font-weight: 500; }
.hero-links { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-decoration: none; border: 0.5px solid var(--border); border-radius: 20px; padding: 5px 14px; transition: all 0.15s; }
.hero-link:hover { color: var(--text); border-color: var(--text); background: var(--faint); transform: translateY(-1px); }
.link-icon { width: 13px; height: 13px; flex-shrink: 0; }

section { margin-bottom: 68px; }
.section-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 28px; display: flex; align-items: center; gap: 14px; }
.section-label::after { content: ''; flex: 1; height: 0.5px; background: var(--border); }

.about-text { font-size: 14px; line-height: 1.85; color: var(--muted); }
.about-text strong { color: var(--text); font-weight: 500; }

/* Interactive Skill Tags */
.skills-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tag {
  font-size: 12px;
  padding: 5px 13px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 4px;
  border: 0.5px solid var(--border);
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  user-select: none;
}
.skill-tag:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  transform: translateY(-1px);
}
.skill-tag.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Interactive Cross-Highlight rules */
.timeline-item, .project-item {
  transition: opacity 0.35s ease, filter 0.35s ease, border-color 0.35s ease;
}
.timeline-item.dimmed, .project-item.dimmed {
  opacity: 0.22;
  filter: blur(0.5px);
}
.timeline-item.highlighted, .project-item.highlighted {
  opacity: 1;
  border-color: var(--accent) !important;
}

/* Text Highlight Matching */
.highlight-inline {
  transition: all 0.3s ease;
}
.highlighted .highlight-inline.active-highlight {
  color: var(--text) !important;
  background: var(--accent-glow);
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 500;
}

/* GitHub Graph — no scrollbar, scales to fit */
.gh-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 6px; }
.gh-username { font-size: 12px; color: var(--muted); }
.gh-username a { color: var(--text); text-decoration: none; border-bottom: 0.5px solid var(--border); }
.gh-total { font-size: 12px; color: var(--muted); }
.gh-outer { width: 100%; position: relative; }
.gh-months-row { display: flex; margin-bottom: 4px; }
.gh-months-row span { font-size: 10px; color: var(--muted); flex: 1; }
.gh-graph { display: flex; gap: 2px; width: 100%; }
.gh-week { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.gh-day { border-radius: 2px; background: var(--gh-0); cursor: pointer; aspect-ratio: 1; width: 100%; transition: transform 0.1s ease; }
.gh-day:hover { transform: scale(1.2); }
.gh-day[data-level="1"] { background: var(--gh-1); }
.gh-day[data-level="2"] { background: var(--gh-2); }
.gh-day[data-level="3"] { background: var(--gh-3); }
.gh-day[data-level="4"] { background: var(--gh-4); }
.gh-legend { display: flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 11px; color: var(--muted); justify-content: flex-end; }
.gh-legend-box { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: grid; grid-template-columns: 150px 1fr; gap: 0 28px; padding: 22px 0; border-bottom: 0.5px solid var(--border); }
.timeline-item:first-child { border-top: 0.5px solid var(--border); }
.timeline-date { font-size: 11px; color: var(--muted); padding-top: 2px; }
.timeline-company { font-size: 12px; color: var(--muted); margin-top: 5px; }
.timeline-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.timeline-role { font-size: 14px; font-weight: 500; color: var(--text); }
.timeline-expand-btn { background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: color 0.15s, background-color 0.15s; }
.timeline-expand-btn:hover { color: var(--text); background-color: var(--faint); }
.timeline-expand-btn.is-active svg { transform: rotate(180deg); }
.timeline-expand-btn svg { width: 12px; height: 12px; transition: transform 0.25s; stroke: currentColor; display: block; }
.timeline-bullets-container { overflow: hidden; transition: max-height 0.35s cubic-bezier(0.25, 0.8, 0.25, 1); }
.timeline-bullets { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.timeline-bullets li { font-size: 12px; color: var(--muted); line-height: 1.6; list-style: none; padding-left: 12px; position: relative; }
.timeline-bullets li::before { content: '–'; position: absolute; left: 0; color: var(--muted); }

/* Expanded Projects CSS */
.projects-grid { display: flex; flex-direction: column; }
.project-item { padding: 22px 0; border-bottom: 0.5px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.project-item:first-child { border-top: 0.5px solid var(--border); }
.project-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.project-name { font-size: 14px; font-weight: 500; color: var(--text); }
.project-year { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.project-desc { font-size: 13px; color: var(--muted); line-height: 1.7; }

.project-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.project-tag {
  font-size: 11px;
  padding: 2px 9px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 3px;
  border: 0.5px solid var(--border);
  transition: all 0.15s ease;
  cursor: default;
}
.project-tag:hover {
  background: var(--faint);
  color: var(--text);
}

.project-links { display: flex; gap: 14px; margin-top: 6px; }
.project-link { font-size: 12px; color: var(--muted); text-decoration: none; transition: color 0.15s; }
.project-link:hover { color: var(--text); }

/* Project Accordion Deep Dive styling */
.project-expand-btn {
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  align-self: flex-start;
  transition: color 0.15s ease;
}
.project-expand-btn:hover {
  color: var(--text);
}
.project-expand-btn svg {
  width: 10px;
  height: 10px;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.project-expand-btn.is-active svg {
  transform: rotate(180deg);
}

.project-deep-dive {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.35s ease;
  opacity: 0;
}
.project-deep-dive.is-expanded {
  opacity: 1;
  margin-top: 10px;
  margin-bottom: 6px;
}
.deep-dive-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 16px;
  background: var(--faint);
  border-radius: 6px;
  border: 0.5px solid var(--border);
}
.deep-dive-col h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 8px;
}
.deep-dive-col p {
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}
.deep-dive-metrics {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}
.metric-badge {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  display: inline-flex;
  flex-direction: column;
  min-width: 80px;
}
.metric-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}
.metric-label {
  font-size: 8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.edu-grid { display: flex; flex-direction: column; }
.edu-item { padding: 20px 0; border-bottom: 0.5px solid var(--border); display: grid; grid-template-columns: 150px 1fr; gap: 0 28px; }
.edu-item:first-child { border-top: 0.5px solid var(--border); }
.edu-year { font-size: 11px; color: var(--muted); padding-top: 2px; }
.edu-degree { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 5px; }
.edu-school { font-size: 13px; color: var(--muted); }

.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 24px;
  padding: 22px 0;
  border-bottom: 0.5px solid var(--border);
  border-top: 0.5px solid var(--border);
}
.service-item h4 {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.service-item p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.contact-block { padding: 40px 32px; border: 0.5px solid var(--border); border-radius: 10px; text-align: center; background: var(--surface); }
.contact-initials { width: 56px; height: 56px; border-radius: 50%; background: var(--faint); color: var(--text); display: flex; align-items: center; justify-content: center; font-size: 18px; font-family: var(--serif); font-style: italic; margin: 0 auto 18px; border: 0.5px solid var(--border); }
.contact-block h3 { font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.contact-block p { font-size: 13px; color: var(--muted); margin-bottom: 22px; line-height: 1.7; }
.contact-email { display: inline-block; font-size: 13px; color: var(--text); text-decoration: none; border-bottom: 0.5px solid var(--border); padding-bottom: 2px; transition: border-color 0.15s; }
.contact-email:hover { border-color: var(--text); }

footer { padding-top: 52px; border-top: 0.5px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; font-size: 12px; color: var(--muted); flex-wrap: wrap; gap: 18px; }
.footer-left p { margin-bottom: 4px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }

/* Back to Top Button */
.back-to-top-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 99;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 0.5px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.9);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s, color 0.15s, border-color 0.15s;
}
.back-to-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.back-to-top-btn:hover {
  color: var(--text);
  background: var(--faint);
  border-color: var(--text);
  transform: translateY(-2px) scale(1.05);
}
.back-to-top-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}
.back-to-top-btn:hover svg {
  transform: translateY(-2px);
}

@media (max-width: 520px) {
  .hero-name { font-size: 40px; }
  nav { margin-bottom: 52px; }
  .timeline-item, .edu-item { grid-template-columns: 1fr; gap: 6px; }
  .deep-dive-grid { grid-template-columns: 1fr; gap: 14px; }
  .services-grid { grid-template-columns: 1fr; gap: 20px; }
  .back-to-top-btn { bottom: 20px; right: 20px; width: 36px; height: 36px; }
}
