/* Interactive pieces for reveal decks: the bedside monitor, findings board and
   branch choices. Sizes are in slide pixels (the deck is 1200 × 800 and reveal
   scales it to the screen). */

/* ---------- layout: slide with a monitor ---------- */

.reveal .monitor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 590px;
  column-gap: 28px;
  align-items: start;
}
.reveal .monitor-main > :first-child {
  margin-top: 0;
}

/* ---------- monitor: device ---------- */

.reveal .vitals-monitor {
  --mon-green: #3cf06e;
  --mon-cyan: #35d8f0;
  --mon-red: #ff4b4b;
  --mon-yellow: #f5d742;
  --mon-white: #f2f2f2;
  --mon-dim: #8c96a3;
  background: linear-gradient(#f4f5f7, #dfe2e7);
  border: 7px solid #2f80c9;
  border-radius: 22px;
  padding: 14px 14px 10px;
  box-shadow:
    0 10px 26px rgba(21, 32, 59, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  font-family: "Helvetica Neue", Arial, sans-serif;
  line-height: 1;
  user-select: none;
}
.reveal .vitals-fallback {
  display: none;
}
.reveal .vitals-monitor.static .vitals-fallback,
.reveal .vitals-monitor:not(.ready) .vitals-fallback {
  display: block;
  color: var(--darkgray);
  font-size: 0.6em;
  margin: 0;
}
.reveal .vitals-monitor.ready .vitals-fallback {
  display: none;
}

.mon-screen {
  position: relative;
  background: #050607;
  border: 3px solid #3a3f47;
  border-radius: 5px;
  height: 372px;
  display: grid;
  grid-template-rows: 92px 1fr 32px;
  overflow: hidden;
  color: var(--mon-white);
}
.mon-softkeys {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 10px 22px 0;
}
.mon-softkeys span {
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(#fbfbfc, #e3e6ea);
  border: 1px solid #c3c8cf;
}

/* ---------- monitor: screen ---------- */

.mon-top {
  display: grid;
  grid-template-columns: 130px 1fr 230px;
  border-bottom: 1px solid #5a6069;
}
.mon-tile {
  position: relative;
  padding: 6px 10px;
  border-right: 1px solid #5a6069;
  overflow: hidden;
}
.mon-top .mon-tile:last-child {
  border-right: none;
}
.mon-label {
  font-size: 17px;
  font-weight: 500;
}
.mon-unit {
  font-size: 11px;
  margin-left: 5px;
}
.mon-value {
  font-variant-numeric: tabular-nums;
}

.mon-spo2 {
  color: var(--mon-cyan);
}
.mon-spo2 .mon-value {
  font-size: 40px;
  margin-top: 8px;
}

.mon-hr {
  color: var(--mon-green);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.mon-hr .mon-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mon-lead {
  font-size: 15px;
}
.mon-heart {
  font-size: 15px;
  opacity: 0.15;
  transition: opacity 0.06s;
}
.mon-heart.beat {
  opacity: 1;
}
.mon-hr .mon-value {
  font-size: 70px;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.mon-status {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
}
.mon-patient {
  font-size: 14px;
  color: var(--mon-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.mon-alarm {
  min-height: 24px;
  padding: 4px 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 3px;
  color: transparent;
}
.mon-alarm.on {
  color: #fff;
  background: #c8102e;
  animation: mon-flash 1s steps(2, start) infinite;
}
.mon-sound {
  font-size: 11px;
  color: var(--mon-dim);
}

.mon-body {
  display: grid;
  grid-template-columns: 130px 1fr;
  min-height: 0;
}
.mon-side {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #5a6069;
  min-height: 0;
}
.mon-side .mon-tile {
  border-right: none;
  border-bottom: 1px solid #5a6069;
}

.mon-nibp {
  color: var(--mon-white);
  cursor: pointer;
}
.mon-nibp:hover {
  background: #11161c;
}
.static .mon-nibp {
  cursor: default;
}
.mon-stack {
  font-size: 22px;
  line-height: 1.12;
  text-align: center;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.mon-time {
  font-size: 10px;
  color: var(--mon-dim);
  text-align: right;
  min-height: 11px;
}

.mon-art {
  display: none;
  color: var(--mon-red);
}
.has-art .mon-art {
  display: block;
}
.mon-art .mon-row {
  margin-top: 2px;
}
.mon-art .mon-value {
  font-size: 20px;
}
.mon-art .mon-map {
  font-size: 15px;
}
/* with an arterial line there's less room in the side column */
.has-art .mon-stack {
  font-size: 19px;
  line-height: 1.05;
}

.mon-resp {
  color: var(--mon-yellow);
}
.mon-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.mon-row .mon-value {
  font-size: 24px;
}
.mon-co2 {
  display: none;
}
.has-co2 .mon-co2 {
  display: flex;
}
.mon-rr .mon-label {
  font-size: 14px;
}
.mon-temp {
  display: none;
  color: var(--mon-white);
}
.has-temp .mon-temp {
  display: block;
}
.mon-temp .mon-label {
  font-size: 13px;
}
.mon-temp .mon-value {
  font-size: 20px;
}
.mon-clock {
  margin-top: auto;
  padding: 6px 10px;
  font-size: 19px;
  text-align: center;
  color: var(--mon-white);
  font-variant-numeric: tabular-nums;
}

.mon-waves {
  position: relative;
  min-height: 0;
}
.mon-waves canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.mon-wave-label {
  position: absolute;
  left: 6px;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  white-space: pre;
}

.mon-bottom {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: center;
  border-top: 1px solid #5a6069;
  font-size: 12px;
  line-height: 1.1;
  color: #e6e9ec;
  text-align: center;
}
.mon-bottom span + span {
  border-left: 1px solid #5a6069;
}

/* ---------- monitor: 12-lead capture ---------- */

.mon-12lead {
  position: absolute;
  top: 92px;
  bottom: 32px;
  left: 0;
  right: 0;
  display: none;
  grid-template-rows: 22px 1fr;
  background: #050607;
}
.show-12 .mon-12lead {
  display: grid;
}
.mon-12-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mon-green);
  border-bottom: 1px solid #2c323a;
}
.mon-12-head [data-v] {
  font-weight: 400;
  color: #e6e9ec;
}
.mon-12-progress {
  align-self: center;
  margin: 0 40px;
  height: 6px;
  background: #1b2a20;
  border-radius: 3px;
  overflow: hidden;
}
.mon-12-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--mon-green);
}
.show-12 .mon-12-progress span {
  width: 100%;
  transition: width 3s linear;
}

/* ---------- 12-lead printout over the slide ---------- */

.reveal .ecg-printout {
  position: absolute;
  inset: 0 0 24px;
  z-index: 20;
  display: none;
  grid-template-rows: auto 1fr;
  background: #fff7f7;
  border: 1px solid #e3b5bb;
  border-radius: 4px;
  box-shadow: 0 14px 40px rgba(21, 32, 59, 0.3);
  cursor: pointer;
  font-family: "Helvetica Neue", Arial, sans-serif;
}
.reveal .ecg-printout.open {
  display: grid;
  animation: ecg-print 0.6s ease-out;
}
.reveal .ecg-head {
  display: flex;
  gap: 24px;
  align-items: baseline;
  padding: 10px 16px;
  font-size: 18px;
  color: #222;
  border-bottom: 1px solid #e3b5bb;
}
.reveal .ecg-close {
  margin-left: auto;
  font-size: 13px;
  color: #888;
}
.reveal .ecg-printout canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
}
@keyframes ecg-print {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* a value outside its alarm limits: inverted and flashing, like the real thing */
.mon-tile.alarm .mon-value,
.mon-tile.alarm .mon-stack {
  animation: mon-invert 1s steps(2, start) infinite;
  border-radius: 3px;
}
@keyframes mon-invert {
  0% {
    background: transparent;
  }
  100% {
    background: #c8102e;
    color: #fff;
  }
}
@keyframes mon-flash {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.35;
  }
}

/* ---------- findings board ---------- */

.reveal .findings {
  margin: 0.2em 0 0.6em;
}
.reveal .findings-title {
  font-size: 0.8em;
  color: var(--gray);
  margin-bottom: 0.4em;
}
.reveal .findings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.reveal .monitor-main .findings-grid {
  gap: 8px;
}
.reveal .finding {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 70px;
  padding: 9px 12px;
  border: 1px solid var(--lightgray);
  border-left: 4px solid var(--secondary);
  border-radius: 6px;
  background: var(--highlight);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}
.reveal .finding {
  position: relative;
}
/* the key that turns this tile over */
.reveal .finding::after {
  content: attr(data-key);
  position: absolute;
  top: 7px;
  right: 10px;
  font-size: 0.5em;
  color: var(--gray);
}
.reveal .finding:hover {
  border-color: var(--secondary);
}
.reveal .finding-label {
  font-size: 0.62em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--secondary);
}
.reveal .finding-value {
  font-size: 0.72em;
  line-height: 1.3;
  color: var(--dark);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}
.reveal .finding:not(.revealed) .finding-value::after {
  content: "";
}
.reveal .finding.revealed {
  background: var(--light);
  border-left-color: var(--tertiary);
}
.reveal .finding.revealed .finding-value {
  opacity: 1;
  transform: none;
}
/* the overview grid and PDF show the answers */
.reveal.overview .finding-value,
.print-pdf .reveal .finding-value {
  opacity: 1;
  transform: none;
}

/* ---------- branch choices ---------- */

.reveal .choices {
  margin: 0.4em 0 0.6em;
  counter-reset: choice;
}
.reveal .choices-title {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.5em;
}
.reveal .choices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.reveal a.choice {
  counter-increment: choice;
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.55em 0.8em;
  border: 2px solid var(--lightgray);
  border-radius: 8px;
  background: var(--light);
  color: var(--darkgray);
  font-size: 0.8em;
  line-height: 1.3;
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}
.reveal a.choice::before {
  content: counter(choice, upper-alpha);
  flex: none;
  display: grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--light);
  font-weight: 700;
  font-size: 0.9em;
}
.reveal a.choice:hover {
  border-color: var(--secondary);
  background: var(--highlight);
  text-decoration: none;
  color: var(--dark);
}

/* ---------- branch navigation ---------- */

.reveal .branch-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1em;
}
.reveal .branch-nav a {
  padding: 0.35em 0.9em;
  border: 2px solid var(--secondary);
  border-radius: 8px;
  font-size: 0.75em;
  text-decoration: none;
}
.reveal .branch-nav a:hover {
  background: var(--highlight);
  text-decoration: none;
}
.reveal .branch-nav a.branch-back {
  border-color: var(--lightgray);
  color: var(--gray);
}
