/* ============================================================
   BOS-HOME.CSS
   Styles specific to the homepage only — kingdom browser,
   taxon tiles, photo reel, and homepage responsive overrides.
   Requires: bos-common.css, bos-responsive.css
   ============================================================ */


/* ── Photo grid (BOS Reel) ─────────────────────────────────────────────── */
:root {
  --bg:          #0d0d0d;
  --surface:     #1a1a1a;
  --accent:      #c8a96e;
  --gap:         3px;
  --cols-desktop: 10;
  --cols-xl:      8;
  --cols-narrow:  7;
  --cols-tablet:  5;
  --cols-mobile:  3;
  --cols-tiny:    2;
}

/* ── Back to "Species Explorer" — shown once its header scrolls off-screen ── */
.reel-back-to-top {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  /* Was var(--navy) — bright #5b8dee on this page, reading as light blue for
     a solid pill-button fill; --cream-dark is the dark "elevated surface"
     tone used elsewhere for cards/panels/bars. */
  background: var(--cream-dark, #1c2b42);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 10px 20px 10px 16px;
  font-size: var(--fs-sm);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(15,35,64,0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s, background 0.15s ease;
}
.reel-back-to-top.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.reel-back-to-top:hover { background: var(--gold, #C4933F); }
.reel-back-to-top svg { flex-shrink: 0; }
@media (max-width: 479px) {
  .reel-back-to-top span { display: none; }
  .reel-back-to-top { padding: 12px; border-radius: 50%; }
}

.photo-grid {
  display: grid;
  gap: var(--gap);
  padding: var(--gap);
  grid-template-columns: repeat(var(--cols-desktop), 1fr);
}

.photo-grid__item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  margin: 0;
}

.photo-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  position: relative;
  z-index: 1;
  transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 0.55s ease;
  filter: grayscale(20%);
}

/* Skeleton shimmer */
.photo-grid__item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #1a1a1a 25%, #242424 50%, #1a1a1a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  z-index: 0;
}

/* Hover overlay */
.photo-grid__item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(200,169,110,0);
  transition: background 0.4s ease;
  z-index: 2;
  pointer-events: none;
}

.photo-grid__item:hover img {
  transform: scale(1.08);
  filter: grayscale(0%);
}

.photo-grid__item:hover::after {
  background: rgba(200,169,110,0.08);
}

.photo-grid__item figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  padding: 0.3em 0.5em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  line-height: 1.6;
  pointer-events: none;
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* Photo grid responsive */
/* Bootstrap's own xl tier (1200-1399.98px, below the 1400px xxl step). */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .photo-grid { grid-template-columns: repeat(var(--cols-xl), 1fr); }
}
/* Same 992-1199.98px "narrow desktop" tier as the hero section below —
   the existing trigger points closest to the requested ~992-1200px range. */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .photo-grid { grid-template-columns: repeat(var(--cols-narrow), 1fr); }
}
@media (max-width: 991px) {
  .photo-grid { grid-template-columns: repeat(var(--cols-tablet), 1fr); }
}
@media (max-width: 767px) {
  .photo-grid { grid-template-columns: repeat(var(--cols-mobile), 1fr); gap: 2px; padding: 2px; }
}
@media (max-width: 479px) {
  .photo-grid { grid-template-columns: repeat(var(--cols-tiny), 1fr); }
}



/* ── Hero section (shared structure) ──────────────────────────────────── */
/* height was briefly driven by the CSS `aspect-ratio` property (matching
   the hero photos' native 2000x672 size) to stop the banner cropping the
   photo vertically past ~1600px wide, but every bug reported afterward —
   a flex row overflowing the viewport at ~900px, .hero-section-bos's own
   box measuring wider than the window at 1423px — traced to width ranges
   that property governed, with no code-level explanation found on static
   analysis (no headless browser in this environment to confirm the exact
   mechanism, e.g. a possible circular-dependency edge case between
   aspect-ratio and this element's absolutely-positioned inset:0 children
   establishing their containing block against it). Reverted 2026-09-11 to
   plain min-height, and background-size:auto 100% on .hero-slide (below)
   took over guaranteeing the photo's full height is always visible
   instead. The ::before rule right after this one restores widescreen
   proportional growth using the older, more conservatively-supported
   padding-percentage technique instead. */
.hero-section-bos {
  height: auto;
  min-height: 480px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  padding-top: 30px;
  padding-bottom: 30px;
}

