/* ds.css — DataSketchers design system ported into MkDocs Material.
   Replicates the Astro site's tokens + header/footer so the wiki chrome matches the main site. */

/* ─── DS Design Tokens (Light) ───────────────────────────── */
:root {
  /* Brand — Yellow */
  --ds-brand: #FFD21D;
  --ds-brand-hover: #E8BC00;
  --ds-brand-deep: #B88700;
  --ds-brand-soft: #FFF1A8;
  --ds-brand-bg: #FFFBE8;
  --ds-brand-glow: rgba(255, 210, 29, 0.4);
  --ds-brand-ink: #0a0a0a;

  /* Surface */
  --ds-bg: #ffffff;
  --ds-bg-subtle: #f7f7f5;
  --ds-bg-card: #ffffff;
  --ds-bg-strong: #0a0a0a;
  --ds-overlay: rgba(10, 10, 10, 0.55);

  /* Text */
  --ds-text: #19191a;
  --ds-text-2: #4d4d4f;
  --ds-text-3: #7c7c7e;
  --ds-text-on-brand: #0a0a0a;
  --ds-text-on-dark: #fafafa;

  /* Lines */
  --ds-line: #e7e5e0;
  --ds-line-strong: #d4d2cd;
  --ds-line-soft: #efedea;

  /* Radius — 둥근 */
  --r-xs: 8px;  --r-sm: 12px; --r-md: 20px; --r-lg: 28px; --r-xl: 36px; --r-pill: 999px;

  /* Shadow */
  --sh-card: 0 2px 8px rgba(20,15,5,.05), 0 1px 2px rgba(20,15,5,.04);
  --sh-card-hover: 0 18px 44px rgba(20,15,5,.09), 0 4px 12px rgba(20,15,5,.05);
  --sh-overlay: 0 28px 80px rgba(20,15,5,.18);

  --t-fast: 140ms; --t-base: 220ms; --t-slow: 380ms;
  --ease-std: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* Type + container (mirror Astro base.css) */
  --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
               'Apple SD Gothic Neo', 'Noto Sans KR', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  --font-head: 'Pretendard Variable', Pretendard, -apple-system, system-ui, sans-serif;

  /* Shadows */
  --sh-brand: 0 14px 32px rgba(217, 179, 28, 0.32);
  --sh-focus: 0 0 0 3px rgba(217, 179, 28, 0.28);

  --w-wide: 1280px;
  --w-full: 1440px;
  --header-h: 76px;

  /* Material overrides — make Material feel like DS */
  --md-primary-fg-color: #0a0a0a;
  --md-primary-bg-color: #ffffff;
  --md-accent-fg-color: var(--ds-brand-deep);
  --md-typeset-a-color: #B88700;
  --md-default-bg-color: var(--ds-bg);
}

/* ─── Fonts (Material font:false → DS uses Pretendard) ─── */
body, input, button {
  font-family: Pretendard Variable, Pretendard, -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}
/* ─── Layout: hide Material's own header, make ours the fixed one ─── */
.md-header { display: none !important; }
.md-main__inner { margin-top: 0; }
/* Push content below the fixed DS header */
body { padding-top: var(--header-h); }

/* ─── Header (matches apps/site SiteHeader.astro) ─────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h); z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color var(--t-base) var(--ease-std),
              border-color var(--t-base) var(--ease-std),
              backdrop-filter var(--t-base) var(--ease-std);
}
.site-header.is-scrolled,
.site-header.is-solid {
  background: color-mix(in srgb, var(--ds-bg) 88%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom-color: var(--ds-line);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; max-width: var(--w-full);
  margin: 0 auto; padding: 0 32px;
}
.site-header__logo {
  display: flex; align-items: center; gap: 10px;
  color: var(--ds-text);
  font-family: var(--font-head); font-weight: 700; font-size: 17px;
  letter-spacing: -0.01em;
}
.site-header__logo-word { height: 51px; width: auto; display: block; }

.site-header__nav { display: flex; align-items: center; gap: 0; flex: 1; justify-content: center; }
.site-header__nav-wrap { position: relative; }
.site-header__nav-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500;
  color: var(--ds-text-2); text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.site-header__nav-item:hover { background: var(--ds-bg-subtle); color: var(--ds-text); }
.site-header__nav-item.is-current { background: var(--ds-text); color: var(--ds-bg-card); }
.site-header__nav-item.is-current::after { display: none; }

/* Submenu (mega, hover) */
.site-header__submenu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(8px);
  min-width: 260px; padding: 12px; background: var(--ds-bg);
  border: 1px solid var(--ds-line); border-radius: var(--r-md);
  box-shadow: var(--sh-overlay); opacity: 0; pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
  z-index: 10;
}
.site-header__nav-wrap:hover .site-header__submenu,
.site-header__nav-wrap:focus-within .site-header__submenu {
  opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto;
}
.site-header__submenu a {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
  border-radius: var(--r-sm); transition: background var(--t-fast); text-decoration: none;
}
.site-header__submenu a:hover { background: var(--ds-bg-subtle); }
.site-header__submenu .ttl {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px; color: var(--ds-text);
}
.site-header__submenu .desc { font-size: 12px; color: var(--ds-text-3); }

