/* ═══════════════════════════════════════════════════════════════
 * skins/board/excerpt/style.css — 발췌짤 게시판
 *
 *  - 작성 폼 (좌: 실시간 미리보기 / 우: 컨트롤)
 *  - 목록 카드 그리드 (1/2/3열 토글)
 *  - 상세 (큰 카드 + 저장 버튼)
 *  - iOS 저장 모달
 * 클래스 접두사: ex-
 * ═══════════════════════════════════════════════════════════════ */

.ex-wrap { width: 100%; box-sizing: border-box; }

.ex-flash {
  padding: 10px 14px; margin: 12px 0 0; border-radius: 8px;
  font-size: 13px; font-weight: 600;
}
.ex-flash.error {
  background: color-mix(in srgb, #c33 10%, transparent);
  border: 1px solid color-mix(in srgb, #c33 35%, transparent);
  color: #c33;
}
.ex-flash.success {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}
.list-actions .btn-new.active { background: color-mix(in srgb, var(--accent) 85%, #000); }

/* ─── 열 개수 토글 ─── */
.ex-cols {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--hair-soft); border-radius: 999px;
}
.ex-cols button {
  width: 30px; height: 30px; border: none; border-radius: 999px;
  background: none; color: var(--ink-mute); cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.ex-cols button:hover { color: var(--ink); }
.ex-cols button.active { background: var(--paper); color: var(--accent); box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 12%, transparent); }

/* ─── 목록 그리드 ─── */
.ex-grid { display: grid; gap: 14px; align-items: start; }
.ex-grid.cols-1 { grid-template-columns: 1fr; max-width: 520px; margin-left: auto; margin-right: auto; }
.ex-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ex-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 480px) { .ex-grid { gap: 8px; } }

.ex-card {
  position: relative; border-radius: 10px; overflow: hidden;
  background: var(--hair-soft);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--ink) 10%, transparent);
  transition: transform .15s, box-shadow .15s;
}
.ex-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px color-mix(in srgb, var(--ink) 16%, transparent); }
.ex-card-link { display: block; line-height: 0; }
.ex-canvas { display: block; width: 100%; height: auto; background: var(--hair-soft); }

/* 카드 우상단 도구 (PC: 호버 시 / 터치: 항상 살짝) */
.ex-card-tools {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 6px; opacity: 0; transition: opacity .15s;
}
.ex-card:hover .ex-card-tools, .ex-card:focus-within .ex-card-tools { opacity: 1; }
@media (hover: none) { .ex-card-tools { opacity: .8; } }
.ex-card-del { margin: 0; display: inline-flex; }
.ex-tool {
  width: 32px; height: 32px; padding: 0; border: none; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .5); color: #fff; font-size: 12px; text-decoration: none;
  cursor: pointer; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: background .15s, transform .1s;
}
.ex-tool:hover { background: rgba(0, 0, 0, .75); }
.ex-tool:active { transform: scale(.92); }
.ex-tool.busy, .ex-big-btn.busy { opacity: .5; pointer-events: none; }
@media (max-width: 480px) { .ex-tool { width: 28px; height: 28px; font-size: 11px; } }

/* ─── 상세 ─── */
.ex-view { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ex-stage { width: 100%; max-width: 560px; }
.ex-canvas-big {
  border-radius: 12px;
  box-shadow: 0 6px 28px color-mix(in srgb, var(--ink) 18%, transparent);
}
.ex-view-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ex-big-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border: none; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: all .15s;
}
.ex-big-btn:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.ex-big-btn:active { transform: scale(.97); }
.ex-big-btn.ghost { background: var(--hair-soft); color: var(--ink-soft); }
.ex-big-btn.ghost:hover { background: var(--hair); color: var(--ink); }

.ex-view-info { width: 100%; max-width: 560px; }
.ex-view-src { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.ex-view-src strong { font-size: 15px; color: var(--ink); }
.ex-view-src span { font-size: 13px; color: var(--ink-soft); }
.ex-view-meta { font-size: 12px; color: var(--ink-mute); margin-top: 8px; }
.ex-view-text {
  margin-top: 14px; padding: 14px 16px; border-radius: 10px;
  background: var(--paper-2, var(--hair-soft)); color: var(--ink);
  font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: keep-all;
}

/* ─── 작성 폼 ─── */
.ex-form {
  background: var(--paper); border: 1px solid var(--hair);
  border-radius: 12px; padding: 16px 18px; margin: 0 0 18px;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 5%, transparent);
}
.ex-form[hidden] { display: none; }
.ex-edit-banner { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 12px; }

.ex-form-grid { display: grid; grid-template-columns: minmax(0, 270px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 640px) { .ex-form-grid { grid-template-columns: 1fr; } }

.ex-prev-sticky { position: sticky; top: 14px; }
@media (max-width: 640px) { .ex-prev-sticky { position: static; max-width: 320px; margin: 0 auto; } }
.ex-prev {
  display: block; width: 100%; height: auto; border-radius: 10px;
  background: var(--hair-soft);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--ink) 14%, transparent);
}
.ex-prev-note { margin-top: 8px; text-align: center; font-size: 11px; color: var(--ink-mute); }

.ex-ctrl-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ex-sec { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--hair-soft); }
.ex-sec:last-child { border-bottom: none; padding-bottom: 0; }
.ex-lab { font-size: 11px; font-weight: 800; letter-spacing: .04em; color: var(--ink-mute); }

