/* ==========================================================
   Global Layout / Grid + Alternating Two-Column Sections
   ========================================================== */

/* --- General Grid Template --- */
.grid-template-main {
  padding: 60px;
  min-height: calc(100vh - 160px);
  text-align: center;
}

/* --- Responsive Grid Container --- */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 60px 60px;
  width: 80%;
  max-width: 900px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .grid-container {
    max-width: 600px;
  }
}

@media (max-width: 600px) {
  .grid-container {
    max-width: 300px;
  }
}

/* --- Grid Items --- */
.grid-item {
  display: block;
  background: #333;
  padding: 15px;
  border-radius: 8px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  text-align: center;
  text-decoration: none;
  color: #fff;
  will-change: transform;
}

.grid-item:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.45);
}

.grid-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center;
  background-color: #d3d3d3;
  border-radius: 4px;
  transition: transform 0.25s ease;
}

.grid-item:hover img {
  transform: scale(1.05);
}

.grid-item p {
  margin: 6px 0;
  font-size: 0.9rem;
  line-height: 1.2;
  transition: transform 0.25s ease;
}

.grid-item:hover p {
  transform: scale(1.04);
}

/* ==========================================================
   Alternating Two-Column Section Layout (.alt-row)
   ========================================================== */

.alt-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  overflow: hidden;

  /* fade-in animation */
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease-out forwards;
}

/* Stagger fade-in delays */
.alt-row:nth-of-type(1) { animation-delay: 0.1s; }
.alt-row:nth-of-type(2) { animation-delay: 0.3s; }
.alt-row:nth-of-type(3) { animation-delay: 0.5s; }
.alt-row:nth-of-type(4) { animation-delay: 0.7s; }

/* Flip direction for every even section (desktop only) */
.alt-row:nth-of-type(even) {
  flex-direction: row-reverse;
}

/* Columns: exactly 50% each */
.alt-row .col {
  width: 50%;
  flex: 0 0 50%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Image behavior */
.alt-row .image {
  overflow: hidden;
}

.alt-row .image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  margin: 0;
  vertical-align: bottom;
}

/* Rounded corners only on outer edges */
.alt-row:nth-of-type(odd) .image img {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}
.alt-row:nth-of-type(even) .image img {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Eliminate any vertical gaps between sections */
.alt-row + .alt-row {
  margin-top: -1px; /* slight overlap to ensure touching */
}

/* ==========================================================
   Text content — minimal margins, always left aligned, wraps naturally
   ========================================================== */

.alt-row .text {
  display: block;
  padding: 12px 18px 20px 18px;
  margin: 0;
  box-sizing: border-box;
  text-align: left;
  line-height: 1.3;
}

.alt-row .text.right {
  text-align: left;
  padding: 12px 18px 20px 18px;
}

/* Headings and body share alignment baseline */
.alt-row .text span.hdr-text-left,
.alt-row .text span.hdr-text-right {
  display: block;
  font-size: 1.2rem;
  font-weight: 300;
  margin: 0 0 6px 0;
  line-height: 1.15;
  text-align: inherit;
  white-space: normal;
  word-wrap: break-word;
}

.alt-row .text p {
  margin: 0 0 8px 0;
  font-size: 1rem;
  line-height: 1.32;
  max-width: 540px;
}

/* =======================================
   Button styling (independent of body fade)
   ======================================= */
.alt-row .text input[type="button"] {
  background-color: #000;
  color: #fff;
  border: 2px solid #000;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.25rem;
  font-weight: 400;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-block;

  /* Animate only what we want */
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;

  /* 🔒 Prevent body color inheritance and transition bleed */
  position: relative;
  z-index: 1;
  color-scheme: only light;  /* ensures contrast consistency */
}

/* Force this element’s text color to ignore inherited transitions */
.alt-row .text input[type="button"] {
  color: #fff !important;         /* 🔒 ensures white text always */
  transition: background-color 0.25s ease, transform 0.25s ease !important;
}

/* Hover + focus effect */
.alt-row .text input[type="button"]:hover,
.alt-row .text input[type="button"]:focus {
  background-color: #fff;
  color: #000 !important;
  border-color: #000;
  transform: scale(1.08);
}

/* Optional: add a slight shadow on hover */
.alt-row .text input[type="button"]:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}


/* =======================================
   Responsive Behavior
   ======================================= */
@media (max-width: 900px) {
  .alt-row,
  .alt-row:nth-of-type(even) {
    flex-direction: column !important;
    align-items: flex-start;
  }

  .alt-row .col {
    width: 100%;
    flex: 1 1 100%;
  }

  .alt-row .text {
    padding: 20px 12px 18px 12px;
    text-align: left;
    max-width: 100%;
    line-height: 1.4;
  }

  .alt-row .text.right {
    text-align: left;
    padding: 20px 12px 18px 12px;
  }

  .alt-row .image img {
    border-radius: 12px;
    margin: 0;
  }

  /* Center and shrink button on stacked layout */
  .alt-row .text input[type="button"] {
    display: block;
    margin: 12px auto 0 auto;
    font-size: 0.9rem;
    padding: 8px 8px;
  }

  .alt-row .text input[type="button"]:hover {
    transform: scale(1.04);
  }

}

/* =======================================
   Fade-In Keyframes
   ======================================= */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =======================================
   Custom Rule — right-align text in last row
   ======================================= */
.alt-row:last-of-type .text {
  text-align: right;
}