.site-header__utils { display: flex; align-items: center; gap: 10px; }
.site-header__menu-btn {
  width: 38px; height: 38px; border: 1px solid var(--ds-line);
  background: transparent; border-radius: var(--r-sm); color: var(--ds-text);
  display: inline-grid; place-items: center;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.site-header__menu-btn:hover { background: var(--ds-bg-subtle); border-color: var(--ds-line-strong); }

@media (max-width: 900px) {
  .site-header__nav { display: none; }
}

/* ─── Mega Menu (Full overlay) ─────────────────────────── */
.mega-menu {
  position: fixed; inset: 0; z-index: 200;
  background: var(--ds-bg);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base) var(--ease-out);
  overflow-y: auto;
}
.mega-menu.is-open { opacity: 1; pointer-events: auto; }
.mega-menu__topbar {
  position: sticky; top: 0; z-index: 1;
  background: var(--ds-bg);
  border-bottom: 1px solid var(--ds-line);
}
.mega-menu__topbar-inner {
  max-width: var(--w-full); margin: 0 auto;
  padding: 18px 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.mega-menu__topbar-actions { display: flex; align-items: center; gap: 8px; }
.mega-menu__search-trigger {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 14px;
  border: 1px solid var(--ds-line-strong);
  border-radius: var(--r-pill);
  background: var(--ds-bg-subtle); color: var(--ds-text-2);
  font: inherit; font-size: 13px; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.mega-menu__search-trigger:hover { background: var(--ds-bg-card); border-color: var(--ds-text); color: var(--ds-text); }
.mega-menu__search-trigger kbd {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 6px; background: var(--ds-bg-card);
  border: 1px solid var(--ds-line); border-radius: 4px; color: var(--ds-text-3);
}
.mega-menu__close {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--ds-line-strong);
  border-radius: var(--r-pill);
  background: var(--ds-bg-subtle); color: var(--ds-text-2);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.mega-menu__close:hover {
  background: var(--ds-bg-card); border-color: var(--ds-text); color: var(--ds-text);
  transform: rotate(90deg);
}
.mega-menu__inner {
  max-width: var(--w-full); margin: 0 auto;
  padding: 56px 32px 80px;
  display: grid; grid-template-columns: repeat(4, 1fr) 1.2fr; gap: 56px;
}
@media (max-width: 1280px) { .mega-menu__inner { grid-template-columns: repeat(4, 1fr); } .mega-menu__promo { grid-column: 1 / -1; max-width: 600px; } }
@media (max-width: 1024px) { .mega-menu__inner { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .mega-menu__inner { grid-template-columns: 1fr; gap: 36px; } }
.mega-menu__group .label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ds-text-3); margin-bottom: 18px;
}
.mega-menu__item {
  display: block; padding: 10px 0;
  border-bottom: 1px solid transparent;
  transition: padding var(--t-fast); text-decoration: none;
}
.mega-menu__item:hover { padding-left: 8px; }
.mega-menu__item-row {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 17px; color: var(--ds-text); transition: color var(--t-fast);
}
.mega-menu__item:hover .mega-menu__item-row { color: var(--ds-brand); }
.mega-menu__item-desc {
  display: block; margin-top: 4px;
  font-size: 12px; color: var(--ds-text-3);
}
.mega-menu__promo {
  padding: 32px; border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--ds-brand-bg), var(--ds-brand-soft));
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 280px;
}
.mega-menu__promo-eyebrow {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ds-text-2); margin-bottom: 16px;
}
.mega-menu__promo-title { font-size: 24px; line-height: 1.2; margin: 0 0 12px; color: var(--ds-text); font-weight: 700; letter-spacing: -0.01em; }
.mega-menu__promo-desc { font-size: 13px; color: var(--ds-text-2); margin: 0 0 20px; line-height: 1.55; }
.mega-menu__promo .btn { align-self: flex-start; }

