
/* MacroDivers protected nudibranch database test page */
.database-hero {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.48), rgba(0, 0, 0, 0.5)),
    url("../images/academy-nudibranchs-hero.webp");
  background-size: cover;
  background-position: center;
}

.database-test-note {
  background: #eef9fb;
  border: 1px solid #bde5ef;
  border-radius: 18px;
  padding: 1rem 1.1rem;
  margin: 0 0 1.3rem;
}

.database-lock {
  max-width: 680px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #d7e7ee;
  border-radius: 20px;
  padding: 1.4rem;
  box-shadow: 0 14px 35px rgba(0, 44, 60, 0.08);
}

.database-lock h2 {
  margin-top: 0;
}

.database-lock-form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: end;
}

.database-lock-form label {
  flex: 1 1 250px;
  font-weight: 700;
}

.database-lock-form input,
.database-filter-panel input,
.database-filter-panel select {
  width: 100%;
  border: 1px solid #bfd9e3;
  border-radius: 12px;
  padding: 0.78rem 0.85rem;
  font: inherit;
  background: #fff;
}

.database-lock-error {
  color: #9c2f1b;
  font-weight: 700;
  min-height: 1.4rem;
}

.database-app[hidden],
.database-lock[hidden] {
  display: none !important;
}

.database-controls-card {
  background: #ffffff;
  border: 1px solid #d7e7ee;
  border-radius: 22px;
  padding: 1.2rem;
  box-shadow: 0 12px 32px rgba(0, 44, 60, 0.06);
  margin-bottom: 1.4rem;
}

.database-status-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  color: #42616e;
  font-weight: 700;
}

.database-filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.database-filter-panel .wide {
  grid-column: 1 / -1 !important;
}

.database-reset-wrap {
  grid-column: 1 / -1 !important;
}

.database-filter-panel label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.92rem;
  font-weight: 800;
  color: #244b5a;
}

.database-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}

.species-card {
  background: #ffffff;
  border: 1px solid #d7e7ee;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 44, 60, 0.07);
  display: flex;
  flex-direction: column;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.species-card:hover,
.species-card:focus-within {
  border-color: #11b9d5;
  box-shadow: 0 16px 38px rgba(17, 185, 213, 0.22);
  transform: translateY(-2px);
}

.species-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e9f4f7;
}

.database-deferred-image {
  opacity: 0.72;
  transition: opacity 180ms ease;
}

.database-deferred-image.is-loaded {
  opacity: 1;
}

.species-card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.species-card h2 {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.2;
  font-style: italic;
}

.species-card .common-name {
  margin: 0.2rem 0 0;
  font-weight: 800;
  color: #55707d;
}

.species-card .previous-taxonomy {
  margin: 0.25rem 0 0;
  color: #55707d;
  font-size: 0.92rem;
  line-height: 1.35;
}

.species-meta {
  margin: 0;
  color: #55707d;
  font-weight: 650;
  line-height: 1.4;
}

.species-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.species-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cce3eb;
  background: #eef9fb;
  color: #07586b;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.species-tag.status-draft {
  background: #fff7e8;
  border-color: #efd19b;
  color: #8a5a00;
}

.species-tag.coral {
  background: #e9fff7;
  border-color: #b8e9d4;
  color: #006747;
}

.species-card details {
  border-top: 1px solid #e1eef3;
  padding-top: 0.75rem;
}

.species-card summary {
  cursor: pointer;
  font-weight: 900;
  color: #07586b;
}

.species-detail-block h3 {
  margin: 0.9rem 0 0.25rem;
  font-size: 1rem;
}

.species-detail-block p,
.species-detail-block li {
  font-size: 0.96rem;
  line-height: 1.55;
}

.species-detail-list {
  display: grid;
  gap: 0.45rem;
  margin: 0.5rem 0 0;
}

.species-detail-list div {
  display: grid;
  grid-template-columns: minmax(8rem, 0.42fr) 1fr;
  gap: 0.5rem;
  border-bottom: 1px solid #e1eef3;
  padding-bottom: 0.4rem;
}

.species-detail-list dt {
  color: #406170;
  font-weight: 800;
}

.species-detail-list dd {
  margin: 0;
}

