@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
  --bg: #ffffff;
  --frame-border: #6b6b66;
  --mat: #ffffff;
  --photo-bg: #ededea;
  --text-primary: #2c2c2a;
  --text-secondary: #6b6b66;
  --text-muted: #9c9a92;
  --max-width: 1040px;
  --date-color: #e8890c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Pretendard', -apple-system, sans-serif;
  font-weight: 400;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ── 홈 ── */
.site-header {
  padding: 30px 64px 0;
  text-align: center;
}

.site-header h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 30px;
  letter-spacing: 0;
  margin: 0;
  color: #1d1d1d;
}

.site-header p {
  font-size: 16px;
  line-height: 20px;
  color: #d9d9d9;
  font-weight: 400;
  margin: 0;
}

.header-divider {
  height: 0;
  background: none;
  margin: 20px 64px 0;
}

.gallery-wrap {
  padding: 40px 60px 5rem;
}

.nickname-tag {
  display: inline-block;
  font-size: 12px;
  line-height: 20px;
  font-weight: 400;
  color: #c40c0c;
  border: 1px solid #c40c0c;
  padding: 2px 10px;
  background: #fff;
}

/* ── 카테고리 칩 ── */
.chips-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.chips-row .category-chips {
  margin-bottom: 0;
  flex-shrink: 0;
}

.chips-whisper {
  flex-shrink: 0;
  width: 168px;
  height: 24px;
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
  cursor: default;
}

.chips-whisper:hover {
  opacity: 1;
}

.category-chips {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 20px;
}
.category-chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: none;
  font-size: 13px;
  line-height: 20px;
  color: #d4d4d4;
  cursor: pointer;
  background: none;
  font-family: 'Pretendard', -apple-system, sans-serif;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s;
}
.chip.active {
  color: #a3a3a3;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.chip:not(.active):hover {
  color: #a3a3a3;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 64px;
  align-items: start;
}

.frame-link {
  display: block;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.frame {
  width: 100%;
  aspect-ratio: 1/1;
  border: 1px solid #d9d9d9;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
}

.frame img {
  width: 43%;
  aspect-ratio: 1/1;
  object-fit: cover;
  display: block;
  background: #d9d9d9;
  border: 1px solid #1d1d1d;
}

@media (max-width: 900px) {
  .gallery { gap: 24px; }
}
@media (max-width: 600px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .gallery-wrap { padding: 16px 16px 3rem; }
  .chips-whisper { display: none; }
  .chips-row .category-chips { flex-shrink: 1; }
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  background: var(--photo-bg);
}

.frame-title {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 8px 2px 0;
  text-align: center;
  word-break: break-word;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 1.5rem;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── 상세 페이지 ── */
.post-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.post-header {
  padding: 2rem 2.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  border-bottom: 1px solid #f0efec;
}

.back-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
  font-family: inherit;
}

.back-btn:hover {
  color: var(--text-primary);
}

.post-title {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.post-content {
  display: flex;
  flex: 1;
  padding: 2.5rem 2.5rem 4rem;
  gap: 4rem;
  align-items: flex-start;
}

.post-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 2.5rem;
}

.photo-container {
  position: relative;
  width: 100%;
}

.photo-container img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.date-stamp {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--date-color);
  text-shadow: 0 0 10px rgba(232, 137, 12, 0.5);
  letter-spacing: 3px;
  pointer-events: none;
  line-height: 1;
}

.slide-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-btn {
  background: none;
  border: 1px solid var(--frame-border);
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}

.nav-btn:hover:not(:disabled) {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.nav-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.slide-counter {
  font-size: 12px;
  color: var(--text-muted);
}

.post-right {
  flex: 1;
  padding-top: 0.25rem;
}

.slide-body {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text-primary);
  white-space: pre-wrap;
}

@media (max-width: 700px) {
  .post-header { padding: 1.5rem 1.25rem 1rem; }
  .post-content {
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 1.25rem 4rem;
  }
  .post-left { position: static; }
}

/* ── 모바일 (프론트) ── */
@media (max-width: 768px) {
  .site-header {
    padding: 32px 1rem 0;
  }
  .site-header h1 {
    font-size: 16px;   /* 20 × 0.8 */
    line-height: 15px; /* 30 × 0.5 */
    margin-bottom: 6px;
  }
  .site-header p {
    font-size: 13px;   /* 16 × 0.8 */
    line-height: 10px; /* 20 × 0.5 */
  }
  .header-divider {
    margin: 20px 24px 0;
  }
  .gallery-wrap {
    padding: 20px 20px 3rem;
  }
  .nickname-tag {
    font-size: 10px;   /* 12 × 0.8 */
    line-height: 10px;
    padding: 2px 8px;
    margin-bottom: 8px;
  }
  .frame-title {
    font-size: 10px;
  }
}

/* ── 어드민 ── */
.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-box h2 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.admin-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}

.admin-page h2 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.form-group label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
input[type="date"],
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #ddddd9;
  background: #fff;
  font-family: 'Pretendard', -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
  border-radius: 0;
  -webkit-appearance: none;
}

input:focus,
textarea:focus {
  border-color: var(--text-primary);
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.slide-card {
  border: 1px solid #e8e8e4;
  padding: 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.slide-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.slide-preview {
  width: 80px;
  height: 80px;
  object-fit: cover;
  display: block;
  background: var(--photo-bg);
}

.btn {
  padding: 0.65rem 1.25rem;
  border: 1px solid var(--frame-border);
  background: none;
  font-family: 'Pretendard', -apple-system, sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  background: var(--text-primary);
  color: #fff;
  border-color: var(--text-primary);
}

.btn-primary {
  background: var(--text-primary);
  color: #fff;
  border-color: var(--text-primary);
}

.btn-primary:hover {
  opacity: 0.8;
}

.btn-danger {
  border-color: #c0392b;
  color: #c0392b;
  font-size: 11px;
  padding: 0.35rem 0.65rem;
}

.btn-danger:hover {
  background: #c0392b;
  color: #fff;
}

.btn-sm {
  font-size: 11px;
  padding: 0.4rem 0.75rem;
}

.post-list {
  margin-top: 3rem;
  border-top: 1px solid #e8e8e4;
  padding-top: 2rem;
}

.post-list h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0efec;
  gap: 1rem;
}

.post-list-title {
  font-size: 14px;
  color: var(--text-primary);
}

.post-list-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.status-msg {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0.75rem 0;
}

.status-msg.error {
  color: #c0392b;
}
