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

/* Mobile Styles */
@media (max-width: 768px) {
  body {
    padding: 0 10px;
  }

  .row-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px;
  }

  .moveKU,
  .moveA,
  .moveC,
  .moveTI {
    width: 100%;
    max-width: 90vw;
    margin: 0 auto;
    background-color: #3b4264;
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  h1 {
    font-size: 1.7em;
    word-break: break-word;
    text-align: center;
    padding: 10px;
  }

  input[type="number"],
  button {
    width: 100%;
    max-width: 100%;
    font-size: 1rem;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  h2 {
    text-align: left;
    font-size: 2.5rem;
    margin: 2rem 0;
    color: #fff;
    opacity: 0;
    animation: fadeIn 1s ease-in-out forwards;
    animation-delay: 0.2s;
    font-family: Georgia, 'Times New Roman', Times, serif;
    padding: 0 1rem;
  }

  .nav-menu {
    position: static;
    margin: 1rem 0 0 0;
    text-align: center;
  }

  .nav-menu ul {
    flex-direction: column;
    gap: 10px;
    align-items: center;
  }

  .nav-menu li a {
    text-decoration: none;
    color: #0048ff;
    font-weight: bold;
    display: inline-block;
    font-size: 1.1rem;
    padding: 10px 20px;
    background-color: #3b4264;
    border-radius: 6px;
    transition: background-color 0.3s;
  }

  .instagram a,
  .linkedin a {
    font-size: 32px;
    width: 50px;
    height: 50px;
  }

  .p1,
  .p2,
  .MePhoto,
  .BackHome,
  .container {
    position: static;
    margin: 1rem auto;
    width: 100%;
    max-width: 90vw;
    display: block;
    opacity: 1;
    animation: none;
  }

  .MePhoto {
    max-width: 300px;
    display: block;
  }

  .BackHome {
    text-align: center;
    width: fit-content;
  }

  .container {
    flex-direction: column;
    gap: 10px;
  }

  /* Stack text and photo vertically on mobile */
  .content-wrapper {
    flex-direction: column;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Base Styles */
body {
  position: relative;
  margin: 0;
  background-color: #04060a;
  padding: 0;
  font-family: JetBrains Mono, monospace;
  line-height: 1.6;
  background:
    repeating-linear-gradient(
      to bottom,
      #ffffff,
      #ffffff 24px,
      #cce0ff 25px
    );
  background-size: 100% 25px, 100% 25px;
  background-repeat: repeat-y;
}

#box1 {
  background: linear-gradient(to bottom, #363b51, #4a517a);
  width: 100%;
  height: 80px;
  margin-top: 0;
  box-sizing: border-box;
}

h1 {
  color: #ffffff;
  text-align: left;
  margin-top: 0;
  font-size: 1.5em;
  padding: 20px;
}

.row-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  color: #99a2cd;
  justify-content: center;
  animation: fadeIn 0.8s ease forwards;
  animation-delay: 0.3s;
  opacity: 0;
  padding: 20px;
  min-width: 260px;
  padding-top: 50px;
}

.moveKU,
.moveA,
.moveC,
.moveTI {
  flex: 1;
  max-width: 240px;
  background: linear-gradient(135deg, #2e2e4d, #3b4264);
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.8s ease forwards;
  animation-delay: 0.3s;
  opacity: 0;
  word-wrap: break-word;
  padding: 10px 12px;
  margin: 0 auto;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.moveKU:hover,
.moveA:hover,
.moveC:hover,
.moveTI:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.exam {
  text-align: center;
  margin-top: 50px;
  color: #3b4264;
  animation: fadeIn 0.8s ease forwards;
  animation-delay: 0.3s;
  opacity: 0;
}

.calculate {
  text-align: center;
  margin-top: 10px;
  margin-bottom: 40px;
}

input[type="number"] {
  width: 100%;
  max-width: 200px;
  margin-bottom: 5px;
  font-size: 1em;
  padding: 5px;
}

button {
  padding: 12px;
  font-size: 0.8rem;
  border-radius: 6px;
  animation: fadeIn 0.8s ease forwards;
  animation-delay: 0.3s;
  opacity: 0;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.button:hover {
  background-color: #e7e41a;
}

.nav-menu {
  position: fixed;
  top: 30px;
  right: 30px;
  z-index: 1000;
}

.nav-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 20px;
}

.nav-menu li a {
  text-decoration: none;
  color: #ffffff;
  font-weight: bold;
  transition: color 0.3s;
}

.nav-menu li a:hover {
  color: #1d2132;
}

/* New Flexbox Wrapper for Text + Photo */
.content-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.text-content {
  flex: 1;
  min-width: 0;
}

.MePhoto {
  flex-shrink: 0;
  width: 300px;
  border-radius: 8px;
  margin: 0; /* Reset margin from mobile */
}

.p1,
.p2 {
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 1rem;
  color: #3b4264;
  max-width: 820px;
  width: 100%;
  line-height: 1.5;
  margin: 0 0 1rem 0; /* Adjusted margin */
  text-align: left;
  padding: 0 0.5rem;
  box-sizing: border-box;
  animation: fadeIn 0.8s ease forwards;
  animation-delay: 0.3s;
  opacity: 0;
}

.BackHome {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background-color: #ffffff;
  color: #000000;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  transition: background-color 0.3s ease;
  z-index: 999;
  box-shadow: 5px 10px 12px rgba(0, 0, 0, 0.1);
}

.BackHome:hover {
  background-color: #99a2cd;
  color: #ffffff;
  transform: scale(1.05);
}

.container {
  position: fixed;
  top: 30px;       /* Align with nav-menu */
  right: 100px;    /* Space from right edge */
  display: flex;
  gap: 15px;
  z-index: 1000;   /* Ensure icons stay above content */
}

h2 {
  text-align: left;
  font-size: 2.5rem;
  margin: 2rem 0;
  color: #3b4264;
  opacity: 0;
  animation: fadeIn 1s ease-in-out forwards;
  animation-delay: 0.2s;
  font-family: Georgia, 'Times New Roman', Times, serif;
  padding: 0 1rem;
}

.instagram a,
.linkedin a {
  color: #3b4264;
  font-size: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  box-sizing: border-box;
  overflow: hidden;
}

.instagram a i,
.linkedin a i {
  display: inline-block;
  width: auto;
  height: auto;
  line-height: normal;
  vertical-align: middle;
}