/* SnapStory 공통 스타일 — 모바일 기준으로 작성하고 min-width 로 넓힌다 (기획안 7.1, 7.6)
 * 2차 디자인 "가족 앨범 에디토리얼" (기획안_2차 4.3): 따뜻한 종이색, 큰 숫자·제목, 대표색은 잉크로만 */
:root {
  color-scheme: light; /* 인앱 브라우저의 강제 다크 변환 막기 */
  --bg: #F7F4EE;          /* 종이 */
  --paper-2: #EFEAE1;     /* 종이 2: 카드·자리 표시 */
  --surface: #FFFFFF;
  --text: #1F1D1A;
  --text-sub: #625E57;    /* 종이 위 대비 5.2:1 */
  --text-mute: #8A857D;   /* 장식용. 14px 미만 정보성 글자에는 쓰지 않음 */
  --line: #E4DED3;
  --line-strong: #D3CBBE;
  --shadow-print: 0 1px 2px rgba(40,30,20,.08), 0 4px 12px rgba(40,30,20,.06);
  /* 글자 크기 (모바일 / 1024px 이상은 아래 미디어 쿼리에서) */
  --t-display: 32px;
  --t-chapter: 40px;
  --t-h1: 24px;
  --t-h2: 19px;
  --t-body: 16px;
  --t-cap: 14px;
  --t-meta: 13px;
  --t-label: 12px;
  --gutter: 16px;
  --s-section: 40px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --accent: #2F5D50;
  --accent-soft: #E6EEEB;
  --lightbox-bg: #0E0E0E;
  --admin-bg: #F4F3EF;
  --danger: #A33A3A;
  --warn: #8A5A12;
  --radius-sm: 4px;
  --radius: 12px;
  --radius-lg: 16px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.65;
  /* 한글은 낱말 단위로 줄바꿈 (드립/니다 처럼 낱말 중간에서 끊기지 않게). 긴 주소 등은 넘치지 않게 끊는다 */
  word-break: keep-all;
  overflow-wrap: break-word;
  touch-action: manipulation;
}
a { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.35; letter-spacing: -0.02em; }
/* hidden 속성은 항상 숨김 (display 를 준 클래스가 덮어쓰지 않게) */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 버튼·입력 (터치 영역 44px 이상, 입력 글자 16px 이상: iOS 자동 확대 방지) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 24px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.input {
  height: 52px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 400;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.alert { padding: 12px 14px; border-radius: var(--radius); font-size: 14px; }
.alert-error { background: #FBEAEA; color: var(--danger); }
.alert-ok { background: var(--accent-soft); color: var(--accent); }

/* ===== 하단 고정 문의 버튼 (랜딩, 모바일) ===== */
.cta-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 8px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); background: rgba(247,244,238,.96); border-top: 1px solid var(--line); }
.cta-bar .btn { flex: 1; }
.btn-kakao { background: #FEE500; border-color: #FEE500; color: #1C1C1A; }
.btn-icon { flex: none !important; width: 52px; padding: 0; }
@media (min-width: 1024px) { .cta-bar { display: none; } }

@media (min-width: 600px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) {
  :root { --t-display: clamp(44px, 4.4vw, 56px); --t-chapter: 64px; --t-h1: 32px; --t-h2: 22px; --gutter: 40px; --s-section: 72px; }
}

/* ===== 갤러리 공통 ===== */
.g-header { position: sticky; top: 0; z-index: 10; background: var(--g-bar, var(--bg)); padding-top: env(safe-area-inset-top); }
.g-header .inner { max-width: 1280px; margin: 0 auto; height: 56px; padding: 0 8px 0 16px; display: flex; align-items: center; justify-content: space-between; }
.g-logo { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; }
.g-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--g-accent-fill, var(--accent)); color: #fff; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.g-logo img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.preview-bar { background: #FBF3E4; color: var(--warn); font-size: 13px; text-align: center; padding: 8px 16px; }
.center-page { min-height: calc(100dvh - 56px); display: flex; align-items: center; justify-content: center; padding: 24px 16px 64px; }
.center-box { width: 100%; max-width: 380px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.center-box .g-mark { width: 56px; height: 56px; border-radius: 16px; font-size: 24px; margin: 0 auto 8px; }
.center-box h1 { margin: 0; font-size: 22px; }
.center-box p { margin: 0; color: var(--text-sub); }
.center-box form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; text-align: left; }
.code-input { text-align: center; font-size: 22px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; height: 56px; }
.empty { padding: 64px 16px; text-align: center; color: var(--text-sub); }

