/* Project pages: the portfolio's paper and ink, with diagrams drawn as a flow that fills in on scroll.
   Builds on site.css (tokens, type, header, reveal). */

.page { padding: 120px var(--gutter) 80px; max-width: 1240px; margin: 0 auto; }
.back { font: 500 13px var(--mono); text-decoration: none; color: var(--ink-2); }
.back:hover { color: var(--signal); }

.page-head { display: grid; gap: 20px; margin: 48px 0 64px; }
.page-head h1 { font: 600 clamp(40px, 7vw, 96px)/.95 var(--cond); letter-spacing: -.03em; max-width: 16ch; }
.page-head .lede { font-size: clamp(18px, 1.6vw, 21px); color: var(--ink-2); max-width: 58ch; }
.page-head .stack { color: var(--mute); }
.page-links { display: flex; gap: 24px; font: 500 13px var(--mono); }
.page-links a { text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.page-links a:hover { color: var(--signal); }

/* Facts: a ruled row of small figures or key points */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border-top: 1px solid var(--ink); margin-bottom: 96px; }
.facts > div { padding: 16px 16px 0 0; }
.facts dt { font: 400 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.facts dd { font: 500 17px/1.4 var(--sans); margin-top: 8px; }

/* Section in a project page */
.block { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding: 64px 0; border-top: 1px solid var(--rule); }
.block > .label { padding-top: 6px; }
.block h2 { font-size: clamp(28px, 3.4vw, 44px); margin-bottom: 20px; }
.block p { color: var(--ink-2); max-width: 64ch; }
.block p + p { margin-top: 12px; }
@media (max-width: 760px) { .block { grid-template-columns: minmax(0, 1fr); gap: 16px; } }

/* The diagram: a vertical spine; nodes sit on it, edges label the hops between them.
   --fill (0..1, set by project.js) draws the spine in the signal colour. */
.flow { position: relative; padding-left: 36px; }
.flow::before, .flow::after {
  content: ""; position: absolute; left: 8px; top: 10px; bottom: 10px; width: 1px; background: var(--rule);
}
.flow::after { background: var(--signal); transform-origin: 50% 0; transform: scaleY(var(--fill, 0)); }

.node, .edge, .split { position: relative; opacity: .25; transition: opacity .6s var(--ease); }
.node.lit, .edge.lit, .split.lit { opacity: 1; }

.node {
  border: 1px solid var(--ink); background: var(--paper);
  padding: 16px 20px; max-width: 460px;
}
.node::before {  /* the stop on the spine */
  content: ""; position: absolute; left: -33px; top: 22px; width: 9px; height: 9px;
  background: var(--paper); border: 1px solid var(--ink); transition: background .4s;
}
.node.lit::before { background: var(--signal); border-color: var(--signal); }
.node .kind { font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.node h3 { font: 600 20px/1.2 var(--cond); margin-top: 8px; }
.node p { font-size: 15px; color: var(--ink-2); margin-top: 4px; }
.node code, .edge code { font: 400 13px var(--mono); }
.node.key { border-color: var(--signal); box-shadow: 4px 4px 0 var(--signal); }
.node.bad { border-style: dashed; }
.node.bad h3 { color: var(--signal); }

.edge { font: 400 12px/1.4 var(--mono); color: var(--ink-2); padding: 14px 0 14px 4px; }
.edge::before { content: "↓ "; color: var(--signal); }

/* A node with something beside it (a lookup, a store) */
.with { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 0; align-items: center; }
.with .aside {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center;
}
.with .aside::before { content: ""; height: 1px; background: var(--ink); }
.with .aside .node { max-width: 320px; }
.with .aside .node::before { display: none; }
.with .aside .edge-side { grid-column: 2; font: 400 12px var(--mono); color: var(--ink-2); margin-top: 8px; }
@media (max-width: 860px) {
  .with { grid-template-columns: 1fr; }
  .with .aside { margin: 12px 0 0 24px; grid-template-columns: 28px minmax(0, 1fr); }
}

/* A decision that branches: the side path ends, the main path continues */
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; max-width: 760px; padding: 6px 0; }
.split .branch .edge { opacity: 1; }
.split .branch .node::before { display: none; }

/* Parallel lanes, e.g. CI and CD side by side */
.lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 48px; }
.lane > .label { margin-bottom: 20px; display: block; }

