/* A full-window scene with a thin layer of HTML over it. */

:root {
  --paper: #eee5cd;
  --ink: #27231f;
  --amber: #ffb238;
  --ui: "Segoe UI", system-ui, sans-serif;
  --mono: "Courier New", Courier, monospace;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #d9d3c7; /* matches the scene's wall colour while it loads */
  font: 15px/1.45 var(--ui);
  color: var(--ink);
}

#view {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

[hidden] {
  display: none !important;
}

/* Lens vignette: darkens the corners so the eye stays on the bench. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 75% at 50% 48%, transparent 60%, rgba(24, 14, 4, .3) 100%);
}

/* Aim ---------------------------------------------------------------------- */

.reticle {
  position: fixed;
  z-index: 2;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .85);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .55);
  pointer-events: none;
  transition: width .12s, height .12s, margin .12s, background-color .12s;
}

/* Something operable is under the dot: it opens into a ring. */
.reticle[data-state="target"],
.reticle[data-state="holding"] {
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  background: transparent;
  box-shadow: 0 0 0 2px var(--amber), 0 0 0 3px rgba(0, 0, 0, .5), 0 0 10px 2px rgba(255, 150, 20, .6);
}

.reticle[data-state="holding"] {
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  background: var(--amber);
}

.hint {
  position: fixed;
  z-index: 2;
  top: calc(50% + 34px);
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: .02em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9), 0 0 6px rgba(0, 0, 0, .6);
  pointer-events: none;
}

/* Start / pause ------------------------------------------------------------- */

.start--arrival { background: linear-gradient(0deg,rgba(15,20,15,.65),transparent 70%) !important; backdrop-filter:none !important; align-items:end !important; }
.start--arrival .start__card { margin-bottom:6vh; width:min(380px,90vw); }
.start--arrival .keys, .start--arrival .operator, .start--arrival .comfort { display:none; }
.arrival-controls { font:12px var(--mono); color:#5b6055; }
.start:not(.start--arrival) .arrival-controls { display:none; }
.terminal-input { position:fixed;left:-10000px;width:1px;height:1px;opacity:0; }
.intercom-caption { position:fixed;z-index:3;bottom:6vh;left:50%;transform:translateX(-50%);width:min(570px,calc(100vw - 70px));padding:16px 22px;background:rgba(20,29,23,.94);color:#ecebdc;border-left:3px solid #c8a35d;box-shadow:0 3px 18px #0003;pointer-events:none; }
.intercom-caption__source { color:#c8b681;font:11px var(--mono);letter-spacing:.13em; }
.intercom-caption p { margin:7px 0 0;font-size:16px;line-height:1.5; }

.start {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 16, 10, .45);
  backdrop-filter: blur(3px);
  /* In a short window the card is taller than the room for it: it scrolls, from its top. */
  overflow-y: auto;
}

.start__card {
  /* Centred by its margins, which give way when there is no room; centring by alignment would put its top out of reach. */
  margin: auto;
  width: min(460px, 100%);
  padding: 26px 28px 22px;
  background: var(--paper);
  /* A clipped corner and a row of punched holes: it is a card, after all. */
  clip-path: polygon(0 0, calc(100% - 34px) 0, 100% 34px, 100% 100%, 0 100%);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  background-image: radial-gradient(circle, rgba(39, 35, 31, .28) 2.6px, transparent 3px);
  background-size: 18px 12px;
  background-repeat: repeat-x;
  background-position: 9px calc(100% - 9px);
  padding-bottom: 36px;
}

.start__card h1 {
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: -.01em;
}

.start__lede {
  margin: 0 0 16px;
}

.keys {
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 700;
}

.keys div {
  display: grid;
  grid-template-columns: 5.2em 1fr;
  gap: 10px;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(39, 35, 31, .25);
}

.keys dt {
  color: #8b2b20;
}

.keys dd {
  margin: 0;
}

/* The few settings kept on the pause card (the rest are on the console in the room). */

.comfort {
  margin: 0 0 18px;
  padding: 8px 12px 10px;
  border: 1px dashed rgba(39, 35, 31, .35);
  border-radius: 6px;
  font-size: 13.5px;
}

.comfort legend {
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #8b2b20;
}

.comfort__level {
  display: grid;
  grid-template-columns: 6.2em 1fr 2.4em;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
}

.comfort__level input {
  width: 100%;
  margin: 0;
  accent-color: #2f6fca;
}

.comfort__level output {
  font-family: var(--mono);
  font-weight: 700;
  text-align: right;
}

.comfort__switches {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding-top: 6px;
}

.comfort__switches label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.comfort__switches input {
  margin: 0;
  accent-color: #2f6fca;
}

.comfort__note {
  margin: 8px 0 0;
  font-size: 12.5px;
  opacity: .75;
}

.comfort input:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

.start__go,
.reading__close {
  font: inherit;
  cursor: pointer;
}

.start__go {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 7px;
  background: #2f6fca;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
}

.start__go:hover {
  background: #255fb3;
}

.start__go:focus-visible,
.reading__close:focus-visible,
.reading__link:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

.start__note {
  margin: 8px 0 0;
  font-size: 12.5px;
  opacity: .75;
}

/* Who is on duty: the sign-in line at the foot of the start card. */

.operator {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(39, 35, 31, .35);
}

.operator__form,
.operator__duty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.operator__duty {
  justify-content: space-between;
  font-size: 14px;
}

.operator__label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #8b2b20;
}

.operator__field {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid rgba(39, 35, 31, .45);
  border-radius: 6px;
  background: rgba(255, 255, 255, .55);
  color: inherit;
  font: 700 14px var(--mono);
}

.operator__button {
  padding: 7px 11px;
  border: 1px solid rgba(39, 35, 31, .55);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.operator__button--quiet {
  background: transparent;
  color: inherit;
  font-weight: 400;
}

.operator__button:disabled {
  opacity: .6;
  cursor: progress;
}

.operator__field:focus-visible,
.operator__button:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

/* Reading ------------------------------------------------------------------- */

.reading {
  position: fixed;
  z-index: 3;
  top: 50%;
  right: max(4vw, 20px);
  width: min(380px, 42vw);
  max-height: 80vh;
  overflow: auto;
  translate: 0 -50%;
  padding: 20px 22px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
}

.reading h2 {
  margin: 0;
  font-size: 20px;
}

.reading p {
  margin: 0;
}

.reading__handle {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  opacity: .8;
}

.reading__text {
  margin: 14px 0 !important;
  font-size: 17px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reading__extra {
  white-space: pre-wrap;
  font-size: 13px;
  opacity: .8;
}

.reading__extra:empty {
  display: none;
}

.reading__meta {
  margin-top: 12px !important;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  opacity: .8;
}

.reading__link {
  display: inline-block;
  margin-top: 14px;
  color: #1f5fb8;
  font-weight: 600;
}

.reading__close {
  display: block;
  margin-top: 14px;
  padding: 7px 12px;
  border: 1px solid rgba(39, 35, 31, .4);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 13px;
}

/* Messages ------------------------------------------------------------------- */

.banner,
.status {
  position: fixed;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  pointer-events: none;
}

.banner {
  z-index: 2;
  top: 12px;
  font-size: 13px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
}

.status {
  top: 50%;
  translate: 0 -50%;
  font-size: 16px;
  color: #4a443a;
}
