/* Niles Games - shared styles.
   The pages are mostly 1995-style HTML attributes. These few rules add the
   site directory buttons and keep things from breaking on phones. */

/* Spelled out here as well as in <body bgcolor> so a host that wraps the page
   in its own template can't change the color or font. */
body { margin: 8px; background: #C0C0C0; color: #000; font: 16px "Times New Roman", Times, serif; }
/* Dividers: colors spelled out so every browser draws the same etched line.
   Left to its defaults, Firefox draws them much darker than Chrome. */
hr { border: 1px solid; border-color: #9A9A9A #EEEEEE #EEEEEE #9A9A9A; }
img { max-width: 100%; height: auto; }
table.banner { margin-top: 8px; max-width: 100%; }
table.banner img { image-rendering: pixelated; }
table.page { width: 640px; max-width: 100%; }

/* Site directory: Windows 95 push buttons. The bevel is the real 1px-per-ring
   Win95 palette (white/#DFDFDF light edges, black/#808080 shadow edges); the
   label uses the same font as the rest of the page. The current page's button
   is shown pushed in. */
.dir { max-width: 860px; }
.dir a { display: inline-block; box-sizing: border-box; width: 112px; margin: 3px;
         padding: 6px 4px 5px; vertical-align: top;
         background: #C0C0C0; color: #000; text-decoration: none; white-space: nowrap;
         box-shadow: inset -1px -1px #000, inset 1px 1px #FFF,
                     inset -2px -2px #808080, inset 2px 2px #DFDFDF; }
/* :hover too, so dragging off a held button pops it back up like Win95. */
.dir a { -webkit-user-select: none; user-select: none; }
.dir a:active:hover, .dir a.on { padding: 7px 3px 4px 5px;
                box-shadow: inset -1px -1px #FFF, inset 1px 1px #000,
                            inset -2px -2px #DFDFDF, inset 2px 2px #808080; }
.dir a.on { font-weight: bold; }
.dir a:focus-visible { outline: 1px dotted #000; outline-offset: -6px; }
/* Icons are drawn at exactly 2x their native size so the pixels stay square. */
.dir img { display: block; margin: 4px auto 6px; image-rendering: pixelated; }

/* Release status line, tucked right under a game's title. */
h3:has(+ .status) { margin-bottom: 0; }
.status { margin-top: 2px; font-weight: bold; }

.counter { font-family: "Courier New", Courier, monospace; background: #000; color: #33FF33;
           padding: 1px 6px; letter-spacing: 2px; border: 2px inset #808080; }

/* Embedded video keeps a 16:9 shape at any width. */
.video { position: relative; aspect-ratio: 16 / 9; background: #000; border: 2px inset #808080; }
.video iframe, .video #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
              color: #FFF; font-family: "Courier New", Courier, monospace; }
.video .msg[hidden] { display: none; }

/* Pixel font: one font pixel is one screen pixel at 12.5px. The outlines in
   this copy were shifted half a pixel left so they sit on the pixel grid, and
   the metrics below put the baseline on a whole pixel (10px up, 3px down). */
@font-face { font-family: "Windows"; src: url(fonts/windows-regular.ttf) format("truetype");
             ascent-override: 80%; descent-override: 24%; line-gap-override: 0%; }

/* Current project: a Win95 copy dialog. copy-dialog.png is the empty window;
   the flying-files GIF, the text and the progress blocks sit on top of it at
   the pixel positions of the original. */
/* The dialog floats over the cover art, centered in its lower third. The
   wrapper centers it; on a phone narrower than the dialog it hangs over the
   edges instead of stretching the page table. */
.cover { position: relative; max-width: 640px; margin: 16px auto; contain: inline-size; }
.cover img { display: block; }
.copy-wrap { position: absolute; left: 0; right: 0; top: 83.333%; transform: translateY(-50%);
             display: flex; justify-content: center; contain: inline-size; }
.copy-dialog { flex: none; position: relative; width: 381px; height: 162px;
               background: url(images/copy-dialog.png) no-repeat; image-rendering: pixelated;
               font: 12.5px "Windows", Tahoma, "MS Sans Serif", sans-serif; color: #000;
               font-synthesis: none; -webkit-font-smoothing: none; }
.copy-dialog > * { position: absolute; line-height: 13px; }
.copy-files { left: 20px; top: 28px; max-width: none; image-rendering: pixelated; }
/* The font has no bold, so the title gets Windows-style bold: the same glyphs
   drawn again one pixel to the right, with an extra pixel between letters. */
.copy-title { left: 6px; top: 5px; width: 350px; color: #FFF; text-shadow: 1px 0 #FFF; letter-spacing: 1px; }
.copy-task, .copy-pct { left: 14px; width: 284px;
                        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-task { top: 85px; }
.copy-pct { top: 101px; }
/* Blocks are 6px wide with 2px gaps, like the real bar. The fill rounds to
   the nearest whole block so a block is never cut in half. */
.copy-bar { left: 16px; top: 126px; width: 280px; height: 9px; line-height: 0; }
.copy-bar span { display: block; height: 100%; max-width: 100%;
                 width: calc(var(--progress) * 2.8px);
                 width: round(calc(var(--progress) * 2.8px), 8px);
                 background: repeating-linear-gradient(90deg, #000084 0 6px, transparent 6px 8px); }

/* Too narrow to float the dialog over the cover: put it underneath. */
@media (max-width: 660px) {
  .copy-wrap { position: static; transform: none; margin-top: 12px; }
}

@media (max-width: 600px) {
  table.game td { display: block; width: auto; text-align: center; }
  table.game td.blurb { text-align: left; }
  .dir a { width: 96px; }
  .dir img { width: 48px; height: 48px; }
}
