/* The 2001 orkfia.com/manual design (Wayback snapshot 20011207115500),
   rebuilt in CSS: white page, centred #3F4F69 panel with a narrower text
   column (Verdana, white, links #B8CDE9 — the original manual.css), and a
   strip of nav buttons that invert to white on hover/current, with colours
   sampled from the original button GIFs.

   Every size is a fixed px value, set at 1.5x the original (750px panel ->
   1125px, 10px text -> 15px, 75x20 buttons -> 30px tall, spanning the panel): drawn for 800x600
   screens, the literal design is a tiny island on a modern display. Widths are maxima, so
   narrower screens get a narrower panel rather than a sideways scroll.

   Pagination: the body is split into <section class="manualPage"> blocks
   (intro + one per numbered section). Pure-CSS :target shows one at a time —
   the nav strip is the page selector. No JavaScript. */

body {
    margin: 8px;
    background: #FFFFFF;
}

.manual {
    max-width: 1125px;
    margin: 0 auto;
    background: #3F4F69;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 15px;
    color: #FFFFFF;
}

/* The original nav: a strip of buttons with a flat pure-white border that
   invert to white (dark border + text) on hover and for the current page.
   Kept sticky so the selector stays put while the page scrolls (no dividing
   line under it — the original had none). The inverted state (hover and
   current page) is defined once by the generated rules in index.html's
   <style>; only the base button styling lives here. */
.manualNav {
    position: sticky;
    top: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    padding-bottom: 3px;
    background: #3F4F69;
}

/* Ten equal buttons spanning the panel edge to edge, as the 2002 manual's did. */
.manualNav a {
    box-sizing: border-box;
    min-width: 0;
    height: 30px;
    line-height: 24px;
    text-align: center;
    color: #FFFFFF;
    background: #3F4F69;
    border: 3px solid #FFFFFF;
    text-decoration: none;
}

.manualBody {
    max-width: 1050px;
    min-height: 900px;
    margin: 0 auto;
    padding: 1px 12px 36px;
    line-height: 1.5;
}

/* One page visible at a time. :target shows the selected section; with none
   selected (e.g. the overlay opened at /manual/ with no fragment) the intro
   shows. scroll-margin-top keeps a section's heading clear of the sticky nav
   when :target scrolls it into view. */
.manualPage {
    display: none;
    scroll-margin-top: 78px;
}

/* A link to a subsection (#vacation-mode) targets a heading inside a page:
   that page shows, scrolled to the heading. */
.manualPage:target,
.manualPage:has(:target) {
    display: block;
}

.manualPage :target {
    scroll-margin-top: 78px;
}

.manualBody:not(:has(.manualPage:target, .manualPage :target)) #intro {
    display: block;
}

.manualBody a {
    color: #B8CDE9;
}

/* Page/section titles: the original's centred <b><font size="3">. */
.manualBody h1,
.manualBody h2 {
    margin: 27px 0 12px;
    font-size: 24px;
    text-align: center;
}

/* Subheads: the 2002 manual's centred, unbolded 12pt line ("The Operations"),
   the same size as the page title. */
.manualBody h3 {
    margin: 36px 0 24px;
    font-size: 24px;
    font-weight: normal;
    text-align: center;
}

/* 2002 kept Word's 12pt paragraph gap under 7.5pt text: 1.6x the text
   size, so 24px under our 15px. */
.manualBody p,
.manualBody ul,
.manualBody ol {
    margin: 24px 0;
}

.manualBody li > ul,
.manualBody li > ol {
    margin: 0;
}

.manualBody .subtitle {
    text-align: center;
    margin-top: 0;
}

/* A section's closing illustration, centred like the 2002 manual's. */
.manualBody .picture {
    text-align: center;
    margin: 24px 0 12px;
}

.manualBody hr {
    width: 50%;
    margin: 24px auto;
    border: 0;
    border-top: 1px solid #6F7B8F;
}

.manualBody blockquote {
    margin: 12px 24px;
    padding: 3px 15px;
    border-left: 3px solid #B8CDE9;
}

