@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;800;900&family=Lato:wght@300;400;700&display=swap');

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-forest-dark: #0F2419;
  --color-forest: #1B3A2D;
  --color-forest-light: #2D5F3F;
  --color-forest-medium: #3A7D5C;
  --color-cream: #F5F0E8;
  --color-cream-dark: #E8DCC8;
  --color-sand: #C4A35A;
  --color-sand-light: #D4C088;
  --color-text-dark: #2C2C2C;
  --color-text-light: #F5F0E8;
  --color-text-muted: #6B6B6B;

  --theme-primary: var(--color-forest);
  --theme-secondary: var(--color-forest-light);
  --theme-accent: var(--color-sand);
  --theme-bg: var(--color-cream);
  --theme-text: var(--color-text-dark);

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Lato', 'Helvetica Neue', Arial, sans-serif;

  --max-width: 1200px;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--theme-text);
  background: var(--theme-bg);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

/* ==========================================================================
   HOMEPAGE — HERO
   ========================================================================== */

.hero {
  position: relative;
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, #0F2419 0%, #1B3A2D 30%, #2D5F3F 60%, #1B3A2D 100%);
  color: var(--color-text-light);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 80%, rgba(196, 163, 90, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(45, 95, 63, 0.15) 0%, transparent 50%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M40 8 C40 8 62 30 40 58 C40 58 18 30 40 8 Z' fill='%23fff'/%3E%3Cpath d='M40 8 L40 58' stroke='%23fff' stroke-width='0.5' fill='none'/%3E%3C/svg%3E");
  background-size: 80px 80px;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 40px 24px;
  max-width: 850px;
}

.hero-icon svg {
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  opacity: 0.75;
}

.hero h1 {
  font-size: clamp(3.2rem, 9vw, 7rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  text-transform: uppercase;
  line-height: 0.95;
}

.hero h1 .accent {
  color: var(--color-sand);
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 300;
  opacity: 0.8;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.65;
}

.hero-wave {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  z-index: 3;
}

.hero-wave svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ==========================================================================
   HOMEPAGE — CARD GRID
   ========================================================================== */

.animals-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px 24px 100px;
}

.section-header {
  text-align: center;
  margin-bottom: 56px;
}

.section-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  color: var(--color-forest);
  margin-bottom: 12px;
}

.section-header p {
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 26px;
}

.animal-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  opacity: 0;
  transform: translateY(30px);
}

.animal-card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.4s ease;
}

.animal-card.visible:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.animal-card:nth-child(1).visible { transition-delay: 0.05s; }
.animal-card:nth-child(2).visible { transition-delay: 0.12s; }
.animal-card:nth-child(3).visible { transition-delay: 0.19s; }
.animal-card:nth-child(4).visible { transition-delay: 0.26s; }
.animal-card:nth-child(5).visible { transition-delay: 0.33s; }
.animal-card:nth-child(6).visible { transition-delay: 0.40s; }
.animal-card:nth-child(7).visible { transition-delay: 0.47s; }
.animal-card:nth-child(8).visible { transition-delay: 0.54s; }

.card-image {
  position: absolute;
  inset: 0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.animal-card:hover .card-image img {
  transform: scale(1.08);
}

.card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 60px 22px 22px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.25) 65%, transparent 100%);
  color: white;
  transition: padding-bottom 0.3s ease;
}

.animal-card:hover .card-overlay {
  padding-bottom: 28px;
}

.card-overlay h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-status {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 20px;
}

.status-cr { background: rgba(190, 50, 50, 0.75); }
.status-en { background: rgba(200, 110, 40, 0.75); }
.status-vu { background: rgba(180, 155, 60, 0.75); }
.status-nt { background: rgba(100, 150, 80, 0.75); }
.status-lc { background: rgba(45, 95, 63, 0.75); }

/* ==========================================================================
   HOMEPAGE FOOTER
   ========================================================================== */

.site-footer {
  background: var(--color-forest-dark);
  color: var(--color-text-light);
  text-align: center;
  padding: 52px 24px;
}

.site-footer .footer-message {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  opacity: 0.8;
  margin-bottom: 8px;
}

.site-footer .footer-sub {
  font-size: 0.9rem;
  opacity: 0.45;
}

/* ==========================================================================
   DETAIL PAGE — NAVIGATION
   ========================================================================== */

.detail-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.detail-nav.scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.08);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 10px 22px;
  border-radius: 30px;
  transition: background 0.3s ease, color 0.3s ease;
}

.detail-nav.scrolled .back-link {
  color: var(--theme-primary);
  background: rgba(0, 0, 0, 0.06);
}

.back-link:hover {
  background: rgba(0, 0, 0, 0.5);
}

.detail-nav.scrolled .back-link:hover {
  background: rgba(0, 0, 0, 0.1);
}

.back-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ==========================================================================
   DETAIL PAGE — HERO IMAGE
   ========================================================================== */

.detail-hero {
  position: relative;
  height: 65vh;
  min-height: 420px;
  overflow: hidden;
}

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

.detail-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 80px 48px 44px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.2) 60%, transparent 100%);
  color: white;
}

.detail-hero-overlay h1 {
  font-size: clamp(2.5rem, 7vw, 4.2rem);
  font-weight: 800;
  margin-bottom: 8px;
}

.scientific-name {
  font-size: 1.15rem;
  font-weight: 300;
  opacity: 0.75;
  font-style: italic;
}

