/* Prevent iOS Safari from automatically resizing text */
html {
  -webkit-text-size-adjust: 100%;
}

/* General Styling */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  font-family: Arial, sans-serif;
  
  background: url('images/farmlink background.png') no-repeat center top;
  background-size: 100% auto;
  background-attachment: scroll;
  background-color: #fff; /* Fallback color */
}

.container {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

.background {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: cover;
  margin: 0 auto;
  opacity: 0;
}

.logo {
  position: fixed;
  top: 5%;
  left: 10%;
  transform: translateX(-50%);
  height: 250px;
  width: auto;
}

.text-block {
  position: absolute;
  font-family: Arial, sans-serif;
  line-height: 1.5;
  color: #333;
}

#block1 {
  top: 25%;
  left: 30%;
  font-size: 3.0rem;
  font-weight: bold;
}

#block2 {
  top: 45%;
  left: 23%;
  font-size: 1.6rem;
  font-weight: bold;
  max-width: 70%;
}

#block3 {
  top: 65%;
  left: 30%;
  font-size: 1.3rem;
  font-weight: bold;
  max-width: 70%;
}

.button-container {
  position: fixed;
  bottom: 10%;
  left: 5%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.button, .back-button {
  width: 100px;
  height: 30px;
  color: white;
  text-align: center;
  line-height: 30px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.button {
  background-color: #4CAF50;
}

.back-button {
  background-color: #2196F3;
}

.button:active, .back-button:active {
  transform: translateY(2px);
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Mobile-Friendly Adjustments for moderately small screens */
@media screen and (max-width: 768px) {
  /* Add extra bottom padding so text isn't hidden behind the fixed buttons */
  .container {
    padding-bottom: 80px;
  }

  .logo {
    height: 100px;
    top: 2%;
    left: 5%;
    transform: translateX(0);
  }
  
  /* Switch text blocks from absolute to relative positioning */
  .text-block {
    position: relative;
    margin: 1rem 5%;
  }
  
  /* Remove fixed top and left values */
  #block1, #block2, #block3 {
    top: auto;
    left: auto;
  }
  
  /* Adjust font sizes and widths */
  #block1 {
    font-size: 2.0rem;
  }
  
  #block2 {
    font-size: 1.2rem;
    max-width: 90%;
  }
  
  #block3 {
    font-size: 1.1rem;
    max-width: 90%;
  }
  
  /* The navigation buttons remain fixed but are slightly smaller */
  .button-container {
    bottom: 5%;
    left: 2%;
    gap: 5px;
  }
  
  .button, .back-button {
    width: 90px;
    height: 25px;
    line-height: 25px;
    font-size: 0.9rem;
  }
}

/* Additional adjustments for small iPhone-sized screens in portrait */
@media screen and (max-width: 480px) {
  /* Stretch the background image to cover the entire viewport */
  html, body {
    background-size: cover;
  }
  
  /* Adjust the text blocks so they're shifted to the right (to avoid the fixed left buttons) */
  .text-block {
    margin: 1rem 5% 1rem 100px;  /* top, right, bottom, left */
    max-width: 80%;
  }
  
  /* Further narrow the navigation buttons if desired */
  .button, .back-button {
    width: 80px;
  }
  
  /* Make the Farmlink logo static (non-fixed) on small screens.
     It will appear in the top left and scroll off the screen to improve readability. */
  .logo {
    position: absolute;  /* switch from fixed to absolute */
    top: 0;
    left: 0;
    transform: none;
    height: 80px;       /* adjust logo size as needed */
  }
}

/* Additional adjustments for landscape mode on small iPhones */
@media screen and (max-width: 768px) and (orientation: landscape) {
  /* Ensure the background fills the entire viewport in landscape */
  html, body {
    background-size: cover;
  }

  /* Increase bottom padding so text does not get hidden behind buttons */
  .container {
    padding-bottom: 100px;
  }
  
  /* Shift text blocks further to the right to avoid overlap with the fixed left buttons.
     Increased left margin from 100px to 120px. */
  .text-block {
    margin-left: 120px;
    margin-right: 5%;
  }
}
