/* AgentInfraGraphWorld — research proposal */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #000000;
  --muted: #555555;
  --faint: #888888;
  --rule: #e2e2e2;
  --rule-strong: #b0b0b0;
  --panel: #fafafa;
  --accent: #1f5c8b;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

svg {
  display: block;
}

figure {
  margin: 0;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 28px 48px;
}

.header {
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.doc-label {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2.05rem, 4.4vw, 2.55rem);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.02em;
}

.byline {
  margin: 0;
  font-size: 13.5px;
  color: var(--faint);
}

.nowrap {
  white-space: nowrap;
}

p {
  margin: 0 0 1em;
}

.lead {
  margin-top: 24px;
  font-size: 1.06rem;
  line-height: 1.6;
}

.question {
  margin: 1.3em 0;
  padding-left: 14px;
  border-left: 2px solid var(--ink);
}

h2 {
  margin: 2.5em 0 0.65em;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
}

h3 {
  margin: 1.9em 0 0.45em;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

/* figures */

.paper-figure {
  margin: 24px 0 26px;
  padding: 16px;
  border: 1px solid var(--rule);
}

.paper-figure svg {
  width: 100%;
  height: auto;
}

.paper-figure figcaption {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--faint);
}

.diagram text {
  font-family: var(--font);
  fill: var(--ink);
}

.diagram .small {
  font-size: 11px;
  fill: var(--muted);
}

.diagram .label {
  font-size: 12px;
  font-weight: 600;
}

/* definition and equations */

.definition {
  margin: 22px 0;
  padding: 12px 16px;
  border-left: 2px solid var(--rule-strong);
  background: var(--panel);
}

.definition p {
  margin: 0;
}