/* ===== 관리자 ===== */
.admin { background: var(--admin-bg); min-height: 100dvh; }
.admin-auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.admin-auth .box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.admin-auth h1 { margin: 0; font-size: 24px; }
.admin-auth .sub { margin: 0; color: var(--text-sub); font-size: 14px; }
.admin-auth form { display: flex; flex-direction: column; gap: 16px; }
.admin-note { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--text-sub); }
.admin-top { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 120px; display: flex; flex-direction: column; gap: 16px; }
.panel { padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.stat span { display: block; font-size: 13px; color: var(--text-sub); }
.stat strong { font-size: 26px; }
@media (min-width: 1024px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ===== 2차 디자인: 공유코드 입력·상태 안내 (기획안_2차 4.4) ===== */
.g-mark-img { object-fit: cover; padding: 0; background: var(--surface); }
.lock-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.lock-wrap { flex: 1; display: flex; flex-direction: column; }
.lock-hero {
  min-height: 40vh; min-height: 40svh; padding: calc(40px + env(safe-area-inset-top)) 24px 48px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: #fff;
  background: linear-gradient(160deg, var(--g-accent-fill, var(--accent)), #1F1D1A);
  background: linear-gradient(160deg, var(--g-accent-fill, var(--accent)), color-mix(in srgb, var(--g-accent-fill, var(--accent)) 55%, #000));
}
.lock-icon { width: 40px; height: 40px; border-radius: 999px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; }
.g-mark.g-mark-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 28px; font-weight: 700; background: rgba(255,255,255,.16); box-shadow: 0 0 0 2px rgba(255,255,255,.5); }
.lock-hero h1 { margin: 4px 0 0; font-size: 28px; line-height: 1.2; letter-spacing: -0.03em; }
.lock-sub { margin: 0; font-size: 14px; opacity: .85; }
.lock-card { position: relative; margin-top: -20px; flex: 1; padding: 28px 20px calc(32px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: var(--surface); display: flex; flex-direction: column; gap: 16px; }
.lock-lead { margin: 0; font-size: 16px; font-weight: 600; text-align: center; }
.lock-card form { display: flex; flex-direction: column; gap: 12px; }
.lock-card .code-input::placeholder { color: var(--text-mute); letter-spacing: .05em; font-weight: 500; font-size: 18px; }
.lock-help { margin: 0; font-size: 13px; color: var(--text-sub); text-align: center; }

.state-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 32px; padding: 48px 24px calc(32px + env(safe-area-inset-bottom)); }
.state-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.state-box .g-mark { width: 44px; height: 44px; border-radius: 12px; font-size: 19px; }
.state-name { margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--text-sub); }
.state-icon { margin-top: 32px; width: 56px; height: 56px; border-radius: 999px; display: flex; align-items: center; justify-content: center; color: var(--g-accent, var(--accent)); background: var(--g-accent-soft, #EEEDEA); }
.state-box h1 { margin: 16px 0 8px; font-size: 24px; letter-spacing: -0.02em; }
.state-box p { margin: 0; font-size: 16px; color: var(--text-sub); }
.state-home { font-size: 13px; color: var(--text-mute); text-decoration: none; font-weight: 600; }

@media (min-width: 1024px) {
  .lock-page { align-items: center; justify-content: center; padding: 48px; background: var(--bg); }
  .lock-wrap { flex: none; width: 880px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 20px; overflow: hidden; box-shadow: 0 2px 4px rgba(40,30,20,.06), 0 16px 48px rgba(40,30,20,.10); }
  .lock-hero { min-height: 480px; padding: 48px; }
  .lock-card { margin: 0; border-radius: 0; padding: 56px 48px; justify-content: center; }
  .lock-lead { text-align: left; font-size: 18px; }
  .lock-help { text-align: left; }
}
.lock-page .btn-primary, .lock-page .input:focus { --accent: var(--g-accent-fill, var(--g-accent, #2F5D50)); }
