/*
 * Copyright (C) 2016-2020  Alex Yatskov <alex@foosoft.net>
 * Author: Alex Yatskov <alex@foosoft.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the entrys of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */


/*
 * Fonts
 */

@font-face {
    font-family: kanji-stroke-orders;
    src: url('/mixed/ttf/kanji-stroke-orders.ttf');
}

/*
 * General
 */

html:root[data-yomichan-page=float]:not([data-yomichan-theme]),
html:root[data-yomichan-page=float]:not([data-yomichan-theme]) body {
    background-color: transparent;
}

:root {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.42857143; /* 14px => 20px */
}

body {
    margin: 0;
    border: 0;
    padding: 0;
    overflow-y: scroll; /* always show scroll bar */
}

ol, ul {
    margin-top: 0;
    margin-bottom: 0.72em;
}

#spinner {
    position: fixed;
    z-index: 1;
    right: 0.36em;
    bottom: 0.36em;
}

#spinner>img {
    width: 2.28571428em; /* 14px => 32px */
    height: 2.28571428em; /* 14px => 32px */
}

.invisible {
    visibility: hidden;
}

/*
 * Navigation
 */

.navigation-header {
    top: 0;
    left: 0;
    width: 100%;
    height: 2.1em;
    box-sizing: border-box;
    padding: 0.25em 0.5em;
    border-bottom-width: 0.07142857em; /* 14px => 1px */
    border-bottom-style: solid;
}

html:root[data-yomichan-page=search] .navigation-header {
    position: sticky;
}

html:root[data-yomichan-page=float] .navigation-header {
    position: fixed;
}

html:root[data-yomichan-page=float] .navigation-header:not([hidden])~.navigation-header-spacer {
    height: 2.1em;
}

.navigation-header-actions {
    display: flex;
}

.navigation-header:not([data-has-previous=true]) .navigation-header-actions .action-previous>img,
.navigation-header:not([data-has-next=true]) .navigation-header-actions .action-next>img {
    opacity: 0.25;
    -webkit-filter: grayscale(100%);
    filter: grayscale(100%);
}

.action-next>img {
    transform: scaleX(-1);
}


/*
 * Search page
 */

.icon-checkbox {
    display: none;
}

.icon-checkbox+label {
    cursor: pointer;
    font-size: 1.6em;
    padding: 0.1em;
    user-select: none;
}

#query-parser-content {
    margin-top: 0.5em;
    font-size: 2em;
}

#query-parser-content[data-term-spacing=true] .query-parser-term {
    margin-right: 0.2em;
}

html:root[data-yomichan-page=search][data-search-mode=popup] .search-input {
    display: none;
}


/*
 * Entries
 */

.entry {
    padding-top: 0.72em;
    padding-bottom: 0.72em;
}

html:root[data-yomichan-page=float] .entry {
    padding-left: 0.72em;
    padding-right: 0.72em;
}

.actions .disabled {
    pointer-events: none;
    cursor: default;
}

.actions .disabled img {
    -webkit-filter: grayscale(100%);
    filter: grayscale(100%);
    opacity: 0.25;
}

.actions .pending {
    visibility: hidden;
}

.actions {
    display: flex;
    float: right;
    margin: -0.25em;
}

.actions:after {
    clear: both;
    content: '';
    display: block;
}

.action-button {
    display: inline-block;
    border: 0;
    margin: 0;
    padding: 0.3em;
    background: transparent;
    font-size: inherit;
}

button.action-button {
    cursor: pointer;
}

.icon-image {
    width: 1.14285714em; /* 14px => 16px */
    height: 1.14285714em; /* 14px => 16px */
    display: block;
}

.term-expression .kanji-link {
    border-bottom-width: 0.03571428em; /* 28px => 1px */
    border-bottom-style: dashed;
    text-decoration: none;
}

.entry:not(.entry-current) .current {
    display: none;
}

.tag {
    display: inline-block;
    padding: 0.2em 0.6em 0.3em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25em;
}

.tag-inner {
    display: block;
}

.tag-list>.tag:not(:last-child) {
    margin-right: 0.375em;
}

html:root:not([data-enable-search-tags=true]) .tag[data-category=search] {
    display: none;
}

.entry-header2,
.entry-header3 {
    display: inline;
}

.term-frequency-separator::before {
    content: ":";
}

.entry+.entry {
    border-top-width: 0.07142857em; /* 14px => 1px */
    border-top-style: solid;
}

.entry[data-type=term][data-expression-multi=true] .actions>.action-play-audio {
    display: none;
}

.term-reasons {
    display: inline-block;
}

