/* Knots module (02): the knot player and its rope drawing. Colours come only from academy.css tokens. */
.knot { margin-top: 3.4rem; padding-top: 1.6rem; border-top: 1px solid var(--rule); }
.knot-head { display: flex; align-items: baseline; gap: .8rem; }
.knot-head .n { font: 600 .82rem/1 var(--mono); color: var(--magenta); letter-spacing: .02em; }
.knot-head h2 { margin: 0; }
.knot-use { margin-top: .7rem; }
.knot-use b { font-weight: 600; }
.knot-caution { margin-top: .9rem; font-size: .93rem; color: var(--ink-2); padding-left: .9rem; border-left: 3px solid var(--magenta); }
.knot-caution b { color: var(--magenta); font-weight: 600; }

.knot-stage { margin: 1.2rem 0 0; padding: .7rem .7rem .9rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); }
.knot-stage noscript img, .kp-stage svg { width: 100%; height: auto; display: block; }
.kp-stage { border-radius: 3px; background: var(--paper); }
.kp-stage:focus-visible { outline: 2px solid var(--magenta); outline-offset: 3px; }
.kp-stage svg { max-height: 68vh; margin: 0 auto; }

.kp-cap { display: flex; gap: .7rem; align-items: baseline; margin: .55rem .15rem 0; min-height: 3.1em; font-size: .98rem; line-height: 1.45; }
.kp-n { flex: none; font: 600 .76rem/1.5 var(--mono); color: var(--magenta); white-space: nowrap; }
.kp-bar { margin-top: .5rem; }
.kp-scrub { width: 100%; margin: 0 0 .55rem; accent-color: var(--sea); height: 28px; cursor: pointer; }
.kp-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.kp-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1.5px solid var(--rule-strong); border-radius: var(--r); background: var(--paper); color: var(--ink); cursor: pointer; }
.kp-btn svg { width: 20px; height: 20px; }
.kp-btn:hover { border-color: var(--ink); }
.kp-btn:focus-visible, .kp-speed button:focus-visible { outline: 2px solid var(--magenta); outline-offset: 2px; }
.kp-play { width: 58px; background: var(--ink); border-color: var(--ink); color: var(--paper); }
.kp-play:hover { background: var(--sea-deep); border-color: var(--sea-deep); }
.kp-speed { margin-left: auto; display: inline-flex; border: 1.5px solid var(--rule-strong); border-radius: var(--r); overflow: hidden; }
.kp-speed button { min-width: 46px; height: 41px; padding: 0 .4rem; border: 0; border-left: 1px solid var(--rule); background: var(--paper); color: var(--ink-2); font: 600 .86rem/1 var(--mono); cursor: pointer; }
.kp-speed button:first-child { border-left: 0; }
.kp-speed button[aria-checked="true"] { background: var(--ink); color: var(--paper); }

.knot-steps { margin: 1rem 0 0; padding: 0; list-style: none; counter-reset: st; }
.knot-steps li { counter-increment: st; position: relative; padding: .42rem .6rem .42rem 2.4rem; border-left: 3px solid transparent; color: var(--ink-2); font-size: .97rem; line-height: 1.45; cursor: pointer; border-radius: 0 var(--r) var(--r) 0; }
.knot-steps li::before { content: counter(st); position: absolute; left: .7rem; top: .45rem; font: 600 .78rem/1.5 var(--mono); color: var(--ink-3); }
.knot-steps li:hover { background: var(--paper-2); }
.knot-steps li.is-done { color: var(--ink-3); }
.knot-steps li.is-current { border-left-color: var(--magenta); background: var(--paper-2); color: var(--ink); font-weight: 500; }
.knot-steps li.is-current::before { color: var(--magenta); }
.knot-steps li:focus-visible { outline: 2px solid var(--magenta); outline-offset: -2px; }

/* rope drawing */
.r-out, .r-fill, .r-lay, .r-tip { fill: none; stroke-linecap: butt; stroke-linejoin: round; }
.r-out { stroke: var(--ink); }
.r-fill.cream { stroke: var(--sail); }
.r-fill.yellow { stroke: var(--buoy-yellow); }
.r-fill.blue { stroke: var(--sea); }
.r-fill.wind { stroke: var(--wind); }
.r-lay { stroke: var(--ink); stroke-opacity: .17; stroke-dasharray: 1.6 4.4; }
.r-tip { stroke: var(--ink-2); }
.r-ghost { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-dasharray: 5 4; stroke-opacity: .6; stroke-linecap: butt; }
.k-mark { fill: none; stroke: var(--magenta); stroke-width: 2.2; stroke-opacity: .85; pointer-events: none; }

.p-out { fill: none; stroke: var(--ink); stroke-linecap: butt; }
.p-rail, .p-ring { fill: none; stroke: var(--paper-3); stroke-linecap: butt; }
.p-hi { fill: none; stroke: var(--sail); stroke-linecap: round; stroke-opacity: .7; }
.p-lo { fill: none; stroke: var(--ink); stroke-opacity: .09; }
.p-cleat { fill: var(--paper); stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.p-shadow { fill: var(--ink); opacity: .07; }
.p-bolt { fill: var(--paper-3); stroke: var(--ink); stroke-width: 1.2; }
.p-slot { stroke: var(--ink); stroke-width: 1.2; }
.p-block { fill: var(--paper-2); stroke: var(--ink); stroke-width: 1.8; }
.p-shackle { fill: none; stroke: var(--ink); stroke-width: 2.6; }
.p-wall { fill: var(--paper-3); }
.p-seam { stroke: var(--rule); stroke-width: 1; }
.p-edge { stroke: var(--ink); stroke-width: 1.5; }
.p-plate { fill: var(--paper-2); stroke: var(--ink); stroke-width: 1.4; }
.p-eye { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }
.p-boom { fill: var(--ink-2); }
.p-sail { fill: var(--sail); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.p-fold { fill: none; stroke: var(--rule-strong); stroke-width: 1.2; }
.p-arrow { fill: none; stroke: var(--sea-deep); stroke-width: 2.6; stroke-linecap: round; }
.p-deck { fill: var(--paper-2); }

.k-label { font: 600 15px/1 var(--body); fill: var(--ink-2); paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; opacity: 0; transition: opacity .3s; }
.k-label.k-arrow { opacity: 1; }
.k-label-g { opacity: 0; transition: opacity .3s; }
.k-label-g.is-on { opacity: 1; }
.k-label-g .k-label { opacity: 1; }
.k-leader { fill: none; stroke: var(--magenta); stroke-width: 1.6; }
.k-leader-dot { fill: var(--magenta); }
.k-label.k-arrow { fill: var(--sea-deep); }
.k-label.on-sail { stroke: var(--sail); }

@media (max-width: 560px) {
  .knot-stage { padding: .45rem .45rem .7rem; margin-left: -.25rem; margin-right: -.25rem; }
  .kp-ctl { gap: .35rem; }
  .kp-speed { margin-left: 0; }
  .kp-speed button { min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) { .k-label { transition: none; } }