/* Plain lists inside blocks */
.points { display: grid; gap: 0; border-top: 1px solid var(--rule); max-width: 760px; }
.points li { padding: 14px 0; border-bottom: 1px solid var(--rule); color: var(--ink-2); }
.points li strong { color: var(--ink); font-weight: 500; }
.points.two { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
@media (max-width: 760px) { .points.two { grid-template-columns: 1fr; } }

pre.code {
  font: 400 13px/1.6 var(--mono); background: var(--night); color: var(--night-ink);
  padding: 20px 24px; overflow-x: auto; max-width: 760px; margin-top: 16px;
}

.page-foot { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; border-top: 1px solid var(--ink); padding-top: 24px; margin-top: 64px; font: 500 13px var(--mono); }
.page-foot a { text-decoration: none; border-bottom: 1px solid currentColor; }

@media (prefers-reduced-motion: reduce) {
  .node, .edge, .split { opacity: 1; }
  .flow::after { transform: scaleY(1); }
}

/* Architecture diagrams: official service icons on paper, ink connectors, the main path in signal.
   Connectors draw in when the figure is revealed; --d staggers them in reading order. */
.arch { margin-top: 40px; }
/* Each figure carries a wide layout and a tall one; the space it gets decides which shows. */
.arch-scroll { container-type: inline-size; border-top: 1px solid var(--ink); padding-top: 24px; }
.arch svg { display: block; width: 100%; height: auto; overflow: visible; }
.arch svg.tall { display: none; max-width: 440px; }
@container (max-width: 720px) {
  .arch svg.wide { display: none; }
  .arch svg.tall { display: block; }
}

.a-box { fill: none; stroke: var(--ink); stroke-width: 1; }
.a-box.dashed { stroke-dasharray: 4 4; stroke: var(--ink-2); }
.a-box.faint { stroke: var(--rule); fill: var(--paper-2); fill-opacity: .55; }
.a-glabel { font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; fill: var(--mute); }
.a-title { font: 600 14px var(--cond); fill: var(--ink); }
.a-sub { font: 400 11px var(--mono); fill: var(--mute); }
.a-badge { fill: var(--paper); stroke: var(--rule); }

.a-pill { fill: var(--paper); stroke: var(--ink); }
.a-pill.key { stroke: var(--signal); }
.a-shadow { fill: var(--signal); }
.a-pill.bad { stroke: var(--signal); stroke-dasharray: 4 3; }
.a-pilltext { font: 500 12px var(--mono); fill: var(--ink); }
.a-pilltext.bad { fill: var(--signal); }
.a-gate { fill: var(--paper); stroke: var(--signal); stroke-width: 1.25; }
.a-gatetext { font: 600 12px var(--mono); fill: var(--signal); }

.a-edge { fill: none; stroke: var(--ink-2); stroke-width: 1.25; stroke-dasharray: 1; stroke-dashoffset: 1; }
.a-edge.main { stroke: var(--signal); stroke-width: 1.5; }
.a-edge.alt { stroke: var(--ink-2); }
.a-edge.bad { stroke: var(--signal); }
.a-head { fill: var(--ink-2); }
.a-head.main, .a-head.bad { fill: var(--signal); }
.a-lbg { fill: var(--paper); }
.a-elabel { font: 400 11px var(--mono); fill: var(--ink-2); }
.a-step rect { fill: var(--signal); }
.a-step text { font: 500 11px var(--mono); fill: var(--paper); }

/* Reveal: nodes fade in, then each connector draws and its arrowhead and label follow */
.a-node { opacity: 0; transition: opacity .6s var(--ease) var(--d, 0s); }
.a-head, .a-lbg, .a-elabel, .a-link image { opacity: 0; transition: opacity .4s var(--ease) calc(var(--d, 0s) + .45s); }
.a-edge { transition: stroke-dashoffset .7s var(--ease) var(--d, 0s); }
.arch.in .a-node, .arch.in .a-head, .arch.in .a-lbg, .arch.in .a-elabel, .arch.in .a-link image { opacity: 1; }
.arch.in .a-edge { stroke-dashoffset: 0; }
/* dashed connectors can't use the dash trick to draw, so they fade */
.a-edge.alt, .a-edge.bad { stroke-dasharray: 5 4; stroke-dashoffset: 0; opacity: 0; transition: opacity .5s var(--ease) var(--d, 0s); }
.arch.in .a-edge.alt, .arch.in .a-edge.bad { opacity: 1; }

/* The numbered steps under a diagram, matching the markers in it */
.arch-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 32px; margin-top: 32px; border-top: 1px solid var(--rule); }
.arch-steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 15px; color: var(--ink-2); }
.arch-steps .mono { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-top: 3px; background: var(--signal); color: var(--paper); font-size: 11px; font-weight: 500; letter-spacing: 0; }
.arch-steps code { font: 400 13px var(--mono); white-space: nowrap; }
.arch-strip .arch-scroll { border-top: 0; padding-top: 0; }
.arch-strip { margin: 8px 0 24px; }

@media (prefers-reduced-motion: reduce) {
  .a-node, .a-head, .a-lbg, .a-elabel, .a-link image, .a-edge.alt, .a-edge.bad { opacity: 1; }
  .a-edge { stroke-dashoffset: 0; }
}
