:root {
  --background-color: #ffffff;
  --text-color: #333333;
  --text-muted: #666666;
  --link-color: #007bff;
  --link-hover-color: #0056b3;
  --border-color: #e5e5e5;
  --sidebar-width: 260px;
  --max-width: 1100px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-size-base: 16px;
  --line-height-base: 1.65;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--text-color);
  background-color: var(--background-color);
  -webkit-font-smoothing: antialiased;
}

/* Scroll offset for anchor links */
section[id],
div[id] {
  scroll-margin-top: 2em;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
  color: var(--link-hover-color);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.25;
}

h1 {
  font-size: 2em;
  margin-top: 0;
}

h2 {
  font-size: 1.4em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3em;
}

h3 {
  font-size: 1.15em;
}

p {
  margin-bottom: 1em;
}

ul, ol {
  margin-bottom: 1em;
  padding-left: 2em;
}

li {
  margin-bottom: 0.3em;
}

code {
  background-color: #f5f5f5;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2em 0;
}

/* ================================================================
   Layout: Two-column flex with sticky sidebar
   ================================================================ */
.page-wrapper {
  display: flex;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5em 1.5em;
  gap: 3.5em;
}

/* ================================================================
   Sidebar (sticky)
   ================================================================ */
.sidebar {
  flex: 0 0 var(--sidebar-width);
  min-width: var(--sidebar-width);
  position: sticky;
  top: 2em;
  align-self: flex-start;   /* critical for sticky to work inside flex */
  max-height: calc(100vh - 4em);
  overflow-y: auto;
}

.profile {
  text-align: center;
}

.profile-image {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1em;
  border: 1px solid var(--border-color);
}

.profile-name {
  font-size: 1.4em;
  font-weight: bold;
  margin-bottom: 0.2em;
  margin-top: 0;
}

.profile-role {
  color: var(--text-muted);
  font-size: 0.88em;
  margin-bottom: 1.2em;
}

.profile-bio {
  font-size: 0.85em;
  color: var(--text-muted);
  text-align: left;
  margin-bottom: 1.5em;
}

/* Contact / social links */
.profile-links {
  list-style: none;
  padding: 0;
  margin: 0 0 1.8em 0;
  text-align: left;
}

.profile-links li {
  margin-bottom: 0.45em;
  font-size: 0.88em;
  display: flex;
  align-items: center;
}

.profile-links li span.icon {
  margin-right: 8px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.profile-links a {
  color: var(--text-color);
}

.profile-links a:hover {
  text-decoration: underline;
  color: var(--link-color);
}

/* ================================================================
   Section navigation in the sidebar
   ================================================================ */
.sidebar-nav {
  border-top: 1px solid var(--border-color);
  padding-top: 1em;
  margin-bottom: 1.5em;
}

.sidebar-nav-title {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.6em;
  font-weight: 600;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin-bottom: 0.3em;
}

.sidebar-nav a {
  display: block;
  padding: 0.3em 0.5em;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover {
  background-color: #f5f5f5;
  color: var(--text-color);
  text-decoration: none;
}

/* ================================================================
   Main Content
   ================================================================ */
.main-content {
  flex: 1;
  min-width: 0;
}

/* Page header / About */
.page-header {
  margin-bottom: 2.5em;
}

.page-header p.lead {
  font-size: 1.15em;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Sections */
.section {
  margin-bottom: 3em;
}

/* Experience entry */
.experience-item {
  margin-bottom: 1.8em;
}

.experience-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 0.4em;
}

.experience-title {
  font-size: 1.05em;
  font-weight: 600;
  margin: 0;
}

.experience-meta {
  color: var(--text-muted);
  font-size: 0.88em;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  margin-top: 0.4em;
}

.tag {
  background-color: #f1f1f1;
  color: var(--text-color);
  padding: 0.15em 0.55em;
  border-radius: 4px;
  font-size: 0.78em;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2em;
  margin-bottom: 1.5em;
}

.stat-item {
  background-color: #fafafa;
  padding: 1.2em;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-align: center;
}

.stat-value {
  font-size: 1.8em;
  font-weight: bold;
  color: var(--text-color);
  line-height: 1;
  margin-bottom: 0.25em;
}

.stat-label {
  font-size: 0.82em;
  color: var(--text-muted);
}

/* ================================================================
   Footer
   ================================================================ */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 2em 0;
  text-align: center;
  font-size: 0.85em;
  color: var(--text-muted);
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 768px) {
  .page-wrapper {
    flex-direction: column;
    padding: 1.5em;
    gap: 2em;
  }

  .sidebar {
    flex: auto;
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5em;
  }

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

  .profile-bio {
    text-align: center;
  }

  .profile-links {
    text-align: center;
  }

  .profile-links li {
    justify-content: center;
  }

  .sidebar-nav a {
    text-align: center;
  }

  .experience-header {
    flex-direction: column;
  }

  .experience-meta {
    margin-top: 0.15em;
  }

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