/* 프로그래밍 언어론 3강 전용 스타일: 그림 속 글씨 크기, 코드 상자, 칸, 상태, 표시 */

/* 그림 속 글씨는 12px 이상 */
.viz text.s,
.viz text.n,
.viz text.v-num { font-size: 12px; }
.viz text.v-num.big { font-size: 20px; }
.viz text.k { fill: var(--key); font-weight: 700; }
.viz text.v { fill: var(--value); font-weight: 700; }
.viz text.bad { font-weight: 700; }
.viz text.tag { font-size: 12px; font-weight: 700; fill: var(--muted); }
.viz text.fx { transition: opacity 0.3s ease, fill 0.3s ease; }
.viz text.dim { opacity: 0.35; }

/* 코드 글씨 */
.viz text.code {
  font-family: var(--mono);
  font-size: 12.5px;
  fill: var(--text);
}
.viz text.code.m { fill: var(--muted); }
.viz text.code.on { fill: var(--accent); }
.viz text.code.k { fill: var(--key); }
.viz text.code.bad { fill: var(--value); }
.viz text.code tspan { transition: fill 0.3s ease, fill-opacity 0.3s ease; }
.viz text.code tspan.on { fill: var(--accent); font-weight: 700; }
.viz text.code tspan.k { fill: var(--key); font-weight: 700; }
.viz text.code tspan.v,
.viz text.code tspan.bad { fill: var(--value); font-weight: 700; }
.viz text.code tspan.m { fill: var(--muted); }
.viz text.code tspan.hide { fill-opacity: 0; }

