/** Fixups */

/* Avoid elements wider than screen on mobile */
img
{
    display: inline-block;
    max-width: 100%;
}

pre, code, sample
{
    white-space: pre-wrap;
    hyphens: none;
}

table
{
    max-width: 100%;
}


body
{
    margin: 0;
    line-height: 1.4;
    background: white;
    color: black;
}

/** Structural blocks */

#page-wrapper
{
    max-width: 1000px;

    padding-top: 2%;
    padding-bottom: 4%;
    
    margin-left:  auto; 
    margin-right: auto;

    display:flex;
    flex-direction: column;
    justify-content: center;
}


#nav-wrapper
{
    width: 100%;
    border-top: #006699 solid 1px;
    border-bottom: #006699 solid 1px;
}

div#nav
{
    margin-top: 1%;
    margin-bottom: 1%;

    margin-left: 2%;
    margin-right: 2%;

    /* Display as two rows */
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 1fr);
    grid-column-gap: 5px;
    grid-row-gap: 5px;
} 

/* On desktop, center the link text in the navigation menu to align them nicely */
div#nav div
{
    text-align: center;
}

#breadcrumbs
{
    padding-top: 20px;
}

/* Make auxilliary "Site menu" and "Top of the page" link invisible on desktop */
#menu-link, #top-link
{
    display: none;
}

div.nav div
{
    text-align: center;
}

/* Mobile device only */
@media (pointer: coarse)
{

     /*
       Swap the blocks so that the navigation menu is at the bottom,
       this simplistic solution works because there are only two
       top level blocks
     */
    #page-wrapper
    {
        flex-direction: column-reverse;
    }

    /* Avoid double border when the nav menu is at the bottom */
    #nav-wrapper
    {
        border-top: none;
    }

    /* Make nav links larger and place them vertically */
    div#nav
    {
        display: flex;
        flex-direction: column;
        font-size: 120%;
    }

    #breadcrumbs
    {
        font-size: 120%;
    }

    /*
      The mobile-exclusive "Site menu" and "Top of the page" links
      for getting to the menu and back quickly
    */
    #menu-link, #top-link
    {
        width: 100%;
        display: block;
        text-align: right;
        font-size: 120%;
        padding-bottom: 0.5em;
    }
}

#content
{
    padding: 2%;
    min-height: 20em;
    border-bottom: #006699 solid 1px;
}

/** Typography */

@supports (hyphens: auto) or (-ms-hyphens: auto)
{
    #content
    {
        text-align: justify;
        hyphens: auto;
    }
}

body
{
    font-family: sans-serif;
}

/* Larger font size for the navigation menu */

div#nav { font-size: 14pt; }

/** Misc visual styles */

pre
{
    background-color: #eaeaea;
    padding: 10px;
    border: 1px solid #aaaaaa;
}

code { background-color: #eaeaea }

/* Links */
a { color: #006699; }

a.nav, a.nav:visited
{
    color: #006699;
    text-decoration: none;
}

a.nav:hover { text-decoration: underline }

a.nav-active, a.nav-active:visited
{
    font-weight: bold;
}

a:visited
{
    color: #355670;
}

a.here { text-decoration: none; }

hr
{
    height: 1px;
    border: 0 none;
    color: #006699;
    background-color: #006699;
    width: 40%;
    margin-bottom: 2em;
    margin-top: 2em;
}

/* Tables */
table
{
    border-collapse: collapse;
}

th, td
{
    text-align: left;
}

table, th, td
{
   border: 1px solid #006699;
}

th, td
{
    padding: 0.5em; 
} 

.table-caption
{
    text-align: center;
}

/* Special styles */

ul.plain
{
    list-style-type: none;
}

ul.toc, ol.toc
{
    list-style-type: none;
}

.centered
{
    text-align: center;
}

div#page-timestamp, div#last-modified
{
    color: #999999;
    padding-top: 1em;
    font-size: 80%;
    text-align: right;
}

div.quote-source
{
    text-align: right;
}

a.footnote
{
    text-decoration: none;
}

/* Site news */

.site-news-entry
{
    display: flex;
    flex-direction: row;
    padding-top: 15px;
    padding-bottom: 15px;
    padding-left: 10px;
    padding-right: 10px;
}

.site-news-entry:nth-child(2n) { background-color: #e8e8e8; }

.site-news-date
{
    margin-right: 10px;
    min-width: max-content;
}

@media (pointer: coarse)
{
    .site-news-entry { flex-direction: column; }
    .site-news-entry:nth-child(2n) { background-color: #e8e8e8; }
}



/* Align headings with dates in .site-news-date */
.site-news-content h3  { margin: 0; margin-bottom: 3px; }
.site-news-content p  { margin: 0; margin-bottom: 3px; }

