/* ============================================================
   Components: page heads, cards, article, buttons, forms, modals, pickers, toast
   ============================================================ */

/* ---------- page head ---------- */
.page-head { margin-bottom: 26px; }
.breadcrumb { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.04em; color: var(--text-3); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb .sep { color: var(--text-3); }
h1.page-title { font-size: clamp(28px, 3vw, 40px); font-weight: 900; letter-spacing: -0.035em; line-height: 1.1; color: var(--text); margin-bottom: 8px; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 13px; color: var(--text-3); margin-top: 10px; }
.page-meta code, .ph-help code {
  font-family: var(--font-mono); font-size: 0.9em;
  background: var(--surface-2); border-radius: 6px; padding: 1px 7px; color: var(--gold);
}

.section-title { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); margin: 36px 0 14px; display: flex; align-items: center; gap: 12px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- cards (tonal surface, no border; elevation only on hover) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 22px;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), border-color var(--dur), background var(--dur);
}
.card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), var(--gold-soft), transparent 60%);
  opacity: 0; transition: opacity var(--dur) var(--ease);
}
.card:hover { transform: translateY(-3px); background: var(--surface-2); border-color: var(--gold-3); }
.card:hover::after { opacity: 1; }
.card h4 { font-size: 16px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.01em; }
.card p { color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.card .card-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 5px; }
.card .card-meta { margin-top: 10px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--text-3); }

.mini-tag { display: inline-block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--gold); border: 1px solid var(--gold-soft-2); padding: 2px 8px; border-radius: 4px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px; }
.tag-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12px; padding: 4px 10px; border-radius: 4px; border: 1px solid var(--line); cursor: pointer; transition: color var(--dur), background var(--dur), border-color var(--dur); }
.tag-chip:hover { color: var(--text); border-color: var(--line-2); }
.tag-chip.on { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-soft-2); }
.tag-chip .cnt { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }

/* ---------- article body ---------- */
.article { line-height: 1.85; font-size: 16px; margin-top: 24px; max-width: 78ch; word-break: break-word; }
.article h1, .article h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.025em; color: var(--text); margin: 44px 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.article h3 { font-size: 20px; font-weight: 700; margin: 30px 0 10px; }
.article h4 { font-size: 17px; font-weight: 700; margin: 24px 0 8px; }
.article p { margin: 12px 0; }
.article ul, .article ol { margin: 12px 0 12px 22px; }
.article li { margin: 5px 0; }
.article li::marker { color: var(--gold-3); }
/* 생김새를 고른 인용구(.mc-q)·구분선(.mc-hr)은 editor.css 의 자기 스타일을 쓴다. */
.article blockquote:not(.mc-q) {
  border-left: 3px solid var(--gold-3); background: var(--gold-soft);
  padding: 12px 20px; margin: 18px 0; border-radius: 0 var(--r-md) var(--r-md) 0; color: var(--text-2);
}
.article code { font-family: var(--font-mono); font-size: 0.86em; background: var(--surface-2); padding: 2px 7px; border-radius: 6px; color: var(--gold); }
.article pre { background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); padding: 16px 20px; border-radius: var(--r-md); overflow-x: auto; margin: 18px 0; font-size: 13.5px; }
.article pre code { background: none; padding: 0; color: var(--text); }
.article img { border-radius: var(--r-md); margin: 10px auto; }
.article video { border-radius: var(--r-md); margin: 10px auto; }
.article .img-wrap { text-align: center; margin: 18px 0; }
.article .img-wrap img { display: inline-block; margin: 0 auto; }
.article .img-wrap .img-caption { font-size: 12.5px; color: var(--text-3); margin-top: 8px; }
.article .yt-wrap { position: relative; aspect-ratio: 16 / 9; height: auto; padding-bottom: 0; margin: 18px auto; border-radius: var(--r-md); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.article .yt-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.article hr:not(.mc-hr) { border: none; height: 1px; background: var(--line-2); margin: 32px 0; }
.article table { border-collapse: collapse; margin: 18px 0; width: 100%; font-size: 14.5px; }
.article th, .article td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.article th { color: var(--text-3); font-weight: 600; font-size: 12.5px; }
.article a { text-decoration: underline; text-decoration-color: var(--gold-soft-2); text-underline-offset: 3px; }
.article a:hover { text-decoration-color: var(--gold); }

.cat-desc { margin: 4px 0 30px; padding: 24px 28px; border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--surface); max-width: none; }
.cat-desc-editor { margin: 4px 0 30px; }

