:root {
  --green: #2ecc71;
  --green-dark: #27ae60;
  --orange: #f39c12;
  --yellow: #f1c40f;
  --blue: #3498db;
  --pink: #e91e8c;
  --purple: #9b59b6;
  --red: #e74c3c;
  --teal: #1abc9c;
  --bg: #fffbf0;
  --card: #ffffff;
  --ink: #2c3e50;
  --muted: #7f8c8d;
  --radius: 20px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
  overflow-x: hidden;
}

/* === HEADER === */
header {
  background: linear-gradient(135deg, #2ecc71 0%, #1abc9c 100%);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(46,204,113,0.3);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: white;
  text-shadow: 2px 3px 0 rgba(0,0,0,0.15);
  text-decoration: none;
}

.logo span { color: var(--yellow); }

nav { display: flex; gap: 0.5rem; }

nav a {
  color: white;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

nav a:hover, nav a.active { background: rgba(255,255,255,0.25); }

/* === HERO === */
.hero {
  background: linear-gradient(160deg, #e8faf0 0%, #fef9e7 50%, #eaf4fb 100%);
  text-align: center;
  padding: 4rem 2rem 3rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '🌿🌺🍃🌸🌿🍀🌻🌿🌺🍃';
  position: absolute;
  top: 0; left: 0; right: 0;
  font-size: 1.5rem;
  opacity: 0.2;
  letter-spacing: 1.5rem;
  animation: scroll-leaves 20s linear infinite;
  white-space: nowrap;
}

@keyframes scroll-leaves {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.hero-badge {
  display: inline-block;
  background: var(--orange);
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.35rem 1.2rem;
  border-radius: 100px;
  margin-bottom: 1.2rem;
  animation: bounce-in 0.6s ease;
}

@keyframes bounce-in {
  0% { transform: scale(0); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.hero h1 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero h1 .highlight { color: var(--green-dark); }

.hero p {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 550px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.9rem 2rem;
  border-radius: 100px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }

.btn-green { background: var(--green); color: white; }
.btn-orange { background: var(--orange); color: white; }
.btn-blue { background: var(--blue); color: white; }

/* === ANIMAL GRID === */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.section-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2.2rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.section-sub {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
}

.animals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.animal-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.07);
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.animal-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 12px 35px rgba(0,0,0,0.12);
}

.card-banner {
  height: 10px;
}

.card-viewer {
  height: 200px;
  background: linear-gradient(135deg, #f8f9ff, #f0f8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.card-viewer model-viewer {
  width: 100%;
  height: 100%;
  background: transparent;
  --poster-color: transparent;
}

.card-emoji-fallback {
  font-size: 5rem;
  line-height: 1;
}

.card-body {
  padding: 1.2rem 1.4rem 1.4rem;
}

.card-yoruba {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  opacity: 0.7;
}

.card-name {
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.card-habitat {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}

.card-fact {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #555;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.8rem;
}

.card-explore {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 0.5rem 1.2rem;
  border-radius: 100px;
  color: white;
  transition: opacity 0.2s;
}

.card-explore:hover { opacity: 0.85; }

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: white;
  border-radius: 24px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s;
  position: relative;
}

.modal-overlay.open .modal { transform: scale(1); }

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #f0f0f0;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close:hover { background: #e0e0e0; }

.modal-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 350px;
}

.modal-viewer {
  border-radius: 24px 0 0 0;
  overflow: hidden;
  background: linear-gradient(135deg, #f0f8f0, #e8f4ff);
}

.modal-viewer model-viewer {
  width: 100%;
  height: 100%;
  min-height: 350px;
  background: transparent;
  --poster-color: transparent;
}

.modal-info {
  padding: 2rem;
}

.modal-yoruba {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.modal-name {
  font-family: 'Fredoka One', cursive;
  font-size: 2.2rem;
  margin-bottom: 0.3rem;
}

.modal-scientific {
  font-style: italic;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  background: #f0f0f0;
  color: #555;
}

.modal-habitat-block {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.modal-habitat-block strong { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.2rem; }

.modal-body { padding: 1.5rem 2rem 2rem; }

.modal-section-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.facts-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.5rem; }

.facts-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 0.9rem;
  line-height: 1.6;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}

.fact-icon { font-size: 1.1rem; flex-shrink: 0; }

.zoo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.zoo-item {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 0.7rem;
  font-size: 0.82rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.zoo-item strong { display: block; font-weight: 800; font-size: 0.85rem; }
.zoo-item span { color: var(--muted); font-size: 0.78rem; }

/* === FOOTER === */
footer {
  background: var(--ink);
  color: white;
  padding: 3rem 2rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
}

.footer-logo {
  font-family: 'Fredoka One', cursive;
  font-size: 1.8rem;
  color: white;
  margin-bottom: 0.7rem;
}

.footer-logo span { color: var(--yellow); }

.footer-desc {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.creator-card {
  background: rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  margin-top: 0.5rem;
}

.creator-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--green);
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.creator-name {
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.creator-detail {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.footer-col h4 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--yellow);
}

.footer-col a {
  display: block;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 0.88rem;
  margin-bottom: 0.6rem;
  transition: color 0.2s;
}

.footer-col a:hover { color: white; }

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.3);
  text-align: center;
}

/* === READ ALOUD BUTTON === */
.read-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  margin-top: 1.2rem;
  padding: 0.85rem 1.4rem;
  background: linear-gradient(135deg, #fff3cd, #ffeaa0);
  border: 3px solid #f39c12;
  border-radius: 100px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  color: #b7770d;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.read-btn:hover {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  border-color: #e67e22;
  color: white;
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(243,156,18,0.4);
}

.read-btn.speaking {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-color: #c0392b;
  color: white;
  animation: pulse-read 1.3s ease-in-out infinite;
}

@keyframes pulse-read {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(231,76,60,0.4); }
  50% { transform: scale(1.05); box-shadow: 0 8px 25px rgba(231,76,60,0.6); }
}

.read-btn .sound-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 18px;
}

.read-btn .sound-wave span {
  display: block;
  width: 3px;
  background: currentColor;
  border-radius: 3px;
  animation: none;
}

.read-btn.speaking .sound-wave span {
  animation: wave-bar 0.8s ease-in-out infinite;
}

.read-btn.speaking .sound-wave span:nth-child(1) { animation-delay: 0s; height: 6px; }
.read-btn.speaking .sound-wave span:nth-child(2) { animation-delay: 0.1s; height: 14px; }
.read-btn.speaking .sound-wave span:nth-child(3) { animation-delay: 0.2s; height: 18px; }
.read-btn.speaking .sound-wave span:nth-child(4) { animation-delay: 0.1s; height: 14px; }
.read-btn.speaking .sound-wave span:nth-child(5) { animation-delay: 0s; height: 6px; }

.read-btn:not(.speaking) .sound-wave span:nth-child(1) { height: 6px; }
.read-btn:not(.speaking) .sound-wave span:nth-child(2) { height: 12px; }
.read-btn:not(.speaking) .sound-wave span:nth-child(3) { height: 16px; }
.read-btn:not(.speaking) .sound-wave span:nth-child(4) { height: 12px; }
.read-btn:not(.speaking) .sound-wave span:nth-child(5) { height: 6px; }

@keyframes wave-bar {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.2); }
}

/* === ANIMAL SOUND BUTTON === */
.sound-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.95rem;
  border-radius: 100px;
  border: 2.5px solid currentColor;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  flex-shrink: 0;
}

.sound-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.sound-btn.playing {
  animation: sound-pulse 0.9s ease-in-out infinite;
}

@keyframes sound-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.1); }
}

/* Card inline sound btn — sits next to animal name */
.card-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.card-name {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
}

/* Modal sound btn — sits next to animal name */
.modal-name-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}

.modal-name {
  font-family: 'Fredoka One', cursive;
  font-size: 2.2rem;
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .modal-top { grid-template-columns: 1fr; }
  .modal-viewer { border-radius: 24px 24px 0 0; }
  .zoo-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  nav a span { display: none; }
}
