/* ==========================================================================
   Deeper genealogy: delay line of buffer stages
   Markup: _includes/delay-line.html   Script: assets/js/delay-line.js
   Colours come from the theme's CSS variables, so the site's light/dark
   toggle (which itself follows prefers-color-scheme by default) applies.
   ========================================================================== */

.dl {
  --dl-ink: var(--global-text-color, #494e52);
  --dl-paper: var(--global-bg-color, #fff);
  --dl-accent: var(--global-base-color, #2f7f93);
  --dl-line: var(--global-border-color, #e5e5e5);
  --dl-mono: Monaco, Consolas, "Lucida Console", monospace;
  --dl-bottom: 0px;                 /* height of the site's fixed footer, set by JS */
  position: relative;
  margin-top: 1em;
}
.dl.dl--js { padding-bottom: 3em; }

.dl__heading { margin-top: 0; }
.dl__intro { max-width: 40em; }
.dl__jump a { font-family: var(--dl-mono); font-size: 0.8em; }

/* semantic list: visible without JS, screen-reader only once the diagram runs */
.dl--js .dl-list,
.dl--js .dl__jump-nojs {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  width: 1px !important;
  height: 1px !important;
  overflow: hidden;
  white-space: nowrap;
}

.dl-stage { display: none; position: relative; margin: 1.5em 0 1em; }
.dl--js .dl-stage { display: block; }
.dl-svg { display: block; overflow: visible; font-family: var(--dl-mono); }

/* --------------------------------------------------------------------------
   Schematic
   -------------------------------------------------------------------------- */
.dl-s, .dl-w path {
  fill: none;
  stroke: var(--dl-ink);
  stroke-width: 1.3px;
}
.dl-w path { opacity: 0.45; }
.dl-jn { fill: var(--dl-ink); }
.dl-leader { stroke: var(--dl-ink); stroke-width: 0.8px; opacity: 0.28; }
.dl-leader--approx { stroke-dasharray: 3 3; }

.dl-tri {
  fill: none;
  stroke: var(--dl-ink);
  stroke-width: 1.4px;
  stroke-linejoin: round;
}
.dl-stg { opacity: 0.45; transition: opacity 0.35s ease; }
.dl-stg.is-lit { opacity: 1; }
.dl-photo { opacity: 0.95; }

/* everything below the pulse front, drawn again in the accent colour */
.dl-lit path,
.dl-lit .dl-tri {
  fill: none;
  stroke: var(--dl-accent);
  stroke-width: 2.2px;
  stroke-linejoin: round;
}

.dl-t { fill: var(--dl-ink); font-family: var(--dl-mono); font-size: 10px; }
.dl-t--muted { fill-opacity: 0.55; font-size: 9px; }
.dl-t--src { font-weight: 700; letter-spacing: 0.08em; fill: var(--dl-accent); }
.dl-t--tag { font-size: 9px; letter-spacing: 0.12em; fill-opacity: 0.6; }
.dl-t--axis { font-size: 9.5px; fill-opacity: 0.6; }
.dl-t--end { font-weight: 700; fill: var(--dl-accent); fill-opacity: 1; }
.dl-t--ini { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }

/* signal flowing up the lit wires (dash offset grows -> dashes move to the path start = up) */
.dl-flow path {
  fill: none;
  stroke: var(--dl-paper);
  stroke-width: 2.4px;
  stroke-dasharray: 3 11;
  animation: dl-flow 0.9s linear infinite;
}
@keyframes dl-flow {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: 14; }
}
.dl--static .dl-flow { display: none; }

/* --------------------------------------------------------------------------
   Rows (real buttons over the drawing)
   -------------------------------------------------------------------------- */
.dl-rows { position: absolute; inset: 0; }
.dl-row {
  position: absolute;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  margin: 0;
  overflow: hidden;
  text-align: left;
  color: var(--dl-ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: inherit;
  line-height: 1.25;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.35s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.dl-row--phd { flex-direction: row-reverse; text-align: right; }
.dl-row__txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dl-row--phd .dl-row__txt { align-items: flex-end; }

/* square portrait next to the buffer; initials when there is no photo */
.dl-row__ph {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--global-dark-border-color, #bdc1c4);
  border-radius: 3px;
  background: var(--global-footer-bg-color, #f2f3f3);
  font-family: var(--dl-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.dl-row__ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
  filter: grayscale(1) contrast(1.05);
}
.dl-row__ph--none { border-style: dashed; opacity: 0.85; }
.dl-row.is-lit .dl-row__ph { border-color: var(--dl-accent); }
.dl-row.is-lit { opacity: 1; }
.dl-row:hover { background: rgba(128, 128, 128, 0.07); }
.dl-row.is-open { border-color: var(--dl-accent); }
.dl-row:focus-visible { outline: 2px solid var(--dl-accent); outline-offset: 2px; }
.dl-row__tag {
  font-family: var(--dl-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.65;
}
.dl-row.is-lit .dl-row__tag { color: var(--dl-accent); opacity: 1; }
.dl-row__name { font-size: 15px; font-weight: 700; }
.dl-row__org { font-size: 12.5px; opacity: 0.8; }
.dl-anchor { position: absolute; top: 0; }

@media (max-width: 519px) {
  .dl-row { gap: 9px; }
  .dl-row__ph { flex-basis: 44px; width: 44px; height: 44px; font-size: 13px; }
  .dl-row__name { font-size: 14px; }
  .dl-row__org { font-size: 11.5px; }
  .dl-row__tag { font-size: 9px; }
}

/* --------------------------------------------------------------------------
   Details card
   -------------------------------------------------------------------------- */
.dl-card {
  position: absolute;
  z-index: 3;
  display: flex;
  padding: 12px 14px;
  background: var(--dl-paper);
  color: var(--dl-ink);
  border: 1px solid var(--dl-accent);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  box-sizing: border-box;
}
.dl-card[hidden] { display: none; }
.dl-card__close {
  position: absolute;
  top: 4px;
  right: 6px;
  padding: 0 6px;
  font-size: 20px;
  line-height: 1;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.dl-card__close:focus-visible { outline: 2px solid var(--dl-accent); }
.dl-card__body { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.dl-card__fig { flex: 0 0 84px; margin: 0; }
.dl-card__fig img {
  display: block;
  width: 84px;
  height: 84px;
  object-fit: cover;
  object-position: 50% 20%;
  border: 1px solid var(--dl-line);
  border-radius: 3px;
  filter: grayscale(1) contrast(1.05);
}
.dl .dl-card__fig figcaption { margin-top: 4px; font-family: inherit; font-size: 10px; line-height: 1.3; opacity: 0.75; word-break: break-word; }
.dl-card__txt { min-width: 0; padding-right: 14px; }
.dl-card__tag { font-family: var(--dl-mono); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--dl-accent); }
.dl .dl-card__name { margin: 2px 0 2px; font-size: 17px; line-height: 1.25; }
.dl-card__name:focus { outline: none; }
.dl-card__org { font-size: 13px; }
.dl .dl-card__note { margin: 6px 0 0; font-size: 13px; line-height: 1.4; }
.dl-card__links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12.5px; }

/* --------------------------------------------------------------------------
   Scope: shows the year of the newest lit stage
   -------------------------------------------------------------------------- */
.dl-scope {
  position: fixed;
  right: 16px;
  bottom: calc(var(--dl-bottom) + 16px);
  z-index: 15;
  width: 236px;
  padding: 6px 8px 5px;
  background: var(--dl-paper);
  color: var(--dl-ink);
  border: 1px solid var(--global-dark-border-color, #bdc1c4);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  font-family: var(--dl-mono);
  font-size: 10px;
  line-height: 1.35;
}
.dl-scope[hidden] { display: none; }
.dl-scope__bar, .dl-scope__foot { display: flex; justify-content: space-between; }
.dl-scope__ch { color: var(--dl-accent); font-weight: 700; }
.dl-scope__probe { opacity: 0.75; }
.dl-scope__main { display: flex; align-items: baseline; gap: 8px; margin: 2px 0; }
.dl-scope__year { font-size: 20px; font-weight: 700; color: var(--dl-accent); }
.dl-scope__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; opacity: 0.8; }
.dl-scope__svg { display: block; width: 100%; height: 56px; background: rgba(128, 128, 128, 0.06); }
.dl-scope__foot { opacity: 0.55; }
.dl-sc-div { stroke: var(--dl-ink); stroke-opacity: 0.12; stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.dl-sc-trace { fill: none; stroke: var(--dl-accent); stroke-width: 1.7; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.dl-sc-head { fill: var(--dl-accent); }

/* phones: a slim bar at the bottom (no plot) */
@media (max-width: 599px) {
  .dl-scope {
    left: 8px;
    right: 8px;
    bottom: calc(var(--dl-bottom) + 8px);
    width: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
  }
  .dl-scope__bar { flex-direction: column; }
  .dl-scope__main { margin: 0; min-width: 0; }
  .dl-scope__year { font-size: 17px; }
  .dl-scope__svg, .dl-scope__foot { display: none; }
  .dl.dl--js { padding-bottom: 5em; }
}

.dl-foot { max-width: 44em; opacity: 0.85; }

/* reduced motion: one static, fully lit diagram */
.dl--static .dl-stg, .dl--static .dl-row { opacity: 1; transition: none; }
@media (prefers-reduced-motion: reduce) {
  .dl * { transition: none !important; }
}