.empty-state { text-align: center; padding: 72px 20px; color: var(--text-3); }
.empty-state .es-shield { width: 56px; height: 66px; margin: 0 auto 16px; opacity: 0.3; }
.empty-state p { font-size: 14.5px; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.field input[type=text], .field input[type=search], .field input[type=url], .field input[type=password],
.field select, .field textarea {
  width: 100%; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); padding: 11px 14px; font-size: 14px; outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold-3); box-shadow: 0 0 0 4px var(--gold-soft); }
.field textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }
.icon-name-row { display: flex; gap: 8px; }
.icon-name-row input { flex: 1; }
.icon-pick {
  width: 44px; height: 44px; flex-shrink: 0; font-size: 21px; line-height: 1;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.icon-pick:hover { border-color: var(--gold-3); box-shadow: 0 0 0 4px var(--gold-soft); }
input[type=color].color-input { width: 46px; height: 42px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-1); cursor: pointer; padding: 3px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(var(--shadow-rgb), 0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: appIn 0.25s var(--ease-out);
}
.modal {
  width: 100%; max-width: 440px; padding: 32px 32px 28px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: 0 40px 90px -30px rgba(var(--shadow-rgb), 0.9);
  text-align: center;
  animation: modalIn 0.4s var(--ease-out);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-shield { width: 54px; height: 54px; margin: 0 auto 16px; }
.modal-shield img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 18px var(--gold-glow)); }
.modal h3 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.modal-desc { font-size: 13.5px; color: var(--text-2); margin-bottom: 22px; line-height: 1.6; }
.modal input {
  width: 100%; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); padding: 12px 16px; font-size: 14px; outline: none; text-align: center; font-family: var(--font-mono); letter-spacing: 0.06em;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.modal input:focus { border-color: var(--gold-3); box-shadow: 0 0 0 4px var(--gold-soft); }
.modal-error { color: var(--danger); font-size: 12.5px; margin-top: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }
.modal-left { text-align: left; }
.modal-left h3 { margin-bottom: 20px; }
.modal-left input { text-align: left; font-family: var(--font-sans); letter-spacing: 0; }
.modal-left .modal-actions { justify-content: flex-end; }

/* ---------- popovers: emoji picker, doc-link / placeholder picker ---------- */
.emoji-pop, .dlink-pop {
  position: fixed; z-index: var(--z-pop);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: 0 30px 60px -24px rgba(var(--shadow-rgb), 0.9);
  animation: modalIn 0.22s var(--ease-out);
}
.emoji-pop { width: 324px; max-height: 380px; }
.ep-head { display: flex; gap: 8px; padding: 12px 12px 8px; }
.ep-head input { flex: 1; min-width: 0; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text); padding: 7px 11px; font-size: 13.5px; outline: none; }
.ep-head input:focus { border-color: var(--gold-3); }
.ep-head button { background: none; border: 1px solid var(--line); color: var(--text-2); border-radius: var(--r-pill); padding: 5px 12px; font-size: 12.5px; white-space: nowrap; }
.ep-head button:hover { color: var(--danger); border-color: var(--danger); }
.ep-body { overflow-y: auto; padding: 0 12px 12px; }
.ep-label { font-size: 10.5px; font-weight: 600; color: var(--text-3); margin: 10px 2px 4px; }
.ep-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.ep-e { background: none; border: none; font-size: 19px; line-height: 1; padding: 6px 0; border-radius: var(--r-sm); transition: background var(--dur) var(--ease); }
.ep-e:hover { background: var(--gold-soft-2); }