/* Status pills (Badge.astro port) */
.ds-badge {
  display: inline-flex; align-items: center;
  border-radius: var(--r-pill);
  font-family: var(--font-mono); font-weight: 700;
  text-transform: uppercase; white-space: nowrap;
}
.ds-badge--md { padding: 2px 7px; font-size: 9.5px; letter-spacing: 0.08em; }
.ds-badge--sm { padding: 1px 6px; font-size: 9px; letter-spacing: 0.06em; }
.ds-badge--new { background: var(--ds-brand); color: var(--ds-text-on-brand); }
.ds-badge--beta { background: var(--ds-text); color: var(--ds-bg-card); }

/* ─── Search Overlay ───────────────────────────────────── */
.search-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10,10,10,0.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base) var(--ease-out);
  display: flex; flex-direction: column;
  padding-top: 80px;
}
.search-overlay.is-open { opacity: 1; pointer-events: auto; }
.search-overlay__panel {
  max-width: 720px; width: calc(100% - 40px); margin: 0 auto;
  background: var(--ds-bg); border-radius: var(--r-xl);
  box-shadow: var(--sh-overlay);
  transform: translateY(-12px); transition: transform var(--t-base) var(--ease-out);
  overflow: hidden;
}
.search-overlay.is-open .search-overlay__panel { transform: translateY(0); }
.search-overlay__input-row {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--ds-line);
}
.search-overlay__icon { color: var(--ds-text-3); flex: 0 0 auto; }
.search-overlay__input {
  flex: 1; border: 0; background: transparent; outline: none;
  font: inherit; font-size: 19px; color: var(--ds-text);
}
.search-overlay__close {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  border: 1px solid var(--ds-line); background: var(--ds-bg-subtle);
  color: var(--ds-text-2); font-family: var(--font-mono);
  font-size: 11px; cursor: pointer;
}
.search-overlay__body { padding: 20px 24px 24px; max-height: 60vh; overflow-y: auto; }
.search-overlay__section { margin-bottom: 24px; }
.search-overlay__section:last-child { margin-bottom: 0; }
.search-overlay__section-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--ds-text-3); margin-bottom: 12px;
}
.search-overlay__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.search-overlay__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--ds-line); background: var(--ds-bg-card);
  font-size: 13px; color: var(--ds-text-2); cursor: pointer;
  transition: all var(--t-fast); font: inherit;
}
.search-overlay__chip:hover { background: var(--ds-brand); color: var(--ds-text-on-brand); border-color: var(--ds-brand); }
.search-overlay__results { display: flex; flex-direction: column; gap: 2px; }
.search-overlay__result {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-radius: var(--r-sm); text-decoration: none;
  transition: background var(--t-fast);
}
.search-overlay__result:hover { background: var(--ds-bg-subtle); }
.search-overlay__result-label { font-size: 15px; color: var(--ds-text); font-weight: 500; }
.search-overlay__result-kind {
  font-family: var(--font-mono); font-size: 11px; color: var(--ds-text-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.search-overlay__footer {
  padding: 14px 24px; border-top: 1px solid var(--ds-line);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--ds-text-3);
}
.search-overlay__footer kbd {
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 5px; background: var(--ds-bg-subtle);
  border: 1px solid var(--ds-line); border-radius: 3px; margin: 0 2px;
}

/* ─── Blog post hero (mirrors Astro PostLayout) — renders only when cover meta exists ─── */
.post-hero {
  max-width: 780px; margin: 0 auto; padding: 48px 0 8px;
}
.post-meta-cat {
  display: inline-block; padding: 4px 12px; margin-bottom: 16px;
  border-radius: var(--r-pill); background: var(--ds-brand); color: var(--ds-brand-ink);
  font-size: 13px; font-weight: 700;
}
.md-content__title { font-size: 40px; line-height: 1.18; margin: 0 0 12px; letter-spacing: -.02em; }
.post-meta { display: flex; align-items: center; gap: 8px; color: var(--ds-text-2); font-size: 14px; }
.post-meta-sep { opacity: .5; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.post-tags .tag {
  padding: 4px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--ds-line-strong); color: var(--ds-text-2); font-size: 12px;
}
.post-cover { display: block; width: 100%; height: auto; border-radius: 16px; margin: 28px 0 8px; }
/* The hero above already renders the title — hide Material's default H1 to avoid a duplicate. */
.post-hero + .md-content .md-content__inner h1,
.post-hero + .md-content h1 { display: none; }
.md-content { max-width: 780px; margin: 0 auto; }
.md-content .md-typeset { font-size: 16px; line-height: 1.75; }

/* ─── Buttons (matches DS .btn) ─────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-pill); padding: 10px 20px;
  font-size: 14px; font-weight: 600; line-height: 1; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.btn--primary { background: var(--ds-brand); color: var(--ds-brand-ink); }
.btn--primary:hover { background: var(--ds-brand-hover); transform: translateY(-1px); }
.btn--ghost { background: transparent; border-color: var(--ds-line-strong); color: var(--ds-text); }
.btn--ghost:hover { border-color: var(--ds-text); }
.btn--sm { padding: 8px 16px; min-height: 36px; font-size: 13px; }

/* ─── Footer (matches apps/site SiteFooter) ─────────────── */
.site-footer {
  background: var(--ds-bg-subtle);
  border-top: 1px solid var(--ds-line);
  padding: 56px 0 28px; margin-top: 80px;
}
.site-footer__inner {
  max-width: 1280px; margin: 0 auto; padding: 0 32px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 32px;
}
.site-footer__brand-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.site-footer__logo-mark { height: 60px; width: auto; display: block; }
.site-footer__tagline { font-size: 13px; line-height: 1.65; color: var(--ds-text-2); margin: 20px 0 0; }
.site-footer__bottom {
  max-width: 1280px; margin: 36px auto 0; padding: 20px 32px 0;
  border-top: 1px solid var(--ds-line); display: flex; justify-content: space-between;
  font-size: 13px; color: var(--ds-text-3);
}

/* ─── Typography tweaks ─────────────────────────────────── */
.md-content h1, .md-content h2, .md-content h3 {
  letter-spacing: -0.01em; color: var(--ds-text);
}
.md-content h1 { margin-top: 0; }

/* ─── Blog list home (카드 그리드 — Astro 블로그 리스트와 동기화) ─── *
   .blog-layout 외엔 위키에 영향 없음 (해당 클래스 없는 페이지엔 미적용) */
.blog-layout { max-width: 980px; }
/* 블로그 홈: Material 780px 콘텐츠 컬럼에서 벗어나 전체 메인 폭 사용.
   포스트 기사 페이지/위키엔 영향 없음 (.blog-layout 없는 페이지엔 미적용). */
.md-content:has(.blog-layout),
.main .md-content:has(.blog-layout) {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 32px;
  box-sizing: border-box;
}
.md-content:has(.blog-layout) .md-content__inner.md-typeset {
  max-width: 100%;
  margin: 0;
}
.md-content:has(.blog-layout) .md-content__inner > .md-content {
  max-width: 1220px;
  margin: 0 auto;
}
.md-content:has(.blog-layout) .blog-layout {
  max-width: 1220px;
  margin: 0 auto;
}
.blog-layout h1, .blog-layout h2, .blog-layout h3 {
  font-family: Pretendard Variable, Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
}
/* Astro 사이트 components.css 와 동일한 카드 시스템 */
.ds-blog-eyebrow, .ds-blog-eyebrow .ds-label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ds-text-3); margin-bottom: 24px;
}
.ds-blog-grid-title {
  font-family: Pretendard Variable, Pretendard, sans-serif;
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 32px;
}
/* article-card — Astro components.css .article-card 그대로 */
.article-card {
  display: flex; flex-direction: column; gap: 16px;
  background: transparent; border: 0; padding: 0; text-decoration: none; color: var(--ds-text);
}
.article-card__thumb {
  aspect-ratio: 16/10; border-radius: var(--r-md); overflow: hidden;
  background: var(--ds-bg-subtle); position: relative; display: block;
  background-size: cover; background-position: center;
}
.article-card__thumb .article-ovl {
  position: absolute; bottom: 14px; left: 14px; color: #fff;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .1em;
}
.article-card__meta { display: flex; gap: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ds-text-3); }
.article-card__meta .cat { color: var(--ds-text-2); }
.article-card h3 {
  margin: 0; font-size: 20px; line-height: 1.35; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.article-card h3::before { content: none; }
.article-card p { margin: 0; color: var(--ds-text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
/* 태그 — Astro .tag 그대로 */
.md-content .article-card .tag {
  display: inline-block; padding: 4px 10px; font-size: 12px;
  background: var(--ds-bg-subtle); color: var(--ds-text-2);
  border-radius: var(--r-xs); font-family: 'IBM Plex Mono', ui-monospace, monospace;
  border: 0;
}
/* featured — Astro .article-card--featured 그대로 */
.article-card--featured { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; padding: 0; }
.article-card--featured .article-card__thumb { aspect-ratio: 4/3; }
.article-card--featured h3 { font-size: 36px; line-height: 1.2; -webkit-line-clamp: 3; }
.article-card--featured p { font-size: 17px; -webkit-line-clamp: 3; }
.blog-featured { margin-bottom: 56px; }
.blog-readmore { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; color: var(--ds-text-2); font-weight: 600; font-size: 14px; }
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.blog-grid .article-card { gap: 16px; }
/* 반응형 — Astro 사이트와 동일 임계값 */
@media (max-width: 900px) {
  .article-card--featured { grid-template-columns: 1fr; padding: 0; }
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .blog-grid { grid-template-columns: 1fr; }
  .article-card--featured h3 { font-size: 28px; }
}

/* ═══ Astro 블로그 읽기 디자인 완전 이식 (post.css 미러) ──────────────
   기사 본문(.md-content article)을 Astro PostLayout의 post-body와 동일하게. */
.md-content article {
  font-family: Pretendard Variable, Pretendard, -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, sans-serif;
  font-size: 18px; line-height: 1.8; color: var(--ds-text);
  max-width: 780px; margin: 0 auto;
}
/* 문단 (Astro .post-body p: margin-bottom 24px) */
.md-content article p { margin: 0 0 24px; }

/* Astro .lead — 도입부 (노란 좌측 보더, 22px, weight 500) */
.md-content article p.lead {
  font-size: 22px; line-height: 1.6; color: var(--ds-text); font-weight: 500;
  padding: 24px 0 24px 24px; border-left: 3px solid var(--ds-brand);
  margin: 0 0 36px;
}

/* 제목 (Astro .post-body h2/h3) */
.md-content article h2 {
  font-family: Pretendard Variable, Pretendard, -apple-system, sans-serif;
  font-size: 28px; line-height: 1.3; letter-spacing: -0.015em;
  margin: 56px 0 20px; font-weight: 700;
}
.md-content article h2::before { content: '#'; color: var(--ds-brand); margin-right: 8px; }
.md-content article h3 {
  font-size: 20px; line-height: 1.35; margin: 32px 0 12px; font-weight: 700;
}

/* 목록 (Astro .post-body ul/ol/li) */
.md-content article ul, .md-content article ol { margin: 0 0 24px; padding-left: 24px; }
.md-content article li { margin-bottom: 8px; }
.md-content article li::marker { color: var(--ds-text-3); }

/* 인용 (Astro .post-body blockquote: subtle bg, r-md, dark left border, mono cite) */
.md-content article blockquote {
  margin: 32px 0; padding: 24px 28px;
  background: var(--ds-bg-subtle); border-radius: var(--r-md);
  border-left: 4px solid var(--ds-text);
  font-size: 18px; line-height: 1.7; color: var(--ds-text);
}
.md-content article blockquote cite {
  display: block; margin-top: 12px; font-style: normal; font-size: 13px;
  color: var(--ds-text-3); font-family: 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace;
}

/* 인라인 코드 (Astro .post-body code: mono .9em, subtle bg, 4px) */
.md-content article code {
  font-family: 'IBM Plex Mono', 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  font-size: .9em; padding: 2px 6px; background: var(--ds-bg-subtle); border-radius: 4px;
}
/* 코드 블록 (Astro .post-body pre: dark #0a0a0a, #e8e8e6, mono 13px) */
.md-content article pre {
  margin: 24px 0; padding: 24px;
  background: #F6F8FA;          /* one-light 코드 배경 */
  color: #24292E;               /* one-light 기본 텍스트 */
  border: 1px solid #E2E8F0;
  border-radius: var(--r-md);
  font-family: 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;line-height: 1.7; overflow-x: auto;
}
.md-content article pre code { background: transparent; padding: 0; color: inherit; }

/* 이미지 */
.md-content article img, .md-content article .post-image {
  margin: 32px 0; border-radius: var(--r-md); width: 100%;
}

/* Astro .callout — 브랜드 소프트 노란 카드 */
.md-content article .callout {
  padding: 20px 24px; background: var(--ds-brand-soft);
  border-radius: var(--r-md); margin: 24px 0; font-size: 15px; line-height: 1.7;
}
.md-content article .callout strong { color: var(--ds-text-2); }

/* Material admonition 을 DS 느낌으로 (callout 대체로 쓴 경우) */
.md-content article .admonition {
  border-radius: var(--r-md); border: 0; border-left: 3px solid var(--ds-brand);
  box-shadow: none; font-size: 15px; line-height: 1.7;
}
.md-content article .admonition-title {
  background: var(--ds-brand-soft); color: var(--ds-text-2); font-weight: 600;
  border-bottom: 0;
}
.md-content article .admonition,
.md-content article .admonition p { background: transparent; }

/* 굵게/기울임 — Material 기본 유지, 색만 DS */

/* ═══ Responsive (모바일/태블릿) — Astro 사이트와 동일 임계값 ─────────── */
/* ≤900px: 가로 네비 접음. 햄버거(data-menu-open)는 메가메뉴 full overlay 를 연다 (마케팅과 동일). */
@media (max-width: 900px) {
  .site-header__nav { display: none; }
  .site-header__inner { padding: 0 20px; }
}

/* ≤640px: 푸터/본문/포스트 히어로 세부 반응 (로고는 마케팅과 동일 inline 51px 유지) */
@media (max-width: 640px) {
  .site-header__inner { padding: 0 16px; }
  .site-header__utils .btn { padding: 8px 14px; font-size: 13px; }
  .mega-menu__topbar-inner { padding: 14px 20px; }

  .site-footer__inner { flex-direction: column; padding: 0 20px; gap: 24px; }
  .site-footer__inner { align-items: flex-start; }
  .site-footer__bottom { flex-direction: column; gap: 8px; padding: 20px 20px 0; }

  .post-hero { padding: 32px 0 4px; }
  .md-content__title { font-size: 30px; }
  .post-cover { border-radius: 12px; }
  .md-content { max-width: 100%; padding: 0 20px; box-sizing: border-box; }
  .md-content article { max-width: 100%; padding: 0; }
  .md-content .md-typeset { font-size: 15px; line-height: 1.7; }

  body { padding-top: var(--header-h); }
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}


/* ══════════════════════════════════════════════════════════════════
   위키 내비게이션 UX (브레드크럼 · 포커스 모드 · 3뎁스 제한 · 활성화)
   chrome.js 의 initWikiNav() 가 wiki(ds-site=wiki)에서 켠다.
   JS 가 안 떠도 전체 트리는 그대로 노출(점진적 향상).
   ══════════════════════════════════════════════════════════════════ */

/* ── 1) 브레드크럼 (본문 최상단) ───────────────────────────────── */
.ds-breadcrumbs {
  max-width: 61rem;
  margin: 0 auto;
  padding: 14px 16px 0;
  font-size: 13px;
  color: var(--ds-text-3);
  overflow-x: auto;
  white-space: nowrap;
}
.ds-breadcrumbs__inner { display: flex; align-items: center; align-items: center !important; gap: 6px; font-size: 13px; line-height: 1; }
/* native <nav class="md-path"> 래퍼 + <ol> 을 display:contents 로 평탄화 → 자식들이 flex 행에 직접 참여 */
.ds-breadcrumbs .md-path,
.ds-breadcrumbs .md-path__list {
  display: contents;
  margin: 0 !important;
  padding: 0 !important;
}
.ds-breadcrumbs .md-path__list { list-style: none; }
.ds-breadcrumbs .md-path__item { display: inline-flex; align-items: center; white-space: nowrap; margin: 0 !important; padding: 0 !important; }
/* 축소된 중간 항목 은닉 (flex/contents 하위에서도 강제) */
.ds-breadcrumbs .md-path__item.ds-crumb-hidden { display: none !important; }
.ds-breadcrumbs__sep { color: var(--ds-line-strong); user-select: none; }
/* 구분자 ">" 통일: 실제 경로 항목(li) 사이에만 표시 (⋯ 축소 버튼 앞은 별도 구분자로) */
.ds-breadcrumbs .md-path__list > li:not(:first-child)::before {
  content: ">"; margin-right: 7px; color: var(--ds-line-strong); font-weight: 400;
}
/* 홈 옆 ">" — ⋯ 축소 버튼 안이 아닌 별도 구분자 요소 */
.ds-crumb-bsep { color: var(--ds-line-strong); font-weight: 400; user-select: none; margin-right: 7px; }
.ds-breadcrumbs__link {
  color: var(--ds-text-2); text-decoration: none; font-weight: 500;
  padding: 2px 2px; border-radius: 6px;
  transition: color var(--t-fast) var(--ease-std);
}
.ds-breadcrumbs__link:hover { color: var(--ds-brand-deep); text-decoration: underline; }
.ds-breadcrumbs__text { color: var(--ds-text-2); }
.ds-breadcrumbs__current { color: var(--ds-text); font-weight: 700; }
.ds-crumbs-more {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 9px; border-radius: var(--r-pill);
  background: var(--ds-bg-subtle); border: 1px solid var(--ds-line);
  color: var(--ds-text-2); font-weight: 800; font-size: 12px; line-height: 1;
  cursor: pointer; user-select: none; vertical-align: middle;
  transition: background var(--t-fast) var(--ease-std), border-color var(--t-fast) var(--ease-std);
}
.ds-crumbs-more:hover { border-color: var(--ds-brand); color: var(--ds-brand-deep); }
/* 드롭다운 팝오버 — body fixed 로 띄워 overflow 클리핑 없음, 최상위 레이어 */
.ds-crumbs-pop {
  position: fixed; z-index: 50;
  min-width: 180px; max-width: 280px;
  background: var(--ds-bg); border: 1px solid var(--ds-line);
  border-radius: var(--r-sm); box-shadow: var(--sh-card-hover);
  padding: 6px; display: none;
}
.ds-crumbs-pop__item {
  display: block; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--ds-text-2);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--t-fast) var(--ease-std), color var(--t-fast) var(--ease-std);
}
.ds-crumbs-pop__item:hover { background: var(--ds-bg-subtle); color: var(--ds-brand-deep); }

/* ── 2) 사이드바 최상단 — 상위이동(∅ up)·Local Root 헤더 ─────── */
.ds-navbar-control { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px 8px; }
.ds-nav-up {
  display: inline-flex; align-items: center; align-self: flex-start;
  gap: 6px;
  border: 1px solid var(--ds-line); background: var(--ds-bg-subtle); color: var(--ds-text-2);
  font-size: 12px; font-weight: 600; line-height: 1; padding: 7px 11px; border-radius: var(--r-pill);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast) var(--ease-std), color var(--t-fast) var(--ease-std), border-color var(--t-fast) var(--ease-std);
}
.ds-nav-up:hover { border-color: var(--ds-brand); color: var(--ds-brand-deep); }
.ds-nav-root {
  font-size: 16px; font-weight: 800; color: var(--ds-text);
  letter-spacing: -0.01em;
  padding: 2px 2px 0;
}
.ds-nav-root::after { content: ""; display: block; height: 2px; margin-top: 8px; border-radius: 2px; background: linear-gradient(90deg, var(--ds-brand), transparent); }

