/* 도란도란 홈페이지 — 공통 스타일
   디자인 토큰은 앱 lib/core/theme/app_colors.dart 에서 이식 (docs/homepage_plan.md §8) */

:root {
  color-scheme: light;
  --primary: #3D4DA0;
  --primary-soft: #E5E7F4;
  --primary-dark: #2E3A80;
  --bg: #EFEBE2;
  --surface: #FFFFFF;
  --ink: #2C2E3A;
  --sub: #8A8A96;
  --divider: #E3DFD4;
  --danger: #E2574C;
  --danger-soft: #FBE6E4;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 20px;
  --shadow: 0 2px 12px rgba(44, 46, 58, 0.06);
  --max-width: 960px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Malgun Gothic", sans-serif;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

/* ---------- header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(239, 235, 226, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--divider);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
}

.brand img { width: 28px; height: 28px; border-radius: 8px; }
.brand:hover { text-decoration: none; }

.site-nav {
  display: flex;
  gap: 22px;
  font-size: 14.5px;
  font-weight: 600;
}

.site-nav a { color: var(--sub); }
.site-nav a.active,
.site-nav a:hover { color: var(--primary); text-decoration: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14.5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:hover { text-decoration: none; opacity: 0.88; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--divider); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- footer ---------- */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--divider);
  padding: 32px 0 48px;
  color: var(--sub);
  font-size: 13px;
}

.site-footer .wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-links a { color: var(--sub); }
.footer-links a:hover { color: var(--primary); }

/* ================= 랜딩 페이지 ================= */
.hero {
  padding: 72px 0 56px;
  text-align: center;
}

.hero .app-icon {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  margin: 0 auto 24px;
  box-shadow: var(--shadow);
}

.hero h1 {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -0.5px;
}

.hero p.lead {
  font-size: 16.5px;
  color: var(--sub);
  max-width: 480px;
  margin: 0 auto 32px;
}

.store-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.store-buttons .btn { padding: 12px 22px; font-size: 15px; }

.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 24px 0 56px;
}

.feature-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  box-shadow: var(--shadow);
}

.feature-card .emoji { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { margin: 0 0 8px; font-size: 16.5px; }
.feature-card p { margin: 0; color: var(--sub); font-size: 14px; }

.screenshots {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 8px 20px 32px;
  scroll-snap-type: x mandatory;
}

.screenshots .shot {
  flex: 0 0 auto;
  width: 200px;
  aspect-ratio: 9 / 19.5;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--primary-soft), var(--surface));
  border: 1px solid var(--divider);
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sub);
  font-size: 13px;
  text-align: center;
  padding: 12px;
}

.section-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px;
}

.section-sub {
  text-align: center;
  color: var(--sub);
  font-size: 14px;
  margin: 0 0 24px;
}

.cta-band {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  margin: 8px 20px 64px;
  padding: 40px 24px;
  text-align: center;
}

.cta-band h2 { margin: 0 0 8px; font-size: 22px; }
.cta-band p { margin: 0 0 22px; opacity: 0.9; font-size: 14.5px; }
.cta-band .btn-primary { background: #fff; color: var(--primary); }

/* ================= 커뮤니티: 목록 ================= */
.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 40px 0 18px;
}

.board-head h1 { font-size: 22px; margin: 0; }
.board-tabs { display: flex; gap: 8px; font-size: 13.5px; }
.board-tabs a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--sub);
  border: 1px solid var(--divider);
}
.board-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

table.board-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.board-table thead th {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
  padding: 12px 10px;
  text-align: center;
  font-size: 13px;
  border-bottom: 1px solid var(--divider);
}

.board-table tbody td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--divider);
  text-align: center;
  color: var(--ink);
}

