/* Linda Forrest Brand System */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #08090d;
  --card-bg: #0e1018;
  --card-border: rgba(255,255,255,0.06);
  --teal: #5bc4be;
  --teal-dim: #3a8a85;
  --purple: #9b8dc8;
  --green: #4a8f62;
  --muted: rgba(255,255,255,0.35);
  --label: rgba(255,255,255,0.18);
}

html, body {
  min-height: 100%;
  background: var(--bg);
  font-family: 'Inter', sans-serif;
  color: #fff;
  overflow-x: hidden;
}

body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  padding-top: max(1rem, 50vh - 400px); /* centers on spacious viewports, top-aligns on small */
}

/* Particle Background */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 2s ease;
}

#particles.active {
  opacity: 1;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--teal);
  border-radius: 50%;
  opacity: 0.6;
  animation: float 6s infinite ease-in-out;
}

@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0.6; }
  50% { transform: translateY(-30px) translateX(15px); opacity: 0.3; }
}

/* Card Container */
.card-container {
  width: 100%;
  max-width: 820px;
  min-height: 520px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 3.5rem 2rem;
  text-align: center;
  position: relative;
  z-index: 1;
  overflow: visible; /* allow scene 5 to grow naturally */
}

@media (max-width: 640px) {
  .card-container {
    padding: 2.5rem 1.5rem;
    min-height: 480px;
  }
}

/* Scene Transitions */
.scene {
  display: none;
  opacity: 0;
}

.scene.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
  overflow-y: auto;
  opacity: 1;
}

/* scene-enter class triggers the animation when switching scenes */
.scene.scene-enter {
  animation: fadeIn 0.6s ease forwards;
}

.scene.scene-enter-dramatic {
  animation: fadeInDramatic 0.9s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDramatic {
  0% { opacity: 0; transform: translateY(12px) scale(0.98); }
  60% { opacity: 0.85; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Logo & Animation */
.logo-icon {
  width: 36px;
  height: 56px;
  margin-bottom: 1.4rem;
  opacity: 0.75;
}

.animate-quill {
  animation: quillDraw 2s ease-in-out;
}

@keyframes quillDraw {
  from { opacity: 0; transform: translateY(-10px) rotate(-5deg); }
  to { opacity: 0.75; transform: translateY(0) rotate(0); }
}

/* Typography */
.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 600;
  color: var(--teal);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 0.7rem;
}

.scene-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 600;
  color: var(--teal);
  line-height: 1.3;
  margin-bottom: 1.5rem;
  max-width: 600px;
}

.apology-note {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(91,196,190,0.18);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 0 0 28px 0;
  max-width: 480px;
  width: 100%;
  text-align: center;
  animation: fadeSlideIn 0.8s ease both;
}
.apology-emoji {
  font-size: 2rem;
  margin-bottom: 8px;
  animation: wobble 2.5s ease-in-out infinite;
}
@keyframes wobble {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}
.apology-text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.05rem;
  font-style: italic;
  color: rgba(255,255,255,0.75);
  margin: 0;
  line-height: 1.7;
}
.apology-sub {
  font-size: 0.88rem;
  color: rgba(91,196,190,0.7);
  display: block;
  margin-top: 6px;
  line-height: 1.65;
}

.subhead {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.02em;
  font-style: italic;
}

.dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 0.5rem 0;
}

.dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
}

/* Buttons */
.nav-btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  outline: none;
}

.nav-btn.teal {
  border: 1.5px solid var(--teal-dim);
  color: var(--teal);
  background: transparent;
}

.nav-btn.teal:hover {
  background: rgba(91,196,190,0.15);
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 0 16px rgba(91,196,190,0.3);
}

.nav-btn.teal:active {
  transform: translateY(0) scale(0.97);
  box-shadow: none;
}

.nav-btn.green {
  border: 1.5px solid var(--green);
  color: #6dbf89;
  background: rgba(74,143,98,0.1);
}

.nav-btn.green:hover {
  background: rgba(74,143,98,0.22);
  transform: translateY(-2px);
}

/* Choice Buttons */
.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 500px;
  margin: 1rem 0;
}

.choice-btn {
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.3s ease;
  text-align: center;
}

.choice-btn.teal {
  border: 1.5px solid var(--teal-dim);
  color: var(--teal);
  background: rgba(91,196,190,0.05);
}

.choice-btn.teal:hover {
  background: rgba(91,196,190,0.15);
  border-color: var(--teal);
  transform: translateX(5px);
  box-shadow: 0 0 18px rgba(91,196,190,0.3);
}

.choice-btn.teal:active {
  transform: scale(0.97) translateX(2px);
  box-shadow: 0 0 8px rgba(91,196,190,0.2);
}

.choice-btn.purple {
  border: 1.5px solid rgba(155,141,200,0.4);
  color: var(--purple);
  background: rgba(155,141,200,0.05);
}

