/* ==========================================================
   Insta Board – Main Stylesheet
   Aesthetic: Clean Editorial Light
   Fonts: Pretendard (body) + Playfair Display (accent)
========================================================== */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&display=swap');

/* ── CSS Variables ────────────────────────────────────── */
/* :root에 선언 → 모달이 body로 이동해도 변수가 유지됨    */
:root {
  --ib-bg:          #ffffff;
  --ib-surface:     #ffffff;
  --ib-surface-2:   #f5f5f5;
  --ib-border:      rgba(0,0,0,0.10);
  --ib-border-mid:  rgba(0,0,0,0.18);
  --ib-text:        #1a1a1a;
  --ib-text-muted:  #777;
  --ib-accent:      #d97706;
  --ib-accent-2:    #b45309;
  --ib-accent-light:#fef3c7;
  --ib-radius:      12px;
  --ib-radius-lg:   20px;
  --ib-gap:         16px;
  --ib-shadow:      0 4px 20px rgba(0,0,0,0.10);
  --ib-shadow-lg:   0 12px 40px rgba(0,0,0,0.15);
  --ib-trans:       0.24s cubic-bezier(0.4, 0, 0.2, 1);
  --ib-font-body:   'Pretendard Variable', 'Pretendard', -apple-system, sans-serif;
  --ib-font-accent: 'Playfair Display', Georgia, serif;
}

.ib-app {
  font-family: var(--ib-font-body);
  color: var(--ib-text);
  background: var(--ib-bg);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--ib-gap) 80px;
  box-sizing: border-box;
}

.ib-modal-overlay *, .ib-modal-overlay *::before, .ib-modal-overlay *::after {
  box-sizing: border-box;
}
.ib-modal-overlay img  { max-width: 100%; height: auto; display: block; }
.ib-modal-overlay button {
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--ib-font-body);
  color: inherit;
}
.ib-modal-overlay a { color: var(--ib-accent); text-decoration: none; }

/* ── Reset inside scope ───────────────────────────────── */
.ib-app *, .ib-app *::before, .ib-app *::after { box-sizing: border-box; }
.ib-app img { max-width: 100%; height: auto; display: block; }
.ib-app button { cursor: pointer; border: none; background: transparent; font-family: var(--ib-font-body); }
.ib-app a { color: var(--ib-accent); text-decoration: none; }

/* ────────────────────────────────────────────────────────
   HERO SLIDESHOW
──────────────────────────────────────────────────────── */
.ib-hero {
  position: relative;
  width: 100%;
  height: clamp(240px, 45vw, 520px);
  overflow: hidden;
  border-radius: var(--ib-radius-lg);
  margin: 24px 0 32px;
  background: var(--ib-surface);
}

.ib-hero__track {
  display: flex;
  width: 100%;
  height: 100%;
}

.ib-hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s ease, transform 0.7s ease;
  transform: scale(1.04);
  cursor: pointer;
}

.ib-hero__slide.is-active {
  opacity: 1;
  transform: scale(1);
  z-index: 1;
}

.ib-hero__slide.is-leaving {
  opacity: 0;
  transform: scale(0.97);
  z-index: 0;
}

.ib-hero__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 6s ease;
}

.ib-hero__slide.is-active img { transform: scale(1.05); }

.ib-hero__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 28px 24px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, transparent 100%);
  z-index: 2;
}

.ib-hero__caption span {
  font-family: var(--ib-font-accent);
  font-size: clamp(1rem, 3vw, 1.6rem);
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Dots */
.ib-hero__dots {
  position: absolute;
  bottom: 14px;
  right: 20px;
  display: flex;
  gap: 6px;
  z-index: 3;
}

.ib-hero__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transition: background var(--ib-trans), width var(--ib-trans);
  padding: 0;
}

.ib-hero__dot.is-active {
  background: #fff;
  width: 22px;
  border-radius: 4px;
}

/* Arrows */
.ib-hero__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ib-trans);
  opacity: 0;
}

.ib-hero:hover .ib-hero__arrow { opacity: 1; }
.ib-hero__arrow:hover { background: rgba(0,0,0,0.75); }
.ib-hero__arrow--prev { left: 14px; }
.ib-hero__arrow--next { right: 14px; }

