/* =========================================
   BENTO GRID FINAL (Responsive Fixed)
   ========================================= */

/* 1. The Wrapper */
#bento-zone {
  display: block;
  width: 100%;
  margin: 65px 0 300px 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: transparent;

  /* Initial GSAP state */
  opacity: 0;
  transform: translateY(100px);
}

/* 2. The Grid System */
.bento-grid {
  display: grid;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  gap: 3px;

  /* CRITICAL FIX: 'dense' allows the grid to fill gaps on Tablet & Desktop */
  grid-auto-flow: dense;

  /* MOBILE DEFAULT: 1 Column */
  grid-template-columns: 1fr;
  grid-auto-rows: 250px;
}

/* 3. The Items */
.bento-item {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--primary-color);
  overflow: hidden;
  margin: 0;
}

/* --- RESPONSIVENESS --- */

/* TABLET (Min 600px): 2 Columns */
@media (min-width: 600px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 300px;
  }
  /* Spans allowed on tablet+ */
  .bento-item.wide {
    grid-column: span 2;
  }
  .bento-item.tall {
    grid-row: span 2;
  }
}

/* DESKTOP (Min 1024px): 4 Columns */
@media (min-width: 1024px) {
  .bento-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- IMAGES --- */
.bento-item > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.4s ease, transform 0.6s ease;
}

/* --- TITLES --- */
.bento-title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -20%); /* Start slightly lower */
  width: 100%;
  text-align: center;
  color: #fff;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 1.8rem;
  z-index: 20;
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);

  /* Hidden by default */
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* --- INTERACTION RULES --- */

/* DESKTOP HOVER (Min 1025px) */
@media (min-width: 1025px) {
  .bento-item:hover > img {
    /* filter: brightness(0.8); */
    transform: scale(1.05);
  }
  .bento-item:hover .bento-title {
    opacity: 1;
    transform: translate(-50%, -50%); /* Slide UP to center */
  }
}

/* MOBILE DISPLAY (Max 1024px) */
@media (max-width: 1024px) {
  .bento-title {
    opacity: 1 !important;
    transform: translate(-50%, -50%) !important; /* Force Centered */
  }
  .bento-item > img {
    filter: brightness(0.85) !important;
  }
}

/* --- FLASH MESSAGES (Currently Hidden) --- */
.flash-message {
  display: none !important; /* DISABLED FOR NOW */

  position: absolute;
  inset: 0;
  z-index: 50;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;

  background-color: rgba(10, 40, 90, 0.95);
  color: #fff;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 1.4rem;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, background-color 0.4s ease;
}

.flash-message.is-visible {
  opacity: 1;
  pointer-events: auto;
}

a.flash-message:hover {
  text-decoration: underline;
  background-color: rgba(10, 40, 90, 1);
}

.flash-message img {
  max-width: 60%;
  max-height: 60%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* BENTO EXPANSION STYLES */
#bento-zone {
  position: relative;
  z-index: 10;
  overflow: visible;
  /* Allow overlay to burst out if needed, though we use fixed */
}

.bento-item {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.bento-item:hover {
  /* transform: scale(0.98); */
}

/* Fixed Overlay Layer */
.bento-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: none;
  /* Hidden by default */
  flex-direction: column;
  overflow: hidden;
  font-family: "Inter", sans-serif;
  /* Assuming font availability */
}

.bento-overlay.active {
  display: flex;
}

/* Background (Darken) */
.bento-overlay-bg {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  z-index: 0;
}

/* Hero Image Wrapper */
.bento-overlay-img-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50vh;
  /* Takes top half */
  z-index: 1;
  overflow: hidden;
}

.bento-overlay-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Content Area */
.bento-overlay-content {
  position: absolute;
  top: 50vh;
  left: 0;
  right: 0;
  bottom: 0;
  background: #111;
  z-index: 2;
  padding: 40px;
  opacity: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Title Styling */
.bento-overlay-title {
  position: absolute;
  z-index: 10;
  color: white;
  font-size: 4rem;
  font-weight: 800;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
  /* Initial Position will be set by JS usually, but here is final */
  top: 40vh;
  left: 40px;
  transform: translateY(-50%);
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.bento-overlay-subtitle {
  color: #aaa;
  font-size: 1.2rem;
  max-width: 600px;
}

.bento-overlay-text {
  color: #ddd;
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 800px;
}

/* Actions */
.bento-overlay-actions {
  margin-top: 30px;
  display: flex;
  gap: 20px;
}

.bento-btn {
  padding: 12px 30px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.bento-btn-primary {
  background: white;
  color: black;
}

.bento-btn-primary:hover {
  background: #ccc;
  transform: translateY(-2px);
}

.bento-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.bento-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Close Button */
.bento-close-btn {
  position: absolute;
  top: 30px;
  right: 30px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  border: 1px solid rgba(255, 255, 255, 0.2);
  opacity: 0;
}

.bento-close-btn:hover {
  background: white;
  color: black;
}
