/* ==========================================================================
   Animals & Habitats Lesson — shared styles
   Friendly, bright, and readable for young learners.
   ========================================================================== */

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

:root {
  --font-body: 'Quicksand', 'Nunito', 'Comic Sans MS', system-ui, sans-serif;
  --font-display: 'Fredoka', 'Quicksand', system-ui, sans-serif;

  --ink: #2b2140;
  --ink-soft: #5a4e78;
  --paper: #fff8ec;
  --accent: #ff7a59;
  --accent-2: #ffd166;
  --ok: #06a77d;
  --shadow: 0 8px 22px rgba(43, 33, 64, 0.14);
}

html, body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  font-size: 18px;
  scroll-behavior: smooth;
}

/* ---------- Page header ---------- */
.page-header {
  background:
    radial-gradient(circle at 20% 20%, #ffe9a8 0%, transparent 55%),
    radial-gradient(circle at 85% 35%, #ffc0b1 0%, transparent 55%),
    linear-gradient(135deg, #82d8ff 0%, #9ae7c7 100%);
  padding: 48px 24px 72px;
  text-align: center;
  color: var(--ink);
  position: relative;
  overflow: hidden;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.page-header .subtitle {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 680px;
  margin: 0 auto 24px;
}

.page-header .lesson-tag {
  display: inline-block;
  background: white;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.diorama-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: white;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  margin-top: 10px;
}

.diorama-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(43, 33, 64, 0.25);
}

.diorama-cta .arrow {
  transition: transform 0.2s ease;
}

.diorama-cta:hover .arrow {
  transform: translateX(4px);
}

/* ---------- Intro / teacher band ---------- */
.intro-band {
  max-width: 880px;
  margin: -40px auto 0;
  background: white;
  border-radius: 22px;
  padding: 28px 32px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
}

.intro-band h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 8px;
  color: var(--accent);
}

.intro-band p {
  color: var(--ink-soft);
  font-size: 1rem;
}

/* ---------- Animal grid ---------- */
.animals {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.animals h2.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  text-align: center;
  margin-bottom: 32px;
  color: var(--ink);
}

.animal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

/* ---------- Animal card ---------- */
.animal-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 3px solid transparent;
}

.animal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(43, 33, 64, 0.2);
}

.animal-card.open {
  border-color: var(--accent);
}

.animal-banner {
  padding: 28px 20px;
  text-align: center;
  font-size: 4.5rem;
  line-height: 1;
  position: relative;
}

.animal-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(255, 255, 255, 0.25));
  pointer-events: none;
}

.animal-body {
  padding: 20px 22px 22px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.animal-body h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 2px;
}

.habitat-label {
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 10px;
}

.habitat-description {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.traits-title, .empathy-title, .question-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 12px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.traits-list {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
}

.traits-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.traits-list li::before {
  content: '✦';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent-2);
  font-weight: 700;
}

.empathy-box {
  background: #fff4e4;
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  border-radius: 0 12px 12px 0;
  margin-top: 4px;
  font-size: 0.95rem;
  color: var(--ink);
}

.discussion-box {
  background: #e5f7f0;
  border-left: 4px solid var(--ok);
  padding: 12px 14px;
  border-radius: 0 12px 12px 0;
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--ink);
}

.discussion-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ok);
  margin-bottom: 4px;
}

