html {
  height: 100%;
}

body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navigation - prevent squishing */
#navigation {
  flex-shrink: 0;
}

#main-body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  overflow-x: hidden;
  position: relative;
  flex: 1 0 auto;
}

#main-body > div {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.main-body-img {
  overflow: hidden;
  background-color: #f4f4f4;
  width: 100%;
  height: 500px;
  box-shadow: rgba(9, 30, 66, 0.25) 0px 4px 8px -2px,
    rgba(9, 30, 66, 0.08) 0px 0px 0px 1px;
  flex-shrink: 0;
  border-bottom: 3.75px solid var(--light-green);
}

.main-body-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: hue-rotate(20deg) brightness(1);
  transition: transform 0.5s ease;
  animation-name: popOutThenSettle;
  animation-duration: 1s;
  animation-delay: 0.4s;
  animation-fill-mode: forwards;
  animation-timing-function: ease-out;
  opacity: 0;
  transform: scale(1);
}

.main-body-content {
  background-color: rgb(255, 255, 255);
  background-image: url("https://www.transparenttextures.com/patterns/otis-redding.png");
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
  padding-bottom: 15px;
  position: relative;
  overflow-x: hidden;
  width: 100%;
}

/* Top-left aged corner */
.main-body-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 450px;
  height: 450px;
  background: radial-gradient(
    ellipse 120% 120% at top left,
    rgba(101, 67, 33, 0.45) 0%,
    rgba(122, 89, 68, 0.38) 12%,
    rgba(139, 119, 101, 0.32) 22%,
    rgba(139, 119, 101, 0.26) 32%,
    rgba(139, 119, 101, 0.2) 42%,
    rgba(139, 119, 101, 0.14) 52%,
    rgba(139, 119, 101, 0.09) 62%,
    rgba(139, 119, 101, 0.05) 72%,
    rgba(139, 119, 101, 0.02) 82%,
    rgba(139, 119, 101, 0.01) 90%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 100;
  mix-blend-mode: multiply;
  filter: blur(15px);
  opacity: 0.95;
  transform: translate(-5%, -5%);
}

/* Top-right aged corner */
.main-body-content::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 450px;
  height: 450px;
  background: radial-gradient(
    ellipse 120% 120% at top right,
    rgba(101, 67, 33, 0.45) 0%,
    rgba(122, 89, 68, 0.38) 12%,
    rgba(139, 119, 101, 0.32) 22%,
    rgba(139, 119, 101, 0.26) 32%,
    rgba(139, 119, 101, 0.2) 42%,
    rgba(139, 119, 101, 0.14) 52%,
    rgba(139, 119, 101, 0.09) 62%,
    rgba(139, 119, 101, 0.05) 72%,
    rgba(139, 119, 101, 0.02) 82%,
    rgba(139, 119, 101, 0.01) 90%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 100;
  mix-blend-mode: multiply;
  filter: blur(15px);
  opacity: 0.95;
  transform: translate(5%, -5%);
}

.main-body-content h1 {
  font-family: "Poppins", "Montserrat", "Arial", sans-serif;
  font-weight: 600;
  font-size: 2.5rem;
  color: #333;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  width: 100%;
  padding: 10px;
  margin-top: 20px;
  margin-bottom: 10px;
  position: relative;
  z-index: 5;
}

.popular-items-box {
  padding: 20px 50px;
  border-radius: 10px;
  width: 100%;
  margin: 0 auto 20px auto;
  max-width: 1200px;
  position: relative;
  z-index: 2;
}

/* Disable grid for 0 or 1 item - will center naturally */
.popular-items-box.has-one-item,
.popular-items-box:not(.has-one-item):not(.has-two-items):not(
    .has-three-items
  ) {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Enable grid only for 2+ items */
.popular-items-box.has-two-items,
.popular-items-box.has-three-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto;
  grid-column-gap: 30px;
  grid-row-gap: 20px;
  justify-items: center;
}

.popular-item-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #ffffff;
  border: 1px solid #eeeeee;
  border-radius: 10px;
  width: 100%;
  width: 336.19px;
  max-width: 414px;
  min-height: 420px;
  box-shadow: rgba(0, 0, 0, 0.15) 0px 5px 15px;
  opacity: 0;
  animation: popIn 0.6s ease-out forwards;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  padding: 15px;
  text-align: center;
}

.popular-item-container:hover {
  transform: translateY(-5px);
  box-shadow: rgba(0, 0, 0, 0.25) 0px 10px 25px;
}

.popular-item-container:nth-child(1) {
  animation-delay: 0.3s;
}

