/* Face/Off 1997 -- modern-Chrome compatibility layer.
 *
 * Scope rule: this file must never restyle the original site. It only styles
 * the small number of elements that replaced dead plug-in embeds, plus the
 * lightbox. Nothing here targets a bare tag selector, so quirks-mode table
 * and image layout is left exactly as the 1997 markup produced it.
 */

/* ---- Stage width ------------------------------------------------------ *
 * The site was authored for a browser no wider than 1024px: the menu bar is
 * 533px, the widest content table is 600px, and the background plates are
 * 800-900px. Past that, text columns run to absurd line lengths and the art
 * strands itself in a corner.
 *
 * Plain documents are constrained here, on the root element, so the body's
 * background keeps propagating to the canvas and positions against the
 * centred 1024px box -- the art travels with the content instead of staying
 * pinned to the far left of a 2560px screen. Black fills the margins, which is
 * already every one of these pages' BGCOLOR.
 *
 * The `fo-stage` class is set by an inline one-liner in <head> and only on a
 * document that is the top-level window, so a page loaded into a frame still
 * fills its frame. Frameset documents cannot be constrained with CSS at all --
 * Chrome's frameset layout ignores width/max-width -- so those are handled in
 * the markup instead, by an outer <FRAMESET cols="*,1024,*"> with black filler
 * frames. See _modern/modernize.py.
 *
 * To change the width, edit this one value. */
:root {
  --fo-stage-width: 1024px;
}

html.fo-stage {
  max-width: var(--fo-stage-width);
  margin-left: auto;
  margin-right: auto;
}

/* ---- Background art -------------------------------------------------- */
/* The 1997 body background="..." attribute maps to background-image, and the
 * CSS default is to tile in both directions. On a 640x480 or 800x600 screen
 * these plates were bigger than the viewport, so nobody ever saw them repeat.
 * On a modern display they wrap two or three times across and once down --
 * something the art was never drawn for: every one of these images fades to
 * black at its right and bottom edge specifically so it would blend into the
 * page's BGCOLOR="#000000" (all 200 such pages are black).
 *
 * So: stop the tiling, and change nothing else. Position stays at the default
 * top-left and background-size stays `auto`, so the art keeps its original
 * anchoring and its natural 1:1 scale. Deliberately NOT `cover` -- these are
 * not meant to fill the viewport, they are meant to sit in the corner and fade
 * out.
 *
 * The two plates with a bright right edge (filmleft_bg.jpg, images_leftbg.jpg)
 * are frame backgrounds drawn to the exact width of their frame, so they never
 * repeated horizontally anyway and are unaffected.
 *
 * Scoped to [background] so this can only touch elements that actually carried
 * the presentational attribute. */
body[background] {
  background-repeat: no-repeat;
}

/* ---- Ruffle (Flash .swf) --------------------------------------------- */
/* The Ruffle polyfill swaps <embed src="*.swf"> for <ruffle-embed>. Keep it
 * inline and baseline-aligned so it occupies the same box the Flash plug-in
 * did inside the original <P>/<TD> flow. */
ruffle-embed,
ruffle-object {
  display: inline-block;
  vertical-align: bottom;
}

/* ---- QuickTime -> HTML5 <video> -------------------------------------- */
/* .fo-qt is sized to the original EMBED box (movie height + the 14px
 * QuickTime controller strip). The <video> inside keeps the movie's native
 * pixel size and sits at the top of that box, exactly where the plug-in put
 * it, so the surrounding table cells do not shift. */
.fo-qt {
  display: inline-block;
  vertical-align: top;
  overflow: hidden;
}

.fo-qt video {
  display: block;
  background: #000;

  /* hi_res.mov is 240x135; H.264 needs an even height, so the transcode is
   * 240x136 with one black row padded at the bottom. Cropping from the top
   * left shows the original frame 1:1 instead of letterboxing it. Videos whose
   * size was already even are unaffected -- cover is a no-op at 1:1. */
  object-fit: cover;
  object-position: top left;
}

/* ---- Shockwave (Director .dcr) placeholder --------------------------- */
/* Sized to the original EMBED box so the page flow is unchanged. */
.fo-dcr {
  display: inline-block;
  vertical-align: bottom;
  box-sizing: border-box;
  border: 1px solid #551014;
  background: #000;
  color: #ffffff;
  text-align: center;
  overflow: hidden;
}

.fo-dcr-inner {
  padding: 20px 34px;
  font-family: Courier, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.fo-dcr-title {
  color: #ff150b;
  font-weight: bold;
  letter-spacing: 3px;
  margin-bottom: 14px;
}

.fo-dcr-inner p {
  margin: 0 0 10px;
}

.fo-dcr-file {
  color: #9a9a9a;
}

/* ---- Lightbox -------------------------------------------------------- */
/* Replaces the 1997 window.open() media pop-ups. */
.fo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  font-family: Courier, monospace;
}

.fo-lightbox-box {
  position: relative;
  max-width: 92vw;
  max-height: 88vh;
  text-align: center;
}

.fo-lightbox-box img,
.fo-lightbox-box video {
  display: block;
  max-width: 92vw;
  max-height: 78vh;
  background: #000;
  border: 1px solid #551014;
}

.fo-lightbox-caption {
  margin-top: 10px;
  color: #ffffff;
  font-size: 13px;
}

.fo-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #551014;
  border-radius: 0;
  background: #000;
  color: #ff150b;
  font: bold 16px/26px Courier, monospace;
  cursor: pointer;
}

.fo-lightbox-close:hover {
  color: #ffffff;
}
