/* ============================================================
   Lecture · 교착 상태와 메모리 단편화 (4과목 · PL/OS) — slide layout extensions
   Builds on /colors_and_type.css and /slides/_slide.css
   ─ 최신 4과목 OS 기준 데크 lecture.css 계승: obj-grid·flow·step-grid·
     comp-grid·tree-frame+dg-* SVG primitive(marker ah·ahy)·mem-stack·
     cmp-tbl.compact·안전영역 압축값(slide-content gap·def-box·metaphor 등).
   ─ 본 데크 시그니처 = ① 자원 할당 그래프(RAG) 환형 대기 도식(dg-box ○프로세스/
     □자원 노드 + dg-arr 요청/할당 간선, 순환을 dg-arr-y로 강조)
     ② 은행원 알고리즘 자원 행렬(tbl.compact Alloc·Max·Need·Available + step-grid 안전순서)
     ③ 단편화 메모리 막대(membar — 파티션/할당/빈공간 블록 시각화).
   ─ 코어(_slide.css) 승격 컴포넌트는 재정의하지 않음:
     def-box · metaphor · mnemonic · real · pass-tip
     · cmp-tbl · trap-row · q-source · tbl.compact · callout.compact · choices
   ============================================================ */

/* ---------- 목표 그리드 (학습 목표) — 기준 데크 패턴 재사용 ---------- */
.obj-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.obj-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  background: var(--ink-50);
  border: 1.5px solid var(--ink-200);
  border-radius: 12px;
}
.obj-item .badge {
  width: 52px;
  height: 52px;
  background: var(--eduwill-yellow);
  color: var(--ink-1000);
  display: grid;
  place-items: center;
  font: 800 26px/1 var(--font-sans);
  border-radius: 12px;
}
.obj-item h3 { margin: 0; font: 800 18px/1.15 var(--font-sans); color: var(--ink-1000); }
.obj-item p  { margin: 4px 0 0; font-size: 13px; color: var(--ink-700); line-height: 1.4; }

/* ============================================================
   흐름 노드 행 — A → B → C inline 시퀀스 (기준 데크 .flow 재사용)
   ─ 처리 4전략 흐름·할당 분류 흐름 등
   ============================================================ */
.flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.flow .box {
  padding: 10px 16px;
  border-radius: 10px;
  background: white;
  border: 1.5px solid var(--ink-300);
  font: 700 16px/1.2 var(--font-sans);
  color: var(--ink-900);
  text-align: center;
}
.flow .box.dark { background: var(--ink-1000); color: white; border-color: var(--ink-1000); }
.flow .box.mid  { background: var(--eduwill-yellow); color: var(--ink-1000); border-color: var(--eduwill-yellow); font-weight: 800; }
.flow .box small { display: block; font-size: 11px; font-weight: 600; opacity: 0.7; margin-top: 2px; }
.flow .arw { color: var(--ink-500); font-size: 20px; font-weight: 800; }
.flow .arw small { display: block; font-size: 10px; font-weight: 700; opacity: 0.75; text-transform: none; }

/* ============================================================
   SVG diagram primitives — 노드/간선/박스 (기준 데크 dg-* 재사용)
   ─ 자원 할당 그래프(RAG)의 프로세스/자원 노드·요청/할당 간선·환형 강조
   ============================================================ */
.dg-line   { stroke: var(--ink-300); stroke-width: 2; }
.dg-line-y { stroke: var(--eduwill-yellow-600); stroke-width: 2.5; }
.dg-edge   { stroke: var(--ink-400); stroke-width: 2.5; }
.dg-edge-y { stroke: var(--eduwill-yellow-600); stroke-width: 3; }
.dg-cap    { fill: var(--ink-500); font: 700 12px var(--font-sans); text-anchor: middle; }