.popular-item-container:nth-child(2) {
  animation-delay: 0.4s;
}

.popular-item-container:nth-child(3) {
  animation-delay: 0.5s;
}

.popular-item-img {
  width: 100%;
  height: 250px;
  max-height: 250px;
  object-fit: cover;
  object-position: center;
  margin-bottom: 15px;
  border-radius: 10px;
}

.popular-item-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex-grow: 1;
  justify-content: space-between;
}

.popular-item-name {
  font-family: "Poppins", "Montserrat", "Arial", sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
  color: #333333;
  margin-top: 5px;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.popular-item-price-stock-flex {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-bottom: 15px;
}

.popular-item-price {
  font-family: "Montserrat", "Arial", sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: #000000;
  margin: 0 10px 0 0;
}

.popular-item-stock {
  font-family: "Open Sans", "Arial", sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
  color: #777777;
  margin: 0;
  padding-left: 10px;
  border-left: 1px solid #ccc;
}

.view-in-shop-btn {
  display: block;
  width: 90%;
  padding: 12px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  background-color: #8dc53e;
  color: #ffffff;
  font-weight: 600;
  font-family: "Montserrat", "Arial", sans-serif;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
  margin: 0 auto;
  margin-top: auto;
}

.view-in-shop-btn:hover {
  background-color: #72a536;
  transform: translateY(-2px);
}

.view-in-shop-btn:active {
  transform: translateY(0);
}

/* Tablet styles */
@media screen and (max-width: 1024px) {
  #main-body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }

  .main-body-img {
    height: 400px;
  }

  .main-body-content h1 {
    font-size: 2.2rem;
    letter-spacing: 1.5px;
    margin-top: 25px;
  }

  .popular-items-box {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    gap: 25px;
    padding: 25px 0;
    height: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-padding: 0 calc(50% - 50% / 2 - 12.5px);
  }

  .popular-items-box::before,
  .popular-items-box::after {
    content: "";
    flex: 0 0 calc((100% - 45%) / 2);
  }

  .popular-items-box::-webkit-scrollbar {
    display: none;
  }

  .popular-item-container {
    flex: 0 0 45%;
    max-width: 380px;
    min-height: 400px;
    scroll-snap-align: center;
    animation: none;
    opacity: 1;
  }

  .popular-item-container:hover {
    transform: none;
  }

  .popular-item-img {
    width: 100%;
    height: 220px;
    max-height: 220px;
    min-height: 220px;
    object-fit: cover;
    object-position: center;
  }

  .popular-item-name {
    font-size: 1.2rem;
    min-height: 2.6rem;
  }

  .view-in-shop-btn {
    font-size: 0.95rem;
    padding: 11px;
    width: 92%;
  }

  .carousel-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
  }

  .carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
  }

  .carousel-dot.active {
    background-color: var(--primary-green);
    transform: scale(1.3);
  }

  #goto-shop-btn {
    font-size: 1.3rem;
    padding: 12px 24px;
  }
}

@media screen and (max-width: 768px) {
  #main-body {
    min-height: auto;
    overflow-x: hidden;
    width: 100%;
    position: relative;
    padding-top: 80px;
  }

  .main-body-img {
    height: 300px;
    border-bottom: 3px solid var(--light-green);
  }

  .main-body-img img {
    object-fit: cover;
    object-position: center;
  }

  .main-body-content {
    padding-bottom: 30px;
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }

  .main-body-content::before,
  .main-body-content::after {
    width: 320px;
    height: 320px;
    filter: blur(12px);
  }

  .main-body-content::before {
    transform: translate(-3%, -3%);
  }

  .main-body-content::after {
    transform: translate(3%, -3%);
  }

  .main-body-content h1 {
    font-size: 1.8rem;
    letter-spacing: 1px;
    margin-top: 20px;
    padding: 10px 20px;
  }

  .popular-items-box {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    gap: 18px;
    padding: 20px 0;
    height: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .popular-items-box::before,
  .popular-items-box::after {
    content: "";
    flex: 0 0 calc((100% - 80%) / 2);
  }

  .popular-items-box::-webkit-scrollbar {
    display: none;
  }

  .popular-item-container {
    flex: 0 0 80%;
    max-width: 320px;
    min-width: 280px;
    min-height: auto;
    scroll-snap-align: center;
    animation: none;
    opacity: 1;
    margin: 0;
    padding: 15px;
    border-radius: 8px;
  }

  .popular-item-container:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }

  .popular-item-img {
    width: 100%;
    height: 200px;
    max-height: 200px;
    min-height: 200px;
    object-fit: cover;
    object-position: center;
    margin-bottom: 12px;
  }

  .popular-item-name {
    font-size: 1.15rem;
    margin-bottom: 10px;
    min-height: 2.5rem;
  }

  .popular-item-price {
    font-size: 1.3rem;
  }

  .popular-item-stock {
    font-size: 0.9rem;
  }

  .view-in-shop-btn {
    font-size: 0.9rem;
    padding: 10px;
    width: 100%;
  }

  .carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 15px 0 20px 0;
  }

  .carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
  }

  .carousel-dot.active {
    background-color: var(--primary-green);
    transform: scale(1.4);
  }

  #goto-shop-btn {
    font-size: 1.2rem;
    padding: 12px 35px;
    width: auto;
    max-width: 250px;
    text-align: center;
  }

  @keyframes subtle-pulse {
    0%,
    100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.02);
    }
  }

  .tagline {
    font-size: 0.85rem;
    margin: 20px auto 8px auto;
    padding: 0 15px 18px 15px;
  }

  .tagline::after {
    width: 320px;
    bottom: -5px;
    height: 1.5px;
  }
}