.choice-btn.purple:hover {
  background: rgba(155,141,200,0.15);
  border-color: var(--purple);
  transform: translateX(5px);
  box-shadow: 0 0 18px rgba(155,141,200,0.28);
}

.choice-btn.purple:active {
  transform: scale(0.97) translateX(2px);
  box-shadow: 0 0 8px rgba(155,141,200,0.18);
}

@keyframes choicePulse {
  0%   { box-shadow: 0 0 0 0 rgba(91,196,190,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(91,196,190,0); }
  100% { box-shadow: 0 0 0 0 rgba(91,196,190,0); }
}

.choice-btn.teal:focus-visible {
  animation: choicePulse 1.2s ease-out infinite;
}

/* Response Messages */
.response {
  display: none;
  margin-top: 1.5rem;
  animation: fadeIn 0.5s ease forwards;
}

.response.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.response-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--teal);
  line-height: 1.5;
  max-width: 500px;
}

.response-text.error {
  color: #ff6b6b;
}

/* Heartfelt Message */
.heartfelt-message {
  max-width: 600px;
  padding: 2rem;
  background: rgba(91,196,190,0.03);
  border-left: 3px solid var(--teal);
  border-radius: 8px;
  margin: 1rem 0;
}

.heartfelt-message p {
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 300;
  color: rgba(255,255,255,0.9);
  line-height: 1.8;
  margin-bottom: 1.5rem;
  text-align: left;
}

.heartfelt-message p:last-child {
  margin-bottom: 0;
}

.heartfelt-message strong {
  color: var(--teal);
  font-weight: 600;
}

.evolution {
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  color: var(--green) !important;
  font-size: 1.15rem !important;
}

.signature {
  text-align: right !important;
  font-family: 'Cormorant Garamond', serif !important;
  font-style: italic !important;
  color: var(--muted) !important;
  font-size: 1rem !important;
  margin-top: 2rem !important;
}

.sig-v {
  font-size: 1.8rem;
  color: var(--teal);
  font-weight: 600;
}

/* Reply Form */
form {
  width: 100%;
  max-width: 500px;
  margin-top: 1.5rem;
}

textarea {
  width: 100%;
  padding: 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--card-border);
  background: rgba(255,255,255,0.03);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--teal);
  background: rgba(91,196,190,0.05);
}

textarea::placeholder {
  color: var(--muted);
}

.submit-btn {
  width: 100%;
  max-width: 300px;
}

/* Success/Footer */
.success-message {
  text-align: center;
}

.footer-reveal {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: var(--label);
  letter-spacing: 0.05em;
  margin-top: 1rem;
  font-style: italic;
}

.continue-btn {
  margin-top: 1rem;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
  .page-title {
    font-size: 2.2rem;
  }

  .scene-title {
    font-size: 1.5rem;
  }

  .heartfelt-message {
    padding: 16px;
    margin-top: 8px;
  }

  .heartfelt-message p {
    font-size: 15px;
    line-height: 1.6;
  }

  .evolution {
    margin-top: 12px;
  }

  .choice-btn {
    font-size: 0.9rem;
    padding: 0.9rem 1.2rem;
  }
}

/* Pixar Character Images */
.character-image {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: 16px;
  margin-bottom: 1rem;
  opacity: 0;
  animation: characterAppear 0.8s ease forwards 0.3s;
  box-shadow: 0 8px 24px rgba(91, 196, 190, 0.15);
}

.transformation-image {
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: characterAppear 0.8s ease forwards 0.2s;
  box-shadow: 0 8px 24px rgba(155, 141, 200, 0.12);
}

.grateful-vitaly {
  margin-top: 1rem;
  opacity: 0;
  animation: characterAppear 0.8s ease forwards 0.6s;
}

.character-image-small {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(91, 196, 190, 0.12);
}

@keyframes characterAppear {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .character-image {
    max-width: 240px;
  }

  .transformation-image {
    max-width: 100%;
  }

  .character-image-small {
    max-width: 160px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   MUSIC MUTE BUTTON (Assignment A5 — CloviCards Music Engine)
   SRS: SRS-CLOVICARDS-MUSIC-001 §4
   ═══════════════════════════════════════════════════════════════════════ */

.music-mute-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--teal);
  transition: opacity 0.2s ease, background 0.2s ease;
}

.music-mute-btn:hover {
  opacity: 0.8;
  background: rgba(91, 196, 190, 0.1);
  border-radius: 8px;
}

.music-mute-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 8px;
}

.music-mute-btn.muted {
  color: #94a3b8;
}

