/* ═══════════════════════════════════════════════
   INDEX PAGE STYLES — Main Sphaerotheriida page
   ═══════════════════════════════════════════════ */

/* ─── HERO BANNER BACKGROUND ─── */
.hero-banner-bg {
  position: absolute; inset: 0;
  background: url('../images/banner.png') center/cover no-repeat;
  z-index: 0;
}
.hero-banner-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(10, 14, 12, 0.65);
}
.hero { z-index: 1; }

/* ─── HERO BACKGROUND RINGS ─── */
.hero-bg-rings {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.hero-bg-rings svg { width: min(90vw, 900px); height: min(90vw, 900px); opacity: 0.07; }

/* ─── PILL MILLIPEDE SVG HERO ─── */
.millipede-wrap {
  margin: 0 auto 1.5rem;
  width: 320px; height: 320px;
  display: flex; align-items: center; justify-content: center;
  animation: fadeUp 1s 0.05s ease both;
}
#pill-svg { cursor: pointer; }
.pill-body { transform-origin: 50% 50%; transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1); }
.pill-svg-wrap:hover .pill-body,
.pill-svg-wrap.rolled .pill-body {
  /* controlled by JS */
}

/* ─── HERO STATS ─── */
.hero-stats {
  display: flex; gap: 2.5rem; justify-content: center;
  animation: fadeUp 1s 0.45s ease both;
}
.hero-stat { text-align: center; }
.hero-stat-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem; font-weight: 500;
  color: var(--gold2);
  display: block;
}
.hero-stat-label {
  font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin-top: 0.1rem;
}

/* ─── PHYLOGENY / MAP SECTION ─── */
#phylogeny { background: var(--bg2); }
.map-section { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start; margin-top: 3rem; }
@media(max-width:768px){.map-section{grid-template-columns:1fr;}}

.family-list { list-style: none; display: flex; flex-direction: column; gap: 0; }
.family-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.6rem;
  overflow: hidden;
  transition: border-color 0.3s;
}
.family-item:hover { border-color: var(--border2); }
.family-header {
  display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.1rem;
  cursor: pointer;
  background: rgba(255,255,255,0.02);
  transition: background 0.2s;
}
.family-header:hover { background: rgba(255,255,255,0.04); }
.family-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.family-name {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: 1.05rem; color: var(--cream2); flex: 1;
}
.family-region { font-size: 0.68rem; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.family-chevron { color: var(--muted); font-size: 0.8rem; transition: transform 0.3s; }
.family-item.open .family-chevron { transform: rotate(90deg); }
.family-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  font-size: 0.88rem; line-height: 1.7; color: var(--muted);
  padding: 0 1.1rem;
}
.family-item.open .family-body { max-height: 200px; padding: 0.8rem 1.1rem; }

/* ─── WORLD MAP (Plotly) ─── */
.world-map-wrap { position: sticky; top: 6rem; }
.world-map-label {
  font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.8rem; text-align: center;
}
#world-map {
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.map-legend { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; margin-top: 1rem; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.family-item.map-active { border-color: var(--gold); background: rgba(201,149,43,0.08); }

/* ─── MORPHOLOGY ─── */
#morphology { background: var(--bg3); }
.morph-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 3rem; }
@media(max-width:900px){.morph-grid{grid-template-columns:repeat(2,1fr);}}
@media(max-width:560px){.morph-grid{grid-template-columns:1fr;}}

.morph-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.6rem 1.4rem;
  background: rgba(255,255,255,0.015);
  position: relative; overflow: hidden;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.morph-card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--clr, var(--sage));
  opacity: 0; transition: opacity 0.3s;
}
.morph-card:hover { transform: translateY(-3px); border-color: var(--border2); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.morph-card:hover::after { opacity: 1; }
.morph-icon { font-size: 2rem; margin-bottom: 1rem; }
.morph-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem; color: var(--cream2);
  margin-bottom: 0.6rem;
}
.morph-text { font-size: 0.87rem; line-height: 1.75; color: var(--muted); }
.morph-tag {
  display: inline-block; margin-top: 0.9rem;
  font-size: 0.65rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--clr, var(--sage)); border: 1px solid var(--clr, var(--sage));
  padding: 0.2rem 0.6rem; border-radius: 2px; opacity: 0.7;
}

/* ─── VOLVATION ─── */
#volvation { background: var(--bg); }
.volvation-layout { display: grid; grid-template-columns: 1fr 1.2fr; gap: 4rem; align-items: center; margin-top: 3rem; }
@media(max-width:768px){.volvation-layout{grid-template-columns:1fr;}}

