/* =========================================================================
 * Picment Gallery — Session Download Page MVP
 * Phase: Picment-Gallery-Session-Download-Page-MVP (2026-06-11)
 *
 * 디자인 토큰:
 *   웜 오프화이트 배경 + 차콜 텍스트 + 샴페인 골드 포인트.
 *   모바일 우선, max-width 720px, 차분한 웨딩 톤.
 * ========================================================================= */

:root {
  /* 색 */
  --color-bg:           #FAF7F2;
  --color-card-bg:      #FFFFFF;
  --color-text:         #1F1F1F;
  --color-text-mute:    #5A5A5A;
  --color-gold:         #C9A86A;
  --color-gold-soft:    #E0CFA8;
  --color-warn:         #B45309;
  --color-warn-bg:      #FEF5E7;
  --color-error:        #9B2C2C;
  --color-border:       #E8E2D6;
  --color-img-placeholder: #F0EDE6;

  /* 형태 */
  --radius-card:        12px;
  --radius-button:      8px;
  --shadow-card:        0 2px 12px rgba(0,0,0,0.06);

  /* 폰트 */
  --font-stack: system-ui, -apple-system, "Segoe UI",
                "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  /* 여백 */
  --gap-sm: 8px;
  --gap-md: 16px;
  --gap-lg: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ── 헤더 / 브랜드 ─────────────────────────────────────── */

.brand {
  text-align: center;
  padding: 8px 0 24px;
}

.brand-logo-wrap {
  position: relative;
  display: inline-block;
  /* margin-bottom: 0 으로 전환 — 로고-bar 간격은 .brand-underline 의 margin-top 단일 권위.
     이전 margin-bottom 10px + underline margin-top 10px 가중 20px → bar-tagline 12px 와 비대칭 문제 해결. */
  margin-bottom: 0;
  /* min-height 으로 로고 로드 전/실패 시에도 헤더 공간 확보 — 슬로건이 위로 밀려 layout shift 차단. */
  min-height: 56px;
  /* 좌우 padding 으로 로고 가장자리가 카드 경계와 밀착 안 되게. */
  padding: 4px 8px;
}

.brand-logo {
  display: block;
  /* 사용자 요구: max-width 220px, height auto. max-height 제거 — SVG aspect ratio 자연 유지. */
  max-width: 220px;
  width: 100%;
  height: auto;
  /* 일부 SVG export 가 intrinsic dimensions 0 인 경우 대비. */
  min-height: 1px;
}

.brand-logo-fallback {
  /* 기본 숨김 — JS 가 .show 클래스 추가 시에만 노출.
     ⚠ underline bar 는 공통 .brand-underline 으로 분리 — fallback 자체에는 border-bottom 부재 (중복 방지). */
  display: none;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-text);
  margin: 0 auto;
}

.brand-logo-fallback.show {
  display: inline-block;
}

/* 로고 이미지 자체에 fallback 클래스가 동시에 붙으면 — JS 가 .show 후 img 는 display:none 처리. */
.brand-logo.failed {
  display: none !important;
}

/* champagne gold underline bar — 로고 (SVG / 텍스트 fallback) 와 슬로건 사이 공통 장식 요소.
   양 분기에서 동일하게 표시되도록 logo-wrap / fallback 외부에 sibling 으로 배치.
   width 200px = 슬로건 "흩어지는 순간을 하나의 앨범으로." 폭 (system-ui 14px 기준 ~215px) 의 약 93% —
   양 끝 "어 ~ 으" 구간을 자연스럽게 받쳐주는 길이. tagline 폭 보다 약간 짧아 안정감.
   tagline 자체가 viewport 무관 (font-size 14px 고정) 이므로 vw 기반 clamp 비채택 — 고정 px 가 안정.
   margin top 12px = bottom 12px — 로고/슬로건과 시각적 균형. wrap 의 margin-bottom 은 0 으로 전환됨. */
.brand-underline {
  width: 200px;
  height: 2px;
  background-color: var(--color-gold);
  border-radius: 999px;
  margin: 12px auto 12px;
}

.brand-tagline {
  color: var(--color-text-mute);
  font-size: 14px;
}

/* ── In-app browser 경고 배너 ──────────────────────────── */

.banner {
  border-radius: var(--radius-card);
  padding: 12px 16px;
  margin-bottom: var(--gap-md);
  font-size: 13px;
  line-height: 1.55;
}

