/* teknlaw blog — Medium-inspired design system */

/* ─── Reset / Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.62;
  color: #242424;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ─── Tokens ───────────────────────────────────────────────────────── */
:root {
  --fg: #1a1a1a;
  --fg-muted: #565656;
  --fg-light: #767676;
  --bg: #ffffff;
  --bg-soft: #FAFAFA;
  --border: #E6E6E6;
  --accent: #1A8917;          /* Medium green */
  --accent-soft: #E8F4E5;
  --link: #1f6feb;
  --shadow: 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.08);
  --radius: 8px;
  --max-content: 1240px;
}

/* ─── Header ───────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.site-logo {
  font-family: 'Charter', 'Noto Serif KR', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -.5px;
}
.site-logo span { color: var(--accent); }
.site-tagline {
  font-size: 14px;
  color: var(--fg-muted);
  font-weight: 500;
  padding-left: 14px;
  margin-left: 2px;
  border-left: 1px solid var(--border);
  letter-spacing: -.3px;
  white-space: nowrap;
}
/* 좁은 화면(헤더 협소)에선 헤더 칩 숨기고 아래 풀폭 배너로 노출 */
@media (max-width: 900px) { .site-tagline { display: none; } }
.site-intro {
  display: none;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  padding: 9px 16px;
  letter-spacing: -.3px;
}
@media (max-width: 900px) { .site-intro { display: block; } }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.btn-text {
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 99px;
}
.btn-text:hover { background: var(--bg-soft); }
.btn-primary {
  background: var(--fg);
  color: #fff;
  border: none;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 99px;
}
.btn-primary:hover { background: #000; }
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 99px;
}
.btn-ghost:hover { border-color: var(--fg); }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* 로그인 사용자 칩 (아바타 + 닉네임 + 로그인수단) → 마이페이지 링크 */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 3px 12px 3px 3px;
  border-radius: 99px;
  border: 1px solid var(--border);
  transition: border-color .15s, background .15s;
}
.user-chip:hover { border-color: var(--fg); background: var(--bg-soft); }
.user-chip__meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip__nick {
  font-size: 13px; font-weight: 600; color: var(--fg);
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chip__prov { font-size: 11px; color: var(--fg-muted); }
@media (max-width: 560px) { .user-chip__meta { display: none; } }

/* 마이페이지 개인설정 카드 */
.settings-card { border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; }
.settings-card h3 { margin: 0 0 14px; }
.account-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--bg-soft); font-size: 14px;
}
.account-row:last-child { border-bottom: none; }
.account-label { color: var(--fg-muted); min-width: 84px; font-size: 13px; }
.account-row--edit { flex-wrap: wrap; }
.account-row--edit input {
  flex: 1; min-width: 160px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}

/* ─── Layout ───────────────────────────────────────────────────────── */
.main-layout {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 36px 28px 80px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 40px;
}
@media (max-width: 1080px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar-right { display: none; }
}
@media (max-width: 760px) {
  .main-layout { padding: 24px 16px 60px; gap: 24px; }
}

/* ─── Sector bar (horizontal, under header) ────────────────────────── */
.sector-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.sector-bar__inner {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 10px 28px;
  display: flex;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sector-bar__inner::-webkit-scrollbar { display: none; }
.sector-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: row; flex-wrap: nowrap; gap: 6px; }
.sector-list a {
  display: block;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--fg);
  transition: background .12s;
}
.sector-list a:hover { background: var(--bg-soft); }
.sector-list a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
@media (max-width: 760px) {
  .sector-bar__inner { padding: 8px 16px; }
}

/* ─── Sidebar right (visitor stats) ────────────────────────────────── */
.stats-card {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
}
.stats-card h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.stat-item { }
.stat-label { font-size: 11px; color: var(--fg-light); text-transform: uppercase; letter-spacing: .8px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--fg); font-feature-settings: 'tnum'; margin-top: 2px; }
.stat-total {
  grid-column: 1 / -1;
  padding-top: 12px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}
.stat-total .stat-value { font-size: 28px; }