@media screen and (max-width: 480px) {
  .main-body-img {
    height: 250px;
  }

  .main-body-content::before,
  .main-body-content::after {
    width: 220px;
    height: 220px;
    filter: blur(10px);
  }

  .main-body-content::before {
    transform: translate(-2%, -2%);
  }

  .main-body-content::after {
    transform: translate(2%, -2%);
  }

  .main-body-content h1 {
    font-size: 1.5rem;
    letter-spacing: 0.5px;
    margin-top: 15px;
    padding: 10px 15px;
  }

  .popular-items-box {
    padding: 15px 0;
    gap: 15px;
  }

  .popular-items-box::before,
  .popular-items-box::after {
    content: "";
    flex: 0 0 calc((100% - 75%) / 2);
  }

  .popular-item-container {
    flex: 0 0 75%;
    max-width: 260px;
    min-width: 240px;
    padding: 12px;
  }

  .popular-item-img {
    width: 100%;
    height: 180px;
    max-height: 180px;
    min-height: 180px;
    object-fit: cover;
    object-position: center;
    margin-bottom: 10px;
  }

  .popular-item-name {
    font-size: 1.05rem;
    margin-bottom: 8px;
    min-height: 2.3rem;
  }

  .popular-item-price {
    font-size: 1.2rem;
  }

  .popular-item-stock {
    font-size: 0.82rem;
    padding-left: 8px;
  }

  .view-in-shop-btn {
    font-size: 0.85rem;
    padding: 9px;
  }

  #goto-shop-btn {
    font-size: 1.1rem;
    padding: 10px 30px;
    max-width: 220px;
  }

  .tagline {
    font-size: 0.82rem;
    margin: 15px auto 5px auto;
    letter-spacing: 0.3px;
    padding: 0 15px 15px 15px;
  }

  .tagline::after {
    width: 320px;
    bottom: -5px;
    height: 1.5px;
  }
}

#goto-shop-btn {
  background-color: var(--primary-green);
  color: var(--white);
  border: none;
  border-radius: 5px;
  padding: 10px 20px;
  font-family: "Montserrat", "Arial", sans-serif;
  font-weight: 600;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background-color 0.3s ease-in-out;
  margin: 20px auto;
  margin-bottom: 20px;
  box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;
  position: relative;
  overflow: hidden;
  z-index: 5;
  animation: subtle-pulse 2s infinite ease-in-out;
}

#goto-shop-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 30%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 70%
  );
  transition: all 0.5s ease-in-out;
  z-index: 2;
}

#goto-shop-btn:hover::after {
  left: 100%;
}

#goto-shop-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
}

#goto-shop-btn:hover {
  background-color: var(--secondary-green);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.carousel-dots {
  display: none;
  position: relative;
  z-index: 5;
}

.tagline {
  font-family: "Open Sans", "Arial", sans-serif;
  font-size: 19.65px;
  font-weight: 500;
  color: #555;
  text-align: center;
  margin: 25px auto 10px auto;
  padding: 0 20px 20px 20px;
  max-width: 1200px;
  font-style: italic;
  letter-spacing: 0.5px;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out 0.2s forwards;
  position: relative;
  z-index: 5;
}

.tagline::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary-green),
    transparent
  );
  opacity: 0;
  animation: fadeIn 0.8s ease-out 0.6s forwards;
}

/* Footer - always at bottom */
#footer {
  flex-shrink: 0;
  margin-top: auto;
}

/* Animations */
@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes popOutThenSettle {
  0% {
    opacity: 0;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1.05);
  }
}

@keyframes subtle-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
