* {
  box-sizing: border-box;
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
  background-color: #0d1117;
  color: #e6edf3;
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
  scroll-padding-top: 80px;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #161b22;
  padding: 1rem 2rem;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: padding 0.3s, background-color 0.3s;
}

.navbar.shrink {
  padding: 0.5rem 2rem;
  background-color: #0d1117;
}

/* Center content inside navbar (name + email) */
.nav-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  transition: transform 0.3s ease;
}

/* Move content up slightly when navbar shrinks */
.navbar.shrink .nav-center {
  transform: translate(-50%, -60%);
}

.nav-name {
  color: #58a6ff;
  font-size: 1.25rem;
  margin: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.nav-email {
  font-size: 0.9rem;
  color: #8b949e;
  text-decoration: none;
  margin-top: 0.25rem;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.navbar.shrink .nav-email {
  transform: translateY(-10px);
}

.nav-email:hover {
  color: #58a6ff;
  text-decoration: underline;
}

/* Navbar right links */
.nav-links-right {
  margin-left: auto;
  display: flex;
  gap: 1rem;
}

.nav-links-right a {
  color: #e6edf3;
  text-decoration: none;
  font-weight: 500;
}

.nav-links-right a:hover {
  color: #58a6ff;
}

#theme-toggle {
  background: #21262d;
  border: none;
  color: #fff;
  border-radius: 20px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

/* Sections */
.section {
  max-width: 900px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.section:first-of-type {
  margin-top: 8rem;
}

.section h2 {
  border-bottom: 2px solid #58a6ff;
  padding-bottom: 0.3rem;
  color: #58a6ff;
}

.job h3 {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.15rem;
  margin-bottom: 0.3rem;
  color: #e6edf3;
  font-weight: 600;
}

.job h3 .meta {
  font-size: 1.15rem;
  color: #8b949e;
  font-weight: 400;
  margin-left: 0.5rem;
}

.section h4 {
  margin-top: 1.5rem;
  color: #79c0ff;
  font-size: 1rem;
  letter-spacing: 0.5px;
  border-left: 4px solid #58a6ff;
  padding-left: 0.6rem;
  text-transform: uppercase;
  font-weight: 600;
}

/* Projects */
.project {
  border: 1px solid #333;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  background: #111;
}

.project-header {
  width: 100%;
  background: #222;
  border: none;
  color: #e6edf3;
  text-align: left;
  font-size: 1.1rem;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
}

.project-content {
  max-height: 0;
  overflow: hidden;
  transition: all 0.4s ease;
  padding: 0 1rem;
}

.project-content.open {
  max-height: 70vh;
  overflow-y: auto;
  padding: 1rem;
}

/* Code sample */
.code-sample {
  margin-top: 1.5em;
  border: 1px solid #333;
  border-radius: 8px;
  background: #111;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: #222;
  padding: 0.5em 1em;
}

.toggle-code {
  background: #333;
  color: #fff;
  border: none;
  padding: 0.6em 1em;
  cursor: pointer;
  border-radius: 6px;
  font-weight: bold;
}

.toggle-code:hover {
  background: #444;
}

.code-container {
  display: none;
  max-height: 80vh;
  overflow-y: auto;
  background: #0a0a0a;
  color: #eee;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  padding: 1em;
  border-top: 1px solid #333;
  line-height: 1.4;
}

/* Floating hide button */
.floating-hide {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 10000;
  padding: 0.6em 1.2em;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  display: none;
  opacity: 0.95;
  transition: opacity 0.8s ease;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.floating-hide:hover {
  background: #333;
}

.floating-hide.fade-out {
  opacity: 0;
  pointer-events: none;
}

body.light-mode .floating-hide {
  background: #ddd;
  color: #111;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  background-color: #161b22;
  color: #8b949e;
  font-size: 0.9rem;
}

/* Light mode */
body.light-mode {
  background-color: #f6f8fa;
  color: #111;
}

body.light-mode .navbar {
  background-color: #fff;
}

body.light-mode .navbar a {
  color: #111;
}

body.light-mode .navbar a:hover {
  color: #0366d6;
}

body.light-mode .section h2 {
  color: #0366d6;
  border-color: #0366d6;
}

body.light-mode .code-sample {
  background-color: #f6f8fa;
}

body.light-mode .code-container {
  background-color: #fff;
  color: #111;
}

body.light-mode .toggle-code {
  background: #ddd;
  color: #111;
}

body.light-mode .job h3 {
  color: #111;
}

body.light-mode .job h3 .meta {
  color: #555;
}

body.light-mode .section h4 {
  color: #0366d6;
  border-left-color: #0366d6;
}


/* Portrait monitor fix / medium-width screens */
@media (max-width: 1000px) and (min-width: 701px) {

  .navbar {
    padding: 0.8rem 1rem;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .nav-center {
    position: static;
    transform: none;
    margin: 0 auto 0.5rem auto;
    text-align: center;
    width: 100%;
  }

  .nav-links-right {
    margin-left: 0;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 0.8rem 1.2rem;
  }

  .nav-links-right a {
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
  }

  #theme-toggle {
    padding: 0.3rem 0.7rem;
    font-size: 0.9rem;
  }
}




/* --- Mobile --- */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

body.light-mode .menu-toggle {
  color: #111;
}

@media (max-width: 700px) {
  .navbar {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.8rem 1rem 1rem;
  }

  .nav-center {
    position: static;
    transform: none;
    text-align: center;
    margin-bottom: 0.5rem;
    max-width: 100%;
    word-wrap: break-word;
  }

  .nav-name {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    color: #58a6ff;
    margin: 0;
  }

  .nav-email {
    font-size: 0.85rem;
    color: #8b949e;
    margin-top: 0.25rem;
    display: block;
    word-break: break-word;
  }

  .menu-toggle {
    display: block;
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.8rem;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 1100;
  }

  .menu-toggle:active {
    transform: scale(0.9);
  }

  .nav-links-right {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: center;
    background-color: #161b22;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .nav-links-right.show {
    max-height: 500px;
    opacity: 1;
    visibility: visible;
    padding: 1rem 0;
  }

  .nav-links-right a {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.75rem 0;
    font-size: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-links-right a:hover {
    background: rgba(88, 166, 255, 0.1);
  }

  .code-container {
    max-height: 70vh;
    font-size: 0.9rem;
  }

  .floating-hide {
    bottom: 15px;
    left: 15px;
    font-size: 0.9rem;
    padding: 0.5em 1em;
  }

  body.light-mode .nav-links-right {
    background-color: #fff;
  }

  body.light-mode .nav-links-right a {
    color: #111;
    border-top-color: rgba(0, 0, 0, 0.1);
  }

  body.light-mode .nav-links-right a:hover {
    background: rgba(3, 102, 214, 0.1);
  }

  body {
    scroll-padding-top: 130px;
  }
  
  .section:first-of-type {
    margin-top: 9rem; /* ensure first section clears navbar fully */
  }
}

@media (max-width: 400px) {
  .navbar.shrink .nav-center {
    transform: translate(-50%, -65%);
  }
}