/* ─── Sidebar cards (Who am I · 많이 본 글) ─────────────────────────── */
.side-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.side-card h3 {
  font-size: 13px; font-weight: 700; color: var(--fg);
  margin: 0 0 14px; text-transform: uppercase; letter-spacing: 1px;
}
.who-name { font-family: 'Pretendard','Apple SD Gothic Neo',-apple-system,BlinkMacSystemFont,sans-serif; letter-spacing: -0.01em; font-size: 19px; font-weight: 700; color: var(--fg); }
.who-name span { font-size: 13px; font-weight: 500; color: var(--fg-muted); margin-left: 5px; font-family: 'Pretendard',sans-serif; }
.who-title { font-size: 13px; font-weight: 600; color: var(--accent); margin-top: 3px; }
.who-desc { font-size: 13px; color: var(--fg-muted); line-height: 1.55; margin: 10px 0 14px; }
.who-link { font-size: 13px; font-weight: 600; color: var(--fg); }
.who-link:hover { color: var(--accent); }
.popular-list { list-style: none; margin: 0; padding: 0; counter-reset: pop; }
.popular-list li { display: flex; align-items: baseline; gap: 9px; padding: 8px 0; border-top: 1px solid var(--border); }
.popular-list li:first-child { border-top: none; padding-top: 0; }
.popular-list li::before { counter-increment: pop; content: counter(pop); font-weight: 700; color: var(--accent); font-size: 13px; min-width: 14px; }
.popular-list a { flex: 1; font-size: 13px; line-height: 1.4; color: var(--fg);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.popular-list a:hover { color: var(--accent); }
.popular-views { font-size: 11px; color: var(--fg-light); white-space: nowrap; font-feature-settings: 'tnum'; }
.popular-empty { color: var(--fg-light); font-size: 13px; }
.popular-empty::before { content: none !important; }

/* ─── Who am I 페이지 ──────────────────────────────────────────────── */
.whoami-page { max-width: 760px; margin: 0 auto; padding: 48px 24px 90px; }
.whoami-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--accent); }
.whoami-name { font-family: 'Pretendard','Apple SD Gothic Neo',-apple-system,BlinkMacSystemFont,sans-serif; letter-spacing: -0.015em; font-size: 38px; font-weight: 800; margin: 10px 0 6px; line-height: 1.2; }
.whoami-name span { font-size: 16px; font-weight: 500; color: var(--fg-muted); font-family: 'Pretendard',sans-serif; margin-left: 8px; }
.whoami-role { font-size: 16px; font-weight: 600; color: var(--accent); margin: 0 0 18px; }
.whoami-lead { font-size: 16px; line-height: 1.75; color: var(--fg-muted); }
.whoami-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.whoami-extlink { display: inline-block; padding: 9px 16px; border: 1px solid var(--border); border-radius: 99px; font-size: 14px; font-weight: 600; }
.whoami-extlink:hover { border-color: var(--accent); color: var(--accent); }
.whoami-block { margin-top: 40px; }
.whoami-block h2 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--fg-light); border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.whoami-list { list-style: none; padding: 0; margin: 14px 0 0; }
.whoami-list li { font-size: 15px; line-height: 1.5; padding: 7px 0; color: var(--fg); border-bottom: 1px solid var(--bg-soft); }
.whoami-list li b { color: var(--accent); margin-right: 4px; }
.whoami-back { margin-top: 44px; font-size: 14px; }
.whoami-back a { color: var(--fg-muted); }
.whoami-back a:hover { color: var(--accent); }

/* ─── Card feed ────────────────────────────────────────────────────── */
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }

