/* ============================================================
   Target Species — Custom Stylesheet (No Tailwind)
   ============================================================ */

:root {
  --color-bg: #0f172a;
  --color-surface: #1e2937;
  --color-card: #0f172a;
  --color-accent: #22d3ee;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-border: #334155;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.1;
}

.heading-serif {
  font-family: 'Playfair Display', Georgia, serif;
}

/* Navigation */
nav {
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-container {
  max-width: 1536px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-brand img {
  height: 48px;
  width: auto;
}

.nav-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: -4px;
}

.nav-links {
  display: flex;
  gap: 32px;
  font-size: 0.875rem;
}

.nav-links a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.1s ease;
}

.nav-links a:hover {
  color: var(--color-accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Hamburger button — hidden on desktop */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.nav-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Mobile dropdown panel (collapsed by default) */
.nav-mobile {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--color-border);
  background-color: rgba(15, 23, 42, 0.97);
}

.nav-mobile.open {
  display: flex;
}

.nav-mobile a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-mobile a.btn-primary {
  color: #0f172a;
  background-color: var(--color-accent);
}

.nav-mobile a.btn-primary:hover,
.nav-mobile a.btn-primary:focus {
  background-color: #67e8f9;
  color: #0f172a;
}

.nav-mobile a:hover,
.nav-mobile a:focus {
  background-color: #1e2937;
  color: var(--color-accent);
}

.nav-mobile .btn {
  margin-top: 8px;
  width: 100%;
  justify-content: center;
}

/* Hero
   Background image is set at runtime by JS (random pick from images/hero/*).
   A left-heavy dark gradient overlay keeps the left-aligned text readable
   regardless of which image is chosen. */
.hero {
  position: relative;
  background-color: #0f172a;          /* fallback while image loads */
  background-size: cover;
  background-position: right center;  /* favor the interesting right side */
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--color-border);
  padding: 64px 24px 80px;
  overflow: hidden;
}

/* Dark gradient overlay — strongest on the left where the text lives */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(15, 23, 42, 0.92) 0%,
    rgba(15, 23, 42, 0.78) 28%,
    rgba(15, 23, 42, 0.45) 55%,
    rgba(15, 23, 42, 0.20) 80%,
    rgba(15, 23, 42, 0.10) 100%
  );
  pointer-events: none;
  z-index: 0;
}

.hero-container {
  position: relative;
  z-index: 1;
  max-width: 1536px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #1e2937;
  border: 1px solid var(--color-border);
  color: var(--color-accent);
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.hero h1 {
  font-size: 3.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0 0 16px;
  line-height: 1.05;
}

.hero-subtitle {
  font-size: 1.5rem;
  color: var(--color-text-muted);
  max-width: 520px;
  margin: 0;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 16px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background-color: var(--color-accent);
  color: #0f172a;
}

.btn-primary:hover {
  background-color: #67e8f9;
}

.btn-secondary {
  background-color: transparent;
  color: white;
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background-color: #1e2937;
}

/* Sections */
.section {
  max-width: 1536px;
  margin: 0 auto;
  padding: 56px 24px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.section-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
}

.section-subtitle {
  color: var(--color-accent);
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}

/* Chapters Horizontal Scroll */
.chapters-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  scroll-snap-type: x mandatory;
  align-items: stretch;
}

.chapters-scroll::-webkit-scrollbar {
  height: 6px;
}

.chapters-scroll::-webkit-scrollbar-thumb {
  background-color: #475569;
  border-radius: 3px;
}

.chapter-card {
  min-width: 300px;
  max-width: 340px;
  min-height: 220px;
  height: 100%;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 20px;
  scroll-snap-align: start;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.chapter-card .species {
  display: inline-block;
  background-color: #164e63;
  color: var(--color-accent);
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 9999px;
  margin-bottom: 12px;
}

/* Tagline leads the card; body snippet fills the rest */
.chapter-card h4 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-text);
}

.chapter-card p,
.chapter-card .chapter-snippet {
  flex: 1;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Book Grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

@media (min-width: 768px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .book-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .book-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1536px) {
  .book-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.book-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.book-card .cover {
  height: 220px;
  background-color: #000000; /* solid black behind transparent species PNGs */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.book-card .cover .cover-image {
  max-width: 88%;
  max-height: 88%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.book-card .cover i {
  font-size: 3.5rem;
  color: #475569;
}

.book-card .cover .format-badge {
  position: absolute;
  /* Dark blue theme — readable on solid black cover art */
  background-color: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(34, 211, 238, 0.45);
  color: #e2e8f0;
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-family: monospace;
  line-height: 1.3;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.book-card .cover .format-badge-paperback {
  top: 12px;
  right: 12px;
  border-color: rgba(34, 211, 238, 0.55);
  color: #a5f3fc;
}

.book-card .cover .format-badge-kindle {
  top: 38px;
  right: 12px;
  border-color: rgba(148, 163, 184, 0.5);
  color: #cbd5e1;
}

.book-card .content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-card h3 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 600;
}

.book-card .subtitle {
  color: var(--color-accent);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.book-card .description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card .toc {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.book-card .toc-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.book-card .toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.book-card .toc li {
  font-size: 0.875rem;
  color: #cbd5e1;
  margin-bottom: 4px;
}

.book-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.book-actions .btn {
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Wholesale Section */
.wholesale {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.wholesale-content {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  padding: 64px 24px;
}

.wholesale-icon {
  width: 64px;
  height: 64px;
  background-color: rgba(34, 211, 238, 0.1);
  color: var(--color-accent);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 28px;
}

.wholesale h2 {
  margin: 0 0 16px;
}

.wholesale p {
  color: var(--color-text-muted);
  margin-bottom: 32px;
}

/* Footer */
footer {
  text-align: center;
  padding: 40px 24px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   IMPROVED SEARCH STYLES (New Prominent Centered Search)
   ============================================================ */

.search-container {
  max-width: 720px;
  margin: 0 auto 32px;
  text-align: center;
}

.search-label {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.search-wrapper {
  position: relative;
  max-width: 100%;
}

.search-wrapper input {
  width: 100%;
  background-color: #020617;
  border: 2px solid var(--color-border);
  color: white;
  padding: 16px 52px 16px 52px;
  border-radius: 9999px;
  font-size: 1.05rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-wrapper input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.15);
}

.search-wrapper .search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

/* Clear (X) button */
.clear-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.6rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  display: none;
  border-radius: 50%;
  transition: color 0.15s ease;
}

.clear-btn:hover {
  color: #f87171;
}

/* Result count */
.result-count {
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  min-height: 20px;
}

/* Responsive adjustments for search */
@media (max-width: 768px) {
  .search-container {
    margin-bottom: 24px;
  }
  
  .search-wrapper input {
    font-size: 1rem;
    padding: 14px 48px 14px 48px;
  }
}

/* Existing search-wrapper styles kept for compatibility */
.search-wrapper i {
  position: absolute;
  left: 16px;
  top: 14px;
  color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .nav-actions {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-container {
    height: 60px;
  }

  .hero h1 {
    font-size: 2.75rem;
  }
}

/* Desktop: always hide mobile panel, even if it still has .open from a prior narrow viewport */
@media (min-width: 769px) {
  .nav-mobile,
  .nav-mobile.open {
    display: none !important;
  }
}
