/* ============================================================
   형태가 계산한다 · 스터디 페이지
   모노톤: 흑·백·중립회색만 사용
   ============================================================ */

:root {
  --ink: #111;
  --ink-2: #444;
  --ink-3: #888;
  --line: #d4d4d4;
  --line-2: #e9e9e9;
  --paper: #fff;
  --paper-2: #f5f5f5;
  --paper-3: #ececec;
  --max: 1080px;
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, "D2Coding", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.7;
  font-size: 16px;
  word-break: keep-all;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 3px; }
pre { margin: 0; }
pre code { background: none; padding: 0; }
b, strong { font-weight: 700; }
.muted { color: var(--ink-3); }

/* ---------- Masthead (스크롤과 함께 올라감) ---------- */
.masthead { max-width: var(--max); margin: 0 auto; padding: 56px 24px 36px; }
.masthead__eyebrow { margin: 0 0 14px; font-size: 13px; letter-spacing: 0.04em; color: var(--ink-3); }
.masthead__title { margin: 0 0 18px; font-size: clamp(40px, 6.5vw, 68px); line-height: 1.05; letter-spacing: -0.01em; font-weight: 300; }
.masthead__lead { max-width: 820px; font-size: 17px; line-height: 1.8; margin: 0; color: var(--ink-2); }
@media (max-width: 720px) { .masthead__lead br { display: none; } }

/* ---------- Top bar: 메뉴 위치에 도달하면 상단 고정 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.94); backdrop-filter: blur(6px);
}
.topbar__inner {
  position: relative;
  max-width: var(--max); margin: 0 auto; padding: 0 24px;
  height: 68px; display: flex; align-items: stretch; gap: 28px;
}
.topbar__inner::before { /* 전체 폭 회색 가로선: 주메뉴 하단 0px, 탭 밑줄과 정확히 같은 높이·두께 */
  content: ""; position: absolute; left: 50%; bottom: 0; width: 100vw; height: 2px;
  transform: translateX(-50%); background: var(--line); pointer-events: none;
}
.topbar__title {
  display: flex; align-items: center; font-weight: 300; font-size: 18px; letter-spacing: 0.02em;
  text-decoration: none; white-space: nowrap; color: var(--ink-3);
  opacity: 0; transition: opacity .2s;            /* 고정된 뒤에만 보임 */
}
.topbar.is-stuck .topbar__title { opacity: 1; color: var(--ink); font-weight: 700; font-size: 22px; }
.topbar__nav { display: flex; margin-left: auto; font-size: 16px; white-space: nowrap; overflow-x: auto; transition: margin .25s ease; }
/* 최상단에서는 선택된 섹션이 없으므로 대메뉴를 왼쪽에 둔다.
   제목은 opacity:0이어도 폭을 차지하므로 이때만 접어준다 */
.topbar__nav.is-start { margin-left: 0; margin-right: auto; }
.topbar__inner:has(.topbar__nav.is-start) .topbar__title { width: 0; overflow: hidden; }
.topbar__inner:has(.topbar__nav.is-start) { gap: 0; }
.topbar__nav a {
  position: relative; display: flex; align-items: center; padding: 0 18px;
  text-decoration: none; color: var(--ink-3); transition: color .15s;
}
.topbar__nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: transparent; z-index: 1; }
.topbar__nav a:hover { color: var(--ink); }
.topbar__nav a.is-active { color: var(--ink); font-weight: 700; }
.topbar__nav a.is-active::after { background: var(--ink); }
.topbar__nav a:last-child { padding-right: 0; }
/* 왼쪽 정렬일 때는 첫 항목이 좌측 기준선에 맞아야 한다 */
.topbar__nav.is-start a:first-child { padding-left: 0; }

