/* ASWEWAIT — a DOS environment that fills the browser.
   Font: "Px437 IBM VGA 8x16" from the Ultimate Oldschool PC Font Pack
   (VileR, CC BY-SA 4.0). See assets/fonts/.

   The screen IS the page: #screen covers the whole viewport in black.
   The text grid inside it is measured in native 8x16 cells; script.js
   works out how many whole columns/rows fit and lays the content out
   on that grid. The font is never scaled, only more or fewer cells are
   shown. */

@font-face {
  font-family: "Px437 IBM VGA 8x16";
  src: url("assets/fonts/WebPlus_IBM_VGA_8x16.woff") format("woff");
  font-display: block;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
}
html { color-scheme: dark; }

/* ---------- the screen ---------- */

#screen {
  position: fixed;
  inset: 0;                      /* 100vw x 100vh; script.js trims the height
                                    only when a mobile keyboard covers part of it */
  background: #000;
  overflow: hidden;
  cursor: default;
}

/* The DOS text grid. Width/height/padding are set in script.js to whole
   numbers of 8x16 cells. */
#term {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: "Px437 IBM VGA 8x16", monospace;
  font-size: 16px;
  line-height: 16px;
  letter-spacing: 0;
  font-weight: normal;
  font-kerning: none;
  font-variant-ligatures: none;
  white-space: pre;
  color: #aaa;
  -webkit-font-smoothing: none;
  font-smooth: never;
  text-rendering: optimizeSpeed;
  user-select: none;
}

.r   { height: 16px; }
.con { overflow: hidden; }

/* VGA palette */
.bl { background: #0000aa; }
.dk { color: #555; }
.wh { color: #fff; }
.g  { color: #55ff55; }
.y  { color: #ffff55; }

/* Status text at the top and bottom edge: left part / right part */
.st { display: flex; justify-content: space-between; color: #555; }

/* Classic DOS underline cursor, one cell wide, blinking. When a command
   suggestion exists its first letter sits in the cursor cell. */
.cur {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 16px;
  vertical-align: top;
  color: #555;
}
.cur::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 8px;
  height: 2px;
  background: #aaa;
  animation: blink 1.06s steps(1, end) infinite;
}
.gh { color: #555; }
@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }

/* Invisible input that only receives keystrokes */
#sink {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 16px;
  padding: 0;
  border: 0;
  outline: 0;
  opacity: 0;
  font-size: 16px;              /* >=16px stops iOS zooming on focus */
  color: transparent;
  background: transparent;
  caret-color: transparent;
  pointer-events: none;
}

/* ---------- windows: rooms opening inside the terminal ---------- */

#windows { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.win {
  position: absolute;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  background: #000;
  border: 3px double #aaa;                 /* the ╔═╗ double line of the boot panel */
  box-shadow: 16px 16px 0 #1c1c1c;         /* hard two-column shadow, DOS style */
  font-family: "Px437 IBM VGA 8x16", monospace;
  font-size: 16px;
  line-height: 16px;
  color: #aaa;
  -webkit-font-smoothing: none;
  font-smooth: never;
  animation: open 0.24s steps(8, end) backwards;
}
.win.off { border-color: #555; box-shadow: none; }

/* opens like a room: a line splits vertically into the full window */
@keyframes open {
  from { clip-path: inset(50% 0); }
  to   { clip-path: inset(0); }
}

.wt {
  flex: none;
  display: flex;
  height: 16px;
  padding: 0 0 0 2px;
  background: #aaa;
  color: #000;
  white-space: pre;
  user-select: none;
}
.win.off .wt { background: #555; color: #aaa; }

.wtitle { flex: 1; overflow: hidden; }

.wx {
  flex: none;
  width: 24px;
  height: 100%;
  margin: 0 2px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #aaa;
  color: #000;
  font: inherit;
  cursor: pointer;
}
.wx:hover { background: #000; color: #aaa; }
.win.off .wx { background: #555; color: #aaa; }
.win.off .wx:hover { background: #000; }

/* content area: the video fills it, inset by one cell of black */
.wc {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 2px;
  background: #000;
  overflow: hidden;
}

.wc video {
  position: absolute;
  left: 8px;
  top: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;                      /* never distorted */
  background: #000;
}

.wc .msg { padding: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* post-teaser state: subtle, click-through to the full film */
.wc-end {
  position: absolute;
  left: 8px;
  top: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #777;
  text-decoration: none;
  letter-spacing: 2px;
  cursor: pointer;
}
.wc-end:hover, .wc-end:focus { color: #ddd; }

/* one-row status strip along the bottom edge */
.wf {
  flex: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  height: 16px;
  padding: 0 8px;
  color: #555;
  white-space: pre;
  overflow: hidden;
  user-select: none;
}

/* touch screens: taller title bar so the close button is easy to hit */
@media (pointer: coarse) {
  .wt { height: 32px; }
  .wtitle { line-height: 32px; }
  .wx { width: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .win { animation: none; }
  .cur::after { animation: none; }
}
