:root {
  --primary-color: #007bff;
  --secondary-color: #f8f8f8;
  --text-color-dark: #333;
  --text-color-medium: #555;
  --text-color-light: #666;
  --background-color-light: #fff;
  --background-color-grey: #f8f8f8;
  --shadow-light: 0 1px 8px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 12px 25px rgba(0, 0, 0, 0.2);
  --container-max-width: 1200px;
  --header-height: 70px;
  --transition-timing: 0.2s ease;
}

body.dark-mode {
  --primary-color: #64ffda;
  --secondary-color: #1a1a1a;
  --text-color-dark: #e6e6e6;
  --text-color-medium: #b2b2b2;
  --text-color-light: #999;
  --background-color-light: #2a2a2a;
  --background-color-grey: #1a1a1a;
  --shadow-light: 0 1px 8px rgba(255, 255, 255, 0.05);
  --shadow-medium: 0 4px 12px rgba(255, 255, 255, 0.08);
  --shadow-hover: 0 12px 25px rgba(255, 255, 255, 0.15);
}

body.dark-mode #theme-toggle img {
  filter: invert(1);
}

body {
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--background-color-grey);
  color: var(--text-color-dark);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
    "Segoe UI Symbol";
  line-height: 1.7;
  margin: 0;
  padding-top: var(--header-height);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

.container {
  margin: 0 auto;
  max-width: var(--container-max-width);
  padding: 0 10px;
}

.site-header {
  background-color: var(--background-color-light);
  box-shadow: var(--shadow-light);
  left: 0;
  padding: 15px 0;
  position: fixed;
  top: 0;
  transition: background-color var(--transition-timing),
    box-shadow var(--transition-timing);
  width: 100%;
  z-index: 1000;
}

.site-header .container {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 0;
  justify-content: space-between;
}

.site-nav {
  align-items: center;
  display: flex;
  flex-grow: 1;
  justify-content: center;
  margin: 0;
  padding: 0;
}

.site-nav ul {
  display: flex;
  flex-direction: row;
  gap: 30px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav li {
  margin: 0;
}

.site-nav a {
  color: var(--text-color-medium);
  font-size: 1.1em;
  font-weight: 500;
  padding: 5px 0;
  position: relative;
  text-decoration: none;
  transition: color var(--transition-timing), transform 0.2s ease;
  white-space: nowrap;
}

.site-nav a::after {
  background-color: var(--primary-color);
  bottom: 0;
  content: "";
  height: 2px;
  left: 0;
  position: absolute;
  transition: width var(--transition-timing);
  width: 0;
}

.site-nav a:hover,
.site-nav a:focus {
  color: var(--primary-color);
  transform: translateY(-2px);
}

.site-nav a:hover::after,
.site-nav a:focus::after {
  width: 100%;
}

.header-home-link {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  padding: 5px;
  text-decoration: none;
  transition: opacity var(--transition-timing);
}

.header-home-link img {
  display: block;
  height: 30px;
  object-fit: contain;
  width: 30px;
}

body.dark-mode .header-home-link img {
  filter: invert(1);
}

#theme-toggle {
  align-items: center;
  background: none;
  border: none;
  color: var(--text-color-medium);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  height: 30px;
  justify-content: center;
  margin-left: 0;
  padding: 5px;
  transition: color var(--transition-timing);
  width: 30px;
}

#theme-toggle:hover {
  color: var(--primary-color);
}

#theme-toggle img {
  height: 100%;
  object-fit: contain;
  transition: opacity var(--transition-timing);
  width: 100%;
}

#theme-toggle #sun-icon {
  display: none;
}

body.dark-mode #theme-toggle #moon-icon {
  display: none;
}

body.dark-mode #theme-toggle #sun-icon {
  display: inline-block;
}

.site-main section {
  padding: 100px 0;
}

.section-title {
  color: var(--text-color-dark);
  font-size: 3em;
  font-weight: 700;
  margin-bottom: 50px;
  position: relative;
  text-align: center;
}

