/**
 * Species care detail pages (/species/[slug]/)
 * Mobile-first; complements styles.css + homepage-test.css
 */

.species-care-page .species-care-main {
  padding-bottom: 3rem;
}

.species-care-hero {
  text-align: center;
  padding-bottom: 0.25rem;
}

.species-care-hero .digest-hub-title {
  margin-bottom: 0.35rem;
}

.species-care-lead {
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ht-muted, #64748b);
  margin: 0 auto 1rem;
  max-width: 38rem;
  font-weight: 500;
}

.species-care-hero-img-wrap {
  margin: 1rem auto 0;
  max-width: 520px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--ht-border, #e2e8f0);
  box-shadow: var(--ht-shadow, 0 4px 14px rgba(15, 23, 42, 0.06));
  background: #f1f5f9;
}

.species-care-hero-img {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: middle;
  max-height: min(52vw, 320px);
  object-fit: cover;
}

.species-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  justify-content: center;
  margin: 1.35rem auto 0;
  max-width: 720px;
}

.species-stats-footnote {
  margin: 0.85rem auto 0;
  max-width: 36rem;
  padding: 0 0.5rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ht-muted, #64748b);
  text-align: center;
}

.species-stat {
  flex: 1 1 calc(50% - 0.65rem);
  min-width: 140px;
  max-width: 220px;
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid var(--ht-border, #e2e8f0);
  background: #ffffff;
  box-sizing: border-box;
}

.species-stat-icon {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.08rem;
}

.species-stat-body {
  min-width: 0;
}

.species-stat-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ht-muted, #64748b);
  margin-bottom: 0.15rem;
}

.species-stat-val {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ht-text, #0f172a);
  line-height: 1.35;
}

.species-care-body {
  margin-top: 2rem;
}

.species-care-body h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 1.75rem 0 0.65rem;
  color: var(--ht-text, #0f172a);
}

.species-care-body h2:first-child {
  margin-top: 0;
}

.species-care-body p {
  margin: 0 0 0.85rem;
  font-size: 0.97rem;
  line-height: 1.62;
  color: var(--ht-text, #334155);
}

.species-enrichment {
  margin-top: 2rem;
  padding: 1.15rem 1.15rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--ht-border, #e2e8f0);
  background: linear-gradient(180deg, #fafbfc 0%, #ffffff 55%);
}

.species-enrichment > h2 {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: var(--ht-text, #0f172a);
}

.species-enrichment-sub {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 1rem 0 0.45rem;
  color: var(--ht-text, #1e293b);
}

.species-enrichment-sub:first-of-type {
  margin-top: 0;
}

.species-insights-list,
.species-guide-links {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.93rem;
  line-height: 1.58;
  color: var(--ht-text, #334155);
}

.species-insights-list li + li,
.species-guide-links li + li {
  margin-top: 0.35rem;
}

.species-guide-links a {
  font-weight: 600;
}

.species-enrichment-hub {
  margin: 1rem 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ht-muted, #64748b);
}

.species-enrichment-hub a {
  font-weight: 600;
}

.species-callout-stock {
  margin: 2rem 0 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  background: rgba(37, 99, 235, 0.06);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ht-text, #334155);
}

.species-callout-stock a {
  font-weight: 600;
}

.species-related {
  margin-top: 2.25rem;
}

.species-related h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.species-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
  gap: 0.75rem;
}

.species-related-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--ht-border, #e2e8f0);
  overflow: hidden;
  background: #ffffff;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.species-related-card:hover {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
}

.species-related-card:focus-visible {
  outline: 2px solid var(--ht-accent, #2563eb);
  outline-offset: 2px;
}

.species-related-thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(180deg, #e8eef6 0%, #f1f5f9 100%);
}

.species-related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.species-related-meta {
  padding: 0.55rem 0.65rem 0.65rem;
}

.species-related-meta strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.25;
}

.species-app-cta {
  margin-top: 2rem;
  padding: 1rem 1rem 1.15rem;
  text-align: center;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--ht-border, #e2e8f0);
  font-size: 0.95rem;
}

.species-app-cta a {
  font-weight: 600;
}

/* Natural distribution map (same SVG + classes as stocking calculator) */
.species-origin-section {
  margin: 1.75rem auto 0;
  max-width: 40rem;
}

.species-origin-section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.65rem;
  text-align: center;
  color: var(--ht-text, #0f172a);
}

.species-origin-desc {
  margin: 0 0 1rem;
  font-size: 0.97rem;
  line-height: 1.55;
  color: var(--ht-text, #334155);
  text-align: center;
}

.species-origin-map-figure {
  margin: 0;
  padding: 1rem 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--ht-border, #e2e8f0);
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 55%);
}

.species-origin-map-wrap {
  max-width: 400px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ht-border, #e2e8f0);
  background: #e2e8f0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  min-height: 120px;
}

.species-origin-map-wrap.is-loading {
  background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
  background-size: 200% 100%;
  animation: species-map-shimmer 1.1s ease-in-out infinite;
}

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

.species-origin-map-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(44vw, 200px);
  vertical-align: middle;
}

/* Backup if SVG <style> is weaker once inlined (matches world-map.svg) */
.species-origin-map-wrap .origin-region.active {
  fill: #3b82f6;
  fill-opacity: 0.55;
}

.species-origin-map-wrap .origin-region.active.multiple {
  fill: #8b5cf6;
  fill-opacity: 0.6;
}

.species-origin-map-fail {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ht-muted, #64748b);
  text-align: center;
}

.species-origin-map-fail a {
  font-weight: 600;
}

.species-origin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  align-items: center;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ht-muted, #64748b);
}

.species-origin-legend li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.species-origin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  flex-shrink: 0;
}

.species-origin-tool-note {
  margin: 0.75rem 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--ht-muted, #64748b);
  text-align: center;
}

.species-origin-map-unavailable {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ht-muted, #64748b);
  margin: 0;
  padding: 0.75rem 0.5rem;
  text-align: center;
}

/* Scroll fade-in (class toggled by inline script) */
.species-care-animate {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.species-care-animate.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 640px) {
  .species-stat {
    flex: 1 1 calc(25% - 0.65rem);
    max-width: none;
  }

  .species-care-body h2 {
    font-size: 1.28rem;
  }
}