/* ────────────────────────────────────────────────────────
   TOOLBAR
──────────────────────────────────────────────────────── */
.ib-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 0 4px;
}

.ib-toolbar__count {
  font-size: 0.82rem;
  color: var(--ib-text-muted);
  margin: 0;
  letter-spacing: 0.02em;
}

/* ── Buttons ──────────────────────────────────────────── */
.ib-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all var(--ib-trans);
}

.ib-btn--primary {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(217,119,6,0.3);
}
.ib-btn--primary:hover,
.ib-btn--primary:visited,
.ib-btn--primary:active,
.ib-btn--primary:focus {
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(217,119,6,0.45);
}
.ib-btn--primary svg   { stroke: #ffffff !important; }
.ib-btn--primary span  { color: #ffffff !important; }

/* 모달 밖에 있는 버튼도 동일하게 */
#ibWriteBtn,
#ibWriteBtn *,
#ibWriteBtn svg { color: #ffffff !important; stroke: #ffffff !important; }

.ib-btn--outline {
  border: 1.5px solid var(--ib-border);
  color: var(--ib-text);
  background: var(--ib-surface-2);
}

.ib-btn--outline:hover { border-color: var(--ib-accent); color: var(--ib-accent); }

.ib-btn--ghost {
  color: var(--ib-text-muted);
  background: transparent;
}
.ib-btn--ghost:hover { color: var(--ib-text); }

.ib-btn--danger {
  background: #c0392b;
  color: #fff;
}
.ib-btn--danger:hover { background: #e74c3c; }

/* ────────────────────────────────────────────────────────
   GRID FEED
──────────────────────────────────────────────────────── */
.ib-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--ib-gap);
}

@media (max-width: 768px) { .ib-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .ib-grid { grid-template-columns: 1fr; } }

/* ── Card ─────────────────────────────────────────────── */
.ib-card {
  background: #ffffff;
  border-radius: var(--ib-radius);
  overflow: hidden;
  border: 1px solid var(--ib-border);
  transition: transform var(--ib-trans), box-shadow var(--ib-trans);
  cursor: pointer;
  animation: ib-fadeUp 0.4s ease both;
  color: #1a1a1a;
}

@keyframes ib-fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ib-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--ib-shadow-lg);
  border-color: var(--ib-border-mid);
}

.ib-card:focus-visible { outline: 2px solid var(--ib-accent); outline-offset: 2px; }

/* 이미지 + 오버레이 래퍼 */
.ib-card__img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--ib-surface-2);
}

.ib-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.ib-card:hover .ib-card__img { transform: scale(1.06); }

/* 오버레이 (기본: 하단 1/3만 보임 → hover 시 위로 확장) */
.ib-card__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  /* 기본 상태: 하단 ~35% 높이만 보임 */
  background: linear-gradient(
    to top,
    rgba(10,10,10,0.92) 0%,
    rgba(10,10,10,0.65) 50%,
    transparent 100%
  );
  padding: 36px 14px 12px;
  transform: translateY(0);
  transition: all var(--ib-trans);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  min-height: 40%;
}

.ib-card:hover .ib-card__overlay {
  /* hover: 카드 전체 덮음 */
  min-height: 100%;
  padding-top: 24px;
  background: linear-gradient(
    to top,
    rgba(10,10,10,0.96) 0%,
    rgba(10,10,10,0.82) 60%,
    rgba(10,10,10,0.45) 100%
  );
}

.ib-card__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ib-card__excerpt {
  margin: 0;
  font-size: 0.76rem;
  color: rgba(255,255,255,0.72);
  line-height: 1.5;
  /* 기본: 숨김 */
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.ib-card:hover .ib-card__excerpt {
  max-height: 80px;
  opacity: 1;
}

.ib-card__more {
  font-size: 0.72rem;
  color: var(--ib-accent);
  font-weight: 600;
  letter-spacing: 0.03em;
  opacity: 0;
  transition: opacity 0.25s ease 0.1s;
}

.ib-card:hover .ib-card__more { opacity: 1; }

/* 카드 하단 메타 */
.ib-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(0,0,0,0.10);
  background: #ffffff;
  color: #1a1a1a;
}

