/* ==========================================================================
   Memories — a single continuous, Instagram-style feed. Built on the
   theme's existing design tokens (colors, fonts, radius, shadow from
   style.css). Enqueued only on /memories and single-memory pages.
   ========================================================================== */

/* ---- Toolbar ---- */
.memories-toolbar { margin: 0 auto 32px; }
.memories-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.memories-filter {
  border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px;
  font-size: 0.85rem; font-family: var(--font-body); background: var(--surface); color: var(--ink);
  cursor: pointer; transition: border-color 0.15s ease;
}
.memories-filter:hover { border-color: var(--accent); }
.memories-filter-check {
  display: inline-flex; align-items: center; gap: 7px; font-size: 0.85rem; color: var(--muted);
  padding: 9px 14px; border: 1px solid transparent; border-radius: 999px; cursor: pointer;
}
.memories-filter-check:hover { color: var(--ink); }
.memories-filter-check input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---- Feed ---- */
.memories-feed-wrap { padding-bottom: 60px; max-width: 620px; margin-left: auto; margin-right: auto; position: relative; }
.memories-feed { display: flex; flex-direction: column; gap: 32px; }
.memories-empty { color: var(--muted); text-align: center; padding: 80px 20px; font-size: 0.98rem; }

.memories-new-pill {
  position: sticky; top: calc(var(--header-h) + 14px); z-index: 20;
  margin: 0 auto 18px; display: inline-flex; align-items: center; gap: 9px;
  background: var(--ink); color: #fff; border: none; border-radius: 999px;
  padding: 11px 20px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 10px 28px rgba(18,22,43,0.28);
  left: 50%; transform: translateX(-50%);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: memories-pill-in 0.35s ease;
}
.memories-new-pill:hover { transform: translateX(-50%) translateY(-2px); box-shadow: 0 14px 32px rgba(18,22,43,0.34); }
.memories-new-count { background: var(--coral); color: #fff; border-radius: 999px; padding: 1px 9px; font-family: var(--font-mono); font-size: 0.78rem; }
@keyframes memories-pill-in { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.memory-post {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; animation: memory-post-in 0.4s ease both;
}
@keyframes memory-post-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.memory-post-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; }
.memory-post-title { font-size: 1.04rem; margin: 0 0 5px; font-family: var(--font-display); }
.memory-post-meta { display: flex; align-items: center; gap: 12px; font-size: 0.78rem; color: var(--muted); font-family: var(--font-mono); flex-wrap: wrap; }
.memory-post-location { display: inline-flex; align-items: center; gap: 4px; }
.memory-post-location .icon { width: 13px; height: 13px; }
.memory-post-expand {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.18s ease;
}
.memory-post-expand:hover { border-color: var(--accent); color: var(--accent); transform: scale(1.06); }
.memory-post-expand .icon { width: 15px; height: 15px; }

.memory-post-media, .memory-detail-media {
  background: var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.memory-carousel { position: relative; width: 100%; overflow: hidden; }
.memory-carousel-track { display: flex; transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.memory-carousel-slide { flex: 0 0 100%; display: flex; align-items: center; justify-content: center; background: var(--border-soft); }
 
.memory-carousel-slide img { width: auto; height: auto; max-width: 100%; max-height: 640px; object-fit: contain; display: block; cursor: zoom-in; }

.memory-carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(18,22,43,0.55); color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2; transition: background 0.15s ease, transform 0.15s ease;
  backdrop-filter: blur(4px);
}
.memory-carousel-arrow:hover { background: rgba(18,22,43,0.78); transform: translateY(-50%) scale(1.08); }
.memory-carousel-prev { left: 12px; }
.memory-carousel-prev .icon { transform: rotate(180deg); }
.memory-carousel-next { right: 12px; }

.memory-carousel-counter {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  background: rgba(18,22,43,0.65); color: #fff; font-family: var(--font-mono); font-size: 0.75rem;
  padding: 4px 11px; border-radius: 999px; backdrop-filter: blur(4px);
}
.memory-carousel-dots { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 7px; z-index: 2; }
.memory-carousel-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.5); cursor: pointer; transition: all 0.2s ease; }
.memory-carousel-dot.is-active { background: #fff; width: 18px; border-radius: 4px; }

.memory-post-video, .memory-detail-video { position: relative; }
.memory-video-embed { position: relative; aspect-ratio: 16/9; background: var(--ink); }
.memory-video-play { position: absolute; inset: 0; width: 100%; height: 100%; border: none; padding: 0; cursor: pointer; background: none; }
.memory-video-thumb { width: 100%; height: 100%; object-fit: cover; }
.memory-video-play-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,0.94);
  display: flex; align-items: center; justify-content: center; color: var(--coral); transition: transform 0.18s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.memory-video-play-icon .icon { width: 22px; height: 22px; margin-left: 3px; }
.memory-video-play:hover .memory-video-play-icon { transform: translate(-50%, -50%) scale(1.1); }
.memory-video-iframe { width: 100%; height: 100%; border: none; }

.memory-post-actions { display: flex; align-items: center; gap: 12px; padding: 14px 20px 8px; }
.memory-post-caption { padding: 0 20px 18px; font-size: 0.94rem; line-height: 1.6; color: var(--ink); }
.memory-post-caption strong { margin-right: 5px; }