.ex-form textarea,
.ex-form input[type=text],
.ex-form select {
  width: 100%; box-sizing: border-box; padding: 9px 12px;
  border: 1px solid var(--hair); border-radius: 8px;
  background: var(--bg); color: var(--ink);
  font-size: 13px; font-family: inherit;
}
.ex-form textarea { resize: vertical; line-height: 1.6; }
.ex-form textarea:focus, .ex-form input[type=text]:focus, .ex-form select:focus {
  outline: none; border-color: var(--accent);
}

.ex-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.ex-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; background: var(--hair-soft);
  border: 1px solid transparent; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  cursor: pointer; transition: all .15s; user-select: none;
}
.ex-pill:hover { background: var(--hair); }
.ex-pill input { display: none; }
.ex-pill.active { background: var(--accent); color: #fff; }
.ex-pill i { font-size: 10px; }

.ex-panel { display: flex; flex-direction: column; gap: 10px; }
.ex-panel[hidden] { display: none; }

.ex-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.ex-row-wrap { align-items: flex-start; gap: 14px; }
.ex-group { display: flex; flex-direction: column; gap: 5px; }
.ex-mini-lab { font-size: 11px; font-weight: 700; color: var(--ink-mute); }
.ex-grow { flex: 1 1 140px; min-width: 0; }

.ex-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.ex-sw {
  width: 34px; height: 34px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid var(--paper); outline: 1px solid var(--hair);
  transition: transform .12s;
}
.ex-sw:hover { transform: scale(1.12); }

.ex-color, .ex-select, .ex-check {
  display: inline-flex; flex-direction: column; gap: 4px;
  font-size: 11px; font-weight: 700; color: var(--ink-mute);
}
.ex-color input[type=color] {
  width: 46px; height: 32px; padding: 2px; cursor: pointer;
  border: 1px solid var(--hair); border-radius: 8px; background: var(--bg);
}
.ex-select select { min-width: 96px; }
.ex-check { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); cursor: pointer; }

.ex-range { display: flex; flex-direction: column; gap: 4px; }
.ex-range-lab { font-size: 11px; font-weight: 700; color: var(--ink-mute); }
.ex-range-lab output { color: var(--accent); margin-left: 4px; }
.ex-range input[type=range] { width: 100%; accent-color: var(--accent); }

.ex-upload, .ex-mini {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; background: var(--hair-soft); color: var(--ink-soft);
  border: 1px solid var(--hair); border-radius: 8px;
  font-size: 12px; font-weight: 700; font-family: inherit; cursor: pointer; transition: all .15s;
}
.ex-upload:hover, .ex-mini:hover { background: var(--hair); color: var(--ink); }
.ex-upload.has-file { background: var(--accent); color: #fff; border-color: var(--accent); }
.ex-hint { font-size: 11px; color: var(--ink-mute); line-height: 1.5; }

.ex-new-bar {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hair-soft);
}
.ex-new-cancel {
  display: inline-flex; align-items: center; padding: 7px 16px;
  background: none; border: 1px solid var(--hair); border-radius: 999px;
  font-size: 12px; font-weight: 700; color: var(--ink-mute);
  cursor: pointer; font-family: inherit; text-decoration: none; transition: all .15s;
}
.ex-new-cancel:hover { background: var(--hair-soft); color: var(--ink); }
.ex-new-submit {
  margin-left: auto; padding: 8px 24px; background: var(--accent); color: #fff;
  border: none; border-radius: 999px; font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.ex-new-submit:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.ex-new-submit:active { transform: scale(.97); }

/* ─── iOS 저장 모달 (길게 눌러 저장) ─── */
.ex-modal {
  position: fixed; inset: 0; z-index: 9999; padding: 20px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .78);
}
.ex-modal-box { max-width: 460px; width: 100%; text-align: center; color: #fff; }
.ex-modal-box img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 10px; }
.ex-modal-box p { margin: 14px 0 12px; font-size: 13px; line-height: 1.6; }
.ex-modal-close {
  padding: 8px 22px; border: none; border-radius: 999px;
  background: #fff; color: #222; font-size: 13px; font-weight: 700; cursor: pointer;
}

/* ═══ 관리자 전용: 순서 변경 / 방문자 이미지 보호 ═══ */
.ex-sort-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 순서 변경 모드 — 카드 위에 ◀ ▶ 표시, 링크/도구는 잠시 비활성 */
.ex-card-move { display: none; }
.ex-sorting .ex-card-move {
  position: absolute; left: 0; right: 0; bottom: 8px;
  display: flex; justify-content: center; gap: 10px; z-index: 2;
}
.ex-sorting .ex-card-link { pointer-events: none; }
.ex-sorting .ex-card-tools { display: none; }
.ex-sorting .ex-card { outline: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -2px; }
.ex-sorting .ex-card:hover { transform: none; }
.ex-card.ex-moved { box-shadow: 0 0 0 3px var(--accent); }

/* 방문자: 길게 눌러 이미지 저장 / 드래그 억제 */
.ex-wrap:not([data-admin]) .ex-canvas {
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
}

/* 글자 크기 숫자 입력 */
.ex-num { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--ink-mute); }
.ex-num input[type=number] {
  width: 84px; padding: 7px 10px; font-size: 14px; font-family: inherit; font-weight: 700;
  color: var(--ink); background: var(--paper); border: 1px solid var(--hair); border-radius: 8px;
  box-sizing: border-box; text-align: center;
}
.ex-num input[type=number]:focus { outline: none; border-color: var(--accent); }
.ex-num-unit { font-weight: 400; color: var(--ink-soft); }
.ex-num-unit small { color: var(--ink-mute); }
.ex-num[hidden] { display: none; }

/* 방문자: 문구 텍스트 선택/길게 눌러 복사 억제 (문구 복사는 관리자 전용) */
.ex-wrap:not([data-admin]) .ex-view-text {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
