:root {
  --bg-color: #333;
  --text-color: whitesmoke;
}

html {
  scroll-behavior: smooth;
}

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

body {
  font-family: Georgia, 'Times New Roman', Times, serif;
  min-height: 100vh;
  background-color: #111;
  color: var(--text-color);
}

header {
  position: sticky;
  top: 0;
  z-index: 999;
  background-color: var(--bg-color);
}

.links {
  display: flex;
  flex-wrap: wrap; /* allows links to wrap instead of overflowing */
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border-bottom: 1px solid var(--text-color);
  background-color: var(--bg-color);
}

.links a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: bold;
  font-size: 18px;
  padding: 8px 12px;
  text-align: center;
  flex: 0 1 auto; /* prevents links from stretching too much */
}

.links a:hover,
.links a:focus {
  background-color: whitesmoke;
  color: #333;
  border-radius: 50%;
}

/* Tablets and below */
@media (max-width: 768px) {
  .links {
    gap: 15px;
    padding: 15px;
  }

  .links a {
    font-size: 16px;
    padding: 6px 10px;
  }
}

/* Mobile devices */
@media (max-width: 480px) {
  .links {
    gap: 10px;
    padding: 10px;
  }

  .links a {
    font-size: 14px;
    padding: 5px 8px;
  }
}

/* Home Section */
.home {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 40px;
  gap: 40px;
  background: url(img/homebg.jpg) center/cover no-repeat;
  border-bottom: 1px solid var(--text-color);
}

.home h1 {
  font-size: 32px;
  max-width: 60%;
}

.home img {
  border-radius: 12px;
  max-width: 200px;
  height: auto;
  border: 2px solid var(--text-color);
}

.about,
.skills,
.edu,
.contact,
.resume-download {
  padding: 40px;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--text-color);
}

.about h2,
.skills h2,
.edu h2,
.contact h2 {
  font-size: 28px;
  margin-bottom: 20px;
  font-weight: bold;
  text-decoration: underline;
}

.about p,
.contact p,
.contact address,
.contact a {
  font-size: 18px;
  line-height: 1.6;
  text-align: justify;
}

.skills table
{
  width: 100%;
  border-collapse: collapse;
  margin: 0 auto;
}

.skills th, .skills td
{
  border: 1px solid var(--text-color);
  padding: 12px 20px;
  text-align: center;
  font-size: 16px;
}

.projects h2 {   
  padding: 20px;
  text-align: center;
  background-color: var(--bg-color);
  color: var(--text-color);
  text-decoration: underline;
  font-size: 28px;
}

.projects-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  background-color: var(--bg-color);
  padding: 40px 20px;
  border-bottom: 1px solid var(--text-color);
}

.project-text {
  flex: 1 1 300px;
  min-width: 250px;
  max-width: 600px;
  color: var(--text-color);
}

.project-text h3 {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 12px;
  padding-left: 10px;
}

.project-text p {
  margin: 0;
  line-height: 1.6;
  text-align: justify;
  font-size: 16px;
  padding-left: 10px; /* Shift to right slightly */
  padding-bottom: 1rem;
}


.projects-content img {
  flex: 1 1 300px;
  max-width: 320px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 2px solid var(--text-color);
  display: block;
  margin: auto;
}

/* Tablet and smaller: stack items and limit width */
@media (max-width: 768px) {
  .projects-content {
    flex-direction: column;
    align-items: center;
    padding: 30px 15px;
  }

  .project-text,
  .projects-content img {
    max-width: 90%;
  }

  .project-text p {
    text-align: justify;
  }
}

/* Phones */
@media (max-width: 480px) {
  .projects h2 {
    font-size: 22px;
  }

  .project-text h3 {
    font-size: 20px;
  }

  .project-text p {
    font-size: 15px;
  }

  .projects-content {
    padding: 20px 10px;
    gap: 20px;
  }
}

@media (max-width: 992px) {
  .projects-content {
    flex-direction: column;
    align-items: center;
    padding: 20px 20px;
    gap: 0; 
  }

  .project-text,
  .projects-content img {
    max-width: 90%;
  }

  .project-text p {
    text-align: justify; 
  }

  .projects-content img {
    margin-top: 0; 
  }
}

