/* ROAM — a 2000s application, fullscreen */

* { box-sizing: border-box; }

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

body {
  font: 11px Tahoma, "MS Sans Serif", Verdana, sans-serif;
  /* the 2000s desktop the window sits on */
  background: #008080;
  color: #000;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden { display: none !important; }

/* the whole application window is one 4:3 rectangle, centred on the desktop */
#app {
  width: min(100vw, 133.3333vh);
  height: min(75vw, 100vh);
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
}

/* ---------------- title bar ---------------- */

#titlebar {
  flex: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 3px;
  background: linear-gradient(90deg, #0a246a 0%, #1c4fa1 55%, #a6caf0 100%);
  color: #fff;
  font-weight: bold;
  letter-spacing: .3px;
}

.ticon { font-size: 9px; opacity: .85; }
.tname { letter-spacing: 2px; }

.troom {
  font-weight: normal;
  opacity: .85;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 62%;
}

.troom:not(:empty)::before { content: "\2014\00a0"; }

/* which build this is, so a stale page is obvious */
.tbuild {
  margin-left: auto;
  font-weight: normal;
  font-size: 10px;
  letter-spacing: .4px;
  opacity: .8;
  white-space: nowrap;
}

/* ---------------- menu bar ---------------- */

#menubar {
  flex: 0 0 20px;
  display: flex;
  align-items: center;
  padding: 0 2px;
  gap: 1px;
  border-bottom: 1px solid #808080;
}

.menuwrap { position: relative; }

.menu {
  background: transparent;
  border: 1px solid transparent;
  padding: 2px 8px;
  font: 11px Tahoma, sans-serif;
  color: #000;
  cursor: default;
}

.menu:hover,
.menu.open {
  background: #0a246a;
  color: #fff;
}

.stats {
  margin-left: auto;
  padding-right: 4px;
  font: 10px "Lucida Console", monospace;
  color: #404040;
}

/* ---------------- dropdowns ---------------- */

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 190px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 2px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .4);
  z-index: 40;
}

.dropdown button {
  display: block;
  width: 100%;
  padding: 4px 18px 4px 20px;
  text-align: left;
  font: 11px Tahoma, sans-serif;
  color: #000;
  background: transparent;
  border: 0;
  cursor: default;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown button:hover {
  background: #0a246a;
  color: #fff;
}

.menu-label {
  padding: 3px 6px;
  font-size: 10px;
  color: #404040;
}

.sep {
  height: 0;
  margin: 3px 2px;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #fff;
}

/* ---------------- toolbar ---------------- */

#toolbar {
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 3px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  box-shadow: inset 0 1px 0 #fff;
}

.tbtn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  font: 11px Tahoma, sans-serif;
  color: #000;
  background: #c0c0c0;
  border: 1px solid transparent;
  cursor: default;
}

.tbtn:hover {
  border-color: #fff #404040 #404040 #fff;
}

.tbtn:active {
  border-color: #404040 #fff #fff #404040;
  padding-top: 1px;
}

.tbtn .glyph {
  font-size: 12px;
  line-height: 1;
  color: #0a246a;
}

.tbtn.cam .lbl { font-weight: bold; }

/* the record button, with a red light while the tape is running */
.tbtn.rec .glyph { color: #808080; }
.tbtn.rec.on .glyph { color: #b00000; }
.tbtn.rec.on .lbl { font-weight: bold; }

.dropdown button:disabled { color: #808080; text-shadow: 1px 1px 0 #fff; }

.tsep {
  width: 2px;
  height: 20px;
  margin: 0 3px;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
}

.tspacer { flex: 1; }

/* ---------------- stage ---------------- */

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 2px;
  background: #000;
  border: 1px solid;
  border-color: #404040 #fff #fff #404040;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#frame {
  position: relative;
  width: 0;
  height: 0;
  cursor: default;
}

#photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  filter: saturate(1.03) contrast(1.02);
  opacity: 1;
  transition: opacity 190ms linear;
}

/* ---------------- flash ---------------- */

#flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 8;
}

/* the little blue label that rides above the pointer */
/* the blue-and-white selection label that rides above the pointer */
.tip {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1px 6px;
  background: #000080;
  border: 1px solid #fff;
  box-shadow: 0 0 0 1px #000;
  color: #fff;
  font: 11px Tahoma, sans-serif;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
}

#flash.fire { animation: flashOut .34s ease-out; }

@keyframes flashOut {
  0% { opacity: .92; }
  55% { opacity: .16; }
  100% { opacity: 0; }
}

