/* ============================================================
   KAIEPA.OR.KR · Theme Tokens
   Minimal · White-first · Systematic
   파란색 강조 최소화, 흰색·검정·그레이 중심의 미니멀 디자인
   ============================================================ */

:root {
  /* ── Mono palette (메인 컬러 시스템) ─────────────── */
  --ink:         #111111;   /* 본문 텍스트 */
  --ink-2:       #2a2a2a;   /* 부제목 */
  --ink-3:       #585858;   /* 캡션 */
  --ink-4:       #888888;   /* 보조 텍스트 */
  --ink-5:       #b4b4b4;   /* placeholder */

  --bg:          #FFFFFF;   /* 메인 배경 */
  --bg-soft:     #FAFAFA;   /* 보조 배경 */
  --bg-2:        #F5F5F5;   /* 섹션 배경 */
  --bg-3:        #ECECEC;   /* 더 진한 배경 */

  --line:        #E5E5E5;   /* 기본 경계선 */
  --line-soft:   #F0F0F0;   /* 옅은 경계선 */
  --line-strong: #D4D4D4;   /* 강조 경계선 */

  /* ── Accent (절제) ───────────────────────────────── */
  --accent:      #111111;   /* 기본 강조 = 검정 */
  --accent-2:    #2a2a2a;
  --link:        #1a1a1a;   /* 링크 = 검정 (밑줄로 구분) */

  /* Legacy aliases used by early page drafts.
     Keep them monochrome so older pages do not drift into a blue gradient theme. */
  --ink-mid:      var(--ink-2);
  --ink-soft:     var(--ink-3);
  --ink-faint:    var(--ink-4);
  --bg-section:   var(--bg-soft);
  --blue:         var(--ink);
  --navy:         var(--ink);
  --teal:         #3d6660;
  --gold:         #806133;
  --hot:          var(--err);
  --grad:         linear-gradient(135deg, #111111 0%, #3a3a3a 100%);
  --grad-soft:    linear-gradient(135deg, #fafafa 0%, #ececec 100%);

  /* ── Semantic (최소한) ───────────────────────────── */
  --ok:          #2d7a4f;
  --warn:        #a76b1a;
  --err:         #b3261e;
  --info:        #1f4e7a;

  /* Tier marks (회원 등급) — 옅은 그레이 위주, 정렬된 톤 */
  --mk-reg:      #111111;
  --mk-gen:      #4a4a4a;
  --mk-edu:      #6b6b6b;
  --mk-grp:      #8a8a8a;
  --mk-biz:      #5e5e5e;
  --mk-hon:      #806133;   /* 명예 = 골드 톤 */
  --mk-par:      #3d6660;   /* 협력 = 다크 그린 톤 */

  /* ── Typography ──────────────────────────────────── */
  --f-sans:  'Pretendard Variable','Pretendard','Apple SD Gothic Neo','Noto Sans KR',system-ui,sans-serif;
  --f-serif: 'Noto Serif KR','Nanum Myeongjo',serif;
  --f-en:    'Inter',var(--f-sans);
  --f-mono:  'JetBrains Mono','D2Coding','Consolas',monospace;

  /* ── Radius (보수적) ─────────────────────────────── */
  --r-xs: 2px;
  --r-sm: 4px;
  --r:    6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  /* ── Shadow (절제, 거의 안 씀) ───────────────────── */
  --sh-1: 0 1px 2px rgba(0,0,0,.04);
  --sh-2: 0 2px 8px rgba(0,0,0,.06);
  --sh-3: 0 8px 24px rgba(0,0,0,.08);
  --sh-pop: 0 16px 40px rgba(0,0,0,.12);

  /* ── Layout ──────────────────────────────────────── */
  --nav-h: 72px;
  --side-w: 256px;
  --maxw: 1200px;
  --content-w: 880px;   /* 본문 최대 폭 */

  /* ── Motion ──────────────────────────────────────── */
  --ease: cubic-bezier(.2,.7,.2,1);
}

/* ── Reset ──────────────────────────────────────────── */
*,*::before,*::after { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; scroll-behavior: smooth; }
body {
  margin:0;
  font-family: var(--f-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss03","tnum";
  letter-spacing: 0;
}
img,svg { display:block; max-width:100%; }
button { font:inherit; cursor:pointer; border:0; background:none; padding:0; color:inherit; }
a { color:inherit; text-decoration:none; }
input,select,textarea { font:inherit; color:inherit; }
h1,h2,h3,h4,h5,h6 { margin:0; font-weight:700; line-height:1.25; letter-spacing: 0; }
p { margin:0; }
ul,ol { margin:0; padding:0; list-style:none; }
table { border-collapse:collapse; width:100%; }
::selection { background: var(--ink); color: #fff; }

/* ============================================================
   Member Mark (회원 마크 — 미니멀 톤)
   ============================================================ */
.mk {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  color: #fff;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid transparent;
}
.mk-reg { background: var(--mk-reg); }
.mk-gen { background: var(--mk-gen); }
.mk-edu { background: var(--mk-edu); }
.mk-grp { background: var(--mk-grp); }
.mk-biz { background: var(--mk-biz); }
.mk-hon { background: var(--mk-hon); }
.mk-par { background: var(--mk-par); }

.mk-pend { background: #fff; color: var(--ink-3); border-color: var(--line-strong); }
.mk-active { background: var(--ok); }
.mk-susp { background: var(--warn); }
.mk-withd { background: var(--ink-4); }

.mk-role-master { background: #111; }
.mk-role-admin  { background: #2a2a2a; }
.mk-role-hr     { background: #444; }

.mk-corp-cha { background: var(--mk-hon); }
.mk-corp-vp  { background: var(--mk-biz); }
.mk-corp-ex  { background: var(--mk-gen); }
.mk-corp-gen { background: var(--mk-grp); }

/* ============================================================
   Buttons (미니멀 — 단색 위주)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background .15s, border .15s, color .15s, transform .12s;
  white-space: nowrap;
  letter-spacing: 0;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink); background: var(--bg-soft); }
.btn-ghost { background: transparent; color: var(--ink-3); }
.btn-ghost:hover { color: var(--ink); background: var(--bg-soft); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-line:hover { background: var(--ink); color: #fff; }
.btn-danger { background: var(--err); color: #fff; }
.btn-warn { background: var(--warn); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ============================================================
   Form Controls
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  display: flex; align-items: center; gap: 6px;
}
.field-label .req { color: var(--err); font-weight: 700; }
.field-label .opt { color: var(--ink-5); font-weight: 500; font-size:11px; }
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: #fff;
  font-size: 14px;
  transition: border .15s;
  font-family: inherit;
  color: var(--ink);
}
.input:focus, .select:focus, .textarea:focus {
  outline: 0;
  border-color: var(--ink);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-5); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.help { font-size: 12px; color: var(--ink-4); }
.error { font-size: 12px; color: var(--err); }

.checkbox-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  cursor: pointer;
  transition: border .15s, background .12s;
}
.checkbox-row:hover { background: var(--bg-soft); }
.checkbox-row:has(input:checked) { border-color: var(--ink); background: var(--bg-soft); }
.checkbox-row input[type="checkbox"] {
  margin-top: 2px; width: 16px; height: 16px; accent-color: var(--ink); cursor:pointer; flex-shrink: 0;
}
.checkbox-row .cb-label { font-weight: 600; font-size: 14px; }
.checkbox-row .cb-desc { font-size: 12px; color: var(--ink-4); margin-top: 2px; }
.checkbox-row .cb-tag { font-size: 10px; padding: 2px 6px; border-radius: var(--r-sm); font-weight: 700; }
.checkbox-row .cb-tag.req { background: var(--ink); color: #fff; }
.checkbox-row .cb-tag.opt { background: var(--bg-3); color: var(--ink-3); }

/* ============================================================
   Card / Panel (보수적 — 테두리 위주)
   ============================================================ */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 24px;
}
.card-pop { box-shadow: var(--sh-2); border-color: var(--line-soft); }

.section-title {
  font-size: 16px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0;
}

/* ============================================================
   Chip / Tag
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap:4px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 12px; font-weight: 500;
  background: var(--bg-2); color: var(--ink-2);
  border: 1px solid var(--line);
  font-family: inherit;
  cursor: default;
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip[data-c], .chip[data-flt], .chip[data-tier] { cursor: pointer; transition: border .12s; }
.chip[data-c]:hover, .chip[data-flt]:hover, .chip[data-tier]:hover { border-color: var(--ink-3); }
.chip.outline { background: #fff; }

/* ============================================================
   Toast / Alert
   ============================================================ */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  padding: 12px 18px; border-radius: var(--r);
  background: var(--ink); color: #fff; font-size: 14px;
  box-shadow: var(--sh-3);
  opacity: 0; transform: translateY(-12px);
  transition: all .25s var(--ease);
  pointer-events: none;
  max-width: 400px;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }
.toast.warn { background: var(--warn); }

/* ============================================================
   Modal
   ============================================================ */
.modal-bd {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center;
  z-index: 999; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-bd.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--r-md);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--sh-pop);
  animation: modalIn .2s var(--ease);
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 920px; }
@keyframes modalIn {
  from { opacity:0; transform: translateY(12px) scale(.99); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-foot {
  padding: 16px 24px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--bg-soft);
  border-bottom-left-radius: var(--r-md);
  border-bottom-right-radius: var(--r-md);
}

/* ============================================================
   Utility
   ============================================================ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-c { align-items: center; }
.items-s { align-items: flex-start; }
.items-e { align-items: flex-end; }
.justify-b { justify-content: space-between; }
.justify-c { justify-content: center; }
.justify-e { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; }
.fw-bold { font-weight: 700; }
.fw-sb { font-weight: 600; }
.ink-mid { color: var(--ink-2); }
.ink-soft { color: var(--ink-3); }
.ink-faint { color: var(--ink-4); }
.serif { font-family: var(--f-serif); }
.mono { font-family: var(--f-mono); letter-spacing: 0; }
.tabular { font-variant-numeric: tabular-nums; }
.uppercase { text-transform: uppercase; letter-spacing: .08em; }

/* Spinner */
.spinner {
  width: 14px; height: 14px; border: 2px solid var(--line-strong);
  border-top-color: var(--ink); border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Image Slot (Placeholder + Edit Mode)
   ============================================================ */
.img-slot {
  position: relative;
  overflow: hidden;
  background: var(--bg-soft);
  display: block;
}
.img-slot-ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 20px;
  color: var(--ink-3);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.img-slot-ph::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,.035) 1px, transparent 1px),
    linear-gradient(rgba(0,0,0,.035) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: .55;
}
.img-slot-ph::after {
  content: "KA";
  position: absolute;
  right: 16px;
  bottom: 14px;
  font-family: var(--f-en);
  font-size: 13px;
  font-weight: 800;
  color: rgba(0,0,0,.12);
}
.img-slot-ph-label {
  position: relative;
  font-family: var(--f-serif);
  font-size: 16px; font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 6px;
  max-width: 90%;
  line-height: 1.4;
}
.img-slot-ph-key {
  position: relative;
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: .08em;
  background: rgba(255,255,255,.72);
  padding: 2px 8px; border-radius: var(--r-sm);
  margin-bottom: 12px;
  border: 1px solid rgba(0,0,0,.05);
}
.img-slot-ph-prompt {
  position: relative;
  font-size: 11px;
  color: var(--ink-4);
  line-height: 1.6;
  max-width: 88%;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.img-slot-ph-prompt span {
  font-family: var(--f-sans);
  color: var(--ink-3);
  display: block; margin-top: 4px;
  font-style: italic;
}

.img-slot-up-btn {
  margin-top: 14px;
  padding: 8px 14px;
  background: var(--ink); color: #fff;
  border-radius: var(--r);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.img-slot-up-btn:hover { background: var(--ink-2); }

.img-slot-bar {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px;
  z-index: 5;
  opacity: 0;
  transition: opacity .15s;
}
.img-slot:hover .img-slot-bar { opacity: 1; }
.img-slot-bar button {
  padding: 6px 10px;
  background: rgba(0,0,0,.78); color: #fff;
  border-radius: var(--r-sm);
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.img-slot-bar button:hover { background: rgba(0,0,0,.92); }

/* Edit mode toolbar (floating) */
.kaiepa-edit-bar {
  position: fixed; bottom: 20px; left: 20px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  z-index: 9000;
  font-size: 13px;
}
.kaiepa-edit-bar .ke-status {
  display: flex; align-items: center; gap: 8px;
  padding-right: 10px;
  border-right: 1px solid var(--line);
}
.kaiepa-edit-bar .ke-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-5);
}
.kaiepa-edit-bar.on .ke-dot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(45,122,79,.18);
  animation: keBlink 2s infinite;
}
@keyframes keBlink {
  0%,100% { box-shadow: 0 0 0 0 rgba(45,122,79,.32); }
  50%     { box-shadow: 0 0 0 6px rgba(45,122,79,0); }
}
.kaiepa-edit-bar.on { border-color: var(--ok); }
.kaiepa-edit-bar .ke-btn {
  padding: 6px 12px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 700;
  background: var(--ink); color: #fff;
  text-decoration: none;
  cursor: pointer;
}
.kaiepa-edit-bar .ke-btn:hover { background: var(--ink-2); }
.kaiepa-edit-bar .ke-btn.ke-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
.kaiepa-edit-bar .ke-btn.ke-secondary:hover { background: var(--bg-soft); }

/* Promo ribbon (right-bottom sticky) */
.promo-ribbon {
  position: fixed; bottom: 24px; right: 24px;
  width: 320px;
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  overflow: hidden;
  z-index: 800;
  transition: transform .3s var(--ease), opacity .3s;
  font-family: var(--f-sans);
}
.promo-ribbon.hidden-anim {
  transform: translateY(20px) scale(.98);
  opacity: 0; pointer-events: none;
}
.promo-ribbon .pr-close {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  color: var(--ink);
  font-size: 16px; line-height: 1;
  cursor: pointer; z-index: 2;
  display: grid; place-items: center;
}
.promo-ribbon .pr-close:hover { background: var(--ink); color: #fff; }
.promo-ribbon .pr-hd {
  background: var(--ink); color: #fff;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 10px;
}
.promo-ribbon .pr-badge {
  font-family: var(--f-en);
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em; padding: 3px 8px;
  border: 1px solid rgba(255,255,255,.32);
  border-radius: var(--r-sm);
}
.promo-ribbon .pr-tag {
  font-size: 12px; font-weight: 700;
  color: #fff;
}
.promo-ribbon .pr-body {
  padding: 18px;
}
.promo-ribbon .pr-title {
  font-family: var(--f-serif);
  font-size: 19px; font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
  letter-spacing: 0;
}
.promo-ribbon .pr-desc {
  font-size: 12px; color: var(--ink-3);
  line-height: 1.6; margin-bottom: 14px;
}
.promo-ribbon .pr-meta {
  font-size: 11px; color: var(--ink-4);
  margin-bottom: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.promo-ribbon .pr-cta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--ink); color: #fff;
  border-radius: var(--r);
  font-size: 13px; font-weight: 700;
  text-decoration: none;
  transition: background .15s;
}
.promo-ribbon .pr-cta:hover { background: var(--ink-2); }

@media (max-width: 720px) {
  .promo-ribbon { left: 16px; right: 16px; bottom: 16px; width: auto; }
}