.equation {
  margin: 0.45em 0 1em;
  font-size: 15.5px;
  line-height: 1.8;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

/* tables */

.table-wrap {
  margin: 0.6em 0 1.2em;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.45;
}

.data-table caption {
  caption-side: top;
  padding-bottom: 6px;
  text-align: left;
  font-size: 13px;
  color: var(--faint);
}

.data-table th,
.data-table td {
  padding: 6px 7px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-weight: 600;
  border-bottom-color: var(--rule-strong);
}

.layers-table th:first-child,
.layers-table td:first-child {
  width: 30%;
}

.eval-table {
  min-width: 640px;
}

.eval-table th:nth-child(1),
.eval-table td:nth-child(1) {
  width: 24%;
}

.eval-table th:nth-child(2),
.eval-table td:nth-child(2) {
  width: 38%;
}

.eval-table th:nth-child(3),
.eval-table td:nth-child(3) {
  width: 38%;
}

/* lists */

.requirements,
.targets,
.contributions {
  margin: 0.5em 0 1.2em;
  padding-left: 1.25em;
}

.requirements li,
.targets li,
.contributions li {
  margin: 0.4em 0;
  padding-left: 2px;
}

/* references */

.references {
  margin: 0.5em 0 0;
  padding-left: 1.4em;
  font-size: 14.5px;
  line-height: 1.55;
}

.references li {
  margin: 0.55em 0;
}

.references a {
  overflow-wrap: anywhere;
}

/* footer */

.footer {
  margin-top: 3em;
  padding-top: 1.2em;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.6;
  color: var(--faint);
}

.footer p {
  margin: 0 0 4px;
}

.footer a {
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
}

@media (max-width: 620px) {
  body {
    font-size: 17px;
  }

  .page {
    padding: 42px 20px 36px;
  }

  h1 {
    font-size: clamp(1.9rem, 8vw, 2.3rem);
  }

  h2 {
    margin-top: 2.1em;
  }

  .paper-figure {
    padding: 10px;
    margin: 20px 0 22px;
  }

  .data-table {
    font-size: 13px;
  }

  .data-table th,
  .data-table td {
    padding: 5px 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ------------------------------------------------------------------
   AgentInfraGraphWorld — interactive visuals
   ------------------------------------------------------------------ */

.header-links {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--faint);
}

.header-links a,
.footer a {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.section-tight {
  margin-top: 1.6em;
}

.section-head {
  margin-bottom: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

.section-intro {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

/* four graph cards */

.graph-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 18px 0 20px;
}

.graph-card {
  padding: 10px 12px;
  border: 1px solid var(--rule);
}

.graph-tag {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
}

.graph-line {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

/* simulator */

.simulator-section {
  width: min(1000px, calc(100vw - 48px));
  margin-left: 50%;
  transform: translateX(-50%);
  margin-top: 3em;
  margin-bottom: 3em;
  scroll-margin-top: 20px;
}

.sim-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sim-scenarios,
.sim-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sim-button,
.sim-scenario {
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  padding: 6px 10px;
  cursor: pointer;
}

.sim-button:hover,
.sim-scenario:hover {
  border-color: var(--ink);
}

.sim-scenario.is-active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.sim-button-primary {
  border-color: var(--ink);
}

.sim-button-primary[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.sim-stage {
  border: 1px solid var(--rule);
  background: var(--bg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#sim-svg {
  display: block;
  width: 100%;
  height: auto;
}

.sim-panel {
  fill: var(--panel);
  stroke: var(--rule);
  transition: fill 0.35s ease, stroke 0.35s ease;
}

.sim-panel.is-active {
  fill: #f1f7fb;
  stroke: var(--accent);
  stroke-width: 1.5;
}

.sim-panel-label {
  font-size: 14px;
  font-weight: 600;
  fill: var(--ink);
}

.sim-rel {
  stroke: #bbbbbb;
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
  transition: stroke 0.3s ease, stroke-width 0.3s ease;
}

.sim-rel.is-active {
  stroke: var(--accent);
  stroke-width: 2;
  animation: sim-dash 0.9s linear infinite;
}

.sim-feedback {
  fill: none;
  stroke: #b45309;
  stroke-width: 2;
  stroke-dasharray: 6 4;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sim-feedback.is-active {
  opacity: 1;
  animation: sim-dash 1.1s linear infinite;
}

.sim-hub {
  fill: #f2f5f8;
  stroke: #888888;
}

.sim-hub-label {
  font-size: 12px;
  font-style: italic;
  fill: var(--ink);
}

.sim-node {
  cursor: pointer;
}

.sim-node circle {
  fill: var(--bg);
  stroke: #333333;
  stroke-width: 1.3;
  transform-box: fill-box;
  transform-origin: center;
}

.sim-node text {
  font-size: 11px;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.sim-node.is-new circle {
  fill: #e8f2fa;
  stroke: var(--accent);
  stroke-width: 2.2;
  animation: sim-pop 0.6s ease-out;
}

.sim-node.is-alert circle {
  fill: #fff7ed;
  stroke: #b45309;
  stroke-width: 2;
}

.sim-node.is-focus circle {
  stroke: var(--accent);
  stroke-width: 2.4;
}

.sim-node.is-ghost {
  pointer-events: none;
  animation: sim-fade 0.85s ease-out forwards;
}

.sim-edge {
  stroke: #777777;
  stroke-width: 1.2;
}

.sim-edge.is-new,
.sim-edge.is-focus {
  stroke: var(--accent);
  stroke-width: 1.8;
}

.sim-timeline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.sim-timeline input[type="range"] {
  flex: 1;
  min-width: 120px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.sim-timeline input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--rule-strong);
}

.sim-timeline input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
}

.sim-timeline input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--rule-strong);
}

.sim-timeline input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
}

.sim-step-label {
  min-width: 52px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.sim-status {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--panel);
  border-left: 2px solid var(--accent);
}

.sim-status-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.sim-step-badge {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

#sim-message {
  margin: 6px 0 8px;
  min-height: 2.7em;
  font-size: 14.5px;
  line-height: 1.55;
}

.sim-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

.sim-chain span {
  padding: 2px 7px;
  border: 1px solid var(--rule);
  background: var(--bg);
}

.sim-chain span.is-current {
  border-color: var(--accent);
  color: var(--accent);
}

.sim-chain em {
  font-style: normal;
  color: #aaaaaa;
}

.sim-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.sim-steps button {
  font: inherit;
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 6px 7px;
  cursor: pointer;
}

.sim-steps button strong {
  display: block;
  font-size: 11.5px;
  color: var(--ink);
  font-weight: 600;
}

.sim-steps button.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.sim-steps button.is-active strong {
  color: var(--bg);
}

.demo-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--faint);
}

/* mechanisms */

.mechanism-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.mechanism-card {
  padding: 14px;
  border: 1px solid var(--rule);
}

.mechanism-card h3 {
  margin: 8px 0 4px;
  font-size: 1rem;
}

.mechanism-card p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.mechanism-visual {
  height: 76px;
}

.mechanism-visual svg {
  width: 100%;
  height: 100%;
}

.mechanism-visual svg circle {
  fill: var(--bg);
  stroke: #333333;
  stroke-width: 1.4;
}

.mechanism-visual svg line,
.mechanism-visual svg path {
  fill: none;
  stroke: #333333;
  stroke-width: 1.3;
}

.mechanism-visual .pulse-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse-ring 2.2s ease-out infinite;
}

.mechanism-visual .flow-arrow {
  stroke: var(--accent);
  stroke-dasharray: 4 3;
  animation: sim-dash 1.1s linear infinite;
}

.mechanism-visual .loop-arrow {
  stroke: var(--accent);
  stroke-dasharray: 5 4;
  animation: sim-dash 1.2s linear infinite;
}

.mechanism-visual .chip-row rect {
  fill: var(--panel);
  stroke: #bbbbbb;
}

.mechanism-visual .chip-row text {
  font-size: 12px;
  fill: var(--ink);
}

.text-button {
  font: inherit;
  font-size: 13px;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* architecture */

.arch-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  margin: 20px 0;
}

.arch-svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: var(--bg);
}