/* 서브메뉴: 현재 섹션의 하위 항목 (topbar 안, ::after 가로선 위에 얹힘) */
.subbar { position: relative; background: #fff; }
/* 서브메뉴는 활성 대메뉴 항목의 중앙에 맞춘다(위치는 JS의 alignSub이 padding-left로 지정) */
.subbar__inner { max-width: var(--max); margin: 0 auto; padding: 0 24px 12px; height: 52px; display: flex; align-items: flex-start; justify-content: flex-start; overflow-x: auto; white-space: nowrap; }
.subbar__inner a { display: flex; align-items: center; height: 40px; padding: 0 18px; font-size: 14px; color: var(--ink-3); text-decoration: none; position: relative; }
.subbar__inner a:hover { color: var(--ink); }
.subbar__inner a.is-active { color: var(--ink); }
.subbar[hidden] { display: none; }

/* 고정 바 높이만큼 앵커 이동 보정 */
.section, #top { scroll-margin-top: 72px; }
/* 서브메뉴로 점프하는 대상들 · 고정 바(120px) 아래로 충분히 띄운다 */
.case[id], .theory__item[id], .grid[id], .tradeoff[id], .table-wrap[id] { scroll-margin-top: 160px; }

/* ---------- Section ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.section { padding: 64px 0; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: 0; }
.section__head { margin-bottom: 40px; }
.section__num { display: inline-block; font-size: 12px; color: var(--ink-3); border: 1px solid var(--line); padding: 2px 8px; margin-bottom: 12px; font-family: var(--mono); }
.section__kind {
  display: inline-block; font-size: 12px; font-family: var(--mono); letter-spacing: 0.06em;
  color: var(--ink-2); border: 1px solid var(--ink-2); padding: 3px 10px; border-radius: 999px; margin-bottom: 14px;
}
.section--tinted {
  background: var(--paper-2); border-radius: 16px;
  padding: 48px 32px; margin: 32px 0; border-bottom: 0;
}
.section--tinted .case { border-top-color: var(--line); }
.section--tinted .demo { background: var(--paper); }
.section--tinted .demo__stage { background: var(--paper); }
.section--tinted .svg-demo, .section--tinted .demo__stage canvas { background: #ededed; }
.section--tinted .section__kind { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.section__title { margin: 0 0 12px; font-size: clamp(24px, 3.5vw, 34px); line-height: 1.25; letter-spacing: -0.01em; }
.section__lead { margin: 0; color: var(--ink-2); max-width: 680px; }

/* ---------- Case ---------- */
.case {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 32px;
  padding: 40px 0;
  border-top: 1px solid var(--line-2);
}
.case:first-of-type { border-top: 0; padding-top: 0; }
.case__title { margin: 0 0 12px; font-size: 22px; line-height: 1.3; }
.case__tag { display: block; font-size: 13px; font-weight: 400; color: var(--ink-3); margin-top: 4px; }
.case__body p { margin: 0 0 14px; color: var(--ink-2); }

.figure { margin: 0 0 16px; }
.figure img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--paper-2); border-radius: 10px; filter: grayscale(1); transition: filter .3s; }
.figure img:hover { filter: grayscale(0); }
.figure--small img { aspect-ratio: 16/9; }
.figure--natural img { aspect-ratio: auto; object-fit: contain; background: #fff; }
.figure figcaption { font-size: 13px; color: var(--ink-3); margin-top: 8px; line-height: 1.5; }
.figure--card img { aspect-ratio: 1; }
.figure--card figcaption { font-size: 14px; color: var(--ink-2); }
.figure--card figcaption b { display: inline-block; font-size: 16px; color: var(--ink); margin: 4px 6px 0 0; }
.figure--card figcaption .muted { font-size: 13px; }
.figure--card figcaption p { margin: 6px 0 0; line-height: 1.65; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; margin-top: 40px; }

/* ---------- Demo ---------- */
.demo {
  border: 1px solid var(--ink);
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr;
}
.demo--full { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); border: 0; gap: 32px; }
.demo--full .demo__stage { border: 1px solid var(--line); padding: 12px; }
.demo__stage { padding: 16px; background: var(--paper); }
.demo__stage--row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding-bottom: 24px; }
.demo__stage canvas { width: 100%; height: auto; display: block; background: var(--paper-2); touch-action: none; }
.demo__title { margin: 0 0 12px; font-size: 22px; line-height: 1.3; }
.demo__text p { color: var(--ink-2); margin: 0 0 12px; }
.demo__note { font-size: 14px; border-left: 2px solid var(--ink); padding-left: 12px; }
.demo__hint { font-size: 14px; color: var(--ink-3); margin: 10px 0 0; }
.demo__label { font-size: 13px; color: var(--ink-3); font-family: var(--mono); }
.demo__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; }
.svg-demo { width: 100%; height: auto; display: block; background: var(--paper-2); }
.svg-label { font-family: var(--mono); font-size: 12px; fill: var(--ink-2); }

