/*
  홈의 '추억 벽' — 폴라로이드 방문기록 카드가 두 줄로 반대 방향으로 흐른다.
  카드는 memory-wall.js 가 그린다. 마우스를 올리면 멈추고, 올린 카드가 앞으로 나온다.
  폴라로이드는 '실물 사진' 느낌이라 다크 모드에서도 종이색 그대로 둔다.
*/

.memory-wall {
  --paper: #fffdf8;
  --paper-text: #3d3846;
  --paper-sub: #8a8494;
  --wall-card: 216px;
  --wall-gap: 22px;
  --wall-loop: 70s; /* 한 줄이 한 바퀴 도는 시간 */

  padding: 64px 0 40px;
  overflow: hidden;
}

.memory-wall .wrap { text-align: center; }
.memory-wall .lead { margin-left: auto; margin-right: auto; }

.wall {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 8px;
  /* 양 끝이 배경으로 스르르 사라진다 */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.wall-row { padding: 18px 0; } /* 기운 카드·떠오른 카드가 잘리지 않게 */

.wall-track {
  display: flex;
  gap: var(--wall-gap);
  align-items: flex-start;
  width: max-content;
  animation: wall-flow var(--wall-loop) linear infinite;
}

.wall-row:nth-child(2) .wall-track {
  animation-direction: reverse;
  animation-duration: calc(var(--wall-loop) * 1.15);
}

.wall:hover .wall-track { animation-play-state: paused; }

/* 묶음을 두 번 이어 붙였으므로 절반만큼 가면 처음과 같은 모습이다.
   gap 반 칸만큼 더 가야 이음매가 맞는다. */
@keyframes wall-flow {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-50% - var(--wall-gap) / 2)); }
}

/* ── 폴라로이드 카드 ─────────────────────────────────── */

.polaroid {
  position: relative;
  flex: none;
  width: var(--wall-card);
  margin: 0;
  padding: 10px 10px 12px;
  background: var(--paper);
  border-radius: 6px;
  box-shadow: 0 10px 26px rgba(42, 42, 50, 0.1), 0 1px 2px rgba(42, 42, 50, 0.08);
  rotate: var(--tilt, 0deg);
  transition: rotate 0.35s var(--pop-ease, ease), scale 0.35s var(--pop-ease, ease), box-shadow 0.35s;
}

.polaroid:hover {
  z-index: 1;
  rotate: 0deg;
  scale: 1.07;
  box-shadow: 0 22px 44px rgba(60, 40, 110, 0.2);
}

/* 위쪽 마스킹 테이프 — 그 추억의 색 */
.polaroid::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 74px;
  height: 20px;
  translate: -50% 0;
  rotate: calc(var(--tilt, 0deg) * -1.6);
  background: var(--tape);
  opacity: 0.85;
  border-radius: 2px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0 3px, #000 3px calc(100% - 3px), transparent calc(100% - 3px));
  mask-image: linear-gradient(90deg, transparent 0 3px, #000 3px calc(100% - 3px), transparent calc(100% - 3px));
}

.polaroid-photo {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 3px;
  background: #eee9e0;
}

.polaroid-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale 0.6s var(--reveal-ease, ease);
}

.polaroid:hover .polaroid-photo img { scale: 1.06; }

.polaroid figcaption {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 2px 0;
  text-align: left;
}

/* 손글씨 같은 한 줄 — 앱의 헤드라인 세리프(Gowun Batang)로 */
.polaroid-line {
  font-family: "Gowun Batang", serif;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--paper-text);
  /* 영어 문장은 길어서 두 줄까지 — 카드 높이가 조금씩 달라져도 실제 사진첩 같다 */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.polaroid-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  font-size: 11.5px;
  color: var(--paper-sub);
}

.polaroid-meta > i {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--tape);
}

/* 함께한 사람 — 프로필이 겹쳐 쌓인다 */
.polaroid-with {
  display: flex;
  margin-left: auto;
}

.polaroid-with img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--paper);
  object-fit: cover;
}

.polaroid-with img + img { margin-left: -7px; }

/* ── 모바일 ─────────────────────────────────────────── */

@media (max-width: 760px) {
  .memory-wall { --wall-card: 164px; --wall-gap: 14px; padding-top: 48px; }
  .polaroid-line { font-size: 13px; }
}

/* ── 동작 줄이기: 흐르지 않고 가로로 넘겨 본다 ───────── */

@media (prefers-reduced-motion: reduce) {
  .wall-track { animation: none; }
  .wall-row { overflow-x: auto; }
}