/* From 1512px wide, min-height's fixed 480px falls short of the photo's
   2000x672 shape (480/2000*672 would need ~1429px+ of width just to
   stop background-size:auto 100% (below) from leaving an uncropped gap
   on the right — visible from 1512px, per Nicky 2026-09-11) — so from
   here up, grow height in step with width instead of leaving it pinned.
   Classic padding-percentage aspect-ratio technique, not the CSS
   `aspect-ratio` property (see note above) — an invisible flex item
   whose own width is pinned to 0 but whose padding-top percentage still
   resolves against the FLEX CONTAINER's width (percentages on padding
   always resolve against the containing block's width, regardless of
   which box they're padding), forcing .hero-section-bos's auto height
   to be at least 33.6% (672/2000) of its own width — well-supported,
   pre-dates flexbox and Grid, no known edge cases with this page's
   flex + absolutely-positioned-children structure. */
@media (min-width: 1512px) {
  .hero-section-bos::before {
    content: '';
    display: block;
    width: 0;
    padding-top: 33.6%;
  }
}

/* Bootstrap's .container spans the full hero width even though only the
   left column (.col-lg-6) has visible content — its empty right half was
   sitting above the slide (z-index:2) and swallowing clicks meant for the
   image. Make the wrapper click-through and only re-enable the actual
   visible text card, so the rest of the banner reaches the slide link. */
.hero-section-bos .container { pointer-events: none; min-width: 0; }

/* .hero-image-panel (bos-home.js, inserted as .hero-section-bos's first
   child) and .container are both flex items of .hero-section-bos — flex
   items default to min-width:auto, which floors their shrink at their
   own content's min-content width regardless of flex-shrink or the
   parent's overflow:hidden. That let the row push .hero-section-bos's
   own box wider than the viewport at ~900px, dragging .hero-caption
   (position:absolute; right:20px — relative to that oversized box)
   off-screen with it. Reported 2026-09-10. */
.hero-image-panel { min-width: 0; }

.hero-text-backdrop {
  pointer-events: auto;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 6px;
  padding: 32px 36px 28px;
  width: 100%;
}

/* Slideshow slides — <a> when the species has a taxon page (clickable image),
   plain <div> otherwise (e.g. Armadillidae isopod, no taxon page yet) */
.hero-slide {
  position: absolute;
  inset: 0;
  /* auto 100% — always scale the photo to exactly match the section's
     height, letting width overflow (cropped by .hero-section-bos's own
     overflow:hidden) or fall short (a plain navy gap, .hero-section-bos's
     own background-color, on the left — where the text card sits) as
     the section's fixed min-height (480px, or 400px at 768-1199.98px
     below) happens to compare to the photo's native 2000x672 shape at a
     given viewport width. Explicit "always fill height, crop/gap width
     instead" per Nicky (2026-09-11) — cover picked whichever dimension
     needed MORE scale (sometimes height, cropping the subject vertically
     — the original ≥1600px bug) and contain picked whichever needed
     LESS (sometimes width, leaving an unwanted vertical letterbox gap —
     reported immediately after switching to it). Neither ever guaranteed
     height was the bound; this always does. */
  background-size: auto 100%;
  background-position: right center;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;   /* stacked slides all sit at inset:0 — opacity:0
                             alone doesn't stop the inactive ones (esp. the
                             last one in DOM order) from swallowing clicks */
  transition: opacity 1.4s ease-in-out;
  z-index: 0;
}
.hero-slide.active { opacity: 1; pointer-events: auto; }
.hero-slide--linked { cursor: pointer; }

/* Slide caption — the name is plain text, never a link (clicking the
   picture navigates, clicking the caption should not); the credit may
   contain its own link out to the photographer's site (bos_personLinkHtml) */
.hero-caption {
  position: absolute;
  bottom: 14px;
  right: 20px;
  z-index: 10;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.04em;
  font-style: normal;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  transition: opacity 0.5s ease;
  background: rgba(0, 0, 0, 0.55);
  padding: 4px 15px;
  border-radius: 3px;
  /* Previously unconstrained outside the ≤767px mobile block, so a long
     name+credit pair grew past .hero-section-bos's left edge and got
     hard-clipped mid-character by its overflow:hidden instead of
     truncating — visible from ~768-1024px, reported 2026-09-10 (the
     narrow-desktop/tablet range's shrunk .hero-section-bos width leaves
     less room than the wider default desktop layout). */
  max-width: calc(100% - 40px);
}
/* display:flex children also default to min-width:auto, which would
   stop them shrinking enough to ever trigger their own ellipsis below —
   same gotcha as .hero-image-panel/.container above, just one level in. */
