/* ── Calls of the Wild — landing, quiz, and My Birds styling ── */

/* ═══ Landing hero (mirrors wild_tracks_studio's hero pattern) ═══ */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
  padding: clamp(3rem, 8vw, 6rem) 0;
}

.hero-art {
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: var(--neu-out);
  display: grid;
  place-items: center;
  max-width: 380px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  animation: heroPulse 4.5s ease-in-out infinite;
}

.hero-art .note {
  position: absolute;
  font-size: 2rem;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.hero-art .note:nth-child(2) { top: 10%; right: 14%; animation-delay: 0.6s; }
.hero-art .note:nth-child(3) { bottom: 16%; left: 10%; animation-delay: 1.2s; }
.hero-art .note:nth-child(4) { top: 46%; left: 4%; animation-delay: 1.8s; font-size: 1.4rem; }

@keyframes heroPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); opacity: 0.85; }
  50% { transform: translateY(-10px); opacity: 1; }
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.steps .card { text-align: center; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.steps .icon {
  width: 64px; height: 64px; border-radius: 50%;
  box-shadow: var(--neu-in);
  display: grid; place-items: center; font-size: 1.8rem;
}

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .steps { grid-template-columns: 1fr; }
  .hero .row { justify-content: center; }
}

/* ═══ Ambient background (play.html) ═══ */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, color-mix(in srgb, var(--teal) 22%, transparent), transparent 60%),
    radial-gradient(ellipse 55% 45% at 82% 30%, color-mix(in srgb, var(--violet) 18%, transparent), transparent 60%),
    radial-gradient(ellipse 70% 60% at 50% 90%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 65%);
  background-size: 140% 140%;
  background-position: 0% 0%;
  opacity: 0.55;
  transition: opacity 1.2s ease;
  animation: ambientDrift 22s ease-in-out infinite alternate;
}

.ambient-bg.playing {
  opacity: 1;
  animation-duration: 12s;
}

@keyframes ambientDrift {
  0%   { background-position: 0% 0%, 100% 20%, 30% 100%; }
  50%  { background-position: 20% 30%, 70% 60%, 60% 70%; }
  100% { background-position: 40% 10%, 90% 10%, 10% 90%; }
}

/* ═══ Session bar ═══ */
.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.session-dots {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  cursor: help;
}

.session-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--neu-in);
}

.session-dot.done { background: var(--accent); box-shadow: none; }
.session-dot.done.revealed { background: var(--danger); }
.session-dot.current { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); }

/* ═══ Player card ═══ */
.player-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.viz-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--neu-in);
}

.viz-minimap,
.viz-main {
  display: block;
  width: 100%;
  cursor: pointer;
}

.viz-minimap {
  height: 40px;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

.viz-main {
  height: 130px;
}

.transport-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
}

.transport-controls .btn-icon { font-size: 1.3rem; }

.clip-error {
  text-align: center;
  color: var(--danger);
  font-size: 0.9rem;
}

/* ═══ Hints ═══ */
.hint-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hint-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  min-height: 2rem;
}

/* Deliberately flat + tinted, unlike the raised neumorphic .btn style used
   for actual controls ("Show me a hint", "What is this bird?") — hints are
   informational, not clickable, so they need to read as note/callout cards,
   not buttons. A left accent stripe + speech-bubble corner reinforces that,
   and the 💡 marks them as read-only content at a glance. */
.hint-bubble {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: color-mix(in srgb, var(--teal) 16%, var(--surface));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-radius: 4px var(--radius-sm) var(--radius-sm) var(--radius-sm);
  border-left: 4px solid var(--teal);
  padding: 0.65rem 1.1rem 0.65rem 0.85rem;
  font-size: 0.9rem;
  max-width: 34ch;
  line-height: 1.4;
  /* Starts invisible; .hint-bubble-show (added a frame after insertion)
     triggers a slow, dramatic reveal. Existing bubbles are repositioned
     separately via an inline FLIP transform set from JS. */
  opacity: 0;
  transform: translateY(18px) scale(0.85);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

.hint-bubble::before {
  content: "💡";
  flex-shrink: 0;
  font-size: 0.95em;
}

.hint-bubble.hint-bubble-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.hint-bubble:nth-child(3n+2) { background: color-mix(in srgb, var(--violet) 16%, var(--surface)); border-left-color: var(--violet); }
.hint-bubble:nth-child(3n)   { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-left-color: var(--accent); }

/* The most-recently-revealed hint stays visually distinct from older ones,
   so the player can tell at a glance what just changed on screen — reset
   when the next hint is requested (only one bubble ever carries this). */
.hint-bubble.hint-bubble-latest {
  background: color-mix(in srgb, var(--accent) 30%, var(--surface));
  border-left-color: var(--accent);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 40%, transparent);
  font-weight: 600;
}