.ib-card__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.ib-card__author {
  font-size: 0.8rem;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ib-card__date {
  font-size: 0.72rem;
  color: var(--ib-text-muted);
  flex-shrink: 0;
}

.ib-card__actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.ib-card__action-btn {
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background var(--ib-trans);
}

.ib-card__action-btn:hover { background: var(--ib-surface-2); }

/* ────────────────────────────────────────────────────────
   LOADER (무한 스크롤)
──────────────────────────────────────────────────────── */
.ib-loader {
  display: flex;
  justify-content: center;
  padding: 32px 0;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.ib-loader.is-visible { opacity: 1; }

.ib-loader__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--ib-border);
  border-top-color: var(--ib-accent);
  border-radius: 50%;
  animation: ib-spin 0.75s linear infinite;
}

@keyframes ib-spin { to { transform: rotate(360deg); } }

/* ────────────────────────────────────────────────────────
   MODAL
──────────────────────────────────────────────────────── */
.ib-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  font-family: var(--ib-font-body);
  color: var(--ib-text);
}

.ib-modal-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.ib-modal {
  background: #ffffff;
  border-radius: var(--ib-radius-lg);
  border: 1px solid var(--ib-border);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.95) translateY(12px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--ib-border) transparent;
  box-shadow: var(--ib-shadow-lg);
  color: #1a1a1a;
  font-family: var(--ib-font-body);
}

.ib-modal-overlay.is-open .ib-modal {
  transform: scale(1) translateY(0);
}

.ib-modal__close {
  position: sticky;
  top: 12px;
  float: right;
  margin: 12px 12px 0 0;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ib-surface-2);
  border: 1px solid var(--ib-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ib-text-muted);
  transition: all var(--ib-trans);
}

.ib-modal__close:hover { color: var(--ib-text); background: var(--ib-border-mid); }

.ib-modal__body { padding: 20px; }

/* ── Detail view ──────────────────────────────────────── */
.ib-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 420px;
}

@media (max-width: 640px) {
  .ib-detail { grid-template-columns: 1fr; }
}

.ib-detail__image-wrap {
  background: #000;
  border-radius: var(--ib-radius) 0 0 var(--ib-radius);
  overflow: hidden;
  max-height: 560px;
}

.ib-detail__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ib-detail__info {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.ib-detail__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ib-border);
}

.ib-detail__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.ib-detail__author {
  display: block;
  font-size: 0.9rem;
}

.ib-detail__date {
  display: block;
  font-size: 0.76rem;
  color: var(--ib-text-muted);
}

.ib-detail__header-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.ib-detail__title {
  margin: 0;
  font-family: var(--ib-font-accent);
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  line-height: 1.35;
  color: var(--ib-text);
}

.ib-detail__content {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--ib-text);
}

.ib-detail__content p { margin: 0 0 12px; }
.ib-detail__content img { border-radius: 8px; margin: 12px 0; }

/* ── Editor (Wide Modal) ─────────────────────────────── */
.ib-editor--wide {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-height: 0;
}

/* 에디터 모달은 거의 풀스크린 */
.ib-modal--editor {
  max-width: calc(100vw - 24px);
  width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
}

.ib-modal--editor .ib-modal__body {
  flex: 1;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 상단 헤더 바 */
.ib-editor__top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.09);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.ib-editor__heading {
  font-family: var(--ib-font-accent);
  font-size: 1.25rem;
  margin: 0;
  color: #1a1a1a;
}

.ib-editor__top-actions {
  display: flex;
  gap: 8px;
}

/* 2-column body */
.ib-editor__layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 800px) {
  .ib-editor__layout { grid-template-columns: 1fr; }
}

.ib-editor__main {
  padding: 20px 20px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid rgba(0,0,0,0.08);
  overflow-y: auto;
  height: 100%;
}

.ib-editor__sidebar {
  padding: 20px 16px;
  background: #fafafa;
  overflow-y: auto;
  height: 100%;
}

.ib-editor__field { display: flex; flex-direction: column; gap: 6px; }

