/* ==========================================================================
   Abstract reading guide — a small vertical flowchart that mirrors the
   abstract sentence by sentence. Pure HTML/CSS/SVG, no dependencies.
   ========================================================================== */

.abstract-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 430px);
  gap: clamp(28px, 3.4vw, 56px);
  align-items: start;
}

.abstract-copy {
  min-width: 0;
}

.abstract-quote {
  max-width: 62ch;
}

/* ---------- the chart ---------- */

.flowchart {
  position: sticky;
  top: 96px;
  padding: 20px 18px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(40, 95, 166, 0.14), transparent 62%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.flowchart__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.flowchart__kicker {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.flowchart__hint {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  opacity: 0.75;
}

.flowchart__title {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.flow {
  margin-top: 18px;
}

.flow__stage {
  position: relative;
}

.flow__stage--pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.flow__card {
  position: relative;
  padding: 11px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.flow__card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.flow__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.flow__label i {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0;
  flex: none;
}

.flow__card b {
  display: block;
  margin-top: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.flow__card p {
  margin-top: 5px;
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--muted);
}

.flow__card--blue {
  border-color: color-mix(in srgb, #4f8fdc 34%, var(--line));
  background: color-mix(in srgb, #4f8fdc 8%, transparent);
}

.flow__card--blue .flow__label {
  color: color-mix(in srgb, #3d7fc4 78%, var(--ink));
}
.flow__card--blue .flow__label i {
  background: rgba(79, 143, 220, 0.18);
  color: color-mix(in srgb, #2f6aa8 82%, var(--ink));
}

.flow__card--warm {
  border-color: color-mix(in srgb, #e2a07c 34%, var(--line));
  background: color-mix(in srgb, #e2a07c 8%, transparent);
}

.flow__card--warm .flow__label {
  color: color-mix(in srgb, #c07a52 80%, var(--ink));
}
.flow__card--warm .flow__label i {
  background: rgba(226, 160, 124, 0.18);
  color: color-mix(in srgb, #a9613c 82%, var(--ink));
}

/* the bridge card: gradient hairline border */

.flow__card--core {
  padding: 13px 13px 12px;
  border: 1px solid transparent;
  background:
    linear-gradient(color-mix(in srgb, var(--surface) 92%, #101828), color-mix(in srgb, var(--surface) 92%, #101828)) padding-box,
    var(--grad-solid) border-box;
  box-shadow: 0 10px 26px -20px rgba(40, 95, 166, 0.8);
}

.flow__card--core .flow__label {
  color: var(--warm);
}

.flow__card--core .flow__label i {
  background: var(--grad-solid);
  color: #fff;
}

.flow__list {
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.flow__list li {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 7px;
  align-items: baseline;
  font-size: 0.69rem;
  line-height: 1.45;
  color: var(--ink-2);
}

.flow__list em {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.02em;
  color: var(--ink);
}

.flow__list sub {
  font-size: 0.66em;
  letter-spacing: 0.02em;
}

.flow__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translateY(-1px);
}

.flow__dot--blue { background: #4f8fdc; box-shadow: 0 0 8px rgba(79, 143, 220, 0.7); }
.flow__dot--warm { background: #e2a07c; box-shadow: 0 0 8px rgba(226, 160, 124, 0.7); }

.flow__foot {
  display: block;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line-strong);
  font-size: 0.64rem;
  line-height: 1.4;
  color: var(--muted);
}

/* ---------- inline cross-reference markers ---------- */

.ref-mark {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-left: 3px;
  border: 1px solid color-mix(in srgb, var(--warm) 42%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--warm) 12%, transparent);
  color: var(--warm);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1;
  vertical-align: 0.35em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.ref-mark:hover,
.ref-mark.is-active {
  background: var(--warm);
  border-color: var(--warm);
  color: #fff;
  transform: scale(1.12);
}

/* highlight the matching stage in the chart */

.flow__stage.is-lit .flow__card {
  border-color: color-mix(in srgb, var(--warm) 62%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warm) 16%, transparent);
}

.flow__stage.is-lit .flow__label i {
  background: var(--warm);
  color: #fff;
}

/* ---------- connectors ---------- */

.flow__conn {
  position: relative;
  height: 30px;
  margin: 2px 0;
}

.flow__conn svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.flow__wire {
  fill: none;
  stroke: color-mix(in srgb, var(--muted) 55%, transparent);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-dasharray: 4 5;
  animation: flow-dash 1.6s linear infinite;
}

@keyframes flow-dash {
  to { stroke-dashoffset: -18; }
}

.flow__conn--line {
  width: 2px;
  height: 26px;
  margin: 4px auto;
  background-image: repeating-linear-gradient(
    180deg,
    color-mix(in srgb, var(--muted) 62%, transparent) 0 5px,
    transparent 5px 10px
  );
  background-size: 2px 10px;
  animation: flow-dash-line 1.4s linear infinite;
}

.flow__conn--line::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 5px;
  height: 5px;
  border-right: 1.4px solid color-mix(in srgb, var(--muted) 70%, transparent);
  border-bottom: 1.4px solid color-mix(in srgb, var(--muted) 70%, transparent);
  transform: translateX(-50%) rotate(45deg);
}

@keyframes flow-dash-line {
  to { background-position: 0 10px; }
}

/* ---------- result pill ---------- */

.flow__result {
  position: relative;
  padding: 12px 14px 13px;
  border-radius: 12px;
  background: var(--grad-solid);
  color: #fff;
  box-shadow: 0 16px 30px -22px rgba(40, 95, 166, 0.9);
  overflow: hidden;
}

.flow__result::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 120% at 100% 0%, rgba(255, 255, 255, 0.22), transparent 60%);
  pointer-events: none;
}

.flow__result-k {
  display: block;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.flow__result b {
  display: block;
  margin-top: 5px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.flow__result-m {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .abstract-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
  }
  .abstract-quote {
    max-width: 72ch;
  }
  /* stacked: the map comes first, then the prose it explains */
  .flowchart {
    position: static;
    order: -1;
    max-width: 640px;
  }
  .flow__stage--pair {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  /* justified text + hyphenation is unreadable on a phone */
  .abstract-text {
    text-align: left;
    -webkit-hyphens: manual;
    hyphens: manual;
    word-spacing: 0;
  }
  .abstract-quote {
    padding-left: 16px;
  }
}

@media (max-width: 560px) {
  .flowchart {
    padding: 16px 14px 18px;
    border-radius: 14px;
  }
  .flow__stage--pair {
    grid-template-columns: 1fr;
  }
  .flow__conn svg {
    display: none;
  }
  .flow__conn {
    height: 18px;
  }
  .flow__conn--line {
    height: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow__wire,
  .flow__conn--line {
    animation: none;
  }
}