/* 드릴다운 스코프 리스트 (Local Root 직속 자식만) */.ds-nav-scope { padding: 0 6px 8px; }
.ds-nav-scope .md-nav__list { list-style: none; margin: 0; padding: 0; display: block !important; }
.ds-nav-scope .md-nav__item { padding: 0; }
.ds-nav-scope .md-nav__link {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 0; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--ds-text-2);
  text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
  border-left: 3px solid transparent;
  transition: background var(--t-fast) var(--ease-std), color var(--t-fast) var(--ease-std), border-color var(--t-fast) var(--ease-std);
}
.ds-nav-scope .md-nav__link:hover { background: var(--ds-bg-subtle); color: var(--ds-brand-deep); }
.ds-nav-scope .md-nav__link--active {
  background: var(--ds-brand-bg); color: var(--ds-brand-deep); font-weight: 700;
  border-left-color: var(--ds-brand);
}
/* 스코프 리스트 내 중첩(4뎁스 이상)은 우측 TOC로 — 숨김 */
.ds-nav-scope .md-nav[data-md-level="4"] { display: none; }
/* 활성 항목의 자신 하위 nav(= 본문 TOC)는 스코프에서 숨김 → 우측 TOC에 노출 */
.ds-nav-scope .md-nav__item--active > .md-nav { display: none !important; }

