
/* Global Search Bar */
.global-search-container {
  position: relative;
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  z-index: 100;
  transition: box-shadow 0.3s ease, border-bottom-color 0.3s ease;
}

@media (hover: hover) {
  .global-search-container:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-bottom-color: var(--accent);
  }

  .global-search-container:hover .global-search-bar {
    transform: translateY(-1px);
  }
}

.global-search-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  transition: transform 0.2s ease;
}

/* Compact search bar for citations and glossary pages */
body[data-page-title="Citations"] .global-search-bar,
body[data-page-title*="Glossary"] .global-search-bar {
  max-width: 600px;
  padding: 0.5rem 1rem;
}

body[data-page-title="Citations"] .global-search-container,
body[data-page-title*="Glossary"] .global-search-container {
  border-bottom-width: 1px;
}

#globalSearchInput {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid #d0d0d0;
  border-radius: 16px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  font-family: "Poppins", sans-serif;
  background-color: #fafafa;
}

@media (hover: hover) {
  #globalSearchInput:hover {
    border-color: var(--accent);
    background-color: #ffffff;
  }
}

#globalSearchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
  background-color: #ffffff;
}

/* Compact input for citations and glossary */
body[data-page-title="Citations"] #globalSearchInput,
body[data-page-title*="Glossary"] #globalSearchInput {
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
}

body[data-page-title="Citations"] #globalSearchButton,
body[data-page-title*="Glossary"] #globalSearchButton {
  padding: 0.5rem 0.8rem;
}

#globalSearchButton {
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

@media (hover: hover) {
  #globalSearchButton:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px color-mix(in srgb, var(--accent) 30%, transparent);
  }
}

#globalSearchButton:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-width: 1200px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 101;
}

/* Compact search results for citations and glossary */
body[data-page-title="Citations"] .search-results,
body[data-page-title*="Glossary"] .search-results {
  max-width: 600px;
}

.search-results.active {
  display: block;
}

.search-results-list {
  padding: 0.5rem 0;
}

