/* style.css ─ 이미지 합치기 도구 공통 스타일 (모바일 우선, 깔끔·현대적) */

:root {
  --c-primary: #4f46e5;       /* 인디고 */
  --c-primary-dark: #4338ca;
  --c-accent: #06b6d4;
  --c-bg: #f6f7fb;
  --c-card: #ffffff;
  --c-text: #1e2330;
  --c-text-sub: #687087;
  --c-border: #e4e7ef;
  --c-border-strong: #cdd3e0;
  --c-warn-bg: #fff7ed;
  --c-warn-border: #fdba74;
  --c-warn-text: #9a3412;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(20, 30, 60, 0.06), 0 6px 20px rgba(20, 30, 60, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic",
    "Apple SD Gothic Neo", Roboto, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
body.busy { cursor: progress; }

a { color: var(--c-primary); }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px; }

/* ─ 상단 내비 ─ */
.page-nav {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
  font-size: 0.85rem; padding: 6px 2px 2px;
}
.page-nav a { color: var(--c-text-sub); text-decoration: none; }
.page-nav a:hover { color: var(--c-primary); }
.page-nav .brand {
  font-weight: 800; color: var(--c-text); font-size: 0.98rem;
  margin-right: auto; letter-spacing: -0.4px;
}
.page-nav .brand b { color: var(--c-primary); }

/* ─ 헤더 ─ */
.site-header { text-align: center; padding: 14px 0 4px; }
.site-header h1 { font-size: 1.5rem; margin: 0 0 6px; letter-spacing: -0.6px; }
.site-header p { margin: 0; font-size: 0.9rem; color: var(--c-text-sub); }

/* ─ 광고 자리 (애드센스 코드는 직접 삽입) ─ */
.ad-slot {
  min-height: 90px; margin: 16px 0;
  border: 1px dashed #d3d9e6; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #aab2c4; font-size: 0.75rem;
}

/* ─ 카드 공통 ─ */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 0;
}
.card > h2 {
  font-size: 1rem; margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.count-badge {
  margin-left: auto; font-size: 0.78rem; font-weight: 600;
  color: var(--c-primary); background: #eef0fe;
  padding: 2px 9px; border-radius: 999px;
}

/* ─ 업로드 영역 ─ */
.drop-zone {
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--radius);
  padding: 34px 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
  background: #fbfcfe;
}
.drop-zone:hover { border-color: var(--c-primary); background: #f5f6ff; }
.drop-zone:active { transform: scale(0.995); }
.drop-zone.dragover { border-color: var(--c-primary); background: #eef0ff; }
.drop-zone .dz-icon { font-size: 2.2rem; line-height: 1; }
.drop-zone .dz-main { font-weight: 700; margin: 8px 0 2px; }
.drop-zone .dz-sub { font-size: 0.8rem; color: var(--c-text-sub); }

/* ─ 개인정보 안심 문구 ─ */
.privacy-note {
  margin-top: 12px; padding: 9px 11px;
  background: #ecfdf5; border: 1px solid #b7ebd2; border-radius: var(--radius-sm);
  font-size: 0.8rem; color: #15724b;
  display: flex; gap: 7px; align-items: flex-start;
}

/* ─ 경고 박스 ─ */
.warn-box {
  margin: 10px 0; padding: 10px 12px;
  background: var(--c-warn-bg); border: 1px solid var(--c-warn-border);
  border-radius: var(--radius-sm); color: var(--c-warn-text); font-size: 0.82rem;
}

/* ─ 썸네일 목록 (드래그 재정렬) ─ */
.thumb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px; margin-top: 4px;
}
.thumb {
  position: relative;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: #fff; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgba(20,30,60,.05);
  user-select: none;
}
.thumb.dragging { opacity: .55; outline: 2px solid var(--c-primary); }
.thumb img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  background: #f0f2f7; display: block;
}
.thumb-order {
  position: absolute; top: 5px; left: 5px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--c-primary); color: #fff;
  font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.thumb-remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(20,24,38,.62); color: #fff;
  font-size: 1rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.thumb-remove:hover { background: #dc2626; }
.thumb-name {
  font-size: 0.68rem; color: var(--c-text-sub);
  padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumb-handle {
  position: absolute; bottom: 4px; right: 5px;
  font-size: 0.95rem; color: #9aa2b4; cursor: grab;
  touch-action: none; padding: 2px 4px;
}
.thumb-handle:active { cursor: grabbing; }

/* ─ 옵션 폼 ─ */
.field { margin: 0 0 16px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 7px;
}
.field-label .sub { font-weight: 400; color: var(--c-text-sub); }

/* 세그먼트 토글 */
.seg {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.seg button {
  flex: 1 1 auto; min-width: 60px;
  padding: 9px 10px; font-size: 0.85rem;
  border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--c-text); cursor: pointer;
  transition: all .12s;
}
.seg button:hover { border-color: var(--c-primary); }
.seg button.active {
  background: var(--c-primary); border-color: var(--c-primary);
  color: #fff; font-weight: 600;
}

/* 슬라이더 행 */
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--c-primary); }
.range-val {
  min-width: 48px; text-align: right;
  font-size: 0.82rem; font-weight: 600; color: var(--c-primary);
}

