html {
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}
*, *:before, *:after {
    -webkit-box-sizing: inherit;
    -moz-box-sizing: inherit;
    box-sizing: inherit;
}

/* Principle page divisions */

body {
    padding: 0 1%;
    /* font-size: 1em; */
    display: grid;
    grid-template-columns: 2fr 5fr 2fr;
    grid-template-rows: 28vh auto;
    grid-template-areas:
	"logo  about   search"
	"index content aside";
}

/* Basic grid layout */

header#logo {
    grid-area: logo;}

div#about {
    grid-area: about;
}

section#content {
    padding-right: 4vw;
    grid-area: content;
}

div#search {
    grid-area: search;
}

aside#aside {
    grid-area: aside;
}

header#logo, div#about, div#search {
    align-self: center;
}

header#logo img {
    height: 18vh;
}

header#logo h1 {
    display:none;
}

/* Styles for larger screens */

@media only screen and (min-width: 1000px) {
    nav#index {
	grid-area: index;
	padding-right: 4vw;
    }
    /* Remove bits that are only for display on mobile */

    a#main-menu-toggle, a#main-menu-close {
	display: none;
    }

    nav#index {
	overflow:hidden;
    }
}

.col h1 {
    font-size: 1.3em;
}

.col h2 {
    font-size: 1.1em;
}

.col article h1 {
    font-size: 1.1em;
}

.col article h2 {
    font-size: 1em;
    font-weight: bold;
}

/* The "top" part of the page */

div#about ul {
    padding-left: 6vw;
    display: flex;
    justify-content: space-between;
    padding-right: 4vw;
}

div#about img {
    width: 25px;
}

div#search input[type=search] {
    width: 55%;
    background: #444444;
    color: #f2f2f2;
    border: none;
}

div#search input[type=submit] {
    border: none;
    background: none;
    font-weight: bold
}

div#search input[type=submit]:hover {
    box-shadow: 0px 0px 1px gray;
}
div#search p#log {
    margin: 0px;
    padding: 0px;
    width: 55%;
}

/* The asides */

aside img {
    width: 50%;
    padding-top: 1em;
    text-align: center;
    border: 1px gray solid;
}
aside img.lscape {
    width: 100%;
}

aside ul#social {
    display: flex;
    justify-content: space-around;
    padding-top: 16px;
}

aside ul#social img {
    width: 20px;
    padding-top: 0px;
}

/* aside div#news_signup { */
/*     text-align: right; */
/*     padding: 15px; */
/*     border: 1px solid gray; */
/* } */

/* aside div#news_signup input { */
/*     width: 100%; */
/* } */

/* aside div#news_signup label { */
/*     display: none; */
/* } */

aside.col div#recentcomments {
    font-size: 0.85em;
}

/* The nav section */

nav#index li {
    padding-bottom: 0.3em;
}

/* Various Common Styles */

/* Xiaoxi's blue link color: #66BBDD */

a {
    color: black;
}

a:visited {
    color: default;
}

a:hover {
    color: #66BBDD;
    text-decoration-color: #66BBDD;
}

div#about a, nav#index a, aside a {
    text-decoration: none;
}

.char {
    font-family: "STHeiti-Light", "AR PwL New Sung";
    font-size: 90%;
}

/* This will prevent superscript from bumping the height of the line
   it's on. */
sup {
    line-height: 100%;
    font-size: 0.7em;
}

/* for "non-applicable" things */
span.na {
    color: gray;
}

ul {
    list-style: none;
}

ul, ol {
    margin: 0;
    padding: 0;
}

.helptext {
    font-size: 0.8em;
    padding: 0;
    margin: 0;
    color: #666;
}

/* The content section */

section#content img {
    max-width: 100%;
}

section#content p.signature,
section#content p.comment,
section#content p.morelink
{
    font-size: 0.85em;
    font-weight: bold;
    margin: 0px;
    padding: 0px;
    color: gray;
}

section#content p.signature a,
section#content p.comment a,
section#content p.morelink a
{
    color: gray;
}

section#content p.signature a:hover,
section#content p.comment a:hover,
section#content p.morelink a:hover
{
    color: #66BBDD;
}

section#content h1 a {
    text-decoration: none;
}

section#content article.item {
    padding-bottom: 5px;
}

#itemlist article {
    margin-bottom: 2em;
}

#itemlist article.link h1 span.link a {
    font-weight: normal;
    padding-left: 1em;
    color: #534E4E;
    font-size: 87%;
    text-decoration: none;
}

#itemlist article.closed_entry h1::before {
    content: "CLOSED ";
    color: #666;
}

#itemlist article.future_entry h1::before {
    content: "FUTURE ";
    color: #666;
}

#itemlist article.moderated h1::before {
    content: "MODERATED ";
    color: #666;
}

#itemlist article.future_entry.closed_entry h1::before {
    content: "CLOSED/FUTURE ";
    color: #666;
}

ul.paginator li {
    display: inline;
    padding-bottom: 5px;
}

