:root {
  --bg: #091018;
  --panel: rgba(10, 18, 26, 0.76);
  --panel-solid: #0e1720;
  --panel-soft: #132130;
  --line: rgba(255,255,255,0.09);
  --text: #edf5ff;
  --muted: #98a6b8;
  --accent: #8fd0a8;
  --accent-2: #f0c97e;
  --shadow: 0 18px 60px rgba(0,0,0,0.28);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(143, 208, 168, 0.18), transparent 32%),
    radial-gradient(circle at top left, rgba(240, 201, 126, 0.12), transparent 26%),
    linear-gradient(180deg, #0b1118 0%, #081018 55%, #091118 100%);
  min-height: 100vh;
}

img { display: block; max-width: 100%; }
button, input { font: inherit; }

.wrap {
  width: min(1380px, calc(100vw - 32px));
  margin-inline: auto;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 42px 0 22px;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(143, 208, 168, 0.18), transparent 25%),
    radial-gradient(circle at 80% 25%, rgba(240, 201, 126, 0.15), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 80%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 430px);
  gap: 22px;
  align-items: end;
}

.eyebrow,
.toolbar__label,
.viewer__kicker,
.section-head__kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(2.6rem, 5vw, 5rem);
  line-height: 0.94;
}

.hero__lead {
  max-width: 760px;
  margin: 18px 0 0;
  font-size: 1.03rem;
  line-height: 1.72;
  color: #d5dfeb;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero__card,
.card {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero__card {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.hero__stat {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.hero__stat span {
  display: block;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
}

.hero__stat small,
.hero__note,
.toolbar__scientific,
.viewer__scientific,
.section-head__hint,
.family-item small,
.species-card small {
  color: var(--muted);
}

.hero__note {
  grid-column: 1 / -1;
  font-size: 0.95rem;
  line-height: 1.65;
  padding: 4px 2px 0;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  padding: 10px 0 34px;
}

.sidebar,
.toolbar,
.viewer,
.species-panel {
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar__header h2,
.toolbar h2,
.viewer h3,
.section-head h3 {
  margin: 0;
}

.sidebar__header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 14px;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.035);
}

.searchbox input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
}

.family-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.family-item {
  width: 100%;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  padding: 11px;
  color: var(--text);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.family-item:hover,
.family-item.is-active {
  transform: translateY(-1px);
  border-color: rgba(143, 208, 168, 0.35);
  background: rgba(143, 208, 168, 0.10);
}

.family-item__number {
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  font-weight: 700;
}

.family-item__labels strong,
.species-card strong {
  display: block;
  font-size: 0.96rem;
}

.main-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.toolbar h2 {
  font-family: "Playfair Display", serif;
  font-size: clamp(1.5rem, 2vw, 2.15rem);
}

.toolbar__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
}

.viewer {
  display: grid;
  gap: 18px;
}

.viewer__media {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius-xl) - 6px);
  min-height: clamp(340px, 55vw, 720px);
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.06);
}

.viewer__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.viewer__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(7,12,18,0.55);
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.viewer__arrow--left { left: 14px; }
.viewer__arrow--right { right: 14px; }

.slideshow-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(143, 208, 168, 0.18);
  border: 1px solid rgba(143, 208, 168, 0.38);
  font-weight: 600;
}

.viewer__info {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.viewer h3 {
  font-family: "Playfair Display", serif;
  font-size: clamp(1.9rem, 4vw, 3.35rem);
  line-height: 0.98;
}

.viewer__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(143, 208, 168, 0.11);
  border: 1px solid rgba(143, 208, 168, 0.24);
  color: #dff7e9;
  font-size: 0.93rem;
}

.pill--muted {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.08);
  color: var(--muted);
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
}

.thumb {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid transparent;
  padding: 0;
  cursor: pointer;
  background: rgba(255,255,255,0.04);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb.is-active {
  border-color: rgba(240, 201, 126, 0.55);
  box-shadow: 0 0 0 2px rgba(240, 201, 126, 0.18);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}

.species-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.species-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  text-align: left;
  width: 100%;
  border-radius: 20px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.035);
  color: var(--text);
  cursor: pointer;
}

.species-card.is-active {
  border-color: rgba(143, 208, 168, 0.38);
  background: rgba(143, 208, 168, 0.10);
}

.species-card__preview {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  background-color: rgba(255,255,255,0.06);
}

.species-card__order {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: var(--accent-2);
  letter-spacing: 0.08em;
}

.btn {
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 0 18px;
  color: var(--text);
  cursor: pointer;
  transition: transform .2s ease, opacity .2s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn--primary {
  background: linear-gradient(135deg, rgba(143, 208, 168, 0.88), rgba(88, 158, 112, 0.88));
  color: #07110a;
  font-weight: 700;
}

.btn--ghost,
.btn--soft {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}

.empty-state {
  padding: 22px;
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
}

@media (max-width: 1050px) {
  .hero__content,
  .layout,
  .viewer__info,
  .toolbar,
  .section-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar {
    position: static;
    height: auto;
    max-height: none;
  }

  .toolbar__actions,
  .viewer__meta {
    justify-content: start;
  }
}

@media (max-width: 720px) {
  .wrap {
    width: min(100vw - 16px, 1380px);
  }

  .hero {
    padding-top: 18px;
  }

  .hero__card {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar,
  .viewer,
  .species-panel,
  .sidebar {
    padding: 14px;
  }

  .viewer__media {
    min-height: 280px;
  }

  .viewer__arrow {
    width: 42px;
    height: 42px;
  }

  .species-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .hero__card,
  .species-list {
    grid-template-columns: 1fr;
  }

  .family-item,
  .species-card {
    border-radius: 16px;
  }
}
.viewer__notice {
  margin-top: 0.45rem;
  color: #d9b46b;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.thumbs .empty-state {
  padding: 1rem;
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 14px;
  color: rgba(255,255,255,0.72);
  text-align: center;
}

.species-card__no-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255,255,255,0.72);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hero--compact {
  padding-top: 2.2rem;
  padding-bottom: 1.4rem;
}

.hero--compact .hero__content {
  gap: 1.25rem;
  align-items: end;
}

.hero--compact h1 {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  margin-bottom: 0.35rem;
}

.hero--compact .hero__lead {
  max-width: 720px;
  font-size: 0.98rem;
  line-height: 1.55;
}

.hero--compact .hero__card {
  padding: 1rem 1.1rem;
}

.hero--compact .hero__stat span {
  font-size: 1.8rem;
}

.viewer__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.viewer__controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn--play {
  white-space: nowrap;
}

#toggleSpeciesSlideshowBtn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.viewer__notice {
  margin-top: 0.45rem;
  color: #d9b46b;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.thumbs .empty-state {
  padding: 1rem;
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 14px;
  color: rgba(255,255,255,0.72);
  text-align: center;
}

.species-card__no-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255,255,255,0.72);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .hero--compact {
    padding-top: 1.6rem;
    padding-bottom: 1rem;
  }

  .hero--compact h1 {
    font-size: clamp(1.9rem, 8vw, 2.6rem);
  }

  .viewer__controls {
    width: 100%;
  }

  .btn--play {
    width: 100%;
    justify-content: center;
  }
}