/* Collapsed state: hide extended details until user clicks */
.animal-extra {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.animal-card.open .animal-extra {
  max-height: 1200px;
}

.tap-hint {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-style: italic;
  align-self: flex-start;
}

.animal-card.open .tap-hint::before {
  content: '▲ Tap to close';
}

.animal-card:not(.open) .tap-hint::before {
  content: '▼ Tap to read the story & question';
}

/* ---------- Banner habitat backgrounds ---------- */
.habitat-savanna    { background: linear-gradient(180deg, #ffd68a, #f8a94e); }
.habitat-antarctic  { background: linear-gradient(180deg, #cde9ff, #89c3eb); }
.habitat-ocean      { background: linear-gradient(180deg, #6fc5e0, #2680a8); }
.habitat-bamboo     { background: linear-gradient(180deg, #a8e6a1, #4fa85e); }
.habitat-forest     { background: linear-gradient(180deg, #f4a676, #b25c3a); }
.habitat-desert     { background: linear-gradient(180deg, #ffd9a0, #e78a3a); }
.habitat-rainforest { background: linear-gradient(180deg, #5bc07d, #1f6f4a); }
.habitat-eucalyptus { background: linear-gradient(180deg, #c9dec4, #6a9b7a); }
.habitat-meadow     { background: linear-gradient(180deg, #ffe68a, #8ac74b); }
.habitat-arctic     { background: linear-gradient(180deg, #e8f4ff, #9dd1eb); }

/* ---------- Page footer ---------- */
.page-footer {
  background: var(--ink);
  color: #e8e1f3;
  padding: 32px 24px;
  text-align: center;
  font-size: 0.9rem;
}

.page-footer a {
  color: var(--accent-2);
}

/* ==========================================================================
   Diorama page
   ========================================================================== */

.diorama-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: #041628;
  overflow: hidden;
}

.diorama-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: linear-gradient(180deg, rgba(4, 22, 40, 0.85), rgba(4, 22, 40, 0));
  color: white;
}

.diorama-top-bar h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}

.back-link {
  color: white;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.15);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  backdrop-filter: blur(6px);
  transition: background 0.15s ease;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* The scene fills the viewport */
.reef {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    180deg,
    #4aaed6 0%,
    #2176a8 35%,
    #104a74 75%,
    #072c4a 100%
  );
  overflow: hidden;
}

/* Sunbeams radiating from surface */
.sunbeam {
  position: absolute;
  top: -10%;
  width: 120px;
  height: 110%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  transform-origin: top center;
  filter: blur(6px);
  opacity: 0.6;
  animation: sway-beam 9s ease-in-out infinite alternate;
}
.sunbeam.b1 { left: 10%;  transform: rotate(-8deg);  animation-delay: 0s;   }
.sunbeam.b2 { left: 32%;  transform: rotate(-3deg);  animation-delay: 1.5s; }
.sunbeam.b3 { left: 55%;  transform: rotate( 4deg);  animation-delay: 3s;   }
.sunbeam.b4 { left: 78%;  transform: rotate(10deg);  animation-delay: 4.5s; }

@keyframes sway-beam {
  from { transform: translateX(-10px) rotate(var(--r, 0deg)); opacity: 0.45; }
  to   { transform: translateX(10px)  rotate(var(--r, 0deg)); opacity: 0.7;  }
}

/* Wavy water surface shimmer */
.water-surface {
  position: absolute;
  top: 0;
  left: -5%;
  width: 110%;
  height: 40px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent);
  animation: shimmer 5s ease-in-out infinite alternate;
}

@keyframes shimmer {
  from { transform: translateX(-10px); opacity: 0.5; }
  to   { transform: translateX(10px);  opacity: 0.8; }
}

/* Sandy seafloor */
.seafloor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 160px;
  background: linear-gradient(180deg, #e9c387 0%, #c99a59 100%);
  border-radius: 50% 50% 0 0 / 40px 40px 0 0;
}

/* Seaweed */
.seaweed {
  position: absolute;
  bottom: 110px;
  width: 14px;
  background: linear-gradient(180deg, #5ac27d, #1f6f4a);
  border-radius: 8px 8px 2px 2px;
  transform-origin: bottom center;
  animation: sway-weed 4s ease-in-out infinite alternate;
}

.seaweed.w1 { left: 8%;  height: 160px; animation-delay: 0s;   }
.seaweed.w2 { left: 22%; height: 120px; animation-delay: 1s;   }
.seaweed.w3 { left: 72%; height: 180px; animation-delay: 0.5s; }
.seaweed.w4 { left: 88%; height: 140px; animation-delay: 1.5s; }

@keyframes sway-weed {
  from { transform: rotate(-6deg); }
  to   { transform: rotate(6deg);  }
}

/* Coral clusters */
.coral {
  position: absolute;
  bottom: 100px;
}

/* Pink branching coral */
.coral-pink {
  left: 14%;
  width: 110px;
  height: 120px;
}
.coral-pink .branch {
  position: absolute;
  bottom: 0;
  background: linear-gradient(180deg, #ff9ab3, #e15c86);
  border-radius: 40% 40% 12px 12px;
}
.coral-pink .branch:nth-child(1) { left: 10px; width: 22px; height: 80px; }
.coral-pink .branch:nth-child(2) { left: 36px; width: 26px; height: 110px; }
.coral-pink .branch:nth-child(3) { left: 66px; width: 22px; height: 90px; }
.coral-pink .branch:nth-child(4) { left: 88px; width: 18px; height: 60px; }

/* Orange brain coral */
.coral-orange {
  left: 38%;
  width: 140px;
  height: 70px;
  background: radial-gradient(circle at 30% 60%, #ffb36a, #e5723a 70%);
  border-radius: 60% 60% 18px 18px;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.2);
}

/* Purple fan coral */
.coral-purple {
  right: 14%;
  width: 120px;
  height: 130px;
}
.coral-purple .fan {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 120px;
  height: 130px;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 100%, #8b5cf6 0%, #8b5cf6 30%, transparent 32%),
    repeating-conic-gradient(from 200deg at 50% 100%, transparent 0 6deg, #a78bfa 6deg 8deg);
  clip-path: polygon(0% 100%, 15% 20%, 50% 0%, 85% 20%, 100% 100%);
}

/* Yellow small coral */
.coral-yellow {
  left: 62%;
  width: 90px;
  height: 60px;
  background: radial-gradient(circle at 40% 70%, #ffd65a, #e5a73a);
  border-radius: 60% 60% 16px 16px;
}

/* Bubbles */
.bubble {
  position: absolute;
  bottom: -40px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.2) 60%, rgba(255, 255, 255, 0.05));
  animation: rise linear infinite;
  opacity: 0.8;
}

@keyframes rise {
  0%   { transform: translateY(0)      translateX(0);   opacity: 0;   }
  10%  {                                                  opacity: 0.9; }
  50%  { transform: translateY(-50vh)  translateX(10px); }
  100% { transform: translateY(-110vh) translateX(-10px); opacity: 0; }
}

/* Sea turtle — uses a big emoji so every kid instantly recognises it */
.turtle {
  position: absolute;
  font-size: 6rem;
  left: -10%;
  top: 40%;
  animation: swim-turtle 24s linear infinite;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
  transform-origin: center;
}

@keyframes swim-turtle {
  0%   { transform: translateX(0)       translateY(0)  rotate(-4deg); }
  25%  { transform: translateX(40vw)    translateY(-30px) rotate(2deg); }
  50%  { transform: translateX(80vw)    translateY(10px)  rotate(-4deg); }
  75%  { transform: translateX(110vw)   translateY(-20px) rotate(2deg); }
  100% { transform: translateX(130vw)   translateY(0)     rotate(-4deg); }
}

/* School of fish */
.fish {
  position: absolute;
  font-size: 1.8rem;
  animation: swim-fish linear infinite;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

@keyframes swim-fish {
  0%   { transform: translateX(110vw) translateY(0);    }
  50%  { transform: translateX(50vw)  translateY(15px); }
  100% { transform: translateX(-10vw) translateY(0);    }
}

/* Info caption for the teacher */
.diorama-caption {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  padding: 12px 22px;
  border-radius: 16px;
  max-width: min(560px, 90vw);
  text-align: center;
  font-size: 0.95rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.diorama-caption strong {
  color: var(--accent);
}

/* Small screens */
@media (max-width: 520px) {
  .turtle { font-size: 4.5rem; }
  .coral-pink  { width: 80px; }
  .coral-purple { width: 90px; }
  .coral-orange { width: 100px; }
  .diorama-top-bar h1 { font-size: 1rem; }
}
