/* ============================================
   stillbeating.love - Styles
   A tribute to JJ
   ============================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: auto; /* GSAP handles smoothness */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: #0a0a0a;
  color: #f5f0eb;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 300;
  line-height: 1.7;
  overflow-x: hidden;
}

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 400;
}

/* ---------- ECG Canvas ---------- */
#ecg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
}

/* ---------- Audio Toggle ---------- */
#audio-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  color: rgba(245, 240, 235, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px;
}

#audio-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(245, 240, 235, 0.8);
}

#audio-toggle.active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
}

#audio-toggle svg {
  width: 20px;
  height: 20px;
}

/* ---------- Scroll Progress ---------- */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, rgba(255,255,255,0.6), rgba(255,255,255,0.3));
  z-index: 200;
  transition: opacity 0.3s ease;
  opacity: 0.4;
}

/* ---------- Sections ---------- */
.section {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Section 1: Opening ---------- */
#opening {
  height: 100vh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 20vh;
}

.opening-content {
  text-align: center;
  opacity: 0;
}

.jj-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #f5f0eb;
  margin-bottom: 0.2em;
  line-height: 1;
}

.jj-dates {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  font-weight: 300;
  letter-spacing: 0.3em;
  color: rgba(245, 240, 235, 0.45);
  text-transform: uppercase;
}

/* ---------- Section 2 & 3: Photos ---------- */
#life {
  min-height: auto;
  padding: 10vh 0 5vh;
}

#slowdown {
  min-height: 80vh;
  padding: 5vh 0 15vh;
}

.photo-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

.photo-block {
  margin-bottom: 10vh;
  opacity: 0;
  transform: translateY(40px);
}

.photo-block:last-child {
  margin-bottom: 5vh;
}

/* Photo alignment */
.photo-center {
  text-align: center;
}

.photo-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.photo-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.photo-frame {
  position: relative;
  display: inline-block;
  max-width: 600px;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(0, 0, 0, 0.4);
}

/* Vignette overlay on photos */
.photo-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.photo-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  transform: scale(1);
  transition: transform 4s ease-out;
}

.photo-block.is-visible .photo-frame img {
  transform: scale(1.03);
}

.photo-right .photo-frame {
  max-width: 500px;
}

.photo-left .photo-frame {
  max-width: 500px;
}

/* Video frames */
.video-frame video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.photo-block.is-visible .video-frame video {
  transform: none;
}

/* Slowdown photos are more intimate */
.slowdown-photo .photo-frame {
  max-width: 480px;
}

/* ---------- Section 4: Flatline ---------- */
#flatline {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flatline-content {
  text-align: center;
  width: 100%;
}

.flatline-timestamp {
  opacity: 0;
}

.flatline-timestamp p {
  font-family: 'Inter', sans-serif;
  font-size: clamp(1.2rem, 2.8vw, 1.8rem);
  font-weight: 300;
  color: rgba(245, 240, 235, 0.4);
  letter-spacing: 0.2em;
}

/* ---------- Section 5: Message ---------- */
#message {
  min-height: auto;
  padding: 15vh 24px 20vh;
  align-items: flex-start;
}

.message-content {
  max-width: 640px;
  margin: 0 auto;
}

.message-to {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 400;
  color: #d4a855;
  margin-bottom: 2.5rem;
  opacity: 0;
  transform: translateY(20px);
}

.message-body p {
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
  line-height: 1.9;
  color: rgba(245, 240, 235, 0.75);
  margin-bottom: 1.8rem;
  opacity: 0;
  transform: translateY(20px);
}

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

.message-signature {
  margin-top: 3rem !important;
  font-style: italic;
  color: rgba(245, 240, 235, 0.5) !important;
}

/* ---------- Section 6: Closing ---------- */
#closing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.closing-content {
  text-align: center;
  opacity: 0;
}

.closing-line {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 400;
  color: #f5f0eb;
  letter-spacing: 0.03em;
  margin-bottom: 4rem;
  line-height: 1.4;
}

.closing-memorial {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.75rem, 1.4vw, 0.9rem);
  font-weight: 300;
  color: rgba(245, 240, 235, 0.5);
  letter-spacing: 0.15em;
  line-height: 2;
}

.closing-url {
  margin-top: 0.5rem;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.85em;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .photo-block {
    margin-bottom: 8vh;
  }

  /* On mobile, all photos center and go full width */
  .photo-right,
  .photo-left {
    align-items: center;
  }

  .photo-right .photo-frame,
  .photo-left .photo-frame {
    max-width: 100%;
  }

  #audio-toggle {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }

  .message-content {
    padding: 0 8px;
  }
}

@media (max-width: 480px) {
  .jj-name {
    font-size: 3.5rem;
  }

  .photo-block {
    margin-bottom: 6vh;
  }

  .photo-frame {
    border-radius: 6px;
  }

  .message-body p {
    font-size: 0.95rem;
    line-height: 1.8;
  }
}

/* ---------- Utility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Prevent selection on the experience */
::selection {
  background: rgba(255, 255, 255, 0.12);
  color: #f5f0eb;
}

/* Smooth image loading */
img {
  opacity: 0;
  transition: opacity 0.6s ease;
}

img.loaded {
  opacity: 1;
}