.range { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: 14px; flex: 1; min-width: 180px; }
.range output { font-family: var(--mono); }
input[type=range] { width: 100%; accent-color: var(--ink); }
.check { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.check input { accent-color: var(--ink); }

.btn {
  font: inherit; font-size: 14px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  transition: background .15s, color .15s;
}
.btn:hover { background: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: var(--paper); color: var(--ink); }
.btn--ghost:hover { background: var(--paper-2); }

/* 코드 / 재료 비교 */
.compare { border-top: 1px solid var(--ink); background: var(--paper-2); }
.compare__tabs { display: flex; border-bottom: 1px solid var(--line); }
.compare__tab {
  font: inherit; font-size: 13px; padding: 8px 16px; cursor: pointer;
  background: none; border: 0; border-right: 1px solid var(--line); color: var(--ink-3);
}
.compare__tab.is-active { color: var(--ink); background: var(--paper); font-weight: 700; }
.compare__panel { display: none; padding: 16px; font-size: 14px; }
.compare__panel.is-active { display: block; }
pre.compare__panel { font-family: var(--mono); font-size: 13px; line-height: 1.6; overflow-x: auto; white-space: pre; }
.compare__panel p { margin: 0 0 10px; color: var(--ink-2); }
.compare__panel p:last-child { margin-bottom: 0; }

/* USB */
.usb { text-align: center; }
.usb__label { margin: 0 0 8px; font-family: var(--mono); font-size: 13px; }
.usb__label .muted { font-family: var(--font); font-size: 12px; margin-left: 6px; }
.usb__svg { width: 100%; height: auto; background: var(--paper-2); margin-bottom: 12px; }
.usb__plug { will-change: transform; }
.usb__plug > g > g { transform-box: fill-box; transform-origin: center; } /* 플러그 단면 중심 기준 회전 */
.usb__plug rect:first-child { fill-opacity: .35; } /* 겹쳤을 때 포트가 비쳐 보이도록 */
.usb__stat { font-size: 13px; margin: 12px 0 8px; color: var(--ink-2); }
.usb .btn { margin-top: 4px; }
.usb.is-fail .usb__svg { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* Edge-notched cards */
.cards-legend { display: flex; gap: 20px; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.cards-legend span { display: flex; align-items: center; gap: 6px; }
.hole-icon { display: inline-block; width: 10px; height: 10px; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--paper-2); }
.hole-icon--notched { border-radius: 0 0 5px 5px; border-top: 0; height: 8px; }
.cards { position: relative; height: 300px; background: var(--paper-2); overflow: hidden; }
.cards__tray {
  position: absolute; left: 8px; right: 8px; bottom: 8px; height: 64px;
  border: 1px dashed var(--ink-3); display: flex; align-items: flex-end; justify-content: center;
}
.cards__tray span { font-size: 11px; color: var(--ink-3); padding-bottom: 4px; }
.card {
  position: absolute; top: 84px; width: 17%; min-width: 90px; height: 128px;
  background: var(--paper); border: 1px solid var(--ink);
  transform: translateY(0) rotate(var(--r, 0deg));
  transition: transform .7s cubic-bezier(.4,0,.5,1), opacity .7s;
  padding: 20px 8px 6px; font-size: 11px; line-height: 1.35;
}
.card.is-lifted { transform: translateY(-66px) rotate(var(--r, 0deg)); }   /* 막대에 걸려 딸려 올라감 */
.card.is-dropped { transform: translateY(96px) rotate(calc(var(--r, 0deg) * 3)); } /* 홈이라 빠져 떨어짐 */
.card__holes { position: absolute; top: 0; left: 12%; right: 12%; height: 14px; display: flex; }
.card__hole { flex: 1; position: relative; }
.card__hole::after {
  content: ""; position: absolute; left: 50%; top: 3px; width: 7px; height: 7px;
  border-radius: 50%; border: 1.5px solid var(--ink); background: var(--paper-2); transform: translateX(-50%);
}
.card__hole.is-notched::after { border-radius: 0 0 4px 4px; top: -1px; height: 8px; border-top: 0; }
.card__hole.is-rod::before {
  content: ""; position: absolute; left: 50%; top: -78px; width: 3px; height: 88px; background: var(--ink); transform: translateX(-50%); z-index: 2;
}
.card__title { font-weight: 700; margin-bottom: 3px; font-size: 11px; }
.card__tags { color: var(--ink-3); font-family: var(--mono); font-size: 10px; line-height: 1.5; }
.cards-result { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; min-height: 1.4em; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13px; padding: 4px 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
}
.chip.is-active { border-color: var(--ink); background: var(--ink); color: var(--paper); }

/* Weave: 재킷 소매 + 폰 */
.jacq { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; align-items: start; }
.jacq__label { margin: 0 0 8px; font-size: 12px; font-family: var(--mono); color: var(--ink-3); }
.weave {
  position: relative; display: grid; grid-template-columns: repeat(16, 1fr);
  background: var(--paper-2); padding: 12px; border-radius: 12px;
  touch-action: none; user-select: none; cursor: pointer;
}
.weave::after { /* 천 가장자리 스티치 */
  content: ""; position: absolute; inset: 5px; border: 1px dashed #c4c4c4; border-radius: 9px; pointer-events: none;
}
/* 씨실(가로)·날실(세로)을 띠로 그리고, 칸마다 위아래 교차를 뒤집어 직조 패턴을 만든다 */
.weave__cell {
  aspect-ratio: 1;
  --wf: #dcdcdc; /* 씨실 */
  --wp: #d2d2d2; /* 날실 */
  background-image:
    linear-gradient(90deg, transparent 8%, var(--wp) 8%, var(--wp) 92%, transparent 92%),
    linear-gradient(transparent 8%, var(--wf) 8%, var(--wf) 92%, transparent 92%);
  transition: --wf .25s, --wp .25s;
}
.weave__cell.alt { /* 옆 칸은 씨실이 위로 */
  background-image:
    linear-gradient(transparent 8%, var(--wf) 8%, var(--wf) 92%, transparent 92%),
    linear-gradient(90deg, transparent 8%, var(--wp) 8%, var(--wp) 92%, transparent 92%);
}
.weave__cell.is-cond-h { --wf: #8e8e8e; }
.weave__cell.is-cond-v { --wp: #8e8e8e; }
.weave__cell.is-warm.is-cond-h { --wf: #4a4a4a; }
.weave__cell.is-warm.is-cond-v { --wp: #4a4a4a; }
.weave__cell.is-press { background-color: #cfcfcf; }        /* 눌린 주변 */
.weave__cell.is-press-center { background-color: #b5b5b5; } /* 손가락 자리 */
.weave__cell.is-hot.is-cond-h { --wf: #111; }
.weave__cell.is-hot.is-cond-v { --wp: #111; }
.phone { border: 2px solid var(--ink); border-radius: 14px; padding: 8px; max-width: 170px; }
.phone__screen { background: var(--paper-2); border-radius: 8px; padding: 18px 12px; text-align: center; min-height: 96px; }
.phone__track { margin: 0 0 8px; font-family: var(--mono); font-size: 15px; font-weight: 700; }
.phone__action { margin: 0; font-size: 13px; color: var(--ink-2); min-height: 1.3em; }
@media (max-width: 560px) { .jacq { grid-template-columns: 1fr; } }

/* Theory */
.theory { display: grid; gap: 32px; }
.theory__item { border-top: 1px solid var(--line-2); padding-top: 24px; }
.theory__item:first-child { border-top: 0; padding-top: 0; }
.theory__item h3 { margin: 0 0 10px; font-size: 19px; line-height: 1.4; }
.theory__item h3 .muted { display: block; font-size: 13px; font-weight: 400; }
.theory__item p { margin: 0; color: var(--ink-2); max-width: 760px; }
.theory__fig { max-width: 340px; margin: 14px 0; }
.theory__fig img { aspect-ratio: 4/3; }
.theory__item--demo .demo { max-width: 760px; }

/* Tradeoff */
.tradeoff { display: grid; gap: 20px; }
.tradeoff__pick p { margin: 0 0 8px; font-size: 13px; }
.tradeoff__criteria { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.crit { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); cursor: pointer; }
.crit input { accent-color: var(--ink); }
.crit.is-on { border-color: var(--ink); }
.tradeoff__verdict { border-top: 1px solid var(--line); padding-top: 16px; font-size: 15px; }
.tradeoff__verdict strong { display: block; font-size: 18px; margin-bottom: 6px; }
.tradeoff__verdict p { margin: 0 0 6px; color: var(--ink-2); }
.tradeoff__verdict .bar { height: 10px; background: var(--paper-3); border: 1px solid var(--line); margin: 8px 0 6px; position: relative; }
.tradeoff__verdict .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); transition: width .3s; }
.tradeoff__verdict .bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.tradeoff__verdict .bar-label span:nth-child(2) { opacity: .75; }
.tradeoff__verdict .bar-legend { font-size: 12px; color: var(--ink-3); margin: 18px 0 10px; line-height: 1.6; }
.tradeoff__verdict .bar-legend b { color: var(--ink); }
.tradeoff__verdict .bar-reading { font-size: 13px; margin: 8px 0 0; padding-left: 10px; border-left: 2px solid var(--ink); line-height: 1.6; }

/* 좁은 칼럼 안에 들어가는 표라 가로 스크롤 대신 줄바꿈으로 맞춘다 */
.table-wrap { overflow-x: visible; }
.table { border-collapse: collapse; width: 100%; font-size: 14px; table-layout: fixed; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; }
.table thead th { border-bottom: 1px solid var(--ink); font-weight: 700; }
.table tbody th { font-weight: 700; color: var(--ink-2); width: 22%; }
.table thead th:first-child { width: 22%; }

/* Sources */
.sources { display: grid; grid-template-columns: 3fr 2fr; gap: 40px; font-size: 14px; }
.sources h3 { margin: 0 0 10px; font-size: 15px; }
.sources ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.sources li { margin-bottom: 6px; line-height: 1.5; }

.footer { max-width: var(--max); margin: 0 auto; padding: 32px 24px 64px; border-top: 1px solid var(--ink); font-size: 13px; color: var(--ink-3); }
.footer p { margin: 0; }
/* 서명 · steve 프로젝트와 동일한 형식 */
.signature { font-family: var(--mono); font-size: 12px; color: var(--ink-3); text-align: right; }
/* 평소엔 서명의 일부로 조용히, 가리키면 링크임이 드러난다 */
.signature__link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-2);
  transition: color .15s ease, border-color .15s ease; }
.signature__link:hover { color: var(--ink); border-bottom-color: var(--ink); }

.seg { display: flex; align-items: center; gap: 8px; }

#bio-run { min-width: 110px; } /* 달리기 시작/멈추기 라벨이 바뀌어도 폭 유지 */

/* 바이메탈 회로: 전류 흐름 애니메이션 */
.current { animation: flow 1s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -10; } }

/* 사운드 토글 */
.sound-toggle {
  position: fixed; right: 16px; bottom: 16px; z-index: 10;
  font: inherit; font-size: 12px; padding: 6px 10px; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
}
.sound-toggle.is-off { background: var(--paper); color: var(--ink-3); border-color: var(--line); }

.crit { justify-content: flex-start; }
.crit__n { flex: 1; }
.crit__w { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.crit.is-on .crit__w { color: var(--ink); }
.tradeoff__verdict .bar { position: relative; }
.tradeoff__verdict .bar__mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-3); z-index: 1; }
.tradeoff__verdict .tally { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin: 10px 0 0; }
.tradeoff__verdict .verdict__head { font-weight: 600; margin: 12px 0 4px; }
.reasons { list-style: none; padding: 0; margin: 12px 0 0; border-top: 1px solid var(--line); }
.reasons li { font-size: 13px; padding: 7px 0 7px 10px; border-bottom: 1px solid var(--line); border-left: 2px solid var(--line); }
.reasons li.is-mat { border-left-color: var(--ink); }
.reasons li.is-sw { border-left-color: var(--ink-3); }
.reasons b { font-family: var(--mono); font-size: 11px; margin-right: 6px; }

.comp__row { display: flex; align-items: stretch; gap: 12px; }
.comp__plus { align-self: center; font-family: var(--mono); color: var(--ink-3); }
.comp__part {
  flex: 1; text-align: left; cursor: pointer; font: inherit;
  background: var(--paper); border: 1px solid var(--line); padding: 14px;
  transition: border-color .15s, background .15s;
}
.comp__part b { display: block; font-size: 14px; color: var(--ink-3); }
.comp__part span { display: block; font-size: 12px; color: var(--ink-3); margin-top: 6px; line-height: 1.5; }
.comp__part.is-on { border-color: var(--ink); background: var(--paper-2); }
.comp__part.is-on b { color: var(--ink); }
.comp__task { margin: 0 0 14px; font-size: 13px; color: var(--ink-3); }
.comp__task b { color: var(--ink); }
.comp__result { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.comp__result > b { display: block; font-size: 15px; }
.comp__result > span { display: block; font-size: 13px; color: var(--ink-3); margin-top: 6px; line-height: 1.6; }
.comp__result > span b { color: var(--ink); }
.comp.is-both .comp__result { border-top-color: var(--ink); }
.comp__good { border-left: 2px solid var(--ink); padding-left: 10px; }
.comp__bad { border-left: 2px solid var(--line); padding-left: 10px; }
.comp__note { margin-top: 10px !important; padding-top: 10px; border-top: 1px solid var(--line); }
.comp__mp { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.comp__mplabel { margin: 0 0 10px; font-size: 13px; color: var(--ink-3); }
.comp__props { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 560px) { .comp__row { flex-direction: column; } .comp__plus { align-self: flex-start; } }

@media (max-width: 560px) {
  .tradeoff__verdict .bar-label span:nth-child(2) { display: none; }
  .tradeoff__verdict .bar-label { font-size: 10px; }
}
.sources__lead { font-size: 12px; margin: 0 0 14px; }
.sources__group { font-size: 12px; font-family: var(--mono); color: var(--ink-3); font-weight: 400; margin: 16px 0 6px; letter-spacing: .03em; }
.sources__group:first-of-type { margin-top: 0; }
/* 아주 좁은 화면(360px 미만)에서 넘치던 것들 정리
   · 코드 블록과 데모 판은 그리드/플렉스 자식이라 min-width:auto가 기본이어서
     내용 길이만큼 부풀며 페이지 전체에 가로 스크롤을 만들었다 */
.demo, .demo__stage, .compare, .case__body, .case__media, .table-wrap { min-width: 0; }
pre.compare__panel { max-width: 100%; }
@media (max-width: 420px) {
  pre.compare__panel { font-size: 12px; padding: 12px; }
  .demo__stage { padding: 12px; }
  .compare__panel { padding: 12px; }
  .section { padding: 36px 0; }
  .masthead { padding-left: 16px; padding-right: 16px; }
  .wrap, .footer { padding-left: 16px; padding-right: 16px; }
  .figure figcaption { font-size: 12px; }
  .demo__controls { gap: 8px 10px; }
  .btn { padding: 8px 12px; font-size: 13px; }
}
/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .case, .demo--full, .sources { grid-template-columns: 1fr; }
  .topbar__inner { gap: 14px; }
  .topbar__nav a { padding: 0 10px; }
  .masthead { padding-top: 36px; }
}

/* 모바일 상단 메뉴 · 가로 스크롤이 되지만 그 사실이 안 보이던 문제 */
@media (max-width: 700px) {
  /* 제목을 메뉴 위에 세로로 쌓는다. 아래 패딩은 0 ·
     메뉴 밑줄이 바의 가로선과 정확히 같은 높이에 오도록 */
  .topbar__inner {
    flex-direction: column; align-items: stretch; gap: 10px;
    padding: 14px 16px 0; height: auto;
  }
  /* 제목은 가운데 · 고정 전에는 자리를 차지하지 않는다 */
  .topbar__title {
    justify-content: center; font-size: 20px; line-height: 1.3;
    height: 0; overflow: hidden; transition: height .2s;
  }
  /* 20px 글자의 줄상자(26px)보다 넉넉해야 위아래가 잘리지 않는다 */
  .topbar.is-stuck .topbar__title { height: 34px; font-size: 20px; }
  /* 메뉴 줄이 가로선에 닿도록 높이를 준다 */
  .topbar__nav a { height: 40px; }
  .topbar__nav {
    margin-left: 0; width: 100%; font-size: 14px;
    /* 항목이 다 들어가면 가운데, 넘치면 왼쪽부터(잘리지 않도록) */
    justify-content: safe center;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    /* 오른쪽 끝이 흐려져 "더 있다"가 보인다 */
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
            mask-image: linear-gradient(to right, #000 88%, transparent);
  }
  .topbar__nav::-webkit-scrollbar { display: none; }
  .topbar__nav a { padding: 0 10px; flex: 0 0 auto; }
  .topbar__nav a:first-child { padding-left: 12px; }
  .topbar__nav a:last-child { padding-right: 12px; }

  .subbar__inner {
    justify-content: safe center; padding: 6px 16px; height: 42px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 94%, transparent);
            mask-image: linear-gradient(to right, #000 94%, transparent);
  }
  .subbar__inner::-webkit-scrollbar { display: none; }
  .subbar__inner a { padding: 0 9px; flex: 0 0 auto; font-size: 13px; }
  .subbar__inner a:first-child { padding-left: 12px; }
  .subbar__inner a:last-child { padding-right: 12px; }

  /* 바 높이에 맞춰 앵커 보정 */
  .section, #top { scroll-margin-top: 64px; }
  .case[id], .theory__item[id], .grid[id], .tradeoff[id], .table-wrap[id] { scroll-margin-top: 172px; }
}
@media (max-width: 560px) {
  .grid, .demo__stage--row { grid-template-columns: 1fr; }
  .signature { text-align: center; }
  .section { padding: 44px 0; }
}
