:root {
  --bg: #0a0a0a;
  --bg-2: #111;
  --bg-3: #161616;
  --fg: #f5f5f5;
  --muted: #888;
  --line: #1f1f1f;
  --accent: #ff5b1f;
  --danger: #f87171;
  --max: 760px;
  --max-wide: 1280px;
  --layout-w: 1180px;
  --content-w: 760px;
  --sidebar-w: 300px;
}

[data-theme="light"] {
  --bg: #fafafa;
  --bg-2: #fff;
  --bg-3: #f0f0f0;
  --fg: #1a1a1a;
  --muted: #666;
  --line: #e5e5e5;
  --accent: #ff5b1f;
  --danger: #d73a49;
}
[data-theme="light"] body::before { display: none; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
               system-ui, "Apple SD Gothic Neo", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15.5px;
  line-height: 1.7;
  letter-spacing: -0.005em;
  word-break: keep-all;
  overflow-wrap: break-word;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none; z-index: -1;
}

a { color: inherit; text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent); }

.container { max-width: var(--max); margin: 0 auto; padding: 56px 24px 96px; }

/* 2-column layout: content + sticky sidebar */
.layout {
  max-width: var(--layout-w);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  gap: 56px;
  align-items: start;
}
.layout-content { min-width: 0; }
.sidebar {
  position: sticky; top: 80px;
  display: flex; flex-direction: column; gap: 22px;
  font-size: 0.9rem;
}
.sb-block {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px;
}
.sb-block h3 {
  margin: 0 0 10px; font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.sb-block h3::after { content: '.'; color: var(--accent); margin-left: 1px; }
.sb-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.sb-list li a {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 6px 8px; border-radius: 6px; color: var(--fg);
  transition: background .15s ease;
}
.sb-list li a:hover { background: var(--bg-3); text-decoration: none; }
.sb-list .cnt { font-size: 0.78rem; color: var(--muted); }
.sb-list.popular .ttl {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.85rem;
}
.sb-list.comments li a {
  flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 8px; border-bottom: 1px solid var(--line);
}
.sb-list.comments li:last-child a { border-bottom: 0; }
.sb-list.comments .cm-author { font-size: 0.78rem; color: var(--accent); font-weight: 600; }
.sb-list.comments .cm-text { font-size: 0.85rem; }
.sb-list.comments .cm-on { font-size: 0.72rem; color: var(--muted); }

.sb-search input {
  width: 100%; padding: 9px 12px; font-size: 0.9rem; font-family: inherit;
  background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
}
.sb-search input:focus { outline: none; border-color: var(--accent); }
.sb-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.sb-tags a {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--muted); font-size: 0.78rem; line-height: 1;
  transition: border-color .15s ease, color .15s ease;
}
.sb-tags a span {
  display: inline-block; padding: 1px 6px; border-radius: 999px;
  background: var(--bg-3); color: var(--muted); font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}
.sb-tags a:hover {
  color: var(--accent); border-color: var(--accent); text-decoration: none;
}
.sb-tags a:hover span { color: var(--accent); }
.sb-more {
  display: inline-block; margin-top: 10px; font-size: 0.8rem;
  color: var(--muted);
}
.sb-more:hover { color: var(--accent); }

/* === nav === */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 32px; max-width: var(--max-wide); margin: 0 auto;
}
.brand {
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em;
  display: inline-flex; align-items: baseline; gap: 8px;
}
.brand-text { color: var(--fg); }
.brand-dot { color: var(--accent); font-size: 1.4em; line-height: 0; }
.brand-sub { color: var(--muted); font-weight: 500; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }

.nav-right { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; font-size: 0.9rem; }

