/* archive.css — the minimum that makes a 1996-2013 page usable on a phone.
 *
 * Loaded by the pages outside the chrome system (polyhedra/, vrml/, the talk
 * pages, the X_ITE wrappers). Deliberately tiny and non-visual: it must not
 * restyle 4,000 archive pages, only stop them overflowing the screen.
 */

img:not([usemap]),
video, embed, object, x3d-canvas, model-viewer, svg {
  max-width: 100%;
}
/* height:auto beats the HTML height attribute, so an image sized only by
 * height="..." would jump to its natural size. Let that attribute win. */
img:not([usemap]):not([height]), img[width]:not([usemap]),
video, embed, object, x3d-canvas, model-viewer, svg {
  height: auto;
}
img[height]:not([width]) {
  object-fit: contain;
}

/* YouTube embeds are hardcoded to width="560" */
iframe {
  max-width: 100%;
}

/* Image maps are the navigation on the polyhedra index pages. Their <area>
 * coordinates are absolute pixels, so scaling the image silently misaligns
 * every hotspot — these scroll instead of shrinking. */
img[usemap] {
  max-width: none;
}

/* 1px shims stretched by width/height attributes: fluid rules would collapse
 * them to a dot. Removed for good when the layout tables go. */
img[width="1"], img[height="1"],
img[src*="spacer"], img[src*="pixel"], img[src*="vert_line"],
img[src*="bluedot"], img[src*="greendot"] {
  max-width: none;
  height: revert;
}

pre, code {
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

:where(body:not([leftmargin="0"]):not([marginwidth="0"])) {
  margin: 22px clamp(28px, 9.5vw, 120px);
}

body {
  overflow-wrap: break-word;
}

@media (max-width: 768px) {
  :where(body:not([leftmargin="0"]):not([marginwidth="0"])) {
    margin: 16px 26px;
  }
  body {
    font-size: 16px;      /* the archive's default 13-14px is unreadable */
    line-height: 1.45;
  }
  /* fixed-width layout tables give up their width rather than the viewport */
  table[width] { width: auto !important; max-width: 100%; }
}

/* --- fixed-width containers in the archive's own stylesheets --------------
 * css/global.css (loaded by 18 polyhedra and vrml pages) pins #container to
 * 900px, which no phone can show. !important is needed because global.css
 * loads after this file. */
@media (max-width: 768px) {
  #container,
  #global_nav,
  #listp,
  #content,
  #main {
    width: auto !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* --- retired Java applets -------------------------------------------------
 * Applets stopped running in browsers in 2017. Where one used to be, these
 * pages now say so and point at the working alternative, rather than showing
 * an unexplained blank rectangle. */
.legacy-applet {
  max-width: 46em;
  margin: 1.5em 0;
  padding: 1em 1.25em;
  border: 1px solid #cccac4;
  border-left: 4px solid #ef3e42;
  background: #f7f6f4;
  color: #333;
  font-family: "Trebuchet MS", Trebuchet, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
.legacy-applet p { margin: 0 0 .6em; }
.legacy-applet p:last-child { margin-bottom: 0; font-size: 14px; color: #555; }
.legacy-applet a { color: #418b77; }

/* --- video embeds --------------------------------------------------------
 * Converted from Flash <object>/<embed>. The wrapper keeps the aspect ratio
 * while the iframe scales down on small screens. */
.video-embed {
  width: 100%;
  margin: 1em 0;
}
.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
