/* Chapter 04 — 조립·피팅 page styles */

/* Hero art */
.asm-hero-art { width: min(40vw, 480px); right: 0; bottom: 10px; opacity: .9; }
.asm-hero-wrench { transform-origin: 112px 64px; animation: asm-wrench 4s ease-in-out infinite; }
@keyframes asm-wrench { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-14deg); } }
@media (min-width: 861px) and (max-width: 1240px) { .asm-hero-art { display: none; } }
@media (max-width: 860px) { .asm-hero-art { max-width: 420px; } }

.asm-stats { margin-bottom: 8px; }
.asm-stats .stat-value { font-size: clamp(2rem, 4vw, 2.8rem); }

/* ---------- Tool checklist ---------- */
.tool-meter { margin-bottom: 18px; }
.tool-meter-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .92rem; margin-bottom: 8px; }
.tool-meter-track { height: 12px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.tool-meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.tool-meter-fill.full { background: var(--green); }
.tool-meter-msg { margin: 8px 0 0; font-size: .88rem; color: var(--muted); }
.tool-filter { margin-bottom: 16px; }
.tool-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 12px; }
.tool-grid li[hidden] { display: none; }
.tool-card {
  width: 100%; height: 100%; text-align: left; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto auto; column-gap: 12px; row-gap: 2px;
  padding: 14px 14px 14px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); position: relative;
  transition: border-color .2s, background .2s, transform .15s;
}
.tool-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.tool-card svg { grid-row: 1 / 4; width: 44px; height: 44px; fill: none; stroke: var(--ink-2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; padding: 6px; border-radius: 10px; background: var(--bg-2); }
.tool-name { font-weight: 700; font-size: .95rem; line-height: 1.3; padding-right: 26px; }
.tool-desc { font-size: .8rem; color: var(--muted); line-height: 1.45; }
.tool-card .tag { justify-self: start; margin-top: 4px; }
.tool-check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line-2); background: var(--surface); display: grid; place-items: center; }
.tool-card[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); }
.tool-card[aria-pressed="true"] svg { stroke: var(--green); background: var(--surface); }
.tool-card[aria-pressed="true"] .tool-check { background: var(--green); border-color: var(--green); }
.tool-card[aria-pressed="true"] .tool-check::after { content: ""; width: 10px; height: 6px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: translateY(-1px) rotate(-45deg); }

