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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Pretendard;
  font-weight: 800;
  background: #f2f2f2;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ===== Fixed Header ===== */
.fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  z-index: 100;
  pointer-events: none;
}

.logo {
  font-family: "neue-haas-grotesk-display", sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #e24545;
  user-select: none;
}

.fixed-header .logo {
  pointer-events: auto;
  cursor: pointer;
}

.about-link {
  font-family: "neue-haas-grotesk-display", sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: #e24545;
  text-decoration: none;
  pointer-events: auto;
  transition: opacity 0.2s;
  text-decoration: underline;
}

.frame {
  width: 100vw;
  height: 100dvh;
  /*border: 12px solid #e24545;*/
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  pointer-events: none;
}

/* ===== Viewport & Canvas ===== */
.viewport {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  cursor: grab;
  position: relative;
  touch-action: none;
}

.viewport:active,
.viewport:active .postcard {
  cursor: grabbing;
}

.viewport.is-dragging,
.viewport.is-dragging * {
  cursor: grabbing !important;
}

.viewport.is-dragging .postcard {
  pointer-events: none;
}

.canvas {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

/* ===== Postcard ===== */
.postcard {
  position: absolute;
  border-radius: 0px;
  overflow: visible;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.08))
    drop-shadow(0 4px 12px rgba(0, 0, 0, 0.06));
  transition:
    filter 0.3s ease,
    transform 0.3s ease;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  --rotation: 0deg;
  transform: rotate(var(--rotation));

  /* 등장 애니메이션 초기 상태 */
  opacity: 0;
  --intro-rotate: 0deg;
  transform: rotate(calc(var(--rotation) + var(--intro-rotate))) scale(0.5);
}

.postcard.is-visible {
  opacity: 1;
  transform: rotate(var(--rotation)) scale(1);
  transition:
    opacity 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    filter 0.3s ease;
}

.postcard.is-visible:hover {
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.12))
    drop-shadow(0 8px 25px rgba(0, 0, 0, 0.08));
  transform: rotate(var(--rotation)) scale(1.03);
  z-index: 10;
}

.postcard img,
.postcard video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* ===== 로딩 화면 ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: #e24545;
  transition: height 0.3s ease-out;
}

/* ===== About 모달 ===== */

.about-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(232, 228, 223, 0);
  pointer-events: none;
  transition: background 0.5s ease;
}

.about-backdrop.active {
  background: #f2f2f2;
  pointer-events: auto;
  cursor: pointer;
}

.about-modal {
  position: fixed;
  inset: 0;
  z-index: 510;
  display: flex;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  padding: 10px 15px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.about-modal.active {
  pointer-events: auto;
  opacity: 1;
}

.about-content,
.about-modal h1 {
  text-align: left;
  width: 50%;
}

.about-content p {
  font-size: 25px;
  font-weight: 900;
  line-height: 1.5;
  color: #e24545;
  word-break: keep-all;
}

.about-content a {
  color: #e24545 !important;
}

/* ===== 상세 보기 (FLIP 애니메이션) ===== */

/* 배경 딤 */
.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(232, 228, 223, 0);
  pointer-events: none;
  transition: background 0.5s ease;
}

.detail-backdrop.active {
  background: #f2f2f2;
  pointer-events: auto;
  cursor: pointer;
}

/* 스크롤 가능한 상세 보기 컨테이너 */
.detail-scroll {
  position: fixed;
  inset: 0;
  z-index: 495;
  overflow-y: auto;
  overflow-x: hidden;
  pointer-events: none;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.detail-scroll::-webkit-scrollbar {
  display: none;
}

.detail-scroll.active {
  pointer-events: auto;
  touch-action: pan-y;
}

.detail-scroll-inner {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 상세 보기 카드 (메인 + extras) */
.detail-card {
  overflow: visible;
  filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.08))
    drop-shadow(0 8px 30px rgba(0, 0, 0, 0.08));
}

.detail-card img,
.detail-card video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* 작가 정보 — 헤더와 동일한 위치/스타일 */
.detail-info {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  z-index: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.detail-info.active {
  opacity: 1;
}

.detail-author {
  font-family: Pretendard;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #e24545;
  pointer-events: auto;
}

.detail-instagram {
  font-family: "neue-haas-grotesk-display", sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: #e24545;
  text-decoration: underline;
  pointer-events: auto;
  transition: opacity 0.2s;
}

.detail-instagram:hover {
  text-decoration: underline;
}

/* ===== 스크롤바 숨기기 ===== */
.viewport::-webkit-scrollbar {
  display: none;
}

.viewport {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ===== 모바일 반응형 ===== */
@media (max-width: 768px) {
  /* 헤더 */
  .fixed-header {
    padding: 12px 16px;
  }

  .logo {
    font-size: 28px;
  }

  .about-link {
    font-size: 28px;
  }

  /* About 모달 */
  .about-modal {
    padding: 12px 16px;
    gap: 16px;
  }

  .about-content p {
    font-size: 20px;
    line-height: 1.6;
  }

  /* 상세 보기 — 작가 정보 */
  .detail-info {
    padding: 12px 16px;
  }

  .detail-author {
    font-size: 28px;
  }

  .detail-instagram {
    font-size: 28px;
  }

  /* 모바일: 그림자 축소 */
  .postcard {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.06))
      drop-shadow(0 2px 6px rgba(0, 0, 0, 0.04));
  }

  .detail-card {
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0))
      drop-shadow(0 4px 20px rgba(0, 0, 0, 0));
  }

  /* 터치 디바이스: hover 효과 비활성화 */
  .postcard.is-visible:hover {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.06))
      drop-shadow(0 2px 6px rgba(0, 0, 0, 0.04));
    transform: rotate(var(--rotation)) scale(1);
    z-index: auto;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 24px;
  }

  .about-link {
    font-size: 24px;
  }

  .about-content p {
    font-size: 18px;
    margin-top: 30px;
  }

  .detail-author {
    font-size: 24px;
  }

  .detail-instagram {
    font-size: 24px;
  }

  .about-content {
    width: 100%;
  }

  .about-modal {
    flex-direction: column;
  }
}
