/* 原理 page (principles/). Tokens from atlas.css, shared layout from home.css.
 * Stage colours follow the home page: peach 目标 · lavender 知识点 · sage 教学原语 · sky 学习页面. */
.pr-sec { padding-inline: 0; }

/* ---- walk-through chips ---- */
.pr-steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.pr-steps button { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 16px 6px 6px; cursor: pointer; font-size: 14.5px; }
.pr-steps i { font-style: normal; font-weight: 800; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--st); font-size: 13px; }
.pr-steps button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* ---- diagram + detail ---- */
.pr-board { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 20px; align-items: start; }
.pr-diagram { position: relative; display: grid; grid-template-columns: 142px minmax(0, 1fr) 186px; column-gap: 34px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 20px 18px 22px; }
.pr-wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.pr-wires path { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; opacity: .5; }
.pr-wires path.hd { fill: var(--muted); stroke-width: 1; }
.pr-wires path.dash { stroke-dasharray: 4 4; }
.pr-wires path.hd.dash { stroke-dasharray: none; }
.has-sel .pr-wires path { opacity: .16; }
.has-sel .pr-wires path.on { stroke: var(--accent); opacity: 1; stroke-width: 2.2; }
.has-sel .pr-wires path.hd.on { fill: var(--accent); stroke-width: 1; }