.hero-section {
  align-items: center;
  background-color: var(--background-color-light);
  display: flex;
  padding: 120px 0;
}

.hero-section .container {
  align-items: center;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  text-align: left;
}

.hero-content {
  margin-bottom: 0;
  max-width: 60%;
  padding-right: 50px;
}

.hero-content .greeting {
  color: var(--text-color-medium);
  font-size: 3em;
  font-weight: 500;
  margin-bottom: 15px;
}

.hero-content .tagline {
  color: var(--text-color-dark);
  font-size: 2em;
  font-weight: 600;
  margin-bottom: 25px;
}

.hero-content .email {
  color: var(--text-color-medium);
  font-size: 1.2em;
  font-weight: 500;
  margin-top: 20px;
}

.hero-content .email a {
  color: var(--primary-color);
  text-decoration: underline;
  transition: color var(--transition-timing);
}

.hero-content .email a:hover {
  color: var(--primary-color);
}

.hero-image {
  position: relative;
  flex-shrink: 0;
  margin-left: 50px;
}

.hero-image img {
  border: 6px solid var(--background-color-light);
  border-radius: 50%;
  box-shadow: var(--shadow-hover);
  display: block;
  height: auto;
  max-width: 300px;
}

.btn {
  border-color: var(--primary-color);
  border-radius: 5px;
  border-style: solid;
  border-width: 2px;
  cursor: pointer;
  display: inline-block;
  font-size: 1em;
  font-weight: 600;
  padding: 12px 25px;
  text-align: center;
  text-decoration: none;
  transition: background-color var(--transition-timing),
    color var(--transition-timing), border-color var(--transition-timing);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--background-color-light);
}

.btn-primary:hover {
  background-color: transparent;
  color: var(--primary-color);
}

.project-buttons {
  display: grid;
  grid-template-columns: auto auto;
  gap: 10px;
  width: fit-content;
}

.btn-secondary {
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  display: inline-block;
  margin-right: 10px;
}

.btn-secondary:hover {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.btn-secondary-social {
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  padding: 8px 15px;
}

.btn-secondary-social:hover {
  background-color: var(--primary-color);
  color: var(--background-color-light);
}

.background-section {
  background-color: var(--background-color-light);
}

.background-section .background-text {
  margin: 0 auto;
  max-width: 1200px;
  text-align: justify;
}

.background-section .background-text p {
  color: var(--text-color-medium);
  font-size: 1.1em;
  margin-bottom: 20px;
}

.background-section .background-text p:last-child {
  margin-bottom: 0;
}

.skills-section {
  background-color: var(--background-color-grey);
}

.skills-section .skills-categories {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: grid;
  gap: 40px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  margin: 0 auto;
  max-width: 1200px;
}

.skills-section .skill-category {
  background-color: var(--background-color-light);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  padding: 25px;
}

.skills-section .skill-category h3 {
  color: var(--text-color-dark);
  font-size: 1.3em;
  font-weight: 600;
  margin-bottom: 15px;
  margin-top: 0;
  text-align: center;
}

.skills-section .skill-category ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.skills-section .skill-category li {
  color: var(--text-color-medium);
  font-size: 1em;
  margin-bottom: 8px;
  padding-left: 20px;
  position: relative;
  text-align: left;
}

.skills-section .skill-category li::before {
  color: var(--primary-color);
  content: "▹";
  font-size: 0.9em;
  left: 0;
  position: absolute;
  top: 0;
}

.projects-section {
  background-color: var(--background-color-light);
}

.projects-section .project-grid {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(2, minmax(300px, 1fr));
}

.projects-section .project-item {
  background-color: var(--background-color-grey);
  border-radius: 8px;
  box-shadow: var(--shadow-medium);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 30px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.centered-item {
  grid-column: 1 / -1;
  justify-self: center;
  max-width: calc(50% - 15px);
}

.projects-section .project-item:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-8px);
}

