:root {
  --ink: #0d0c22;
  --muted: #6e6d7a;
  --paper: #ffffff;
  --soft: #f6f7fb;
  --line: #e2e8f2;
  --pink: #ea4c89;
  --dark: #060318;
  --radius: 8px;
  --font: "Mona Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

.post-header {
  z-index: 20;
  min-height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dark);
  color: #fff;
}

.brand,
.post-nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 9px;
  font-size: 18px;
  font-weight: 900;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: inset -5px 0 0 rgba(255, 255, 255, 0.28);
}

.post-nav {
  gap: 8px;
}

.post-nav a {
  min-height: 38px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 13px;
  font-weight: 800;
}

.post-page {
  width: min(100% - 40px, 1160px);
  margin: 0 auto;
  padding: 42px 0 72px;
}

.post-shell {
  display: grid;
  gap: 24px;
}

.post-hero {
  display: grid;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 26px;
}

.post-kicker {
  margin: 0;
  color: var(--pink);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.post-title {
  max-width: 980px;
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.08;
  letter-spacing: 0;
}

.post-description {
  max-width: 840px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.post-card-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.post-card-strip figure {
  flex: 0 0 172px;
  margin: 0;
}

.post-card-strip img {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--dark);
}

.post-body {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(13, 12, 34, 0.08);
}

.post-body-frame {
  display: block;
  width: 100%;
  min-height: 640px;
  border: 0;
  background: #fff;
}

.html-report-surface {
  width: 100%;
  min-height: 70vh;
}

.html-post-mode {
  background: #f4f5f7;
}

.html-post-mode .post-header {
  min-height: 52px;
}

.html-post-mode .brand {
  font-size: 16px;
}

.html-post-mode .post-page {
  width: min(100% - 28px, 1320px);
  padding: 22px 0 64px;
}

.html-post-mode .post-shell {
  display: block;
}

.html-post-mode .html-report-surface > style:first-child + .acr-wrap,
.html-post-mode .html-report-surface > .acr-wrap {
  max-width: 1180px;
  margin: 0 auto;
}

.html-post-mode .acr-wrap {
  background: transparent;
}

.html-post-mode .acr-progress {
  top: 0;
}

.post-text {
  max-width: 820px;
  padding: clamp(28px, 5vw, 72px);
}

.post-text p {
  margin: 0 0 18px;
  color: #2b2b38;
  font-size: 18px;
}

.post-loading,
.post-empty {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 28px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 720px) {
  .post-header {
    padding: 14px 16px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .post-page {
    width: min(100% - 24px, 1160px);
    padding-top: 28px;
  }

  .post-title {
    font-size: 34px;
  }

  .post-description {
    font-size: 16px;
  }
}

/* Local admin controls (visible only when the local server responds) */
.post-admin-bar {
  margin: 32px auto 0;
  max-width: 920px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: 0 8px 24px rgba(13, 12, 34, 0.06);
}
.post-admin-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.post-admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.post-admin-btn {
  font: inherit;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.post-admin-btn:hover {
  border-color: var(--ink);
}
.post-admin-btn.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.post-admin-btn.danger:hover {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
}
.post-admin-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.post-edit-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.post-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.post-edit-form input,
.post-edit-form textarea {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  resize: vertical;
}
.post-edit-form input:focus,
.post-edit-form textarea:focus {
  outline: none;
  border-color: var(--ink);
}

.post-edit-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.post-edit-row > label {
  flex: 1 1 220px;
}
.post-edit-form select {
  font: inherit;
  color: var(--ink);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}
.post-edit-form select:focus {
  outline: none;
  border-color: var(--ink);
}
.post-edit-form label small {
  font-weight: 400;
  color: var(--muted);
}
.post-edit-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre;
  overflow-wrap: normal;
}

/* ── Card-news arrows: force high contrast on ANY card background ──
   Applies to every injected post HTML (carousel + lightbox), overriding
   each post's embedded styles so the nav arrows are always visible. */
.html-report-surface .acr-cf-nav,
.html-report-surface .acr-lb-arrow {
  background: #fff !important;
  color: #111 !important;
  border: 2px solid #111 !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5) !important;
  opacity: 1 !important;
  -webkit-text-stroke: 0 !important;
}
.html-report-surface .acr-cf-nav:hover,
.html-report-surface .acr-lb-arrow:hover {
  background: #111 !important;
  color: #fff !important;
  border-color: #fff !important;
}
/* Close (X) button on the lightbox — same treatment so it never disappears. */
.html-report-surface .acr-lb-close {
  background: #fff !important;
  color: #111 !important;
  border: 2px solid #111 !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5) !important;
  opacity: 1 !important;
}

/* ── 카드뉴스 리포트 폭 안전장치 ──────────────────────────────────────
   일부 글은 본문 HTML이 .acr-inner 래퍼(max-width 앵커) 없이 생성되는데,
   그러면 카드뉴스 캐러셀(.acr-cf-track)이 카드 전체를 한 줄로 펼쳐 페이지
   폭을 수천 px로 터뜨린다. .acr-wrap에 폭 앵커를 줘서 래퍼가 없어도 폭이
   갇히고, 카드뉴스는 .acr-cf-track의 가로 스크롤(overflow-x:auto)로 처리된다.
   정상 글(.acr-inner 보유)에는 영향이 없다(이미 더 좁게 중앙 정렬됨). */
/* 그리드 칸이 본문(카드뉴스)의 내용 폭으로 늘어나는 것을 막는다.
   minmax(0,1fr)이 핵심: 칸을 .post-page 폭으로 가둬 캐러셀이 가로
   스크롤(overflow-x:auto)로 처리되게 한다. min-width:0도 같은 목적. */
.post-shell {
  grid-template-columns: minmax(0, 1fr);
}
.html-report-surface,
.html-report-surface .acr-wrap,
.html-report-surface .acr-cf,
.html-report-surface .acr-cf-track {
  min-width: 0;
  max-width: 100%;
}
.html-report-surface .acr-wrap {
  margin-left: auto;
  margin-right: auto;
}

/* ── 관련 글 ("이런 글도 함께 보기") — 본문/출처 아래 ───────────────── */
.related-posts {
  padding-top: 30px;
  border-top: 1px solid var(--line);
}
.related-posts[hidden] { display: none; }
.related-title {
  margin: 0 0 18px;
  font-size: clamp(19px, 2.6vw, 24px);
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.related-card {
  display: block;
  color: var(--ink);
}
.related-thumb {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--dark);
  box-shadow: 0 8px 24px rgba(13, 12, 34, 0.1);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.related-card:hover .related-thumb {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(13, 12, 34, 0.18);
}
.related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.related-meta { padding: 10px 2px 0; }
.related-cat {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.related-card h3 {
  margin: 4px 0 0;
  font-size: 14.5px;
  line-height: 1.34;
  font-weight: 700;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 720px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
