/* extra.css: loaded after project.css; the palette comes from theme.css. Parts: page-wide touches (tables), the abstract, the
   four-ways tiles and chart, the stain lab's row, the clinic's layout (the two model cards side by side), and the clinic's guided tour (tour.js). */

/* ---- page-wide: a number and its interval stay on one line on wider screens --------------------------------- */
@media (min-width: 768px) {
  .card-body table td { white-space: nowrap; }
}
@media (max-width: 767.98px) {                          /* on a phone a wide table scrolls sideways inside its card */
  .card-body table { display: block; max-width: 100%; overflow-x: auto; }
}

/* the abstract: each part under its own small heading, as in a journal's structured abstract */
.abstract .abstract-label {
  display: block; margin-bottom: .2rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--navy);
}
.abstract p { margin-bottom: 1.1rem; }
.abstract .abstract-keywords { font-size: .88rem; color: #495057; margin-bottom: 0; }

/* the retired apology at the top of the page, kept visible but struck out */
.glance-update s { color: #6c757d; text-decoration-thickness: 2px; text-decoration-color: rgba(138, 59, 52, .7); }

/* ---- the stain lab: the patch and the two models in one row when there is room ------------------------------- */
[data-widget="stain-lab"] .lab-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

/* ---- four ways to count one: the split tiles and the chart ---------------------------------------------------- */
.split-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: .75rem; margin: .75rem 0 .4rem; }
.split-tile {
  margin: 0; padding: .7rem .75rem .6rem; border: 1px solid var(--line); border-radius: .5rem; background: #fff;
  display: flex; flex-direction: column; transition: box-shadow .2s ease, transform .2s ease;
}
.split-tile:hover { box-shadow: 0 .4rem 1rem rgba(23, 41, 63, .1); transform: translateY(-2px); }
.split-tile .split-name {
  order: -1; padding: 0 0 .4rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--navy);
}
.split-diagram { width: 100%; height: auto; border: 0 !important; background: transparent !important; }
.split-diagram .hosp { fill: #f4f6f8; stroke: #c7cbd1; }
.split-diagram .hosp-test { fill: #f7ebe9; stroke: var(--brick); stroke-width: 1.5; }
.split-diagram .slide { fill: #fff; stroke: #d5dae1; }
.split-diagram .cell { fill: #9fb3c8; }
.split-diagram .cell.test { fill: var(--brick); }
.split-diagram .patient-link { fill: none; stroke: #6c757d; stroke-width: 1.2; }
.split-diagram .hosp-label { font-size: 7px; fill: #6c757d; text-anchor: middle; }
.split-tile:hover .cell.test { animation: split-blink 1.2s ease-in-out infinite; }
@keyframes split-blink { 50% { opacity: .45; } }
.split-tile .split-text { font-size: .8rem; line-height: 1.4; color: #343a40; margin: .45rem 0 .5rem; flex: 1; }
.split-tile .split-score { margin: 0; font-size: .72rem; color: #6c757d; }
.split-tile .split-score span { display: block; font-size: 1.35rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.1; }
.split-legend { font-size: .78rem; color: #495057; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .4rem; }
.split-legend .sw { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; vertical-align: -1px; }
.split-legend .sw-train { background: #9fb3c8; }
.split-legend .sw-test { background: var(--brick); margin-left: .5rem; }
.split-legend .sw-patient { width: 1.1rem; height: .45rem; border: 1.5px solid #6c757d; border-top: 0; border-radius: 0; margin-left: .5rem; }
.split-legend .split-note { color: #6c757d; flex-basis: 100%; }

[data-widget="levels"] svg { display: block; width: 100%; max-width: 680px; height: auto; border: 0; background: transparent; }
[data-widget="levels"] svg .mark circle { transition: r .15s ease; }
[data-widget="levels"] svg .mark:hover circle { r: 8; }
@media (prefers-reduced-motion: reduce) { .split-tile, .split-tile:hover { transition: none; transform: none; } .split-tile:hover .cell.test { animation: none; } }

/* ---- the two model cards ------------------------------------------------------------------------------------- */
[data-widget="clinic"] .cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem; align-items: start; margin-bottom: .5rem;
}
[data-widget="clinic"] .cards > .card {
  padding: .75rem .85rem .6rem; border-radius: .45rem;
  transition: box-shadow .3s ease, border-color .3s ease;
}
[data-widget="clinic"] .cards > .card:hover { box-shadow: 0 .35rem 1rem rgba(23, 41, 63, .08); }
[data-widget="clinic"] .cards h3 {
  font-size: .95rem; font-weight: 600; letter-spacing: .01em; color: var(--navy); margin: 0 0 .55rem;
}
[data-widget="clinic"] .cards canvas {
  display: block; width: 100%; max-width: 320px; height: auto; aspect-ratio: 1;
  image-rendering: pixelated; border-radius: .2rem; cursor: crosshair;
  touch-action: none;                                   /* a finger drags the mark instead of scrolling the page */
}
[data-widget="clinic"] .cards canvas:focus-visible { outline: 3px solid #7fb0e6; outline-offset: 2px; }
[data-widget="clinic"] .cards .verdict {
  font-weight: 600; font-size: .9rem; margin: .6rem 0 .35rem; padding: .15rem .35rem; margin-left: -.35rem;
  border-radius: .25rem;
}
[data-widget="clinic"] .cards .bars { list-style: none; padding: 0; margin: 0 0 .45rem; font-size: .78rem; }
[data-widget="clinic"] .cards .bars li {
  display: grid; grid-template-columns: minmax(0, 1fr) 4.5rem 2.4rem; gap: .5rem; align-items: center; line-height: 1.45;
}
[data-widget="clinic"] .cards .bars li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-widget="clinic"] .cards .bars li:first-child { font-weight: 600; }
[data-widget="clinic"] .cards .bars meter { width: 100%; height: .55rem; }
[data-widget="clinic"] .cards .bars li > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
[data-widget="clinic"] .cards .footer { font-size: .72rem; color: #6c757d; margin: 0; }
[data-widget="clinic"] .status { font-size: .8rem; color: #6c757d; min-height: 1.2em; }

/* ---- the tour's start button --------------------------------------------------------------------------------- */
[data-widget] .tour-start {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .35rem 1rem .35rem .35rem; border-radius: 999px;
  color: #fff; background: var(--navy); border-color: var(--navy-deep);
  font-weight: 600; box-shadow: 0 .3rem .9rem rgba(31, 58, 92, .25);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
[data-widget] .tour-start:hover { background: var(--navy-deep); transform: translateY(-1px); box-shadow: 0 .45rem 1.2rem rgba(31, 58, 92, .32); }
[data-widget] .tour-start:active { transform: translateY(0); }
[data-widget] .tour-start .play {
  display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: #fff; color: var(--navy); font-size: .7rem; padding-left: .12rem;
  animation: tour-beckon 2.8s ease-out infinite;
}
[data-widget] .tour-start .sub { font-weight: 400; opacity: .75; font-size: .8rem; }
[data-widget] .tour-start:disabled { transform: none; box-shadow: none; }
[data-widget] .tour-start:disabled .play { animation: none; }
@keyframes tour-beckon {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); }
  60%, 100% { box-shadow: 0 0 0 .6rem rgba(255, 255, 255, 0); }
}

/* While the tour runs, the widget is driven by it, not by the pointer. */
[data-touring] .picker, [data-touring] .overlay-toggle, [data-touring] .cards { pointer-events: none; }

/* ---- the stage: spotlight, pointer and pinned labels, all in page coordinates -------------------------------- */
.tour-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 1070; pointer-events: none; }

.tour-shade {
  position: absolute; left: 0; top: 0; border-radius: 12px;
  box-shadow: 0 0 0 200vmax rgba(14, 24, 38, .5);
  opacity: 0; transition: opacity .5s ease; will-change: transform, width, height;
}
.tour-shade.in { opacity: 1; }
.tour-shade::after {
  content: ""; position: absolute; inset: -2px; border-radius: inherit;
  border: 2px solid rgba(143, 190, 240, .95);
  box-shadow: 0 0 0 4px rgba(143, 190, 240, .22), 0 0 26px rgba(143, 190, 240, .45);
  animation: tour-breathe 2.6s ease-in-out infinite;
}
@keyframes tour-breathe { 50% { box-shadow: 0 0 0 8px rgba(143, 190, 240, .08), 0 0 34px rgba(143, 190, 240, .28); } }

.tour-cursor {
  position: absolute; left: -4px; top: -3px; width: 26px; height: 26px;
  opacity: 0; transition: opacity .35s ease; will-change: transform;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
}
.tour-cursor.in { opacity: 1; }
.tour-cursor svg { display: block; transform-origin: 4px 3px; transition: transform .12s ease; }
.tour-cursor.press svg { transform: scale(.8); }
.tour-ripple {
  position: absolute; left: 4px; top: 3px; width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border-radius: 50%; border: 2px solid #8fbef0; background: rgba(143, 190, 240, .18); opacity: 0;
}
.tour-cursor.click .tour-ripple { animation: tour-ripple .5s ease-out; }
@keyframes tour-ripple { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }

.tour-pin { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .25s ease; will-change: transform; }
.tour-pin.in { opacity: 1; }
.tour-pin > span {
  position: relative; display: inline-block; white-space: nowrap;
  padding: .28rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 600; line-height: 1.3;
  color: #fff; background: var(--navy); box-shadow: 0 .35rem 1rem rgba(10, 20, 35, .35), 0 0 0 2px rgba(255, 255, 255, .9);
  transform: scale(.55); transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
}
.tour-pin.in > span { transform: none; }
.tour-pin.hot > span { background: var(--brick); }
.tour-pin > span::after {                                /* a small pointer toward the target */
  content: ""; position: absolute; width: 8px; height: 8px; background: inherit; transform: rotate(45deg);
}
.tour-pin[data-side="above"] > span::after { left: calc(50% - 4px); bottom: -4px; }
.tour-pin[data-side="below"] > span::after { left: calc(50% - 4px); top: -4px; }
.tour-pin[data-side="right"] > span::after { left: -4px; top: calc(50% - 4px); }
.tour-pin[data-side="left"] > span::after { right: -4px; top: calc(50% - 4px); }
.tour-pin[data-side="over"] > span::after { display: none; }

/* ---- the caption bar --------------------------------------------------------------------------------------- */
.tour-caption {
  position: fixed; left: 50%; bottom: 16px; z-index: 1080; width: min(40rem, calc(100vw - 32px));
  padding: .8rem 1rem .75rem; overflow: hidden;
  color: #1c1e21; background: #fff; border-radius: .8rem;
  box-shadow: 0 1.2rem 3rem rgba(10, 20, 35, .35), 0 0 0 1px rgba(31, 58, 92, .16);
  opacity: 0; transform: translate(-50%, 1.5rem) scale(.98);
  transition: opacity .35s ease, transform .5s cubic-bezier(.2, .8, .2, 1);
}
.tour-caption.in { opacity: 1; transform: translate(-50%, 0); }
.tour-top { display: flex; align-items: center; gap: .7rem; font-size: .7rem; color: #6c757d; letter-spacing: .06em; text-transform: uppercase; }
.tour-dots { display: flex; gap: .3rem; list-style: none; margin: 0; padding: 0; }
.tour-dots li { width: .5rem; height: .5rem; border-radius: 999px; background: #d5dae1; transition: width .4s ease, background .4s ease; }
.tour-dots li.done { background: #8fa6c2; }
.tour-dots li.now { width: 1.5rem; background: var(--navy); }
.tour-title { font-size: 1.05rem; font-weight: 650; color: var(--navy); margin: .4rem 0 .25rem; }
.tour-copy {
  font-size: .92rem; line-height: 1.5; margin: 0; overflow: hidden;
  transition: height .3s ease, opacity .17s ease, transform .17s ease;
}
.tour-copy.swap { opacity: 0; transform: translateY(4px); }

.tour-chip { margin-top: .6rem; display: grid; gap: .3rem; font-size: .82rem; animation: tour-rise .35s ease; }
.tour-chip > div {
  display: grid; grid-template-columns: 5.2rem minmax(0, 1fr) 1.2rem minmax(0, 1fr); align-items: center; gap: .4rem;
  padding: .3rem .55rem; border-radius: .4rem; background: #f1f3f6;
}
.tour-chip .who { font-weight: 600; color: var(--navy); }
.tour-chip .from { color: #6c757d; }
.tour-chip .arrow { text-align: center; color: #6c757d; }
.tour-chip .moved { background: #f7ebe9; }
.tour-chip .moved .to { color: var(--brick); font-weight: 600; }
.tour-chip .moved .arrow { color: var(--brick); }
.tour-chip .live { grid-template-columns: 7.5rem minmax(0, 1fr); font-variant-numeric: tabular-nums; }
.tour-chip .meter { height: .5rem; border-radius: 999px; background: #dde3ea; overflow: hidden; }
.tour-chip .meter i {
  display: block; height: 100%; width: 0; border-radius: inherit; transition: width .25s ease-out;
  background: linear-gradient(90deg, #3d6ba3, #7fb0e6, #3d6ba3); background-size: 200% 100%; animation: pl-flow 1s linear infinite;
}
@keyframes tour-rise { from { opacity: 0; transform: translateY(6px); } }

.tour-foot { display: flex; align-items: center; gap: .4rem; margin-top: .7rem; }
.tour-gap { flex: 1; }
.tour-foot .btn-link { color: #6c757d; text-decoration: none; }
.tour-foot .btn-link:hover { color: var(--brick); }
.tour-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #eef1f5; }
.tour-timer i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3d6ba3, #7fb0e6); transition: width .12s linear; }
.tour-caption.paused .tour-timer i { background: #c7cbd1; }
.tour-caption.paused .tour-dots li.now { animation: tour-blink 1.2s ease-in-out infinite; }
@keyframes tour-blink { 50% { opacity: .35; } }

/* the verdict that changed when the ring went down */
[data-widget="clinic"] .verdict.tour-flash { animation: tour-flash 2.4s ease-out; }
@keyframes tour-flash {
  0%, 30% { background: rgba(138, 59, 52, .18); color: var(--brick); }
  100% { background: transparent; }
}

@media (max-width: 575.98px) {
  .tour-caption { bottom: 8px; width: calc(100vw - 16px); padding: .65rem .8rem .65rem; }
  .tour-copy { font-size: .86rem; }
  .tour-chip > div { grid-template-columns: 4.2rem minmax(0, 1fr) 1rem minmax(0, 1fr); font-size: .76rem; }
  .tour-pin > span { font-size: .72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-shade::after, [data-widget] .tour-start .play, .tour-chip, .tour-chip .meter i,
  .verdict.tour-flash, .tour-caption.paused .tour-dots li.now { animation: none; }
  .tour-caption { transition: opacity .2s; transform: translate(-50%, 0); }
  .tour-copy, .tour-pin > span, .tour-dots li { transition: none; }
  .tour-pin > span { transform: none; }
}