.volvation-steps { display: flex; flex-direction: column; gap: 1.2rem; }
.vstep {
  display: flex; gap: 1.2rem; align-items: flex-start;
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}
.vstep:hover, .vstep.active {
  border-color: var(--gold);
  background: rgba(201,149,43,0.05);
}
.vstep-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem; font-weight: 300; color: var(--gold2); opacity: 0.4;
  line-height: 1; flex-shrink: 0; transition: opacity 0.3s;
}
.vstep.active .vstep-num { opacity: 1; }
.vstep-text h4 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem; color: var(--cream2); margin-bottom: 0.3rem;
}
.vstep-text p { font-size: 0.85rem; line-height: 1.65; color: var(--muted); }

/* ─── VOLVATION SVG ANIMATION ─── */
.volvation-viz {
  display: flex; flex-direction: column; align-items: center; gap: 1.5rem;
}
#vol-svg { filter: drop-shadow(0 8px 30px rgba(0,0,0,0.5)); }
.vol-progress {
  display: flex; gap: 0.5rem;
}
.vol-pip {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border); transition: background 0.3s;
}
.vol-pip.active { background: var(--gold); }
.vol-btn {
  padding: 0.6rem 1.5rem;
  background: transparent; border: 1px solid var(--gold);
  color: var(--gold); font-family: 'Jost', sans-serif;
  font-size: 0.78rem; letter-spacing: 0.15em; text-transform: uppercase;
  cursor: pointer; border-radius: 3px;
  transition: all 0.25s;
}
.vol-btn:hover { background: var(--gold); color: var(--bg); }

/* ─── ECOLOGY ─── */
#ecology { background: var(--bg2); }
.eco-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 3rem; }
@media(max-width:700px){.eco-grid{grid-template-columns:1fr;}}

.eco-card {
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}
.eco-card-inner { padding: 2rem; }
.eco-card-bg {
  position: absolute; inset: 0; opacity: 0.04;
  background-size: cover; pointer-events: none;
}
.eco-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem; color: var(--cream2); margin-bottom: 0.8rem;
  display: flex; align-items: center; gap: 0.8rem;
}
.eco-card h3 span { font-size: 1.5rem; }
.eco-card p { font-size: 0.88rem; line-height: 1.75; color: var(--muted); position: relative; }
.eco-stat-row { display: flex; gap: 2rem; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.eco-stat-item { }
.eco-stat-val {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem; color: var(--gold2);
  display: block; line-height: 1;
}
.eco-stat-lbl { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* ─── REPRODUCTION ─── */
#reproduction { background: var(--bg3); }
.repro-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 4rem; align-items: start; margin-top: 3rem; }
@media(max-width:768px){.repro-layout{grid-template-columns:1fr;}}

.stridulation-box {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 1.8rem;
  margin-top: 1.5rem;
}
.stridulation-box h4 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem; color: var(--cream2); margin-bottom: 0.5rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.stridulation-box p { font-size: 0.85rem; line-height: 1.7; color: var(--muted); margin-bottom: 1rem; }
#waveform-canvas { width: 100%; height: 70px; display: block; border-radius: 4px; }

.repro-timeline { position: relative; padding-left: 1.5rem; }
.repro-timeline::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 1px; background: linear-gradient(to bottom, var(--gold), transparent);
}
.rt-step { margin-bottom: 1.8rem; position: relative; }
.rt-step::before {
  content: ''; position: absolute; left: -1.5rem; top: 0.3rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); transform: translateX(-3.5px);
  box-shadow: 0 0 8px var(--gold);
}
.rt-step h4 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem; color: var(--cream2); margin-bottom: 0.3rem;
}
.rt-step p { font-size: 0.85rem; line-height: 1.7; color: var(--muted); }

/* ─── CONSERVATION ─── */
#conservation { background: var(--bg); }
.threat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 3rem; }
@media(max-width:700px){.threat-grid{grid-template-columns:1fr;}}

.threat-card {
  padding: 1.5rem 1.2rem;
  border-radius: 8px;
  border: 1px solid;
  position: relative; overflow: hidden;
  transition: transform 0.3s;
}
.threat-card:hover { transform: translateY(-3px); }
.threat-card.red { border-color: rgba(210,60,60,0.3); background: rgba(210,60,60,0.04); }
.threat-card.amber { border-color: rgba(210,140,40,0.35); background: rgba(210,140,40,0.04); }
.threat-card.green { border-color: rgba(80,180,120,0.3); background: rgba(80,180,120,0.04); }
.threat-icon { font-size: 2rem; margin-bottom: 0.8rem; }
.threat-title { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; color: var(--cream2); margin-bottom: 0.5rem; }
.threat-text { font-size: 0.84rem; line-height: 1.7; color: var(--muted); }
.threat-card.red .threat-title { color: #e07070; }
.threat-card.amber .threat-title { color: var(--gold2); }
.threat-card.green .threat-title { color: var(--sage2); }

.conservation-callout {
  margin-top: 3rem; padding: 2.5rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(111,170,133,0.06), rgba(201,149,43,0.04));
  border: 1px solid rgba(111,170,133,0.2);
}
.conservation-callout p {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem; font-style: italic;
  line-height: 1.7; color: var(--cream);
  text-align: center;
}
