*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #0d1117;
  color: #e6edf3;
  font-family: 'Segoe UI', sans-serif;
  overflow-y: hidden;
  overflow-x: hidden;
  animation: allowScroll 1s forwards 1s;
}

#home {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  margin: 0;
}

#about {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  margin: 0;
  font-size: 1.5rem;
}

#projects {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  margin: 0;
}

h2 {
  font-size: 2rem;
  margin: 20px 0 5px;
}


.typed-line {
  font-size: 1.5rem;
  margin: 0 0 10px;
}

#navbar {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #161b22;
  padding: 15px 20px;
  border-bottom: 2px solid #30363d;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  font-size: 1.8rem;
  font-weight: bold;
  width: 100%;
  letter-spacing: 1px;
}

#navbar a {
  color: #fff;
  text-decoration: none;
}

#navbar a:hover {
  color: aqua;
  background-color: #555;
  border-radius: 5px;
}

#navbar a:active {
  color: #fff;
  background-color: rgba(0,255,255,0.137);
  border-radius: 5px;
}

/* brand (logo + text) */
#navbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 20px; 
}

#navbar .logo {
  height: 44px;
  width: 44px;
  border-radius: 50%;
  display: block;
}

/* links */
#navbar .nav-links {
  display: flex;
  gap: 16px;
}

#navbar .nav-links a {
  padding: 6px 10px;
}

#title {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    padding: 5px;
    color: rgb(255,255,255);
}

#title hr {
    width: 50%;
    margin: 20px auto;
    border: 2px solid #555;
}

#content {
    display: block;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: rgb(200,200,200);
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 8%;
  height: 100vh;
  background-color: #161b22;
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 2px 0 10px rgba(0,0,0,0.25);
  transition: width 0.3s ease, transform .25s ease;
  z-index: 999;
  border-right: 1px solid #30363d;
  will-change: width, transform;
}

#sidebarToggle img {
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: block;
}

#sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

#sidebar li {
  width: 100%;
}

#sidebar a {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  color: #e6edf3;
  text-decoration: none;
  transition: background 0.2s ease, color .2s ease;
}

#sidebar a:hover {
  background: #21262d;
  color: #58a6ff;
}

.sidebar-img {
  width: 24px;
  height: 24px;
  margin-right: 12px;
}

.sidebar-text {
  transition: opacity 0.3s;
}

#sidebar.collapsed {
  width: 60px;
}

#sidebar.collapsed .sidebar-text {
  opacity: 0;
  pointer-events: none;
}

#sidebarBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 998;
}

body.menu-open {
  overflow: hidden;
}

body.menu-open #sidebarBackdrop {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  #navbar {
    font-size: 1.03rem;
  }

  #navbar .brand {
    display: none;         
  }

  #navbar .nav-links {
    padding-left: 40px;
  }

  #navbar .nav-links a {
    padding: 8px 10px;
  }

  #sidebar {
    position: fixed;
    top: 12px;
    left: 12px;
    width: auto;
    height: auto;
    padding: 0;
    background-color: transparent !important;
    box-shadow: none !important;
    border-right: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform .25s ease, background-color .25s ease, width .25s ease, height .25s ease;
    z-index: 999;
  }

  #sidebar #sidebarToggle {
    display: block;
  }

  #sidebar .sidebar-text,
  #sidebar ul {
    display: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
  }

  #sidebar.open {
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    padding-top: 20px;
    background-color: #161b22 !important;
    box-shadow: 2px 0 10px rgba(0,0,0,.25) !important;
    border-right: 1px solid #30363d !important;
  }

  #sidebar.open .sidebar-text,
  #sidebar.open ul {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  #sidebar.collapsed {
    width: auto;
    height: auto;
    background-color: transparent !important;
    box-shadow: none !important;
    border-right: 0 !important;
  }

  #sidebar.collapsed .sidebar-text,
  #sidebar.collapsed ul {
    display: none;
    opacity: 0;
    pointer-events: none;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
}

@keyframes fadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(40px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes allowScroll {
  to {
    overflow-y: auto;
  }
}

#projects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
  animation: fadeSlideUp 0.8s ease-out 0.3s both;
  justify-items: center;
  align-items: start;
  overflow-x: hidden;
  margin-bottom: 20px;
}

#projects .mainProject {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  width: 80%;
  text-align: center;
  padding: 20px;
  margin: 20px auto;
}

#projects .mainProject img {
  margin: 10px auto;
  display: block;
  max-width: 80%;
  border-radius: 8px;
}

#projects .project {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 8px;
  width: 70%;
  padding: 20px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "title title"
    "lead lead"
    "img aside"
    "button button";
  gap: 16px 24px;
}

#projects .project h2 {
  grid-area: title;
  text-align: center;
  margin: 0 0 8px 0;
}

#projects .project .lead {
  grid-area: lead;
  text-align: center;
  margin: 0;
  opacity: 0.9;
}

#projects .project img {
  grid-area: img;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  justify-self: center;
}

#projects .project .aside {
  grid-area: aside;
  align-self: center;
  opacity: 0.9;
  text-align: center;
}

#projects .project a {
  grid-area: button;
  justify-self: center;
}

#projects a {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 15px;
  background: #238636;
  color: #fff;
  text-decoration: none;
  border-radius: 5px;
  transition: background 0.2s ease;
}

#projects a:hover {
  background: #2ea043;
}

#projects .project:nth-of-type(even) {
  grid-template-areas:
    "title title"
    "lead lead"
    "aside img"
    "button button";
}

#projects .project:nth-of-type(even) .aside {
  text-align: center;
}

@media (max-width: 768px) {
  #projects {
    grid-template-columns: 1fr;
  }
  #projects .project,
  #projects .project:nth-of-type(even) {
    width: 92%;
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "lead"
      "img"
      "aside"
      "button";
  }
  #projects .project img {
    justify-self: center;
    max-width: 100%;
  }
  #projects .project .aside,
  #projects .project:nth-of-type(even) .aside {
    text-align: center;
    margin-top: 8px;
  }
}

#footer {
  background: #161b22;
  text-align: center;
  font-size: 0.95rem;
  color: #8b949e;
  border-top: 1px solid #30363d;
  animation: fadeSlideUp 0.8s ease-out 0.3s both;
}