.database-empty,
.database-warning {
  background: #fff;
  border: 1px solid #d7e7ee;
  border-radius: 18px;
  padding: 1.1rem;
}

.database-warning {
  background: #fff8e9;
  border-color: #efd19b;
}

@media (max-width: 920px) {
  .database-filter-panel {
    grid-template-columns: 1fr 1fr;
  }
  .database-filter-panel .wide,
  .database-reset-wrap {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .database-filter-panel {
    grid-template-columns: 1fr;
  }
  .database-filter-panel .wide,
  .database-reset-wrap {
    grid-column: 1 / -1;
  }
  .database-lock-form {
    display: block;
  }
  .database-lock-form .btn {
    margin-top: 0.75rem;
    width: 100%;
  }
}


/* V2 readability and photo lightbox fixes */
.species-card {
  color: #102f3d;
}

.species-card h2 {
  color: #0a4658;
  font-weight: 900;
}

.species-card .common-name,
.species-meta,
.species-detail-block,
.species-detail-block p,
.species-detail-block li,
.species-detail-block h3 {
  color: #163947;
}

.species-detail-block h3 {
  font-weight: 900;
  color: #0a4658;
}

.species-detail-block p,
.species-detail-block li {
  opacity: 1;
}

.species-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #e9f4f7;
  cursor: zoom-in;
  text-align: left;
}

.species-image-button:focus-visible {
  outline: 4px solid #11b9d5;
  outline-offset: -4px;
}

.species-image-button img {
  display: block;
}

.database-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: start center;
  padding: 1.2rem;
  background: rgba(0, 20, 32, 0.88);
  overflow-y: auto;
}

.database-lightbox[hidden] {
  display: none !important;
}

.database-lightbox-inner {
  position: relative;
  max-width: min(1200px, 96vw);
  width: min(1200px, 96vw);
  margin: auto 0;
}

#database-lightbox-image {
  display: block;
  max-width: 100%;
  max-height: min(62vh, 760px);
  margin: 0 auto;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  background: #ffffff;
}

.database-lightbox img {
  display: block;
}

.database-lightbox-caption {
  margin: 0.65rem 0 0;
  color: #ffffff;
  font-weight: 800;
  text-align: center;
}