/* 트리/그래프 도식 프레임 */
.tree-frame {
  background: var(--ink-50);
  border: 1.5px solid var(--ink-200);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  place-items: center;
}
.tree-frame.hi { background: var(--eduwill-yellow-50); border-color: var(--eduwill-yellow); }
.tree-frame svg { width: 100%; height: auto; max-height: 290px; display: block; }
.tree-frame .cap { margin-top: 6px; font-size: 12px; color: var(--ink-500); font-weight: 600; text-align: center; }

/* ---------- utility: small caption ---------- */
.cap { font-size: 12px; color: var(--ink-500); }

/* 노드/간선 SVG primitives (기준 데크 계승) */
.dg-box   { fill: white; stroke: var(--ink-300); stroke-width: 2; }
.dg-box-d { fill: var(--ink-1000); stroke: var(--ink-1000); }
.dg-box-y { fill: var(--eduwill-yellow); stroke: var(--eduwill-yellow-600); }
.dg-bt    { fill: var(--ink-1000); font: 800 16px var(--font-sans); text-anchor: middle; dominant-baseline: central; }
.dg-bt-w  { fill: white; font: 800 16px var(--font-sans); text-anchor: middle; dominant-baseline: central; }
.dg-bt-s  { fill: var(--ink-500); font: 700 10px var(--font-sans); text-anchor: middle; dominant-baseline: central; }
.dg-arr   { stroke: var(--ink-400); stroke-width: 2.5; fill: none; marker-end: url(#ah); }
.dg-arr-y { stroke: var(--eduwill-yellow-600); stroke-width: 3; fill: none; marker-end: url(#ahy); }
.dg-flab  { fill: var(--ink-700); font: 800 12px var(--font-sans); text-anchor: middle; }
.dg-flab-y{ fill: var(--eduwill-yellow-700); font: 800 12px var(--font-sans); text-anchor: middle; }

/* ============================================================
   단계 카드 그리드 — 은행원 안전순서 탐색 단계 등 (기준 데크 step-grid 계승)
   ============================================================ */
.step-grid { display: grid; gap: 10px; }
.step-grid.c2 { grid-template-columns: 1fr 1fr; }
.step-grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
.step-grid.c5 { grid-template-columns: repeat(5, 1fr); }
.step-card {
  background: white;
  border: 1.5px solid var(--ink-200);
  border-radius: 12px;
  border-left: 5px solid var(--eduwill-yellow);
  padding: 12px 16px;
}
.step-card.gray { border-left-color: var(--ink-1000); }
.step-card.info { border-left-color: var(--info-500); }
.step-card .hd { display: flex; align-items: baseline; gap: 10px; }
.step-card .hd .nm { font: 800 16px/1 var(--font-sans); color: var(--ink-1000); }
.step-card .hd .badge2 { margin-left: auto; font: 800 13px/1 var(--font-mono); color: var(--eduwill-yellow-700); }
.step-card .bd { margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--ink-800); }
.step-card .bd b { color: var(--ink-1000); }

/* ============================================================
   comp-grid — 카드 그리드 (기준 데크 계승): 교착 4조건 2×2 등
   ============================================================ */
.comp-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.comp-grid.c2 { grid-template-columns: 1fr 1fr; }
.comp-grid.c4 { grid-template-columns: repeat(4, 1fr); }
.comp-card {
  background: white;
  border: 1.5px solid var(--ink-200);
  border-top: 5px solid var(--ink-1000);
  border-radius: 10px;
  padding: 11px 13px;
}
.comp-card.part { border-top-color: var(--eduwill-yellow); }
.comp-card .hd { display: flex; align-items: baseline; gap: 8px; }
.comp-card .ch { font: 800 22px/1 var(--font-sans); color: var(--eduwill-yellow-700); }
.comp-card .nm { font: 800 14.5px/1.15 var(--font-sans); color: var(--ink-1000); letter-spacing: -0.01em; }
.comp-card .ds { font-size: 11.5px; color: var(--ink-700); line-height: 1.4; margin-top: 6px; }
.comp-card .ds b { color: var(--ink-1000); }

/* ============================================================
   mem-stack — 행 기반 라벨+설명 적층 (기준 데크 계승, 보조)
   ============================================================ */
.mem-stack { display: flex; flex-direction: column; gap: 5px; }
.mem-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: center;
  padding: 9px 14px;
  border-radius: 8px;
  background: white;
  border: 1.5px solid var(--ink-200);
}
.mem-row .nm { font: 800 14px/1 var(--font-sans); color: var(--ink-1000); }
.mem-row .nm small { display: block; font-size: 10px; font-weight: 700; color: var(--ink-500); margin-top: 2px; }
.mem-row .ds { font-size: 12.5px; color: var(--ink-700); line-height: 1.4; }
.mem-row .ds b { color: var(--ink-1000); }
.mem-row.y { border-left: 5px solid var(--eduwill-yellow); }
.mem-row.d { border-left: 5px solid var(--ink-1000); }

/* ============================================================
   membar — 단편화 메모리 막대 (신규)
   ─ 가로 메모리 영역을 블록으로 분할 시각화. 본 데크 단편화 시그니처.
   ─ block.used=사용중(다크) / .proc=프로세스(노랑) / .free=빈 공간(점선 회색)
   ─ flex-grow를 인라인 style로 줘 크기 비율을 표현.
   ============================================================ */
.membar {
  display: flex;
  width: 100%;
  height: 60px;
  border: 2px solid var(--ink-1000);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}
.membar .blk {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 2px solid var(--ink-1000);
  font: 800 13px/1.15 var(--font-sans);
  text-align: center;
  padding: 0 4px;
  min-width: 0;
}
.membar .blk:last-child { border-right: none; }
.membar .blk small { font-size: 10px; font-weight: 700; opacity: 0.8; margin-top: 2px; }
.membar .blk.used { background: var(--ink-1000); color: white; }
.membar .blk.proc { background: var(--eduwill-yellow); color: var(--ink-1000); }
.membar .blk.free {
  background: repeating-linear-gradient(45deg, var(--ink-50), var(--ink-50) 7px, var(--ink-100) 7px, var(--ink-100) 14px);
  color: var(--ink-600);
}
.membar .blk.waste { background: var(--err-50); color: var(--err-700); border-left: 2px dashed var(--err-500); }
.membar-cap { margin-top: 7px; font-size: 12.5px; color: var(--ink-700); font-weight: 600; text-align: center; }
.membar-cap b { color: var(--err-600); }

/* ============================================================
   푸터 안전영역(y≤672) 압축 — 기준 데크 검증값 계승
   _slide.css 코어보다 뒤에 로드되므로 이 데크에만 적용됨.
   ============================================================ */
.slide-content { gap: 22px; }

.def-box { grid-template-columns: 118px 1fr; }
.def-box .term { padding: 14px 10px; }
.def-box .term .abbr { font-size: 23px; letter-spacing: -0.02em; line-height: 1.05; }
.def-box .term .full { font-size: 10px; margin-top: 4px; line-height: 1.25; word-break: keep-all; }
.def-box .body { padding: 14px 20px; }
.def-box .body .label { font-size: 11px; }
.def-box .body .text { font-size: 15.5px; line-height: 1.45; margin-top: 4px; }

.metaphor { padding: 13px 18px; }
.metaphor .icon { width: 38px; height: 38px; font-size: 18px; }
.metaphor .text { font-size: 14.5px; line-height: 1.45; }

.pass-tip, .real, .callout.compact { padding: 12px 18px; }
.pass-tip .text, .real .text { font-size: 14.5px; line-height: 1.45; }
.mnemonic { padding: 13px 20px; }
.mnemonic .phrase { font-size: 18px; }

/* ---------- cmp-tbl 압축 변형 (다축 비교표 안전영역 보존) ---------- */
.cmp-tbl.compact { font-size: 13.5px; }
.cmp-tbl.compact thead th { padding: 8px 14px; font-size: 13px; }
.cmp-tbl.compact tbody td { padding: 7px 14px; }
.cmp-tbl.compact tbody td:first-child { width: 110px; }
