/* The old nerdbucket.com look, rebuilt without layout tables. Colors and
   images come from the 2005 style/default.css and images/layout/. */

body {
  margin: 0;
  background: #c0c0c0;
  color: #000;
}

a:link, a:visited { color: #3333aa; }
a:hover { color: #33aa33; }
a:focus-visible { outline: 3px solid #000; outline-offset: 2px; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1em;
  top: 1em;
  z-index: 1;
  background: #fff;
  padding: 0.5em 1em;
}

/* Top navbar: logo, image buttons, then a stretchy filler ending in the
   top-right corner image. */
.topnav {
  display: flex;
  flex-wrap: wrap;
  background: url(/images/layout/NavbarFiller.jpg) repeat-x;
}
.topnav img { display: block; }
.topnav .logo { max-width: 100%; height: auto; }
.topnav ul {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}
.topnav .on { display: none; }
.topnav a:hover .off, .topnav a:focus-visible .off { display: none; }
.topnav a:hover .on, .topnav a:focus-visible .on { display: block; }
.topnav a:focus-visible { outline-offset: -3px; }
.topnav .filler {
  flex: 1;
  min-width: 12px;
  height: 97px;
  background: url(/images/layout/NavbarTopRight.jpg) right top no-repeat;
}

/* Sidebar on the left, main box filling 95% of the rest, 10px apart. */
.columns {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  flex: 0 0 150px;
  margin-bottom: 1em;
}
.sidebar::before, .sidebar::after {
  content: "";
  display: block;
}
.sidebar::before { height: 30px; background: url(/images/layout/leftnav_top.gif); }
.sidebar::after { height: 20px; background: url(/images/layout/leftnav_bot.gif); }
.sidebar ul {
  margin: 0;
  padding: 0 6px 0 10px;
  list-style: none;
  background:
    url(/images/layout/leftnav_lefttable.gif) left top repeat-y,
    url(/images/layout/leftnav_righttable.gif) right top repeat-y,
    url(/images/layout/leftnav_backcolor.gif);
}

/* The white box with faded edges. The corner and edge images sit on white,
   as they did in the old table. */
.mainbox {
  flex: 1;
  margin: 0 2.5% 1em 10px;
  padding: 16px 24px;
  background:
    url(/images/layout/maintable_tl.gif) left top no-repeat,
    url(/images/layout/maintable_tr.gif) right top no-repeat,
    url(/images/layout/maintable_bl.gif) left bottom no-repeat,
    url(/images/layout/maintable_br.gif) right bottom no-repeat,
    url(/images/layout/maintable_t.gif) 24px top / calc(100% - 48px) 16px no-repeat,
    url(/images/layout/maintable_b.gif) 24px bottom / calc(100% - 48px) 16px no-repeat,
    url(/images/layout/maintable_l.gif) left 16px / 24px calc(100% - 32px) no-repeat,
    url(/images/layout/maintable_r.gif) right 16px / 24px calc(100% - 32px) no-repeat,
    #fff;
  min-width: 0;
}

h1 {
  font-size: 1.5em;
  text-align: center;
}
.center { text-align: center; }
.justify { text-align: justify; }
.returning {
  max-width: 35em;
  margin: 2em auto;
  padding: 1em;
  border: 1px solid #000;
  background: #ffffbf;
  text-align: center;
}

/* News, as on the old front page */
.newsbox {
  width: 90%;
  margin: 2em auto 0;
  border: 1px solid #000;
}
.newsbox .boxheader {
  margin: 0;
  padding: 2px 1em;
  font-size: 1em;
  background: #bfbfff;
}
.news > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.5em;
  padding: 2px;
  background: #000;
  color: #fff;
}
.news > header h1, .news > header h2 {
  display: inline;
  margin: 0;
  font-size: 1em;
  font-weight: normal;
  text-align: left;
}
.news > header a:link, .news > header a:visited { color: #9999ff; }
.news > header a:hover { color: #66ff66; }
.news > header a:focus-visible { outline-color: #fff; }
.news time { color: #ff0; font-size: x-small; }
.news .author { margin-left: auto; }
.news .body {
  padding: 0 20px;
  text-align: justify;
}
.more {
  text-align: center;
  font-size: small;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Section links under the site links, like the old "Jump To Section:" */
.sidebar h2 {
  margin: 0;
  padding: 0.5em 6px 0 10px;
  font-size: 1em;
  color: #c00;
  background:
    url(/images/layout/leftnav_lefttable.gif) left top repeat-y,
    url(/images/layout/leftnav_righttable.gif) right top repeat-y,
    url(/images/layout/leftnav_backcolor.gif);
}
.prevnext {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  margin-top: 2em;
}
.prevnext [rel=next] { margin-left: auto; }

/* Games and Fun Stuff lists, styled like the old yellow-header table */
.listing {
  width: 90%;
  margin: 1em auto;
  padding: 0;
  list-style: none;
  border: 1px solid #000;
}
.listing h2 {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75em;
  margin: 0;
  padding: 2px 4px;
  font-size: 1em;
  background: #ffffbf;
}
.listing .help { margin-left: auto; font-weight: normal; }
.listing .status {
  font-weight: normal;
  font-style: italic;
}
.listing .entry {
  display: flow-root;
  padding: 4px 4px 8px 20px;
  text-align: justify;
}
.listing .entry img {
  float: left;
  margin: 0 8px 4px 0;
}

/* Games */
.red { color: #c00; }
.game-actions { text-align: center; }
.game-actions button, .letters button, .weblibs button, .hg-form button {
  font: inherit;
  cursor: pointer;
}
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 0.25em 1.5em; }
.keys dt { font-weight: bold; text-align: right; }
.keys dd { margin: 0; }
.flash { text-align: center; }
.flash embed, .flash ruffle-embed { max-width: 100%; }

/* Hangman: the nerd and his quote on the left, the puzzle on the right,
   then the letters, as on the old page. */
.hangman .board {
  display: flex;
  border: 1px solid #000;
}
.hangman .nerd {
  flex: 0 0 auto;
  max-width: 45%;
  padding: 4px;
  border-right: 1px solid #000;
  text-align: center;
}
.hangman .quote { margin: 0 0 0.5em; }
.hangman .puzzle {
  flex: 1;
  margin: 1em;
  font-size: 150%;
  font-family: monospace;
  letter-spacing: 0.15em;
  text-align: center;
  overflow-wrap: anywhere;
}
.letters {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 1em 0;
  font-size: 150%;
}
.letters button {
  padding: 0.2em 0;
  border: 1px solid #3333aa;
  background: #fff;
  color: #3333aa;
}
.letters button:hover:enabled { color: #33aa33; border-color: #33aa33; }
.letters button:disabled { color: #767676; border-color: #ccc; cursor: default; }

/* WebLibs */
.weblibs { text-align: center; }
.weblibs table { width: 90%; margin: 0 auto; border-collapse: collapse; text-align: left; }
.weblibs th { font-weight: bold; }
.weblibs td, .weblibs th { padding: 2px 4px; }
.weblibs .row0 { background: #ffffdf; }
.weblibs .row1 { background: #dfdfff; }
.weblibs input { border: 1px solid #000; background: inherit; font: inherit; }
.weblibs .story-title { color: #006400; font-size: 1.2em; font-weight: normal; }
.weblibs .story { text-align: justify; }

/* Hypergeometric calculator */
.hg-form {
  display: grid;
  grid-template-columns: max-content 8em;
  gap: 0.25em 0.5em;
  align-items: center;
}
.hg-form button { grid-column: 1; justify-self: start; margin-top: 0.5em; }
.hg-table { width: 100%; border: 1px solid #000; border-collapse: collapse; }
.hg-table th { background: #ddf; text-align: left; }
.hg-table td, .hg-table th { padding: 2px 4px; }
.hg-table tbody tr:nth-child(odd) { background: #fff; }
.hg-table tbody tr:nth-child(even) { background: #ddd; }

@media (max-width: 500px) {
  .hangman .board { flex-direction: column; }
  .hangman .nerd { max-width: none; border-right: 0; border-bottom: 1px solid #000; }
}

/* FAQs: bold Q:/A: as in the old table */
.faqs dt { margin-top: 0.75em; }
.faqs dd { margin-left: 0; }
.faqs .qa { font-weight: bold; }

/* Phones: the sidebar moves below the main box. */
@media (max-width: 700px) {
  .columns { flex-direction: column; align-items: stretch; }
  .mainbox { order: -1; margin: 0 0 1em; }
  .sidebar { align-self: center; }
  .newsbox { width: 100%; }
}