.ib-editor__label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #777;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* 제목 입력 */
.ib-editor__title-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  color: #1a1a1a;
  background: #ffffff;
  font-family: var(--ib-font-body);
  font-size: 1.05rem;
  font-weight: 600;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.ib-editor__title-input:focus {
  outline: none;
  border-color: var(--ib-accent);
  box-shadow: 0 0 0 3px var(--ib-accent-light);
}

.ib-editor__input,
.ib-editor__textarea {
  background: #ffffff;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  color: #1a1a1a;
  font-family: var(--ib-font-body);
  font-size: 0.9rem;
  padding: 10px 14px;
  transition: border-color var(--ib-trans);
  resize: vertical;
}
.ib-editor__input:focus,
.ib-editor__textarea:focus {
  outline: none;
  border-color: var(--ib-accent);
  box-shadow: 0 0 0 3px var(--ib-accent-light);
}

/* RTE wrap tall 버전 */
.ib-rte-wrap--tall {
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  overflow: hidden;
}
.ib-rte-wrap--tall:focus-within {
  border-color: var(--ib-accent);
  box-shadow: 0 0 0 3px var(--ib-accent-light);
}

/* 에디터 편집 영역 — 키 크게, 모달 높이 채우기 */
.ib-rte-content--editor {
  min-height: 300px;
  height: calc(100vh - 260px);   /* 모달 내 툴바·제목 영역 제외 */
  max-height: none;
  font-size: 1rem;
  line-height: 1.85;
  overflow-y: auto;
}

/* ── 다중 이미지 그리드 (에디터) ─────────────────────────── */
.ib-editor__img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

/* 업로드된 이미지 카드 */
.ib-editor__img-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--ib-surface-2);
  border: 1.5px solid var(--ib-border);
  transition: border-color var(--ib-trans);
}

.ib-editor__img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 업로드 중 흐림 효과 */
.ib-editor__img-item.is-uploading img { filter: blur(2px); opacity: 0.5; }

/* 대표 이미지 배지 */
.ib-editor__img-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  background: var(--ib-accent);
  color: #000;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

/* 업로드 진행 스피너 오버레이 */
.ib-editor__img-progress {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
}

/* 개별 제거 버튼 */
.ib-editor__img-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--ib-trans);
}

.ib-editor__img-item:hover .ib-editor__img-remove { opacity: 1; }
.ib-editor__img-remove:hover { background: rgba(192,57,43,0.9); }

/* 이미지 추가 버튼 */
.ib-editor__img-add {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 2px dashed var(--ib-border-mid);
  background: var(--ib-surface-2);
  color: var(--ib-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  font-family: var(--ib-font-body);
  transition: all var(--ib-trans);
  cursor: pointer;
}

.ib-editor__img-add:hover {
  border-color: var(--ib-accent);
  color: var(--ib-accent);
  background: var(--ib-accent-light);
}

/* 업로드 상태 표시줄 */
.ib-editor__upload-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--ib-accent);
}

/* 작은 스피너 */
.ib-loader__spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
  flex-shrink: 0;
}

/* 저장 버튼 업로딩 상태 */
.ib-btn--primary.is-uploading {
  background: var(--ib-surface-2);
  color: var(--ib-text-muted);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  border: 1.5px solid var(--ib-border);
}

/* hint 텍스트 */
.ib-editor__img-hint {
  font-size: 0.72rem;
  color: var(--ib-text-muted);
  font-weight: 400;
  margin-left: 6px;
  text-transform: none;
  letter-spacing: 0;
}

/* ── 상세보기 갤러리 (다중 이미지) ──────────────────────── */
.ib-gallery {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ib-gallery__main {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #000;
  min-height: 300px;
}

.ib-gallery__main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.2s ease;
}

.ib-gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ib-trans);
}

.ib-gallery__nav:hover { background: rgba(0,0,0,0.8); }
.ib-gallery__nav--prev { left: 10px; }
.ib-gallery__nav--next { right: 10px; }

.ib-gallery__counter {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.45);
  padding: 2px 8px;
  border-radius: 10px;
}