.music-mute-btn svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* Choice visual effects */
@keyframes warmPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 180, 50, 0); }
  50% { box-shadow: 0 0 60px 30px rgba(255, 180, 50, 0.15); }
  100% { box-shadow: 0 0 0 0 rgba(255, 180, 50, 0); }
}
@keyframes tealPulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 144, 217, 0); }
  50% { box-shadow: 0 0 60px 30px rgba(74, 144, 217, 0.15); }
  100% { box-shadow: 0 0 0 0 rgba(74, 144, 217, 0); }
}
.effect-warm { animation: warmPulse 1.2s ease-out; }
.effect-teal { animation: tealPulse 1.2s ease-out; }
.breathe {
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.92; }
}

/* Dark mode adjustments for mute button */
@media (prefers-color-scheme: dark) {
  .music-mute-btn {
    color: #e2e8f0;
  }
  .music-mute-btn:hover {
    background: rgba(226, 232, 240, 0.1);
  }
  .music-mute-btn.muted {
    color: #64748b;
  }
}

/* ============================================================
   CHARACTER FRAMES — real photos, animated
   ============================================================ */

/* Keyframes */
@keyframes charFadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes charSlideRight {
  from { opacity: 0; transform: translateX(30px) scale(0.85); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes portraitHeartbeat {
  0%, 100% { transform: scale(1); }
  14%       { transform: scale(1.06); }
  28%       { transform: scale(1); }
  42%       { transform: scale(1.04); }
  56%       { transform: scale(1); }
}
@keyframes ringPulse {
  0%   { box-shadow: 0 0 0 0 rgba(91,196,190,0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(91,196,190,0); }
  100% { box-shadow: 0 0 0 0 rgba(91,196,190,0); }
}
@keyframes waitingBob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}
@keyframes waitingRingPulse {
  0%   { box-shadow: 0 0 0 0 rgba(155, 141, 200, 0.6); }
  70%  { box-shadow: 0 0 0 14px rgba(155, 141, 200, 0); }
  100% { box-shadow: 0 0 0 0 rgba(155, 141, 200, 0); }
}

/* Container */
.char-frames {
  position: relative;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 8px 8px;
  pointer-events: none;
  z-index: 5;
  margin-top: 12px;
}

/* Basic small circular frame (scenes 1-3) */
.char-frame {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(91, 196, 190, 0.45);
  box-shadow: 0 0 12px rgba(91,196,190,0.2);
  flex-shrink: 0;
}
.char-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* Start frame: fade in */
.char-frame-start {
  animation: charFadeIn 0.9s ease-out forwards;
}
/* End frame: slides in after 2s */
.char-frame-end {
  animation: charSlideRight 0.9s ease-out 2s forwards;
  opacity: 0;
}

/* Portrait frames for scenes 4-5 (larger, more expressive) */
.char-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.char-portrait .portrait-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: ringPulse 1.6s ease-out infinite;
}

.char-portrait img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2.5px solid rgba(91, 196, 190, 0.5);
  position: relative;
}

.portrait-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Scene 4: heartbeat portraits */
.scene4-frames {
  justify-content: center;
  gap: 24px;
  margin: 16px 0;
}
.char-portrait-vitaly {
  position: relative;
  animation: charFadeIn 1s ease-out forwards, portraitHeartbeat 2s ease-in-out 1.5s infinite;
}
.char-portrait-vitaly img {
  border-color: rgba(91, 196, 190, 0.6);
}
.char-portrait-linda {
  position: relative;
  animation: charFadeIn 1s ease-out 1.2s forwards, portraitHeartbeat 2s ease-in-out 2.2s infinite;
  opacity: 0;
}
.char-portrait-linda img {
  border-color: rgba(155, 141, 200, 0.6);
}
.char-portrait-linda .portrait-ring {
  animation: none;
  box-shadow: none;
}

/* Scene 5: Linda waiting — bob + purple ring pulse */
.scene5-frames {
  justify-content: center;
  margin: 14px 0;
}
.char-portrait-linda-waiting {
  position: relative;
  animation: charFadeIn 1s ease-out 0.5s forwards, waitingBob 2.4s ease-in-out infinite 1.5s;
  opacity: 0;
}
.char-portrait-linda-waiting img {
  width: 90px;
  height: 90px;
  border-color: rgba(155, 141, 200, 0.65);
  box-shadow: 0 0 20px rgba(155,141,200,0.25);
}
.waiting-ring {
  animation: waitingRingPulse 1.8s ease-out infinite !important;
}
.waiting-label {
  color: rgba(155, 141, 200, 0.7) !important;
  font-style: italic;
}

/* ── Video Player (scene-player / scene-iframe) ───────────────────────── */
/* These were missing — iframe showed white Gumlet bg against dark card   */
.scene-player {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg); /* #0e1018 — matches card background */
}

.scene-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  z-index: 2;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.scene-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
  background: var(--card-bg); /* dark bg while Gumlet loads — no white flash */
  z-index: 1;
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* When video plays: thumbnail fades out, iframe fades in */
.scene-player.playing .scene-thumb { opacity: 0; }
.scene-player.playing .scene-iframe { opacity: 1; z-index: 3; }
