@font-face {
  font-family: 'NanumSonDahaeng';
  src: url('../assets/fonts/NanumSonDahaeng.woff') format('woff');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'BrownCookies';
  src: url('../assets/fonts/BrownCookies.woff') format('woff');
  font-weight: 400;
  font-display: swap;
}

:root {
  --cam-bg: #0E0D0C;
  --cam-panel: #1A1917;
  --cam-ink: #F5F2EA;
  --cam-muted: #9A9488;
  --cam-line: #302E2A;
  --snap-accent: #F0C24B;
  --film-accent: #C17F2A;
  --album-cream: #F7F3EC;
  --album-panel: #FFFDF9;
  --album-ink: #17140F;
  --album-muted: #6B6459;
  --album-line: #E4DDD0;
  --font-serif: "Noto Serif KR", serif;
  --font-body: "Pretendard", "IBM Plex Sans KR", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; font-family: var(--font-body); font-size: 14px; min-height: 100vh; }
body { animation: pageIn .4s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
body.anim-settled { animation: none; }
body.leaving { animation: pageOut .28s ease both; }
@keyframes pageOut { to { opacity: 0; transform: translateY(-8px); } }

/* ===== Capture screens (dark viewfinder) ===== */
body.cam-mode { background: var(--cam-bg); color: var(--cam-ink); }
.cam-topbar { padding: 20px max(28px, calc((100% - 1180px) / 2 + 28px)); display: flex; justify-content: space-between; align-items: center; }
.cam-topbar .mark { font-family: 'Space Grotesk'; font-weight: 700; font-size: 15px; letter-spacing: normal; color: var(--cam-ink); text-decoration: none; cursor: pointer; }
.cam-topbar .cam-nav-links { display: flex; gap: 30px; font-size: 12px; color: var(--cam-muted); }
.cam-topbar .cam-nav-links span { cursor: pointer; }
.cam-topbar .cam-nav-links span.active { color: var(--film-accent); font-weight: 700; }
.cam-topbar .cam-nav-links span:hover { color: var(--cam-ink); }

.cam-stage { max-width: 480px; margin: 0 auto; padding: 10px 20px 100px; text-align: center; }
.cam-kicker { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 10px; }
.cam-kicker.snap { color: var(--snap-accent); }
.cam-kicker.film { color: var(--film-accent); }
.cam-title { font-family: var(--font-serif); font-weight: 700; font-size: 24px; margin-bottom: 6px; }
.cam-sub { font-size: 12.5px; color: var(--cam-muted); margin-bottom: 22px; }

.viewfinder {
  position: relative; width: 100%; border-radius: 16px; overflow: hidden;
  background: #000; margin-bottom: 22px; border: 1px solid var(--cam-line);
}
.viewfinder.ratio-square { aspect-ratio: 1 / 1; }
.viewfinder.ratio-32 { aspect-ratio: 3 / 2; }
.viewfinder.peek { width: 26.4%; margin-left: auto; margin-right: auto; }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewfinder video.mirror { transform: scaleX(-1); }
.viewfinder canvas.preview-canvas { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }

.shutter-row { display: flex; justify-content: center; align-items: center; gap: 20px; margin-bottom: 18px; }
.shutter-btn {
  width: 66px; height: 66px; border-radius: 50%; border: 4px solid var(--cam-ink);
  background: transparent; cursor: pointer; position: relative;
}
.shutter-btn::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--cam-ink); }
.shutter-btn:active::after { background: var(--film-accent); }
.cam-flip-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--cam-line);
  background: var(--cam-panel); color: var(--cam-ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cam-flip-btn svg { width: 20px; height: 20px; }

.cam-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.cam-result-actions .cam-btn { flex: 1; }
.cam-btn {
  border: 1px solid var(--cam-line); background: transparent; color: var(--cam-ink);
  border-radius: 20px; padding: 11px 20px; font-size: 12.5px; cursor: pointer;
}
.cam-btn.primary { background: var(--cam-ink); color: var(--cam-bg); border-color: var(--cam-ink); font-weight: 700; }
.cam-btn:hover { border-color: var(--film-accent); }

.cam-field { text-align: left; margin: 18px 0; }
.cam-field label { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cam-muted); margin-bottom: 8px; }
.cam-field input[type="text"] {
  width: 100%; background: var(--cam-panel); border: 1px solid var(--cam-line); border-radius: 8px;
  color: var(--cam-ink); padding: 12px 14px; font-size: 14px; outline: none; box-sizing: border-box;
}
.cam-field input:focus { border-color: var(--film-accent); }
.date-check-row { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12.5px; line-height: 15px; text-transform: none; letter-spacing: 0; color: var(--cam-muted); cursor: pointer; margin-bottom: 10px; }
.date-check-row input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--film-accent); cursor: pointer; }
.char-count-row { text-align: right; font-size: 11px; color: var(--cam-muted); margin-top: 6px; }
#capCharCount.limit { color: #E0674F; font-weight: 700; }

.cam-notice { font-size: 11px; color: var(--cam-muted); line-height: 1.8; margin-top: 18px; }
.cam-notice a { color: var(--film-accent); cursor: pointer; text-decoration: underline; }
.cam-howto-steps { margin: 22px 0 26px; text-align: left; }
.cam-howto-steps.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.cam-howto-steps .step { display: flex; gap: 12px; margin-bottom: 12px; align-items: center; }
.cam-howto-steps .num {
  width: 20px; height: 20px; border-radius: 50%; background: var(--cam-ink); color: #14110D;
  font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; line-height: 1;
}
.cam-howto-steps p { font-size: 12.5px; color: var(--cam-muted); line-height: 1.6; margin: 0; }