.hero-caption-name {
  color: rgba(255,255,255,0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.hero-caption-credit {
  font-size: 10px;
  color: rgba(255,255,255,0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.hero-caption-credit a { color: inherit; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.3); }
.hero-caption-credit a:hover { color: rgba(255,255,255,0.85); text-decoration-color: currentColor; }

/* Hero search bar */
.hero-search {
  display: flex;
  gap: 0;
  max-width: 520px;
}

.hero-search input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.18);
  border-right: none;
  border-radius: 4px 0 0 4px;
  padding: 13px 18px;
  font-size: 14px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}

.hero-search-btn {
  background: var(--gold);
  border: none;
  border-radius: 0 4px 4px 0;
  padding: 13px 20px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-search-btn:hover { background: #B8872F; }

.hero-adv {
  display: block;
  margin-top: 14px;
  font-size: 12px;
  color: rgba(255,255,255,0.58);
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}
.hero-adv:hover { color: rgba(255,255,255,0.6); }
/* \2192 (CSS unicode escape for →) instead of the literal character — same
   mojibake risk as .hdr-search-advanced-link::after (bos-header-search.css):
   this file serves as text/css with no charset parameter, so the raw UTF-8
   arrow can misrender without other encoding signals. */
.hero-adv::after { content: ' \2192'; }


/* ── Stats bar ─────────────────────────────────────────────────────────── */
.stats-bar {
  /* Was var(--navy-mid) — fine as a button/text accent, but --navy-mid is
     now the bright #4a7de0 dark-theme accent (bos-home.css) rather than the
     dark navy it used to be, so it read as too light for a full-width bar
     fill. --cream-dark is the actual dark "elevated surface" tone used
     elsewhere for cards/panels. */
  background: var(--cream-dark, #1a3456);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.stats-container {
  display: flex;
  align-items: stretch;
}

.stat-item {
  flex: 1;
  padding: 18px 28px;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stat-item:last-child { border-right: none; }

.stat-val {
  font-size: 26px;
  font-weight: 400;
  color: #fff;
  line-height: 1;
}

.stat-lbl {
  font-size: 11px;
  color: rgba(255,255,255,0.38);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 400;
}


/* ============================================================
   HERO MOBILE LAYOUT — image above, text below
   Primary layout at ≤767px; ≤479px fine-tunes further. 768-991px
   (tablet) instead uses the "narrow desktop" overlay-on-photo layout
   below (text card on the left half only, search bar relocated below
   the hero) — the stacked treatment tried at that width capped the
   image panel's height while its width grew with the viewport,
   producing a very wide/short crop that showed too much empty
   background to the left of the subject (subject is anchored right,
   see .hero-slide below).
   ============================================================ */

@media (max-width: 767px) {
  /* Stack vertically instead of overlapping; image panel first,
     text panel below, flush against the sticky header above. */
  .hero-section-bos {
    display: block;
    position: relative;
    min-height: 0;
    padding: 0;
    overflow: visible;
  }

  /* .hero-slide children (bos-home.js) are position:absolute; inset:0
     inside .hero-image-panel — giving the panel itself a position and
     a fluid height makes them fill just this box instead of the whole
     section. */
  .hero-image-panel {
    position: relative;
    height: clamp(260px, 78vw, 320px);
    overflow: hidden;
    width: 100%;
  }

  .hero-slide {
    position: absolute;
    inset: 0;
    /* Subject sits in the right 30-40% of the source photo — cover +
       right-anchored position means any cropping eats the left side
       first, at any panel width/height. The subject never crops. */
    background-position: right center;
    background-size: cover;
  }

  button[aria-label="Previous image"],
  button[aria-label="Next image"] {
    top: 50% !important;
    transform: translateY(-50%) !important;
  }

  .hero-caption {
    position: absolute;
    bottom: 8px;
    right: 10px;
    z-index: 10;
    /* May span the whole photo (10px margin each side) — the prev/next
       arrows sit at mid-height, well clear of this bottom line. */
    max-width: calc(100% - 20px);
    font-size: 10px;
  }
  .hero-caption-name {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* The photographer's credit is never cut off: it keeps its full width
     and only the taxon name beside it shrinks (ellipsis). */
  .hero-caption-credit {
    flex: 0 0 auto;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
  }

  /* Text panel — solid background matching the section's own inline
     navy, no translucent blur backdrop (only needed for legibility
     over a photo, not needed on a solid panel). */
  .hero-section-bos .container {
    position: relative;
    z-index: 5;
    background: #1c2b42;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .hero-text-backdrop {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    padding: 0 4px;
    width: 100%;
  }

  .hero-section-bos h4 {
    font-size: 2rem !important;
    line-height: 1.3;
    margin-bottom: 12px !important;
  }

  .hero-section-bos .fs-16 {
    font-size: 14px !important;
    line-height: 1.55;
    margin-bottom: 16px !important;
  }

  .hero-search {
    max-width: 100%;
  }
}

@media (max-width: 479px) {
  button[aria-label="Previous image"],
  button[aria-label="Next image"] {
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
  }
  button[aria-label="Previous image"] { left: 6px !important; }
  button[aria-label="Next image"] { right: 6px !important; }

  .hero-caption {
    font-size: 10px;
    right: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
  }
}

/* Hero position dots (bos-home.js .hero-dots, a sibling right after
   .hero-image-panel). Desktop/tablet: overlaid inside the banner's bottom
   edge, right-aligned just above .hero-caption (the text card fills the
   left half and the caption the bottom-right corner, so centred dots
   collided with both), on a translucent pill so they read on any photo. Phones:
   a strip under the photo (the caption and credit already use the photo's
   bottom edge there). Each button is a 22px hit target around an 8px dot;
   the current banner's dot widens to a bar, and a dot pulses while its
   banner's image is still downloading. */
.hero-dots {
  position: absolute;
  right: 20px;
  bottom: 44px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  max-width: calc(100% - 40px);
}
.hero-dot {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  transition: width 0.3s, background 0.3s;
}
.hero-dot:hover::before,
.hero-dot:focus-visible::before { background: rgba(255, 255, 255, 0.85); }
.hero-dot:focus-visible { outline: 2px solid #fff; outline-offset: -3px; border-radius: 999px; }
.hero-dot.active::before { width: 18px; background: #fff; }
.hero-dot.loading::before { animation: hero-dot-pulse 0.9s ease-in-out infinite; }
@keyframes hero-dot-pulse { 50% { background: rgba(255, 255, 255, 0.15); } }
@media (prefers-reduced-motion: reduce) {
  .hero-dot.loading::before { animation: none; background: rgba(255, 255, 255, 0.85); }
}
@media (max-width: 767px) {
  .hero-dots {
    position: static;
    max-width: none;
    border-radius: 0;
    padding: 4px 8px;
    background: #1c2b42; /* the hero section's own navy */
  }
}

/* ============================================================
   HERO — NARROW DESKTOP + TABLET (iPad portrait/landscape, lg-only
   laptop windows). Still the desktop overlay-on-photo layout (not the
   mobile stack, which stops at 767px) — but at this width the text
   card and the photo's subject occupy the same space, and there
   isn't enough room for both. Rather than trading image height
   against text height: the heading shrinks, the text card is forced
   to the left half (.col-lg-6 only gets its 50% width from Bootstrap
   at ≥992px natively — width:100% below that, from the plain
   `.row > *` base rule, so it must be set explicitly here), and
   bos-home.js moves the search form/advanced-search link out of the
   text card into a standalone .hero-search-bar placed after the hero
   section — a real bar in normal document flow, not another layer
   over the photo. Moved back to their original spot inside
   .hero-text-backdrop outside this range, so no other breakpoint's
   layout changes.
   ============================================================ */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .hero-section-bos {
    min-height: 400px;
  }

  .hero-section-bos .col-lg-6 {
    width: 50%;
  }

  .hero-section-bos h4 {
    font-size: 1.8em !important;
  }

  /* The paragraph's mb-50px (Bootstrap utility) was sized to leave room for
     the search form that used to follow it right inside .hero-text-backdrop.
     At this tier bos-home.js moves the form/link out into .hero-search-bar,
     so the paragraph is now the backdrop's last child — that 50px reads as
     a dead gap above the card's own bottom padding instead. */
  .hero-text-backdrop .fs-16 {
    margin-bottom: 0 !important;
  }

  .hero-search-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 24px;
    background: #1c2b42;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .hero-search-bar .hero-search {
    width: 100%;
    max-width: 480px;
  }

  /* Base .hero-adv is a block element with its own margin-top, meant to
     sit below the form when stacked — reset both so it instead sits
     inline to the form's right, spaced only by the bar's own gap. */
  .hero-search-bar .hero-adv {
    display: inline;
    margin-top: 0;
    white-space: nowrap;
  }
}

/* Bootstrap's own @media (min-width: 768px) rule caps .container at 720px
   (the 960px width below is its ≥992px value) — homepage-only override so
   .container-based sections (hero text card, stats bar, kingdom browser)
   get desktop-width breathing room starting at 768px instead of 992px. */
@media (min-width: 768px) and (max-width: 991.98px) {
  .container-md, .container-sm, .container {
    max-width: 960px;
  }
}
/* Beyond tablet, scale with the viewport instead of Bootstrap's fixed
   960/1140/1320px steps — otherwise this override (which would keep
   matching at every wider tier too) locks every larger screen to 960px. */
@media (min-width: 992px) {
  .container-md, .container-sm, .container {
    max-width: 80%;
  }
}



/* ── Kingdom browser ───────────────────────────────────────────────────── */
.section {
  padding: 52px 36px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0px;
}

/* Species Explorer title — space above it (this section's own padding-top)
   should match the space below it before #reelFilterBar, i.e. .section-header's
   own margin-bottom (28px) — was pt-5px (home.php), reading as pinned to the
   top instead of centered in the gap between the kingdom browser and the
   filter bar. */
#species-explorer {
  padding-top: 28px;
}

.section-title {
  font-size: 26px;
  font-weight: 400;
  color: #fff;
  letter-spacing: -0.01em;
  border-left: 5px solid #fff;
  padding-left: 20px;
}

.section-sub {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.kingdom-container {
  padding: 6px;
}

.kingdom-block {
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  background: var(--cream-dark, #fff);
  transition: box-shadow 0.2s;
  padding: 0;
}
.kingdom-block:hover { box-shadow: 0 2px 16px rgba(0,0,0,0.35); }

.kingdom-header {
  position: relative;
  height: 130px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.kingdom-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.5s ease;
}
.kingdom-block:hover .kingdom-bg { transform: scale(1.03); }

.kingdom-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10,20,35,0.82) 0%,
    rgba(10,20,35,0.45) 50%,
    rgba(10,20,35,0.1) 100%
  );
}

.kingdom-info {
  position: relative;
  z-index: 2;
  padding: 14px 20px 16px;
  width: 100%;
  border-bottom: 1px solid var(--border);
  text-shadow: 1px 1px 2px black;
}

.kingdom-name,
.kingdom-name a {
  font-size: 24px;
  font-weight: 400;
  color: #fff;
  margin-bottom: 2px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
  text-decoration: none;
}

.kingdom-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  line-height: 1.45;
  font-weight: 300;
}

.kingdom-count {
  font-size: 14px;
  color: var(--gold-light);
  margin-top: 4px;
  font-weight: 400;
}


/* ── Taxon tiles ───────────────────────────────────────────────────────── */
.taxon-group-list {
  display: flex;
  flex-wrap: wrap;
}

.taxon-tile {
  padding: 9px 16px;
  cursor: pointer;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}
.taxon-tile:hover { background: var(--cream); }
.taxon-tile:hover .taxon-sci { color: var(--navy); }

.taxon-tile-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.taxon-sci {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
  line-height: 1.25;
}

.taxon-common {
  font-size: 12px;
  color: var(--stone-dark);
  font-weight: 400;
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.taxon-tile-count {
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  font-style: normal;
  line-height: 1;
  color: white;
  background-color: rgba(46, 125, 80, 0.6);
  padding: 6px 8px;
}


/* ── Homepage responsive overrides ────────────────────────────────────── */

/* Stats bar — 2 per row throughout the mobile tier; six short numeric
   stats hold up fine at 2-up even at very narrow widths, so there's no
   further collapse to 1-per-row. */
@media (max-width: 767px) {
  .stats-container { flex-wrap: wrap; }
  .stat-item {
    flex: 1 1 50%;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 14px 18px;
  }
  .stat-item:nth-child(2n) { border-right: none; }
}

/* Tablet tier gets its own row width — 3 per row (two full rows of six
   items) fits comfortably at this size instead of only 2. */
@media (min-width: 768px) and (max-width: 991px) {
  .stats-container { flex-wrap: wrap; }
  .stat-item {
    flex: 1 1 33.3333%;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 16px 20px;
  }
  .stat-item:nth-child(3n) { border-right: none; }
}

/* Kingdom blocks */
@media (max-width: 991px) {
  .kingdom-container.col-4,
  .kingdom-container.col-6 {
    width: 50% !important;
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
}
@media (max-width: 767px) {
  .kingdom-container.col-4,
  .kingdom-container.col-6 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  .section { padding: 28px 14px; }
  .section-header { flex-direction: column; gap: 4px; margin-bottom: 16px; }
  .section-title { font-size: 20px; }
}

/* Taxon tiles on very small screens */
@media (max-width: 479px) {
  .taxon-group-list { display: grid; grid-template-columns: 1fr 1fr; }
  .taxon-tile { border-right: 1px solid var(--border); }
}

/* Navbar search shrink on mobile */
@media (max-width: 479px) {
  .search-container input { max-width: 120px; font-size: 12px; }
}
