/* ============================================================
   RRC 갤러리 — app.css
   네이비 + 화이트 (허브와 동일 톤)
   ============================================================ */

:root {
  --bg:       #0a1428;
  --bg2:      #0f1a35;
  --surface:  #142042;
  --surface2: #1a2752;
  --line:     rgba(255,255,255,.08);
  --line2:    rgba(255,255,255,.15);

  --tx:       #ffffff;
  --tx2:      #a4b0c5;
  --tx3:      #5a6582;

  --r:  16px;
  --r2: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  background: var(--bg);
  color: var(--tx);
  font-family: 'Pretendard', -apple-system, sans-serif;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#root {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fade { animation: fadeIn .32s ease both; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ============================================================
   상단바
   ============================================================ */
.topbar {
  width: 100%;
  max-width: 480px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(10,20,40,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand b { font-size: 15px; font-weight: 800; letter-spacing: .06em; }
.brand .sub { font-size: 9px; color: var(--tx2); letter-spacing: .1em; line-height: 1; }

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ffd700;
  box-shadow: 0 0 10px rgba(255,215,0,.6);
}

.back-link {
  font-size: 12px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

/* ============================================================
   메인
   ============================================================ */
.main {
  width: 100%;
  max-width: 480px;
  padding: 16px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================================
   앨범 카드 (메인 페이지)
   ============================================================ */
.album-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid rgba(255,255,255,.25);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: all .12s;
}

.album-card:active { transform: scale(.98); }
.album-card:hover {
  border-color: #fff;
  background: var(--surface2);
}

.album-info {
  flex: 1;
  min-width: 0;
}

.album-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-date {
  font-size: 11px;
  color: var(--tx2);
  font-family: 'DM Mono', monospace;
  font-weight: 600;
}

.album-count {
  font-size: 11px;
  color: var(--tx3);
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
}

/* ============================================================
   앨범 상세 페이지 (album.html)
   ============================================================ */
.album-header {
  padding: 20px 16px 14px;
  text-align: center;
}

.album-header h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.album-header .date {
  font-size: 12px;
  color: var(--tx2);
  font-family: 'DM Mono', monospace;
}

/* 사진 그리드 */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  padding: 0 4px;
}

.photo {
  aspect-ratio: 1;
  background: var(--surface);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s;
}

.photo:active { transform: scale(.97); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 사진 모달 */
.photo-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.95);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

.photo-modal.on { opacity: 1; pointer-events: auto; }

.photo-modal img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 4px;
  touch-action: none;
  transform-origin: center center;
  will-change: transform;
}

.photo-modal-img-wrap {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.photo-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
}

.photo-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: grid;
  place-items: center;
}

.photo-modal-nav.prev { left: 16px; }
.photo-modal-nav.next { right: 16px; }

/* ============================================================
   어드민
   ============================================================ */
.admin {
  width: 100%;
  max-width: 480px;
  padding: 24px 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #fff;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.row:last-child { margin-bottom: 0; }
.row label { font-size: 12px; font-weight: 600; color: var(--tx2); }

.si {
  background: var(--surface2);
  border: 1.5px solid var(--line2);
  border-radius: 10px;
  color: var(--tx);
  font-family: 'Pretendard', sans-serif;
  font-size: 13px;
  padding: 9px 11px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .18s;
}

.si:focus { border-color: #fff; }

.sb {
  background: var(--surface2);
  border: 1px solid var(--line2);
  border-radius: 10px;
  color: var(--tx);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.sb:hover { background: #243762; }
.sb.danger { color: #ff8a73; border-color: rgba(255,138,115,.3); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--r2);
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .12s;
}

.btn:active { transform: scale(.97); opacity: .85; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-acc { background: #fff; color: #0a1428; }
.btn-ghost { background: var(--surface2); color: var(--tx); border: 1px solid var(--line2); }

.album-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--line2);
  border-radius: 10px;
  margin-bottom: 8px;
}

.album-item:last-child { margin-bottom: 0; }

.album-item-info { flex: 1; min-width: 0; }
.album-item-title { font-size: 14px; font-weight: 700; }
.album-item-date { font-size: 11px; color: var(--tx2); font-family: 'DM Mono', monospace; margin-top: 2px; }

.upload-input {
  width: 100%;
  padding: 16px;
  background: var(--surface2);
  border: 1.5px dashed var(--line2);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--tx2);
  transition: all .15s;
}

.upload-input:hover {
  border-color: #fff;
  color: #fff;
}

.photo-thumb {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface2);
  position: relative;
  flex-shrink: 0;
}

.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,.7);
  color: white;
  display: grid;
  place-items: center;
  font-size: 10px;
  cursor: pointer;
  border: none;
}

#toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--line2);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 99;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  white-space: nowrap;
}

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--tx2);
  font-size: 13px;
  line-height: 1.7;
}

.foot {
  margin-top: 20px;
  text-align: center;
}

.adminlink {
  font-size: 10px;
  color: var(--tx3);
  text-decoration: none;
  letter-spacing: .12em;
  padding: 8px 14px;
  border-radius: 8px;
  transition: color .15s;
}

.adminlink:hover { color: var(--tx2); }

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .main, .admin { padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
}

/* ============================================================
   PC 반응형 (768px 이상)
   ============================================================ */
@media (min-width: 768px) {
  .topbar {
    max-width: 960px !important;
    padding: 20px 32px !important;
  }

  .brand b { font-size: 17px; }
  .brand .sub { font-size: 10px; }

  .back-link { font-size: 14px; }

  .main {
    max-width: 960px !important;
    padding: 24px 32px 64px !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px !important;
  }

  .main .empty,
  .main .foot {
    grid-column: 1 / -1;
  }

  .album-card {
    padding: 20px 24px !important;
  }

  .album-title { font-size: 16px !important; }
  .album-date { font-size: 12px !important; }
  .album-count { font-size: 12px !important; }

  /* 앨범 상세 */
  .album-header {
    padding: 32px 32px 20px !important;
    max-width: 960px;
    margin: 0 auto;
  }

  .album-header h1 { font-size: 28px !important; }
  .album-header .date { font-size: 14px !important; }

  /* 사진 그리드: 3열 */
  .photo-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
    padding: 0 !important;
    max-width: 896px;
    margin: 0 auto;
  }

  .photo { border-radius: 10px !important; }
}

/* 큰 화면 (1200px 이상) - 갤러리 사진 4열 */
@media (min-width: 1200px) {
  .photo-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    max-width: 1236px !important;
    gap: 12px !important;
  }
}
