@font-face {
  font-family: 'NotoSans';
  src: url(/static/fonts/NotoSans-VariableFont_wdth,wght.ttf);
  font-display: swap;
}

@font-face {
  font-family: 'NotoSansCJK';
  src: url(/static/fonts/NotoSansCJK-VF.otf.ttc);
  font-display: swap;
}

@font-face {
  font-family: 'PlanGothicP1';
  src: url(/static/fonts/PlangothicP1-Regular.woff2);
  font-display: swap;
}

@font-face {
  font-family: 'PlanGothicP2';
  src: url(/static/fonts/PlangothicP2-Regular.woff2);
  font-display: swap;
}

:root {
  --frame-color: hsl(90, 10%, 50%);
  --paper-color: hsl(40, 100%, 98%);
  --cell-color: hsl(40, 100%, 98%);
  --text-color: hsl(90, 10%, 20%);
  --shadow-color: hsla(90, 20%, 30%, 30%);
  --border-color: hsl(90, 10%, 60%);
  --button-color: hsl(90, 30%, 40%);
  --link-color: hsl(30, 100%, 35%);
  --table-header-color: hsl(90, 20%, 80%);
  --tag-color: hsl(40, 90%, 45%);
}

html {
  background-color: var(--frame-color);
}

body {
  width: 1024px;
  margin: auto;
  font-family: sans-serif, 'NotoSans', 'NotoSansCJK', 'PlanGothicP1', 'PlanGothicP2';
  background-color: var(--paper-color);
  color: var(--text-color);
}

@media screen and (max-width: 1023px) {
  body {
    width: 100%;
  }
}

#header {
  position: fixed;
  z-index: 1;
  top: 0px;
  width: 100%;
  height: 60px;
  max-width: 1024px;
  background-color: var(--paper-color);
  box-shadow: 0px 10px 10px var(--shadow-color);
}

#header-logo {
  position: absolute;
  top: 0px;
  left: 15px;
  height: 60px;
}

#header-search {
  display: flex;
  position: absolute;
  right: 10px;
  top: 12.5px;

  input {
    background-color: var(--cell-color);
    border: solid 1px var(--border-color);
    width: 180px;
    height: 35px;
    vertical-align: middle;
    font-size: 1.0em;
  }

  input {
    font-family: inherit;
  }

  input:focus {
    outline: 0px;
  }

  input::placeholder {
    color: var(--border-color);
    position: relative;
    top: 0px;
    left: 2px;
  }

  button {
    background-color: var(--button-color);
    color: var(--paper-color);
    border: 0px;
    width: 60px;
    height: 35px;
    vertical-align: middle;
    font-size: 1.0em;
  }

  button:hover {
    cursor: pointer;
    filter: brightness(125%);
  }
}

#content {
  margin-top: 60px;
  padding: 10px;
}

@media screen and (max-width: 399px) {
  #header {
    height: 105px;
  }

  #header-search {
    top: 57.5px;
  }

  #content {
    margin-top: 105px;
  }
}

p {
  content-visibility: auto;
  contain-intrinsic-size: 0 1.0em;
}

h1 {
  border-bottom: solid 1px var(--border-color);
  padding-bottom: 5px;
  margin-top: 10px;
}

h2 {
  border-bottom: solid 1px var(--border-color);
  margin-top: 20px;
  margin-bottom: 10px;
  padding-bottom: 5px;
}

h3 {
  margin-top: 0px;
  margin-bottom: 0px;
}

h4 {
  margin-top: 15px;
  margin-bottom: 10px;
}

ul, ol {
  margin-top: 0px;
  margin-bottom: 0px;

  li {
    margin-top: 5px;
    margin-bottom: 5px;

    p {
      margin-top: 0px;
      margin-bottom: 0px;
    }
  }
}

a {
  color: var(--link-color);
  text-decoration: none;

  img.plaintext {
    /* https://angel-rs.github.io/css-color-filter-generator/ */
    filter: brightness(0) saturate(100%) invert(29%) sepia(68%) saturate(2999%) hue-rotate(30deg) brightness(96%) contrast(105%);
  }
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.1em;
  filter: brightness(125%);

  img.plaintext {
    border-bottom-color: var(--link-color);
  }
}

a.self-link {
  color: var(--text-color);
  font-weight: bold;

  img.plaintext {
    filter: none;
  }
}

a.self-link:hover {
  cursor: text;
  text-decoration: none;
  filter: none;

  img#header-logo {
    cursor: pointer;
    filter: brightness(125%);
  }

  img.plaintext {
    border-bottom-color: transparent;
  }
}

a[target="_blank"]::after {
  content: '\f08e';
  font-family: 'Font Awesome 7 Free';
  font-weight: 900;
  margin-left: 2.5px;
}

#index-top {
  text-align: center;
}

#index-logo {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-top: 80px;
  margin-bottom: 80px;
  width: 120px;
}

.news-date {
  font-weight: bold;
}

.news-content {
  padding-bottom: 5px;
  margin-bottom: 10px;
  border-bottom: solid 1px var(--border-color);
}