.term-reasons>.term-reason+.term-reason-separator+.term-reason:before {
    content: " \00AB  "; /* The two spaces is not a typo */
    white-space: pre-wrap;
    display: inline;
}

.term-expression-list {
    display: inline-block;
}

.term-expression {
    display: inline-block;
}

.term-expression-text {
    display: inline-block;
    font-size: 2em;
}

.term-expression-details {
    display: inline;
}

.term-expression-details>.action-play-audio {
    display: none;
}

.term-expression-details>.tags {
    display: inline;
}

.term-expression-details>.frequencies {
    display: none;
}

.term-expression-list>.term-expression:not(:last-of-type):after {
    font-size: 2em;
    content: "\3001";
}

.term-expression-list[data-multi=true]>.term-expression:last-of-type:after {
    font-size: 2em;
    content: "\3000";
    visibility: hidden;
}

.term-expression-list[data-multi=true] .term-expression-details {
    display: inline-block;
    position: relative;
    width: 0;
    height: 0;
    visibility: hidden;
}

.term-expression-list[data-multi=true] .term-expression:hover .term-expression-details {
    visibility: visible;
}

.term-expression-list[data-multi=true] .term-expression-details>.action-play-audio {
    position: absolute;
    left: 0;
    bottom: 0.5em;
}

.term-expression-list[data-multi=true] .term-expression-details>.action-play-audio {
    display: block;
}

.term-expression-list[data-multi=true] .term-expression-details>.tags {
    display: block;
    position: absolute;
    left: 0;
    bottom: -0.5em;
    white-space: nowrap;
}

.term-expression-list[data-multi=true] .term-expression-details>.frequencies {
    display: block;
    position: absolute;
    left: 0;
    bottom: -1.9em;
    white-space: nowrap;
}

.term-definition-list {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

.term-definition-list:not([data-count="0"]):not([data-count="1"]) {
    padding-left: 1.4em;
    list-style-type: decimal;
}

.term-glossary-list {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

.term-glossary-list:not([data-count="0"]):not([data-count="1"]) {
    padding-left: 1.4em;
    list-style-type: circle;
}

.term-definition-only-list[data-count="0"] {
    display: none;
}

.term-definition-only-list:before {
    content: "(";
}

.term-definition-only-list:after {
    content: " only)";
}

.term-definition-only+.term-definition-only:before {
    content: ", ";
}

.debug-info {
    display: none;
}

:root[data-debug=true] .debug-info {
    display: block;
}

:root[data-anki-enabled=false] .action-view-note,
:root[data-anki-enabled=false] .action-add-note {
    display: none;
}

:root[data-audio-enabled=false] .action-play-audio {
    display: none;
}

:root[data-compact-glossaries=true] .term-definition-tag-list,
:root[data-compact-glossaries=true] .term-definition-only-list:not([data-count="0"]) {
    display: inline;
}

:root[data-compact-glossaries=true] .term-glossary-list {
    display: inline;
    list-style: none;
    padding-left: 0;
}

:root[data-compact-glossaries=true] .term-glossary-list>li {
    display: inline;
}

:root[data-compact-glossaries=true] .term-glossary-list>li:not(:first-child):before {
    white-space: pre-wrap;
    content: " | ";
    display: inline;
}

.term-glossary-separator,
.term-reason-separator {
    display: inline;
    font-size: 0;
    opacity: 0;
    white-space: pre-wrap;
}

.term-special-tags>.frequencies {
    display: inline;
}


/*
 * Kanji
 */

.kanji-glyph {
    font-family: kanji-stroke-orders;
    font-size: 8.5em;
    line-height: 1;
    padding: 0.01em;
    vertical-align: top;
}

.kanji-glyph-data {
    margin-top: 0.75em;
    border-spacing: 0;
    border-collapse: collapse;
}

.kanji-glyph-data>tbody>tr>* {
    border-top-width: 0.07142857em; /* 14px => 1px */
    border-top-style: solid;
    text-align: left;
    vertical-align: top;
    padding: 0.36em;
    margin: 0;
}

.kanji-info-table {
    width: 100%;
}

.kanji-info-table>tbody>tr>th,
.kanji-info-table>tbody>tr>td {
    text-align: left;
    vertical-align: top;
    padding: 0;
    margin: 0;
}

.kanji-info-table>tbody>tr>td {
    text-align: right;
}

.kanji-glyph-data dl {
    margin-top: 0;
    margin-bottom: 1.4em;
}

.kanji-glyph-data dd {
    margin-left: 0;
}

.kanji-glossary-list {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

.kanji-glossary-list:not([data-count="0"]):not([data-count="1"]) {
    padding-left: 1.4em;
    list-style-type: decimal;
}