.arch-scroll {
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.arch-module {
  cursor: pointer;
}

.arch-module rect {
  fill: var(--panel);
  stroke: var(--rule-strong);
  transition: fill 0.25s ease, stroke 0.25s ease;
}

.arch-module text {
  font-size: 14px;
  fill: var(--ink);
}

.arch-module .arch-note {
  font-size: 11px;
  fill: var(--faint);
}

.arch-module.is-active rect {
  fill: #edf5fa;
  stroke: var(--accent);
  stroke-width: 1.8;
}

.arch-module:hover rect,
.arch-module:focus-visible rect {
  stroke: var(--ink);
}

.arch-arrows path {
  fill: none;
  stroke: #555555;
  stroke-width: 1.2;
}

.arch-feedback-path {
  stroke: var(--accent) !important;
  stroke-dasharray: 5 4;
  animation: sim-dash 1.2s linear infinite;
}

.arch-caption {
  font-size: 11px;
  fill: var(--faint);
}

.arch-detail {
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--accent);
}

.arch-detail h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.arch-detail p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

/* comparison, contributions, references */

.compare-table {
  min-width: 620px;
}

.compare-table th:nth-child(1),
.compare-table td:nth-child(1) {
  width: 18%;
}

.compare-table th:nth-child(2),
.compare-table td:nth-child(2),
.compare-table th:nth-child(3),
.compare-table td:nth-child(3) {
  width: 41%;
}

.contrib-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 18px 0;
}

.contrib-card {
  padding-top: 10px;
  border-top: 2px solid var(--ink);
}

.contrib-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.contrib-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.contrib-num {
  margin: 0 0 4px !important;
  font-size: 11px;
  color: var(--faint) !important;
  font-variant-numeric: tabular-nums;
}

.references-details {
  margin-top: 2em;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.references-details summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}

.references-details[open] summary {
  margin-bottom: 10px;
}

