@import 'default.css';
@import 'theme.css';

/* ----- General ----- */
:root {
  --nav-height: 2.5rem;
}

html {
  scroll-padding-top: calc(var(--nav-height) + 0.5rem);
}

body {
  /* Chrome sets font-size to 75% (16px x 75% = 12px) */
  font-size: unset;
}

img {
  vertical-align: text-bottom;
}

article {
  padding: 2em;
  background-color: var(--bg);
}


/* ----- h1-h5 ----- */
h2 {
  color: var(--header);
  font-size: 2.5em;
  border-bottom: 1px solid var(--border);
  font-weight: normal;
}

h2:first-of-type {
  margin-top: 0;
}

h3 {
  font-size: 1.5em;
  font-weight: normal;
}

h4 {
  font-size: 1.2em;
}

h5 {
  font-size: 1em;
}

:not(h2) + h3 {
  margin-top: 1.5em;
}

:is(h1, h2, h3, h4, h5) span {
  color: var(--dim);
  font-size: 0.8em;
  font-style: italic;
  font-weight: normal;
  margin-left: 0.5em;
}
/* ----- /h1-h5 ----- */

p {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

pre {
  border-left: 3px solid #ccc;
  padding: 0.5em 1em;
}

code {
  padding: 0 0.3em;
  background-color: var(--hover);
  font-size: 1.1em;
}

blockquote {
  color: var(--color);
  padding: 1em 3.5em;
  font-style: italic;
  position: relative;
  font-size: 0.9em;
}

blockquote::before,
blockquote::after {
  color: #ccc;
  opacity: 0.6;
  font-size: 4em;
  position: absolute;
  content: '❝';
  top: 0;
  left: 0.1em;
}

blockquote::after {
  bottom: -0.5em;
  right: 0.5em;
}

cite {
  display: block;
  margin-top: 1em;
  color: #999;
}

cite::before {
  content: '— source: ';
}

img.figure {
  border-radius: 1em;
  border: 4px solid var(--nav-hover);
  width: 140px;
}

dt {
  font-size: 1.1em;
}

dd + dt {
  margin-top: 1em;
}

dd > dl {
  margin: 1em auto;
}

ol, ul {
  margin: 0;
}

th span,
dt span,
dd span,
li span {
  margin-left: 0.5em;
  color: var(--dim);
  font-style: italic;
  font-weight: normal;
  letter-spacing: normal;
  font-size: 0.9em;
}

mark {
  color: var(--header);
  background-color: unset;
}

.scroll {
  max-height: 25em;
  overflow: auto;
}

/* ----- About ----- */
.about dt {
  display: table;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.2em;
  min-width: 15vw;
  font-weight: bold;
}
/* ----- /About ----- */

/* ----- Navigation ----- */
nav {
  background-color: var(--bg);
  height: var(--nav-height);
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: 0 3px 6px #0004;
  display: grid;
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
}

nav a {
  color: var(--color);
  padding: 0.5em 1em;
}

nav a:hover {
  background-color: var(--hover);
}

/* ----- /Navigation ----- */

/* ----- Table ----- */
table {
  border-collapse: collapse;
  border: 1px solid var(--border);
  margin-bottom: 1em;
  width: calc(100% - 2.5rem);
  font-size: 0.9em;
}

caption {
  padding: 0.5em;
}

tr:nth-child(2n) {
  background-color: var(--alt-bg);
}

th,
td {
  border: 1px solid var(--border);
  vertical-align: top;
  padding: 0.5em;
}

thead th {
  font-size: 1.2em;
}

tbody th {
  min-width: 10em;
  text-align: left;
}

td pre,
.code td,
td.code {
  font-family: monospace;
  font-size: 1.2em;
}

.slim th,
.slim td {
  padding: 0.2em 0.5em;
}
/* ----- /Table ----- */

/* ----- note, footnote, warning, experimental ----- */
.note,
.warning {
  border: 1px solid var(--border);
  border-radius: 0.5em;
  border-left: 3px solid #17f;
  padding: 0.3em 0.5em 0.3em 2em;
  margin-top: 0.5em;
  position: relative;
  display: table;
}

.note::before,
.warning::before {
  content: 'ⓘ';
  color: #17f;
  position: absolute;
  top: 0;
  left: 0.5em;
}

.warning {
  border-left-color: #f90;
}

.warning::before {
  content: '⚠️';
}

.experimental::after {
  content: '';
  background: url('../image/beaker.svg') no-repeat center / contain;
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: 0.5em;
}

.footnote {
  font-size: 0.9em;
  font-style: italic;
}

/* ----- span links ----- */
.chrome-extension,
.moz-extension {
  cursor: pointer;
  font-style: normal;
  font-size: 0.8em;
  display: none;
}

/* ----- Translate ----- */
.translate {
  display: grid;
  grid-auto-flow: column;
  justify-content: end;
  align-items: center;
  gap: 0.5em;
  padding: 1em 1em 0;
  background-color: var(--bg);
}

.translate select {
  width: auto;
}

.translate input[type="submit"] {
  color: inherit;
  background-color: var(--alt-bg);
  border: 1px solid var(--border);
  border-radius: 0.3em;
  padding: 0.2em 0.5em;
}
/* ----- /Translate ----- */