.banner-warning {
  background: var(--color-warn-bg);
  border: 1px solid #F3D7A0;
  color: var(--color-warn);
}

/* ── 상태 카드 (Loading / Expired / NotFound / Error / NoFiles) ── */

.view { margin-top: 8px; }

.state-block {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.state-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--color-text);
}

.state-body {
  color: var(--color-text-mute);
  font-size: 14px;
  margin: 0 0 20px;
  line-height: 1.6;
}

.state-text {
  color: var(--color-text-mute);
  font-size: 14px;
  margin-top: 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── 세션 메타 카드 ────────────────────────────────────── */

.session-meta {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  margin-bottom: var(--gap-md);
  box-shadow: var(--shadow-card);
}

.session-meta-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  padding: 4px 0;
}

.session-meta-label {
  color: var(--color-text-mute);
  font-size: 13px;
}

.session-meta-value {
  font-weight: 500;
  color: var(--color-text);
  font-size: 14px;
}

.session-meta-value.warn {
  color: var(--color-warn);
}

.file-count {
  text-align: center;
  font-size: 14px;
  color: var(--color-text-mute);
  margin: 8px 0 16px;
}

/* ── 파일 카드 목록 ────────────────────────────────────── */

.file-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}

.file-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.file-preview {
  width: 100%;
  background: var(--color-img-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  overflow: hidden;
}

.file-preview img,
.file-preview video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  background: #fff;
}

.file-preview-empty {
  color: var(--color-text-mute);
  font-size: 13px;
  padding: 32px;
}

.file-info {
  padding: 14px 16px 16px;
}

.file-type-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--color-text-mute);
  margin-bottom: 10px;
}

.file-type-label {
  font-weight: 500;
  color: var(--color-text);
  font-size: 14px;
}

.file-size {
  color: var(--color-text-mute);
}

.file-actions {
  display: flex;
  gap: 8px;
}

.file-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--color-text-mute);
  line-height: 1.5;
}

/* ── 버튼 ──────────────────────────────────────────────── */

.btn-primary {
  background: var(--color-gold);
  color: #fff;
  border: none;
  border-radius: var(--radius-button);
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
  font-family: inherit;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover { opacity: 0.92; }
.btn-primary:active { opacity: 0.85; }

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  border-radius: var(--radius-button);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  margin-top: 16px;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover { background: #FBF8F0; }

.btn-secondary[hidden] { display: none; }

.caption {
  margin: 24px auto 0;
  font-size: 12px;
  color: var(--color-text-mute);
  text-align: center;
  line-height: 1.6;
  max-width: 360px;
}

/* ── 푸터 ──────────────────────────────────────────────── */

.site-footer {
  margin-top: 32px;
  padding-top: var(--gap-md);
  border-top: 1px solid var(--color-border);
}

.footer-promo {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  margin-bottom: 16px;
  text-align: left;
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "image image"
    "label cta"
    "title cta"
    "desc  cta";
  gap: 4px 12px;
  align-items: center;
}

.footer-promo[data-no-image="true"] {
  grid-template-areas:
    "label cta"
    "title cta"
    "desc  cta";
}

.footer-promo-image {
  grid-area: image;
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.footer-promo-label {
  grid-area: label;
  font-size: 10.5px;
  color: var(--color-gold);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-weight: 600;
}

.footer-promo-title {
  grid-area: title;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.footer-promo-desc {
  grid-area: desc;
  font-size: 13px;
  color: var(--color-text-mute);
  line-height: 1.5;
}

.footer-promo-cta {
  grid-area: cta;
  display: inline-block;
  background: transparent;
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  padding: 7px 14px;
  border-radius: var(--radius-button);
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.footer-promo-cta:hover { background: #FBF8F0; }

.footer-base {
  text-align: center;
  font-size: 12px;
  color: var(--color-text-mute);
  padding: 16px 0;
  letter-spacing: 0.3px;
}

/* ── 반응형 — 데스크탑 미세 조정 ───────────────────────── */

@media (min-width: 600px) {
  .app { padding: 32px 24px 56px; }
  .brand { padding-bottom: 32px; }
  .state-block { padding: 40px 32px; }
}

/* ── 접근성 — reduced motion ───────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  * { transition-duration: 0.01ms !important; }
}