button:focus-visible,
.sim-node:focus-visible,
.arch-module:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@keyframes sim-pop {
  0% { opacity: 0.2; }
  100% { opacity: 1; }
}

@keyframes sim-fade {
  to { opacity: 0; }
}

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

@keyframes pulse-ring {
  0% { transform: scale(0.7); opacity: 0.8; }
  100% { transform: scale(1.7); opacity: 0; }
}

@media (max-width: 860px) {
  .graph-cards { grid-template-columns: repeat(2, 1fr); }
  .mechanism-grid { grid-template-columns: 1fr; }
  .arch-wrap { grid-template-columns: 1fr; }
  .arch-scroll .arch-svg { min-width: 680px; }
  .contrib-grid { grid-template-columns: 1fr; }
  #sim-svg { min-width: 760px; }
}

@media (max-width: 620px) {
  .graph-cards { grid-template-columns: 1fr; }
  .simulator-section { width: calc(100vw - 32px); }
  .sim-toolbar { flex-direction: column; }
  .sim-scenarios, .sim-controls { width: 100%; }
  .sim-scenario, .sim-button { flex: 1 1 auto; }
  .card, .graph-card, .mechanism-card { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.scroll-hint {
  display: none;
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--faint);
}

@media (max-width: 860px) {
  .scroll-hint { display: block; }
}

/* semantic simulator */

.motivation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 16px 0 18px;
}

.motivation-card {
  padding-top: 9px;
  border-top: 2px solid var(--ink);
}

.motivation-card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.motivation-card .graph-tag {
  margin: 0 0 4px;
  color: var(--ink);
}

.hypothesis {
  margin: 1.1em 0 1.2em;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  font-size: 15px;
  line-height: 1.6;
}

.sim-node rect {
  fill: var(--bg);
  stroke: #333333;
  stroke-width: 1.2;
  transition: fill 0.25s ease, stroke 0.25s ease, stroke-width 0.25s ease;
}

.sim-node text {
  font-size: 10.5px;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.sim-node.is-new rect {
  fill: #e8f2fa;
  stroke: var(--accent);
  stroke-width: 2;
}

.sim-node.is-new {
  animation: sim-pop 0.6s ease-out;
}

.sim-node.is-alert rect {
  fill: #fff7ed;
  stroke: #b45309;
  stroke-width: 1.8;
}

.sim-node.is-focus rect {
  stroke: var(--accent);
  stroke-width: 2.2;
}

.sim-node.is-ghost rect {
  opacity: 0.75;
}

.sim-edge.is-contention {
  stroke: #b45309;
  stroke-width: 1.8;
  stroke-dasharray: 5 3;
}

.sim-edge.is-reuse {
  stroke: #777777;
}

.sim-xedge {
  fill: none;
  stroke: #8fa9bc;
  stroke-width: 1.1;
  stroke-dasharray: 4 4;
  opacity: 0.5;
}

.sim-xedge.is-new {
  opacity: 0.9;
}

.sim-xedge.is-active {
  opacity: 1;
  stroke: var(--accent);
  stroke-width: 1.8;
  animation: sim-dash 1s linear infinite;
}

.sim-xedge.is-feedback {
  opacity: 1;
  stroke: #b45309;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.sim-xedge.is-feedback.is-active {
  stroke: #b45309;
  animation: sim-dash 1.2s linear infinite;
}

.sim-edge-label {
  font-size: 9.5px;
  fill: var(--faint);
  pointer-events: none;
}

.sim-edge-label.is-alert {
  fill: #b45309;
}

.sim-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.sim-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  display: inline-block;
  width: 24px;
  height: 0;
  border-top: 1.4px solid #777777;
}

.legend-line.dashed {
  border-top-color: #8fa9bc;
  border-top-style: dashed;
}

.legend-line.amber {
  border-top-color: #b45309;
  border-top-style: dashed;
}

.sim-scope {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--accent);
}

@media (max-width: 860px) {
  .motivation-grid { grid-template-columns: 1fr; }
  .sim-scope { text-align: left; }
}
