:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #202124;
  --muted: #777d86;
  --line: #d8dce2;
  --accent: #6657d9;
  --accent-soft: #eeebff;
  --topbar: #24242b;
  --topbar-text: #ffffff;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
}

:root.dark {
  --bg: #17181c;
  --surface: #222329;
  --surface-2: #2b2d34;
  --text: #eceef2;
  --muted: #a9aeb8;
  --line: #3a3d46;
  --accent: #a99cff;
  --accent-soft: #302d4d;
  --topbar: #111217;
  --topbar-text: #ffffff;
  --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: var(--topbar);
  color: var(--topbar-text);
  box-shadow: 0 1px 8px rgba(0,0,0,.18);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 190px;
  font-weight: 800;
  letter-spacing: .2px;
  color: inherit;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent);
}

.search {
  flex: 1;
  max-width: 620px;
  display: flex;
  height: 36px;
}

.search input {
  min-width: 0;
  flex: 1;
  border: 1px solid #4a4c55;
  border-right: 0;
  border-radius: 6px 0 0 6px;
  padding: 0 12px;
  outline: none;
  background: #fff;
  color: #222;
}

.search input:focus { border-color: var(--accent); }
.search button {
  border: 0;
  border-radius: 0 6px 6px 0;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.top-actions { margin-left: auto; }
.icon-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 20px;
}

.layout {
  min-height: calc(100vh - 58px);
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow: auto;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.sidebar-section + .sidebar-section { margin-top: 26px; }
.sidebar-title {
  margin: 0 10px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.sidebar-link {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--text);
}
.sidebar-link:hover { background: var(--surface-2); text-decoration: none; }
.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}
.button-link {
  border: 0;
  text-align: left;
  background: transparent;
  cursor: pointer;
}
.sidebar-note {
  margin: 28px 10px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.content { min-width: 0; padding: 28px; }
.article {
  max-width: 1180px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.article-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: 26px 30px 18px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
}
.article-head h1 {
  margin: 0;
  font-size: 38px;
  letter-spacing: -.7px;
}
.subtitle {
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
}
.revision {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.article-tabs { display: flex; gap: 5px; }
.tab {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 11px;
  background: var(--surface);
  color: var(--text);
}
.tab.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.notice {
  margin: 22px 30px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  line-height: 1.6;
}
.article-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 28px;
  padding: 26px 30px 60px;
}
.article-body {
  min-width: 0;
  line-height: 1.8;
  font-size: 15px;
}
.article-body section { scroll-margin-top: 78px; }
.article-body h2 {
  margin: 38px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 24px;
  letter-spacing: -.4px;
}
.article-body h2:first-child { margin-top: 0; }
.article-body h2 span { color: var(--accent); margin-right: 4px; }

.profile-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.profile-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.profile-row:first-child { border-top: 0; }
.profile-row a { word-break: break-all; }

.link-list {
  display: grid;
  gap: 12px;
}
.link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.link-item:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.badge-green { background: #1f9d62; }
.badge-red { background: #e53935; }
.badge-dark { background: #111; }
.badge-green-outline {
  background: transparent;
  color: #1f9d62;
  border: 1px solid #1f9d62;
}
.link-text {
  font-size: 15px;
  font-weight: 600;
}

.right-column { min-width: 0; }
.infobox {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.infobox-title {
  padding: 12px;
  background: var(--accent);
  color: white;
  text-align: center;
  font-weight: 800;
}
.infobox-signature {
  padding: 14px 14px 8px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.infobox-signature img {
  display: block;
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
  height: auto;
  border-radius: 6px;
}
.infobox dl { margin: 0; }
.infobox dl div {
  display: grid;
  grid-template-columns: 88px 1fr;
  border-top: 1px solid var(--line);
}
.infobox dt, .infobox dd {
  margin: 0;
  padding: 9px 10px;
  font-size: 13px;
}
.infobox dt {
  background: var(--surface-2);
  font-weight: 700;
}
.infobox dd { word-break: break-word; }

.toc {
  position: sticky;
  top: 78px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.toc-title { margin-bottom: 8px; font-weight: 800; }
.toc a {
  display: block;
  padding: 4px 3px;
  color: var(--muted);
  font-size: 13px;
}
.toc a:hover { color: var(--accent); text-decoration: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 18px);
  padding: 9px 14px;
  border-radius: 7px;
  background: #111;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  font-size: 13px;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.mobile-only { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 25;
    left: 0;
    top: 58px;
    width: 260px;
    transform: translateX(-102%);
    transition: transform .2s ease;
    box-shadow: 6px 0 20px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-block; }
  .brand { min-width: auto; }
  .brand span:last-child { display: none; }
  .content { padding: 14px; }
  .article-grid { grid-template-columns: 1fr; padding: 20px; }
  .article-head { padding: 22px 20px 16px; }
  .notice { margin: 18px 20px 0; }
  .right-column { order: -1; }
  .toc { position: static; }
}

@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .search button { padding: 0 11px; }
  .article-head h1 { font-size: 30px; }
  .subtitle { font-size: 17px; }
  .article-tabs { display: none; }
  .profile-row { grid-template-columns: 96px 1fr; }
  .link-item { align-items: flex-start; flex-direction: column; }
  .badge { min-width: auto; }
}


.infobox-photo {
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.infobox-photo img {
  display: block;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  height: auto;
  object-fit: contain;
}
.signature-inline {
  background: #fff;
}
.signature-inline img {
  display: block;
  width: 100%;
  max-width: 180px;
  height: auto;
  margin: 2px auto;
}