ul.paginator li.current {
    border-bottom: 3px solid gray;
}
ul.paginator li.num a {
    padding: 0 4px;
    text-decoration: none;
    color: #66BBDD;
}
ul.paginator {
    margin-left: 30px;
    font-size: 0.9em;
    padding-bottom: 20px;
}
footer.paginator {
    padding-bottom: 20px;
    text-align: right;
}
footer.paginator a {
    text-decoration: none;
    color: #66BBDD;
}

p.help {
    font-size: 0.9em;
    padding: 0 0 8px 8px;
    color: #B0B0B0;
}
p.help a {
    color: #B0B0B0;
}

/* for the comment post success page */
div#preview_posted h1 {
    margin: 1em 0 1em 0;
}
div#preview_posted p.note {
    margin-left: 3em;
    font-weight: bold;
}
div#preview_posted div#comment {
    width: 60%;
    margin-left: 3em;
    padding: 0.5em;
    background-color: #EEE;
}

/* All long-form readable articles */

article.readable {
    width: 90%;
    max-width: 70ch;
}

article.readable ol {
    list-style: decimal inside;
}
article.readable ul {
    list-style: circle inside;
}
article.readable {
    font-size: 1.2em;
}
article.readable p {
    line-height: 1.3em;
}

article.readable blockquote {
    font-size: 0.8em;
}

article.readable div.footnote {
    font-size: 0.8em;
}

/* This provides floating for cover_image images for blog posts and
   news items on the homepage, and individual contributor pages.
   Basically styles incl/entry.html, incl/newslink.html, and
   entry.html */

article.item p.portrait img, article.readable p.portrait img {
    float: left;
    width: 35%;
    padding-right: 20px;
    padding-bottom: 10px;
}

article.item p.landscape, article.readable p.landscape {
    text-align: center;
}

article.item p.landscape img, article.readable p.landscape img {
    width: 80%;
}

article.item p.comment, article.readable {
    clear: both;
}

/* Kind of cheating on the database landing page */

/* article#db div.fbox { */
/*     display: flex; */
/* } */

/* article#db div.dtype { */
/*     flex-grow: 1; */
/* } */

/* logged in users see a "edit" link by object names, in small
   superscript, this is used to style that */

span.edit {
    font-size: 0.55em;
    /* background: gray; */
    /* padding: 1px; */
    /* color: white; */
}
span.edit a {
    /* color: white; */
    text-decoration: none;
}
span.edit a:hover {
    color: #66BBDD;
}


/* Styles for small screens, including the pop-out nav bar. */

@media only screen and (max-width: 1000px) {
    body {
	grid-template-columns: 5fr 2fr;
	grid-template-rows: 15vh auto;
	grid-template-areas:
	    "search logo"
	    "content aside";
	padding: 5%;
    }

    div#about, p#log {
	display: none;
    }

    section#content, aside#aside {
	font-size: 170%;
    }

    input[type=text] {
	line-height: 3em;
    }
    input[type=submit] {
	font-size: 3vw;
    }
    div#search input[type=text] {
	width: 30vw;
    }
    header#logo img {
	width: 65%;
	height: 65%;
    }
    .sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	border: 0;
    }
    a#main-menu-toggle {
	position: fixed;
	top: 5%;
	left: 5%;
	line-height: 1em;
	font-size: 1em;
	color: #333;
    }

    a#main-menu-toggle:hover,
    a#main-menu-toggle:focus {
	color: #c00;
    }

    #navcontents {
	position: absolute;
	left: -1000px;
	top: 0;
	transition: left 0.6s ease;
	z-index: 999;
	background-color: rgba(0,0,0,.80);
	-moz-box-shadow: 3px 0 12px rgba(0,0,0,.25);
	-webkit-box-shadow: 3px 0 12px rgba(0,0,0,.25);
	box-shadow: 3px 0 12px rgba(0,0,0,.25);
	outline: none;
	padding-right: 0px;
	padding-left: 10px;
	width: 19em;
	height: 98vh;
	color: white;
	font-size: 200%;
	overflow-y: scroll;
    }

    #navcontents a {
	color: #66BBDD;
    }

    #navcontents #main-menu-close {
	position: absolute;
	right: 0;
	top: 20px;
    }

    /* When it's targeted, transition it in from the left. */

    #navcontents:target, #navcontents[aria-expanded="true"] {
	left: 0px;
    }

    #navcontents:target a, #navcontents[aria-expanded="true"] a {
	color: #66BBDD;
    }

    #navcontents:target #main-menu-close,
    #navcontents[aria-expanded="true"] #main-menu-close {
	z-index: 1001;
    }

    @supports (position: fixed) {
	nav#index {
	    position: fixed;
	}
    }
}

.database {
    background-color: #f0f0f0;
    padding: 0.1em 0.5em 0.5em;
    border: 1px solid gainsboro;
}
.database p.disclaimer {
    font-size: 0.7em;
    width: 60%;
    margin: 4em auto 0px;
    text-align: center;
}