.memory-like-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px; font-size: 0.85rem; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: all 0.18s ease;
}
.memory-like-btn .icon { width: 15px; height: 15px; transition: transform 0.2s ease; }
.memory-like-btn:hover { border-color: var(--coral); color: var(--coral); }
.memory-like-btn.is-liked { background: var(--coral-tint); border-color: var(--coral); color: var(--coral); }
.memory-like-btn.is-liked .icon { fill: currentColor; }
.memory-like-btn.is-pulsing .memory-like-icon { animation: memory-like-pulse 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes memory-like-pulse { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
.memory-like-btn-large { padding: 13px 24px; font-size: 0.95rem; }
.memory-like-btn-large .icon { width: 18px; height: 18px; }

.memory-share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); cursor: pointer; transition: all 0.18s ease;
}
.memory-share-btn .icon { width: 15px; height: 15px; }
.memory-share-btn:hover { border-color: var(--accent); color: var(--accent); transform: scale(1.06); }

.memories-sentinel { height: 1px; }
.memories-loading, .memories-end { text-align: center; color: var(--muted); font-size: 0.88rem; padding: 24px 0; }
.memories-loading::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
  vertical-align: -2px; animation: memories-spin 0.7s linear infinite;
}
@keyframes memories-spin { to { transform: rotate(360deg); } }

.memory-modal { position: fixed; inset: 0; z-index: 6000; display: none; align-items: center; justify-content: center; }
.memory-modal.is-open { display: flex; animation: memory-modal-fade 0.2s ease; }
@keyframes memory-modal-fade { from { opacity: 0; } to { opacity: 1; } }
.memory-modal-backdrop { position: absolute; inset: 0; background: rgba(10,10,20,0.86); backdrop-filter: blur(2px); }
.memory-modal-inner {
  position: relative; z-index: 1; background: var(--surface); border-radius: var(--radius);
  max-width: 560px; width: 92vw; max-height: 88vh; overflow-y: auto;
  animation: memory-modal-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
@keyframes memory-modal-in { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.memory-modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: rgba(18,22,43,0.55); color: #fff; font-size: 1.4rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.memory-modal-close:hover { background: rgba(18,22,43,0.8); transform: scale(1.08); }
.memory-modal-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 6001;
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.12); color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.18s ease; backdrop-filter: blur(4px);
}
.memory-modal-nav:hover { background: rgba(255,255,255,0.25); transform: translateY(-50%) scale(1.08); }
.memory-modal-prev { left: 24px; }
.memory-modal-prev .icon { transform: rotate(180deg); }
.memory-modal-next { right: 24px; }
.memory-modal-loading, .memory-modal-error { padding: 70px 24px; text-align: center; color: var(--muted); }
.memory-modal-loading::before {
  content: ""; display: block; width: 22px; height: 22px; margin: 0 auto 12px;
  border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
  animation: memories-spin 0.7s linear infinite;
}

.memory-detail-body { padding: 22px 24px 26px; }
.memory-detail-title { font-size: 1.35rem; margin-bottom: 8px; font-family: var(--font-display); }
.memory-detail-caption { margin: 16px 0; font-size: 1rem; line-height: 1.75; }

.memory-share-panel { position: fixed; inset: 0; background: rgba(18,22,43,0.42); z-index: 7000; display: none; align-items: flex-end; justify-content: center; }
.memory-share-panel.is-open { display: flex; animation: memory-modal-fade 0.2s ease; }
.memory-share-panel-inner {
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 26px; width: 100%; max-width: 440px;
  box-shadow: 0 -12px 44px rgba(18,22,43,0.22);
  animation: memory-share-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes memory-share-in { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (min-width: 640px) {
  .memory-share-panel { align-items: center; }
  .memory-share-panel-inner { border-radius: var(--radius); }
}
.memory-share-panel-title { font-weight: 700; font-size: 1.08rem; margin-bottom: 18px; }
.memory-share-panel-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.memory-share-option {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 17px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink);
  font-size: 0.85rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: all 0.15s ease;
}
.memory-share-option:hover { border-color: var(--accent); color: var(--accent); }
.memory-share-option.is-copied { border-color: var(--success); color: var(--success); background: var(--success-tint); }
.memory-share-option .icon { width: 15px; height: 15px; }

.tag-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }

@media (max-width: 720px) {
  .memories-toolbar { padding: 0 4px; }
  .memories-filters { justify-content: flex-start; }
  .memory-carousel-slide img { max-height: 480px; }
  .memory-modal-nav { display: none; }
  .memory-modal-inner { width: 94vw; max-height: 92vh; }
}


/* ---- Fullscreen image viewer (opened from any carousel photo) ---- */
.memory-image-viewer {
  position: fixed; inset: 0; z-index: 9000; display: none;
  align-items: center; justify-content: center; background: rgba(6,7,14,0.96);
}
.memory-image-viewer.is-open { display: flex; }
.memory-image-viewer-stage { max-width: 92vw; max-height: 88vh; }
.memory-image-viewer-img { max-width: 92vw; max-height: 88vh; object-fit: contain; display: block; }
.memory-image-viewer-close {
  position: absolute; top: 20px; right: 20px; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.12); color: #fff; font-size: 1.6rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.15s ease;
}
.memory-image-viewer-close:hover { background: rgba(255,255,255,0.22); }
.memory-image-viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.12); color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s ease;
}
.memory-image-viewer-nav:hover { background: rgba(255,255,255,0.22); }
.memory-image-viewer-prev { left: 20px; }
.memory-image-viewer-prev .icon { transform: rotate(180deg); }
.memory-image-viewer-next { right: 20px; }
.memory-image-viewer-counter {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.75); font-family: var(--font-mono); font-size: 0.85rem;
}
@media (max-width: 720px) {
  .memory-image-viewer-nav { width: 40px; height: 40px; }
  .memory-image-viewer-prev { left: 10px; }
  .memory-image-viewer-next { right: 10px; }
}