/* Final layout polish: equal feature cards, a compact prompt card, and
   comfortable interaction targets. */

/* Paired path cards read as one row instead of two unrelated heights. */
.two-paths {
  align-items: stretch;
}

.path-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.path-card > .link-arrow {
  margin-top: auto;
  padding-top: 1rem;
}

/* The prompt card is a compact quote; let the execution chain define the row. */
.auto-grid {
  align-items: start;
}

.auto-card--task .auto-signal {
  margin-top: 1.2rem;
}

/* Keep primary controls comfortable on touch screens. */
.site-header .lang-btn {
  min-width: 44px;
  min-height: 44px;
}

.site-header .nav-toggle {
  min-width: 44px;
  min-height: 44px;
}

.site-header .header-install {
  min-height: 44px;
}

.quick-install__head .copy-btn {
  min-height: 44px;
}

.site-footer .footer-col a {
  display: flex;
  min-height: 30px;
  align-items: center;
}

@media (max-width: 960px) {
  .site-header .nav-link {
    min-height: 44px;
  }
}

/* Rows use a soft hover wash only; no blue vertical hover rule. */
.tool-cap-row:hover,
.tool-detail__row:hover {
  box-shadow: none;
}

/* The scenario row ends with its cards, not a stray rule. */
.scenario-grid {
  border-bottom: 0;
}

/* No hover/focus rule is allowed to draw a vertical line on reference rows. */
.tool-detail__row,
.tool-detail__row:hover,
.tool-detail__row:focus-within,
.tool-cap-row,
.tool-cap-row:hover,
.tool-cap-row:focus-within {
  border-left: 0 !important;
  box-shadow: none !important;
}

/* Boundary cards need breathing room inside their rounded surface. */
.boundary-box {
  padding-left: 1.15rem;
  padding-right: 1.15rem;
}

@media (max-width: 720px) {
  .boundary-box {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }
}

/* Give the host-setup note and its following link their own breathing room. */
#mcp .method-note {
  margin-top: 1.4rem;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

#mcp .method-note + p {
  margin-top: 1rem;
  padding-left: 0.9rem;
}

/* Device flow cells need their labels inset from the first vertical rule. */
.device-step {
  padding-left: 0.75rem;
}

/* Tool capability rows: the hover surface runs edge-to-edge, and the
   navigation arrow is large enough to read at a glance. */
.tool-cap-list {
  padding: 0;
  overflow: hidden;
}

.tool-cap-row {
  grid-template-columns: 4rem minmax(0, 1fr) 2rem;
  padding: 1.25rem 1.5rem;
}

.tool-cap-row__arrow {
  align-self: center;
  justify-self: end;
  padding-top: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.tool-cap-row:focus-visible {
  background: #f8fbff;
}

@media (max-width: 720px) {
  .tool-cap-row {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 640px) {
  .tool-cap-row {
    grid-template-columns: 3.2rem minmax(0, 1fr) 1.8rem;
  }
}

/* Make the right-hand navigation mark read as an icon, not small text. */
.tool-cap-row__arrow {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
}

/* Install headings sit in a narrow rail; do not split long English words. */
@media (min-width: 1100px) {
  .install-section > h2 {
    max-width: none;
    overflow-wrap: normal;
    word-break: normal;
  }
}

/* End-to-end loop: a compact process rail, not another card stack. */
body[data-page="analysis"] .section--loop {
  padding-block: clamp(2.6rem, 4.5vw, 4rem);
  background: #0b1220;
  color: #f6f9ff;
}

body[data-page="analysis"] .section--loop .section-title {
  color: #f6f9ff;
}

body[data-page="analysis"] .section--loop .section-intro {
  color: #b9c8dd;
}

.loop-flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.loop-step {
  display: flex;
  min-width: 0;
  min-height: 10.5rem;
  flex-direction: column;
  padding: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.loop-step__num {
  color: #8fb5e8;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1;
}

.loop-step strong {
  display: block;
  margin-top: 0.65rem;
  color: #f6f9ff;
  font-size: 1.03rem;
  line-height: 1.25;
}

.loop-step__owner {
  display: block;
  margin-top: 0.4rem;
  color: #a9b8cc;
  font-size: 0.76rem;
  line-height: 1.35;
}

.loop-step code {
  display: block;
  margin-top: auto;
  padding-top: 1rem;
  color: #a9c9f5;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.loop-return {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 1.4rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: #b9c8dd;
  font-size: 0.86rem;
  line-height: 1.55;
}

.loop-return__icon {
  color: #8fb5e8;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  line-height: 1.2;
}

@media (max-width: 1100px) {
  .loop-flow {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .loop-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .loop-step {
    min-height: 0;
  }

  .loop-step code {
    margin-top: 0.8rem;
    padding-top: 0;
  }
}

@media (max-width: 360px) {
  .loop-flow {
    grid-template-columns: 1fr;
  }

  .loop-step {
    min-height: 0;
  }
}

.loop-step code {
  font-size: 0.75rem;
}

/* Budget/evidence demo: use the same light code surface as the rest of the site. */
#mcp-budget .terminal {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--card-shadow);
}

#mcp-budget .terminal-top {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--line);
  background: #f7faff;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  line-height: 1.3;
  text-transform: uppercase;
}

#mcp-budget .terminal-body {
  padding: 1.15rem 1.1rem;
  background: #f7faff;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.75;
}

#mcp-budget .terminal-body .key {
  color: var(--signal);
}