/* ═══ Guess names ═══ */
.guess-names {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.guess-name {
  font-size: 0.88rem;
  transition: box-shadow 0.15s, transform 0.15s, opacity 0.15s, color 0.15s;
}

.guess-name:hover { transform: translateY(-2px); }
.guess-name.wrong { animation: shakeX 0.4s ease; }
.guess-name.correct { box-shadow: 0 0 0 3px var(--accent); color: var(--accent-deep); }
:root[data-theme="dark"] .guess-name.correct { color: var(--accent); }
.guess-name:disabled { opacity: 0.5; cursor: default; pointer-events: none; }

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ═══ Hover fact-card tooltip (base_res/hover_tooltip.js positioning) ═══ */
#cotw-fact-tip {
  position: fixed;
  z-index: 1500;
  width: 220px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--neu-out);
  padding: 0.85rem;
  pointer-events: none;
}

/* Source bird photos vary wildly in aspect ratio — a plain width:100% +
   object-fit:cover box crops birds out of frame. Per past experience with
   this exact class of bug (see feedback_bird_thumb_object_fit memory),
   object-fit alone isn't reliably enough: use a position:relative wrapper
   with a position:absolute; inset:0 image, which sizes strictly to the
   wrapper's box regardless of layout mode, then object-fit:contain so nothing
   is cropped. */
.fc-tip-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #3a3a3a;
  margin-bottom: 0.5rem;
}

.fc-tip-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fc-tip-body h3 { font-size: 1rem; }
.fc-tip-body .fc-sci { font-style: italic; color: var(--text-muted); font-size: 0.78rem; }
.fc-tip-body .fc-taxon { margin-top: 0.15rem; }
.fc-tip-body .fc-fact { margin-top: 0.5rem; line-height: 1.4; }

/* ═══ Hover progress-summary tooltip (session-dots bar) ═══ */
#cotw-progress-tip {
  position: fixed;
  z-index: 1500;
  width: max-content;
  max-width: 220px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--neu-out);
  padding: 0.7rem 0.9rem;
  pointer-events: none;
  font-size: 0.82rem;
}

.progress-tip-body .pt-row + .pt-row { margin-top: 0.3rem; }

/* ═══ Correct-guess fanfare ═══ */
.match-fanfare {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.match-fanfare.show { opacity: 1; }
.match-fanfare.fade-out { opacity: 0; transition: opacity 0.4s ease; }

.match-fanfare .fanfare-text {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 800;
  color: var(--accent-deep);
  background: var(--surface);
  box-shadow: var(--neu-out);
  padding: 1.1rem 2rem;
  border-radius: var(--radius);
  transform: scale(0.7) rotate(-3deg);
  transition: transform 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}

:root[data-theme="dark"] .match-fanfare .fanfare-text { color: var(--accent); }
.match-fanfare.show .fanfare-text { transform: scale(1) rotate(0); }

.match-fanfare .fanfare-deco {
  font-size: 2.2rem;
  opacity: 0;
  transform: translateY(10px) scale(0.6);
  transition: opacity 0.4s ease calc(var(--i) * 90ms), transform 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) calc(var(--i) * 90ms);
}

.match-fanfare.show .fanfare-deco { opacity: 1; transform: translateY(0) scale(1); }

/* ═══ Round-complete inline CTA ═══ */
.round-complete-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  text-align: center;
}

/* ═══ Fact-card reveal enhancements (injected into shared BirdDetail modal) ═══ */
.bd-overlay:not([hidden]) .bd-panel {
  animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.cotw-reveal-cta {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
}

.cotw-reveal-result {
  font-weight: 600;
}

.cotw-reveal-result .cotw-revealed { color: var(--danger); }

/* ═══ Session summary ═══ */
.summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--neu-in);
}

/* Source bird photos vary wildly in aspect ratio — plain object-fit:cover on
   a fixed circle crops the bird out of frame (see feedback_bird_thumb_object_fit
   memory). Wrapper sizes the circle; the img is absolutely positioned inside
   it with object-fit:contain so nothing is cropped. */
.summary-thumb {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  background: #3a3a3a;
}

.summary-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.summary-row .name { flex: 1; }

.summary-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: var(--neu-out-sm);
}

.summary-badge.revealed { color: var(--danger); }
.summary-badge.great { color: var(--teal); }

/* ═══ My Birds checklist ═══ */
.birds-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.stat-tile {
  text-align: center;
  min-width: 120px;
}

.stat-tile .num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-deep);
}

:root[data-theme="dark"] .stat-tile .num { color: var(--accent); }

.stat-tile .label { font-size: 0.8rem; color: var(--text-muted); }

.birds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.bird-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

/* Same crop-out-the-bird trap as .summary-thumb above — wrapper sizes the
   circle, img is absolutely positioned with object-fit:contain. */
.bird-thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 8%;
  overflow: hidden;
  box-shadow: var(--neu-in);
  background: #3a3a3a;
}

.bird-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bird-card.never-tried .bird-thumb img { filter: grayscale(1); opacity: 0.55; }

.bird-card .name { font-weight: 600; font-size: 0.9rem; }

.bird-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  box-shadow: var(--neu-out-sm);
}

.bird-badge.best { color: var(--teal); }
.bird-badge.revealed-only { color: var(--danger); }
.bird-badge.never { color: var(--text-muted); }

/* ═══ Misc ═══ */
.confirm-note { font-size: 0.8rem; color: var(--text-muted); }
