/* ═══════════════════════════════════════════════════════════════
   chapters34.css  —  Chapter 3 (Diya frames) + Chapter 4 (Memory Rain)
   ═══════════════════════════════════════════════════════════════ */

/* ╔══════════════════════════════════════════════════╗
   ║  CHAPTER 3                                       ║
   ╚══════════════════════════════════════════════════╝ */

.ch3-wrapper {
  position: relative;
  z-index: 5;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 3rem 1.5rem 4rem;
}

/* Header */
.ch3-eyebrow {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.4rem;
  text-align: center;
}

.ch3-title {
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 500;
  text-align: center;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.ch3-subtitle {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  color: rgba(255,255,255,0.5);
  text-align: center;
  margin-top: 0.3rem;
}

.ch3-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

/* ── Two-frame row ─────────────────────────────────── */
.ch3-frames-row {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 900px;
  align-items: center;
}

@media (min-width: 640px) {
  .ch3-frames-row {
    flex-direction: row;
    justify-content: center;
    gap: 2.5rem;
  }
}

.ch3-frame-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  max-width: 420px;
}

/* ── Individual frame ──────────────────────────────── */
.ch3-frame {
  position: relative;
  width: 100%;
  /* Landscape ratio */
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #0a0a14;
  box-shadow:
    0 8px 40px rgba(0,0,0,0.7),
    0 2px 8px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.06);
}

/* ── Slot (A or B) — crossfade layer ──────────────── */
.ch3-slot {
  position: absolute;
  inset: 0;
  transition: opacity 1.1s ease;
}

/* Blurred background fill — covers letterbox bars */
.ch3-img-bg {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  object-fit: cover;
  filter: blur(22px);
  opacity: 0.45;
  transform: scale(1.05);
  user-select: none;
  -webkit-user-drag: none;
}

/* Sharp foreground — always fully visible */
.ch3-img-fg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Diya warm gradient overlay (bottom of frame) ─── */
.ch3-diya-glow {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(
    to top,
    rgba(245, 158, 11, 0.40) 0%,
    rgba(245, 158, 11, 0.15) 40%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 3;
  border-radius: 0 0 14px 14px;
}

/* ── Diya emoji ────────────────────────────────────── */
.ch3-diya-wrap {
  display: flex;
  justify-content: center;
}

.ch3-diya {
  font-size: 2.2rem;
  display: inline-block;
  animation: diyaPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(245,158,11,0.7))
          drop-shadow(0 0 20px rgba(245,158,11,0.4));
}

@keyframes diyaPulse {
  0%,100% { transform: scale(1);    filter: drop-shadow(0 0 8px rgba(245,158,11,0.7)) drop-shadow(0 0 20px rgba(245,158,11,0.4)); }
  50%     { transform: scale(1.12); filter: drop-shadow(0 0 14px rgba(245,158,11,1))  drop-shadow(0 0 35px rgba(245,158,11,0.6)); }
}

