/* ============================================
   Resting State (Post-Sequence Home)
   ============================================ */

#resting-state {
  background: var(--bg-deep);
}

/* Hero */
.resting-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(1rem, 5vh, 4rem) var(--gap-lg);
  position: relative;
}

.resting-hero > *:not(#resting-particles) {
  position: relative;
  z-index: 1;
}

#resting-particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

#resting-particles canvas {
  max-height: 100% !important;
  height: 100% !important;
}

.resting-hero h1 {
  font-family: var(--font-display);
  padding-top: 2rem;
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: var(--text-primary);
  margin-bottom: var(--gap-md);
}

.resting-hero .flourish {
  color: var(--purple);
  font-size: 1.5rem;
  margin-bottom: var(--gap-sm);
  opacity: 0.7;
}

.resting-hero .date-stamp {
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: clamp(0.85rem, 2vw, 1rem);
  margin-bottom: var(--gap-xl);
}

/* Action buttons */
.action-buttons {
  display: flex;
  gap: var(--gap-md);
  justify-content: center;
  max-width: var(--content-narrow);
  width: 100%;
  margin-bottom: var(--gap-xl);
}

.action-btn {
  flex: 1;
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
}

.action-btn:hover {
  background: rgba(160, 120, 72, 0.1);
  box-shadow: 0 2px 12px var(--glow);
  transform: translateY(-2px);
}

/* Return visit banner */
.return-banner {
  background: rgba(160, 120, 72, 0.06);
  border: 1px solid rgba(160, 120, 72, 0.15);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-md);
  max-width: var(--content-narrow);
  width: 100%;
  margin-bottom: var(--gap-xl);
}

