/*
 * Supplementary styles for the UPR proteotoxic stress-resolution page.
 * Loaded after yap-signal-experience.css, which supplies the shared circuit-lab,
 * section, lab, mode and evidence styles. This file adds only the widgets unique
 * to this page: the conventional/proposed model rows, the branch explorer, the
 * toxicant evidence grid, the cell-type decoder, the resolution comparison and
 * the readout columns. Conceptual illustration, not measured data.
 */

/* ---------- Conventional vs proposed model (Fig. 1 top) ---------- */
.upr-models {
  display: grid;
  gap: 0.9rem;
  margin: 1.2rem 0 0.4rem;
}
.upr-model-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(7, 9, 14, 0.4);
}
.upr-model-row.is-proposed {
  border-color: rgba(129, 140, 248, 0.38);
  background: linear-gradient(140deg, rgba(49, 46, 129, 0.24), rgba(7, 9, 14, 0.45));
}
.upr-model-tag {
  color: var(--soft, #b7bec9);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.upr-model-row.is-proposed .upr-model-tag { color: #c4b5fd; }
.upr-model-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.2rem;
}
.upr-model-step {
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  background: rgba(23, 32, 50, 0.5);
  color: #eef4ff;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
}
.is-proposed .upr-model-step {
  border-color: rgba(129, 140, 248, 0.32);
  background: rgba(49, 46, 129, 0.28);
}
.upr-model-arrow {
  color: #94a3b8;
  font-size: 0.95rem;
}
.is-proposed .upr-model-arrow { color: #a5b4fc; }

/* ---------- Branch explorer (Table 1) ---------- */
.upr-branch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}
.upr-branch-btn {
  display: block;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-left: 4px solid var(--br, #67e8f9);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(27, 38, 60, 0.7), rgba(13, 18, 28, 0.9));
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s;
}
.upr-branch-btn:hover { transform: translateY(-2px); }
.upr-branch-btn.is-active {
  border-color: var(--br, #67e8f9);
  box-shadow: 0 0 0 1px var(--br, #67e8f9) inset;
}
.upr-branch-btn strong {
  display: block;
  color: #f1f6ff;
  font-size: 1.05rem;
  font-weight: 700;
}
.upr-branch-btn small {
  display: block;
  margin-top: 0.25rem;
  color: #aab1be;
  font-size: 0.82rem;
  line-height: 1.4;
}
.upr-branch-detail {
  margin-top: 0.9rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-left: 4px solid var(--br, #67e8f9);
  border-radius: 14px;
  background: rgba(10, 14, 22, 0.55);
}
.upr-branch-detail h3 {
  margin: 0 0 0.3rem;
  color: #f1f6ff;
  font-size: 1.15rem;
}
.upr-branch-detail .upr-branch-role {
  margin: 0 0 0.9rem;
  color: var(--soft, #b7bec9);
  font-size: 0.95rem;
  line-height: 1.6;
}
.upr-suboutputs {
  display: grid;
  gap: 0.6rem;
}
.upr-suboutput {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  background: rgba(23, 32, 50, 0.32);
}
.upr-suboutput b {
  color: var(--br, #67e8f9);
  font-size: 0.9rem;
  font-weight: 700;
}
.upr-suboutput span {
  color: #c2c9d4;
  font-size: 0.88rem;
  line-height: 1.5;
}
.upr-branch-immune {
  margin: 0.9rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  color: #c2c9d4;
  font-size: 0.9rem;
  line-height: 1.6;
}
.upr-branch-immune b {
  color: #eef4ff;
  font-weight: 700;
}

/* ---------- Toxicant evidence grid (Table 2) ---------- */
.tox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}
.tox-btn {
  display: block;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(27, 38, 60, 0.7), rgba(13, 18, 28, 0.9));
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s;
}
.tox-btn:hover { transform: translateY(-2px); }
.tox-btn.is-active {
  border-color: rgba(147, 197, 253, 0.6);
  box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.4) inset;
}
.tox-btn strong {
  display: block;
  color: #eef4ff;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
}
.tox-grades {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.55rem;
}
.grade {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.grade::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.grade .grade-label { color: #e9eef6; font-weight: 600; }
.grade-strong { color: #34d399; border: 1px solid rgba(52, 211, 153, 0.4); background: rgba(6, 78, 59, 0.3); }
.grade-moderate { color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.4); background: rgba(120, 53, 15, 0.3); }
.grade-limited { color: #fb923c; border: 1px solid rgba(251, 146, 60, 0.4); background: rgba(124, 45, 18, 0.3); }
.grade-sparse { color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.4); background: rgba(30, 41, 59, 0.4); }
.tox-detail {
  margin-top: 0.9rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  background: rgba(10, 14, 22, 0.55);
}
.tox-detail h3 { margin: 0 0 0.25rem; color: #f1f6ff; font-size: 1.12rem; }
.tox-detail .tox-signature {
  margin: 0 0 0.9rem;
  color: var(--soft, #b7bec9);
  font-size: 0.93rem;
  line-height: 1.6;
}
.tox-evidence { display: grid; gap: 0.55rem; }
.tox-study {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0.55rem 0.8rem;
  align-items: start;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 10px;
  background: rgba(23, 32, 50, 0.3);
}
.tox-study .tox-domain {
  color: #93c5fd;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-top: 0.12rem;
}
.tox-study p { margin: 0; color: #c2c9d4; font-size: 0.86rem; line-height: 1.5; }
.tox-gap {
  margin: 0.9rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  font-size: 0.88rem;
  line-height: 1.6;
}
.tox-gap b { color: #fca5a5; }

/* ---------- Cell-type decoder (Fig. 2) ---------- */
.celltype-detail .ct-branches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0.4rem 0 0.9rem;
}
.ct-branch {
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-top: 3px solid var(--br, #67e8f9);
  border-radius: 10px;
  background: rgba(23, 32, 50, 0.32);
}
.ct-branch.is-faded { opacity: 0.5; }
.ct-branch b { display: block; color: var(--br, #67e8f9); font-size: 0.86rem; font-weight: 700; }
.ct-branch span { display: block; margin-top: 0.25rem; color: #c2c9d4; font-size: 0.84rem; line-height: 1.45; }
.ct-consequence {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(129, 140, 248, 0.3);
  border-radius: 10px;
  background: rgba(49, 46, 129, 0.22);
}
.ct-consequence b {
  color: #c4b5fd;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ct-consequence span { color: #eef4ff; font-size: 0.95rem; font-weight: 600; }

/* ---------- Adaptive vs failed resolution (Fig. 3) ---------- */
.upr-resolve-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}
.upr-resolve-col {
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(10, 14, 22, 0.5);
}
.upr-resolve-col.is-adaptive { border-color: rgba(52, 211, 153, 0.34); background: linear-gradient(150deg, rgba(6, 78, 59, 0.26), rgba(10, 14, 22, 0.5)); }
.upr-resolve-col.is-failed { border-color: rgba(248, 113, 113, 0.34); background: linear-gradient(150deg, rgba(127, 29, 29, 0.24), rgba(10, 14, 22, 0.5)); }
.upr-resolve-col h3 { margin: 0 0 0.2rem; font-size: 1.1rem; }
.upr-resolve-col.is-adaptive h3 { color: #86efac; }
.upr-resolve-col.is-failed h3 { color: #fca5a5; }
.upr-resolve-col > p { margin: 0 0 0.8rem; color: var(--soft, #b7bec9); font-size: 0.9rem; line-height: 1.55; }
.upr-resolve-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.4rem; }
.upr-resolve-list li {
  padding: 0.5rem 0.7rem;
  border-radius: 9px;
  background: rgba(23, 32, 50, 0.4);
  color: #d4dae4;
  font-size: 0.85rem;
  line-height: 1.45;
}
.is-adaptive .upr-resolve-list li { border-left: 3px solid rgba(52, 211, 153, 0.6); }
.is-failed .upr-resolve-list li { border-left: 3px solid rgba(248, 113, 113, 0.6); }

/* ---------- Repeated-exposure recovery simulator ---------- */

/* ---------- Readout columns (Fig. 3 readouts) ---------- */
.readout-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}
.readout-col {
  padding: 1rem 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(10, 14, 22, 0.5);
}
.readout-col h3 {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.readout-col.is-activation { border-top: 3px solid #93c5fd; }
.readout-col.is-activation h3 { color: #93c5fd; }
.readout-col.is-resolution { border-top: 3px solid #86efac; }
.readout-col.is-resolution h3 { color: #86efac; }
.readout-col.is-functional { border-top: 3px solid #fca5a5; }
.readout-col.is-functional h3 { color: #fca5a5; }
.readout-col ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.3rem; }
.readout-col li { color: #d4dae4; font-size: 0.86rem; line-height: 1.4; }

/* ---------- 3D scene ---------- */
.upr-scene-card { overflow: visible; }
.upr-scene {
  position: relative;
  min-height: 460px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 10%, rgba(13, 36, 70, 0.6), rgba(2, 7, 15, 0.85));
  touch-action: pan-y;
}
.upr-scene-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1.5rem;
  color: #8b93a1;
  font-size: 0.92rem;
  text-align: center;
}
.upr-scene.is-ready .upr-scene-fallback { display: none; }
.upr-scene-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.9s ease;
  touch-action: pan-y;
}
.upr-scene.is-ready .upr-scene-canvas { opacity: 1; }
.upr-scene.is-dragging .upr-scene-canvas { cursor: grabbing; }
.upr-scene-tag {
  position: absolute;
  top: 0.7rem;
  left: 0.85rem;
  z-index: 2;
  color: #93c5fd;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}
.upr-scene-labels { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.upr-scene-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--lc, rgba(147, 197, 253, 0.4));
  border-radius: 999px;
  background: rgba(4, 10, 22, 0.72);
  color: #e8f1ff;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
  will-change: transform;
}
.upr-scene-label[hidden] { display: none; }
.upr-scene.is-narrow .upr-scene-labels { display: none; }

.upr-scene-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.8rem;
}
.upr-view-toggle, .upr-phase-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.upr-view-toggle button, .upr-phase-row button {
  min-height: 34px;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(8, 15, 30, 0.7);
  color: #d4dae4;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.upr-view-toggle button:hover, .upr-phase-row button:hover { border-color: rgba(147, 197, 253, 0.6); }
.upr-view-toggle button.is-active { border-color: #67e8f9; color: #ecfeff; background: rgba(8, 145, 178, 0.28); }
.upr-phase-row button.is-active { border-color: #a5b4fc; color: #f1f5ff; background: rgba(79, 70, 229, 0.28); }
.upr-view-toggle button:focus-visible, .upr-phase-row button:focus-visible { outline: 2px solid #67e8f9; outline-offset: 2px; }

.upr-scene-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0.7rem 0 0 !important;
  color: #9aa2b1;
  font-size: 0.8rem;
}
.upr-scene-caption span[class^="l-"] {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0.25rem;
  border-radius: 50%;
  vertical-align: -1px;
}
.upr-scene-caption .l-tox { background: #cbd5e1; }
.upr-scene-caption .l-ire { background: #f87171; }
.upr-scene-caption .l-perk { background: #a5b4fc; }
.upr-scene-caption .l-atf6 { background: #86efac; }
.upr-scene-caption .l-mis { background: #fbbf24; }

@media (max-width: 599.98px) {
  .upr-scene { min-height: 360px; }
  .upr-scene-controls { gap: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .upr-scene-canvas { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .upr-branch-grid,
  .tox-grid,
  .celltype-detail .ct-branches,
  .readout-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upr-resolve-compare { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .upr-model-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .upr-branch-grid,
  .tox-grid,
  .celltype-detail .ct-branches,
  .readout-cols { grid-template-columns: 1fr; }
  .upr-suboutput { grid-template-columns: 1fr; gap: 0.25rem; }
  .tox-study { grid-template-columns: 1fr; gap: 0.2rem; }
}