/* 색상 + 투명 */
.color-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.color-row input[type="color"] {
  width: 46px; height: 36px; padding: 0; border: 1px solid var(--c-border-strong);
  border-radius: 8px; background: #fff; cursor: pointer;
}
.color-row label { font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }

.num-input {
  width: 110px; padding: 8px 10px; font-size: 0.9rem;
  border: 1px solid var(--c-border-strong); border-radius: 8px;
}

/* ─ 미리보기 ─ */
.preview-wrap {
  border-radius: var(--radius-sm);
  background: #eef1f6; padding: 12px;
  display: flex; align-items: center; justify-content: center;
  min-height: 160px;
}
.preview-wrap.checker {
  background-image:
    linear-gradient(45deg, #d6dae3 25%, transparent 25%),
    linear-gradient(-45deg, #d6dae3 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d6dae3 75%),
    linear-gradient(-45deg, transparent 75%, #d6dae3 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
#previewCanvas {
  max-width: 100%; height: auto; display: block;
  border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.empty-state { color: var(--c-text-sub); font-size: 0.85rem; text-align: center; }
.preview-info {
  text-align: center; font-size: 0.78rem; color: var(--c-text-sub);
  margin-top: 10px; min-height: 1.2em;
}

/* ─ 버튼 ─ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; font-size: 1rem; font-weight: 700;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .12s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost {
  background: #fff; color: var(--c-text-sub);
  border: 1px solid var(--c-border-strong); font-weight: 600; font-size: 0.88rem;
  padding: 10px;
}
.btn-ghost:hover { color: #dc2626; border-color: #f0b4b4; }
.btn-row { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

/* ─ 본문 콘텐츠 (설명/FAQ/정책) ─ */
.content h1 { font-size: 1.4rem; margin: 0 0 10px; letter-spacing: -0.5px; }
.content h2 { font-size: 1.05rem; margin: 24px 0 8px; }
.content h3 { font-size: 0.95rem; margin: 16px 0 6px; }
.content p, .content li { font-size: 0.9rem; color: #313846; }
.content .lead { font-size: 0.95rem; color: var(--c-text-sub); }
.content ul, .content ol { padding-left: 20px; }
.content code {
  background: #eef0f6; padding: 1px 5px; border-radius: 5px; font-size: 0.85em;
}
.feature-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px; margin: 6px 0;
}
.feature-item {
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  padding: 12px 14px; background: #fbfcfe;
}
.feature-item .fi-icon { font-size: 1.3rem; }
.feature-item h3 { margin: 4px 0 4px; font-size: 0.92rem; }
.feature-item p { margin: 0; font-size: 0.83rem; color: var(--c-text-sub); }

.faq-item { border-top: 1px solid var(--c-border); padding: 12px 0; }
.faq-item:first-of-type { border-top: none; }
.faq-item summary {
  font-weight: 600; font-size: 0.9rem; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; gap: 10px;
}
.faq-item summary::after { content: '+'; color: var(--c-primary); font-weight: 700; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin: 8px 0 0; }

/* ─ 푸터 ─ */
.site-footer {
  text-align: center; color: var(--c-text-sub); font-size: 0.78rem;
  padding: 18px 0 28px; margin-top: 8px;
}
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--c-text-sub); margin: 0 7px; }

/* ─ 내비 활성 표시 ─ */
.page-nav a.active { color: var(--c-primary); font-weight: 700; }
.site-footer .copyright { color: #aab2c4; }

/* ─ 허브: 도구 카드 그리드 ─ */
.tool-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px; margin: 14px 0;
}
.tool-card {
  display: block; text-decoration: none; color: var(--c-text);
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 16px; transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tool-card:hover {
  transform: translateY(-2px); border-color: var(--c-primary);
  box-shadow: 0 6px 22px rgba(79,70,229,0.14);
}
.tool-card .tc-icon { font-size: 2rem; line-height: 1; }
.tool-card h2 { font-size: 1.05rem; margin: 8px 0 4px; }
.tool-card p { margin: 0 0 10px; font-size: 0.85rem; color: var(--c-text-sub); }
.tool-card .tc-go { font-size: 0.82rem; font-weight: 700; color: var(--c-primary); }

/* ─ 업로드한 원본 파일 정보 ─ */
.src-info {
  margin-top: 10px; font-size: 0.8rem; color: var(--c-text-sub);
  text-align: center; word-break: break-all;
}

/* ─ 줄바꿈 허용 세그먼트(비율/배경 등 항목 많을 때) ─ */
.seg.seg-wrap button { flex: 1 1 30%; }

/* ─ 직접 비율 입력 ─ */
.ratio-inputs { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.num-input.small { width: 80px; }

/* ─ 보조 버튼 ─ */
.btn-secondary {
  background: #eef0fe; color: var(--c-primary-dark);
  border: 1px solid #d7daf7; font-weight: 700;
}
.btn-secondary:hover { background: #e3e6fd; }
.btn-secondary:disabled { opacity: .6; cursor: progress; }

/* ─ 데스크톱: 살짝 넓게 + 기능/도구 2열 ─ */
@media (min-width: 720px) {
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .tool-grid { grid-template-columns: 1fr 1fr 1fr; }
}
