/* ════════════════════════════════════════════════════
   jeemin gallery · styles.css
   K-pop 화보 무드 · 핑크-코랄 포인트 · 다크 베이스
════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@1,500&display=swap');

@font-face { font-family:'S-CoreDream'; font-weight:300; font-display:swap;
  src:url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/S-CoreDream-3Light.woff') format('woff'); }
@font-face { font-family:'S-CoreDream'; font-weight:400; font-display:swap;
  src:url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/S-CoreDream-4Regular.woff') format('woff'); }
@font-face { font-family:'S-CoreDream'; font-weight:500; font-display:swap;
  src:url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/S-CoreDream-5Medium.woff') format('woff'); }
@font-face { font-family:'S-CoreDream'; font-weight:700; font-display:swap;
  src:url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_six@1.2/S-CoreDream-6Bold.woff') format('woff'); }

/* ── 토큰 ─────────────────────────────────────────── */
:root {
  --ink:    #0C0810;
  --sur:    #1A1120;
  --sur2:   #231629;
  --coral:  #FF6B7A;
  --pink:   #F0395A;
  --grad:   linear-gradient(135deg, #FF6B7A 0%, #F0395A 100%);
  --text:   #F4EDF8;
  --muted:  #998FA8;
  --line:   rgba(255,107,122,.10);
  --line2:  rgba(255,107,122,.22);
  --danger: #FF5252;
  --r:      14px;
  --rb:     999px;
  --sh-c:   0 2px 8px rgba(0,0,0,.38), 0 0 1px rgba(0,0,0,.28);
  --sh-h:   0 8px 28px rgba(255,107,122,.18), 0 4px 14px rgba(0,0,0,.42);
  --sh-f:   0 8px 28px rgba(240,57,90,.45), 0 2px 8px rgba(0,0,0,.32);
  --dp:     'Playfair Display', Didot, Georgia, serif;
  --ui:     'S-CoreDream', 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
}

/* ── 리셋 ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; min-height: 100vh;
  background: var(--ink); color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-wrap: pretty;
}

/* ── 헤더 ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top);
  height: calc(58px + env(safe-area-inset-top));
  background: rgba(12,8,16,.90);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--dp); font-style: italic; font-weight: 500;
  font-size: 28px; letter-spacing: -.01em; line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; user-select: none;
}
.auth-slot { display: flex; align-items: center; gap: 10px; }
.uname {
  font-size: 13px; font-weight: 600; color: var(--coral);
  max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: -.01em;
}

/* ── 버튼 ─────────────────────────────────────────── */
.btn {
  font-family: var(--ui); font-size: 13px; font-weight: 700;
  border: none; border-radius: var(--rb); padding: 8px 18px;
  cursor: pointer; background: var(--grad); color: #fff;
  transition: opacity .12s, transform .12s; line-height: 1.4;
}
.btn:hover  { opacity: .85; transform: translateY(-1px); }
.btn:active { opacity: .75; transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line2);
}
.btn.ghost:hover { color: var(--text); }

/* ── 아이콘 전용 버튼 (로그아웃) ─────────────────────── */
.btn.icon-btn {
  width: 34px; height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border-color: transparent;
  flex-shrink: 0; color: var(--coral);
}
.btn.icon-btn:hover {
  color: var(--pink); border-color: var(--line2);
  background: rgba(255,107,122,.12);
  opacity: 1; transform: none;
}
.btn.icon-btn:active { transform: scale(.88); opacity: 1; }

/* ── 배너 ─────────────────────────────────────────── */
.banner {
  background: #1e1215; color: #f4d9b0;
  border-bottom: 1px solid rgba(255,107,122,.15);
  padding: 12px 20px; font-size: 13px; font-weight: 400;
}
.banner code { background: rgba(0,0,0,.35); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* ── 메인 / 그리드 ────────────────────────────────── */
main { padding: 14px; padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom))); }

.grid, .skeleton-grid { columns: 2; column-gap: 12px; }
@media (min-width: 640px)  { .grid, .skeleton-grid { columns: 3; } }
@media (min-width: 1024px) { .grid, .skeleton-grid { columns: 4; } }

