/* ===========================
   CSS VARIABLES & RESET
   =========================== */
:root {
  --bg: #ffffff;
  --bg-secondary: #f4f4f4;
  --bg-card: #ffffff;
  --text: #323239;
  --text-secondary: #5a5a5a;
  --text-muted: #8a8a8a;
  --accent: #7b8fcc;
  --accent-hover: #6a7dba;
  --star-color: #ffd479;
  --border: #e0e0e0;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --code-bg: #f4f4f4;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-heading: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  --sidebar-width: 260px;
  --content-max: 900px;
}

[data-theme="dark"] {
  --bg: #1c1c20;
  --bg-secondary: #16161a;
  --bg-card: #25252b;
  --text: #ededf0;
  --text-secondary: #c0c0c8;
  --text-muted: #b0b0c0;
  --accent: #7b8fcc;
  --accent-hover: #6a7dba;
  --star-color: #ffd479;
  --border: #323239;
  --nav-bg: rgba(28, 28, 32, 0.92);
  --code-bg: #25252b;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  transition: background 0.3s, color 0.3s;
}

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

a:hover {
  color: var(--accent-hover);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text);
  line-height: 1.3;
}

h1 { font-size: 2.4rem; font-weight: 700; margin-bottom: 1rem; }
h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 1.5rem; }
h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

img {
  max-width: 100%;
}

/* ===========================
   LAYOUT
   =========================== */
.site-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg);
  z-index: 100;
  transition: background 0.3s;
}

.sidebar-header {
  margin-bottom: 2.5rem;
}

.sidebar-name {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 0.25rem;
}

.sidebar-name:hover {
  color: var(--accent);
}

.sidebar-tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.sidebar-nav {
  list-style: none;
  flex: 1;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.sidebar-nav a .nav-icon {
  font-size: 1.1rem;
  line-height: 1;
  width: 1.4rem;
  text-align: center;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--bg-secondary);
  color: var(--accent);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  color: var(--text-muted);
  transition: color 0.2s;
}

.sidebar-footer a:hover {
  color: var(--accent);
}

.sidebar-footer svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.theme-toggle:hover {
  color: var(--accent);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

/* ===========================
   MAIN CONTENT
   =========================== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 3rem 2.5rem;
}

.content-area {
  max-width: 1100px;
}

/* Full-width content for projects */
.content-area.full-width {
  max-width: 1100px;
}

/* ===========================
   MOBILE NAV
   =========================== */
.mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 0;
  padding: 0 1.25rem;
  z-index: 200;
}

.mobile-nav-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.mobile-theme-toggle {
  color: var(--text);
  margin-left: 0.25rem;
}

.mobile-nav-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  margin-left: auto;
}

.mobile-nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 199;
  padding: 2rem 1.5rem;
}

.mobile-menu.open {
  display: block;
}

.mobile-menu-nav {
  list-style: none;
}

.mobile-menu-nav li {
  margin-bottom: 0.5rem;
}

.mobile-menu-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.mobile-menu-nav a .nav-icon {
  font-size: 1.2rem;
  width: 1.5rem;
  text-align: center;
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a.active {
  color: var(--accent);
}

/* ===========================
   PAGE HERO
   =========================== */
.page-hero {
  margin-bottom: 3rem;
}

.page-hero h1 {
  font-size: 2.4rem;
  margin-bottom: 0.5rem;
}

.page-hero .subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* ===========================
   ABOUT PAGE
   =========================== */
.about-intro {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.about-intro strong {
  color: var(--text);
}

.highlight-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.highlight-box p {
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.skills-section {
  margin-top: 2.5rem;
}

.skills-section h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.skill-category h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.skill-category ul {
  list-style: none;
}

.skill-category ul li {
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 0.2rem 0;
}

/* ===========================
   EXPERIENCE PAGE
   =========================== */
.experience-list {
  list-style: none;
}

.experience-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.experience-item:last-child {
  border-bottom: none;
}

.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.exp-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.exp-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.exp-company {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.exp-company a {
  color: #e05555;
  transition: color 0.2s;
}

.exp-company a:hover {
  color: #f06e6e;
}

.exp-bullets {
  list-style: none;
  padding: 0;
}

.exp-bullets li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.exp-bullets li::before {
  content: '\2014';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ===========================
   PROJECTS PAGE
   =========================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

[data-theme="dark"] .project-card:hover {
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.project-card h3 {
  margin-bottom: 0;
}

.project-card h3 a {
  color: var(--accent);
}

.project-card h3 a:hover {
  color: var(--accent-hover);
}

.project-card p {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.project-tags span {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-radius: 4px;
  font-weight: 500;
  border: 1px solid var(--border);
}

.project-star {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--star-color);
  font-weight: 600;
}

.project-star svg {
  width: 16px;
  height: 16px;
  fill: var(--star-color);
  stroke: var(--star-color);
}

/* ===========================
   GITHUB CONTRIBUTION GRID
   =========================== */
.github-chart {
  margin: 0 auto 2.5rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: inline-block;
  text-align: center;
}

.github-chart-wrapper {
  text-align: center;
}

.github-chart-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-weight: 500;
}

.contrib-grid {
  display: inline-grid;
  grid-template-rows: auto repeat(7, 1fr);
  grid-auto-flow: column;
  gap: 3px;
}

.contrib-grid .month-label {
  grid-row: 1;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  padding-bottom: 4px;
}

.contrib-grid .day-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
}

.contrib-cell {
  width: 18px;
  height: 18px;
  border-radius: 2px;
  background: var(--bg-secondary);
  transition: outline 0.15s;
  position: relative;
}

.contrib-cell:hover {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.contrib-cell[data-level="1"] { background: rgba(57, 211, 83, 0.25); }
.contrib-cell[data-level="2"] { background: rgba(57, 211, 83, 0.5); }
.contrib-cell[data-level="3"] { background: rgba(57, 211, 83, 0.75); }
.contrib-cell[data-level="4"] { background: rgba(57, 211, 83, 1); }

.contrib-cell .tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  color: var(--text);
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

.contrib-cell:hover .tooltip {
  display: block;
}

.contrib-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 0.75rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.contrib-legend .swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* ===========================
   BLOG PAGE
   =========================== */
.blog-list {
  list-style: none;
}

.blog-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.blog-item:last-child {
  border-bottom: none;
}

.blog-item-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 0.25rem;
}

.blog-item h3 {
  margin-bottom: 0.25rem;
}

.blog-item h3 a {
  color: var(--text);
}

.blog-item h3 a:hover {
  color: var(--accent);
}

.blog-item p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.blog-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.blog-empty p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* ===========================
   CONTACT PAGE
   =========================== */
.contact-text {
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.contact-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-link-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.contact-link-item svg {
  width: 22px;
  height: 22px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.contact-link-item a {
  font-size: 1rem;
  font-weight: 500;
}

.contact-link-item span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===========================
   FOOTER
   =========================== */
.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 4.5rem 1.25rem 2rem;
    max-width: 100%;
  }

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

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

  .exp-header {
    flex-direction: column;
    gap: 0.15rem;
  }
}
