/* Cats section container adjustment */
#cats {
  padding-top: 1.5rem !important; /* Override default container padding */
  pointer-events: auto;           /* Re-enable clicks (parent has pointer-events: none) */
}

.cats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 2rem;
}

.cats-grid img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  border-radius: 6px;
}

/* Cat wrapper with fixed aspect ratio */
.cat-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}

/* Skeleton loading states - positioned as overlay */
.skeleton {
  position: absolute;
  inset: 0;
  background: #e4e4e4;
  border-radius: 6px;
  pointer-events: none;
}

.cats-modal {
  display: none;               /* hidden until opened */
  position: fixed;
  z-index: 1050;               /* above bootstrap nav */
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
}

.cats-modal-content {
  position: absolute;
  width: 90vmin;
  height: 90vmin;
  max-width: 90%;
  max-height: 90%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 6px;
  object-fit: cover;
}

.cats-close {
  position: absolute;
  top: 16px; right: 24px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
}

/* Button styling to match nav buttons */
.cats-button-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.cats-refresh-btn {
  position: relative;
  display: inline-block;
  font-family: var(--font-nav);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 16px;
  border: 2px solid var(--black);
  border-radius: 16px;
  text-decoration: none;
  z-index: 0;
  cursor: pointer;
  background: transparent;
  
  /* Text is always page background color */
  color: var(--page-bg);
  transition: color var(--transition-fast);
}

/* Base fill: solid black rectangle under text */
.cats-refresh-btn::after {
  content: "";
  position: absolute;
  inset: -1px;
  background: var(--black);
  z-index: -2;
  border-radius: inherit;
  transition: background var(--transition-theme);
}

/* Hover fill: page background, hidden by default */
.cats-refresh-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--page-bg);
  opacity: 0;
  z-index: -1;
  border-radius: 14px;
  transition: opacity var(--transition-fast),
              background var(--transition-theme);
}

/* Hover state: invert colors */
.cats-refresh-btn:hover,
.cats-refresh-btn:focus-visible {
  color: var(--black);
  transition: color var(--transition-fast);
}

.cats-refresh-btn:hover::before,
.cats-refresh-btn:focus-visible::before {
  opacity: 1;
}

/* Theme fade override - slow transition during theme changes */
body.theme-fade .cats-refresh-btn {
  transition: color var(--transition-theme);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .cats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 750px) {
  /* Reduce excessive container padding on mobile */
  #cats {
    padding: 1.5rem 1rem !important;
  }
  
  /* Add more space between grid and button on mobile */
  .cats-grid {
    margin-bottom: 3rem;
  }
  
  /* Ensure modal image respects viewport constraints */
  .cats-modal-content {
    width: 80vmin !important;
    height: 80vmin !important;
    max-width: 95vw !important;
    max-height: 80vh !important;
  }
}

@media (max-width: 480px) {
  .cats-grid {
    grid-template-columns: 1fr;
  }
  
  /* Even more conservative modal sizing on small screens */
  .cats-modal-content {
    width: 70vmin !important;
    height: 70vmin !important;
    max-width: 90vw !important;
    max-height: 70vh !important;
  }
}