.database-lightbox-close {
  position: absolute;
  top: -0.9rem;
  right: -0.9rem;
  width: 2.7rem;
  height: 2.7rem;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: #063c4c;
  font-size: 1.8rem;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.database-lightbox-close:focus-visible {
  outline: 3px solid #11b9d5;
}







/* Reset button placed inside the nudibranch database filter panel */
.database-reset-wrap {
  display: flex;
  align-items: end;
}

.database-reset-btn {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: #07566b;
  color: #ffffff;
  font-weight: 900;
  padding: 0.82rem 1.15rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 54, 68, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.database-reset-btn:hover,
.database-reset-btn:focus {
  background: #003f52;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 54, 68, 0.22);
}

.database-reset-btn:focus-visible {
  outline: 3px solid rgba(0, 160, 190, 0.35);
  outline-offset: 3px;
}


/* Private nudibranch database colour filter alignment */
#database-primary-colour,
#database-second-colour,
#database-third-colour {
  width: 100%;
}

/* Make the 1st, 2nd and 3rd colour controls equal size in the filter grid */
.database-filters label:has(#database-primary-colour),
.database-filters label:has(#database-second-colour),
.database-filters label:has(#database-third-colour),
.database-search label:has(#database-primary-colour),
.database-search label:has(#database-second-colour),
.database-search label:has(#database-third-colour) {
  grid-column: span 1 !important;
}

/* Fallback classes if the browser ignores :has */
.colour-filter-equal {
  grid-column: span 1 !important;
}


/* Help tooltips for private nudibranch database */
.tooltip-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: help;
  border-bottom: 1px dotted rgba(0, 90, 110, 0.45);
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #e8f7fb;
  color: #07566b;
  border: 1px solid #b8e2ec;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.tooltip-label::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.55rem);
  z-index: 50;
  width: min(280px, 80vw);
  padding: 0.7rem 0.8rem;
  border-radius: 0.75rem;
  background: #062d3a;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.35;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.25rem);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  white-space: normal;
  font-style: normal;
}

.tooltip-label::before {
  content: "";
  position: absolute;
  left: 1rem;
  bottom: calc(100% + 0.2rem);
  z-index: 51;
  border: 0.4rem solid transparent;
  border-top-color: #062d3a;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.tooltip-label:hover::after,
.tooltip-label:focus::after,
.tooltip-label:focus-visible::after,
.tooltip-label:hover::before,
.tooltip-label:focus::before,
.tooltip-label:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.species-card h3 .tooltip-label,
.species-card summary .tooltip-label,
.database-card h3 .tooltip-label,
.database-card summary .tooltip-label {
  color: inherit;
}

@media (max-width: 720px) {
  .tooltip-label::after {
    left: 50%;
    transform: translate(-50%, 0.25rem);
  }

  .tooltip-label:hover::after,
  .tooltip-label:focus::after,
  .tooltip-label:focus-visible::after {
    transform: translate(-50%, 0);
  }
}


/* Colour filters are now all-colour match fields */
#database-primary-colour,
#database-second-colour,
#database-third-colour {
  width: 100%;
}


/* Small help text under database search field */
.database-field-hint {
  display: block;
  margin-top: 0.35rem;
  color: #486978;
  font-size: 0.82rem;
  font-weight: 650;
}


/* Private database admin action button */
.database-admin-actions {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  background: #f2fbfd;
  border: 1px solid #cbeaf0;
  box-shadow: 0 8px 22px rgba(0, 54, 68, 0.08);
}

.database-admin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
}

.database-admin-note {
  margin: 0.65rem 0 0;
  color: #365b68;
  font-size: 0.92rem;
  line-height: 1.45;
}


/* Cleaner 404 page layout */
.not-found-page .not-found-hero {
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(4rem, 10vw, 7rem) 1rem clamp(3rem, 7vw, 5rem);
}

.not-found-page .not-found-hero .hero-content {
  max-width: 880px;
  margin: 0 auto;
}

.not-found-page .not-found-hero h1 {
  max-width: 850px;
  margin-left: auto;
  margin-right: auto;
}

.not-found-content {
  padding: clamp(2rem, 5vw, 4rem) 1rem;
  background: #061c26;
}

.not-found-card {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: clamp(1.35rem, 4vw, 2.2rem);
  border-radius: 1.35rem;
  background: rgba(255,255,255,0.96);
  color: #082f3d;
  border: 1px solid rgba(84,198,211,0.22);
  box-shadow: 0 18px 42px rgba(0,0,0,0.22);
  text-align: center;
}

.not-found-card h2 {
  color: #063547;
  margin-bottom: 0.65rem;
}

.not-found-card p {
  max-width: 640px;
  margin: 0 auto 1.25rem;
  color: #365b68;
  line-height: 1.6;
}

.not-found-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

.not-found-links .button {
  margin: 0;
}

@media (max-width: 700px) {
  .not-found-page .not-found-hero {
    min-height: 300px;
  }

  .not-found-links {
    flex-direction: column;
    align-items: stretch;
  }

  .not-found-links .button {
    width: 100%;
  }
}


/* Size filter/card display */
#database-size {
  width: 100%;
}


/* v1.8 multi-photo gallery support */
.species-photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}
.species-photo-thumb,
.database-lightbox-thumb {
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 0.4rem;
  background: rgba(6, 35, 63, 0.72);
  color: #ffffff;
  cursor: pointer;
  text-align: center;
}
.species-photo-thumb img,
.database-lightbox-thumb img {
  width: 100%;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.35rem;
}
.species-photo-thumb span,
.database-lightbox-thumb span {
  display: block;
  font-size: 0.78rem;
}
.species-photo-credit-list {
  margin: 0;
  padding-left: 1.1rem;
}
.database-lightbox-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 0.6rem;
  margin-top: 1rem;
  width: min(760px, 90vw);
  margin-left: auto;
  margin-right: auto;
}
.database-lightbox-thumb.active {
  outline: 2px solid #34c6d3;
}

/* Keep database cards consistent with the site's blue hover highlight. */
.database-results-grid .species-card:hover,
.database-results-grid .species-card:focus-within {
  border-color: #11b9d5 !important;
  box-shadow: 0 16px 38px rgba(17, 185, 213, 0.24) !important;
  transform: translateY(-2px);
}