/* hamburger button (mobile only) */
.nav-hamburger {
  display: none; background: transparent; border: 0; cursor: pointer;
  width: 36px; height: 36px; padding: 8px; align-self: center;
  flex-direction: column; justify-content: space-around;
}
.nav-hamburger span {
  display: block; width: 100%; height: 2px;
  background: var(--fg); border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-active span:nth-child(2) { opacity: 0; }
.nav-hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-link { color: var(--muted); }
.nav-link:hover { color: var(--fg); }
.nav-link.rss { color: var(--accent); }
.nav-link.admin-link { color: var(--fg); }
.nav-portfolio {
  border-left: 1px solid var(--line); padding-left: 22px; color: var(--muted);
}

/* === page header === */
.page-title { margin: 0 0 8px; font-size: 1.9rem; letter-spacing: -0.02em; font-weight: 700; }
.page-title::after { content: '.'; color: var(--accent); }
.page-desc { color: var(--muted); margin: 0 0 36px; font-size: 0.96rem; }

/* === post list === */
.post-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 36px; }
.post-item { padding-bottom: 36px; border-bottom: 1px solid var(--line); }
.post-item:last-child { border-bottom: 0; }
.post-item .cover img {
  width: 100%; height: auto; border-radius: 10px; display: block;
  margin-bottom: 14px; border: 1px solid var(--line);
}
.post-item .meta {
  font-size: 0.78rem; color: var(--muted);
  display: flex; gap: 12px; align-items: center; margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.post-item .meta .cat { color: var(--accent); font-weight: 600; }
.post-item h2 {
  margin: 0 0 6px; font-size: 1.4rem; line-height: 1.3;
  letter-spacing: -0.015em; font-weight: 700;
}
.post-item h2 a { color: var(--fg); }
.post-item h2 a:hover { color: var(--accent); }
.post-item .subtitle { margin: 0 0 8px; color: var(--muted); font-size: 0.97rem; }
.post-item .excerpt {
  margin: 0; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-item .read-more {
  display: inline-block; margin-top: 10px; font-size: 0.85rem;
  color: var(--accent); font-weight: 600;
}
.post-item .read-more:hover { text-decoration: none; opacity: 0.8; }

.pager { margin-top: 48px; font-size: 0.9rem; }
.pager-row {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  justify-content: center; margin-bottom: 10px;
}
.pg-btn, .pg-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); background: var(--bg-2);
  text-decoration: none; transition: border-color .15s ease, color .15s ease;
}
.pg-btn:hover, .pg-num:hover { color: var(--fg); border-color: var(--muted); text-decoration: none; }
.pg-btn.disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.pg-num.current {
  color: #fff; background: var(--accent); border-color: var(--accent);
  font-weight: 600;
}
.pg-gap { color: var(--muted); padding: 0 4px; }
.pager-meta { text-align: center; color: var(--muted); font-size: 0.82rem; }
.pager-jump {
  display: flex; gap: 6px; justify-content: center; align-items: center;
  margin-top: 10px; font-size: 0.85rem; color: var(--muted);
}
.pager-jump input[type=number] {
  width: 80px; padding: 6px 10px; text-align: center;
  background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; font: inherit;
}
.pager-jump input[type=number]:focus { outline: none; border-color: var(--accent); }
.pager-jump .btn { padding: 6px 12px; font-size: 0.85rem; }

.empty { color: var(--muted); padding: 60px 0; text-align: center; font-size: 0.95rem; }

/* === post detail === */
.post .post-head { margin-bottom: 36px; }
.post .post-head .meta {
  font-size: 0.78rem; color: var(--muted);
  display: flex; gap: 12px; margin-bottom: 14px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.post .post-head .meta .cat { color: var(--accent); font-weight: 600; }
.post .post-head .meta .author { color: var(--muted); }
.post h1 { margin: 0 0 10px; font-size: 2.1rem; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; }
.post .post-head .subtitle { margin: 0 0 18px; color: var(--muted); font-size: 1.05rem; }
.post .post-head .cover { width: 100%; border-radius: 10px; margin-top: 18px; border: 1px solid var(--line); }

.post-body { font-size: 1.02rem; }
.post-body h1, .post-body h2, .post-body h3 {
  margin-top: 1.7em; line-height: 1.3; letter-spacing: -0.015em; font-weight: 700;
}
.post-body h2 { font-size: 1.45rem; }
.post-body h3 { font-size: 1.18rem; }
.post-body p { margin: 1.05em 0; }
.post-body img { max-width: 100%; height: auto; border-radius: 8px; }
.post-body a { color: var(--accent); border-bottom: 1px dashed rgba(255,91,31,0.4); }
.post-body a:hover { border-bottom-color: var(--accent); }
.post-body pre {
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 16px 18px; border-radius: 8px; overflow-x: auto; font-size: 0.9em;
}
.post-body code {
  background: var(--bg-2); padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.92em;
  color: #e6e6e6; border: 1px solid var(--line);
}
.post-body pre code { background: transparent; padding: 0; border: 0; }
.post-body blockquote {
  border-left: 3px solid var(--accent); padding: 4px 16px;
  color: var(--muted); margin: 1.4em 0; font-style: italic;
}
.post-body table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.95em; }
.post-body th, .post-body td { border: 1px solid var(--line); padding: 8px 12px; }
.post-body th { background: var(--bg-2); font-weight: 600; }