/* ---------------- loading ---------------- */

.empty {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 20px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: 0 0 0 1px #000;
  color: #000;
  font: 11px Tahoma, "MS Sans Serif", sans-serif;
  white-space: nowrap;
}

/* a blinking block cursor, because nothing in 1996 loaded silently */
.empty::after {
  content: "_";
  margin-left: 2px;
  animation: cursorBlink 1s steps(1) infinite;
}

@keyframes cursorBlink {
  50% { opacity: 0; }
}

.marquee {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: 208px;
  padding: 4px 5px 5px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .3);
  z-index: 6;
}

.marquee .mq-text {
  display: block;
  margin-bottom: 3px;
  font: 10px/1 "MS Sans Serif", Tahoma, sans-serif;
  color: #000;
  text-align: center;
  letter-spacing: .3px;
}

.marquee .bar {
  height: 12px;
  padding: 2px;
  box-sizing: border-box;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  overflow: hidden;
  position: relative;
}

.marquee .bar::after {
  content: "";
  position: absolute;
  inset: 2px;
  background-image: repeating-linear-gradient(90deg, #0000aa 0 8px, #c0c0c0 8px 16px);
  background-size: 16px 100%;
  animation: march .6s steps(2) infinite;
}

@keyframes march {
  from { background-position: 0 0; }
  to   { background-position: 16px 0; }
}

/* ---------------- status bar ---------------- */

#statusbar {
  flex: 0 0 22px;
  display: flex;
  gap: 2px;
  padding: 2px;
  background: #c0c0c0;
}

.pane {
  display: flex;
  align-items: center;
  padding: 0 5px;
  overflow: hidden;
  white-space: nowrap;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  font-size: 11px;
}

.pane.grow { flex: 1 1 auto; min-width: 90px; }

.pane.credit {
  flex: 0 1 42%;
  max-width: 340px;
  min-width: 0;
  color: #303030;
  font-size: 10px;
}

/* where the room came from, click through to the original photograph */
.srclink {
  color: #0046a3;
  font-weight: bold;
  text-decoration: none;
  margin-right: 5px;
}

.srclink:hover { text-decoration: underline; }
.srclink:empty { display: none; }

.pane.shots #counter {
  margin-right: 4px;
}

.pane.shots {
  min-width: 78px;
  justify-content: center;
  font-family: "Lucida Console", monospace;
  font-size: 10px;
}

@media (max-width: 620px) {
  .pane.credit { display: none; }
}

/* ---------------- where to? ---------------- */

.modal-inner.wide { width: min(94%, 430px); }

.places {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  max-height: 176px;
  overflow-y: auto;
  margin-bottom: 8px;
  padding-right: 2px;
}

.place {
  font: 11px Tahoma, "MS Sans Serif", sans-serif;
  text-align: left;
  padding: 3px 5px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #404040 #404040 #fff;
  cursor: pointer;
}

.place:hover { background: #d0d0d0; }

.place.on {
  background: #000080;
  color: #fff;
  border-color: #404040 #fff #fff #404040;
}

.field {
  display: block;
  margin: 7px 0 3px;
  font-size: 11px;
  color: #303030;
}

.desk-input {
  width: 100%;
  box-sizing: border-box;
  font: 11px Tahoma, "MS Sans Serif", sans-serif;
  padding: 3px 4px;
  background: #fff;
  border: 1px solid;
  border-color: #404040 #fff #fff #404040;
}

.sides { display: flex; gap: 14px; }

.side-opt {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* ---------------- about ---------------- */

.modal {
  /* dialogs belong to the application window, not to the whole desktop */
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .45);
  z-index: 60;
}

.modal-inner {
  width: min(420px, 88vw);
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .4);
}

