/* Compact figures sit before their project's complete, always-visible body. */
.project-visual {
  margin: 0 0 24px;
  padding: 4px 0 18px;
  border-bottom: 1px solid rgba(100, 255, 218, .15);
}
.project-visual .diagram-stage { max-width: 460px; margin: 0 auto; }
.project-visual .content-diagram {
  display: block;
  width: 100%;
  height: auto;
  color: var(--accent);
  fill: none;
  overflow: visible;
}
.project-visual .node-body { fill: #102c38; stroke: currentColor; stroke-width: 1.3; stroke-opacity: .55; }
.project-visual .node-title,
.project-visual .node-subtitle,
.project-visual .lens-label { fill: var(--text-bright); stroke: none; font-family: var(--font-mono); }
.project-visual .node-subtitle { fill: #c5dfdf; }
.project-visual .diagram-icon { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.project-visual .route { fill: none; stroke: currentColor; stroke-width: 1.5; opacity: .38; pointer-events: none; }
.project-visual .flow { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 100; stroke-dashoffset: 100; opacity: 0; pointer-events: none; }
.project-visual .diagram-link,
.project-visual .diagram-link:hover,
.project-visual .diagram-link:focus,
.project-visual .diagram-link:active { cursor: pointer; outline: none; text-decoration: none; }
.project-visual .diagram-link:hover .node-body,
.project-visual .diagram-link:focus .node-body,
.project-visual .diagram-link.is-active .node-body { fill: #1d443f; stroke-width: 2.5; stroke-opacity: 1; }
.project-visual .diagram-link:focus .node-body { stroke-dasharray: 4 3; }
.project-visual .diagram-link:hover .route,
.project-visual .diagram-link:focus .route,
.project-visual .diagram-link.is-active .route { opacity: 1; }
.project-visual .phone-boundary { opacity: .65; }
.project-visual .lens-body { fill: #16313b; stroke: var(--accent); stroke-opacity: .25; }
.project-visual .lens-label { font-size: 22px; }
.project-visual .cycle-guide { fill: none; stroke: var(--accent); opacity: .22; stroke-width: 1; }
.project-visual .diagram-instruction { color: var(--text-dim); font: 10px/1.6 var(--font-mono); border: 0; padding: 0; margin: 8px 0 12px; }
.project-visual .detail-panel { min-height: 0; padding: 0; }
.project-visual .diagram-detail { scroll-margin-top: 24px; }
.project-visual .diagram-detail h3,
.project-visual .diagram-detail h4 { color: var(--accent); font: 12px/1.5 var(--font-mono); margin: 0 0 4px; }
.project-visual .diagram-detail p { color: var(--text); font-size: 13px; line-height: 1.6; margin: 0; }
.project-visual .diagram-detail + .diagram-detail { margin-top: 14px; }
.project-visual .diagram-detail:target { border-left: 2px solid var(--accent); padding-left: 12px; }
.project-visual.is-enhanced .diagram-detail { margin-top: 0; }
.project-visual.is-enhanced .diagram-detail:target { border: 0; padding-left: 0; }
.project-visual [hidden] { display: none !important; }
.project-visual [data-diagram-status] { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: no-preference) {
  html:not(.no-motion) .project-visual .node-body { transition: fill .18s, stroke-width .18s; }
  html:not(.no-motion) .project-visual .diagram-link.is-running .flow { animation: project-diagram-route 1.3s linear both; }
  html:not(.no-motion) .project-visual .diagram-link.is-running .node-body { animation: project-diagram-acknowledge .35s ease-out .95s; }
}
@keyframes project-diagram-route {
  0% { stroke-dashoffset: 100; opacity: 0; }
  8%, 90% { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes project-diagram-acknowledge {
  0%, 100% { stroke-width: 2.5; }
  45% { stroke-width: 4; }
}
html.no-motion .project-visual *,
html.no-motion .project-visual *::before,
html.no-motion .project-visual *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .project-visual *, .project-visual *::before, .project-visual *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 760px) {
  .project-visual .diagram-stage { margin: 0 -6px; }
}

/* Improved project diagrams (v2).
   Everything is scoped to .content-diagram.v2, so the current figures keep their look.
   To adopt a picked diagram on the site, append this file to website/project-diagrams.css
   (or link it after that file). It adds roles by colour, hierarchy and icon styling;
   interaction and motion still come from project-diagrams.css/.js unchanged. */

.project-visual .content-diagram.v2 {
  /* One hue per role, chosen to sit on the site's navy and next to its teal accent. */
  --dv-teal: #64ffda;   /* the result / the thing that was built */
  --dv-slate: #8892b0;  /* legacy, before, optional */
  --dv-blue: #82aaff;   /* platforms, inputs, people outside the framework */
  --dv-gold: #ffcb6b;   /* gates, coupling, pilot status, failure path */
  --dv-violet: #c792ea; /* models, diagnostics */
  --dv-coral: #ff8a9a;  /* blocked */
  --dv-leaf: #8fdc8a;   /* tree theme: canopy, growth */
  --dv-bark: #c9a27a;   /* tree theme: trunk, roots, principles */
  --tone: var(--dv-teal);
  --tone-fill: #0f2c35;
  --tone-hover: #16423f;
}
.project-visual .v2 .tone-teal   { --tone: var(--dv-teal);   --tone-fill: #0f2c35; --tone-hover: #16423f; }
.project-visual .v2 .tone-slate  { --tone: var(--dv-slate);  --tone-fill: #111d30; --tone-hover: #1b2a42; }
.project-visual .v2 .tone-blue   { --tone: var(--dv-blue);   --tone-fill: #0f2140; --tone-hover: #183058; }
.project-visual .v2 .tone-gold   { --tone: var(--dv-gold);   --tone-fill: #252314; --tone-hover: #383320; }
.project-visual .v2 .tone-violet { --tone: var(--dv-violet); --tone-fill: #1c1a35; --tone-hover: #2b244c; }
.project-visual .v2 .tone-coral  { --tone: var(--dv-coral); }
.project-visual .v2 .tone-leaf   { --tone: var(--dv-leaf);   --tone-fill: #142e27; --tone-hover: #1d4134; }
.project-visual .v2 .tone-bark   { --tone: var(--dv-bark);   --tone-fill: #272118; --tone-hover: #3a2f22; }

/* Tree theme (organism): crown, trunk, roots and growth rings. */
.project-visual .v2 .canopy { fill: var(--dv-leaf); opacity: .07; pointer-events: none; }
.project-visual .v2 .leaf-deco { stroke-width: 1.4; opacity: .35; }
.project-visual .v2 .trunk { fill: var(--dv-bark); fill-opacity: .16; stroke: var(--dv-bark); stroke-opacity: .55; stroke-width: 1.4; }
.project-visual .v2 .ground { stroke: var(--dv-bark); stroke-opacity: .45; stroke-width: 1.4; stroke-dasharray: 2 6; stroke-linecap: round; }
.project-visual .v2 .root { fill: none; stroke: var(--dv-bark); stroke-opacity: .6; stroke-width: 2; stroke-linecap: round; }
.project-visual .v2 .growth-ring { fill: none; stroke: var(--dv-leaf); stroke-opacity: .28; stroke-width: 1.2; }
.project-visual .v2 .diagram-link:hover .root,
.project-visual .v2 .diagram-link.is-active .root { stroke-opacity: .9; }

/* Nodes */
.project-visual .content-diagram.v2 .node-body { fill: var(--tone-fill); stroke: var(--tone); stroke-width: 1.4; stroke-opacity: .7; }
.project-visual .content-diagram.v2 .node-body.is-hero { stroke-width: 1.8; stroke-opacity: 1; }
.project-visual .content-diagram.v2 .is-dashed { stroke-dasharray: 6 5; }
.project-visual .content-diagram.v2 .diagram-link:hover .node-body,
.project-visual .content-diagram.v2 .diagram-link:focus .node-body,
.project-visual .content-diagram.v2 .diagram-link.is-active .node-body { fill: var(--tone-hover); stroke-width: 2.4; stroke-opacity: 1; }
.project-visual .content-diagram.v2 .layer { fill: var(--tone); fill-opacity: .08; stroke: var(--tone); stroke-opacity: .55; stroke-width: 1.2; }

/* Text: titles carry weight, captions step back, small capitals label roles. */
.project-visual .v2 text { font-family: var(--font-mono); stroke: none; }
/* Same regular weight and sizes as the current figures; colour carries the emphasis. */
.project-visual .v2 .node-title { fill: var(--text-bright); }
.project-visual .v2 .node-subtitle { fill: #c5dfdf; }
.project-visual .v2 .t-caps { fill: var(--tone); }
.project-visual .v2 .t-tone { fill: var(--tone); }
.project-visual .v2 .t-big { fill: var(--tone); }
.project-visual .v2 .t-ink { fill: #0a192f; font-weight: 700; }
.project-visual .v2 .chip-text { fill: var(--text-bright); }

/* Icons and decoration */
.project-visual .v2 .ico { fill: none; stroke: var(--tone); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.project-visual .v2 .ico-soft { fill: var(--tone); fill-opacity: .14; stroke: none; pointer-events: none; }
.project-visual .v2 .ico-solid { fill: var(--tone); stroke: none; pointer-events: none; }
.project-visual .v2 .ink-fill { fill: #0a192f; }
.project-visual .v2 .chip { fill: var(--tone); fill-opacity: .12; stroke: var(--tone); stroke-opacity: .5; stroke-width: 1; }
.project-visual .v2 .glow { fill: var(--tone); opacity: .2; pointer-events: none; }
.project-visual .v2 .ring { fill: none; stroke: var(--dv-teal); stroke-opacity: .2; stroke-width: 1.5; stroke-dasharray: 2 7; stroke-linecap: round; }
.project-visual .v2 .port { fill: var(--tone); stroke: #0a192f; stroke-width: 2; }
.project-visual .v2 .boundary { fill: #0c1f2e; fill-opacity: .55; stroke: var(--dv-teal); stroke-opacity: .45; stroke-width: 1.6; }

/* Routes take the colour of the step they lead into. */
.project-visual .v2 .route { stroke: var(--tone); opacity: .6; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.project-visual .v2 .flow { stroke: var(--tone); }
.project-visual .v2 .route-alt { fill: none; stroke: var(--dv-gold); stroke-width: 1.8; stroke-dasharray: 5 5; stroke-linecap: round; stroke-linejoin: round; opacity: .8; pointer-events: none; }
.project-visual .v2 .route-alt-head { fill: none; stroke: var(--dv-gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .9; pointer-events: none; }
.project-visual .v2 .diagram-link:hover .route-alt,
.project-visual .v2 .diagram-link.is-active .route-alt { opacity: 1; }
