/* Engineering page and the technical sections of the home page. Tokens from site.css; every class
   starts with eng-. Dense, precise, reference-like: the place we show the system, not the slogan */

.eng-hero { padding-top: 80px; }
.eng-hero .lede { margin-top: 26px; max-width: 40em; }

.eng-specs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 56px; background: var(--rule); border-radius: 6px; overflow: hidden; }
.eng-specs > div { background: var(--paper); padding: 22px 22px 20px; display: grid; gap: 6px; align-content: start; }
.eng-specs b { font-size: clamp(30px, 3.2vw, 44px); font-weight: 500; letter-spacing: -0.045em; line-height: 1; }
.eng-specs span { font-size: 14px; color: var(--soft); line-height: 1.4; }
.eng-specs small { font-size: 12px; color: var(--faint); }

.eng-sechead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: end; }
.eng-sechead p { color: var(--soft); font-size: 17px; line-height: 1.5; max-width: 34em; }

/* Architecture diagram */
.eng-arch { margin-top: 48px; border-radius: 6px; background: var(--night); color: var(--n-ink); padding: 34px 34px 26px; overflow-x: auto; }
.eng-arch svg { display: block; width: 100%; min-width: 900px; height: auto; font-family: var(--font); }
.eng-arch .bx { fill: var(--n-sheet); stroke: var(--n-rule); }
.eng-arch .bx-hi { fill: rgba(108, 192, 142, 0.12); stroke: var(--n-go); }
.eng-arch .bx-tape { fill: var(--n-tape-wash); stroke: var(--n-tape); }
.eng-arch .bx-des { fill: none; stroke: var(--n-soft); stroke-dasharray: 5 4; }
.eng-arch__key { margin-top: 10px; font-size: 13px; color: var(--soft); }
.eng-arch .grp { fill: none; stroke: var(--n-rule); stroke-dasharray: 5 5; }
.eng-arch .gl { fill: var(--n-faint); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.eng-arch .t { fill: var(--n-ink); font-size: 13px; font-weight: 600; }
.eng-arch .s { fill: var(--n-soft); font-size: 11px; }
.eng-arch .ln { stroke: rgba(238, 235, 228, 0.28); stroke-width: 1.2; fill: none; }
.eng-arch .ln-go { stroke: var(--n-go); stroke-width: 1.5; fill: none; }
.eng-arch .ln-tape { stroke: var(--n-tape); stroke-width: 1.5; fill: none; }
.eng-arch .dot-go { fill: var(--n-go); }
.eng-arch .dot-tape { fill: var(--n-tape); }
.eng-arch-k { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 18px; font-size: 13px; color: var(--n-soft); }
.eng-arch-k span { display: inline-flex; align-items: center; gap: 8px; }
.eng-arch-k i { width: 18px; height: 2px; background: var(--n-go); }
.eng-arch-k i.tape { background: var(--n-tape); }
.eng-arch-k i.grey { background: rgba(238, 235, 228, 0.35); }

/* The hard parts */
.eng-hard { list-style: none; margin-top: 48px; display: grid; gap: 0; counter-reset: hp; }
.eng-hard > li { counter-increment: hp; display: grid; grid-template-columns: 70px minmax(0, 1.1fr) minmax(0, 1.4fr); gap: 28px; padding: 34px 0; border-top: 1px solid var(--rule); align-items: start; }
.eng-hard > li:last-child { border-bottom: 1px solid var(--rule); }
.eng-hard > li::before { content: counter(hp, decimal-leading-zero); font-size: 15px; font-weight: 600; color: var(--faint); padding-top: 6px; }
.eng-hard h3 { font-size: clamp(24px, 2.2vw, 30px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.1; }
.eng-hard h3 + p { margin-top: 12px; color: var(--soft); font-size: 15.5px; line-height: 1.55; }
.eng-hard .eng-how { display: grid; gap: 12px; }
.eng-hard .eng-how p { font-size: 15.5px; line-height: 1.6; }
.eng-hard .eng-how ul { list-style: none; display: grid; gap: 8px; }
.eng-hard .eng-how li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; font-size: 14.5px; line-height: 1.5; color: var(--soft); }
.eng-hard .eng-how li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); margin-top: 8px; }
.eng-hard .eng-how li b { color: var(--ink); font-weight: 600; }
.eng-tags { font-size: 14px; color: var(--soft); line-height: 1.5; }
.eng-doclink { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; font-weight: 500; }
.eng-doclink svg { width: 15px; height: 15px; transition: transform .3s var(--out); }
.eng-doclink:hover svg { transform: translateX(3px); }