.modal-title {
  padding: 2px 4px;
  background: linear-gradient(90deg, #0a246a, #a6caf0);
  color: #fff;
  font-weight: bold;
}

.modal-body {
  padding: 12px 14px 4px;
  line-height: 1.55;
}

.modal-body p { margin: 0 0 8px; }

.modal-body .fine {
  color: #404040;
  font-size: 10px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  padding: 2px 12px 12px;
}

.modal-foot .ok {
  min-width: 74px;
  padding: 3px 12px;
  font: 11px Tahoma, sans-serif;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #404040 #404040 #fff;
  cursor: default;
}

.modal-foot .ok:active {
  border-color: #404040 #fff #fff #404040;
}

/* ---------------- film roll ---------------- */

.modal-inner.wide {
  width: min(780px, 94vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
}

.modal-inner.wide .modal-body {
  overflow-y: auto;
  flex: 1 1 auto;
  padding: 10px 12px;
}

.roll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 8px;
}

.roll-grid .cell {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  padding: 3px;
}

.roll-grid .cell img,
.roll-grid .cell video {
  display: block;
  width: 100%;
  height: 84px;
  object-fit: cover;
  background: #000;
  border: 1px solid #404040;
}

.roll-grid .cell.clip .cellbar::before {
  content: "\25B6  ";
  color: #0a246a;
}

.roll-grid .cellbar {
  padding: 3px 1px 2px;
  font: 9px "Lucida Console", monospace;
  color: #303030;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roll-grid .cell button {
  width: 100%;
  padding: 2px 0;
  font: 10px Tahoma, sans-serif;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #404040 #404040 #fff;
  cursor: default;
}

.roll-grid .cell button:active {
  border-color: #404040 #fff #fff #404040;
}

.roll-empty {
  padding: 22px 8px;
  text-align: center;
  color: #404040;
  line-height: 1.6;
}

.roll-foot {
  gap: 6px;
  border-top: 1px solid #fff;
  padding-top: 8px;
  box-shadow: inset 0 1px 0 #808080;
}

/* the X on a dialog: a Win-9x caption button, level with the title bar */
.modal-title { padding-right: 28px; }

.modal-x {
  position: absolute;
  top: 0;
  right: 2px;
  width: 20px;
  height: 17px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: bold 12px/1 "MS Sans Serif", Tahoma, sans-serif;
  color: #000;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  cursor: pointer;
  z-index: 3;
}
.modal-x:hover { background: #d4d0c8; }
.modal-x:active {
  border-color: #404040 #dfdfdf #dfdfdf #404040;
  padding: 1px 0 0 1px;
}
.modal-inner { position: relative; }


/* developer info: everything the walk knows, in one monospace box */
.dev-body {
  margin: 0;
  padding: 8px 10px;
  max-height: 62vh;
  overflow: auto;
  font: 11px/1.5 "Lucida Console", "Courier New", monospace;
  color: #000;
  background: #fff;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  white-space: pre-wrap;
  word-break: break-word;
}


/* ---------------- signal / corruption meter ----------------
   A row of blocks, green at the left and red at the right, like the level
   meter on a tape deck. Lit blocks are what the room has already cost. */

.corrupt {
  margin-left: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
  font: 10px "Lucida Console", monospace;
  color: #404040;
  user-select: none;
}

.corrupt .clabel { opacity: .7; letter-spacing: .4px; }

.cbar {
  display: flex;
  gap: 1px;
}

.ccell {
  width: 7px;
  height: 9px;
  background: #8a8a8a;
  border: 1px solid;
  border-color: #5a5a5a #d8d8d8 #d8d8d8 #5a5a5a;
  opacity: .55;
}

/* the colour each block turns when it is lit: green, then yellow, then red */
.ccell.on {
  opacity: 1;
  background: hsl(calc(120 - (var(--i) * 9.2)) 62% 42%);
  border-color: rgba(0, 0, 0, .45) rgba(255, 255, 255, .55) rgba(255, 255, 255, .55) rgba(0, 0, 0, .45);
}

.cstate {
  min-width: 62px;
  text-transform: lowercase;
  letter-spacing: .3px;
  opacity: .85;
}




/* ---------------- the feed tears ---------------- */

#frame.chopped #photo {
  animation: chop 150ms steps(2, end) infinite;
}

@keyframes chop {
  0%   { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
  15%  { clip-path: inset(6% 0 74% 0); transform: translate(-18px, 0); }
  30%  { clip-path: inset(52% 0 22% 0); transform: translate(14px, 2px); }
  45%  { clip-path: inset(28% 0 51% 0); transform: translate(-9px, -2px); }
  60%  { clip-path: inset(78% 0 5% 0); transform: translate(22px, 0); }
  75%  { clip-path: inset(40% 0 38% 0); transform: translate(-26px, 1px); }
  90%  { clip-path: inset(12% 0 66% 0); transform: translate(7px, 0); }
  100% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
}

/* and lines of nothing wash over it */
#frame.chopped::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(0, 0, 0, .55) 0 2px, transparent 2px 4px);
  animation: chopLines 180ms steps(3, end) infinite;
}

@keyframes chopLines {
  0% { opacity: .10; transform: translateY(0); }
  50% { opacity: .45; transform: translateY(-6px); }
  100% { opacity: .18; transform: translateY(4px); }
}
