/* 프로젝트 상세 페이지 (public/projects) — 메인 사이트(src/style.css)와 같은 토큰·헤더·푸터를 씁니다. */
/* 메인과 오갈 때 페이지가 부드럽게 겹쳐 바뀐다 (지원하지 않는 브라우저는 평소처럼 이동) */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
:root {
  --navy-900: #0b1f3a;
  --navy-800: #12294a;
  --navy-700: #1c3a63;
  --teal-600: #0f766e;
  --teal-500: #14b8a6;
  --teal-400: #2dd4bf;
  --teal-50: #e7f8f5;
  --text: #0f172a;
  --body: #1e293b;
  --muted: #526077;
  --line: #e3e8ef;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --shot-bg: #efece7;
  --radius: 14px;
  --shadow: 0 20px 50px -20px rgba(11, 31, 58, 0.25);
  --header-h: 68px;
  --bar-h: 50px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); }
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* Buttons · tags (메인과 동일) */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 24px; border-radius: 10px;
  font-weight: 600; font-size: 15px; transition: background .2s, color .2s, border-color .2s;
}
.btn-primary { background: var(--navy-900); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--teal-500); background: var(--teal-50); padding: 4px 10px; border-radius: 999px; line-height: 1.4; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-500); margin-bottom: 14px; }

/* Header (메인과 동일) */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.header.scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: .02em; }
.logo svg { width: 32px; height: 32px; }
.nav { display: flex; align-items: center; gap: 32px; font-size: 15px; font-weight: 500; }
.nav a:not(.btn) { color: var(--muted); }
.nav a:not(.btn):hover, .nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"] { font-weight: 700; }
.nav-toggle { display: none; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; margin: 5px auto; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }

/* Hero */
.doc-hero {
  padding: 40px 0 64px;
  background:
    radial-gradient(900px 400px at 85% 10%, rgba(45, 212, 191, .14), transparent 60%),
    radial-gradient(700px 400px at 0% 100%, rgba(28, 58, 99, .08), transparent 60%);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 36px; }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }
.doc-hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; }
.doc-hero h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.18; font-weight: 800; letter-spacing: -.03em; }
.doc-hero .lead { margin-top: 22px; font-size: 17.5px; color: var(--muted); max-width: 560px; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 26px; font-size: 14px; color: var(--muted); }
.tag-plan { color: #8a5a00; background: #fff3d1; }
.stage { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 30px; max-width: 520px; counter-reset: stage; }
.stage li { position: relative; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--muted); }
.stage li::before { content: ""; position: absolute; top: 8px; left: 18px; right: 0; height: 2px; background: var(--line); }
.stage li:last-child::before { display: none; }
.stage b { position: relative; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #cbd3de; background: #fff; }
.stage .is-current { color: var(--text); font-weight: 700; }
.stage .is-current b { border-color: var(--teal-500); box-shadow: 0 0 0 4px rgba(20, 184, 166, .18); background: var(--teal-500); }
.doc-hero-shots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hero-shot {
  display: flex; flex-direction: column; text-align: left; cursor: zoom-in;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 10px 30px -18px rgba(11, 31, 58, .25); transition: transform .2s, box-shadow .2s;
}
.hero-shot:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.hero-shot img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; background: var(--shot-bg); }
.hero-shot span { padding: 12px 14px; font-size: 13.5px; font-weight: 600; }

/* 모바일 목차 막대 */
.toc-bar { display: none; }

/* 본문 레이아웃 */
.doc-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 64px; padding-top: 56px; padding-bottom: 96px; }
.toc {
  position: sticky; top: calc(var(--header-h) + 24px); align-self: start;
  max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; overscroll-behavior: contain;
  padding: 2px 6px 16px 0; font-size: 14px; scrollbar-width: thin;
}
.toc-title { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px 10px; }
.toc a { display: block; border-radius: 8px; color: var(--muted); transition: color .15s, background .15s; }
.toc a:hover { color: var(--text); background: var(--bg-soft); }
.toc-chapter > a { padding: 6px 10px; font-weight: 600; }
.toc-sub { margin: 2px 0 8px 14px; padding-left: 4px; border-left: 1px solid var(--line); }
.toc-sub a { padding: 4px 10px; font-size: 13.5px; }
.js .toc-chapter:not(.is-open) > .toc-sub { display: none; }
.toc a.is-active { color: var(--teal-600); background: var(--teal-50); font-weight: 600; }
.toc-top { display: inline-block !important; margin: 16px 0 0 10px; padding: 0 !important; font-size: 13px; background: none !important; }