.post-tags { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 8px; }
.post-tags a {
  background: var(--bg-2); color: var(--accent);
  padding: 4px 12px; border-radius: 999px; font-size: 0.82rem;
  border: 1px solid var(--line);
}
.post-tags a:hover { background: rgba(255,91,31,0.1); border-color: var(--accent); }

.admin-edit { margin-top: 28px; font-size: 0.88rem; color: var(--muted); }
.admin-edit a { color: var(--muted); border: 1px solid var(--line); padding: 4px 10px; border-radius: 6px; }
.admin-edit a:hover { color: var(--accent); border-color: var(--accent); }

/* === login === */
.login-box {
  max-width: 360px; margin: 80px auto 60px;
  background: var(--bg-2); padding: 36px 32px;
  border: 1px solid var(--line); border-radius: 12px;
}
.login-box h1 { margin: 0 0 20px; font-size: 1.3rem; letter-spacing: -0.01em; }
.login-box label {
  display: block; margin-bottom: 14px;
  font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.login-box input {
  width: 100%; padding: 10px 12px; margin-top: 6px;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; font-size: 0.95rem;
  font-family: inherit; transition: border-color .15s ease;
}
.login-box input:focus { outline: none; border-color: var(--accent); }
.login-box button {
  width: 100%; padding: 11px; margin-top: 6px;
  background: var(--accent); color: #fff;
  border: 0; border-radius: 8px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: opacity .15s ease;
}
.login-box button:hover { opacity: 0.9; }
.login-box .error { color: var(--danger); margin: 0 0 14px; font-size: 0.88rem; }

/* === admin === */
.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.admin-head h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
.admin-head h1::after { content: '.'; color: var(--accent); }
.actions { display: flex; gap: 8px; }

.btn {
  display: inline-block; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--fg); cursor: pointer;
  font-size: 0.9rem; font-family: inherit;
  transition: border-color .15s ease, background .15s ease;
}
.btn:hover { border-color: var(--muted); background: var(--bg-3); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { opacity: 0.9; background: var(--accent); border-color: var(--accent); }

.admin-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 0.92rem;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table th {
  background: var(--bg-3); font-weight: 600; position: sticky; top: 0; z-index: 2;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
}
.admin-table tbody tr { transition: background .15s ease; }
.admin-table tbody tr:hover { background: var(--bg-3); }
.admin-table input[type=checkbox] { cursor: pointer; }
.status {
  font-size: 0.72rem; padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.06em;
  border: 1px solid var(--line);
}
.status-PUBLISHED { background: rgba(34,197,94,0.1); color: #4ade80; border-color: rgba(34,197,94,0.3); }
.status-DRAFT { background: rgba(234,179,8,0.1); color: #facc15; border-color: rgba(234,179,8,0.3); }
.status-ARCHIVED { background: var(--bg-3); color: var(--muted); }
.row-actions { white-space: nowrap; }
.row-actions a, .row-actions button { font-size: 0.85rem; margin-right: 8px; color: var(--muted); }
.row-actions a:hover { color: var(--accent); }
.link-danger { background: none; border: 0; color: var(--danger) !important; cursor: pointer; padding: 0; font-family: inherit; }

/* === post form === */
.post-form { display: grid; gap: 16px; margin-top: 8px; }
.post-form label {
  display: block; font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.post-form input[type=text], .post-form textarea, .post-form select {
  width: 100%; padding: 10px 12px;
  background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.95rem; font-family: inherit; margin-top: 6px;
  transition: border-color .15s ease;
}
.post-form input[type=text]:focus, .post-form textarea:focus, .post-form select:focus {
  outline: none; border-color: var(--accent);
}
.post-form .md-area {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.92rem; line-height: 1.6; min-height: 480px;
}
.post-form .row { display: flex; gap: 16px; }
.post-form .row label { flex: 1; }
.post-form .row label.grow { flex: 2; }
.post-form .check {
  display: flex; align-items: center; gap: 8px;
  padding-top: 26px; text-transform: none; letter-spacing: 0; font-size: 0.9rem;
  color: var(--fg);
}
.post-form .actions { margin-top: 24px; display: flex; gap: 10px; }

.post-form-grid {
  display: grid; grid-template-columns: 1fr 320px; gap: 24px;
  margin-top: 8px;
}
.post-form-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.post-form-side { display: flex; flex-direction: column; gap: 14px; }
.side-block {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.side-block h3 {
  margin: 0 0 4px; font-size: 0.72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.side-block h3::after { content: '.'; color: var(--accent); }
.lbl-stack { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; }
.lbl-stack .lbl-text { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.big-input { font-size: 1.1rem; font-weight: 600; }
.btn.full { width: 100%; padding: 10px; font-size: 0.95rem; }

.upload-helper {
  margin-top: 36px; padding: 16px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
}
.upload-helper summary {
  cursor: pointer; font-size: 0.9rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.upload-helper input[type=file] {
  margin: 12px 0; color: var(--muted);
}
.upload-helper input[type=text] {
  width: 100%; margin-top: 8px;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
  font-size: 0.88rem; font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.upload-helper button {
  background: var(--bg-3); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 14px; font-size: 0.88rem; cursor: pointer;
}
.upload-helper button:hover { border-color: var(--accent); }

/* === footer === */
.site-footer {
  border-top: 1px solid var(--line); padding: 28px 0;
  color: var(--muted); font-size: 0.82rem; margin-top: 64px;
}
.site-footer .container {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 0; padding-bottom: 0;
}
.site-footer .footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 0; padding-bottom: 0;
}
.site-footer .footer-links {
  display: flex; gap: 14px 18px; flex-wrap: wrap;
}
.site-footer .footer-links a { color: var(--muted); }
.site-footer .footer-links a:hover { color: var(--accent); }

/* === theme toggle btn === */
.theme-toggle {
  background: transparent; border: 1px solid var(--line);
  color: var(--muted); cursor: pointer;
  border-radius: 6px; padding: 4px 10px; font: inherit;
  font-size: 1rem; line-height: 1;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* === search form === */
.search-form {
  display: flex; gap: 8px; margin: 16px 0 28px;
}
.search-form input[type=search] {
  flex: 1; padding: 12px 14px; font-size: 1rem;
  background: var(--bg-2); color: var(--fg); font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .15s ease;
}
.search-form input[type=search]:focus { outline: none; border-color: var(--accent); }
.search-form .btn { padding: 0 22px; font-size: 0.95rem; }

/* === tags index === */
.tag-cloud {
  list-style: none; padding: 0; margin: 24px 0 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tag-cloud li a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-2); color: var(--muted);
  transition: border-color .15s ease, color .15s ease;
}
.tag-cloud li a:hover {
  color: var(--accent); border-color: var(--accent); text-decoration: none;
}
.tag-cloud .tag-name { font-weight: 600; }
.tag-cloud .tag-count { font-size: 0.78rem; color: var(--muted); }

/* === post prev/next === */
.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line);
}
.post-nav a {
  display: block; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-2);
  transition: border-color .15s ease, background .15s ease;
}
.post-nav a:hover { border-color: var(--accent); text-decoration: none; }
.post-nav-next { text-align: right; }
.post-nav .lbl {
  display: block; font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px;
}
.post-nav .ttl { font-weight: 600; color: var(--fg); font-size: 0.95rem; }

/* === comments === */
.comments {
  margin-top: 60px; padding-top: 28px;
  border-top: 1px solid var(--line);
}
.comments h2 {
  font-size: 1.2rem; letter-spacing: -0.01em; margin-bottom: 18px;
}
.comments h2::after { content: '.'; color: var(--accent); }
.comments h2 .cnt {
  display: inline-block; margin-left: 6px; font-size: 0.85rem;
  color: var(--muted); font-weight: 500;
}
.comment-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 14px; }
.comment {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px;
}
.comment header {
  display: flex; gap: 10px; align-items: center; margin-bottom: 6px;
  font-size: 0.85rem; color: var(--muted);
}
.comment .author { color: var(--fg); font-weight: 600; }
.comment p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.empty-comments { padding: 18px 0; text-align: center; }

.comment-form {
  display: grid; gap: 10px; margin-top: 12px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px;
}
.comment-form .row { display: flex; gap: 10px; }
.comment-form .row input { flex: 1; }
.comment-form input, .comment-form textarea {
  padding: 9px 11px; background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px;
  font-family: inherit; font-size: 0.92rem;
}
.comment-form input:focus, .comment-form textarea:focus {
  outline: none; border-color: var(--accent);
}
.comment-form .btn { justify-self: end; }

/* === admin tabs === */
/* admin: full width — no sidebar */
.admin-layout {
  grid-template-columns: 1fr !important;
  max-width: var(--max-wide) !important;
}
.admin-layout .layout-content { max-width: none; }

/* error pages: 1col, narrow centered */
.err-layout {
  grid-template-columns: 1fr !important;
  max-width: 720px !important;
}
.err-layout .layout-content { max-width: none; text-align: center; }

.admin-stats {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
  margin: 18px 0 24px;
}
.stat-card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
  transition: border-color .15s ease, transform .15s ease;
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.stat-card::after {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  opacity: 0.08;
}
.stat-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--fg); letter-spacing: -0.02em; line-height: 1; }
.text-ok    { color: #4ade80; }
.text-warn  { color: #facc15; }
.text-muted { color: var(--muted); }

.admin-filters {
  display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
}
.admin-filters input[type=search],
.admin-filters select {
  padding: 8px 12px; background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 0.9rem;
}
.admin-filters input[type=search] { flex: 1; min-width: 180px; }
.admin-filters input[type=search]:focus,
.admin-filters select:focus { outline: none; border-color: var(--accent); }

.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--bg-2); border: 1px solid var(--accent); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 12px; position: sticky; top: 70px; z-index: 5;
}
.bulk-bar .sel-count { color: var(--muted); margin-right: auto; font-size: 0.9rem; }
.bulk-bar .sel-count strong { color: var(--accent); font-size: 1rem; }

.cat-chip {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  background: var(--bg-3); color: var(--muted); font-size: 0.78rem;
  border: 1px solid var(--line);
}
.cell-title { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.admin-tabs {
  display: flex; gap: 4px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.admin-tabs .tab {
  padding: 8px 14px; color: var(--muted);
  border: 1px solid transparent; border-bottom: 0;
  border-radius: 6px 6px 0 0; font-size: 0.9rem;
}
.admin-tabs .tab:hover { color: var(--fg); text-decoration: none; }
.admin-tabs .tab.active {
  color: var(--accent); background: var(--bg-2);
  border-color: var(--line);
}

.quick-status {
  background: var(--bg-2); color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 2px 8px; font-size: 0.8rem; cursor: pointer;
  margin-right: 4px;
}
.quick-status:hover { color: var(--accent); border-color: var(--accent); }

/* toast */
.toast-host {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; font-size: 0.9rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ok  { border-color: rgba(34,197,94,0.5); color: #4ade80; }
.toast-err { border-color: rgba(248,113,113,0.5); color: var(--danger); }

/* === error pages === */
.errpage {
  text-align: center; padding: 60px 0 40px;
}
.errcode {
  font-size: 6rem; font-weight: 900; letter-spacing: -0.05em;
  color: var(--accent); line-height: 1; margin-bottom: 20px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.errcode.err500 { color: var(--danger); }
.errpage h1 { margin: 0 0 10px; font-size: 1.5rem; letter-spacing: -0.01em; }
.errpath {
  margin: 18px auto 28px; padding: 10px 14px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85rem;
  color: var(--muted); word-break: break-all; max-width: 520px;
}
.erract { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.errcats {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; align-items: center;
  font-size: 0.9rem;
}
.errcats a {
  padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-2); color: var(--muted);
}
.errcats a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* === responsive === */
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .sidebar { position: static; order: 2; }
}

@media (max-width: 720px) {
  .nav-inner { padding: 14px 20px; }
  .nav-hamburger { display: flex; }
  .nav-right {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    gap: 0; padding: 8px 0; font-size: 0.95rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  }
  .nav-right.nav-open { display: flex; }
  .nav-right .nav-link {
    padding: 12px 24px; border-bottom: 1px solid var(--line);
  }
  .nav-right .nav-link:last-child { border-bottom: 0; }
  .nav-portfolio { border-left: 0; padding-left: 24px; margin-left: 0; }
  .container { padding: 36px 20px 72px; }
  .post h1 { font-size: 1.7rem; }
  .post-item h2 { font-size: 1.2rem; }
  .admin-table { font-size: 0.85rem; }
  .admin-table th, .admin-table td { padding: 8px 8px; }
  .post-form .row { flex-direction: column; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .post-form-grid { grid-template-columns: 1fr; }
  .admin-filters { flex-direction: column; }
  .admin-filters input[type=search] { min-width: 0; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { text-align: left; }
  .comment-form .row { flex-direction: column; }
  .search-form { flex-direction: column; }
}

/* ======================
   AdSense 광고 슬롯
   ====================== */
.ad-slot { margin: 32px auto; max-width: 100%; }
.ad-rail {
  position: fixed; top: 100px; width: 160px; z-index: 5;
}
.ad-rail--left  { left: 16px; }
.ad-rail--right { right: 16px; }
.ad-rail__label {
  display: block; font-size: 10px; opacity: 0.5;
  letter-spacing: 0.12em; margin-bottom: 4px;
}
@media (max-width: 1280px) {
  .ad-rail { display: none; }
}

/* ── 읽기 진행바 ── */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--accent); z-index: 200;
  transition: width .1s linear;
  border-radius: 0 2px 2px 0;
  pointer-events: none;
}

/* ── 목차(TOC) ── */
.toc-box {
  margin: 0 0 32px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px;
  font-size: 0.9rem;
}
.toc-toggle {
  cursor: pointer; font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  list-style: none; user-select: none;
}
.toc-toggle::-webkit-details-marker { display: none; }
.toc-toggle::before { content: '▶ '; font-size: 0.65em; }
details[open] .toc-toggle::before { content: '▼ '; }
.toc-nav { margin-top: 10px; }
.toc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.toc-item a {
  display: block; padding: 4px 8px; border-radius: 5px;
  color: var(--muted); transition: color .15s ease, background .15s ease;
  line-height: 1.4;
}
.toc-item a:hover { color: var(--fg); background: var(--bg-3); text-decoration: none; }
.toc-item a.toc-active { color: var(--accent); background: rgba(255,91,31,0.08); font-weight: 600; }
.toc-h3 { padding-left: 14px; }
.toc-h3 a { font-size: 0.88rem; }

/* ── 관련글 ── */
.related-posts {
  margin-top: 56px; padding-top: 28px;
  border-top: 1px solid var(--line);
}
.related-posts__title {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em;
  margin: 0 0 18px; color: var(--muted);
  text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.06em;
}
.related-posts__title::after { content: '.'; color: var(--accent); }
.related-posts__list {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.related-posts__item a {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden;
  transition: border-color .15s ease, transform .15s ease;
  height: 100%;
}
.related-posts__item a:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.related-posts__thumb {
  width: 100%; height: 120px; object-fit: cover; display: block;
  border-bottom: 1px solid var(--line);
}
.related-posts__info {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px 12px;
}
.related-posts__ttl {
  font-weight: 600; font-size: 0.92rem; color: var(--fg);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.4;
}
.related-posts__excerpt {
  font-size: 0.8rem; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.related-posts__date { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

/* ── 최근 본 글 ── */
.recently-viewed {
  margin-top: 48px; padding: 16px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
}
.recently-viewed__title {
  margin: 0 0 12px; font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.recently-viewed__title::after { content: '.'; color: var(--accent); }
.recently-viewed__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.rv-item a {
  display: block; padding: 6px 8px; border-radius: 6px;
  color: var(--muted); font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .15s ease, background .15s ease;
}
.rv-item a:hover { color: var(--accent); background: var(--bg-3); text-decoration: none; }

/* 광고 가로 오버플로우 방지 — 모바일에서 AdSense ins / 970·728 모비온 iframe 넘침 차단 */
ins.adsbygoogle { max-width: 100% !important; overflow: hidden !important; display: block; }
.mobonslot iframe, .adslot iframe, ins.adsbygoogle iframe,
iframe[src*="mobon"], iframe[src*="mediacategory"], iframe[src*="googlesyndication"] { max-width: 100% !important; }
html, body { overflow-x: hidden; max-width: 100%; }


/* === 좁은 화면 콘텐츠 짤림 방지 (2026-06-24) === */
.post-body img, .post-body video, .post-body iframe, .post-body svg,
.post-body embed, .post-body object,
.post-item img, .related-posts img, .recently-viewed img { max-width: 100%; height: auto; }
.post-body table { display: block; max-width: 100%; overflow-x: auto; }
.post-body pre { max-width: 100%; overflow-x: auto; }
.post-body, .post-item .excerpt, .post-item h2, .post-item .subtitle,
.post h1, .post-head h1, .page-title, .related-posts__title {
  overflow-wrap: break-word; word-break: break-word; min-width: 0;
}
.layout-content, .post-list, .post-item, .post, .post-body, .related-posts { min-width: 0; max-width: 100%; }
@media (max-width: 420px) {
  .container { padding-left: 14px; padding-right: 14px; }
  .post-item h2 { font-size: 1.12rem; }
  .post h1, .post-head h1 { font-size: 1.45rem; }
}

@media (max-width: 600px) {
  .site-footer .footer-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .site-footer .container { flex-direction: column; align-items: flex-start; }
}