.board-table tbody tr:last-child td { border-bottom: none; }
.board-table tbody tr:hover { background: #FAF9F5; }

.board-table td.col-title { text-align: left; max-width: 0; }
.board-table td.col-title a {
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
}
.board-table td.col-title a span.t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-table td.col-title a:hover { color: var(--primary); text-decoration: none; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  flex: 0 0 auto;
}
.badge-notice { background: var(--primary); color: #fff; }
.badge-new { background: var(--danger); color: #fff; }
.badge-secret { background: var(--sub); color: #fff; }
.badge-admin { background: #2E9E6B; color: #fff; }
.badge-tag { background: var(--primary-soft); color: var(--primary-dark); }

.comment-count { color: var(--danger); font-weight: 700; font-size: 12.5px; }

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 40px;
  gap: 12px;
  flex-wrap: wrap;
}

.search-form { display: flex; gap: 6px; }
.search-form select,
.search-form input {
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  background: var(--surface);
}
.search-form input { width: 200px; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 48px;
  font-size: 13.5px;
}
.pagination a, .pagination span {
  min-width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--sub);
}
.pagination a:hover { background: var(--primary-soft); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; font-weight: 700; }

/* 모바일 카드형 목록 */
.board-cards { display: none; }
.board-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.board-card .title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.board-card .title span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card .meta { display: flex; gap: 10px; color: var(--sub); font-size: 12.5px; }

/* ================= 커뮤니티: 상세 ================= */
.post-head { padding: 36px 0 18px; border-bottom: 1px solid var(--divider); }
.post-head h1 { font-size: 21px; margin: 0 0 12px; line-height: 1.4; }
.post-meta { display: flex; gap: 14px; color: var(--sub); font-size: 13px; flex-wrap: wrap; }
.post-meta .nick { color: var(--ink); font-weight: 700; }

.post-body {
  padding: 28px 0;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
}
.post-body img { border-radius: var(--radius); margin: 10px 0; }

.post-actions { display: flex; justify-content: center; padding: 20px 0 36px; }
.like-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--divider);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 40px;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}
.like-btn:hover { border-color: var(--primary); color: var(--primary); }
.like-btn.liked { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.like-btn .count { font-size: 18px; }

.secret-lock {
  text-align: center;
  padding: 60px 20px;
  color: var(--sub);
}
.secret-lock form { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.secret-lock input { border: 1px solid var(--divider); border-radius: var(--radius-sm); padding: 10px 12px; }

.comments { padding: 20px 0 40px; border-top: 1px solid var(--divider); }
.comments h2 { font-size: 16px; margin: 0 0 16px; }

.comment {
  padding: 14px 0;
  border-bottom: 1px solid var(--divider);
}
.comment.reply { margin-left: 34px; padding-left: 14px; border-left: 2px solid var(--primary-soft); }
.comment .c-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.comment .c-nick { font-weight: 700; }
.comment .c-time { color: var(--sub); }
.comment .c-body { font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.comment .c-actions { margin-top: 6px; display: flex; gap: 10px; font-size: 12.5px; }
.comment .c-actions button { background: none; border: none; color: var(--sub); cursor: pointer; padding: 0; font-size: 12.5px; }
.comment .c-actions button:hover { color: var(--primary); }
.comment.deleted .c-body { color: var(--sub); font-style: italic; }

.comment-form { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.comment-form .row { display: flex; gap: 8px; }
.comment-form input, .comment-form textarea {
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
}
.comment-form input { flex: 1; }
.comment-form textarea { resize: vertical; min-height: 60px; }

.post-nav { display: flex; justify-content: space-between; padding: 20px 0 60px; }

/* ================= 글쓰기 폼 ================= */
.write-form {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  margin: 32px 0 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.write-form .field { display: flex; flex-direction: column; gap: 6px; }
.write-form label { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.write-form .hint { font-size: 12px; color: var(--sub); font-weight: 400; }
.write-form input[type="text"],
.write-form input[type="password"],
.write-form textarea,
.write-form select {
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14.5px;
  font-family: inherit;
  background: var(--bg);
}
.write-form textarea { min-height: 260px; resize: vertical; }
.write-form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.write-form .checkbox-row { display: flex; align-items: center; gap: 8px; }
.write-form .actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.write-form .error { color: var(--danger); font-size: 13px; display: none; }
.write-form .error.show { display: block; }

.empty-state, .loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--sub);
}

/* ================= 반응형 ================= */
@media (max-width: 768px) {
  .features { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  .board-table { display: none; }
  .board-cards { display: block; }
  .write-form .grid-2 { grid-template-columns: 1fr; }
  .site-nav { gap: 14px; font-size: 13.5px; }
  .board-head { flex-direction: column; align-items: flex-start; gap: 10px; }
}