/* 본문 타이포 */
.prose { max-width: 820px; min-width: 0; font-size: 16.5px; line-height: 1.78; color: var(--body); }
.prose > :first-child { margin-top: 0; }
.prose h2 {
  position: relative; font-size: clamp(24px, 3vw, 30px); line-height: 1.3; font-weight: 800; letter-spacing: -.025em; color: var(--text);
  margin: 88px 0 20px; padding-top: 36px; border-top: 1px solid var(--line);
}
.prose h2#overview { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { position: relative; font-size: 20px; line-height: 1.4; font-weight: 700; letter-spacing: -.015em; color: var(--text); margin: 52px 0 14px; }
.h-anchor { margin-left: 8px; color: var(--teal-500); font-weight: 600; opacity: 0; transition: opacity .15s; text-decoration: none !important; }
.prose h2:hover .h-anchor, .prose h3:hover .h-anchor, .h-anchor:focus { opacity: 1; }
.prose p { margin: 0 0 16px; }
.prose ul { list-style: disc; padding-left: 22px; margin: 0 0 20px; }
.prose ol { list-style: decimal; padding-left: 24px; margin: 0 0 20px; }
.prose ol ul { list-style: circle; margin: 6px 0 10px; }
.prose li { margin: 7px 0; padding-left: 2px; }
.prose li::marker { color: var(--teal-500); font-weight: 700; }
.prose strong { font-weight: 700; color: var(--text); }
.prose a:not(.h-anchor):not(.shot-btn) { color: var(--teal-600); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.prose a:not(.h-anchor):hover { color: var(--navy-900); }
.prose code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .86em; background: var(--bg-soft); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.prose pre.code {
  position: relative; margin: 0 0 20px; padding: 40px 22px 22px; overflow-x: auto;
  background: var(--navy-900); color: #dbe4f0; border-radius: 12px; font-size: 13.5px; line-height: 1.65;
}
.prose pre.code::before { content: attr(data-lang); position: absolute; top: 12px; left: 22px; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--teal-400); letter-spacing: .04em; }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }

/* 표 */
.table-wrap {
  margin: 0 0 24px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px;
  /* 옆으로 넘칠 때 가장자리에 그림자 */
  background:
    linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) 0 0,
    linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(11, 31, 58, .16), transparent) 0 0,
    radial-gradient(farthest-side at 100% 50%, rgba(11, 31, 58, .16), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.6; }
.prose th { background: var(--bg-soft); color: var(--text); font-weight: 700; text-align: left; padding: 11px 14px; white-space: nowrap; }
.prose td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.prose td + td, .prose th + th { border-left: 1px solid var(--line); }
.table-wide table { min-width: 820px; font-size: 13.5px; }
.table-wide th, .table-wide td { padding: 10px 11px; }
.table-wrap td:first-child { white-space: nowrap; }
.table-wide td:first-child, .table-wide td:nth-child(2) { white-space: normal; min-width: 120px; }