/* ── 별첨(featured) 레이아웃: 상단 3개 카드 + 나머지 세로 리스트 ── */
.feed--featured { display: block; }
.feed-featured { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 30px; }
.feed-list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 22px; padding: 24px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.list-item__image { width: 220px; height: 142px; object-fit: cover; border-radius: 10px; flex: none; background: #f2f2ef; }
.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font-family: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, sans-serif; letter-spacing: -0.01em; font-size: 22px; font-weight: 700; color: var(--fg); line-height: 1.32; margin: 7px 0 9px; }
.list-item__excerpt { color: var(--fg-muted); font-size: 16px; line-height: 1.72; margin: 0 0 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.list-item:hover .list-item__title { color: var(--accent); }
@media (max-width: 760px) {
  .feed-featured { grid-template-columns: 1fr; }
  /* 모바일: 별첨 리스트를 상단 카드처럼 세로 카드로 (사진 위 + 전체폭 본문 — 좌우 반반 옹색함 해소) */
  .feed-list { gap: 18px; }
  .list-item { flex-direction: column; gap: 0; padding: 0; border-bottom: none;
    background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
  .list-item__image { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 0; border-bottom: 1px solid var(--border); }
  .list-item__body { padding: 14px 16px 16px; }
  .list-item__title { font-size: 18px; margin: 4px 0 8px; }
  .list-item__excerpt { font-size: 14px; -webkit-line-clamp: 3; }
  /* 모바일 기본 글자 — 네이버 모바일에 맞춰 데스크톱보다 한 단계 작게 */
  body { font-size: 16px; }
  .card__title { font-size: 17px; }
  .card__excerpt { font-size: 14px; }
}

/* ── 페이지 크기 토글 + 더보기 ── */
.feed-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.feed-controls__label { font-size: 13px; color: var(--fg-light); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; color: var(--fg-muted); padding: 6px 14px; font-size: 13px; cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--accent); color: #fff; font-weight: 600; }
.load-more { display: block; margin: 26px auto 8px; padding: 11px 34px; background: #fff; border: 1px solid var(--border); border-radius: 99px; font-size: 15px; color: var(--fg); cursor: pointer; transition: background .15s; }
.load-more:hover { background: #f5f5f3; }
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s;
  cursor: pointer;
  height: 100%;           /* 그리드 한 줄 내 카드 높이 균일 (내용에 맞춰 늘어남, 하단 잘림 방지) */
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-soft);
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border);
}
.card__body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}
.card__sector {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.card__media {
  color: var(--fg-light);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.card__pin {
  display: inline-block;
  background: #fff4d6;
  color: #c47d00;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: 0;
}
.card__title {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-shrink: 0;
}
.card__excerpt {
  font-size: 15px;
  color: var(--fg-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
}
.card--text .card__excerpt { -webkit-line-clamp: 5; }
.card__meta {
  font-size: 12px;
  color: var(--fg-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  flex-shrink: 0;     /* 메타(조회·좋아요·댓글)는 항상 하단에 보이게 */
  padding-top: 4px;
}
.card__meta__stat { display: inline-flex; gap: 4px; align-items: center; }

.card--text { background: linear-gradient(180deg, #fafaf7, #fff); }

/* 무한스크롤 sentinel */
.feed-end { text-align: center; padding: 30px; color: var(--fg-light); font-size: 13px; }

/* ─── Post page ────────────────────────────────────────────────────── */
.post-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 28px 80px;
}
.post-page h1 {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: -0.015em;
  font-size: 42px;
  line-height: 1.2;
  margin: 0 0 18px;
}
.post-page .post-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.post-page .post-meta .citation {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.post-page .canonical-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--fg-muted);
  background: var(--bg-soft);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  user-select: all;
}

/* ─── Reader (StPageFlip 모달) ─────────────────────────────────────── */
.reader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,20,20,.92);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.reader-overlay.open { display: flex; cursor: pointer; }   /* 여백 클릭으로 넘김 가능함을 커서로 암시 */
.reader-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  padding: 16px 24px;
  gap: 14px;
  color: #fff;
  z-index: 9999;            /* flipbook(및 그 내부 transform 레이어) 위에 항상 */
  flex-wrap: wrap;          /* 좁은 화면에서 버튼이 줄바꿈되어 사라지지 않게 */
  /* 상단 그라데이션 — 표지가 밝아도 버튼이 항상 보이게 */
  background: linear-gradient(180deg, rgba(20,20,20,.92) 0%, rgba(20,20,20,.55) 70%, rgba(20,20,20,0) 100%);
  padding-bottom: 28px;
  pointer-events: none;     /* 그라데이션 영역 클릭이 책을 막지 않게 */
}
.reader-top > * { pointer-events: auto; }   /* 버튼/제목은 정상 클릭 */
.reader-top button { flex-shrink: 0; }      /* 버튼은 절대 줄어들거나 밀려나지 않음 */
.reader-top h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-views { color: #cfcfcf; font-size: 13px; white-space: nowrap; font-feature-settings: 'tnum'; }
.reader-top button {
  background: rgba(255,255,255,.1);
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 8px 14px;
  font-size: 13px;
}
.reader-top button:hover { background: rgba(255,255,255,.2); }
.reader-close { width: 36px; height: 36px; padding: 0 !important; font-size: 18px !important; }

#flipbook-host {
  position: relative;
  width: min(92vw, 1100px);
  height: min(78vh, 700px);
}
.reader-bottom {
  position: absolute;
  bottom: 14px; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  color: #ccc;
  font-size: 13px;
  z-index: 1010;
}
.reader-bottom button {
  background: rgba(255,255,255,.14);
  color: #fff;
  border: none;
  min-width: 78px; height: 56px;
  border-radius: 14px;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.reader-bottom button:hover { background: rgba(255,255,255,.28); }
.reader-bottom button:active { background: rgba(255,255,255,.4); }
@media (max-width: 600px) {
  .reader-bottom { gap: 18px; }
  .reader-bottom button { min-width: 64px; height: 50px; font-size: 24px; }
}
/* 모바일: 상단 헤더가 책 본문 위에 겹치지 않게 — 책을 헤더 아래로 내리고 헤더 컴팩트화 */
@media (max-width: 720px) {
  .reader-overlay.open { justify-content: flex-start; }
  .reader-top { padding: 9px 10px 14px; gap: 5px; }
  .reader-top h2 { display: none; }            /* 제목은 페이지 풋터에 표시됨 — 버튼 줄바꿈 줄이기 */
  .reader-top button { padding: 6px 9px; font-size: 12px; }
  .reader-views { font-size: 12px; }
  #flipbook-host { margin-top: 96px; height: calc(100dvh - 188px); width: 94vw; }
  .page-foot { display: none; }   /* 모바일: 하단 제목 풋터 숨김 (본문과 겹침 방지, 페이지번호는 하단 바에 있음) */
}
.page-indicator { font-feature-settings: 'tnum'; }

/* StPageFlip 페이지 콘텐츠 */
.flip-page {
  background: #fffdfa;
  padding: 40px 44px;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, sans-serif;
  font-size: 16.5px;
  line-height: 1.78;
  color: #161616;
  overflow: hidden;
  overflow-wrap: break-word;   /* 긴 단어·URL 이 페이지 폭을 넘지 않게 (가로 넘침 방지) */
  /* 본문 텍스트 드래그 선택 → 하이라이트. StPageFlip 의 none 을 덮어씀 */
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}
.flip-page, .flip-page * { -webkit-user-select: text; user-select: text; }
/* StPageFlip 내부 래퍼도 선택 허용 */
.stf__item, .stf__item * { -webkit-user-select: text !important; user-select: text !important; }
.flip-page h1, .flip-page h2, .flip-page h3 { font-family: inherit; }
.flip-page h1 { font-size: 28px; margin-bottom: 16px; }
.flip-page h2 { font-size: 22px; margin: 24px 0 12px; }
.flip-page h3 { font-size: 18px; margin: 20px 0 10px; }
.flip-page p { margin: 0 0 14px; }
.flip-page img { display: block; margin: 18px auto; max-width: 100%; border-radius: 4px; }
/* 모바일: 좁은 화면에서 여백 축소 + 살짝 작은 본문 → 내용 넘침 방지 (페이지 분할 probe 도 동일 적용) */
@media (max-width: 720px) {
  .flip-page { padding: 22px 18px; font-size: 16px; line-height: 1.7; }
  .flip-page h1 { font-size: 23px; margin-bottom: 12px; }
  .flip-page h2 { font-size: 19px; margin: 18px 0 10px; }
  .flip-page h3 { font-size: 16.5px; margin: 16px 0 8px; }
}
/* 사진 전용 페이지 — 한 페이지에 사진 1장(전체 보이게) + 아래 설명(에피소드) */
.flip-page .photo-page { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; box-sizing: border-box; margin: 0; }
.flip-page .photo-page img { margin: 0 auto; max-width: 100%; max-height: 74%; object-fit: contain; box-shadow: 0 2px 14px rgba(0,0,0,.14); }
.flip-page .photo-page figcaption { margin-top: 18px; font-size: 14px; line-height: 1.65; color: #555; text-align: center; max-width: 94%; overflow: hidden; }
.flip-page .photo-page figcaption blockquote { margin: 0; padding: 0; border: 0; font-style: normal; color: #555; }
.flip-page a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.flip-page a:hover { color: #146611; }
.flip-page blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--fg-muted);
  font-style: italic;
}
.flip-page code {
  background: #f0eee5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 14px;
}
.flip-page mark[data-hl] {
  background: rgba(255, 234, 0, .55);
  padding: 0 2px;
  border-radius: 2px;
  cursor: pointer;
}
.flip-page mark[data-hl][data-color="green"] { background: rgba(133,234,140,.5); }
.flip-page mark[data-hl][data-color="blue"]  { background: rgba(140,200,255,.5); }
.flip-page mark[data-hl][data-color="pink"]  { background: rgba(255,170,200,.55); }
.page-foot {
  position: absolute;
  bottom: 14px; left: 44px; right: 44px;
  font-size: 11px;
  color: var(--fg-light);
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #ebe6dc;
  padding-top: 8px;
}

/* 하이라이트 팝오버 */
.hl-popover {
  position: fixed;
  z-index: 1100;
  background: #1f1f1f;
  color: #fff;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.hl-popover button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 4px;
}
.hl-popover button:hover { background: rgba(255,255,255,.1); }
.hl-color-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
}
.hl-color-dot:hover { border-color: #fff; }
.hl-color-dot.yellow { background: #fde047; }
.hl-color-dot.green  { background: #86efac; }
.hl-color-dot.blue   { background: #93c5fd; }
.hl-color-dot.pink   { background: #f9a8d4; }

/* 우측 사이드 패널 (편집 제안 / 댓글) */
.side-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  background: #fff;
  z-index: 1200;
  box-shadow: -8px 0 32px rgba(0,0,0,.15);
  transform: translateX(100%);
  transition: transform .25s;
  display: flex;
  flex-direction: column;
}
.side-panel.open { transform: translateX(0); }
.side-panel header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.side-panel header h3 { margin: 0; font-size: 16px; flex: 1; }
.side-panel header button {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--fg-muted);
}
.side-panel .body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}
.side-panel textarea {
  width: 100%;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 120px;
  resize: vertical;
}
.side-panel .anchor-quote {
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 14px;
}
.side-panel footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
@media (max-width: 580px) {
  .side-panel { width: 100%; }
}

/* 댓글 */
.comment-list { display: flex; flex-direction: column; gap: 18px; }
.comment {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.comment__head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-muted); margin-bottom: 6px; }
.comment__head .nick { color: var(--fg); font-weight: 600; }
.comment__body { font-size: 14px; line-height: 1.55; color: var(--fg); white-space: pre-wrap; }
.comment__actions { display: flex; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--fg-muted); }
.comment__actions button { background: transparent; border: none; color: var(--fg-muted); font-size: 12px; padding: 2px 6px; }
.comment__actions button:hover { color: var(--fg); }
.comment__actions button.liked { color: var(--accent); }

/* ─── 로그인 모달 ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  width: min(90vw, 420px);
  padding: 32px 28px;
  text-align: center;
  position: relative;
}
.modal h2 { margin: 0 0 6px; font-size: 22px; }
.modal p.modal-sub { margin: 0 0 22px; color: var(--fg-muted); font-size: 14px; }
.modal .oauth-buttons { display: flex; flex-direction: column; gap: 10px; }
.oauth-btn {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--fg);
}
.oauth-btn:hover { background: var(--bg-soft); }
.oauth-btn--kakao { background: #fee500; border-color: #fee500; }
.oauth-btn--kakao:hover { background: #ffd900; }
.oauth-btn--naver { background: #03c75a; border-color: #03c75a; color: #fff; }
.oauth-btn--naver:hover { background: #02b452; }
.oauth-btn--apple { background: #000; border-color: #000; color: #fff; }
.modal .close-x {
  position: absolute;
  top: 14px; right: 14px;
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--fg-muted);
}

/* ─── Buttons (share / cite) ──────────────────────────────────────── */
.share-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 0; }
.share-btn {
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.share-btn:hover { background: var(--bg-soft); }
.share-btn--kakao { background: #fee500; border-color: #fee500; }
.share-btn--copy.copied { background: var(--accent-soft); color: var(--accent); }

/* ─── Admin ────────────────────────────────────────────────────────── */
.admin-shell { max-width: 1240px; margin: 0 auto; padding: 30px 28px 60px; display: grid; grid-template-columns: 220px 1fr; gap: 40px; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav button {
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--fg);
  font-size: 14px;
}
.admin-nav button:hover { background: var(--bg-soft); }
.admin-nav button.active { background: var(--fg); color: #fff; font-weight: 600; }
.admin-nav__group {
  font-size: 15px; font-weight: 800; color: var(--fg);
  letter-spacing: -.2px; margin: 22px 0 4px; padding: 0 14px;
}
.admin-nav button.admin-nav__cat { font-size: 15px; font-weight: 700; }   /* 대시보드·설정 (단독 카테고리) */
.admin-nav__settings { margin-top: 18px; }
@media (max-width: 760px) { .admin-nav__group { flex-basis: 100%; margin: 10px 0 0; } .admin-nav__settings { margin-top: 0; } }
.admin-section { display: none; }
.admin-section.active { display: block; }
.admin-section h2 { font-size: 22px; margin: 0 0 18px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.field textarea { min-height: 320px; line-height: 1.6; font-family: 'Charter', 'Noto Serif KR', Georgia, serif; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.admin-table th { font-weight: 600; color: var(--fg-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.admin-table tr:hover { background: var(--bg-soft); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge--published { background: var(--accent-soft); color: var(--accent); }
.badge--draft { background: #fef3c7; color: #92400e; }
.badge--archived { background: #f3f4f6; color: var(--fg-muted); }
.badge--pinned { background: #fff4d6; color: #c47d00; }

/* 고정 토글 — 목록 버튼(.pin-btn) + 편집화면 버튼(.pin-toggle). 고정 시 색 반전 */
.pin-btn { color: #999; }
.pin-btn.is-pinned { background: #c47d00; color: #fff; border-radius: 6px; padding: 2px 9px; font-weight: 600; }
.pin-btn--locked { opacity: .4; }
.pin-toggle { padding: 8px 14px; border: 1px solid #d8c089; border-radius: 8px; background: #fff; color: #a07400; font-weight: 600; cursor: pointer; font-size: 13px; }
.pin-toggle.is-pinned { background: #c47d00; color: #fff; border-color: #c47d00; }
.pin-toggle.pin-locked { opacity: .5; border-style: dashed; color: #999; }

/* 빠른 기간 preset 칩 버튼 */
.chip-btn { background: #fff; border: 1px solid var(--border); border-radius: 99px; padding: 4px 13px; font-size: 12px; color: var(--fg-muted); cursor: pointer; }
.chip-btn:hover { background: #f5f5f3; border-color: #ccc; }

/* ── PWA '홈 화면에 추가' 안내 바텀시트 ── */
#a2hs-sheet { position: fixed; inset: 0; z-index: 12000; background: rgba(15,20,25,.5); display: flex; align-items: flex-end; justify-content: center; }
.a2hs-card { background: #fff; width: 100%; max-width: 480px; border-radius: 18px 18px 0 0; padding: 20px 20px 26px; box-shadow: 0 -8px 28px rgba(0,0,0,.22); animation: a2hs-up .28s ease; }
@keyframes a2hs-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.a2hs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.a2hs-title { font-size: 17px; font-weight: 800; color: var(--fg); }
.a2hs-x { background: none; border: 0; font-size: 20px; color: var(--fg-light); cursor: pointer; line-height: 1; }
.a2hs-desc { font-size: 13px; color: var(--fg-muted); line-height: 1.6; margin: 0 0 14px; }
.a2hs-steps { margin: 0 0 16px; padding-left: 20px; font-size: 14px; color: var(--fg); line-height: 1.95; }
.a2hs-share { color: #1f6feb; font-weight: 700; }
.a2hs-btn { width: 100%; padding: 13px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.a2hs-later { width: 100%; padding: 10px; margin-top: 8px; border: 0; background: none; color: var(--fg-light); font-size: 13px; cursor: pointer; }

/* 수집 검색결과 — 같은 내용 이미 수집됨 안내 */
.search-existing { margin-top: 6px; font-size: 12px; color: #92600e; background: #fff7e6; border: 1px solid #f3dca6; border-radius: 6px; padding: 5px 8px; }
.search-existing a { color: #1f6feb; }

/* ── 블록 에디터 (글·사진) ── */
.block-editor { display: flex; flex-direction: column; gap: 12px; }
.block { position: relative; border: 1px solid #e3e3e0; border-radius: 8px; padding: 26px 12px 12px; background: #fff; }
.block--photo { background: #fbfbf9; }
.block__tag { position: absolute; left: 0; top: 0; font-size: 10px; font-weight: 700; color: #fff; background: #b8b8b8; padding: 2px 9px; border-radius: 8px 0 8px 0; }
.block--photo .block__tag { background: #6b8caf; }
.block__ctrls { position: absolute; right: 6px; top: 4px; display: flex; gap: 2px; }
.block__ctrls .btn-text { padding: 2px 6px; font-size: 14px; line-height: 1; }
.block__ctrls .btn-text:disabled { opacity: .3; cursor: default; }
.block__text { width: 100%; min-height: 88px; border: 0; resize: vertical; font-family: inherit; font-size: 14px; line-height: 1.6; background: transparent; }
.block__text:focus { outline: none; }
.block__photo { display: flex; gap: 12px; align-items: flex-start; }
.block__photo img { width: 140px; height: 140px; object-fit: cover; border-radius: 6px; flex: none; background: #eee; }
.block__caption { flex: 1; min-height: 140px; border: 1px solid #e3e3e0; border-radius: 6px; padding: 8px 10px; resize: vertical; font-family: inherit; font-size: 13px; line-height: 1.6; }
.block-empty { color: #999; font-size: 13px; padding: 22px; text-align: center; border: 1px dashed #ddd; border-radius: 8px; }
.block-toolbar { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.block-photo-count { margin-left: auto; font-size: 12px; color: #888; }
.block-photo-count b { color: #555; }
@media (max-width: 600px) {
  .block__photo { flex-direction: column; }
  .block__photo img { width: 100%; height: 180px; }
  .block__caption { width: 100%; min-height: 80px; }
}

.suggestion-card { border: 1px solid var(--border); border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.suggestion-card .anchor { background: var(--bg-soft); padding: 10px; border-radius: 4px; font-size: 13px; color: var(--fg-muted); margin-bottom: 10px; }
.suggestion-card .suggested { background: #fff7e8; padding: 10px; border-radius: 4px; font-size: 14px; line-height: 1.6; margin-bottom: 12px; }
.suggestion-card .meta { font-size: 12px; color: var(--fg-light); margin-bottom: 10px; }
.suggestion-card .actions { display: flex; gap: 8px; }

@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; gap: 20px; padding: 20px 16px 40px; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
}

/* ─── Toast ────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  background: #1f1f1f;
  color: #fff;
  padding: 12px 20px;
  border-radius: 99px;
  font-size: 14px;
  z-index: 3000;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ─── 다종 Reaction (페북식) ───────────────────────────────────────── */
.reader-react { position: relative; display: inline-flex; align-items: center; }
.react-summary {
  background: rgba(255,255,255,.1);
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 8px 14px;
  font-size: 14px;
}
.react-summary:hover { background: rgba(255,255,255,.2); }
.reaction-popup {
  position: absolute;
  top: 100%;
  margin-top: 6px;
  left: 0;
  background: #fff;
  border-radius: 99px;
  padding: 6px 8px;
  display: flex;
  gap: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 1300;
}
/* 버튼과 팝업 사이 빈 공간을 덮는 투명 브릿지 — 마우스 이동 중 hover 유지 */
.reaction-popup::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}
.reaction-emoji {
  background: transparent;
  border: none;
  font-size: 24px;
  padding: 6px 8px;
  border-radius: 12px;
  transition: transform .12s;
  position: relative;
  line-height: 1;
}
.reaction-emoji:hover { transform: scale(1.35) translateY(-4px); background: #f3f4f6; }
.reaction-emoji.active { background: var(--accent-soft); }
.reaction-emoji .rc {
  display: block;
  font-size: 10px;
  color: var(--fg-muted);
  text-align: center;
  margin-top: 2px;
}

/* 카드/글 reaction 합계 */
.reaction-bar-inline { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; }

/* ─── 하이라이트 댓글 스레드 ──────────────────────────────────────── */
.thread-comment {
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}
.thread-comment:first-child { border-top: none; margin-top: 0; }
.thread-comment .comment__head { font-size: 12px; color: var(--fg-muted); margin-bottom: 4px; }
.thread-comment .comment__body { font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.thread-comment .reply-btn {
  background: transparent; border: none; color: var(--accent);
  font-size: 12px; padding: 2px 0; margin-top: 4px; cursor: pointer;
}

/* 하이라이트에 댓글 있으면 말풍선 표시 */
.flip-page mark[data-hl-id] { position: relative; }
.flip-page mark[data-hl-id]:hover { filter: brightness(.92); }

/* 알람 딥링크 점멸 */
@keyframes hl-flash {
  0%, 100% { background: rgba(255,234,0,.55); }
  50% { background: rgba(255,140,0,.9); box-shadow: 0 0 0 4px rgba(255,140,0,.3); }
}
.flip-page mark.hl-flash { animation: hl-flash 0.5s ease-in-out 3; }

/* ─── 어드민 알람 종 ──────────────────────────────────────────────── */
.notif-bell {
  position: relative;
  background: transparent;
  border: none;
  font-size: 20px;
  padding: 6px 10px;
  cursor: pointer;
}
.notif-badge {
  position: absolute;
  top: 0; right: 2px;
  background: #e0245e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 99px;
  padding: 0 4px;
}
.notif-dropdown {
  position: absolute;
  top: 52px; right: 20px;
  width: 360px;
  max-height: 480px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1500;
}
.notif-dropdown header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
}
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.notif-item:hover { background: var(--bg-soft); }
.notif-item.unread { background: #f0f7ff; }
.notif-item .notif-type { font-weight: 600; color: var(--accent); font-size: 12px; }
.notif-item .notif-preview { color: var(--fg-muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-item .notif-time { color: var(--fg-light); font-size: 11px; margin-top: 2px; }

/* 어드민 댓글 관리 */
.cm-row { border-bottom: 1px solid var(--border); padding: 12px 0; }
.cm-row.hidden { opacity: .55; }
.cm-row.deleted { opacity: .4; text-decoration: line-through; }
.cm-row .cm-meta { font-size: 12px; color: var(--fg-muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cm-row .cm-body { font-size: 14px; line-height: 1.5; }
.cm-row .cm-actions { display: flex; gap: 6px; margin-top: 6px; }
.cm-row .cm-actions button { font-size: 12px; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--border); background: #fff; }
.cm-row .cm-actions button:hover { background: var(--bg-soft); }

/* ─── Scrollbar (subtle) ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.3); }
