:root {
  --white: #fff;
  --company-red: #e93325;
  --black: #000;
  --light-red: #FFA583;
  --grey: #f5f5f5;
}

/* Title section */

.title__container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  align-self: center;
  align-content: center;
  flex-wrap: wrap;
  background-color: #f5f5f5;
  height: 50vh;
  text-align: center;
}

.title__container h1 {
  font-size: 6rem;
  z-index: 2;
  transform: translateY(22px);
}

.title__container a {
  color: #000;
  font-size: 1.5rem;
  font-weight: bold;
  font-style: italic;
  margin-top: 2rem;
  z-index: 2;
  transition: all 0.3s ease;
}

@media screen and (max-width: 820px) {
  .title__container a {
    font-size: 1rem;
  }
}

.button__title {
  display: flex;
  gap:30px;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  padding: 10px 20px;
  height: 20%;
  width: 30%;
  border: none;
  outline: none;
  border-radius: 15px;
  background: #000;
  transition: all 0.3s ease;
  transform: translateY(22px);
}

.title__container a {
  color: #fff;
}

.button__title:hover {
  background: var(--company-red);
  transition: all 0.3s ease;
}

/* Card Container and Card Styling */

.container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 80px 80px; /* increased spacing */
  padding: 60px 60px;
}

.container .card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 400px;
  height: 320px;
  background: var(--grey);
  border-radius: 20px;
  transition: 0.5s;
  overflow: hidden;
  position: relative;
}

/* Image Box Styling */

.container .card .imgBx {
  margin-top: 20px;
  width: 300px;
  height: 200px;
  transform: scale(1);
  background: #fff;
  border: 1px solid var(--company-red);
  overflow: hidden;
  border-radius: 12px;
  transition: all 0.5s;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container .card .imgBx img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Project Title Styling (Always Visible) */

.container .card h2 {
  font-size: 1.6rem;
  font-weight: bold;
  color: var(--black);
  margin: 15px 0 10px;
  text-align: center;
  margin-bottom: 20px;
  transition: color 0.3s ease;
}

/* Hidden Content */

.container .card .content {
  padding: 0 20px 20px;
  text-align: left;
  width: 100%;
  /* opacity: 0; */
  max-height: 0;
  transition: all 0.5s ease;
}

.container .card h3,
.container .card p {
  display: none;
}

/* Hover Effects */

.container .card:hover {
  height: 620px;
  box-shadow: 0 6px 20px rgba(233, 51, 37, 0.55);
}

.container .card:hover .imgBx {
  transform: scale(0.85) translateY(-20px);
  box-shadow: 0 6px 20px rgba(233, 51, 37, 0.55);
}

.container .card:hover .content {
  opacity: 1;
  max-height: 1000px;
  overflow: visible;
}

/* Show text on hover */

.container .card:hover h3,
.container .card:hover p {
  display: block;
  margin: 10px 0;
  color: var(--black);
  font-size: 0.95rem;
  line-height: 1.4rem;
}

/* --- Mobile-Friendly Adjustments --- */
@media screen and (max-width: 820px) {
  .container {
    gap: 40px 40px;
    padding: 30px 20px;
  }

  .container .card {
    width: 90%;
    height: auto;
    min-height: 320px;
  }

  .container .card .imgBx {
    width: 90%;
    height: auto;
    aspect-ratio: 4 / 3; /* Keeps proportional */
  }

  .container .card .imgBx img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

/* --- Touch/Tap Expansion --- */
@media (hover: none) and (pointer: coarse) {
  .container .card {
    cursor: pointer;
  }

  /* Remove hover dependency, use focus-within for tap */
  .container .card:focus-within,
  .container .card.active {
    height: 620px;
    box-shadow: 0 6px 20px rgba(233, 51, 37, 0.55);
  }

  .container .card:focus-within .imgBx,
  .container .card.active .imgBx {
    transform: scale(0.85) translateY(-20px);
    box-shadow: 0 6px 20px rgba(233, 51, 37, 0.55);
  }

  .container .card:focus-within .content,
  .container .card.active .content {
    opacity: 1;
    max-height: 1000px;
    overflow: visible;
  }

  .container .card:focus-within h3,
  .container .card:focus-within p,
  .container .card.active h3,
  .container .card.active p {
    display: block;
    margin: 10px 0;
    color: var(--black);
    font-size: 0.95rem;
    line-height: 1.4rem;
  }
}

@media screen and (max-width: 820px) {
  .title__container h1 {
    font-size: 3rem; /* smaller but still prominent */
    transform: none; /* remove downward shift */
    line-height: 1.2;
    padding: 0 10px; /* prevent text from touching edges */
  }
}

@media screen and (max-width: 820px) {
  .button__title {
    width: 60%; /* wider for phones/tablets */
  }
}