.dlink-pop { width: 320px; max-height: 360px; padding: 10px; }
.dl-search { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text); padding: 8px 11px; font-size: 13.5px; outline: none; margin-bottom: 8px; }
.dl-search:focus { border-color: var(--gold-3); }
.dl-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.dl-item, .dl-back {
  text-align: left; background: none; border: none; color: var(--text); font-size: 13.5px;
  padding: 8px 10px; border-radius: var(--r-sm); transition: background var(--dur) var(--ease);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dl-item:hover { background: var(--gold-soft); color: var(--gold); }
.dl-back { color: var(--gold); font-weight: 600; font-size: 12.5px; }
.dl-empty { color: var(--text-3); font-size: 13px; padding: 10px; }
.dlink-pop .ph-pick { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.dlink-pop .ph-pk { color: var(--gold); font-family: var(--font-mono); font-size: 12.5px; }
.dlink-pop .ph-pv { color: var(--text-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---------- placeholder management ---------- */
.ph-help { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 20px; margin-bottom: 18px; font-size: 13.5px; line-height: 1.7; color: var(--text-2); }
.ph-new { display: grid; grid-template-columns: 200px 1fr 200px auto; gap: 10px; align-items: start; }
.ph-new input, .ph-new textarea, .ph-fields input, .ph-fields textarea {
  width: 100%; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); padding: 10px 12px; font-size: 13.5px; outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.ph-new input:focus, .ph-new textarea:focus, .ph-fields input:focus, .ph-fields textarea:focus { border-color: var(--gold-3); box-shadow: 0 0 0 4px var(--gold-soft); }
.ph-new textarea, .ph-fields textarea { resize: vertical; line-height: 1.5; min-height: 42px; font-family: var(--font-mono); font-size: 13px; }
.ph-row {
  display: grid; grid-template-columns: 180px 1fr auto; gap: 14px; align-items: start;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  padding: 16px 18px; margin-bottom: 10px;
}
.ph-token { display: flex; align-items: center; gap: 6px; padding-top: 8px; }
.ph-token code { font-family: var(--font-mono); font-size: 12.5px; background: var(--gold-soft); color: var(--gold); border-radius: var(--r-pill); padding: 5px 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.ph-copy { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: none; border: 1px solid var(--line); color: var(--text-2); font-size: 14px; }
.ph-copy:hover { border-color: var(--gold-3); color: var(--gold); }
.ph-fields { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ph-fields .ph-key { color: var(--text); font-weight: 600; }
.ph-actions { display: flex; flex-direction: column; gap: 6px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500;
  padding: 12px 22px; border-radius: var(--r-sm); border: 1px solid var(--gold-soft-2);
  box-shadow: 0 20px 40px -16px rgba(var(--shadow-rgb), 0.9);
  animation: toastIn 0.4s var(--ease-out);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.error { border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }

/* ---------- site editor (#/site) ---------- */
.se-toolbar { margin-bottom: 8px; }
.se-row { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.se-row:first-child { border-top: 0; }
.se-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-2); }
.se-thumb.wide { height: 64px; }
.se-noimg { display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); border: 1px dashed var(--line-2); }
.se-num { font-family: var(--font-mono); font-size: 22px; color: var(--gold); padding-top: 8px; }
.se-fields { display: grid; gap: 8px; min-width: 0; }
.se-fields.se-two { grid-template-columns: 1fr 1fr; }
.se-fields input, .se-fields textarea { width: 100%; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text); padding: 9px 12px; font-size: 13.5px; outline: none; transition: border-color var(--dur); }
.se-fields input:focus, .se-fields textarea:focus { border-color: var(--gold-3); }
.se-fields textarea { resize: vertical; line-height: 1.5; }
.se-inline { display: flex; gap: 8px; align-items: center; }
.se-inline input, .se-inline textarea { flex: 1; }
.se-actions { display: flex; flex-direction: column; gap: 4px; }
.se-actions button { width: 30px; height: 30px; border-radius: var(--r-sm); background: none; border: 1px solid var(--line); color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; transition: color var(--dur), border-color var(--dur); }
.se-actions button:hover { color: var(--gold); border-color: var(--gold-3); }
.se-actions .se-del:hover { color: var(--danger); border-color: var(--danger); }
@media (max-width: 768px) { .se-row { grid-template-columns: 1fr; } .se-actions { flex-direction: row; } }