.return-banner p {
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.return-banner .replay-link {
  color: var(--gold);
  cursor: pointer;
  font-weight: 500;
}

.return-banner .replay-link:hover {
  color: var(--gold-bright);
}

.return-banner .dismiss-btn {
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.5;
  transition: opacity var(--duration-fast);
}

.return-banner .dismiss-btn:hover {
  opacity: 1;
}

/* Memories section */
.memories-section {
  padding: var(--section-padding) var(--gap-lg);
  max-width: 1000px;
  margin: 0 auto;
}

.memories-section h2 {
  font-family: var(--font-display);
  text-align: center;
  color: var(--text-primary);
  margin-bottom: var(--gap-xl);
}

.memories-grid {
  columns: 3;
  column-gap: 1.5rem;
}

.memory-card {
  break-inside: avoid;
  margin-bottom: 1.5rem;
}

.memory-card .memory-media {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.5s var(--ease-default), opacity 0.8s ease;
  will-change: transform, opacity;
}

.memory-card:hover .memory-media {
  transform: scale(1.05);
}

.memory-card .caption {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: var(--gap-sm);
  padding: 0 0.25rem;
  opacity: 0;
  transition: opacity 0.8s ease 0.6s; /* Default delay for Soft Echo */
}

.memory-card.revealed .caption {
  opacity: 1;
}

/* ---- POLAROID STYLE (Option 2) ---- */
.memories-grid.style-polaroid .memory-card {
  background: #fff;
  padding: 10px 10px 40px 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  transform: rotate(var(--rotation, 0deg));
  transition: transform 0.4s ease;
}

.memories-grid.style-polaroid .memory-card:hover {
  transform: scale(1.02) rotate(0deg);
  z-index: 10;
}

.memories-grid.style-polaroid .caption {
  font-family: 'Nothing You Could Do', var(--font-body); /* Handwriting style if available, else body */
  background: transparent;
  color: #2A2018; /* Ink color */
  margin-top: 1rem;
  text-align: center;
  transition: opacity 0.6s ease 0.4s, transform 0.6s ease 0.4s;
  transform: translateY(-5px);
}

.memories-grid.style-polaroid .memory-card.revealed .caption {
  opacity: 1;
  transform: translateY(0);
}

/* Music widget (fixed top-left) */
.music-widget {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(160, 120, 72, 0.2);
  border-radius: var(--radius-pill);
  max-width: 320px;
  transition: opacity var(--duration-normal) var(--ease-default);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.music-widget.hidden-widget {
  opacity: 0;
  pointer-events: none;
}

.music-widget .album-art {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.music-widget .song-info {
  flex: 1;
  min-width: 0;
  margin: 0 var(--gap-sm);
}

.music-widget .song-title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-widget .song-artist {
  font-family: var(--font-body);
  font-size: 0.65rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-widget .controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.music-widget .control-btn {
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 0.25rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--duration-fast);
}

.music-widget .control-btn:hover {
  opacity: 1;
}

.music-widget .progress-bar {
  position: absolute;
  bottom: 0;
  left: 1rem;
  right: 1rem;
  height: 2px;
  background: rgba(107, 91, 138, 0.15);
  border-radius: 1px;
}

.music-widget .progress-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 1px;
  width: 0%;
  transition: width 0.5s linear;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 4rem var(--gap-lg) 2rem;
}

.site-footer p {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.6;
}

/* Tablet */
@media (max-width: 768px) {
  .memories-grid {
    columns: 2;
  }

  .action-buttons {
    flex-direction: column;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .memories-grid {
    columns: 1;
  }

  .music-widget {
    max-width: calc(100vw - 2rem);
  }
}

/* Dark Mode Overrides for Music Widget */
[data-theme="dark"] .music-widget {
  background: rgba(26, 23, 20, 0.85);
  border: 1px solid rgba(212, 165, 116, 0.2);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .music-widget .progress-bar {
  background: rgba(168, 153, 194, 0.2);
}

/* ============================================
   Music Modal (Expanded)
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 1;
  visibility: visible;
  transition: opacity var(--duration-normal), visibility var(--duration-normal);
}

.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(245, 240, 232, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

[data-theme="dark"] .modal-overlay {
  background: rgba(26, 23, 20, 0.85);
}

.modal-content.music-expanded {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: var(--bg-soft);
  border: 1px solid rgba(160, 120, 72, 0.15);
  border-radius: var(--radius-xl);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  transform: scale(1);
  transition: transform var(--duration-bounce);
}

.modal.hidden .modal-content {
  transform: scale(0.95);
}

[data-theme="dark"] .modal-content.music-expanded {
  background: var(--bg-warm);
  border-color: rgba(212, 165, 116, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.close-modal-btn {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  transition: color var(--duration-fast);
}

.close-modal-btn:hover {
  color: var(--text-primary);
}

.album-art-large {
  width: 240px;
  height: 240px;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  background-color: var(--bg-mystery);
  background-position: center;
  background-size: cover;
}

.song-info-large {
  margin-bottom: 2rem;
  width: 100%;
}

.song-title-large {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.song-artist-large {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-secondary);
}

.progress-container-large {
  width: 100%;
  margin-bottom: 2rem;
}

.progress-bar-large {
  height: 4px;
  background: rgba(107, 91, 138, 0.15);
  border-radius: 2px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

[data-theme="dark"] .progress-bar-large {
  background: rgba(168, 153, 194, 0.2);
}

.progress-fill-large {
  height: 100%;
  background: var(--purple);
  width: 0%;
  transition: width 0.1s linear;
}

.time-stamps {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

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

.control-btn-large {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform var(--duration-fast), color var(--duration-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn-large.play-btn {
  font-size: 2.5rem;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--gold);
  color: white;
  box-shadow: 0 4px 12px var(--glow);
  padding-left: 4px; /* Optically center the triangle */
}

.control-btn-large.play-btn:hover {
  transform: scale(1.1);
  background: var(--gold-bright);
}

.control-btn-large:not(.play-btn):hover {
  color: var(--gold);
  transform: scale(1.1);
}
