:root {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --fg: #c9d1d9;
  --fg-muted: #8b949e;
  --accent: #58a6ff;
  --border: #30363d;
  --code-bg: #161b22;
  --max-width: 720px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
               "Noto Sans KR", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
  font-size: 17px;
}

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

/* header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}
.site-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.site-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg);
  text-decoration: none;
}
.site-nav-link {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.site-nav-link:hover { color: var(--accent); }

/* main */
main.wrap { padding-top: 40px; padding-bottom: 60px; min-height: 60vh; }

.home-intro p { color: var(--fg-muted); }
.home-intro a { color: var(--accent); }

/* chapters */
.chapter + .chapter { margin-top: 48px; }
.chapter-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  margin: 40px 0 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.chapter:first-of-type .chapter-title { margin-top: 32px; }

/* post list */
.post-list { list-style: none; padding: 0; margin: 32px 0 0; }
.post-list-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.post-list-item:first-child { padding-top: 0; }
.post-list-date {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.post-list-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
}
.post-list-title:hover { color: var(--accent); }
.post-list-desc {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin: 6px 0 0;
}

/* post */
.post-header { margin-bottom: 32px; }
.post-title { font-size: 1.7rem; margin: 0 0 8px; line-height: 1.35; }

.post-content h2 {
  font-size: 1.3rem;
  margin-top: 2.2em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
}
.post-content h3 { font-size: 1.1rem; margin-top: 1.8em; }
.post-content p { margin: 1em 0; }
.post-content a { color: var(--accent); }
.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content strong { color: #fff; }
.post-content { word-break: keep-all; overflow-wrap: break-word; }

/* tables */
.post-content table {
  display: block;
  overflow-x: auto;
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.92rem;
}
.post-content th, .post-content td {
  padding: 8px 14px;
  border: 1px solid var(--border);
  text-align: left;
  word-break: keep-all;
}
.post-content th {
  background: var(--bg-alt);
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
}

/* demo images (스크린샷, 나란히) */
.demo-images {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 24px 0 0;
}
.demo-images figure {
  flex: 1 1 45%;
  min-width: 260px;
  margin: 0;
}
.demo-images img {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}
.demo-images figcaption {
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin: 8px 0 0;
}

/* image lightbox (click to enlarge, used on .demo-images img) */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox-overlay.active { display: flex; }
.lightbox-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* demo videos (동시 재생, 위아래로 크게) */
.demo-videos {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin: 24px 0 0;
}
.demo-video-item { width: 100%; }
.demo-video-item video {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #000;
}
.demo-video-label {
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin: 8px 0 0;
}
.demo-play-btn {
  display: block;
  margin: 20px auto 0;
  padding: 10px 22px;
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.demo-play-btn:hover { opacity: 0.85; }

.post-back { margin-top: 48px; }
.post-back a { color: var(--fg-muted); text-decoration: none; }
.post-back a:hover { color: var(--accent); }

/* code */
code {
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  line-height: 1.5;
}
pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
}

/* rouge syntax highlighting (minimal) */
.highlight .k, .highlight .kd, .highlight .kt { color: #ff7b72; }   /* keyword */
.highlight .s, .highlight .s1, .highlight .s2 { color: #a5d6ff; }  /* string */
.highlight .c, .highlight .c1, .highlight .cm { color: #8b949e; font-style: italic; } /* comment */
.highlight .n, .highlight .nf { color: #d2a8ff; }                  /* name/function */
.highlight .mi, .highlight .mf { color: #79c0ff; }                 /* number */
.highlight .o { color: #ff7b72; }                                  /* operator */

/* footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .post-title { font-size: 1.4rem; }
}