.projects-section .project-image {
  border-radius: 5px;
  margin-bottom: 15px;
  overflow: hidden;
}

.projects-section .project-image img {
  display: block;
  height: auto;
  object-fit: cover;
  transition: transform 0.5s ease;
  width: 100%;
}

.projects-section .project-item:hover .project-image img {
  transform: scale(1.05);
}

.projects-section .project-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.projects-section .project-info h3 {
  color: var(--text-color-dark);
  font-size: 1.6em;
  margin-bottom: 10px;
  margin-top: 0;
}

.projects-section .project-info .project-description {
  color: var(--text-color-medium);
  flex-grow: 1;
  margin-bottom: 20px;
  text-align: justify;
}

.projects-section .project-info .project-description a {
  color: var(--primary-color);
  text-decoration: underline;
  transition: color var(--transition-timing);
}

.projects-section .project-info .project-description a:hover {
  color: var(--primary-color);
}

.projects-section .project-info .btn {
  align-self: flex-start;
  margin-top: 10px;
}

.project-description ul {
  list-style-type: disc;
  padding-left: 5px;
  margin: 0;
}

.project-description li {
  margin-bottom: 1px;
  line-height: 1.4;
}

#other-projects {
  background-color: var(--background-color-grey);
}

#other-projects .project-grid {
  gap: 30px;
  grid-template-columns: repeat(3, minmax(300px, 1fr));
}

.contact-section {
  background-color: var(--background-color-grey);
  padding-bottom: 100px;
}

.contact-section .contact-info {
  text-align: center;
}

.contact-section .social-links {
  display: flex;
  gap: 40px;
  justify-content: center;
  margin-top: 30px;
  flex-wrap: nowrap;
  overflow-x: visible;
  padding-bottom: 0;
}

.contact-section .social-links .btn-secondary-social {
  transition: color var(--transition-timing), transform 0.2s ease;
}

.contact-section .social-links .btn-secondary-social:hover {
  transform: translateY(-3px);
}

.site-footer {
  background-color: var(--background-color-light);
  color: var(--text-color-light);
  font-size: 0.9em;
  margin-top: 80px;
  padding: 40px 0;
  text-align: center;
}

.site-footer a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-timing);
}

.site-footer a:hover {
  text-decoration: underline;
}

a:focus,
button:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.js-scroll {
  opacity: 0;
  transform: translateY(50px);
  will-change: opacity, transform;
}