/* ── 카드 ─────────────────────────────────────────── */
.card {
  position: relative; break-inside: avoid; margin: 0 0 12px;
  border-radius: var(--r); overflow: hidden; display: block;
  border: 1px solid var(--line); box-shadow: var(--sh-c);
  /* 로딩 shimmer — 이미지가 올라오면 덮힘 */
  background: linear-gradient(110deg, var(--sur) 35%, rgba(255,107,122,.07) 50%, var(--sur) 65%);
  background-size: 250% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover   { transform: translateY(-4px); box-shadow: var(--sh-h); border-color: var(--line2); }
.card img     { width: 100%; display: block; cursor: zoom-in; opacity: 0; transition: opacity .45s ease; position: relative; z-index: 1; }
.card img.loaded { opacity: 1; }

/* ── 삭제 버튼 ────────────────────────────────────── */
.del {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  border: none; border-radius: 8px; cursor: pointer;
  font-family: var(--ui); font-size: 11px; font-weight: 700; padding: 5px 10px;
  background: rgba(0,0,0,.65); color: #ff7070;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .15s, background .1s; letter-spacing: .02em;
}
.card:hover .del, .card:focus-within .del { opacity: 1; }
@media (hover: none) { .del { opacity: 1; } }
.del:hover  { background: rgba(255,82,82,.22); }
.del:active { background: rgba(255,82,82,.40); }

/* ── 스켈레톤 카드 ────────────────────────────────── */
.sk-card {
  break-inside: avoid; margin: 0 0 12px; border-radius: var(--r);
  height: var(--h, 240px); border: 1px solid var(--line);
  background: linear-gradient(110deg, var(--sur) 35%, rgba(255,107,122,.07) 50%, var(--sur) 65%);
  background-size: 250% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}
.sk-card:nth-child(2n) { animation-delay: .35s; }
.sk-card:nth-child(3n) { animation-delay: .70s; }
.sk-card:nth-child(5n) { animation-delay: .15s; }

/* ── 빈 상태 ──────────────────────────────────────── */
.empty {
  color: var(--muted); text-align: center;
  padding: 72px 24px 60px; font-size: 15px; line-height: 1.8;
}
.empty::before {
  content: '✦'; display: block; font-size: 28px; margin-bottom: 16px;
  background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── 센티넬 ───────────────────────────────────────── */
.sentinel { height: 1px; }

/* ── FAB ──────────────────────────────────────────── */
.fab {
  position: fixed; right: 20px;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 30; width: 58px; height: 58px;
  border-radius: 50%; border: none; cursor: pointer;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-f);
  transition: transform .2s ease, box-shadow .2s ease;
}
.fab:hover  { transform: scale(1.07); box-shadow: 0 12px 36px rgba(240,57,90,.52), 0 4px 8px rgba(0,0,0,.3); }
.fab:active { transform: scale(.94); }
.fab.uploading { cursor: wait; }
.fab.uploading::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.15); border-top-color: rgba(255,255,255,.85);
  animation: spin .7s linear infinite;
}

/* ── 라이트박스 ───────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8,4,12,.96);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 24px 64px rgba(0,0,0,.7); }

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(26,17,32,.55); border: 1px solid var(--line2); color: var(--text);
  cursor: pointer; z-index: 41;
  transition: background .15s ease, opacity .15s ease;
}
.lb-nav:hover:not(:disabled) { background: rgba(26,17,32,.85); }
.lb-nav:disabled { opacity: .25; cursor: default; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
@media (max-width: 520px) {
  .lb-nav { width: 40px; height: 40px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}

/* ── 토스트 ───────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(96px, calc(80px + env(safe-area-inset-bottom)));
  z-index: 50;
  background: var(--sur2); border: 1px solid var(--line2); color: var(--text);
  padding: 10px 20px; border-radius: var(--rb);
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 28px rgba(0,0,0,.52), 0 0 0 1px rgba(255,107,122,.08);
  white-space: nowrap; max-width: calc(100vw - 32px);
  text-overflow: ellipsis; overflow: hidden;
}

/* ── 포커스 링 ────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

/* ── 키프레임 ─────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position:  200% 50%; }
  100% { background-position: -200% 50%; }
}
@keyframes spin {
  from { transform: rotate(0deg);   }
  to   { transform: rotate(360deg); }
}