/* ---------- Wizard ---------- */
.wz:focus { outline: none; }
.wz-count { font-size: .85rem; color: var(--muted); padding-top: 6px; }
.wz-progress { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.wz-progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .4s ease; }
.wz-dots { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-wrap: wrap; gap: 6px; }
.wz-dot { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); font-family: var(--mono); font-size: .78rem; font-weight: 600; color: var(--muted); display: grid; place-items: center; padding: 0; transition: background .2s, border-color .2s, color .2s; }
.wz-dot:hover { border-color: var(--ink); color: var(--ink); }
.wz-dot.done { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.wz-dot[aria-current="step"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.wz-dot.done[aria-current="step"] { background: var(--green); border-color: var(--green); color: #fff; }

.wz-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; align-items: start; }
@media (max-width: 1180px) { .wz-body { grid-template-columns: 1fr; } }
.wz-figure { margin: 0; position: sticky; top: calc(var(--header-h) + 16px); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
@media (max-width: 1180px) { .wz-figure { position: static; } }
.wz-figure figcaption { text-align: center; margin-top: 4px; }
.wz-bike { width: 100%; height: auto; overflow: visible; }
.wz-bike * { transition: stroke .35s, fill .35s, opacity .35s; }
.wz-ground { stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 6 6; }
.wz-tire { fill: none; stroke: var(--line-2); stroke-width: 9; }
.wz-rim { fill: none; stroke: var(--line-2); stroke-width: 3; }
.wz-spoke { stroke: var(--line); stroke-width: 1.4; fill: none; }
.wz-hub { fill: var(--surface); stroke: var(--line-2); stroke-width: 3; }
.wz-axle { stroke: var(--line-2); stroke-width: 4; stroke-linecap: round; }
.wz-frame { fill: none; stroke: var(--muted); stroke-width: 9; stroke-linejoin: round; stroke-linecap: round; }
.wz-frame-thin { stroke: var(--muted); stroke-width: 8; stroke-linecap: round; }
.wz-rotor { fill: none; stroke: var(--line-2); stroke-width: 3; stroke-dasharray: 4 3; }
.wz-caliper { fill: var(--line-2); }
.wz-cable { fill: none; stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 2 0; }
.wz-ring { fill: none; stroke: var(--line-2); stroke-width: 3.5; }
.wz-chain { fill: none; stroke: var(--line-2); stroke-width: 2.5; stroke-dasharray: 4 2; }
.wz-derailleur { fill: none; stroke: var(--line-2); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.wz-crank { stroke: var(--ink-2); stroke-width: 7; stroke-linecap: round; }
.wz-crank-far { opacity: .45; }
.wz-pedal { fill: var(--ink-2); }
.wz-post { stroke: var(--ink-2); stroke-width: 6; stroke-linecap: round; }
.wz-saddle { fill: var(--ink-2); }
.wz-clamp { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2; }
.wz-stem { stroke: var(--ink-2); stroke-width: 7; stroke-linecap: round; }
.wz-bar { fill: none; stroke: var(--ink-2); stroke-width: 5; stroke-linecap: round; }
.wz-lever { fill: none; stroke: var(--ink-2); stroke-width: 6; stroke-linecap: round; }
.wz-spacer { fill: var(--ink-2); }

/* highlighted group */
.wz-bike .is-hl .wz-tire, .wz-bike .is-hl .wz-rim, .wz-bike .is-hl .wz-rotor, .wz-bike .is-hl .wz-ring,
.wz-bike .is-hl .wz-chain, .wz-bike .is-hl .wz-derailleur, .wz-bike .is-hl .wz-cable, .wz-bike .is-hl .wz-hub,
.wz-bike .is-hl .wz-axle, .wz-bike .is-hl .wz-frame, .wz-bike .is-hl .wz-frame-thin, .wz-bike .is-hl .wz-crank,
.wz-bike .is-hl .wz-post, .wz-bike .is-hl .wz-stem, .wz-bike .is-hl .wz-bar, .wz-bike .is-hl .wz-lever { stroke: var(--accent); }
.wz-bike .is-hl .wz-spoke { stroke: color-mix(in srgb, var(--accent) 45%, transparent); }
.wz-bike .is-hl .wz-caliper, .wz-bike .is-hl .wz-pedal, .wz-bike .is-hl .wz-saddle, .wz-bike .is-hl .wz-spacer { fill: var(--accent); }
.wz-bike .is-hl .wz-clamp { stroke: var(--accent); }
.wz-bike .is-hl .wz-crank-far { opacity: .55; }
.wz-bike.dim [data-part]:not(.is-hl) { opacity: .45; }

.wz-bolts circle { fill: var(--gold); stroke: var(--surface); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.wz-bike.show-bolts .wz-bolts circle { opacity: 1; animation: wz-blink 1.4s ease-in-out infinite; }
.wz-bolts circle:nth-child(2n) { animation-delay: .3s !important; }
@keyframes wz-blink { 50% { transform: scale(1.5); } }
.wz-motion path { stroke: var(--accent); stroke-width: 4; stroke-linecap: round; opacity: 0; }
.wz-bike.show-motion .wz-motion path { opacity: .8; animation: wz-dash 1s linear infinite; stroke-dasharray: 18 10; }
@keyframes wz-dash { to { stroke-dashoffset: -28; } }
.wz-box rect, .wz-box path { fill: none; stroke: var(--gold); stroke-width: 3; stroke-dasharray: 10 6; opacity: 0; }
.wz-bike.show-box .wz-box rect, .wz-bike.show-box .wz-box path { opacity: .9; }
.wz-focus { transition: transform .55s cubic-bezier(.2,.8,.2,1); }
.wz-focus-ring { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 6 5; transition: r .55s cubic-bezier(.2,.8,.2,1); }
.wz-focus-pulse { fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: none; transform-box: fill-box; transform-origin: center; animation: wz-pulse 2s ease-out infinite; transition: r .55s; }
@keyframes wz-pulse { 0% { opacity: .9; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.25); } }

.wz-steps { min-width: 0; }
.wz-step { animation: wz-in .35s ease; }
.wz-step[hidden] { display: none; }
@keyframes wz-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.wz-step-num { font-family: var(--mono); font-size: .75rem; letter-spacing: .12em; color: var(--accent); font-weight: 600; }
.wz-step h4 { font-size: 1.3rem; margin: 4px 0 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wz-step h4 .tag { font-size: .72rem; }
.wz-step p { color: var(--ink-2); font-size: .97rem; }
.wz-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; }
.wz-meta div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.wz-meta dt { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.wz-meta dd { margin: 2px 0 0; font-size: .86rem; font-weight: 600; line-height: 1.45; }
@media (max-width: 640px) { .wz-meta { grid-template-columns: 1fr; } }
.wz-step .callout { font-size: .92rem; margin: 16px 0 0; }
.wz-controls { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.wz-controls .btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.wz-done-btn { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.wz-done-btn:hover { color: var(--ink); }
.wz-done-btn[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.wz-done-btn[aria-pressed="true"]:hover { color: #fff; }
.wz-hint { font-size: .8rem; margin: 12px 0 0; }
@media (max-width: 640px) { .wz-hint { display: none; } .wz-controls .btn { flex: 1 1 auto; justify-content: center; } }

/* ---------- Pedal demo ---------- */
.pedal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .pedal-grid { grid-template-columns: 1fr; } }
.pedal-panel { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.pedal-panel svg { width: 100%; height: auto; }
.pd-title { font-weight: 800; font-size: 15px; fill: var(--ink); font-family: var(--font); }
.pd-dir { font-weight: 700; font-size: 15px; fill: var(--accent-ink); font-family: var(--font); }
.pd-crank-end { fill: var(--bg-2); stroke: var(--line-2); stroke-width: 2; }
.pd-wrench { fill: var(--ink-2); }
.pd-spindle { fill: var(--surface); stroke: var(--ink-2); stroke-width: 3; }
.pd-mark { fill: var(--accent); }
.pd-arrow { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; }
.pd-crank-side { fill: var(--bg-2); stroke: var(--line-2); stroke-width: 1.5; }
.pd-axle { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2; }
.pd-thread-line { stroke: var(--ink-2); stroke-width: 1.6; }
.pedal-rule { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); font-size: .95rem; }
#pedal-play .lbl { min-width: 2.6em; display: inline-block; }

/* ---------- Torque bars ---------- */
.tq .bar-row { grid-template-columns: 180px 1fr 64px; }
.tq .bar-track { position: relative; height: 16px; }
.tq-lo { position: absolute; left: 0; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, var(--accent-soft) 0 4px, color-mix(in srgb, var(--accent) 35%, var(--surface)) 4px 6px); opacity: 0; transition: opacity .6s ease .9s; border-radius: 999px 0 0 999px; }
.tq.in .tq-lo { opacity: 1; }
@media (max-width: 640px) { .tq .bar-row { grid-template-columns: 1fr 56px; row-gap: 4px; } .tq .bar-row > span:first-child { grid-column: 1 / -1; font-weight: 600; } }
.tq-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.tq-key { width: 18px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.tq-key-lo { background: repeating-linear-gradient(135deg, var(--accent-soft) 0 4px, color-mix(in srgb, var(--accent) 35%, var(--surface)) 4px 6px); }
.tq-key-hi { background: var(--accent); }
.tq-note { font-size: .82rem; margin: 18px 0 0; }
.tq-scale { font-family: var(--mono); font-size: .75rem; color: var(--muted); margin: -12px 0 14px; }

/* ---------- Fit calculator ---------- */
.fit-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
@media (max-width: 760px) { .fit-grid { grid-template-columns: 1fr; } }
.fit-form output { font-family: var(--mono); color: var(--accent-ink); }
.fit-error { color: var(--red); font-size: .86rem; min-height: 1.2em; margin: 0; }
.fit-unit { font-size: .45em; font-family: var(--font); }
.fit-sub { font-size: .85rem; margin-top: 4px; }
.fit-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin-top: 20px; padding-top: 18px; border-top: 1px solid color-mix(in srgb, var(--bg) 20%, transparent); }
.fit-results div { display: grid; gap: 2px; }
.fit-results span { font-size: .78rem; line-height: 1.35; }
.fit-results strong { font-size: 1.2rem; font-family: var(--mono); }
.fit-figure { margin: 24px 0 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.fit-figure svg { width: 100%; height: auto; }
.fit-explain { font-size: .88rem; margin: 16px 0 0; }
.fit-ok { color: var(--green); font-weight: 700; }
.fit-bad { color: var(--red); font-weight: 700; }

/* SVG drawing classes for fit diagram */
.fd-ground { stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 6 6; }
.fd-wheel { fill: none; stroke: var(--line-2); stroke-width: 7; }
.fd-frame { fill: none; stroke: var(--muted); stroke-width: 7; stroke-linejoin: round; stroke-linecap: round; }
.fd-post { stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }
.fd-saddle { fill: var(--ink-2); }
.fd-crank { stroke: var(--ink-2); stroke-width: 5; stroke-linecap: round; }
.fd-bar { fill: none; stroke: var(--ink-2); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.fd-limb { stroke: var(--teal); stroke-width: 11; stroke-linecap: round; fill: none; opacity: .85; }
.fd-torso { stroke: var(--teal); stroke-width: 15; stroke-linecap: round; fill: none; opacity: .85; }
.fd-head { fill: var(--teal); opacity: .85; }
.fd-joint { fill: var(--surface); stroke: var(--teal); stroke-width: 2.5; }
.fd-dim { stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 5 4; }
.fd-dim-end { stroke: var(--accent); stroke-width: 2; }
.fd-label { font-family: var(--mono); font-size: 14px; font-weight: 600; fill: var(--accent-ink); }
.fd-label-bg { fill: var(--surface); stroke: var(--accent); stroke-width: 1.2; }
.fd-knee-arc { fill: color-mix(in srgb, var(--gold) 30%, transparent); stroke: var(--gold); stroke-width: 1.5; }
.fd-knee-txt { font-family: var(--mono); font-size: 13px; font-weight: 700; fill: var(--ink); }
.fd-small { font-family: var(--font); font-size: 12px; fill: var(--muted); }

/* ---------- Size chart ---------- */
.size-table tbody tr { transition: background .3s; }
.size-table tbody tr.is-match { background: var(--accent-soft); }
.size-table tbody tr.is-match td:first-child { box-shadow: inset 4px 0 0 var(--accent); font-weight: 700; }
.size-table td.is-col { font-weight: 800; color: var(--accent-ink); }
.size-note { font-size: .85rem; margin-top: -8px; }