.manualBody blockquote p {
    margin: 12px 0;
}

.manualBody code {
    font-size: 16px;
    color: #D0D4DA;
}

.manualBody table {
    display: block;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    margin: 24px auto;
    border-collapse: collapse;
}

/* Desktop: one width for every table, so a page's tables line up. */
@media (min-width: 601px) {
    .manualBody table {
        display: table;
        width: 80%;
    }
}

.manualBody th,
.manualBody td {
    padding: 4px 12px;
    border: 1px solid #6F7B8F;
    font-size: 15px;
    text-align: left;
}

/* Race reference: one table per family, its three races side by side — the
   2001 races pages' layout and cell colours. */
.manualPage[id="8-race-reference"] table {
    display: table;
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 2px;
}

.manualPage[id="8-race-reference"] th {
    background: #707D8E;
    text-align: center;
}

.manualPage[id="8-race-reference"] th,
.manualPage[id="8-race-reference"] td {
    border: 0;
    vertical-align: top;
}

.manualPage[id="8-race-reference"] td {
    background: #465875;
}

/* Phones (or the overlay on one): drop the page margin and unstick the nav —
   wrapped to four-plus rows it would otherwise pin a third of the screen. */
@media (max-width: 600px) {
    body {
        margin: 0;
    }

    .manualNav {
        position: static;
        grid-template-columns: repeat(5, 1fr);
    }

    .manualNav a {
        font-size: 13px;
    }

    /* Race tables: one race after another (name, lore, traits, units) instead of
       three squeezed columns. The cells are reordered race by race. */
    .manualPage[id="8-race-reference"] table {
        display: flex;
        flex-direction: column;
    }

    .manualPage[id="8-race-reference"] thead,
    .manualPage[id="8-race-reference"] tbody,
    .manualPage[id="8-race-reference"] tr {
        display: contents;
    }

    .manualPage[id="8-race-reference"] th:nth-child(1) { order: 1; }
    .manualPage[id="8-race-reference"] tr:nth-child(1) td:nth-child(1) { order: 2; }
    .manualPage[id="8-race-reference"] tr:nth-child(2) td:nth-child(1) { order: 3; }
    .manualPage[id="8-race-reference"] tr:nth-child(3) td:nth-child(1) { order: 4; }
    .manualPage[id="8-race-reference"] th:nth-child(2) { order: 5; }
    .manualPage[id="8-race-reference"] tr:nth-child(1) td:nth-child(2) { order: 6; }
    .manualPage[id="8-race-reference"] tr:nth-child(2) td:nth-child(2) { order: 7; }
    .manualPage[id="8-race-reference"] tr:nth-child(3) td:nth-child(2) { order: 8; }
    .manualPage[id="8-race-reference"] th:nth-child(3) { order: 9; }
    .manualPage[id="8-race-reference"] tr:nth-child(1) td:nth-child(3) { order: 10; }
    .manualPage[id="8-race-reference"] tr:nth-child(2) td:nth-child(3) { order: 11; }
    .manualPage[id="8-race-reference"] tr:nth-child(3) td:nth-child(3) { order: 12; }

    .manualPage[id="8-race-reference"] th:not(:first-child) {
        margin-top: 12px;
    }

    .manualPage {
        scroll-margin-top: 0;
    }

    /* A catalogue table stacks into the 2002 manual's entries: name and
       labelled facts on one line, the prose underneath. */
    .manualBody table.catalogue,
    .manualBody table.catalogue tbody,
    .manualBody table.catalogue tr {
        display: block;
    }

    .manualBody table.catalogue thead {
        display: none;
    }

    .manualBody table.catalogue tr {
        padding: 9px 0;
        border-bottom: 1px solid #6F7B8F;
    }

    .manualBody table.catalogue td {
        display: inline;
        padding: 0;
        border: 0;
    }

    .manualBody table.catalogue td[data-label]::before {
        content: " · " attr(data-label) " ";
        color: #B8CDE9;
    }

    .manualBody table.catalogue td:last-child {
        display: block;
        margin-top: 3px;
    }
}
