/* 프런트(공개 도구) 스타일 */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1c1f2b;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --danger: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  line-height: 1.7;
}

/* 헤더 / 푸터 */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  max-width: 880px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
}
.brand-mark { font-weight: 800; letter-spacing: .08em; color: var(--brand); }
.brand-name { font-size: .9rem; color: var(--muted); }

.site-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  padding: 0 1.25rem 3rem;
}

/* 히어로 */
.hero { text-align: center; margin-bottom: 2rem; }
.hero h1 { font-size: 1.9rem; line-height: 1.35; margin: 0 0 .6rem; }
.hero p { color: var(--muted); margin: 0; }

/* 카드 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card h2 { font-size: 1.05rem; margin: 0 0 1rem; }
.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-head h2 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* 폼 */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.field input, .field select {
  width: 100%;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: inherit;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.hint { font-size: .8rem; color: var(--muted); margin: .4rem 0 0; }
.hint.center { text-align: center; }

/* 버튼 */
.btn {
  display: inline-block;
  padding: .55rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-lg { width: 100%; padding: .85rem; font-size: 1rem; font-weight: 600; }

/* 알림 */
.alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 10px;
  padding: .9rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .9rem;
}
.alert strong { display: block; margin-bottom: .2rem; }

/* 단계 안내 */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.step-no {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
}
.step h3 { font-size: .95rem; margin: .6rem 0 .3rem; }
.step p { margin: 0; font-size: .85rem; color: var(--muted); }

/* 결과 */
.result-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.result-head h1 { font-size: 1.5rem; margin: 0 0 .3rem; }
.meta { margin: 0; font-size: .85rem; color: var(--muted); word-break: break-all; }
.meta a { color: var(--brand); }

.title-list { margin: 0; padding-left: 1.25rem; }
.title-list li {
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 0;
  border-bottom: 1px solid var(--line);
}
.title-list li:last-child { border-bottom: 0; }
.title-text { font-weight: 600; }

.article-body { font-size: 1rem; }
.article-body img { max-width: 100%; height: auto; border-radius: 8px; }
.article-body h2 { font-size: 1.2rem; margin: 1.6rem 0 .6rem; }
.article-body h3 { font-size: 1.05rem; margin: 1.3rem 0 .5rem; }
.article-body p { margin: 0 0 1rem; }
.article-body blockquote {
  margin: 1rem 0;
  padding: .6rem 1rem;
  border-left: 3px solid var(--brand);
  background: #f8f8fc;
  color: var(--muted);
}

.tag-list { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.tag {
  background: #eef2ff;
  color: var(--brand-dark);
  border-radius: 999px;
  padding: .25rem .7rem;
  font-size: .82rem;
}

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.gallery-item { margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.gallery-item img { width: 100%; border-radius: 10px; display: block; }
.gallery-item figcaption {
  font-size: .78rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gallery-item .btn { text-align: center; }
.gallery-pending {
  aspect-ratio: 4 / 5; display: flex; align-items: center; justify-content: center;
  padding: 1rem; text-align: center; font-size: .85rem; line-height: 1.5;
  color: #6b7280; background: #f3f4f6; border-radius: 10px;
}

/* 로딩 오버레이 */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 31, 43, .6);
  display: grid;
  place-items: center;
  padding: 1.25rem;
  z-index: 50;
}
.loading-overlay[hidden] { display: none; }
.loading-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  max-width: 380px;
}
.loading-title { font-weight: 700; margin: 1rem 0 .5rem; }
.loading-note { font-size: .85rem; color: var(--muted); margin: 0; }
.spinner {
  width: 36px; height: 36px;
  margin: 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 토스트 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: #1c1f2b;
  color: #fff;
  padding: .6rem 1.1rem;
  border-radius: 999px;
  font-size: .87rem;
  z-index: 60;
}
.toast[hidden] { display: none; }

@media (max-width: 640px) {
  .hero h1 { font-size: 1.5rem; }
  .field-row, .steps { grid-template-columns: 1fr; }
  .title-list li { flex-direction: column; align-items: flex-start; }
}