.cam-album-link {
  position: fixed; right: 22px; bottom: 26px; z-index: 55;
  display: flex; align-items: center; gap: 6px;
  background: rgba(23,20,15,0.55); color: var(--cam-ink); text-decoration: none;
  border: 1px solid rgba(247,243,236,0.25);
  backdrop-filter: blur(14px) saturate(1.5); -webkit-backdrop-filter: blur(14px) saturate(1.5);
  padding: 12px 20px; border-radius: 999px; font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4); cursor: pointer;
}
.cam-album-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.cam-album-link:hover { background: rgba(23,20,15,0.75); }

/* ===== Album (light, cream) ===== */
body.album-mode { background: var(--album-cream); color: var(--album-ink); }
.album-topbar { padding: 20px max(24px, calc((100% - 1180px) / 2 + 24px)); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--album-line); }
.album-topbar .mark { font-family: 'Space Grotesk'; font-weight: 700; font-size: 14px; letter-spacing: normal; color: var(--album-ink); cursor: pointer; }
.album-topbar .album-back { font-size: 12px; color: var(--album-muted); cursor: pointer; }
.album-topbar .album-back:hover { color: var(--film-accent); }
.album-topbar .cam-nav-links { display: flex; gap: 30px; font-size: 12px; color: var(--album-muted); }
.album-topbar .cam-nav-links span { cursor: pointer; }
.album-topbar .cam-nav-links span:hover { color: var(--album-ink); }

.album-stage { max-width: 640px; margin: 0 auto; padding: 24px 20px 90px; }
.album-head { text-align: center; margin-bottom: 22px; }
.album-head h1 { font-family: var(--font-serif); font-size: 24px; margin-bottom: 6px; }
.album-head p { font-size: 12px; color: var(--album-muted); }

.album-filter { display: flex; gap: 8px; justify-content: center; margin-bottom: 22px; }
.album-filter button {
  border: 1px solid var(--album-line); background: var(--album-panel); border-radius: 20px;
  padding: 7px 16px; font-size: 12px; color: var(--album-muted); cursor: pointer;
}
.album-filter button.active { background: var(--album-ink); color: #fff; border-color: var(--album-ink); font-weight: 700; }

.album-notice {
  font-size: 11.5px; color: var(--album-muted); background: var(--album-panel); border: 1px solid var(--album-line);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 22px; line-height: 1.7; text-align: center;
}

.album-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.album-card { position: relative; cursor: pointer; }
.album-card img, .album-card .locked-face { width: 100%; display: block; border-radius: 4px; }
.album-card.snap-card { transform: rotate(var(--rot, -2deg)); }
.album-card.snap-card img { box-shadow: 0 8px 18px rgba(0,0,0,0.12); }
.album-card.film-card img { border-radius: 6px; box-shadow: 0 8px 18px rgba(0,0,0,0.16); }
.locked-face {
  aspect-ratio: 3/2; background: linear-gradient(135deg, #2A2721, #17150F); border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: #C9BEA6; font-size: 11px; padding: 10px; text-align: center;
}
.locked-face .lock-icon { font-size: 22px; }
.album-caption { font-size: 11px; color: var(--album-muted); text-align: center; margin-top: 6px; padding: 0 4px; }
.album-empty { text-align: center; color: var(--album-muted); font-size: 13px; padding: 60px 20px; border: 1px dashed var(--album-line); border-radius: 8px; grid-column: 1 / -1; }

/* ===== Lightbox ===== */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(10,8,5,0.86); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lightbox-box { max-width: 420px; width: 100%; text-align: center; }
.lightbox-box img { max-width: 100%; border-radius: 4px; margin-bottom: 14px; }
.lightbox-caption { color: #F5F2EA; font-size: 13px; margin-bottom: 16px; font-family: var(--font-serif); }
.lightbox-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lightbox-close { position: absolute; top: 20px; right: 24px; color: #fff; font-size: 22px; cursor: pointer; background: none; border: none; }

/* ===== Film develop reveal ===== */
.developing { animation: developIn 2.2s ease forwards; }
@keyframes developIn {
  0% { filter: brightness(0.15) contrast(0.6) grayscale(1); opacity: 0.3; }
  40% { filter: brightness(0.5) contrast(0.8) grayscale(0.6); opacity: 0.75; }
  100% { filter: brightness(1) contrast(1) grayscale(0); opacity: 1; }
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--album-ink); color: #fff; padding: 10px 20px; border-radius: 20px;
  font-size: 12.5px; z-index: 999; opacity: 0; transition: opacity .3s ease;
}
body.cam-mode .toast { background: var(--cam-ink); color: var(--cam-bg); }
.toast.show { opacity: 1; }

.bottom-nav { display: none; }
@media (max-width: 760px) {
  .cam-topbar .cam-nav-links, .album-topbar .cam-nav-links { display: none; }
  body { padding-bottom: 78px; }
  .cam-album-link { bottom: 92px; right: 16px; padding: 10px 16px; font-size: 12px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(14,13,12,0.92); backdrop-filter: blur(16px);
    border-top: 1px solid var(--cam-line); padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  }
  body.album-mode .bottom-nav { background: rgba(251,246,236,0.94); border-top: 1px solid var(--album-line); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; color: var(--cam-muted); font-weight: 600; text-decoration: none; padding: 4px 0; cursor: pointer; }
  body.album-mode .bottom-nav a { color: var(--album-muted); }
  .bottom-nav a .bicon { font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; }
  .bottom-nav a .bicon svg { width: 19px; height: 19px; }
  .bottom-nav a.active { color: var(--film-accent); }
  .album-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
