@charset "utf-8";
@import url('https://fonts.googleapis.com/css2?family=Inconsolata&display=swap');
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --family-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --family-code: "Inconsolata", "Nanum Gothic Coding", "D2Coding", monospace;

  --bg-color: #ffffff;
  --text-color: #333333;
  --text-muted: #757575;
  --border-color: #e0e0e0;

  --primary: #037c6e;
  --primary-hover: #025043;
  --accent: #025043;
  --accent-light: rgba(2, 80, 67, 0.08);

  --header-bg: #ffffff;
  --header-text: #333333;
  --card-bg: #ffffff;
  --code-bg: #f5f5f5;
  --dropdown-bg: #ffffff;
  --dropdown-hover: #f0fdf9;
  --container-max-width: 1024px;
}

[data-theme="dark"] {
  --bg-color: #1e1e1e;
  --text-color: #e0e0e0;
  --text-muted: #9e9e9e;
  --border-color: #333333;

  --primary: #26a69a;
  --primary-hover: #80cbc4;
  --accent: #80cbc4;
  --accent-light: rgba(128, 203, 196, 0.12);

  --header-bg: #181818;
  --header-text: #e0e0e0;
  --card-bg: #242424;
  --code-bg: #2d2d2d;
  --dropdown-bg: #242424;
  --dropdown-hover: #2e3835;
}

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

html {
  font-size: 14pt !important;
}

@media screen and (min-width: 100em) {
  html {
    font-size: 14pt !important;
  }
}

@media screen and (min-width: 125em) {
  html {
    font-size: 14pt !important;
  }
}

body {
  font-family: var(--family-sans);
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text-color);
  background-color: var(--bg-color);
  max-width: var(--container-max-width);
  margin: 0 auto !important;
  transition: background-color 0.2s, color 0.2s;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Header & Navbar (Slim & Tight)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.header-inner {
  max-width: var(--container-max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 1.25rem; /* Tight slim height */
  height: 48px;
  gap: 1.2rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.drawer-btn {
  display: none; /* Desktop hidden */
  background: none;
  border: none;
  color: var(--header-text);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--header-text);
  text-decoration: none !important;
  line-height: 1;
}

.site-logo img {
  height: 26px;
  width: auto;
  display: block;
}

/* Desktop Navigation & Dropdowns */
.site-nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  height: 100%;
}

.nav-item {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--header-text);
  padding: 0.3rem 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  text-decoration: none !important;
  transition: color 0.15s;
}

.nav-link:hover, .nav-item:hover .nav-link {
  color: var(--primary);
}

.nav-link .arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.nav-item:hover .nav-link .arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--dropdown-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  padding: 0.4rem 0;
  min-width: 170px;
  display: none;
  z-index: 150;
}

.nav-item.has-dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  color: var(--text-color);
  text-decoration: none !important;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: var(--dropdown-hover);
  color: var(--primary);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theme-btn {
  background: none;
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  color: var(--text-color);
}
.theme-btn:hover {
  background: var(--code-bg);
}

/* Search Box */
.search-box {
  position: relative;
}
.search-box input {
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 0.85rem;
  font-family: var(--family-sans);
  outline: none;
  width: 150px;
  height: 30px;
  transition: width 0.2s;
}
.search-box input:focus {
  width: 200px;
  border-color: var(--primary);
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  display: none;
  z-index: 200;
}

/* ==========================================================================
   Mobile Drawer Navigation
   ========================================================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 290;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.drawer-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.drawer-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: var(--bg-color);
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
}

.drawer-menu.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.drawer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--text-color);
  text-decoration: none !important;
}

.drawer-close-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
}

.drawer-nav {
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
}

.drawer-link {
  padding: 0.65rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-color);
  text-decoration: none !important;
}
.drawer-link:hover {
  background: var(--dropdown-hover);
  color: var(--primary);
}

.drawer-group {
  margin-bottom: 0.5rem;
}

.drawer-group-title {
  padding: 0.6rem 1.5rem 0.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.drawer-group-title a {
  color: inherit;
  text-decoration: none;
}

.drawer-group-items {
  display: flex;
  flex-direction: column;
}

.drawer-item {
  padding: 0.5rem 1.5rem 0.5rem 2.2rem;
  font-size: 0.95rem;
  color: var(--text-color);
  text-decoration: none !important;
}
.drawer-item:hover {
  background: var(--dropdown-hover);
  color: var(--primary);
}

/* Responsive breakpoint */
@media screen and (max-width: 768px) {
  .site-nav {
    display: none; /* Hide topbar links on mobile */
  }
  .drawer-btn {
    display: flex; /* Show hamburger button */
  }
  .search-box input {
    width: 120px;
  }
  .search-box input:focus {
    width: 160px;
  }
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-container {
  max-width: var(--container-max-width);
  margin: 2rem auto;
  padding: 0 1.25rem;
  min-height: 70vh;
}

.content-page, .section-container, .blog-container {
  max-width: 100%;
}

.page-body, .section-body {
  margin-top: 1.5rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--family-sans);
  color: var(--text-color);
  font-weight: 700;
  line-height: 1.4;
}