#mcp-budget .terminal-body .prompt {
  color: var(--muted);
}

#mcp-budget .terminal-body .comment {
  color: var(--muted);
}

#mcp-budget .terminal-stats {
  border-top: 1px solid var(--line);
  background: #fff;
}

#mcp-budget .terminal-stat {
  padding: 0.9rem 1rem;
}

#mcp-budget .terminal-stat + .terminal-stat {
  border-left: 1px solid var(--line);
}

#mcp-budget .terminal-stat b {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
}

#mcp-budget .terminal-stat span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  line-height: 1.35;
  text-transform: uppercase;
}

/* No section marker line above split headings. */
.sticky-head h2::before {
  display: none !important;
  content: none !important;
}

#mcp-budget .terminal-top {
  font-size: 0.75rem;
}

/* Workflow as an explicit owner-by-owner process list. */
.loop-flow {
  display: block;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.loop-step {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1.55fr) minmax(9rem, 0.55fr);
  gap: 1rem;
  align-items: start;
  min-height: 0;
  padding: 1.05rem 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  background: transparent;
}

.loop-step:first-child {
  border-top: 0;
}

.loop-step__num {
  padding-top: 0.1rem;
}

.loop-step__body {
  min-width: 0;
}

.loop-step__body strong {
  display: block;
  margin: 0 0 0.25rem;
  color: #f6f9ff;
  font-size: 0.98rem;
  line-height: 1.35;
}

.loop-step__desc {
  margin: 0;
  color: #b9c8dd;
  font-size: 0.84rem;
  line-height: 1.55;
}

.loop-step__meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.loop-step__owner {
  display: inline-flex;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #dce8f8;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.25;
  white-space: nowrap;
}

.loop-step__meta code {
  margin: 0;
  padding: 0;
  color: #a9c9f5;
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: right;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .loop-step {
    grid-template-columns: 1.7rem minmax(0, 1fr);
    column-gap: 0.8rem;
    row-gap: 0;
    padding: 0.95rem 0;
  }

  .loop-step__body,
  .loop-step__meta {
    grid-column: 2;
  }

  .loop-step__meta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    margin-top: 0.55rem;
  }

  .loop-step__meta code {
    text-align: left;
  }
}

/* Workflow: a light, readable ownership timeline. */
body[data-page="analysis"] .section--loop {
  padding-block: clamp(2.8rem, 4.5vw, 4.2rem);
  border-block: 1px solid #e7eef8;
  background: #f4f8ff;
  color: var(--ink);
}

body[data-page="analysis"] .section--loop .section-title {
  color: var(--ink);
}

body[data-page="analysis"] .section--loop .section-intro {
  color: var(--muted);
}

.loop-flow {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
}

.loop-step {
  position: relative;
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) minmax(10rem, 0.42fr);
  gap: 1.3rem;
  align-items: start;
  min-height: 0;
  padding: 0 0 1.85rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.loop-step::before {
  content: "";
  position: absolute;
  top: 2.65rem;
  bottom: 0;
  left: 1.3rem;
  width: 1px;
  background: #d7e2f0;
}

.loop-step:last-child {
  padding-bottom: 0;
}

.loop-step:last-child::before {
  display: none;
}

.loop-step__num {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1;
}

.loop-step__body {
  min-width: 0;
  padding-top: 0.15rem;
}

.loop-step__body strong {
  display: block;
  margin: 0 0 0.35rem;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
}

.loop-step__desc {
  max-width: 64ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.loop-step__meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  padding-top: 0.1rem;
}

.loop-step__owner {
  display: inline-flex;
  padding: 0.25rem 0.55rem;
  border: 1px solid #cbd9ea;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.25;
  white-space: nowrap;
}

