/* Diagrams use real text and reflow into vertical paths on smaller screens. */
.diagram-nav { border-top: 1px solid var(--line); padding-block: 20px; gap: 12px 32px; }
.diagram-nav a { color: var(--accent); }
.diagram-intro { max-width: 1120px; color: var(--muted); }
.diagram-frame { margin: 32px 0 0; padding: 32px; border: 1px solid var(--line); border-radius: 24px; background: radial-gradient(ellipse at top left, #19453c44, transparent 65%), #111a28; }
.diagram-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 28px; }
.diagram-key { display: flex; align-items: center; gap: 12px; font-size: 16px; color: var(--muted); }
.line-sample { width: 30px; border-top: 2px solid var(--accent); }
.system-flow, .network-flow { display: grid; grid-template-columns: minmax(0, 1fr) 110px minmax(0, 1fr) 110px minmax(0, 1fr); align-items: stretch; }
.system-overview { display: none; }
.overview-path { list-style: none; padding: 0; margin: 0; }
.overview-path a { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; min-height: 68px; padding: 14px 16px; border: 1px solid #518779; border-radius: 12px; background: #183930; text-decoration: none; }
.overview-path a > span { color: var(--muted); font-size: 17px; }
.overview-path strong { color: var(--text); font-size: 21px; line-height: 1.3; overflow-wrap: anywhere; }
.overview-path a:hover { border-color: var(--accent); background: #214c40; }
.overview-connection { display: flex; align-items: center; justify-content: center; gap: 10px; padding-block: 8px; margin: 0; font-size: 17px; color: var(--muted); }
.overview-connection > span { color: var(--accent); font-size: 26px; line-height: 1; }
.overview-hint { margin-top: 16px; color: var(--muted); font-size: 17px; }
.diagram-node { min-width: 0; padding: 25px; border: 1px solid #405875; border-radius: 16px; background: #18263a; display: flex; flex-direction: column; }
.diagram-node h3, .mini-node h3 { font-size: clamp(26px, 2vw, 32px); }
.diagram-node p, .mini-node p { font-size: 19px; }
.node-owner { color: var(--accent); font-size: 13px !important; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; margin-bottom: 20px; }
.node-product { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 16px !important; }
.signer-node { border-color: #6487ab; background: #1a2f47; }
.box-node { border-color: #518779; background: #183930; }
.diagram-connector { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 12px 6px; color: var(--accent); }
.diagram-connector > span { font-size: 42px; line-height: 1; }
.diagram-connector p { font-size: 14px; line-height: 1.5; color: var(--muted); margin: 0; }
.diagram-connector .arrow-vertical { display: none; }
.diagram-connector.planned { color: var(--amber); }
.planned .arrow-horizontal { border-bottom: 2px dashed var(--amber); padding-bottom: 7px; width: 85%; }
.architecture-extension { display: grid; grid-template-columns: 70px 1fr; gap: 24px; margin-top: 30px; }
.extension-line { border-left: 2px dashed var(--amber); border-bottom: 2px dashed var(--amber); margin: 0 0 50% 30px; }
.architecture-extension > div:last-child { border: 1px dashed #847049; border-radius: 14px; padding: 24px; background: #47351d22; }
.architecture-extension h3 { font-size: 27px; margin-top: 18px; }
.architecture-extension p { font-size: 19px; color: var(--muted); }
figcaption { color: var(--muted); font-size: 17px; line-height: 1.6; margin-top: 26px; max-width: 1100px; }
.library-root { max-width: 640px; margin: 0 auto; text-align: center; padding: 28px; border: 1px solid var(--accent); border-radius: 16px; background: #183930; position: relative; }
.library-root::after { content: ""; position: absolute; top: 100%; height: 34px; left: 50%; border-left: 2px solid #507b70; }
.library-root h3 { font-size: 34px; margin-bottom: 12px; }
.library-root p:last-child { font-size: 19px; }
.library-tree { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; margin-top: 32px; }
.library-branch { position: relative; min-width: 0; margin-top: 30px; padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: #172335; display: flex; flex-direction: column; }
.library-branch::before { content: ""; position: absolute; left: calc(-1px - 13px); right: calc(-1px - 13px); top: -32px; height: 30px; border-top: 2px solid #507b70; background: linear-gradient(#507b70, #507b70) center / 2px 100% no-repeat; }
.library-branch:nth-child(3n+1)::before { left: -1px; }
.library-branch:nth-child(3n)::before { right: -1px; }
.library-branch:nth-child(n+4) { margin-top: 46px; }
.library-branch:nth-child(n+4)::before { top: -48px; height: 46px; }
.library-branch h3 { font-size: 28px; }
.library-items { padding: 0; margin: 0; list-style: none; }
.library-items li { padding-block: 17px; border-top: 1px solid var(--line); }
.library-items code, .library-name { display: block; color: var(--text); font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.library-items li > span:last-child { display: block; color: var(--muted); font-size: 17px; margin-top: 6px; }
.branch-status { border-top: 1px solid var(--line); padding-top: 20px; margin-top: auto; color: var(--amber); font-size: 16px; }
.network-views { margin-top: 32px; }
.network-view { border: 1px solid var(--line); border-radius: 20px; background: #121e2e; margin-bottom: 20px; overflow: hidden; }
.network-view > summary { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 26px 30px; color: var(--text); list-style: none; }
.network-view > summary::-webkit-details-marker { display: none; }
.network-view > summary > span:first-child { display: flex; align-items: center; gap: 22px; }
.network-view summary strong { font-size: clamp(23px, 2vw, 30px); line-height: 1.25; }
.detail-toggle { font-size: 32px; color: var(--accent); flex-shrink: 0; }
.network-view[open] .detail-toggle { transform: rotate(45deg); }
.network-view[open] > summary { border-bottom: 1px solid var(--line); }
.network-content { padding: 30px; }
.network-content figure { margin: 0; }
.network-content .feature-list h3 { overflow-wrap: anywhere; }
.network-state { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; color: var(--muted); font-size: 17px; margin-bottom: 28px; }
.trust-boundary { min-width: 0; border: 1px solid #598a7e; border-radius: 18px; padding: 20px; background: #17362e66; }
.mini-node { padding: 20px; border-radius: 12px; border: 1px solid #466b61; background: #182e29; }
.mini-node h3 { font-size: 25px; margin-bottom: 12px; }
.mini-node p { font-size: 17px; color: var(--muted); }
.internal-connector { text-align: center; color: var(--accent); font-size: 28px; }
.carrier-node { align-self: center; border-color: #607ba3; }
.carrier-options { display: grid; gap: 10px; margin: 0 0 20px; }
.carrier-options span { border: 1px solid #4c658b; padding: 10px; border-radius: 8px; color: var(--blue); font-size: 17px; }
.public-node { border-color: #7c8596; }
.network-note { padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 19px; margin-top: 24px; }
@media (max-width: 1399px) {
  .system-overview { display: block; margin-bottom: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
  .system-flow, .network-flow { grid-template-columns: 1fr; gap: 0; }
  .diagram-connector { flex-direction: row; justify-content: center; gap: 18px; padding: 18px; }
  .diagram-connector .arrow-horizontal { display: none; }
  .diagram-connector .arrow-vertical { display: inline-block; }
  .planned .arrow-vertical { border-left: 2px dashed var(--amber); padding-left: 12px; }
  .diagram-connector p { font-size: 17px; }
  .diagram-node { padding: 28px; }
  .trust-boundary { display: grid; grid-template-columns: 1fr 32px 1fr; gap: 16px; align-items: center; }
  .trust-boundary > .node-owner { grid-column: 1 / -1; margin-bottom: 0; }
  .internal-connector { transform: rotate(90deg); }
  .library-tree { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .library-branch, .library-branch:nth-child(n+4) { margin-top: 30px; }
  .library-branch::before, .library-branch:nth-child(n+4)::before { top: -32px; height: 30px; left: -13px; right: -13px; }
  .library-branch:nth-child(odd)::before { left: -1px; }
  .library-branch:nth-child(even)::before { right: -1px; }
}
@media (max-width: 699px) {
  .diagram-frame { padding: 20px; margin-top: 24px; border-radius: 18px; }
  .diagram-heading { align-items: flex-start; }
  .diagram-key { font-size: 15px; }
  .diagram-node { padding: 22px; }
  .architecture-extension { grid-template-columns: 1fr; gap: 0; }
  .extension-line { height: 25px; margin: 0 0 0 50%; border-bottom: 0; }
  .architecture-extension > div:last-child { padding: 20px; }
  .library-root { padding: 22px; }
  .library-tree { grid-template-columns: 1fr; gap: 0; }
  .library-branch { padding: 22px; }
  .library-branch::before, .library-branch:nth-child(n+4)::before { left: 50%; right: auto; width: 0; border-top: 0; border-left: 2px solid #507b70; background: none; }
  .library-branch:nth-child(odd)::before, .library-branch:nth-child(even)::before { left: 50%; right: auto; }
  .network-view > summary { padding: 22px; }
  .network-view > summary > span:first-child { flex-direction: column; align-items: flex-start; gap: 12px; }
  .network-content { padding: 20px; }
  .trust-boundary { display: block; padding: 18px; }
  .trust-boundary > .node-owner { margin-bottom: 16px; }
  .internal-connector { transform: none; }
  .mini-node { padding: 18px; }
  .network-view summary strong { font-size: 24px; }
  .library-items code, .library-name { font-size: 18px; }
  .network-state, figcaption { font-size: 16px; }
}
