/* Small supplemental rules; layout/typography is mostly Tailwind utility classes in index.html */

html { scroll-behavior: smooth; }

/* MathJax output must never be case-transformed by surrounding styles (e.g. uppercase table headers) */
mjx-container, mjx-container * { text-transform: none !important; }

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* Condition selector pill buttons */
.cond-btn {
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.cond-btn[aria-pressed="true"] {
  background-color: #111827;
  color: #fff;
  border-color: #111827;
}

/* Filmstrip */
.filmstrip-frame {
  transition: opacity .15s ease;
}

/* Diagram nodes */
.diagram-node {
  border: 1px solid #d4d4d8;
  background: #fff;
}
.diagram-arrow {
  color: #a3a3a3;
}

/* Table styling for reproduced paper results */
.paper-table th, .paper-table td {
  border-bottom: 1px solid #e5e5e5;
  padding: .5rem .75rem;
  text-align: right;
  white-space: nowrap;
}
.paper-table th:first-child, .paper-table td:first-child,
.paper-table th:nth-child(2), .paper-table td:nth-child(2) {
  text-align: left;
}
.paper-table thead th {
  font-weight: 600;
  color: #52525b;
  font-size: .78rem;
}
.paper-table tbody tr:hover { background: #fafafa; }

/* ============================ Interactive pipeline / loss explorer ============================ */
.pl-flow {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  overflow-x: auto;
  padding: .25rem .25rem 1rem;
}
.pl-col { display: flex; flex-direction: column; justify-content: center; gap: .5rem; min-width: 8.5rem; }
.pl-outcol { min-width: 12rem; }
.pl-arrow { display: flex; align-items: center; color: #c4c4cc; font-size: 1.1rem; flex: 0 0 auto; }
.pl-divider { flex: 0 0 auto; width: 1px; align-self: stretch; background: #e5e5e5; margin: 0 1rem; }
.pl-out-head { font-size: .6rem; text-transform: uppercase; letter-spacing: .05em; color: #9ca3af; font-weight: 600; margin-bottom: .1rem; }

.pl-node {
  border: 1px solid #e5e5e5;
  background: #fff;
  border-radius: .9rem;
  padding: .6rem .7rem;
  transition: opacity .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.pl-title { font-weight: 600; font-size: .8rem; line-height: 1.15; }
.pl-sub { font-size: .68rem; color: #9ca3af; margin-top: .1rem; }
.pl-node.is-active { border-color: #111827; box-shadow: 0 1px 0 #111827; }
.pl-node.is-dim { opacity: .32; }

.pl-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-top: .45rem; }
.pl-block {
  font-size: .58rem; text-align: center; padding: .12rem .1rem;
  border-radius: .35rem; background: #f4f4f5; color: #71717a; border: 1px solid #ececee;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.show-blockzero #node-zc .pl-block[data-block="5"] { /* spotlight one block being zeroed for Δ̂ₖ */
  background: #111827; color: #fff; border-color: #111827; text-decoration: line-through;
}

.pl-out {
  text-align: left; border: 1px solid #d4d4d8; background: #fff; border-radius: .9rem;
  padding: .6rem .75rem; cursor: pointer; display: flex; flex-direction: column; gap: .15rem;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.pl-out:hover { border-color: #111827; }
.pl-out-title { font-weight: 600; font-size: .82rem; }
.pl-out-tag { font-size: .68rem; color: #9ca3af; }
.pl-out.is-active { background: #111827; border-color: #111827; }
.pl-out.is-active .pl-out-title { color: #fff; }
.pl-out.is-active .pl-out-tag { color: #d4d4d8; }

/* detail panel */
.pl-detail-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; }
.pl-detail-title { font-weight: 700; font-size: 1.05rem; }
.pl-formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem; color: #111827; background: #f4f4f5; border: 1px solid #ececee;
  border-radius: .5rem; padding: .3rem .55rem;
}
.pl-plain { margin-top: .6rem; color: #374151; font-size: .92rem; line-height: 1.55; max-width: 46rem; }
.pl-comp-label {
  margin-top: 1.1rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
  color: #9ca3af; font-weight: 600;
}
.pl-comps { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.pl-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .72rem; padding: .2rem .5rem; border-radius: .5rem;
  background: #fff; border: 1px solid #d4d4d8; color: #374151;
}
.pl-losses { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .55rem; margin-top: .5rem; }
.pl-loss { border: 1px solid #e5e5e5; border-left-width: 3px; border-radius: .6rem; padding: .5rem .65rem; background: #fff; }
.pl-loss-h { font-weight: 600; font-size: .8rem; }
.pl-loss-w { font-size: .76rem; color: #52525b; margin-top: .2rem; line-height: 1.45; }
.pl-coef {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .68rem;
  color: #6b7280; background: #f4f4f5; border-radius: .3rem; padding: .02rem .3rem; margin-left: .25rem;
}
/* loss category accents */
.loss-risk   { border-left-color: #111827; }
.loss-pres   { border-left-color: #6366f1; }
.loss-anchor { border-left-color: #0d9488; }
.loss-adv    { border-left-color: #e11d48; }
.loss-proj   { border-left-color: #d97706; }
.loss-route  { border-left-color: #7c3aed; }
.loss-cons   { border-left-color: #059669; }