/* ── 3) 포커스 모드 — 현재 1depth 가지만 표시, 나머지 은닉 ────── */
.md-sidebar--primary .md-nav.md-nav--primary.md-nav--focus > .md-nav__list > li { display: none; }
.md-sidebar--primary .md-nav.md-nav--primary.md-nav--focus > .md-nav__list > li.md-nav__item--current { display: list-item; }

/* ── 4) 3뎁스 제한 — 4뎁스 이상 사이드바에서 숨김 (우측 TOC로 분리) ──
   Material 은 중첩 <nav> 에 data-md-level(N) 을 부여한다.
   레벨 3 nav 가 3뎁스(챕터 목록)이므로, 레벨 4 이상만 숨긴다. */
.md-sidebar--primary .md-nav[data-md-level="4"],
.md-sidebar--primary .md-nav[data-md-level="5"],
.md-sidebar--primary .md-nav[data-md-level="6"],
.md-sidebar--primary .md-nav[data-md-level="7"] { display: none; }

/* ── 5) 활성 & 현재 브랜치 강조 ───────────────────────────────── */
/* 현재 페이지(리프) 링크 — 가장 강하게 */
.md-sidebar--primary .md-nav__link--active {
  color: var(--ds-brand-deep);
  font-weight: 800;
  background: var(--ds-brand-bg);
  border-radius: 8px;
}
/* 현재 경로(조상들) — 중간 밝기로 경로를 보여준다 */
.md-sidebar--primary .md-nav__item--current-path > .md-nav__link,
.md-sidebar--primary .md-nav__item--current-path > label.md-nav__link {
  color: var(--ds-brand-deep);
  font-weight: 700;
}
.md-sidebar--primary .md-nav__item--current > .md-nav__link { background: var(--ds-brand-bg); border-radius: 8px; font-weight: 700; }
.md-nav--focus .md-nav__item--current > .md-nav__toggle:checked ~ .md-nav { display: block; }

