
/* CSS Variables */
:root {
  --bg-color: #121212;            /* body background */
  --text-color: #ffffff;          /* body text */
  --box-bg: #1f1f1f;              /* default box background */
  --box-hover-bg: #2a2a2a;        /* box hover background */
  --box-border-hover: #00c8ff;    /* hover border color */
  --box-shadow-hover: rgba(0, 200, 255, 0.2); /* hover glow */
  --title-hover-color: #00c8ff;   /* title & desc hover color */
  --padding: 15px;                /* box content padding */
  --gap: 20px;                    /* grid gap */
  --border-radius: 12px;          /* box border radius */
  --box-width: 400px;             /* fixed box width */
  --box-height: 280px;            /* fixed box height including title + desc */
}

/* Global Styles */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  padding: 20px;
}

h1 {
  margin-bottom: 40px;
  text-align: center;
}

/* Grid Container */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--box-width), var(--box-width)));
  gap: var(--gap);
  width: 100%;
  justify-content: center; /* center boxes */
}

/* Box Styles */
.box {
  background-color: var(--box-bg);
  border-radius: var(--border-radius);
  border: 2px solid transparent;
  overflow: hidden;
  text-align: center;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text-color);
  width: var(--box-width);
  height: var(--box-height);
}

/* Hover Effect */
.box:hover {
  background-color: var(--box-hover-bg);
  border-color: var(--box-border-hover);
  box-shadow: 0 0 15px var(--box-shadow-hover);
}

/* Image inside box */
.box img {
  width: 100%;
  height: 65%;           /* leave space for title + desc */
  object-fit: cover;
  transition: opacity 0.3s ease;
}

/* Slight dim image on hover for contrast */
.box:hover img {
  opacity: 0.9;
}

/* Inner content container */
.box-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 15px 20px;    /* extra spacing from edges */
}

/* Box title */
.box-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 8px;    /* space between title and description */
  transition: color 0.3s ease;
}

/* Box description */
.box-desc {
  font-size: 0.9rem;
  color: #cccccc;         /* lighter text */
  line-height: 1.4;       /* easier to read */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;  /* limit to 3 lines on desktop */
  -webkit-box-orient: vertical;
  transition: color 0.3s ease;
}

/* Hover: title & description color */
.box:hover .box-title,
.box:hover .box-desc {
  color: var(--title-hover-color);
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr; /* full-width boxes */
    justify-items: stretch;
  }

  .box {
    width: 100%;   /* fill container width */
    height: auto;  /* adjust height automatically */
  }

  .box img {
    height: auto;  /* responsive image height */
  }

  .box-content {
    padding: 12px 15px;  /* slightly smaller padding on mobile */
  }

  .box-title {
    font-size: 1rem;
  }

  .box-desc {
    font-size: 0.85rem;
    -webkit-line-clamp: 5; /* allow more lines on mobile */
  }
}