/* 썸네일 스트립 */
.ib-gallery__strip {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: var(--ib-surface-2);
  overflow-x: auto;
  scrollbar-width: thin;
}

.ib-gallery__thumb {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color var(--ib-trans);
  padding: 0;
}

.ib-gallery__thumb.is-active { border-color: var(--ib-accent); }
.ib-gallery__thumb:hover     { border-color: rgba(255,255,255,0.4); }

.ib-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ib-editor__preview {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--ib-border);
}

.ib-editor__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--ib-border);
}

/* ────────────────────────────────────────────────────────
   RICH TEXT TOOLBAR
──────────────────────────────────────────────────────── */
.ib-rte-wrap {
  border: 1.5px solid var(--ib-border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color var(--ib-trans);
  background: var(--ib-surface);
}

.ib-rte-wrap:focus-within {
  border-color: var(--ib-accent);
  box-shadow: 0 0 0 3px var(--ib-accent-light);
}

/* 툴바 */
.ib-rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  background: #f5f5f5;
  border-bottom: 1px solid rgba(0,0,0,0.10);
}

.ib-rte-btn {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-family: var(--ib-font-body);
  color: var(--ib-text);
  background: transparent;
  border: none;
  transition: background var(--ib-trans), color var(--ib-trans);
  cursor: pointer;
  flex-shrink: 0;
}

.ib-rte-btn:hover   { background: var(--ib-border); }
.ib-rte-btn.is-active { background: var(--ib-accent-light); color: var(--ib-accent-2); }

/* 툴바 구분선 */
.ib-rte-sep {
  width: 1px;
  height: 20px;
  background: var(--ib-border-mid);
  margin: 5px 3px;
  flex-shrink: 0;
}

/* 폰트 크기 / 색상 select */
.ib-rte-select {
  height: 30px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid var(--ib-border);
  background: var(--ib-surface);
  color: var(--ib-text);
  font-size: 0.8rem;
  font-family: var(--ib-font-body);
  cursor: pointer;
}

/* 색상 피커 */
.ib-rte-color {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  border: 1.5px solid var(--ib-border);
  padding: 2px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

/* ── 색상 버튼 (A 아이콘 + 아래 바) ─────────────────────── */
.ib-rte-btn--color {
  width: auto;
  min-width: 30px;
  padding: 0 4px;
  flex-direction: column;
  gap: 0;
}

.ib-rte-color-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1;
}

.ib-rte-color-icon b {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  font-family: var(--ib-font-body);
}

.ib-rte-color-bar {
  display: block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
}

.ib-rte-color-group {
  display: flex;
  gap: 2px;
  align-items: center;
}

/* ── 색상 팔레트 팝업 ─────────────────────────────────── */
.ib-color-palette {
  position: absolute;
  z-index: 99999;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  padding: 10px;
  width: 220px;
  animation: ib-fadeUp 0.15s ease;
}

.ib-color-palette__swatches {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  margin-bottom: 8px;
}

.ib-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
  padding: 0;
}

.ib-color-swatch:hover { transform: scale(1.25); border-color: rgba(0,0,0,0.2); }

.ib-color-palette__custom {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 8px;
}

.ib-color-palette__custom label {
  font-size: 0.72rem;
  color: #777;
  flex: 1;
  cursor: pointer;
}

.ib-color-palette__custom input[type="color"] {
  width: 28px;
  height: 28px;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  padding: 1px;
  cursor: pointer;
  background: transparent;
}

/* 편집 영역 */
.ib-rte-content {
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  padding: 12px 14px;
  outline: none;
  font-family: var(--ib-font-body);
  font-size: 0.9rem;
  line-height: 1.75;
  color: #1a1a1a;
  background: #ffffff;
}

.ib-rte-content:empty::before {
  content: attr(data-placeholder);
  color: var(--ib-text-muted);
  pointer-events: none;
}

