/* ---------------------------------------------------------
   요거트 리뷰 블로그 - 공통 스타일
   --------------------------------------------------------- */

:root {
  --bg: #FCFAF6;
  --surface: #FFFFFF;
  --surface-2: #F6F2EA;
  --text: #1E1B18;
  --muted: #7D766C;
  --line: #EAE3D7;
  --accent: #C0455F;
  --accent-soft: #FBEDF0;
  --star: #E0A526;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(30, 27, 24, .04), 0 8px 24px rgba(30, 27, 24, .05);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --maxw: 860px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16140F;
    --surface: #201D17;
    --surface-2: #2A261F;
    --text: #F3EFE7;
    --muted: #A29B8E;
    --line: #34302A;
    --accent: #E8899B;
    --accent-soft: #332226;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { 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: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* --- 헤더 --------------------------------------------------- */

.site-head {
  padding: 56px 0 32px;
  text-align: center;
}

.site-head .badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 16px;
}

.site-title {
  margin: 0 0 10px;
  font-size: clamp(28px, 6vw, 40px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
}

.site-title a { text-decoration: none; }

.site-desc {
  margin: 0 auto;
  max-width: 520px;
  color: var(--muted);
  font-size: 15px;
}

/* --- 미션 현황 ---------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 32px 0 40px;
}

.stat {
  background: var(--surface);
  padding: 18px 12px;
  text-align: center;
}

.stat b {
  display: block;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

/* --- 글 목록 ------------------------------------------------ */

.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--muted);
}

.post-list {
  list-style: none;
  margin: 0 0 64px;
  padding: 0;
  display: grid;
  gap: 14px;
}

.post-card {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.post-thumb {
  width: 108px;
  height: 108px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-2);
}

.post-thumb.is-empty {
  display: grid;
  place-items: center;
  font-size: 30px;
  background: linear-gradient(140deg, var(--surface-2), var(--accent-soft));
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.chip {
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}

.chip.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.post-card h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.4;
}

.post-excerpt {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stars { color: var(--star); letter-spacing: .1em; }

/* --- 상단 바 / 버튼 ------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-brand {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -.01em;
  text-decoration: none;
}

.topbar-back {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.topbar-back:hover { color: var(--accent); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-status {
  font-size: 13px;
  color: var(--muted);
  max-width: 44vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-status.is-error { color: var(--accent); font-weight: 600; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  text-decoration: none;
  cursor: pointer;
  transition: filter .15s ease;
}

.btn:hover { filter: brightness(1.06); }

.btn.ghost { background: transparent; color: var(--accent); }

.btn.ghost:hover { background: var(--accent-soft); }

.btn.small { font-size: 13px; padding: 8px 14px; }

.btn.danger { border-color: var(--line); color: var(--muted); }

.btn.danger:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 모바일용 떠 있는 글쓰기 버튼 */
.fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 25;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  text-decoration: none;
  place-items: center;
  box-shadow: 0 6px 20px rgba(192, 69, 95, .35);
}

/* --- 로그인 창 ----------------------------------------------- */

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 16, 14, .45);
  backdrop-filter: blur(2px);
}

.modal {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px 20px;
}

.modal h2 { margin: 0 0 6px; font-size: 19px; font-weight: 800; }

.modal-desc { margin: 0 0 18px; font-size: 13.5px; color: var(--muted); }

.modal input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}

.modal input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.modal-error { margin: 10px 0 0; font-size: 13px; color: var(--accent); font-weight: 600; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* --- 글 본문 ------------------------------------------------ */

.article-head { padding: 40px 0 8px; }

.owner-actions {
  display: flex;
  gap: 8px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.back-link {
  display: inline-block;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 24px;
}

.back-link:hover { color: var(--accent); }

.article-title {
  margin: 8px 0 12px;
  font-size: clamp(24px, 5.5vw, 34px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.3;
}

.article-body {
  font-size: 17px;
  line-height: 1.85;
}

.article-body p { margin: 0 0 1.2em; }

.article-body strong { font-weight: 700; }

.article-body ul,
.article-body ol { padding-left: 1.2em; margin: 0 0 1.2em; }

.article-body h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 1.6em 0 .5em;
}

.article-body h3 { font-size: 19px; font-weight: 700; margin: 1.4em 0 .4em; }

.article-body blockquote {
  margin: 0 0 1.2em;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.article-body hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

.article-body img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin: 10px 0 24px;
}

.article-body a { color: var(--accent); }

.gallery {
  display: grid;
  gap: 12px;
  margin: 28px 0;
}

.gallery img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.gallery.multi { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.gallery.multi img { aspect-ratio: 4 / 3; object-fit: cover; }

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin: 48px 0 0;
  padding: 24px 0 64px;
  font-size: 14px;
}

.article-nav a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* --- 기타 -------------------------------------------------- */

.empty {
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 48px 24px;
  margin-bottom: 64px;
}

.site-foot {
  border-top: 1px solid var(--line);
  padding: 24px 0 48px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 520px) {
  .site-head { padding: 36px 0 20px; }
  .post-card { grid-template-columns: 84px 1fr; gap: 12px; }
  .post-thumb { width: 84px; height: 84px; }

  /* 좁은 화면에서는 상단 글쓰기 버튼 대신 떠 있는 버튼을 씁니다 */
  .btn-write { display: none; }
  .fab { display: grid; }
}
