:root {
  --ink: #111;
  --ink-2: #444;
  --ink-3: #888;
  --line: #e5e5e5;
  --bg: #fff;
  --bg-2: #f6f6f4;
  --accent: #b4161b;
  --ok: #1d7a3a;
  --serif: 'Noto Serif KR', Georgia, serif;
  --sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  --wrap: 1120px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---- header ---- */
.top {
  position: sticky; top: 0; z-index: 30; background: var(--bg);
  display: grid; grid-template-columns: 48px 1fr auto; align-items: center;
  padding: 6px 12px; border-bottom: 1px solid var(--ink);
}
.logo { font: 900 30px/1 var(--serif); letter-spacing: .06em; text-align: center; justify-self: center; grid-column: 2; }
.top-right { display: flex; gap: 6px; align-items: center; justify-self: end; }
.icon-btn { width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; border-radius: 8px; }
.icon-btn:hover { background: var(--bg-2); }
.top-link { font-size: 14px; font-weight: 600; padding: 10px 8px; min-height: 44px; display: inline-flex; align-items: center; background: none; border: 0; cursor: pointer; }

.sections { display: flex; gap: 4px; overflow-x: auto; padding: 0 12px; border-bottom: 1px solid var(--line); scrollbar-width: none; justify-content: center; }
.sections::-webkit-scrollbar { display: none; }
.sections a { padding: 12px 12px; font-size: 15px; font-weight: 600; letter-spacing: .04em; white-space: nowrap; border-bottom: 2px solid transparent; }
.sections a.on { border-color: var(--ink); }

/* ---- drawer ---- */
.drawer { position: fixed; inset: 0 auto 0 0; width: min(340px, 86vw); background: var(--bg); z-index: 50; transform: translateX(-100%); transition: transform .25s; overflow-y: auto; }
.drawer.open { transform: none; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer-inner { padding: 20px; }
.drawer h3 { font: 700 20px/1.2 var(--serif); margin: 24px 0 6px; }
.drawer h3:first-child { margin-top: 4px; }
.drawer .d-desc { font-size: 13px; color: var(--ink-3); margin: 0 0 6px; }
.drawer a.d-cat { display: block; padding: 10px 0; font-size: 16px; border-bottom: 1px solid var(--line); }
.drawer form { display: flex; gap: 6px; }
.drawer input[type=search] { flex: 1; min-height: 44px; padding: 8px 12px; border: 1px solid var(--ink); border-radius: 0; }

/* ---- layout ---- */
main { max-width: var(--wrap); margin: 0 auto; padding: 16px 16px 48px; min-height: 60vh; }
.loading, .empty { color: var(--ink-3); text-align: center; padding: 60px 0; }
.empty strong { display: block; color: var(--ink); font: 700 20px/1.4 var(--serif); margin-bottom: 6px; }
.page-head { padding: 18px 0 14px; border-bottom: 1px solid var(--ink); margin-bottom: 18px; }
.page-head .kicker { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.page-head h1 { font: 900 32px/1.2 var(--serif); margin: 4px 0 6px; }
.page-head p { margin: 0; color: var(--ink-2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chip { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; min-height: 40px; display: inline-flex; align-items: center; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---- cards ---- */
.lead { display: grid; gap: 14px; padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.lead .ph { aspect-ratio: 16/10; }
.lead h2 { font: 900 28px/1.25 var(--serif); margin: 6px 0; }
.lead p { color: var(--ink-2); margin: 0; font-size: 17px; }
.grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
.card .ph { aspect-ratio: 4/3; margin-bottom: 10px; }
.card h3 { font: 700 19px/1.35 var(--serif); margin: 4px 0; }
.card p { margin: 0; color: var(--ink-2); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ph { background: var(--bg-2); overflow: hidden; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph.none { display: grid; place-items: center; font: 900 22px var(--serif); color: #ccc; letter-spacing: .1em; }
.meta { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.meta .date { color: var(--ink-3); font-weight: 500; letter-spacing: 0; margin-left: 6px; text-transform: none; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: #fde8e8; color: var(--accent); margin-left: 6px; letter-spacing: 0; }
.strip { margin-top: 36px; }
.strip-head { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid var(--ink); padding-top: 10px; margin-bottom: 14px; }
.strip-head h2 { font: 900 22px var(--serif); margin: 0; }
.strip-head a { font-size: 14px; color: var(--ink-2); padding: 8px 0; }
.more { display: block; margin: 28px auto 0; }

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .lead { grid-template-columns: 3fr 2fr; align-items: center; }
  .lead h2 { font-size: 34px; }
}
@media (min-width: 1000px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- article ---- */
.article { max-width: 720px; margin: 0 auto; }
.article h1 { font: 900 30px/1.3 var(--serif); margin: 10px 0; word-break: keep-all; }
.article .sub { font-size: 18px; color: var(--ink-2); margin: 0 0 16px; word-break: keep-all; }
.article .byline { font-size: 14px; color: var(--ink-3); padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.article .cover { margin: 0 -16px 22px; }
.body { font-size: 17px; line-height: 1.85; word-break: keep-all; overflow-wrap: anywhere; }
.body p { margin: 0 0 1.2em; }
.body h2 { font: 700 22px/1.4 var(--serif); margin: 1.6em 0 .6em; }
.body blockquote { margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--ink); font: 500 19px/1.6 var(--serif); }
.body figure { margin: 1.6em 0; }
.body figure img { width: 100%; }
.body figcaption { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.body a { text-decoration: underline; }
.source { font-size: 14px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 28px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
@media (min-width: 720px) { .article h1 { font-size: 40px; } .article .cover { margin: 0 0 26px; } }

/* ---- forms ---- */
.form { max-width: 420px; margin: 24px auto; }
.form h1 { font: 900 28px var(--serif); margin: 0 0 6px; }
.form .hint { color: var(--ink-2); margin: 0 0 18px; font-size: 15px; }
label.f { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
label.f > span.h { display: block; font-weight: 400; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.in, select.in, textarea.in { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; min-height: 46px; border: 1px solid #ccc; border-radius: 6px; background: #fff; font-size: 16px; }
textarea.in { min-height: 160px; line-height: 1.6; resize: vertical; }
.in:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.btn { min-height: 46px; padding: 10px 18px; border-radius: 6px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.ghost { background: #fff; color: var(--ink); }
.btn.danger { background: #fff; color: var(--accent); border-color: var(--accent); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.err { color: var(--accent); font-size: 14px; min-height: 20px; margin: 4px 0 10px; }
.switch-link { text-align: center; margin-top: 16px; font-size: 15px; color: var(--ink-2); }
.switch-link a { text-decoration: underline; color: var(--ink); }

/* ---- admin ---- */
.admin-nav { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 18px; scrollbar-width: none; }
.admin-nav a { padding: 10px 14px; border-radius: 999px; background: var(--bg-2); font-size: 14px; font-weight: 600; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
.admin-nav a.on { background: var(--ink); color: #fff; }
.rows { display: grid; gap: 10px; }
.row { border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 8px; }
.row .t { font-weight: 700; font-size: 16px; word-break: break-all; }
.row .s { font-size: 13px; color: var(--ink-3); word-break: break-all; }
.row .btns { display: flex; gap: 6px; flex-wrap: wrap; }
.row .btns .btn { min-height: 40px; padding: 6px 14px; font-size: 14px; }
.perm { display: flex; gap: 14px; flex-wrap: wrap; font-size: 15px; }
.perm label { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; cursor: pointer; }
.perm input { width: 20px; height: 20px; }
.st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: var(--bg-2); }
.st.published { background: #e3f3e8; color: var(--ok); }
.st.held, .st.draft { background: #fff4d6; color: #8a5a00; }
.st.failed { background: #fde8e8; color: var(--accent); }

.editor-grid { display: grid; gap: 18px; }
@media (min-width: 960px) { .editor-grid { grid-template-columns: 380px 1fr; align-items: start; } .editor-grid .side { position: sticky; top: 120px; } }
.panel { border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.panel h2 { font-size: 16px; margin: 0 0 4px; }
.panel .hint { font-size: 13px; color: var(--ink-3); margin: 0 0 12px; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.thumb { position: relative; aspect-ratio: 1; background: var(--bg-2); border-radius: 6px; overflow: hidden; border: 2px solid transparent; cursor: pointer; }
.thumb.cover { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .tag { position: absolute; left: 4px; top: 4px; background: var(--accent); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 3px; }
.thumb .x { position: absolute; right: 2px; top: 2px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.upload { display: flex; align-items: center; justify-content: center; min-height: 64px; border: 1px dashed #bbb; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: 15px; }
.upload input { display: none; }
.toolbar { display: flex; gap: 4px; flex-wrap: wrap; border: 1px solid #ccc; border-bottom: 0; border-radius: 6px 6px 0 0; padding: 4px; background: var(--bg-2); position: sticky; top: 108px; z-index: 5; }
.toolbar button { min-width: 40px; min-height: 40px; border: 0; background: none; border-radius: 4px; cursor: pointer; font-weight: 700; font-size: 14px; }
.toolbar button:hover { background: #fff; }
.rich { border: 1px solid #ccc; border-radius: 0 0 6px 6px; padding: 16px; min-height: 360px; outline: none; background: #fff; }
.rich:focus { border-color: var(--ink); }
.title-in { font: 900 24px/1.3 var(--serif); }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; z-index: 6; }
.sticky-actions .btn { flex: 1 1 auto; }
.ai-busy { font-size: 14px; color: var(--ink-2); margin-top: 8px; }

.foot { border-top: 1px solid var(--ink); padding: 28px 16px 40px; text-align: center; color: var(--ink-3); font-size: 14px; }
.foot-logo { font: 900 24px var(--serif); color: var(--ink); letter-spacing: .06em; }
.foot a { text-decoration: underline; padding: 6px; display: inline-block; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(100px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 15px; z-index: 80; transition: transform .25s; max-width: calc(100vw - 32px); }
.toast.show { transform: translateX(-50%); }