.js-scroll.is-in-view {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.js-scroll:nth-child(odd).is-in-view {
  transition-delay: 0.1s;
}

.js-scroll:nth-child(even).is-in-view {
  transition-delay: 0.2s;
}

@media (max-width: 767px) {
  .container {
    padding: 0 10px; /* Reduced container padding */
  }

  .site-header {
    padding: 8px 0; /* Further reduced header padding */
  }

  .site-header .container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px; /* Reduced gap in header container */
  }

  .site-nav {
    align-items: center;
    flex-grow: 1;
    justify-content: center;
    margin: 0;
    padding: 0;
  }

  .site-nav ul {
    flex-direction: row;
    align-items: center;
    gap: 3px; /* Further reduced gap */
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 3px; /* Reduced space for scrollbar */
  }

  .site-nav li {
    flex-shrink: 0;
  }

  .site-nav a {
    font-size: 0.75em; /* Further reduced font size */
    padding: 1px 3px; /* Further reduced padding */
    white-space: nowrap;
  }

  .site-nav a::after {
    height: 1px;
    bottom: 1px; /* Adjusted position */
  }

  .site-nav a:hover,
  .site-nav a:focus {
    transform: none;
  }

  #theme-toggle {
    margin-left: 0;
    margin-right: 0;
  }

  .header-home-link img,
  #theme-toggle img {
    height: 20px; /* Reduced icon size */
    width: 20px; /* Reduced icon size */
  }

  .site-main section {
    padding: 60px 0;
  }

  .section-title {
    font-size: 2em;
    margin-bottom: 30px;
  }

  .hero-section {
    padding: 80px 0;
  }

  .hero-section .container {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .hero-content {
    margin-bottom: 30px;
    max-width: 100%;
    padding-right: 0;
  }

  .hero-content .greeting {
    font-size: 2em;
  }

  .hero-content .tagline {
    font-size: 1.4em;
  }

  .hero-content .email {
    font-size: 1em;
  }

  .hero-image {
    margin-top: 30px;
    margin-left: 0;
    position: static;
    transform: none;
  }

  .hero-image img {
    margin: 0 auto;
    max-width: 180px;
  }

  .btn {
    font-size: 0.9em;
    padding: 10px 20px;
  }

  .background-section .background-text {
    text-align: center;
  }

  .skills-section .skills-categories {
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }

  .skills-section .skill-category {
    padding: 20px;
  }

  .skills-section .skill-category h3 {
    font-size: 1.2em;
  }

  .skills-section .skill-category li {
    font-size: 0.95em;
  }

  .projects-section .project-grid,
  #other-projects .project-grid {
    gap: 20px;
    grid-template-columns: 1fr;
  }

  .projects-section .project-item,
  #other-projects .project-item {
    padding: 20px;
  }

  .projects-section .project-image,
  #other-projects .project-image {
    margin-bottom: 10px;
  }

  .projects-section .project-info h3,
  #other-projects .project-info h3 {
    font-size: 1.4em;
  }

  .projects-section .project-info .project-description,
  #other-projects .project-info .project-description {
    font-size: 1em;
  }

  .project-description ul {
    list-style-type: disc;
    padding-left: 20px;
    margin: 0;
  }

  .project-description li {
    margin-bottom: 5px;
    line-height: 1.4;
  }

  .contact-section .social-links {
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  .contact-section .social-links .btn-secondary-social {
    font-size: 0.8em;
    padding: 6px 10px;
    flex-shrink: 0;
  }

  .site-footer {
    font-size: 0.85em;
    margin-top: 60px;
    padding: 30px 0;
  }
}

@media (min-width: 768px) {
  .site-header .container {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    gap: 20px;
  }

  .site-title {
    flex-shrink: 0;
  }

  .site-nav {
    align-items: center;
    flex-grow: 1;
    justify-content: center;
    margin: 0;
    width: auto;
  }

  .site-nav ul {
    flex-direction: row;
    gap: 30px;
  }

  .site-nav a {
    font-size: 1.1em;
    padding: 5px 0;
    white-space: nowrap;
  }

  .site-nav a::after {
    height: 2px;
    bottom: 0;
  }

  .site-nav a:hover,
  .site-nav a:focus {
    transform: translateY(-2px);
  }

  #theme-toggle {
    flex-shrink: 0;
    margin-left: 0;
    margin-right: 0;
  }

  .header-home-link img,
  #theme-toggle img {
    height: 30px;
    width: 30px;
  }

  .site-header .header-home-link,
  .site-header #theme-toggle {
    flex-shrink: 1;
  }

  .hero-section .container {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }

  .hero-content {
    margin-bottom: 0;
    max-width: 60%;
    padding-right: 50px;
  }

  .hero-image {
    flex-shrink: 0;
    margin-left: 50px;
    position: static;
    top: auto;
    transform: none;
  }

  .hero-image img {
    margin: 0;
    max-width: 300px;
  }

  .background-section .background-text {
    text-align: justify;
  }

  .skills-section .skills-categories {
    gap: 40px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  .projects-section .project-grid {
    gap: 30px;
    grid-template-columns: repeat(2, minmax(300px, 1fr));
  }

  #other-projects .project-grid {
    gap: 30px;
    grid-template-columns: repeat(3, minmax(300px, 1fr));
  }

  .contact-section .social-links {
    gap: 40px;
  }
}