/* 체크리스트 */
.prose ul.tasks { list-style: none; padding-left: 0; }
.prose ul.tasks li { display: flex; gap: 12px; align-items: flex-start; }
.task-box { flex: none; width: 18px; height: 18px; margin-top: 5px; border: 2px solid #cbd3de; border-radius: 5px; background: #fff; }

/* 수식 */
.formula {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px;
  margin: 0 0 20px; padding: 22px 18px; background: var(--bg-soft); border-radius: 12px; font-size: 15.5px; color: var(--text);
}
.formula-lhs { font-weight: 600; }
.frac { display: inline-flex; flex-direction: column; align-items: center; text-align: center; }
.frac .num { padding: 0 8px 6px; border-bottom: 1.5px solid var(--text); }
.frac .den { padding: 6px 8px 0; }

/* 그림 */
.shot { margin: 8px 0 28px; }
.shot-btn {
  position: relative; display: block; width: 100%; padding: 0; cursor: zoom-in;
  background: var(--shot-bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.shot-btn img { display: block; width: 100%; height: auto; transition: transform .3s; }
.shot-btn:hover img { transform: scale(1.015); }
.shot-zoom {
  position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 10px;
  background: rgba(11, 31, 58, .72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cpath d='M20 20l-4.5-4.5M11 8v6M8 11h6'/%3E%3C/svg%3E") center / 20px no-repeat;
  opacity: 0; transition: opacity .2s;
}
.shot-btn:hover .shot-zoom, .shot-btn:focus-visible .shot-zoom { opacity: 1; }
.shot figcaption, .diagram figcaption { margin-top: 10px; font-size: 13.5px; color: var(--muted); text-align: center; }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 8px 0 28px; }
.shots .shot { margin: 0; }
.shots-3 > :first-child { grid-column: 1 / -1; }

.diagram { margin: 8px 0 28px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.diagram-scroll { overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 620px; height: auto; font-family: inherit; }
.d-lane { fill: var(--bg-soft); stroke: var(--line); }
.d-box { fill: #fff; stroke: #9aa6b8; stroke-width: 1.25; }
.d-box.main { fill: #e3f7f4; stroke: var(--teal-500); stroke-width: 2; }
.d-box.dashed { fill: none; stroke-dasharray: 4 4; }
.d-links path { fill: none; stroke: #9aa6b8; stroke-width: 1.25; }
.d-arrowhead { fill: #9aa6b8; }
.d-lane-name { font-size: 13px; font-weight: 700; fill: var(--muted); }
.d-name { font-size: 13px; font-weight: 700; fill: var(--text); }
.d-sub, .d-label { font-size: 11.5px; fill: var(--muted); }

/* 이미지 모아 보기 */
.gallery { margin: 0 0 8px; }
.gallery-label { margin: 26px 0 10px !important; font-size: 13.5px; font-weight: 700; color: var(--text); }
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.g-item {
  display: flex; flex-direction: column; padding: 0; text-align: left; cursor: zoom-in;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: transform .2s, box-shadow .2s;
}
.g-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.g-item img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: var(--shot-bg); }
.g-item.g-contain img { object-fit: contain; background: #fff; padding: 6px; }
.g-cap { display: block; padding: 9px 11px 10px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* 본문 메모 */
.prose .note { margin: 0 0 20px; padding: 14px 18px; background: var(--bg-soft); border-left: 3px solid var(--teal-500); border-radius: 0 10px 10px 0; font-size: 15.5px; }
.tag-todo { color: var(--muted); background: var(--bg-soft); }

/* 진행 단계: 끝난 단계 */
.stage .is-done b { border-color: var(--teal-500); background: var(--teal-500); }

/* 히어로 그림 (사진 대신 SVG) */
.doc-hero-art { margin: 0; background: var(--shot-bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 10px 30px -18px rgba(11, 31, 58, .25); }
.doc-hero-art svg { display: block; width: 100%; height: auto; }
.doc-hero-art figcaption { padding: 12px 14px; font-size: 13.5px; font-weight: 600; background: #fff; border-top: 1px solid var(--line); }

/* 도표: 그림 위 이름표, 회로도, 막대 차트 */
.dl-name { font-size: 26px; font-weight: 700; fill: var(--text); }
.dl-sub { font-size: 20px; fill: var(--muted); }
.sch-wire { fill: none; stroke: #334155; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sch-thick { stroke-width: 2.4; }
.sch-part { fill: #fff; stroke: #334155; stroke-width: 1.6; stroke-linejoin: round; }
.sch-dot { fill: #334155; }
.chart svg { min-width: 560px; }
.c-grid { stroke: #eef1f5; stroke-width: 1; }
.c-base { stroke: #cbd3de; stroke-width: 1; }
.c-tick { font-size: 11.5px; fill: var(--muted); }
.c-name { font-size: 13px; font-weight: 700; fill: var(--text); }
.c-sub { font-size: 11.5px; fill: var(--muted); }
.c-bar-main { fill: var(--teal-600); }
.c-bar-muted { fill: #6b7686; }
.c-in { font-size: 12.5px; font-weight: 700; fill: #fff; }
.c-ref { stroke: var(--text); stroke-width: 1.5; }
.c-reflabel { font-size: 11.5px; font-weight: 600; fill: var(--text); }
.prose .note-warn { background: #fff7ed; border-left-color: #f59e0b; }

/* 모터 기판 배치도 */
.bm-col { font-size: 15px; font-weight: 700; fill: var(--muted); }
.bm-ch { font-size: 15px; font-weight: 700; fill: var(--text); }
.bm-rail { font-size: 14px; font-weight: 600; fill: var(--text); }
.bm-brace { fill: none; stroke: #94a3b8; stroke-width: 1.5; }
.bm-back { stroke: #ea7a3a; stroke-opacity: .55; stroke-width: 13; stroke-linecap: round; }
.bm-pad { fill: #d6b26a; stroke: #b08a3e; stroke-width: 1; }
.bm-hole { fill: #fff; }
.bm-lead, .bm-lead-path { stroke: #7b8492; stroke-width: 3; fill: none; stroke-linecap: round; }
.bm-diode { fill: #f0a35e; stroke: #b8732f; stroke-width: 1.2; }
.bm-res { fill: #e8d5b0; stroke: #a8916a; stroke-width: 1.2; }
.bm-fet { fill: #1d1d1d; }
.bm-leg { font-size: 13px; font-weight: 700; fill: var(--text); }
.bm-part { font-size: 12px; font-weight: 600; fill: var(--muted); }
.bm-mplus { fill: none; stroke: #dc2626; stroke-width: 3; }
.bm-mminus { fill: none; stroke: #2563eb; stroke-width: 3; }
.bm-msign { font-size: 17px; font-weight: 800; fill: #dc2626; }
.bm-msign.minus { fill: #2563eb; }
.bm-mark { fill: #7c3aed; }
.bm-markn { font-size: 12px; font-weight: 800; fill: #fff; }
.bm-legend { font-size: 13px; fill: var(--text); }

/* SOT-23 다리 구분 */
.sot-body { fill: #1d1d1d; }
.sot-leg { fill: #b9bec7; }
.sot-mark { font-size: 15px; font-weight: 700; fill: #cbd5e1; }
.sot-wire { fill: none; stroke: #7b8492; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.diagram .sot-t { font-size: 17px; }
.diagram .sot-s { font-size: 15px; }
.d-links-solid { fill: none; stroke: #9aa6b8; stroke-width: 2; }

/* 코드 복사 버튼 */
.prose pre.code .copy-btn {
  position: absolute; top: 8px; right: 10px; padding: 4px 10px; font: inherit; font-family: "Pretendard Variable", Pretendard, system-ui, sans-serif;
  font-size: 12px; font-weight: 600; color: #dbe4f0; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); border-radius: 6px; cursor: pointer;
}
.prose pre.code .copy-btn:hover { background: rgba(255, 255, 255, .16); }

.doc-note { margin-top: 72px !important; padding: 16px 20px; background: var(--teal-50); border-radius: 12px; font-size: 14.5px; color: #0f5f57; }

/* 라이트박스 */
.lightbox {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(6, 14, 28, .95); color: #fff; overflow: hidden;
}
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox::backdrop { background: rgba(6, 14, 28, .6); }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 64px 84px 0; touch-action: pan-y; }
.lb-stage img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 10px; background: #fff; }
.lb-caption { flex: none; display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 76px; padding: 12px 72px 16px; font-size: 15px; color: #dbe4f0; text-align: center; }
.lb-count { color: #8fa1ba; font-size: 13.5px; white-space: nowrap; }
.lb-btn {
  position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .1); cursor: pointer; transition: background .2s;
}
.lb-btn:hover { background: rgba(255, 255, 255, .2); }
.lb-btn svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lb-close { top: 14px; right: 14px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
body.lb-open { overflow: hidden; }

/* Footer (메인과 동일) */
.footer { background: var(--navy-900); color: #8fa1ba; padding: 48px 0 36px; font-size: 14px; }
.footer-top { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.logo-light { color: #fff; }
.footer-nav { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-nav a:hover { color: #fff; }
.copyright { margin-top: 20px; color: #5f7391; }

/* Responsive */
@media (max-width: 1080px) {
  html { scroll-padding-top: calc(var(--header-h) + var(--bar-h) + 20px); }
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 32px; }
  .prose { max-width: 820px; margin: 0 auto; width: 100%; }
  .toc-bar {
    display: block; position: sticky; top: var(--header-h); z-index: 40;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  }
  .toc-bar-inner { height: var(--bar-h); display: flex; align-items: center; }
  .toc-toggle {
    display: flex; align-items: center; gap: 12px; width: 100%; max-width: 820px; margin: 0 auto; height: 38px; padding: 0 12px;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; text-align: left;
  }
  .toc-toggle-label { flex: none; font-size: 13px; font-weight: 700; color: var(--teal-600); }
  .toc-current { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; font-weight: 600; }
  .toc-toggle svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .2s; }
  .toc-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .toc {
    position: fixed; top: calc(var(--header-h) + var(--bar-h)); left: 0; right: 0; z-index: 45;
    max-height: min(70vh, 560px); padding: 16px max(16px, calc((100vw - 820px) / 2)) 20px;
    background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 24px 40px -24px rgba(11, 31, 58, .35);
    display: none;
  }
  .toc.is-open { display: block; }
  .toc-title { display: none; }
}

@media (max-width: 960px) {
  .doc-hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .doc-hero-shots { max-width: 560px; }
}

@media (max-width: 760px) {
  .container { padding: 0 16px; }
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 16px 20px; background: #fff; border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a:not(.btn) { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav .btn { margin-top: 16px; height: 46px; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .doc-hero { padding: 28px 0 44px; }
  .crumbs { margin-bottom: 24px; font-size: 13px; }
  .doc-hero .lead { font-size: 16.5px; }
  .stage li { font-size: 12.5px; }
  .doc-hero-shots { gap: 10px; }
  .hero-shot span { padding: 10px 12px; font-size: 12.5px; }
  .prose { font-size: 16px; }
  .prose h2 { margin-top: 64px; padding-top: 28px; }
  .prose h3 { font-size: 18.5px; margin-top: 40px; }
  .gallery-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .shots { grid-template-columns: 1fr; gap: 14px; }
  .diagram { padding: 12px; }
  .lb-stage { padding: 60px 8px 0; }
  .lb-caption { padding: 10px 16px 76px; font-size: 14px; flex-direction: column; gap: 4px; }
  .lb-prev, .lb-next { top: auto; bottom: 14px; transform: none; width: 44px; height: 44px; }
  .lb-prev { left: calc(50% - 56px); }
  .lb-next { right: calc(50% - 56px); }
  .footer-top { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

/* 최종 배치도 (옆모습, 위에서 본 모습) */
.st-frame { fill: #e5e7eb; stroke: #9ca3af; stroke-width: 1; }
.st-board { fill: #ccfbf1; stroke: #0d9488; stroke-width: 1.25; }
.st-foam { fill: #fff; stroke: #cbd5e1; stroke-width: 1; }
.st-batt { fill: #fef3c7; stroke: #d97706; stroke-width: 1; }
.st-dark { fill: #4b5563; }
.st-res { fill: #e8d5b0; stroke: #a8916a; stroke-width: 1; }
.st-pad { fill: #0d9488; }
.st-prop { fill: none; stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 4 4; }
.st-propline { stroke: #374151; stroke-width: 3; stroke-linecap: round; }
.st-wire { fill: none; stroke: #4b5563; stroke-width: 1.6; }
.st-wire-thin { fill: none; stroke: #9ca3af; stroke-width: 1.3; }
.st-leader { stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 3 3; }
.st-arrowline { stroke: #64748b; stroke-width: 1.5; }
.diagram .st-lab { font-size: 14px; }
.diagram .st-big { font-size: 16px; }
.diagram .st-mid { font-size: 13px; }

/* MOSFET 다리 달기 그림 */
.mj-card { fill: #f3ead9; stroke: #d9c9a8; stroke-width: 1; }
.mj-tape { fill: #f5b94a; opacity: .45; }
.mj-hold { fill: #e5e7eb; stroke: #cbd5e1; stroke-width: 1; opacity: .92; }
.mj-wire { fill: none; stroke: #9aa1ab; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.mj-wire-s { stroke-width: 6; }
.mj-joint { fill: #d7dbe0; stroke: #6b7280; stroke-width: 1; }
.mj-solder { fill: #cfd4da; stroke: #6b7280; stroke-width: 1; }
.mj-pen { font-size: 18px; font-weight: 700; fill: #9a3412; }
.mj-pcb { fill: #e9d8ae; stroke: #b59f6e; stroke-width: 1; }
.mj-pad { fill: #c58b3a; }
.mj-cut { stroke: #ef4444; stroke-width: 1.5; stroke-dasharray: 5 4; }
.mj-dim { stroke: #64748b; stroke-width: 1.2; }