/* Code block */
.eng-code { margin-top: 4px; border-radius: 8px; background: var(--n-deep); color: var(--n-ink); padding: 16px 18px; font: 12.5px/1.6 'SF Mono', Menlo, Consolas, monospace; overflow-x: auto; white-space: pre; }
.eng-code .c { color: #8a877f; } .eng-code .k { color: #ff8a72; } .eng-code .s { color: #9fd4ae; } .eng-code .n { color: #e2b765; } .eng-code .t { color: #93a9c9; }

/* Request path */
.eng-path { margin-top: 48px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; position: relative; }
.eng-path > div { position: relative; padding: 0 14px 0 0; display: grid; gap: 8px; align-content: start; }
.eng-path > div::before { content: ""; height: 4px; border-radius: 2px; background: var(--ink); opacity: calc(0.25 + var(--k) * 0.11); margin-bottom: 10px; }
.eng-path b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.eng-path span { font-size: 13.5px; color: var(--soft); line-height: 1.45; }
.eng-path em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--go); }

/* Capability matrix */
.eng-matrix { margin-top: 48px; border-radius: 6px; background: var(--sheet); overflow-x: auto; }
.eng-matrix table { width: 100%; min-width: 880px; border-collapse: collapse; font-size: 14.5px; }
.eng-matrix th, .eng-matrix td { padding: 15px 18px; text-align: left; border-top: 1px solid var(--rule); vertical-align: top; }
.eng-matrix thead th { border-top: 0; font-size: 13.5px; font-weight: 600; color: var(--soft); }
.eng-matrix thead th.us { color: var(--ink); }
.eng-matrix td:first-child { font-weight: 600; width: 24%; }
.eng-matrix td.us { background: color-mix(in srgb, var(--paper) 70%, transparent); }
.eng-y, .eng-n, .eng-p { display: inline-flex; align-items: center; gap: 7px; }
.eng-y::before, .eng-n::before, .eng-p::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.eng-y::before { background: var(--go); }
.eng-n::before { box-shadow: inset 0 0 0 1.5px var(--faint); }
.eng-p::before { background: linear-gradient(90deg, var(--soft) 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px var(--soft); }
.eng-matrix small { display: block; color: var(--soft); font-size: 12.5px; margin-top: 3px; font-weight: 400; }
.eng-note { margin-top: 14px; font-size: 13px; color: var(--soft); }

/* Stack */
.eng-stack { margin-top: 48px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.eng-stack > div { padding: 24px; border-radius: 6px; background: var(--sheet); display: grid; gap: 14px; align-content: start; }
.eng-stack h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.eng-stack dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.eng-stack dt { color: var(--soft); }
.eng-stack dd { font-weight: 500; }

/* Docs teaser */
.eng-docs { margin-top: 48px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.eng-docs a { display: grid; gap: 8px; align-content: start; padding: 22px; border-radius: 6px; background: var(--sheet); min-height: 132px; transition: background .3s; }
.eng-docs a:hover { background: var(--well); }
.eng-docs b { font-size: 19px; font-weight: 500; letter-spacing: -0.025em; line-height: 1.2; }
.eng-docs span { font-size: 14px; color: var(--soft); line-height: 1.45; }

/* Principles */
.eng-princ { margin-top: 56px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 34px; }
.eng-princ div { display: grid; gap: 10px; align-content: start; padding-top: 18px; border-top: 1.5px solid var(--n-ink); }
.eng-princ b { font-size: 21px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; }
.eng-princ span { color: var(--n-soft); font-size: 15px; line-height: 1.55; }

/* Problem section (home) */
.eng-problem { margin-top: 48px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 14px; }
.eng-mess { position: relative; border-radius: 6px; background: var(--sheet); padding: 28px; min-height: 440px; overflow: hidden; }
.eng-mess img { position: absolute; inset: auto 0 0 auto; width: 100%; height: 100%; object-fit: contain; object-position: bottom right; }
.eng-mess h3 { position: relative; font-size: 22px; font-weight: 500; letter-spacing: -0.03em; max-width: 15em; }
.eng-costs { display: grid; gap: 0; border-radius: 6px; background: var(--sheet); padding: 6px 28px; }
.eng-costs li { list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; padding: 20px 0; border-top: 1px solid var(--rule); }
.eng-costs li:first-child { border-top: 0; }
.eng-costs b { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; }
.eng-costs em { font-style: normal; font-size: 13px; font-weight: 500; color: var(--soft); white-space: nowrap; align-self: center; }
.eng-costs span { grid-column: 1 / -1; color: var(--soft); font-size: 14.5px; line-height: 1.5; }
.eng-before { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.eng-before > div { border-radius: 6px; padding: 26px 28px; display: grid; gap: 14px; align-content: start; }
.eng-before .then { background: var(--sheet); }
.eng-before .now { background: var(--night); color: var(--on-night); }
.eng-before h3 { font-size: 15px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.eng-before ol { list-style: none; display: grid; gap: 0; }
.eng-before li { display: grid; grid-template-columns: 82px 1fr; gap: 14px; padding: 11px 0; border-top: 1px solid var(--rule); font-size: 15px; line-height: 1.45; }
.eng-before .now li { border-top-color: var(--n-rule); }
.eng-before time { font-size: 13px; font-weight: 600; color: var(--soft); padding-top: 1px; }
.eng-before .now time { color: var(--n-go); }
.eng-before .then li.bad time { color: var(--tape); }

.eng-art { display: block; width: 100%; height: auto; }
.eng-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; margin-top: 40px; }

@media (max-width: 1100px) {
  .eng-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eng-hard > li { grid-template-columns: 1fr; gap: 14px; }
  .eng-path { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 0; }
  .eng-stack, .eng-docs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eng-princ { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eng-problem, .eng-before, .eng-sechead, .eng-split { grid-template-columns: minmax(0, 1fr); }
  .eng-mess { min-height: 0; }
  .eng-mess img { position: static; width: 100%; height: auto; margin-top: 18px; }
}
@media (max-width: 640px) {
  .eng-specs, .eng-stack, .eng-docs, .eng-princ { grid-template-columns: 1fr; }
  .eng-docs a { min-height: 0; }
  .eng-arch { padding: 18px; }
  .eng-before li { grid-template-columns: 70px 1fr; }
}

/* Generated line art: ink on transparent. In dark mode invert it so the ink reads light and the
   plates read dark; the hue turn keeps the red accent red */
.eng-hard-art { margin-top: 18px; max-width: 360px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .eng-art, :root:not([data-theme="light"]) .eng-mess img { filter: invert(0.9) hue-rotate(180deg); } }
:root[data-theme="dark"] .eng-art, :root[data-theme="dark"] .eng-mess img { filter: invert(0.9) hue-rotate(180deg); }
.eng-code code { white-space: pre; background: none; padding: 0; font: inherit; }
.eng-swipe { display: none; margin-top: 12px; font-size: 12.5px; color: var(--n-soft); }
@media (max-width: 640px) {
  .eng-swipe { display: block; }
  .eng-matrix { background: none; overflow: visible; }
  .eng-matrix table { min-width: 0; }
  .eng-matrix thead { display: none; }
  .eng-matrix table, .eng-matrix tbody, .eng-matrix tr, .eng-matrix td { display: block; width: auto; }
  .eng-matrix tr { background: var(--sheet); border-radius: 6px; padding: 6px 16px 10px; margin-bottom: 10px; }
  .eng-matrix td { border-top: 0; padding: 6px 0; display: grid; grid-template-columns: 9em 1fr; gap: 10px; }
  .eng-matrix td:first-child { display: block; width: auto; font-size: 16px; padding: 8px 0 6px; }
  .eng-matrix td:not(:first-child)::before { content: attr(data-label); font-size: 12.5px; color: var(--soft); }
  .eng-matrix td.us { background: none; font-weight: 600; }
}

/* Engineering facts under the hero: plain two-column list */
.eng-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; margin-top: 48px; border-top: 1px solid var(--rule); max-width: 1040px; }
.eng-facts > div { display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.eng-facts dt { font-weight: 600; }
.eng-facts dd { margin: 0; color: var(--soft); }
.eng-facts small { font-size: 15px; color: var(--faint); }
@media (max-width: 720px) { .eng-facts { grid-template-columns: minmax(0, 1fr); } }

/* System map (js/arch.js): planes, components with status, hover and traces */
.arch-map { margin-top: 48px; border-radius: 8px; background: #1b1b19; color: var(--n-ink); overflow: hidden; box-shadow: 0 0 0 1px rgba(238, 235, 228, 0.08); }
.arch-map__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 16px 20px; border-bottom: 1px solid rgba(238, 235, 228, 0.08); }
.arch-map__traces { display: flex; flex-wrap: wrap; gap: 8px; }
.arch-map__traces button { height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid rgba(238, 235, 228, 0.16); background: transparent; color: var(--n-ink); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: background 0.2s, border-color 0.2s; }
.arch-map__traces button:hover { border-color: rgba(238, 235, 228, 0.4); }
.arch-map__traces button[aria-pressed="true"] { background: var(--n-ink); color: #1b1b19; border-color: var(--n-ink); }
.arch-map__traces .arch-map__reset { border-color: transparent; color: var(--n-soft); }
.arch-map__legend { display: flex; gap: 18px; font-size: 12.5px; color: var(--n-soft); }
.arch-map__legend span { display: inline-flex; align-items: center; gap: 7px; }
.arch-map__s { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--n-go); }
.arch-map__s--demo { background: var(--n-soft); }
.arch-map__s--designed { background: none; box-shadow: inset 0 0 0 1.5px var(--n-soft); }
.arch-map__s--ext { background: none; box-shadow: inset 0 0 0 1.5px var(--n-faint); }
.arch-map__canvas { overflow-x: auto; padding: 18px 20px 6px; scrollbar-width: thin; }
.arch-map__canvas svg { display: block; width: 100%; min-width: 980px; height: auto; font-family: var(--font); }
.arch-map__panel { display: grid; gap: 6px; min-height: 118px; padding: 16px 22px 20px; border-top: 1px solid rgba(238, 235, 228, 0.08); }
.arch-map__panel h3 { font-size: 19px; font-weight: 500; letter-spacing: -0.02em; }
.arch-map__panel p { font-size: 14.5px; color: var(--n-soft); max-width: 70ch; }
.arch-map__k { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px !important; color: var(--n-faint) !important; }
.arch-map__k code { font: 12px "SF Mono", Menlo, Consolas, monospace; color: var(--n-ink); background: rgba(238, 235, 228, 0.08); padding: 2px 6px; border-radius: 4px; }
/* planes */
.arch-map .pl__band { fill: rgba(238, 235, 228, 0.025); stroke: rgba(238, 235, 228, 0.06); }
.arch-map .pl__name { fill: var(--n-ink); font-size: 13px; font-weight: 600; }
.arch-map .pl__note { fill: var(--n-faint); font-size: 11px; }
.arch-map .pl__rule { stroke: rgba(238, 235, 228, 0.08); }
/* components */
.arch-map .n { cursor: pointer; outline: none; transition: opacity 0.25s; }
.arch-map .n__box { fill: #262624; stroke: rgba(238, 235, 228, 0.14); stroke-width: 1; transition: stroke 0.2s, fill 0.2s; }
.arch-map .n__t { fill: var(--n-ink); font-size: 13px; font-weight: 600; }
.arch-map .n__d { fill: var(--n-soft); font-size: 11px; }
.arch-map .n__s { fill: var(--n-go); }
.arch-map .n--demo .n__s { fill: var(--n-soft); }
.arch-map .n--designed .n__box { fill: none; stroke-dasharray: 5 4; stroke: rgba(238, 235, 228, 0.32); }
.arch-map .n--designed .n__s { fill: none; stroke: var(--n-soft); stroke-width: 1.4; }
.arch-map .n--ext .n__box { fill: rgba(238, 235, 228, 0.04); stroke: rgba(238, 235, 228, 0.22); }
.arch-map .n:hover .n__box, .arch-map .n:focus-visible .n__box, .arch-map .n.is-me .n__box { stroke: var(--n-ink); }
.arch-map .n__badge { opacity: 0; transition: opacity 0.3s; }
.arch-map .n__badge circle { fill: var(--n-ink); }
.arch-map .n__badge text { fill: #1b1b19; font-size: 10.5px; font-weight: 700; }
/* connections */
.arch-map .e { fill: none; stroke: rgba(238, 235, 228, 0.16); stroke-width: 1.2; transition: stroke 0.2s, opacity 0.25s; }
.arch-map .e--write { stroke: rgba(255, 106, 77, 0.3); }
.arch-map .e--ctl { stroke-dasharray: 3 4; }
.arch-map svg.is-focus .n:not(.on) { opacity: 0.3; }
.arch-map svg.is-focus .e:not(.on) { opacity: 0.12; }
.arch-map svg.is-focus .e.on { stroke: var(--n-ink); stroke-width: 1.6; }
.arch-map svg.is-focus .e--write.on { stroke: var(--n-tape); }
/* traces: lit copies flow along the path, nodes light up in order */
.arch-map svg.is-trace .n:not(.lit) { opacity: 0.38; }
.arch-map svg.is-trace .e { opacity: 0.35; }
.arch-map .n.lit .n__box { stroke: var(--n-ink); fill: #2e2e2b; }
.arch-map .n.cur .n__box { stroke-width: 1.8; }
.arch-map .n.lit .n__badge { opacity: 1; }
.arch-map .f { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.arch-map .f.is-rev { stroke-dashoffset: -1; }
.arch-map .f--read { stroke: var(--n-go); }
.arch-map .f--write { stroke: var(--n-tape); }
.arch-map .f.go { stroke-dashoffset: 0; transition: stroke-dashoffset 0.9s cubic-bezier(0.5, 0, 0.2, 1); }
/* entrance: planes, then connections draw, then components */
.js .arch-map .pl { opacity: 0; transition: opacity 0.6s ease-out calc(var(--i) * 0.12s); }
.js .arch-map .e { stroke-dasharray: 1600; stroke-dashoffset: 1600; }
.js .arch-map.is-drawn .e { stroke-dasharray: none; }
.js .arch-map.is-drawn .e--ctl { stroke-dasharray: 3 4; }
.js .arch-map .n { opacity: 0; transition: opacity 0.5s ease-out calc(0.3s + var(--i) * 0.03s); }
.js .arch-map.is-in .pl { opacity: 1; }
.js .arch-map.is-in .e { stroke-dashoffset: 0; transition: stroke-dashoffset 1.2s cubic-bezier(0.5, 0, 0.2, 1) calc(0.5s + var(--i) * 0.03s), stroke 0.2s, opacity 0.25s; }
.js .arch-map.is-in .n { opacity: 1; }
.js .arch-map.is-in svg.is-focus .n:not(.on) { opacity: 0.3; }
.js .arch-map.is-in svg.is-trace .n:not(.lit) { opacity: 0.38; }
@media (prefers-reduced-motion: reduce) { .arch-map * { transition: none !important; } }
@media (max-width: 720px) {
  .arch-map__bar { padding: 14px; }
  .arch-map__canvas { padding: 14px 14px 4px; }
  .arch-map__panel { padding: 14px 16px 18px; }
  .arch-map .eng-swipe { display: block; padding: 0 16px 16px; }
}