/* ══════════════════════════════════════════════════════════════════
   Mermaid 다이어그램 — 라이트 테마 가독성 (REQ #2)
   Material 이 주는 어두운 배경을 제거하고 라이트 패널로 교체.
   ══════════════════════════════════════════════════════════════════ */
.md-typeset pre.mermaid,
.md-typeset .mermaid {
  background-color: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 12px;
  box-shadow: none !important;
  padding: 16px;
  margin: 1.2em 0;
  text-align: center;
}
/* 다이어그램 내 텍스트/라벨 시인성 (라이트 배경 기준) */
.md-typeset pre.mermaid .nodeLabel,
.md-typeset pre.mermaid .edgeLabel,
.md-typeset pre.mermaid text { color: #0f172a; fill: #0f172a; }
.md-typeset pre.mermaid .cluster-label text { fill: #334155; }

/* ══════════════════════════════════════════════════════════════════
   드릴다운 사이드바 — 높이 고정 + FOUM(깜빡임) 제거
   REQ #1: 사이드바 뷰포트 전체 높이 고정 + 내부 스크롤
   REQ #2: 파싱 시점에 미필터 트리 은닉(JS 와 무관) → 순간 전체노출 방지
   ══════════════════════════════════════════════════════════════════ */

/* 1) 높이/레이아웃 고정 — 데스크톱 상시노출 사이드바에만 (모바일은 Material 드로어가 처리) */
@media (min-width: 76.25em) {
  [data-ds-wiki] .md-sidebar--primary {
    position: sticky;
    top: var(--header-h);                       /* DS 고정 헤더 높이 76px */
    height: calc(100vh - var(--header-h));
    display: flex;
    flex-direction: column;
  }
  [data-ds-wiki] .md-sidebar--primary .md-sidebar__scrollwrap {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    height: 100%;
  }
  [data-ds-wiki] .md-sidebar--primary .md-sidebar__inner {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  /* 메뉴가 짧아도 컨테이너는 유지(자식들이 늘어난 스크롤 공간) */
  [data-ds-wiki] .md-sidebar--primary .md-nav.md-nav--primary {
    flex: 1 1 auto;
  }
}

/* 2) FOUM 제거 — 미필터 전체 트리를 파싱 시점에 은닉 (JS 전)
      활성 스코프(.ds-nav-scope)는 JS 가 이식 후 block 으로 노출. */
[data-ds-wiki] .md-sidebar--primary .md-nav__list { display: none; }
[data-ds-wiki] .ds-nav-scope .md-nav__list { display: block !important; }

/* 모바일 사이드바 드로어 햄버거 — 메가메뉴 버튼 대신 Material #__drawer 열기.
   데스크톱(≥76.25em)에선 숨김(Material 상시 사이드바 사용). */
.site-header__drawer-btn {
  display: none;
  width: 38px; height: 38px; border: 1px solid var(--ds-line);
  background: transparent; border-radius: var(--r-sm); color: var(--ds-text);
  align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.site-header__drawer-btn:hover { background: var(--ds-bg-subtle); border-color: var(--ds-line-strong); }
@media (max-width: 76.24em) {
  .site-header__drawer-btn { display: inline-flex; }
}