/* ==========================================================================
   DETAIL PAGE — STATS BAR
   ========================================================================== */

.detail-stats {
  display: flex;
  justify-content: center;
  background: var(--theme-primary);
  color: white;
  flex-wrap: wrap;
}

.stat {
  flex: 1;
  min-width: 180px;
  padding: 22px 28px;
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.stat:last-child {
  border-right: none;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.65;
  margin-bottom: 5px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
}

/* ==========================================================================
   DETAIL PAGE — CONTENT AREA
   ========================================================================== */

.detail-page {
  background: var(--theme-bg);
}

.detail-content {
  max-width: 920px;
  margin: 0 auto;
  padding: 64px 24px 90px;
  position: relative;
  z-index: 1;
}

.fact-section {
  margin-bottom: 52px;
}

.fact-section h2 {
  font-size: 1.55rem;
  color: var(--theme-primary);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--theme-accent);
  display: inline-block;
}

.fact-section > p {
  font-size: 1.05rem;
  color: #4a4a4a;
  line-height: 1.85;
  margin-bottom: 16px;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.fact-card {
  background: white;
  border-radius: 12px;
  padding: 24px 24px 22px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.05);
  border-left: 4px solid var(--theme-accent);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fact-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.09);
}

.fact-card h3 {
  font-size: 0.95rem;
  color: var(--theme-primary);
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-weight: 700;
}

.fact-card p {
  font-size: 0.92rem;
  color: #555;
  line-height: 1.65;
}

.fact-full {
  background: white;
  border-radius: 12px;
  padding: 28px 30px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.fact-full p {
  font-size: 1.02rem;
  color: #4a4a4a;
  line-height: 1.85;
}

.detail-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 28px 0;
}

.detail-gallery img {
  border-radius: 12px;
  width: 100%;
  height: 260px;
  object-fit: cover;
}

/* Leaf divider between sections */
.leaf-divider {
  text-align: center;
  margin: 48px 0;
  opacity: 0.18;
}

.leaf-divider svg {
  width: 36px;
  height: 36px;
  fill: var(--theme-primary);
}

/* ==========================================================================
   DETAIL PAGE — FOOTER
   ========================================================================== */

.detail-footer {
  text-align: center;
  padding: 52px 24px;
  background: var(--theme-primary);
  color: white;
  position: relative;
  z-index: 1;
}

.detail-footer p {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  opacity: 0.65;
  margin-bottom: 22px;
}

.detail-footer a {
  display: inline-block;
  padding: 12px 34px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.detail-footer a:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   PAGE BACKGROUND DECORATION (subtle nature patterns)
   ========================================================================== */

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.028;
}

/* ==========================================================================
   THEMES — One per animal
   ========================================================================== */

/* Lion — Savanna */
.theme-lion {
  --theme-primary: #7A6332;
  --theme-secondary: #A68B4B;
  --theme-accent: #C4A35A;
  --theme-bg: #FAF4E8;
}

/* Tiger — Jungle */
.theme-tiger {
  --theme-primary: #1B4332;
  --theme-secondary: #2D6A4F;
  --theme-accent: #CC6B2C;
  --theme-bg: #F0F5EE;
}

/* Manatee — Ocean */
.theme-manatee {
  --theme-primary: #1A5C5C;
  --theme-secondary: #2A7B7B;
  --theme-accent: #5AADA8;
  --theme-bg: #EFF7F5;
}

/* Axolotl — Lake */
.theme-axolotl {
  --theme-primary: #2B4C6F;
  --theme-secondary: #3D6B8E;
  --theme-accent: #D4849B;
  --theme-bg: #EFF3F8;
}

/* Bald Eagle — Mountain */
.theme-eagle {
  --theme-primary: #2D4A3E;
  --theme-secondary: #3D6B5E;
  --theme-accent: #8B7355;
  --theme-bg: #F0EDE8;
}

/* African Elephant — Earth */
.theme-elephant {
  --theme-primary: #6B5234;
  --theme-secondary: #8B7355;
  --theme-accent: #D4935E;
  --theme-bg: #F8F3ED;
}

/* Mountain Gorilla — Rainforest */
.theme-gorilla {
  --theme-primary: #1A3326;
  --theme-secondary: #2D5F3F;
  --theme-accent: #6B9B6B;
  --theme-bg: #EFF5EF;
}

/* Hawksbill Sea Turtle — Reef */
.theme-turtle {
  --theme-primary: #1A5C6B;
  --theme-secondary: #2A7B8B;
  --theme-accent: #D4856B;
  --theme-bg: #EFF5F7;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
  }
}

@media (max-width: 768px) {
  .hero {
    min-height: 55vh;
  }

  .hero h1 {
    font-size: clamp(2.4rem, 11vw, 3.8rem);
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .detail-hero {
    height: 45vh;
    min-height: 320px;
  }

  .detail-hero-overlay {
    padding: 60px 24px 28px;
  }

  .detail-stats {
    flex-direction: column;
  }

  .stat {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 24px;
  }

  .stat:last-child {
    border-bottom: none;
  }

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

  .detail-gallery {
    grid-template-columns: 1fr;
  }

  .detail-content {
    padding: 44px 20px 64px;
  }

  .detail-hero-overlay h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
    max-width: 380px;
    margin: 0 auto;
  }

  .animals-section {
    padding: 50px 16px 70px;
  }

  .section-header {
    margin-bottom: 40px;
  }

  .detail-nav {
    padding: 12px 16px;
  }
}
