/* Shared structure loaded under every theme. Keep this minimal.
   Anything visual/aesthetic belongs in a theme file under themes/. */

#theme-switcher {
  position: fixed;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1000;
  /* Forms side by side: language switcher (only on a page that has a
     translation), protocol switcher, then theme switcher. */
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 8px;
}

#theme-switcher form {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

/* Stop oversized media from blowing out the layout. */
img {
  max-width: 100%;
  height: auto;
}

/* 88x31 button wall. Fixed-size badges, so opt out of the img rule above and
   keep them at their native pixel dimensions rather than scaling. */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.badges img {
  display: block;
  width: 88px;
  height: 31px;
  max-width: none;
}

/* Each badge is a <picture> (smallest format first, see siteAssets.txt). It is
   inline by default; make it a block like the <img> inside it, so it adds no
   line box of its own around the badge. */
.badges picture {
  display: block;
}

/* Every blog post's <h1> is a row: the title on the left, the Pangram
   "100% Human" badge pinned to the right. */
.post-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.post-title a {
  flex: none;
  line-height: 0;
}

/* Skip link.

ubuntu804.css overrides both states to place and paint it against the desktop. */
.skip:not(:focus) {
  position: absolute;
  left: -100vw;
}

/* Server vitals box, index pages only (templates/html/index.tpl). The markup
   comes from status.cgi in box mode, the same fragment as /professional/:

     aside.statbox > div.sbrow > span(label) span.bar>(i[,u]) span.sbval
                   > p.sbmore > a

   Structure only here: where it sits and how a bar is built. Every theme
   paints it (plain.css included, which otherwise styles nothing). These class
   names are status.cgi's: rename one there and it must change here and in
   every theme. See ~/configNotes/status.txt. */
.statbox {
  float: right;
  width: min(14rem, 100%);
  margin: 0 0 1rem 1.5rem;
  box-sizing: border-box;
}

/* A heading beside the float gets its own block formatting context, so it
   narrows to fit instead of running its underline beneath the box. */
.statbox ~ h1,
.statbox ~ h2 {
  display: flow-root;
}

.sbrow {
  display: grid;
  grid-template-columns: 2.4rem 1fr 2.6rem;
  gap: 0.5rem;
  align-items: center;
  margin-block: 0.35rem;
}

/* The bar: solid <i> is in use, faded <u> is reclaimable cache. Both are
   flex items, so they are blockified and sit side by side. */
.statbox .bar {
  display: flex;
  height: 0.7rem;
  overflow: hidden;
}

.statbox .bar > * {
  height: 100%;
  text-decoration: none;
}

.sbval {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.sbmore {
  margin: 0.5rem 0 0;
  text-align: center;
}

/* The lawa box (lawaPage.pl's box(), class "statbox lawabox"): the same frame
   as the vitals box, so every theme paints it already; it only has to stack
   underneath rather than beside it. Its text lines are tight; its link
   (.sbmore) keeps the vitals box's spacing. */
.lawabox {
  clear: right;
}

.lawabox .lbstate,
.lawabox .lbnums {
  margin: 0;
}

.lbstate {
  font-weight: bold;
}

/* Live numbers on paper are a snapshot nobody asked for. */
@media print {
  .statbox { display: none; }
}

@media (max-width: 40rem) {
  .statbox {
    float: none;
    width: auto;
    margin: 0 0 1rem;
  }
}
