/* Shared layout replacing the original frameset: a 160px space-background
   column on the left (logo, buttons, credit) and the page on the right.
   Page colours still come from each page's own <body> attributes. */

/* The headings ask for Monotype Corsiva, a Windows font. Use a lookalike
   where one is installed, otherwise browsers fall back to Times as they
   always did. */
@font-face {
  font-family: "Monotype Corsiva";
  src: local("Monotype Corsiva"), local("MonotypeCorsiva"),
       local("Apple Chancery"), local("AppleChancery");
}

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }

.ca { display: flex; min-height: 100vh; }

.ca-side {
  flex: 0 0 160px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 5px;
  box-sizing: border-box;
  background: #000 url(spacebkg.gif);
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}
.ca-side a { color: #fff; }
.ca-side img { border: 0; vertical-align: middle; }

.ca-logo { text-align: center; margin: 0 0 6px; }
.ca-title { font-size: small; }

.ca-nav { list-style: none; margin: 0; padding: 0; text-align: center; }
.ca-nav li { margin: 16px 0; }

.ca-credit {
  margin-top: auto;
  padding-top: 16px;
  color: #0ff;
  font-size: x-small;
}
.ca-credit img { float: right; }

.ca-main { flex: 1; min-width: 0; padding: 1px 8px 24px; }
.ca-main img { max-width: 100%; height: auto; }
.ca-main pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.ca-main table, .ca-main hr { max-width: 100%; }
.ca-main input, .ca-main textarea { max-width: 100%; box-sizing: border-box; }
.ca-main audio { display: block; max-width: 100%; margin: 4px 0 8px; }

.ca-counter {
  font-family: "Courier New", Courier, monospace;
  background: #000;
  color: #0f0;
  padding: 0 4px;
  border: 1px inset #555;
}

/* Phones: the left column becomes a band across the top. */
@media (max-width: 640px) {
  .ca { flex-direction: column; }
  .ca-side {
    position: static;
    height: auto;
    flex: none;
    overflow: visible;
  }
  .ca-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  .ca-nav li { margin: 0; }
  .ca-title { text-align: center; margin-bottom: 8px; }
  .ca-credit {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
  }
  /* keep the 70x61 shape the original frame drew it at */
  .ca-credit img { float: none; width: 42px; height: auto; aspect-ratio: 70 / 61; }
  /* The few tables are fixed-width layout grids; stack their cells. */
  .ca-main table, .ca-main tbody, .ca-main tr, .ca-main td {
    display: block;
    width: auto !important;
  }
  .ca-main td:empty, .ca-main td[height] { display: none; }
}
