/* Shared styles for every Animal Explorer page. Each page sets its own theme colors
   (--accent, --accent-dark, --soft, --hero-from, --dark, --band) in a <style> tag. */
:root {
  --accent: #2f9e75;
  --accent-dark: #1f6e52;
  --soft: #dff5ea;
  --hero-from: #8ad9b5;
  --dark: #16302a;
  --band: none;
  --ink: #2b1d12;
  --cream: #fffaf2;
  --paper: #ffffff;
  --green: #2f8f5b;
  --purple: #6b4fc8;
  --shadow: 0 6px 18px rgba(40, 30, 10, 0.12);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 1.15rem;
  line-height: 1.6;
}
h1, h2, h3 { font-family: "Fredoka", "Nunito", sans-serif; line-height: 1.2; }
h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0 0 0.5rem; }
h3 { font-size: 1.35rem; margin: 0.6rem 0 0.3rem; }
img { max-width: 100%; display: block; }
a { color: var(--accent-dark); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* Top bar linking all animals */
.sitebar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
  padding: 0.6rem max(1rem, 5vw);
  background: var(--dark);
}
.sitebar a { color: #fff; text-decoration: none; font-weight: 800; }
.home-link { font-family: "Fredoka", sans-serif; font-size: 1.2rem; }
.sitebar nav { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.sitebar nav a { padding: 0.2rem 0.75rem; border-radius: 999px; background: rgba(255, 255, 255, 0.12); }
.sitebar nav a[aria-current="page"], .sitebar nav a:hover { background: var(--accent); }

/* Hero, with a themed band along the bottom */
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: center;
  padding: 3rem max(1rem, 5vw) 3.5rem;
  background: linear-gradient(135deg, var(--hero-from), var(--accent));
  position: relative;
}
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18px;
  background: var(--band);
}
.kicker { font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; margin: 0; }
.hero h1 { font-size: clamp(2.6rem, 7vw, 4.5rem); margin: 0.2rem 0 0.6rem; }
.hero h1 .hl { color: var(--paper); text-shadow: 3px 3px 0 var(--dark); }
.lead { font-size: 1.3rem; max-width: 34ch; }
.hero-photo { margin: 0; }
.hero-photo img { border-radius: var(--radius); border: 6px solid var(--paper); box-shadow: var(--shadow); aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.hero-photo figcaption { margin-top: 0.5rem; font-weight: 600; }

.fact-btn, .wizard button[type="submit"], .quiz button.next, .quiz button.restart {
  font: 700 1.1rem "Fredoka", sans-serif;
  background: var(--dark); color: var(--paper);
  border: none; border-radius: 999px; padding: 0.75rem 1.4rem;
  cursor: pointer; box-shadow: var(--shadow);
}
.fact-btn:hover { transform: translateY(-2px); }
.random-fact {
  min-height: 3em; font-weight: 700;
  background: rgba(255, 255, 255, 0.85); border-radius: 14px;
  padding: 0.6rem 1rem; margin-top: 1rem; max-width: 40ch;
}
.random-fact:empty { visibility: hidden; }

/* Sticky section menu */
.topnav {
  position: sticky; top: 0; z-index: 10;
  /* One row that scrolls sideways, so the sticky menu never covers more than a sliver of the page */
  display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: thin;
  justify-content: safe center;
  padding: 0.7rem max(1rem, 5vw);
  background: var(--paper); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.topnav a {
  flex: none; text-decoration: none; color: var(--ink); font-weight: 800;
  background: var(--soft); padding: 0.35rem 0.9rem; border-radius: 999px;
}
.topnav a:hover { background: var(--accent); color: var(--paper); }

main section, footer { padding: 3rem max(1rem, 5vw); scroll-margin-top: 4rem; }
main > section:nth-of-type(even) { background: color-mix(in srgb, var(--soft) 55%, white); }
.section-lead { font-size: 1.2rem; max-width: 60ch; margin-top: 0; }
.note { max-width: 70ch; background: var(--paper); border-left: 6px solid var(--accent); padding: 0.8rem 1rem; border-radius: 10px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center; }
.split.reverse > :first-child { order: 2; }
figure { margin: 0; }
figure img { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
figcaption { margin-top: 0.4rem; font-weight: 600; font-size: 1rem; }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.facts { padding-left: 1.2rem; }
.facts li { margin-bottom: 0.6rem; }
.try { background: var(--paper); border-radius: 14px; padding: 0.7rem 1rem; box-shadow: var(--shadow); }

.tag { display: inline-block; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.03em; padding: 0.1rem 0.55rem; border-radius: 999px; vertical-align: middle; }
.tag.real { background: #d8f3e3; color: #1d6b41; }
.tag.ai { background: #e9e2ff; color: var(--purple); }

/* Card grids */
.cards { display: grid; gap: 1.2rem; }
.numbers { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.icons { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 1.5rem; }
.videos { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.num-card {
  text-align: left; font: inherit; color: inherit;
  background: var(--paper); border: 3px solid transparent; border-radius: var(--radius);
  padding: 1.2rem; box-shadow: var(--shadow); cursor: pointer;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.num-card:hover, .num-card[aria-expanded="true"] { border-color: var(--accent); }
.num-card .big { font: 700 2.4rem "Fredoka", sans-serif; color: var(--accent-dark); }
.num-card .compare { display: none; font-weight: 700; background: var(--soft); border-radius: 12px; padding: 0.5rem 0.7rem; margin-top: 0.4rem; }
.num-card[aria-expanded="true"] .compare { display: block; }

.card, .video-card { background: var(--paper); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); padding-bottom: 1rem; }
.card img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.card h3, .card p, .card .tag { margin-left: 1rem; margin-right: 1rem; }
.card p { font-size: 1.05rem; }

.icon-card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; text-align: center; }
.icon-card span { font-size: 3rem; }
.icon-card p { margin: 0.3rem 0 0; }

/* Quiz */
.feature { text-align: center; }
.feature .section-lead { margin-left: auto; margin-right: auto; }
.quiz, .wizard-box {
  max-width: 680px; margin: 0 auto;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; text-align: left;
}
.quiz-progress { height: 14px; background: var(--soft); border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.quiz-bar { height: 100%; width: 0; background: repeating-linear-gradient(115deg, var(--accent) 0 14px, var(--dark) 14px 22px); transition: width 0.4s; }
.quiz .step { font-weight: 800; color: var(--accent-dark); margin: 0; }
.quiz h3 { font-size: 1.5rem; }
.quiz .choices { display: grid; gap: 0.6rem; margin: 1rem 0; }
.quiz .choice {
  font: 600 1.1rem "Nunito", sans-serif; text-align: left;
  padding: 0.8rem 1rem; border-radius: 14px;
  border: 3px solid var(--soft); background: #fffdf9; cursor: pointer; color: var(--ink);
}
.quiz .choice:hover:not(:disabled) { border-color: var(--accent); }
.quiz .choice.correct { border-color: var(--green); background: #e3f7ea; }
.quiz .choice.wrong { border-color: #d9534f; background: #fde8e7; }
.quiz .feedback { font-weight: 700; min-height: 1.5em; }
.quiz .result { text-align: center; }
.quiz .badge { font-size: 4rem; }

/* Animal Wizard */
main > section.wizard { background: linear-gradient(135deg, #efe9ff, var(--soft)); }
.examples { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.examples button {
  font: 600 0.95rem "Nunito", sans-serif;
  background: #efe9ff; color: var(--purple); border: 2px solid #d6cbff;
  border-radius: 999px; padding: 0.35rem 0.8rem; cursor: pointer;
}
.examples button:disabled, .wizard button[type="submit"]:disabled { opacity: 0.5; cursor: wait; }
#ask-form { display: flex; gap: 0.6rem; }
#ask-form input {
  flex: 1; min-width: 0; font: 600 1.1rem "Nunito", sans-serif;
  padding: 0.7rem 1rem; border-radius: 999px; border: 3px solid #d6cbff;
}
.wizard button[type="submit"] { background: var(--purple); }
.chat { max-height: 26rem; overflow-y: auto; margin-bottom: 1rem; padding-right: 0.3rem; }
.chat:empty { display: none; }
.chat .bubble { background: #f6f2ff; border-radius: 18px; padding: 1rem 1.2rem; border: 2px solid #e1d8ff; }
.chat .bubble::before { content: "🧙 "; }
.chat .asked {
  margin: 0 0 0.6rem auto; width: fit-content; max-width: 85%;
  background: var(--soft); border-radius: 18px 18px 4px 18px; padding: 0.6rem 1rem; font-weight: 700;
}
.chat .asked::before { content: "🙋 "; }
.new-question {
  display: block; width: 100%; margin-top: 1rem;
  font: 700 1.2rem "Fredoka", sans-serif;
  background: var(--paper); color: var(--purple);
  border: 3px solid var(--purple); border-radius: 999px;
  padding: 0.8rem 1.2rem; cursor: pointer;
}
.new-question:hover { background: var(--purple); color: var(--paper); }
.new-question[hidden] { display: none; }
.chat .thinking { color: var(--purple); font-weight: 700; }
.small { font-size: 0.9rem; opacity: 0.8; }

/* Videos */
.video-card { text-decoration: none; color: var(--ink); display: block; }
.video-card .thumb { position: relative; }
.video-card .thumb img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.video-card .thumb::after {
  content: "▶"; position: absolute; inset: 0; margin: auto; width: 64px; height: 64px;
  display: grid; place-items: center; font-size: 1.8rem; color: var(--paper);
  background: rgba(220, 30, 30, 0.9); border-radius: 50%;
}
.video-card h3 { font-size: 1.1rem; margin: 0.7rem 1rem 0.2rem; }
.video-card p { margin: 0 1rem; font-size: 0.95rem; opacity: 0.8; }
.video-card:hover { transform: translateY(-3px); }

footer { background: var(--dark); color: #f3ede4; }
footer h2 { color: var(--hero-from); }
footer a { color: var(--hero-from); }
.credits { font-size: 0.95rem; }

/* Home page */
.home-hero { grid-template-columns: 1fr; text-align: center; padding-bottom: 3rem; }
.home-hero .lead { margin: 0 auto; max-width: 46ch; }
.animals { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.animal-card {
  display: block; text-decoration: none; color: var(--ink);
  background: var(--paper); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 4px solid var(--soft);
}
.animal-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.animal-card img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.animal-card-text { padding: 1rem 1.2rem 1.3rem; }
.animal-card h2 { font-size: 1.8rem; }
.animal-card .go { font-weight: 800; color: var(--accent); }
.animal-card.soon { display: grid; place-items: center; text-align: center; border-style: dashed; background: #fffdf9; }

/* Animal Wizard: link in the top bar, banner on the home page, and its own page */
.sitebar nav a.wizard-link { background: #6b4fc8; }
.sitebar nav a.wizard-link:hover, .sitebar nav a.wizard-link[aria-current="page"] { background: #8a6ff0; }
.wizard-banner {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.5rem; padding: 1rem 1.4rem;
  background: linear-gradient(135deg, #efe9ff, #fff); border: 3px solid #d6cbff; border-radius: var(--radius);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow); font-size: 1.15rem;
}
.wizard-banner:hover { border-color: #6b4fc8; transform: translateY(-2px); }
.wizard-banner-icon { font-size: 2.8rem; }
.wizard-banner .go { margin-left: auto; font-weight: 800; color: #6b4fc8; }
main > section.wizard-only { padding-top: 2.5rem; }
.wizard-animals { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; }
.wizard-animals a {
  font: 700 1.2rem "Fredoka", sans-serif; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 3px solid var(--soft); border-radius: 999px; padding: 0.6rem 1.2rem; box-shadow: var(--shadow);
}
.wizard-animals a:hover { border-color: var(--accent); }

@media (max-width: 760px) {
  .hero, .split { grid-template-columns: 1fr; }
  .split.reverse > :first-child { order: 0; }
  #ask-form { flex-direction: column; }
}

/* Wizard chat extras */
.chat .bubble { margin: 0 0 0.8rem; }
.chat-end { text-align: center; font-weight: 800; color: var(--purple); margin: 0.5rem 0 0; }
.turns { margin: 0.6rem 0 0; font-weight: 700; color: var(--purple); font-size: 0.95rem; }
.examples[hidden] { display: none; }
#ask-form input:disabled { background: #f3f0fa; }
