/* 문단 정렬·사진 여러 장 배치·본문 동영상. 글쓰기 편집기와 공개 글 화면이 함께 쓴다.
   문단 맨 앞의 보이지 않는 표시 <span class="al-…|ly-…">​</span>(admin_editor.js)를 :has()로 찾는다.
   선택자 앞 :is(.prose, .write-card--editor .toastui-editor-contents)는 각 화면의 기본 사진 규칙보다 우선하기 위해서다. */
:root {
  --block-gap: 6px;
  --block-radius: 8px;
  /* 다음 사진이 살짝 보여서 옆으로 넘길 수 있다는 걸 알게 한다. 넓은 화면에서도 한 장이 너무 커지지 않게 상한 */
  --slide-width: min(86%, 340px);
  --slide-ratio: 4 / 5;
  --collage-min: 30%;           /* 한 줄에 최대 3장 */
  --video-max-height: 70vh;
  --video-bg: #000000;
}

/* ── 정렬(사진은 기본 가운데, 글자는 기본 왼쪽) ── */
:is(.prose, .toastui-editor-contents) :is(p, h1, h2, h3, h4, h5, h6):has(> .al-left) { text-align: left; }
:is(.prose, .toastui-editor-contents) :is(p, h1, h2, h3, h4, h5, h6):has(> .al-center) { text-align: center; }
:is(.prose, .toastui-editor-contents) :is(p, h1, h2, h3, h4, h5, h6):has(> .al-right) { text-align: right; }
:is(.prose, .toastui-editor-contents) :is(p, h1, h2, h3, h4, h5, h6):has(> .al-justify) { text-align: justify; }
:is(.prose, .write-card--editor .toastui-editor-contents) p:has(> .al-left) img:not(.ProseMirror-separator) { margin-left: 0; margin-right: auto; }
:is(.prose, .write-card--editor .toastui-editor-contents) p:has(> .al-right) img:not(.ProseMirror-separator) { margin-left: auto; margin-right: 0; }

/* ── 콜라주: 한 문단에 모은 사진을 격자로(정사각형으로 잘라 맞춤) ── */
:is(.prose, .write-card--editor .toastui-editor-contents) p:has(> .ly-collage) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--collage-min), 1fr));
  gap: var(--block-gap);
}
/* ── 슬라이드: 옆으로 넘겨 보기 ── */
:is(.prose, .write-card--editor .toastui-editor-contents) p:has(> .ly-slide) {
  display: flex;
  gap: var(--block-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
/* 격자·가로줄 안에서는 표시 글자·편집기 보조 요소(줄 끝 보이지 않는 이미지·줄바꿈)를 칸으로 세지 않는다 */
:is(.prose, .toastui-editor-contents) p:is(:has(> .ly-collage), :has(> .ly-slide)) > :is(span, br, .ProseMirror-separator) { display: none; }
:is(.prose, .write-card--editor .toastui-editor-contents) p:has(> .ly-collage) img:not(.ProseMirror-separator) {
  width: 100%;
  max-height: none;
  aspect-ratio: 1;
  object-fit: cover;
  margin: 0;
  border-radius: var(--block-radius);
}
:is(.prose, .write-card--editor .toastui-editor-contents) p:has(> .ly-slide) img:not(.ProseMirror-separator) {
  flex: 0 0 auto;
  width: var(--slide-width);
  max-height: none;
  aspect-ratio: var(--slide-ratio);
  object-fit: cover;
  margin: 0;
  border-radius: var(--block-radius);
  scroll-snap-align: center;
}

/* ── 본문 동영상(글쓰기에서 올린 파일, content.py가 재생기로 바꾼다) ── */
.prose .post-video {
  display: block;
  width: 100%;
  max-height: var(--video-max-height);
  border-radius: var(--block-radius);
  background: var(--video-bg);
}

/* ── 글자 크기(도구 막대 [글자 크기], content.FONT_SIZES와 같은 목록). 줄 간격이 큰 글자에 맞춰 늘어나게 line-height는 그대로 둔다 ── */
:is(.prose, .toastui-editor-contents) .fs-13 { font-size: 13px; }
:is(.prose, .toastui-editor-contents) .fs-15 { font-size: 15px; }
:is(.prose, .toastui-editor-contents) .fs-19 { font-size: 19px; }
:is(.prose, .toastui-editor-contents) .fs-24 { font-size: 24px; }
:is(.prose, .toastui-editor-contents) .fs-28 { font-size: 28px; }
:is(.prose, .toastui-editor-contents) .fs-34 { font-size: 34px; }
