/* SAXS Detective: what it adds to ../shared/ui.css (the look shared with the XPCS Beamline Lab). */

.boss.calm {
  border-color: var(--brand);
}
/* The group leader speaks from the left, so that he does not cover the fit results. */
.boss:not(.boss-inline) {
  left: 1rem;
  right: auto;
}
.btn small {
  font-weight: 400;
  font-size: 0.8em;
  opacity: 0.85;
}

/* Desk layout */
.desk {
  display: grid;
  gap: 0.9rem;
  padding: 0.9rem;
  max-width: 1500px;
  margin: 0 auto;
  grid-template-columns: minmax(270px, 0.9fr) minmax(320px, 1.3fr) minmax(260px, 0.9fr);
  grid-template-areas:
    "det plot plot"
    "lab lineup report";
  align-items: start;
}
.d-det {
  grid-area: det;
}
.d-lab {
  grid-area: lab;
}
.d-plot {
  grid-area: plot;
}
.d-lineup {
  grid-area: lineup;
}
.d-report {
  grid-area: report;
}

/* Detector */
.det-msg {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.45rem 0.6rem;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  color: var(--ink);
  font-size: 0.88rem;
  text-align: center;
}
.det-msg[hidden] {
  display: none;
}
.det-wrap.exposing::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 4px solid var(--beam);
  border-radius: 4px;
  animation: exposing 0.5s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes exposing {
  to {
    opacity: 0.25;
  }
}

/* Lab */
.lab-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.lab-actions .btn {
  flex-direction: column;
  gap: 0;
  min-height: 3rem;
  line-height: 1.2;
}
.seg button small {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.8;
}
.seg button {
  line-height: 1.15;
  padding: 0.3rem 0.1rem;
}
.ledger {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 0;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 0.2rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.ledger li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.ledger .warn {
  color: var(--bad);
  font-weight: 600;
}
.ledger .ok {
  color: var(--ok);
  font-weight: 600;
}
.ledger .empty {
  color: var(--ink-soft);
}

/* Plot */
.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.view-tabs [aria-selected="true"] {
  background: var(--brand);
  color: var(--brand-ink);
}
#plot {
  touch-action: none;
  cursor: ew-resize;
}
.range-ctrl {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 0.3rem 0.6rem;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.range-ctrl label {
  font-weight: 600;
  white-space: nowrap;
}
.range-ctrl output {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.range-ctrl input {
  width: 100%;
  min-width: 0;
}
.fit h3 {
  font-family: inherit;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin: 0;
}
.fit .box {
  border-top: 1px solid var(--rule);
  padding-top: 0.45rem;
  display: grid;
  gap: 0.2rem;
  font-variant-numeric: tabular-nums;
}
.fit .box:first-child {
  border-top: 0;
  padding-top: 0;
}
.fit .big {
  font-size: 1.25rem;
  font-weight: 700;
}
.fit .big small {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-soft);
}
.fit .verdict-line {
  font-size: 0.85rem;
}
.fit .good {
  color: var(--ok);
  font-weight: 600;
}
.fit .poor {
  color: var(--bad);
  font-weight: 600;
}
.fit .meh {
  color: var(--warn);
  font-weight: 600;
}
.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.8rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.legend-row i {
  display: inline-block;
  width: 0.9rem;
  height: 0.2rem;
  vertical-align: middle;
  margin-right: 0.25rem;
  border-radius: 1px;
}

/* Line-up */
.lineup {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}
.suspect {
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  padding: 0.35rem 0.2rem 0.45rem;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  min-width: 0;
}
.suspect:hover {
  border-color: var(--brand);
}
.suspect[aria-pressed="true"] {
  border-color: var(--beam);
  box-shadow: inset 0 0 0 1.5px var(--beam);
  background: var(--surface-sunk);
}
.suspect canvas {
  width: 100%;
  max-width: 5.5rem;
  aspect-ratio: 1;
  /* the height strip of a police line-up */
  background: repeating-linear-gradient(to bottom, transparent 0 19%, var(--rule) 19% 20%);
  border-radius: 4px;
}
.suspect b {
  font-size: 0.86rem;
}
.suspect span {
  font-size: 0.7rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.15;
}
.suspect-box {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.45rem;
  font-size: 0.9rem;
}
.suspect-box .fingerprint {
  background: var(--surface-sunk);
  border-left: 4px solid var(--beam);
  padding: 0.45rem 0.6rem;
  border-radius: 0 6px 6px 0;
  margin: 0;
}
.suspect-box .param {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 0.5rem;
  align-items: center;
}
.suspect-box .param label {
  font-weight: 600;
}
.suspect-box .param output {
  font-variant-numeric: tabular-nums;
}
.suspect-box .param input {
  grid-column: 1 / -1;
  width: 100%;
}
.suspect-box .model-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.3rem 0.8rem;
  font-variant-numeric: tabular-nums;
}

/* Report */
.report {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.report .lab-title {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.report output {
  font-weight: 700;
  color: var(--brand);
}
.rg-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
}
.rg-row input {
  width: 5.5rem;
  min-height: 2.25rem;
  padding: 0.2rem 0.5rem;
  border: 1.5px solid var(--brand);
  border-radius: 6px;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
}

/* Cards */
.case-note {
  background: var(--surface-sunk);
  border: 1px dashed var(--rule);
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
  margin: 0.7rem 0;
}
.case-note p {
  margin: 0.25rem 0;
}
.witness {
  margin: 0.35rem 0;
  padding-left: 0.8rem;
  border-left: 3px solid var(--rule);
}
.witness b {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.reveal {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1rem;
  align-items: center;
}
.reveal canvas {
  width: 9rem;
  height: 9rem;
  background: var(--surface-sunk);
  border-radius: 8px;
}
.stamp {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border: 3px double currentColor;
  border-radius: 4px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-4deg);
  font-size: 0.95rem;
}
.stamp.solved {
  color: var(--ok);
}
.stamp.cold {
  color: var(--bad);
}
.guide {
  display: grid;
  gap: 0.6rem;
}
.guide-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.7rem;
  align-items: center;
}
.guide-row canvas {
  width: 4.5rem;
  height: 4.5rem;
  background: var(--surface-sunk);
  border-radius: 6px;
}
.guide-row p {
  margin: 0.1rem 0;
  font-size: 0.92rem;
}
.daily-card {
  border-color: var(--beam);
  border-width: 2px;
}
.score-bars {
  display: grid;
  gap: 0.25rem;
  margin: 0.6rem 0;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.score-bars div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--rule);
}

@media (max-width: 1180px) {
  .desk {
    grid-template-columns: minmax(250px, 0.8fr) minmax(300px, 1.2fr);
    grid-template-areas:
      "det plot"
      "lab plot"
      "lab lineup"
      "report lineup";
  }
  .plot-area {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .desk {
    padding: 0.6rem;
    gap: 0.6rem;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "det"
      "lab"
      "plot"
      "lineup"
      "report";
  }
  .det-wrap {
    max-width: 22rem;
    margin: 0 auto;
  }
  .range-ctrl {
    grid-template-columns: auto 1fr;
  }
  .lineup {
    gap: 0.25rem;
  }
  .suspect {
    padding: 0.25rem 0.1rem 0.35rem;
  }
  .suspect b {
    font-size: 0.72rem;
    text-align: center;
  }
  .suspect span {
    display: none;
  }
  .reveal {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .boss:not(.boss-inline) {
    top: auto;
    bottom: 0.6rem;
    left: 0.6rem;
    right: 0.6rem;
    max-width: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .det-wrap.exposing::after {
    animation: none;
  }
}