.search-result-item {
  padding: 1rem 1.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

.search-result-item:last-child {
  border-bottom: none;
}

@media (hover: hover) {
  .search-result-item:hover {
    background: #f5f5f5;
  }
}

.search-result-item:active {
  background: #eeeeee;
}

.search-result-item.current-page {
  background: #e8f5e9;
  border-left: 3px solid var(--accent);
}

.search-result-item h4 {
  margin: 0 0 0.3rem 0;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
}

.search-result-item p {
  margin: 0;
  color: #666;
  font-size: 0.85rem;
}

.search-snippet {
  margin: 0.5rem 0 0 0;
  color: #555;
  font-size: 0.85rem;
  line-height: 1.5;
  font-style: italic;
}

.search-snippet mark {
  background-color: #ffeb3b;
  color: #1e1919;
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
  font-weight: 600;
  font-style: normal;
}

/* Highlighting for search results on page */
mark.search-highlight {
  background-color: #ffeb3b;
  color: #1e1919;
  padding: 0.15rem 0.2rem;
  border-radius: 3px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  animation: highlightPulse 0.6s ease-in-out;
}

@keyframes highlightPulse {
  0%, 100% {
    background-color: #ffeb3b;
  }
  50% {
    background-color: #ffc107;
  }
}

.search-no-results {
  padding: 1.5rem;
  text-align: center;
  color: #999;
}

/* Search Filters */
.search-filters {
  padding: 1rem;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.filter-label {
  font-weight: 600;
  color: #555;
  font-size: 0.9rem;
  margin-right: 0.5rem;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filter-title {
  font-weight: 500;
  color: #666;
  font-size: 0.85rem;
  margin-right: 0.25rem;
}

.filter-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid #d0d0d0;
  border-radius: 12px;
  background: #ffffff;
  color: #555;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Poppins", sans-serif;
}

.filter-btn:hover {
  border-color: var(--accent);
  background: #f0f7ff;
  color: var(--accent);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-btn.active:hover {
  background: var(--accent-dark);
}

/* Enhanced search highlight animation */
mark.search-highlight {
  background-color: #ffeb3b;
  color: #1e1919;
  padding: 0.15rem 0.2rem;
  border-radius: 3px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  animation: highlightPulse 0.6s ease-in-out;
  transition: background-color 0.3s ease;
}

mark.search-highlight:hover {
  background-color: #ffc107;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Header styling */
header {
  background-color: #2c3e50; /* dark blue-gray */
  color: #ecf0f1;           /* light text */
  padding: 1rem 2rem;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  position: relative;
}

.header-left {
  flex: 0 0 auto;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header-right {
  flex: 0 0 auto;
}

/* Home button styling */
.home-button {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #ffffff;
  color: var(--accent);
  text-decoration: none;
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  border: 1px solid #d0d0d0;
}

@media (hover: hover) {
  .home-button:hover {
    background: #e8f5e9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  }
}

.home-button:active {
  background: #e8f5e9;
  transform: translateY(0);
}

/* Dynamic page title */
header h1#pageHeader {
  font-size: 2rem;
  margin: 0;
  text-align: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--accent); /* accent color */
}

/* Navigation styling */
header nav {
  display: flex;
  gap: 1.5rem;
}

header nav a {
  color: #ecf0f1;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.2s;
}

@media (hover: hover) {
  header nav a:hover {
    color: var(--accent);
  }
}

header nav a:active {
  color: var(--accent);
}




/* CSS Custom Properties for Theme Colors */
:root {
  --accent: #2E7D32;
  --accent-dark: #1b5e20;
  --accent-light: #70a598;
}

/* Reset & body */
* { box-sizing: border-box; margin:0; padding:0; }
body { font-family:"Poppins", sans-serif; background:#fafafa; color:#333; display:flex; flex-direction:column; min-height:100vh; }

/* Gallery container */
/* .gallery-container { position: relative; width:100%; height:400px; overflow:hidden; } */

/* .gallery-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  transition: height 0.5s ease;
} */

/* Shared gallery container */
.gallery-container {
  position: relative;
  width: 100%;
  background: #000;
  color: white;
}

/* Main page gets the tall hero banner */
body[data-page-type="main"] .gallery-container {
  height: 400px;
  overflow: hidden;
}

/* Subpages get a short header */
body[data-page-type="sub"] .gallery-container,
.gallery-container， {
  height: 70px;
  overflow: hidden; /* Keep cards within container bounds */
}

/* 
.gallery-container::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
} */
/* Gallery row */
.gallery { display:flex; flex-wrap:nowrap; width:100%; height:100%; position:relative; overflow:hidden; }

/* Bug cards */
.header-card { flex:1; position:relative; overflow:hidden; cursor:pointer; transition: transform 0.3s ease, filter 0.3s ease, flex 0.3s ease; transform: scale(1); filter: brightness(0.7) grayscale(0.6); transform-origin: center center; }
/* Hover effects only for devices that support hover (not touch-only devices) */
@media (hover: hover) {
  .header-card:hover { transform: scale(1.05); z-index:2; filter: brightness(1.5) grayscale(0); flex: 1.15; transform-origin: center center; }
}

/* Touch-friendly active states */
.header-card:active {
  transform: scale(1.02);
  filter: brightness(1.2) grayscale(0);
  transition: transform 0.1s ease, filter 0.1s ease;
}
.header-card img { width:100%; height:100%; object-fit:cover; display:block; }
.header-card img.small { object-fit: fill; }

/* Home button in gallery nav */
.nav-home-button {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: #ffffff;
  color: var(--accent);
  text-decoration: none;
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
  pointer-events: none;
  border: 1px solid #d0d0d0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Hover effects only for devices that support hover */
@media (hover: hover) {
  .gallery-container:hover .nav-home-button {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-home-button:hover {
    background: #e8f5e9;
    transform: translateY(-1px);
  }
}

/* Touch-friendly: Always show home button on touch devices */
@media (hover: none) {
  .nav-home-button {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

.nav-home-button:active {
  background: #e8f5e9;
  transform: translateY(0);
}

/* Overlay */
.overlay { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; background: transparent; color:#fff; opacity:0; text-align:center; transition:opacity 0.5s ease; text-shadow: 2px 2px 8px rgba(0,0,0,0.8); }

@media (hover: hover) {
  .header-card:hover .overlay { opacity:1; }
}

/* Touch-friendly: Show overlay on tap */
.header-card:active .overlay {
  opacity: 0.8;
}
.overlay h2 { font-size:1.4rem; font-weight:700; }
.overlay p { font-size:0.95rem; font-style:italic; margin-top:0.3rem; opacity:0.9; }

/* Intro banner */
.intro-banner {
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  z-index:5;
  text-align:center;
  pointer-events:none;
  color:#fff;
  font-size:2rem;
  font-weight:700;
  background: rgba(0,0,0,0.35);
  padding:0.5rem 1rem;
  border-radius:8px;
  transition: top 0.8s ease;
}


/* Top-left & bottom-right texts */
.gallery-text { position:absolute; color:#fff; font-weight:700; text-shadow:1px 1px 4px rgba(0,0,0,0.7); z-index:6; pointer-events:none; padding:1rem; transition:opacity 0.4s ease; }
.gallery-text.top-left { top:0; left:0; font-size:1.6rem; }
.gallery-text.bottom-right { bottom:0; right:0; font-size:1.1rem; }

/* Fade texts on hover */
@media (hover: hover) {
  .header-card:hover ~ .gallery-text.top-left,
  .header-card:hover ~ .gallery-text.bottom-right,
  .gallery-container:hover .gallery-text { opacity:0; }
}


/* Slideshow Section Below Hero */
.slideshow-section { width:100%; padding:2rem 0; background:#f8f5f5; color:#1e1919; display:flex; flex-direction:column; align-items:center; }


/* Slideshow container */
.slideshow-container {
  display: flex;
  width: 90%;
  max-width: 1200px;
  gap: 2rem;
  align-items: stretch; /* Make both columns same height */
  margin: 0 auto;
}

/* Left Column: Image and Buttons */
.image-column {
  flex: 0 0 33.33%; /* 1/3 width */
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%; /* Fill container height */
}

.insect-image-container {
  width: 100%;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  flex: 1; /* Fill remaining space after buttons */
  min-height: 400px; /* Minimum height to ensure visibility */
}

/* Slideshow gallery */
.slideshow-gallery {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%; /* Fill parent container */
  overflow: hidden;
}

/* Buttons below image in left column */
.image-column .slideshow-buttons {
  display: flex;
  gap: 0.8rem;
  position: relative;
  width: 100%;
}

.slideshow-buttons button {
  flex: 1;
  padding: 0.6rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  color: #1e1919;
  background: #e0e0e0;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

@media (hover: hover) {
  .slideshow-buttons button:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
  }
}

.slideshow-buttons button:active {
  background: #c0c0c0;
  transform: translateY(0);
}

/* Each slide */
.slide {
  position: absolute;   /* stacked slides */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease;
}

.slide.active {
  opacity: 1;
}

/* Slide image */
.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Text section */
.text-section {
  flex: 0 0 66.67%; /* 2/3 width */
  padding: 1.5rem 2rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-family: "Poppins", sans-serif;
  height: 100%; /* Fill container height */
}

.text-section h3 { margin-bottom:0.5rem; font-size:1.8rem; 
  font-weight: 700;
  color: var(--accent); /* green accent for insect theme */
  margin-bottom: 0.5rem;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.2); /* subtle depth */}

.text-content {
  max-width: 100%;      /* fill parent width */
  margin: 0;            /* handled by container padding */
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.98) 100%);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  line-height: 1.8;
  font-size: 1.05rem;
  color: #2c3e50;
  font-family: "Poppins", sans-serif;
  border: 1px solid color-mix(in srgb, var(--accent) 10%, transparent);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

/* Text content hover only for hover-capable devices */
@media (hover: hover) {
  .text-content:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
  }
}

.text-content p {
  margin-bottom: 1.4rem;   /* space between paragraphs */
  font-size: 1.05rem;
  line-height: 1.8;
  color: #2c3e50;
  text-align: justify;
  text-justify: inter-word;
  letter-spacing: 0.01em;
}

.text-content p:first-child {
  margin-top: 0;
}

.text-content p:last-child {
  margin-bottom: 0;
}

/* Style italicized scientific names and citations */
.text-content p i,
.text-content p em {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
}

/* Optional: highlight insect names */
.text-content p span.insect-name {
  font-weight: 700;
  color: #388E3C; /* darker green for species names */
}

/* Style links within text-content */
.text-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  transition: color 0.2s ease, border-color 0.2s ease;
}

@media (hover: hover) {
  .text-content a:hover {
    color: var(--accent-dark);
    border-bottom-color: var(--accent-dark);
  }
}

.text-content a:active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent-dark);
} 

@media screen and (max-width: 768px) {
  .slideshow-container {
    flex-direction: column;
  }

  .image-column,
  .text-section {
    flex: 0 0 100%;
  }

  .slideshow-gallery {
    padding-bottom: 56.25%; /* 16:9 aspect ratio on mobile */
  }
}

/* Glossary term styling */
.glossary-term {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  position: relative;
  border-bottom: 1px dashed var(--accent);
  transition: color 0.2s ease;
  touch-action: manipulation; /* Better touch handling - prevents double-tap zoom delay */
}

@media (hover: hover) {
  .glossary-term:hover {
    color: var(--accent-dark);
  }
}

.glossary-term:active {
  color: var(--accent-dark);
}

/* Tooltip style - only use data-title to avoid duplicate tooltips */
.glossary-term::after {
  content: attr(data-title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.9);
  color: #fff;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  white-space: normal;
  max-width: 200px;
  min-width: 100px;
  width: max-content;
  word-wrap: break-word;
  overflow-wrap: break-word;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10000;
  line-height: 1.3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  text-align: left;
}


/* Ensure parent containers don't clip tooltips */
.bug-card,
.species-card,
.bug-card-content,
.species-card-content,
.subpage-hero-description,
.text-content,
.bug-card-description,
.species-card-description {
  overflow: visible !important;
}

/* Tooltip arrow pointing to the term */
.glossary-term::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(0,0,0,0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1001;
}

/* Show tooltip only on hover-capable devices */
@media (hover: hover) {
  .glossary-term:hover::after,
  .glossary-term:hover::before {
    opacity: 1;
  }
}

/* Subpage Hero Section */
.subpage-hero {
  display: flex;
  gap: 2.5rem;
  padding: 3rem 5%;
  max-width: 1400px;
  margin: 0 auto;
  align-items: center;
  min-height: 400px;
}

.subpage-hero-image {
  flex: 0 0 35%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 500px;
}

.subpage-hero-image img {
  width: 100%;
  height: auto;
  max-height: 450px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  display: block;
}

.subpage-hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0; /* Allows text to wrap properly */
}

.subpage-hero-title {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  line-height: 1.2;
}

.subpage-hero-subtitle {
  font-size: 1.5rem;
  color: #666;
  font-style: italic;
  margin: 0;
}

.subpage-hero-description {
  margin-top: 1rem;
}

/* Bug Cards Section */
.bug-cards-section,
.species-cards-section {
  padding: 3rem 5%;
  background: #fafafa;
}

.bug-cards-container,
.species-cards-container {
  max-width: 1400px;
  margin: 0 auto;
}

.bug-cards-heading,
.species-cards-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2rem;
  text-align: center;
}

.bug-cards-grid,
.species-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

/* Bug Card */
.bug-card,
.species-card {
  background: #ffffff;
  border-radius: 12px;
  overflow: visible; /* Changed from hidden to allow tooltips to escape */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative; /* Ensure positioning context */
}

/* Bug card hover only for hover-capable devices */
@media (hover: hover) {
  .bug-card:hover,
  .species-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }
}

/* Touch-friendly active state for bug cards */
.bug-card:active,
.species-card:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.bug-card-image,
.species-card-image {
  width: 100%;
  height: 250px;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 0.9rem;
  overflow: hidden; /* Keep images clipped */
  position: relative; /* Maintain clipping for images */
  z-index: 1; /* Images below content */
  border-radius: 12px 12px 0 0; /* Match top corners of card */
}

.bug-card-image div {
  text-align: center;
}

.bug-card-image img,
.species-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bug-card-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative; /* Positioning context for tooltips */
  z-index: 2; /* Content above images */
  overflow: visible; /* Allow tooltips to escape */
}

.bug-card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
  margin: 0;
}

.bug-card-scientific {
  font-size: 1rem;
  color: var(--accent);
  font-style: italic;
  margin: 0;
}

.bug-card-description {
  margin-top: 0.5rem;
  flex: 1;
}

.bug-card-description p {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: #555;
  font-size: 0.95rem;
}

.bug-card-description p:last-child {
  margin-bottom: 0;
}

/* Responsive styles for subpages */
@media screen and (max-width: 968px) {
  .subpage-hero {
    flex-direction: column;
    padding: 2rem 3%;
    align-items: center;
    min-height: auto;
  }

  .subpage-hero-image {
    flex: 0 0 auto;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }

  .subpage-hero-image img {
    max-height: 350px;
  }

  .subpage-hero-content {
    width: 100%;
    text-align: center;
  }

  .subpage-hero-title {
    font-size: 2.5rem;
  }

  .bug-cards-grid,
  .species-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
  }
}