/* ✅ Reduce image size on laptop screens */
@media (min-width: 992px) and (max-width: 1200px) {
  .projects-content img {
    max-width: 300px;
  }
}

/* Optional: control even more tightly on large screens */
@media (min-width: 1201px) {
  .projects-content img {
    max-width: 400px;
  }
}

.edu {
  text-align: center;
  padding: 40px;
  background-color: var(--bg-color);
  color: var(--text-color);
  border-bottom: 1px solid var(--text-color);
}

.edu h2 {
  font-size: 28px;
  margin-bottom: 25px;
  font-weight: bold;
  text-decoration: underline;
}

.table-wrapper {
  overflow-x: auto;
  width: 100%;
}

.edu table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-color);
  table-layout: fixed; 
  word-wrap: break-word;
}

.edu th, .edu td {
  border: 1px solid var(--text-color);
  padding: 12px;
  text-align: center;
  font-size: 16px;
  vertical-align: middle;
}

.edu td img {
  width: 100%;
  max-width: 100px;
  height: auto;
  display: block;
  margin: auto;
}

@media (max-width: 768px) {
  .edu td img {
    max-width: 80px;
  }
}

@media (max-width: 480px) {
  .edu td img {
    max-width: 60px;
  }
}

/* Resume Button */
.rainbow-button {
  position: relative;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border: 2px solid var(--text-color);
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(135deg, #ff6ec4, #7873f5, #4fd1c5);
  overflow: hidden;
  color: transparent;
}

.rainbow-button::before {
  content: "📄 Download Resume";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(
    90deg,
    red,
    orange,
    yellow,
    green,
    blue,
    indigo,
    violet
  );
  background-size: 400% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: rainbow-text 5s linear infinite;
  font-size: 16px;
  font-weight: bold;
  white-space: nowrap;
  pointer-events: none;
}

@keyframes rainbow-text {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 100% center;
  }
}


@keyframes rainbow-text {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 100% center;
  }
}

.resume-download {
  text-align: center;
  padding: 40px 20px;
  background-color: var(--bg-color);
  color: var(--text-color);
  border-bottom: 1px solid var(--text-color);
}

.resume-download h2 {
  font-size: 26px;
  margin-bottom: 20px;
}

.resume-download a {
  display: inline-block; /* Needed for centering the button */
  text-decoration: none;
}

.resume-download .resdown{
  margin-bottom: 20px;
}

/* Animations & Effects */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 1s forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scale-hover:hover {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

/* Responsive Layout Adjustments */
@media (max-width: 992px) {
  .home {
    flex-direction: column;
    text-align: center;
  }

  .home h1 {
    max-width: 100%;
    font-size: 26px;
  }

  .home img {
    max-width: 80%;
  }

  .projects-content {
    flex-direction: column;
    align-items: center;
  }

  .skills th,
  .skills td,
  .edu th,
  .edu td {
    font-size: 15px;
  }
}

@media (max-width: 576px) {
  .home h1 {
    font-size: 20px;
  }

  .about h2,
  .skills h2,
  .edu h2,
  .contact h2 {
    font-size: 22px;
  }

  .about p,
  .skills td,
  .edu td,
  .contact p,
  .contact a {
    font-size: 16px;
  }

  .rainbow-button {
    font-size: 14px;
    padding: 10px 18px;
  }
}

.contact p 
{
  font-size: 1.3rem;
}

.contact a
{
  text-decoration: none;
  font-size: 1.3rem;
}

.contact a:hover,a:focus
{
    color: cyan;
}

#home,
#about,
#skills,
#projects,
#education,
#contact {
  scroll-margin-top: 100px;
}

/* Base scroll margin for desktops/laptops */
#home,
#about,
#skills,
#projects,
#education,
#contact {
  scroll-margin-top: 78px;
}

/* Tablets */
@media (max-width: 992px) {
  #home,
  #about,
  #skills,
  #projects,
  #education,
  #contact {
    scroll-margin-top: 120px;
  }
}

/* Mobile phones */
@media (max-width: 600px) {
  #home,
  #about,
  #skills,
  #projects,
  #education,
  #contact {
    scroll-margin-top: 70px;
  }
}