/* 편집 영역 안 요소 */
.ib-rte-content p   { margin: 0 0 8px; }
.ib-rte-content h1  { font-size: 1.6em; margin: 12px 0 6px; }
.ib-rte-content h2  { font-size: 1.3em; margin: 10px 0 5px; }
.ib-rte-content h3  { font-size: 1.1em; margin: 8px 0 4px; }
.ib-rte-content ul,
.ib-rte-content ol  { padding-left: 20px; margin: 6px 0; }
.ib-rte-content blockquote {
  border-left: 3px solid var(--ib-accent);
  margin: 8px 0;
  padding: 4px 12px;
  color: var(--ib-text-muted);
  font-style: italic;
}
.ib-rte-content a   { color: var(--ib-accent); text-decoration: underline; }
.ib-rte-content img { max-width: 100%; border-radius: 6px; }

/* ────────────────────────────────────────────────────────
   조회수 배지
──────────────────────────────────────────────────────── */
.ib-card__views {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  color: var(--ib-text-muted);
  flex-shrink: 0;
}

.ib-detail__views {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--ib-text-muted);
  margin-top: 2px;
}

/* ────────────────────────────────────────────────────────
   이미지 드래그 정렬 (SortableJS)
──────────────────────────────────────────────────────── */
.ib-editor__img-item[draggable="true"] { cursor: grab; }
.ib-editor__img-item.sortable-drag    { opacity: 0.4; }
.ib-editor__img-item.sortable-ghost   {
  opacity: 0.6;
  border: 2px dashed var(--ib-accent);
  background: var(--ib-accent-light);
}
/* 드래그 핸들 */
.ib-editor__img-handle {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.8);
  font-size: 0.7rem;
  letter-spacing: 1px;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ────────────────────────────────────────────────────────
   EMPTY STATE
──────────────────────────────────────────────────────── */
.ib-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--ib-text-muted);
}

.ib-empty__icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.ib-empty p { font-size: 0.9rem; }

/* ────────────────────────────────────────────────────────
   EDIT PAGE (전용 편집 페이지)
──────────────────────────────────────────────────────── */
.ib-edit-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  font-family: var(--ib-font-body);
  color: #1a1a1a;
  background: #ffffff;
  box-sizing: border-box;
}

.ib-edit-page__header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(0,0,0,0.10);
}

.ib-edit-page__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: #777;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 7px;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.ib-edit-page__back:hover { background: #f5f5f5; color: #1a1a1a; }

.ib-edit-page__title {
  font-family: var(--ib-font-accent);
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}

/* 2-column layout */
.ib-edit-page__body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 900px) {
  .ib-edit-page__body { grid-template-columns: 1fr; }
}

/* 편집 필드 */
.ib-edit-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.ib-edit-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #777;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ib-edit-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  font-size: 1.1rem;
  font-family: var(--ib-font-body);
  color: #1a1a1a;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.ib-edit-input:focus {
  outline: none;
  border-color: #d97706;
  box-shadow: 0 0 0 3px #fef3c7;
}

/* 편집 영역 키우기 */
.ib-rte-content--tall {
  min-height: 420px;
  max-height: none;
}

/* 사이드바 */
.ib-edit-page__sidebar {
  position: sticky;
  top: 24px;
  background: #fafafa;
  border: 1px solid rgba(0,0,0,0.09);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 저장 박스 */
.ib-edit-page__save-box {
  border-top: 1px solid rgba(0,0,0,0.09);
  padding-top: 16px;
}

.ib-edit-page__save-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

/* ────────────────────────────────────────────────────────
   WP TINYMCE 에디터 — 모달 내 사용
──────────────────────────────────────────────────────── */
/* 숨김 컨테이너 (페이지에 항상 존재, 모달 열릴 때 이동) */
#ibWpEditorWrap {
  display: none;
  width: 100%;
}

/* 모달 안으로 이동됐을 때 보이게 */
#ibWpEditorSlot #ibWpEditorWrap {
  display: block !important;
}

/* WP 에디터 iframe 높이 확보 */
#ibWpEditorWrap .wp-editor-container {
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 0 0 8px 8px;
}

#ibWpEditorWrap .wp-editor-area {
  min-height: 320px;
}

/* 탭 바 스타일 통일 */
#ibWpEditorWrap .wp-editor-tabs {
  background: #f5f5f5;
  border-bottom: 1px solid rgba(0,0,0,0.10);
}

/* 에디터 슬롯 */
#ibWpEditorSlot {
  width: 100%;
}