/* ── Note / Quote inside ch3 ───────────────────────── */
.ch3-note {
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-style: italic;
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  line-height: 1.9;
  color: rgba(255,255,255,0.80);
  text-align: center;
  max-width: 580px;
  padding: 1.25rem 1.5rem;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  position: relative;
}
.ch3-note::before {
  content: '"';
  position: absolute;
  top: -0.5rem; left: 0.75rem;
  font-size: 3.5rem;
  color: var(--accent, #6ee7b7);
  opacity: 0.18;
  font-style: normal;
  line-height: 1;
}

.ch3-quote {
  border: none;
  margin: 0;
  padding: 0.9rem 1.25rem;
  background: rgba(255,255,255,0.03);
  border-left: 2px solid var(--accent, #6ee7b7);
  border-radius: 0 10px 10px 0;
  max-width: 500px;
}
.ch3-quote-text {
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-style: italic;
  font-size: clamp(0.85rem, 1.3vw, 1rem);
  color: rgba(255,255,255,0.72);
  line-height: 1.75;
  margin: 0 0 0.4rem;
}
.ch3-quote-author {
  font-size: 0.78rem;
  color: var(--accent, #6ee7b7);
  opacity: 0.7;
  font-style: normal;
  letter-spacing: 0.04em;
}

/* ── Unlock row ────────────────────────────────────── */
.ch3-unlock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 440px;
}

.ch3-unlock-label {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}

.ch3-unlock-row {
  display: flex;
  gap: 0.6rem;
  width: 100%;
}

.ch3-unlock-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  color: #fff;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.ch3-unlock-input:focus {
  border-color: var(--accent, #6ee7b7);
  background: rgba(255,255,255,0.09);
}
.ch3-unlock-input::placeholder { color: rgba(255,255,255,0.25); }

.ch3-unlock-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  background: transparent;
  border: 1.5px solid var(--accent, #6ee7b7);
  border-radius: 8px;
  color: var(--accent, #6ee7b7);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.22s, color 0.22s, transform 0.18s;
}
.ch3-unlock-btn:hover {
  background: var(--accent, #6ee7b7);
  color: #0a0a14;
  transform: translateY(-1px);
}

.ch3-unlock-feedback {
  font-size: 0.82rem;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  min-height: 1.4em;
  text-align: center;
  transition: opacity 0.3s;
}
.ch3-unlock-feedback.success { color: #86efac; }
.ch3-unlock-feedback.fail    { color: #fca5a5; }


/* ╔══════════════════════════════════════════════════╗
   ║  CHAPTER 4                                       ║
   ╚══════════════════════════════════════════════════╝ */

/* Center card wrapper */
.ch4-centre {
  position: relative;
  z-index: 10;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-height: auto;
}

/* ── Custom Layout for Chapter 4 ── */
.ch4-layout-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 6rem;
  z-index: 10;
  position: relative;
}

.ch4-top-section {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 2rem;
  align-items: center;
  width: 100%;
}

.ch4-left-tracks, .ch4-right-tracks {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.ch4-bottom-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  width: 100%;
}

@media (max-width: 1024px) {
  .ch4-top-section {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .ch4-left-tracks, .ch4-right-tracks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 900px) {
  .ch4-bottom-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .ch4-left-tracks, .ch4-right-tracks {
    grid-template-columns: 1fr;
  }
  .ch4-bottom-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Glassmorphism card ─────────────────────────────── */
.ch4-card {
  position: relative;
  width: min(540px, 90vw);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.6),
    0 1px 0 rgba(255,255,255,0.08) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  text-align: center;
  z-index: 2;
}

/* Inner colour glow */
.ch4-card-glow {
  position: absolute;
  inset: -1px;
  border-radius: 21px;
  background: radial-gradient(
    ellipse at 50% 0%,
    color-mix(in oklch, var(--accent, #f9a8d4) 18%, transparent) 0%,
    transparent 65%
  );
  pointer-events: none;
  z-index: 0;
}

.ch4-card > * { position: relative; z-index: 1; }

.ch4-card-eyebrow {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}

.ch4-card-title {
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.ch4-card-subtitle {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: clamp(0.82rem, 1.3vw, 0.95rem);
  color: rgba(255,255,255,0.45);
}

.ch4-card-note {
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-style: italic;
  font-size: clamp(0.9rem, 1.4vw, 1.05rem);
  line-height: 1.9;
  color: rgba(255,255,255,0.78);
  max-width: 420px;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 1rem;
}

.ch4-card-quote {
  border: none;
  margin: 0;
  padding: 0.8rem 1rem;
  background: rgba(255,255,255,0.03);
  border-left: 2px solid var(--accent, #f9a8d4);
  border-radius: 0 8px 8px 0;
  max-width: 400px;
  text-align: left;
}
.ch4-card-quote p {
  font-family: var(--font-display, 'Cormorant Garamond', serif);
  font-style: italic;
  font-size: clamp(0.85rem, 1.2vw, 0.98rem);
  color: rgba(255,255,255,0.70);
  line-height: 1.75;
  margin: 0 0 0.35rem;
}
.ch4-card-quote cite {
  font-size: 0.75rem;
  color: var(--accent, #f9a8d4);
  opacity: 0.7;
  font-style: normal;
  letter-spacing: 0.04em;
}

/* ── Glassmorphic Audio Cards ──────────────────────────── */
.ch4-audio-card {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
  min-width: 0; /* Prevents overflow in flex layouts */
}

.ch4-audio-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--accent, #f9a8d4);
  box-shadow: 0 8px 40px rgba(249, 168, 212, 0.15);
  transform: translateY(-2px);
}

.ch4-audio-card.playing {
  border-color: var(--accent, #f9a8d4);
  box-shadow: 0 0 20px rgba(249, 168, 212, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.ch4-audio-title {
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.95rem;
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.ch4-audio-time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  font-family: monospace;
}

.ch4-audio-slider-container {
  display: flex;
  align-items: center;
  width: 100%;
}

.ch4-audio-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
}

.ch4-audio-slider:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ch4-audio-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent, #f9a8d4);
  cursor: pointer;
  transition: transform 0.1s;
}

.ch4-audio-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

.ch4-audio-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--accent, #f9a8d4);
  cursor: pointer;
  transition: transform 0.1s;
}

.ch4-audio-slider::-moz-range-thumb:hover {
  transform: scale(1.3);
}

.ch4-audio-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.ch4-control-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.ch4-control-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.ch4-play-btn {
  background: var(--accent, #f9a8d4);
  color: #0d0d14;
  font-size: 1.1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(249, 168, 212, 0.3);
  transition: all 0.2s;
}

.ch4-play-btn:hover {
  background: #ffffff;
  color: #0d0d14;
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(255, 255, 255, 0.4);
}
