:root {
  font-size: clamp(12px, calc(0.5vw + 0.5vh + 0.5vmin), 16px); /* More controlled fluid typography */
}

body {
  display: grid;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Montserrat', sans-serif;
  overflow-x: hidden;
}

/* Animation - Simplified with modern prefixes */
@keyframes darwin {
  0% {
    opacity: 0.2;
    filter: blur(10px);
  }
  25% {
    opacity: 0.4;
  }
  50%, 75% {
    opacity: 0.8;
  }
  100% {
    opacity: 1;
    filter: blur(0);
  }
}

/* Navigation */
.navheads {
  position: absolute;
  z-index: 9999;
  width: 100%;
}

/* Cover Section - Improved Grid Layout */
.cover {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  min-height: 70vh;
  gap: 1rem;
  padding: 1rem;
  z-index: 1;
}

.covimg {
  display: flex;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  width: 100%;
  min-height: 200px;
  font-size: clamp(1.5rem, 5vmin, 2.5rem);
  color: white;
  justify-content: center;
  align-items: flex-end;
  opacity: 0.1;
  transition: opacity 0.3s ease;
}

/* Animation Classes */
.evo {
  animation: darwin 0.75s ease-in forwards;
}

.trans {
  animation: darwin 0.75s ease-in 0.75s forwards;
}

.dom {
  animation: darwin 0.75s ease-in 1.5s forwards;
}

/* Text Elements */
.imgtxt {
  margin-top: 1rem;
  font-weight: 800;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 0.5rem 1rem;
  width: 100%;
  text-align: center;
}

.covtxt {
  font-size: clamp(0.8rem, 2vmin, 1rem);
  margin: 5vh auto;
  max-width: 90%;
  text-align: center;
}

/* Portfolio Grid */
.sight, 
.portfolio-items-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 1rem;
  padding: 1rem;
}

.portfolio-item-wrapper {
  position: relative;
  aspect-ratio: 1/1; /* Maintain square ratio */
  overflow: hidden;
}

.portfolio-img-background {
  background-size: cover;
  background-position: center;
  height: 100%;
  width: 100%;
  border: 1px solid #808080;
  background-color: rgba(0, 0, 0, 0.2);
  color: white;
  transition: filter 0.3s ease;
}

.img-text-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.portfolio-item-wrapper:hover .img-text-wrapper {
  opacity: 1;
}

.subtitle {
  color: transparent;
  transition: color 0.3s ease;
  font-size: clamp(0.8rem, 2vmin, 1rem);
}

.portfolio-item-wrapper:hover .subtitle {
  color: lightseagreen;
  font-weight: 600;
}

.image-blur {
  filter: brightness(10%);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .cover {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  
  .covimg {
    min-height: 150px;
    aspect-ratio: 16/9;
  }
  
  .sight, 
  .portfolio-items-wrapper {
    grid-template-columns: 1fr;
  }
}

@media (hover: none) {
  .img-text-wrapper {
    opacity: 1;
    background: rgba(0, 0, 0, 0);
  }
  
  .subtitle {
    color: rgb(182, 238, 235);
    background: rgba(0, 0, 0, 0.7);
  }
}