@media screen and (max-width: 768px) {
  .subpage-hero {
    padding: 1.5rem 2%;
  }

  .subpage-hero-title {
    font-size: 2rem;
  }

  .subpage-hero-subtitle {
    font-size: 1.2rem;
  }

  .bug-cards-section,
  .species-cards-section {
    padding: 2rem 2%;
  }

  .bug-cards-heading,
  .species-cards-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
  }

  .bug-cards-grid,
  .species-cards-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

footer { 
  position: fixed; 
  bottom: 0; 
  left: 0; 
  padding: 0.5rem 1rem; 
  background: rgba(224,224,224,0.85); 
  font-size: 0.8rem; 
  color: #333; 
  border-top-right-radius: 8px; 
  box-shadow: 2px -2px 5px rgba(0,0,0,0.1); 
  z-index: 5;  
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.footer-left {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Made with Love styling */
.made_by {
  font-weight: 400;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s ease;
  user-select: none;
  display: inline;
  margin-left: 0.3em;
}

.made_by:hover {
  transform: scale(1.05);
}

.made_by i.fas.fa-heart {
  color: var(--accent); /* Theme accent color */
  transition: color 0.3s ease;
}

.footer-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Show footer buttons only on subpages */
body[data-page-type="sub"] .footer-right {
  display: flex;
}

/* Hide footer buttons on main page */
body[data-page-type="main"] .footer-right {
  display: none;
}

.footer-right button {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1e1919;
  background: #ffffff;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

@media (hover: hover) {
  .footer-right button:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
  }
}

.footer-right button:active {
  background: #d0d0d0;
  transform: translateY(0);
}

  /* footer {
      text-align: left;
      padding: 0.5rem 1rem;
      background: #e0e0e0;
      font-size: 0.8rem;
      position: fixed;
      bottom: 0;
      left: 0;
      width: 100%;
    } */