.pr-col { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pr-col.c-kc { padding-left: 58px; }
.pr-col.c-out { justify-content: flex-end; }
.pr-cap { margin: 0 0 2px; display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.pr-cap i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--st); color: var(--ink); font-size: 12px; font-weight: 800; flex: none; }
.pr-cap + .pr-cap, .pr-node + .pr-cap { margin-top: 18px; }
.pr-group { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.pr-group:first-of-type { margin-top: 0; }

.pr-node { display: grid; gap: 1px; width: 100%; text-align: left; border: 1.5px solid transparent; background: var(--st); color: var(--ink); border-radius: 12px; padding: 8px 12px; cursor: pointer; min-width: 0; }
.pr-node small { font-size: 11.5px; opacity: .72; line-height: 1.4; }
.pr-node b { font-size: 14.5px; line-height: 1.35; }
.pr-node span em { font: 11px var(--font-mono); margin-right: 6px; }
.pr-node span i { font-style: normal; }
.pr-node span { font-size: 12.5px; line-height: 1.4; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-node.wrap-text span { white-space: normal; }
.pr-node.early { background: transparent; border: 1.5px dashed var(--line); }
.pr-node:hover { border-color: var(--accent); }
.pr-node.target b::after { content: "目标"; display: inline-block; white-space: nowrap; margin-left: 6px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); vertical-align: 1px; }
.has-sel .pr-node { opacity: .5; }
.has-sel .pr-node.rel, .has-sel .pr-node.sel { opacity: 1; }
.pr-node.sel { border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 3px var(--focus); }

.pr-legend { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.pr-legend li { display: grid; grid-template-columns: 26px 1fr; gap: 6px; align-items: center; }
.pr-legend svg { width: 26px; height: 8px; }
.pr-legend line { stroke: var(--muted); stroke-width: 1.8; }

.pr-side { position: sticky; top: 14px; }
.pr-detail { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px 18px 20px; font-size: 14.5px; line-height: 1.6; max-height: calc(100vh - 28px); overflow: auto; }
.pr-detail:empty { display: none; }
.pr-detail .kind { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .05em; color: var(--accent); }
.pr-detail h3 { font-size: 20px; margin: 2px 0 2px; letter-spacing: -.01em; }
.pr-detail .sub { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.pr-detail h4 { margin: 14px 0 3px; font-size: 12.5px; letter-spacing: .04em; color: var(--muted); }
.pr-detail p { margin: 0; }
.pr-detail ul, .pr-detail ol { margin: 0; padding-left: 1.2em; }
.pr-detail li + li { margin-top: 3px; }
.pr-detail .eg { background: var(--soft); border-radius: 10px; padding: 8px 12px; }
.pr-detail .eg span { display: block; color: var(--muted); font-size: 13px; }
.pr-detail .why { background: var(--sage); border-radius: 12px; padding: 10px 12px; }
.pr-detail .note { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin-top: 12px; }
.pr-detail .bad li::marker { color: var(--bad); }
.pr-detail code { font: 12px var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
.pr-detail .jump { display: inline; border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.pr-detail .row { margin-top: 14px; gap: 6px; }
.pr-detail .row .btn { padding: 6px 14px; font-size: 13.5px; white-space: normal; }
.pr-detail .tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 0 8px; border-radius: 999px; background: var(--soft); color: var(--muted); margin-right: 4px; }
.pr-detail .tag.main { background: var(--accent-soft); color: var(--accent); }

/* ---- the page itself ---- */
.pr-try { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px; align-items: start; }
.pr-try-text p { margin: 10px 0 0; }
.pr-try .device { margin: 0; }
.pr-cmp { margin-top: 16px; display: grid; gap: 10px; }
.pr-cmp > div { border-radius: 16px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); font-size: 14.5px; }
.pr-cmp h3 { font-size: 15px; margin: 0 0 4px; }
.pr-cmp ul { margin: 0; padding-left: 1.2em; }
.pr-cmp .yes { border-left: 4px solid var(--cv-block); } .pr-cmp .no { border-left: 4px solid var(--cv-borrow); } .pr-cmp .say { border-left: 4px solid var(--accent); }

/* ---- three layers ---- */
.pr-band { align-items: start; }
.pr-band .eyebrow { color: var(--ink); opacity: .65; }
.pr-uses { margin: 14px 0 0; padding-left: 1.2em; font-size: 15px; }
.pr-uses li + li { margin-top: 6px; }
.pr-panel { background: var(--panel); border-radius: 20px; padding: 18px; min-width: 0; }
.pr-panel h3 { font-size: 17px; margin-bottom: 4px; }
.pr-panel .foot { margin: 0 0 10px; font-size: 13px; }
.pr-path { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pr-path li { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: 10px; font-size: 14px; line-height: 1.45; }
.pr-path li.in { background: var(--soft); }
.pr-path li.target { background: var(--accent-soft); }
.pr-path .u { font: 11.5px var(--font-mono); color: var(--muted); white-space: nowrap; }
.pr-path .need { display: block; font-size: 12.5px; color: var(--muted); }
.pr-path .sep { display: block; padding: 6px 8px 0; font-size: 12px; color: var(--muted); grid-template-columns: 1fr; }

.pr-blocks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.pr-block { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.pr-block .shot { display: block; aspect-ratio: 600 / 427; background: var(--soft); border-bottom: 1px solid var(--line); overflow: hidden; }
.pr-block .shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.pr-block .body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; font-size: 14px; }
.pr-block small { color: var(--muted); font-size: 12px; }
.pr-block b { font-size: 16.5px; }
.pr-block p { margin: 0; }
.pr-block .fit { color: var(--ink); } .pr-block .does { color: var(--muted); font-size: 13.5px; }
.pr-block .row { margin-top: auto; padding-top: 8px; gap: 6px; }
.pr-block .btn { padding: 6px 14px; font-size: 14px; }
#ws-task li b { font-size: 15px; }

@media (max-width: 1100px) { .pr-blocks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 979px) {
  .pr-board, .pr-try { grid-template-columns: minmax(0, 1fr); }
  .pr-diagram { grid-template-columns: minmax(0, 1fr); row-gap: 22px; padding: 16px 12px 18px; }
  .pr-col.c-kc { padding-left: 54px; padding-right: 34px; }
  .pr-col.c-out { justify-content: flex-start; }
  .pr-side { position: static; }
  .pr-detail { max-height: none; border-color: var(--accent); margin: 2px 0 6px; padding: 14px; }
  .pr-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-right: 44px; margin-top: 10px; }
}
@media (max-width: 520px) {
  .pr-sec { padding-inline: 0; }
  .pr-blocks { grid-template-columns: minmax(0, 1fr); }
  .pr-panel { padding: 14px; }
  .pr-steps button { padding-right: 12px; font-size: 13.5px; }
}
@media (prefers-reduced-motion: no-preference) {
  .pr-node, .pr-wires path { transition: opacity .15s, border-color .15s; }
}

/* ---- depth (see design/atlas.css) ---- */
.pr-steps button { border-width: 2px; box-shadow: 0 3px 0 var(--edge); }
.pr-steps button:active { transform: translateY(3px); box-shadow: none; }
.pr-steps button[aria-pressed="true"] { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge-sel); }
.pr-diagram, .pr-detail, .pr-block { border-width: 2px; box-shadow: 0 6px 0 var(--edge); }
.pr-cmp > div { border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; box-shadow: 0 4px 0 var(--edge); }
.pr-panel { box-shadow: 0 5px 0 var(--edge-dark); }
.pr-node { box-shadow: 0 3px 0 color-mix(in srgb, var(--st) 76%, var(--ink)); } .pr-node.early { box-shadow: none; }
.pr-node:active { transform: translateY(2px); }
.pr-node.sel { box-shadow: 0 0 0 3px var(--focus), 0 3px 0 var(--edge-sel); }
