:root {
  --bg: #FFFFFF;
  --fg: #736955;
  --muted: rgba(115, 105, 85, 0.75);
  --border: rgba(0, 0, 0, 0.1);
  --accent: #EFB33A;
  --sidebar-bg: #FFFDF0;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --fg: #e0e0e0;
  --muted: rgba(224, 224, 224, 0.75);
  --border: rgba(255, 255, 255, 0.1);
  --accent: #EFB33A;
  --sidebar-bg: #2a2a2a;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--accent); }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 280px;
  flex: 0 0 280px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  padding-bottom: 24px;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.header-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

#closeSidebar {
  display: none;
  font-size: 16px;
  line-height: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
  color: var(--fg);
}
#closeSidebar:hover { background: rgba(0, 0, 0, 0.03); }

[data-theme="dark"] #closeSidebar:hover { background: rgba(255, 255, 255, 0.05); }

#closeSidebar:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(239,179,58,0.25);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  padding: 0;
  transition: all .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.toggle-track {
  width: 100%;
  height: 100%;
  background: #e0e0e0;
  border-radius: 14px;
  position: relative;
  transition: background .2s ease;
}

[data-theme="dark"] .toggle-track {
  background: var(--accent);
}

.toggle-slider {
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 4px;
  left: 4px;
  transition: transform .2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .toggle-slider {
  transform: translateX(22px);
  background: var(--sidebar-bg);
}

.theme-toggle:hover .toggle-track {
  opacity: 0.8;
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(239,179,58,0.25);
}

.theme-icon {
  font-size: 16px;
  line-height: 1;
}



.nav-list { padding: 8px; }

.nav-section-header {
  margin: 16px 0 8px 0;
  padding: 0 12px;
  font-size: 16px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.nav-section-header:first-child {
  margin-top: 8px;
}

.nav-item {
  display: block;
  padding: 10px 12px 10px 24px;
  margin: 4px 0;
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
}

.nav-list a:hover { background: rgba(0, 0, 0, 0.03); }
.nav-list a.active {
  background: rgba(239, 179, 58, 0.15);
  color: var(--accent);
}

.content-wrap { flex: 1 1 auto; min-width: 0; }

.hamburger {
  display: none;
  margin: 12px 16px 0;
  font-size: 20px;
  line-height: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
  color: var(--fg);
}
.hamburger:hover { background: rgba(0, 0, 0, 0.03); }

[data-theme="dark"] .hamburger:hover { background: rgba(255, 255, 255, 0.05); }

.hamburger:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(239,179,58,0.25);
}

.content {
  max-width: 820px;
  margin: 24px auto 80px;
  padding: 0 24px 0 24px;
}
.content .empty { color: var(--muted); }

.content h1, .content h2, .content h3,
.content h4, .content h5, .content h6 {
  line-height: 1.3;
  margin: 32px 0 16px;
  font-weight: 700;
}
.content h1 { font-size: 2rem; }
.content h2 { font-size: 1.6rem; }
.content h3 { font-size: 1.25rem; }

.content p { 
  line-height: 2.0; 
  margin: 18px 0; 
  text-indent: 0;
  padding: 0;
  letter-spacing: 0.02em;
}
.content ul, .content ol { padding-left: 1.4em; margin: 16px 0; }
.content li { 
  margin: 12px 0; 
  line-height: 1.8;
  padding-left: 4px;
}

.content img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.content blockquote {
  margin: 16px 0;
  padding: 8px 12px;
  border-left: 4px solid var(--border);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .content blockquote {
  background: rgba(255, 255, 255, 0.05);
}

.content aside {
  display: block;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: rgba(239,179,58,0.08);
  color: var(--fg);
}

[data-theme="dark"] .content aside {
  background: rgba(239,179,58,0.15);
}
.content aside p { margin: 6px 0; }
.content aside > :first-child { margin-top: 0; }

.content pre { overflow: auto; }
.content pre, .content code {
  font-family: "D2Coding", monospace;
}
.content pre code {
  display: block;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: normal !important;
  color: var(--fg) !important;
  font-style: normal !important;
  text-decoration: none !important;
}

[data-theme="dark"] .content pre code {
  background: rgba(255, 255, 255, 0.05);
}

.content :not(pre) > code {
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: normal !important;
  color: var(--fg) !important;
  font-style: normal !important;
  text-decoration: none !important;
}

[data-theme="dark"] .content :not(pre) > code {
  background: rgba(255, 255, 255, 0.05);
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.95rem;
}
.content th, .content td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.content thead th { background: var(--sidebar-bg); }

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    height: 100vh;
    box-shadow: 0 2px 20px rgba(0,0,0,0.12);
    transition: left .2s ease;
    z-index: 1000;
  }
  body.sidebar-open .sidebar { left: 0; }
  #closeSidebar { display: inline-flex; }
  .hamburger { display: inline-flex; }
}