/* 코드 상자와 줄 강조 */
.v-code { fill: #0a0c10; stroke: var(--line); }
.v-codeblock { transition: opacity 0.3s ease; }
.v-codeblock.dim { opacity: 0.4; }
.v-codeblock.hide { opacity: 0; }
.v-hl { fill: var(--accent); opacity: 0.2; }
.v-hl.bad { fill: var(--value); opacity: 0.24; }
.v-hl.k { fill: var(--key); opacity: 0.22; }
.v-hl.hide { opacity: 0; }

/* 칩: 틀림(붉은 테두리), 청록 */
.v-chip.bad rect { fill: none; stroke: var(--value); stroke-width: 1.5; }
.v-chip.bad text { fill: var(--value); }
.v-chip.k rect { fill: none; stroke: var(--key); stroke-width: 1.5; }
.v-chip.k text { fill: var(--key); }
.v-chip.kk rect { fill: var(--key); }
.v-chip.kk text { fill: var(--on-accent); }

/* 메모리 칸, 표의 칸 */
.v-cellbox {
  fill: var(--surface-2);
  stroke: transparent;
  stroke-width: 1.5;
  transition: stroke 0.25s ease, fill 0.3s ease, opacity 0.3s ease;
}
.v-cellbox.k { stroke: var(--key); }
.v-cellbox.on { stroke: var(--accent); fill: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.v-cellbox.bad { stroke: var(--value); fill: color-mix(in srgb, var(--value) 20%, var(--surface)); }
.v-cellbox.dim { opacity: 0.4; }

/* 체크와 가위표 */
.v-mark {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.3s ease;
}
.v-mark.bad { stroke: var(--value); }
.v-mark.hide { opacity: 0; }

/* 틀, 상자 */
.v-frame { transition: stroke 0.3s ease, opacity 0.3s ease; }
.v-frame.bad { stroke: var(--value); }
.v-frame.k { stroke: var(--key); }
.v-frame.soft { fill: none; stroke-dasharray: 3 3; }
.v-box rect { transition: stroke 0.3s ease; }
.v-box.fx { transition: opacity 0.3s ease; }
.v-step { transition: opacity 0.3s ease; }
.v-step.dim { opacity: 0.4; }
.v-step.bad .bg { stroke: var(--value); }

/* 곧은 점선 (V.path 는 길이를 1로 맞추므로 점선은 따로 그린다) */
.v-rule { fill: none; stroke: var(--line); stroke-width: 1.2; }
.v-rule.dot { stroke: var(--muted); stroke-dasharray: 3 4; }
.v-rule.on { stroke: var(--accent); }

/* 선과 화살표의 색 바꾸기 */
.v-line.fx { transition: opacity 0.3s ease, stroke 0.3s ease, stroke-width 0.3s ease; }
.v-line.hide, .v-vector.hide { opacity: 0; }
.v-line.soft { stroke: var(--line); }
.v-vector { transition: opacity 0.3s ease; }
.v-vector line, .v-vector path { transition: stroke 0.3s ease; }
.v-vector.k line, .v-vector.k path { stroke: var(--key); }
.v-vector.bad line, .v-vector.bad path { stroke: var(--value); }
.v-vector.dim { opacity: 0.35; }

.v-line.docline { stroke: #4b5263; }
.v-bar.badsoft { fill: color-mix(in srgb, var(--value) 32%, var(--surface-2)); }
.v-dot.k { fill: var(--key); }
.v-dot.bad { fill: var(--value); }
.v-dot.m { fill: var(--muted); }
.v-bar { transition: opacity 0.3s ease; }
.v-bar.dim { opacity: 0.3; }
.v-tri { fill: var(--accent); }
.v-tri.bad { fill: var(--value); }
.v-grid rect.hide { opacity: 0; }

.fx.off { opacity: 0.18; }
.nb { white-space: nowrap; }

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

/* --- 3강에서 더한 것 --- */

/* 상태 다이어그램의 상태 (둥근 칸) */
.v-state rect {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1.5;
  transition: stroke 0.25s ease, fill 0.25s ease;
}
.v-state text { fill: var(--text); font-weight: 600; transition: fill 0.25s ease; }
.v-state.on rect { stroke: var(--accent); fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.v-state.on text { fill: var(--accent); }
.v-state.k rect { stroke: var(--key); fill: color-mix(in srgb, var(--key) 18%, var(--surface)); }
.v-state.k text { fill: var(--key); }
.v-state { transition: opacity 0.3s ease; }
.v-state.dim { opacity: 0.4; }

/* 굽은 화살표의 머리 */
.v-head {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.3s ease, opacity 0.3s ease;
}
.v-head.on { stroke: var(--accent); }
.v-head.k { stroke: var(--key); }
.v-head.bad { stroke: var(--value); }
.v-head.hide { opacity: 0; }
.v-line.fat { stroke-width: 2.4; }
.v-line.thin { stroke-width: 0.7; }

/* 칩: 흐린 틀, 붉게 채움 */
.v-chip.ghost rect { fill: none; stroke: var(--line); stroke-width: 1.2; stroke-dasharray: 3 3; }
.v-chip.ghost text { fill: var(--muted); }
.v-chip.badfill rect { fill: var(--value); }
.v-chip.badfill text { fill: var(--on-accent); }
.v-chip.st rect { fill: none; stroke: var(--key); stroke-width: 1.3; }
.v-chip.st text { fill: var(--key); }
.v-chip.st.on rect { fill: var(--accent); stroke: var(--accent); }
.v-chip.st.on text { fill: var(--on-accent); }

/* 표의 칸 */
.v-cellbox.head { fill: none; }
.v-cellbox.kk { stroke: var(--key); fill: color-mix(in srgb, var(--key) 20%, var(--surface)); }
.v-cellbox.soft { fill: color-mix(in srgb, var(--accent) 9%, var(--surface-2)); }
.v-cellbox.softk { fill: color-mix(in srgb, var(--key) 9%, var(--surface-2)); }
.v-cellbox.blank { fill: var(--surface); }

/* 단계 줄: 청록, 붉은 강조 */
.v-step.k .bg { stroke: var(--key); }
.v-step.on.bad .bg { stroke: var(--value); }

/* 영역 (문법의 포함 관계) */
.v-region { fill: none; stroke: var(--line); stroke-width: 1.5; transition: stroke 0.3s ease; }
.v-region.on { stroke: var(--accent); fill: color-mix(in srgb, var(--accent) 7%, transparent); }
.v-region.k { stroke: var(--key); fill: color-mix(in srgb, var(--key) 9%, transparent); }

.viz text.code.b { font-weight: 700; }
.viz text.code.dim { opacity: 0.35; }
.viz text.code tspan.dim { fill-opacity: 0.35; }
.viz text.code tspan.b { fill: var(--text); font-weight: 700; }
.viz text.mono { font-family: var(--mono); }
.viz text.hide { opacity: 0; }
.v-grid rect.on { fill: var(--accent); }
.v-grid rect.k { fill: var(--key); }