.loop-step:nth-child(1) .loop-step__owner {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.loop-step:nth-child(n + 2):nth-child(-n + 6) .loop-step__owner {
  border-color: #cfe0ff;
  background: #eaf2ff;
  color: #0a59f7;
}

.loop-step:nth-child(7) .loop-step__owner {
  border-color: #cbd9ea;
  background: #fff;
  color: var(--ink);
}

.loop-step__meta code {
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding: 0.28rem 0.5rem;
  border: 1px solid #dbe5f1;
  border-radius: 6px;
  background: #fff;
  color: #47617f;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: left;
  overflow-wrap: anywhere;
}

.loop-return {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 2rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid #dbe5f1;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.loop-return__icon {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  line-height: 1.2;
}

@media (max-width: 720px) {
  .loop-step {
    grid-template-columns: 2rem minmax(0, 1fr);
    column-gap: 0.9rem;
    row-gap: 0;
    padding-bottom: 1.5rem;
  }

  .loop-step::before {
    top: 2.15rem;
    left: 1rem;
  }

  .loop-step__num {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
  }

  .loop-step__body {
    padding-top: 0.05rem;
  }

  .loop-step__meta {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding-top: 0;
    margin-top: 0.7rem;
  }
}

/* Run sequence: a plain engineering table, not a timeline or card deck. */
body[data-page="analysis"] .section--run {
  padding-block: clamp(2.8rem, 4.5vw, 4.2rem);
  background: #fff;
}

.run-table {
  margin-top: clamp(1.6rem, 3vw, 2.4rem);
  border-top: 1px solid var(--ink);
}

.run-head,
.run-row {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) 9rem 10rem;
  gap: 1.1rem;
  align-items: start;
}

.run-head {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-transform: uppercase;
}

.run-row {
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line);
}

.run-num {
  padding-top: 0.15rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
}

.run-action strong {
  display: block;
  margin: 0 0 0.25rem;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.35;
}

.run-action p {
  max-width: 72ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.run-owner {
  padding-top: 0.15rem;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.45;
}

.run-tool {
  padding-top: 0.15rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.run-note {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: right;
}

@media (max-width: 720px) {
  .run-head {
    display: none;
  }

  .run-row {
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.35rem 0.8rem;
    padding: 0.95rem 0;
  }

  .run-num {
    grid-column: 1;
    grid-row: 1;
    padding-top: 0.1rem;
  }

  .run-action {
    grid-column: 2;
    grid-row: 1;
  }

  .run-owner {
    grid-column: 2;
    grid-row: 2;
    padding-top: 0.3rem;
    color: var(--muted);
    font-size: 0.78rem;
  }

  .run-tool {
    grid-column: 2;
    grid-row: 3;
    padding-top: 0;
    font-size: 0.75rem;
  }

  .run-note {
    text-align: left;
  }
}

/* Run sheet: left heading, right steps, compact owner/tool metadata. */
.run-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 0.34fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 5vw, 6rem);
  align-items: start;
}

.run-aside {
  position: sticky;
  top: calc(var(--header-h) + 2rem);
}

.run-aside .section-title {
  margin: 0;
  font-size: clamp(2rem, 2.7vw, 2.55rem);
  line-height: 1.08;
}

.run-aside .section-intro {
  max-width: 30ch;
  margin: 1rem 0 0;
  font-size: 0.9rem;
  line-height: 1.65;
}

.run-main {
  min-width: 0;
}

.run-table {
  margin-top: 0;
}

.run-head,
.run-row {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) 11rem;
  gap: 1.15rem;
  align-items: start;
}

.run-head {
  padding: 0 0 0.6rem;
}

.run-row {
  padding: 1.05rem 0;
}

.run-meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding-top: 0.1rem;
}

.run-owner {
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.4;
}

.run-tool {
  display: inline-block;
  max-width: 100%;
  padding: 0.22rem 0.42rem;
  border: 1px solid #e3e9f2;
  border-radius: 4px;
  background: #f7faff;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.run-note {
  margin-top: 1.1rem;
  text-align: left;
}

@media (max-width: 960px) {
  .run-layout {
    display: block;
  }

  .run-aside {
    position: static;
  }

  .run-aside .section-intro {
    max-width: 60ch;
    margin-bottom: 1.8rem;
  }
}

@media (max-width: 720px) {
  .run-row {
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.35rem 0.8rem;
  }

  .run-meta {
    grid-column: 2;
    grid-row: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding-top: 0.35rem;
  }

  .run-tool {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .run-head {
    display: none;
  }
}