ul.kanji-table {
  padding-left: 0px;

  li {
    list-style-type: none;
    display: inline-block;
    width: calc(100% / 10 - 2px);
    height: 50px;
    text-align: center;
    font-size: 2.0em;
    border: solid 1px var(--border-color);

    p {
      display: inline;
      margin-top: 0px;
      margin-bottom: 0px;
    }
  }
}

@media screen and (max-width: 449px) {
  ul.kanji-table li {
    width: calc(100% / 5 - 2px);
  }
}

#tooltip {
  z-index: 2;
  visibility: hidden;
  position: absolute;
  width: 600px;
  max-width: calc(100% - 52px);
  padding-left: 15px;
  padding-right: 15px;
  padding-top: 15px;
  padding-bottom: 5px;
  background-color: var(--cell-color);
  border: solid 1px var(--border-color);
  box-shadow: 10px 10px 10px var(--shadow-color);
}

.keyword {
  text-decoration: underline dotted 1px var(--text-color);
  text-underline-offset: 2.5px;
}

.glyph-count {
  font-size: 1.5em;
  font-weight: bold;
  color: var(--link-color);
}

summary {
  margin-top: 20px;

  h3 {
    display: inline-block;
  }
}

figure {
  img {
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-top: 20px;
    margin-bottom: 10px;
    max-width: 100%;
  }

  figcaption {
    text-align: center;
  }
}

ul.kanken-glyph {
  padding-left: 0px;
  margin-top: -5px;
  margin-bottom: 5px;

  li {
    list-style-type: none;
    display: inline-block;
    text-align: center;
    font-size: 2.5em;

    p {
      display: inline;
      margin-top: 2.5px;
      margin-bottom: 2.5px;
      margin-right: 25px;
    }
  }
}

ul.link-list {
  margin-top: 5px;
  margin-bottom: 5px;
  padding-left: 10px;

  li {
    list-style-type: none;
    display: inline-block;

    p {
      display: inline;
      margin-top: 2.5px;
      margin-bottom: 2.5px;
      margin-right: 7.5px;
    }
  }
}

ul.glyph-image-table {
  padding-left: 0px;
  margin-top: 5px;
  margin-bottom: 5px;

  li {
    list-style-type: none;
    display: inline-block;
    width: 123px;
    border: solid 1px var(--border-color);
    text-align: center;

    p.header {
      display: block;
      height: 38px;
      line-height: 38px;
      margin: auto;
      font-weight: bold;
      border-bottom: solid 1px var(--border-color);
      background-color: var(--table-header-color);
    }

    img.glyph-image {
      display: block;
      margin-left: auto;
      margin-right: auto;
      margin-top: 10px;
      margin-bottom: 0px;
      height: 60px;
    }

    p.footer {
      display: inline;
      height: 39px;
      line-height: 39px;
      margin-top: 0px;
      margin-bottom: 0px;
    }
  }
}

ul.variant-table {
  padding-left: 0px;
  margin-top: 5px;
  margin-bottom: 5px;

  li {
    list-style-type: none;
    display: inline-block;
    width: 123px;
    border: solid 1px var(--border-color);
    text-align: center;

    p.variant {
      display: block;
      height: 79px;
      line-height: 79px;
      margin-top: -5px;
      margin-bottom: -10px;
      font-family: 'NotoSansCJK';
      font-size: 3.0em;
    }

    p.footer {
      display: inline;
      height: 39px;
      line-height: 39px;
      margin-top: 0px;
      margin-bottom: 0px;
    }
  }
}

table {
  border-collapse: collapse;
  transform-origin: top left;
}

th {
  padding-left: 10px;
  padding-right: 10px;
  border: solid 1px var(--border-color);
  background-color: var(--table-header-color);
  white-space: nowrap;

  p {
    margin-top: 5px;
    margin-bottom: 5px;
  }
}

td {
  padding-left: 10px;
  padding-right: 10px;
  border: solid 1px var(--border-color);
  background-color: var(--cell-color);
  white-space: nowrap;

  p {
    margin-top: 5px;
    margin-bottom: 5px;
  }
}

td.a-l {
  text-align: left;
}

td.a-c {
  text-align: center;
}

td.a-r {
  text-align: right;
}

td.a-t {
  vertical-align: top;
}

td.a-m {
  vertical-align: middle;
}

td.a-b {
  vertical-align: bottom;
}

.kanji-header {
  font-size: 1.5em;
  margin-right: 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-left: solid 10px var(--border-color);
  border-right: solid 10px var(--border-color);
}

.tag {
  margin-right: 2.5px;
  padding-left: 7.5px;
  padding-right: 7.5px;
  border-radius: 15px;
  background-color: var(--tag-color);
  color: var(--paper-color);
  font-weight: normal;
}

.number {
  margin-right: 2.5px;
  padding-left: 7.5px;
  padding-right: 7.5px;
  border-radius: 5px;
  background-color: var(--tag-color);
  color: var(--paper-color);
  font-weight: normal;
}

img.plaintext {
  height: 1.0em;
  transform: translateY(0.2em);
  border-bottom: solid 0.1em transparent;
}

.unicode-previous {
  float: left;
}

.unicode-next {
  float: right;
}

#footer {
 height: 60px;
  border-top: solid 1px var(--border-color);
  text-align: center;
}