h1 {
  font-size: 2.1rem;
  margin-top: 1.8rem;
  margin-bottom: 1.2rem;
}

h2 {
  font-size: 1.55rem;
  margin-top: 2rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-color);
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.6rem;
  margin-bottom: 0.55rem;
}

p {
  margin-bottom: 1.25rem;
  word-break: keep-all;
  overflow-wrap: break-word;
}

ul, ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.35rem;
}

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2.2rem 0;
}

blockquote {
  border-left: 4px solid var(--primary);
  margin: 1.5rem 0;
  color: var(--text-muted);
  background: var(--accent-light);
  padding: 0.8rem 1.2rem;
  border-radius: 0 4px 4px 0;
}

code {
  font-family: var(--family-code);
  font-size: 0.9em;
  background-color: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

pre {
  background-color: var(--code-bg);
  padding: 1.1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.95em;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.5rem 0;
}

/* Post Header & Meta */
.post-header {
  margin-bottom: 1.8rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

.post-title {
  font-size: 2.2rem;
  margin-top: 0;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
}

.tag {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--primary);
  background: var(--accent-light);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-right: 0.3rem;
}

/* Blog List Cards */
.posts-list .post-card {
  padding: 1.8rem 0;
  border-bottom: 1px solid var(--border-color);
}

.post-card-header h2 {
  font-size: 1.5rem;
  border-bottom: none;
  margin-top: 0;
  margin-bottom: 0.35rem;
}

.post-card-header h2 a {
  color: var(--text-color);
}
.post-card-header h2 a:hover {
  color: var(--primary);
  text-decoration: none;
}

.post-card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.post-card-summary {
  color: var(--text-color);
  line-height: 1.7;
}

.read-more {
  display: inline-block;
  margin-top: 0.75rem;
  font-weight: 600;
  color: var(--primary);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2.8rem;
}

/* ==========================================================================
   Page Layout & Table of Contents (ToC)
   ========================================================================== */

/* Default layout (no ToC) */
.page-layout {
  width: 100%;
}

.page-content-area {
  width: 100%;
  min-width: 0;
}

/* Desktop layout with ToC (min-width: 861px) */
@media screen and (min-width: 861px) {
  .page-layout.has-toc {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 2.5rem;
  }

  .toc-sidebar {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding-right: 0.8rem;
    border-right: 1px solid var(--border-color);
  }

  .toc-summary {
    list-style: none;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    user-select: none;
  }
  .toc-summary::-webkit-details-marker {
    display: none;
  }
  .toc-icon {
    display: none;
  }

  .toc-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
  }

  .page-content-area {
    flex: 1;
    min-width: 0;
  }
}

/* Common ToC nav styles (Clean, unboxed typography list) */
.toc-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-nav li {
  margin-bottom: 0.35rem;
  line-height: 1.45;
}

.toc-nav a {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
  display: block;
  word-break: keep-all;
}

.toc-nav a:hover {
  color: var(--primary);
  text-decoration: none;
}

/* Nested headings indentation with subtle guide line */
.toc-nav ul ul {
  padding-left: 0.85rem;
  margin-top: 0.25rem;
  border-left: 1px solid var(--border-color);
}

.toc-nav ul ul a {
  font-size: 0.84rem;
}

/* Subtle scrollbar for ToC */
.toc-sidebar::-webkit-scrollbar {
  width: 4px;
}
.toc-sidebar::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}

/* Mobile collapsible styles (max-width: 860px) */
@media screen and (max-width: 860px) {
  .page-layout.has-toc {
    display: block;
  }

  .toc-sidebar {
    width: 100%;
    margin-bottom: 1.5rem;
    border-right: none;
  }

  .toc-collapsible {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.6rem;
  }

  .toc-summary {
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0;
    user-select: none;
    list-style: none;
  }
  .toc-summary::-webkit-details-marker {
    display: none;
  }

  .toc-title {
    color: var(--primary);
  }

  .toc-icon {
    display: inline-block;
    font-size: 0.8rem;
    transition: transform 0.2s;
  }

  .toc-collapsible[open] .toc-icon {
    transform: rotate(180deg);
  }

  .toc-nav {
    margin-top: 0.6rem;
    padding-left: 0.4rem;
    max-height: 280px;
    overflow-y: auto;
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 2.2rem 1.25rem;
  margin-top: 3.5rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: var(--container-max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
