/* A Bottle of Wiki — personal wiki
 * SPDX-License-Identifier: AGPL-3.0-or-later
 * Copyright (C) 2020  Benoît Monin <benoit.monin@gmx.fr>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

/* min size for the editor */
textarea#editor_text {
    min-height: 15rem;
}

/* keep the toolbar visible */
div#editor_toolbar {
    position: sticky;
    top: 3.5rem;
    z-index: 1000;
}

/* smaller text in the toolbar menu */
div#editor_toolbar_menu {
    font-size: 0.875rem;
    line-height: 1.1rem;
}

/* make the headings stand a bit more */
.abow_view h2,
.abow_view h3,
.abow_view h4,
.abow_view h5,
.abow_view h6 {
    margin-top: 1.25rem;
    font-weight: bold;
}

/* make the paragraph title visible when following the anchor link */
.abow_view > h2[id]:target::before,
.abow_view > h3[id]:target::before,
.abow_view > h4[id]:target::before,
.abow_view > h5[id]:target::before {
    display: block;
    height: 4rem;
    margin-top: -4rem;
    content: "";
}

/* permalink */
a.permalink {
    font-size: 80%;
    color: var(--gray);
    opacity: 0;
    position: relative;
    top: -0.1rem;
    transition: all 0.15s linear;
}
a.permalink:hover {
    text-decoration: none;
    color: var(--primary);
}
:hover > a.permalink {
    padding-left: 0.6rem;
    opacity: 80%;
}
.abow_view a.permalink::after {
    content: "";
}

/* always visible toc */
.abow_toc {
    position: sticky;
    overflow-y: auto;
    top: 4.5rem;
    height: calc(100vh - 5.5rem);
}

/* style for the toc */
div.toc {
    border-left: 1px solid #dee2e6;
}
div.toc ul {
    padding-left: 0rem;
    margin: 0.1rem;
    list-style: none;
}
div.toc li {
    padding-left: 1rem;
    font-size: .875rem;
}
div.toc a {
    display: block;
    padding: 0.15rem 0;
    color: var(--gray);
}
div.toc a:hover {
    color: var(--blue);
    text-decoration: none;
}

/* style of the wiki page view */
.abow_view a::after {
    content: "\2197";
}
.abow_view a.wikilink::after {
    content: "";
}
.abow_view blockquote {
    border-width: 0 0 0 0.2rem;
    border-color: #dee2e6;
    border-style: solid;
    padding-left: 1rem;
    margin-left: 0.2rem;
}
.abow_view pre {
    border: 0;
}
.abow_view td,
.abow_view th {
    padding: .5rem .75rem;
}
.abow_view dd {
    margin-left: 2.5rem;
}

/* code block */
div.highlight {
    background-color: var(--light);
    border-radius: 0.25rem;
}

/* admonitions, insipred by bootstrap documentation callouts */
div.admonition {
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    border: 1px solid #eee;
    border-left-width: .25rem;
    border-radius: .25rem;
}
div.admonition.attention {
    border-left-color: var(--info);
}
div.admonition.caution {
    border-left-color: var(--warning);
}
div.admonition.danger {
    border-left-color: var(--danger);
}
div.admonition.error {
    border-left-color: var(--danger);
}
div.admonition.hint {
    border-left-color: var(--green);
}
div.admonition.important {
    border-left-color: var(--info);
}
div.admonition.note {
    border-left-color: var(--info);
}
div.admonition.tip {
    border-left-color: var(--green);
}
div.admonition.warning {
    border-left-color: var(--warning);
}
p.admonition-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    font-weight: 500;
}
div.admonition p:last-child {
    margin-bottom: 0;
}

/* tasklists */
.task-list-item {
    list-style-type: none !important;
}
.task-list-control {
    position: relative;
    display: inline-block;
}
.task-list-control input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    z-index: -1;
}
.task-list-indicator {
    position: absolute;
    top: -0.375rem;
    left: -1.125rem;
    display: block;
    width: 1rem;
    height: 1rem;
    border: 0.0675rem solid #aeb2b6;
    border-radius: .25rem;
}
.task-list-control input[type="checkbox"]:checked + .task-list-indicator::before {
    display: block;
    margin-top: -0.25rem;
    margin-left: 0;
    font-size: 1.25rem;
    line-height: 1;
    content: "✔";
    color: var(--dark);
}

/* footnotes */
a.footnote-ref::after {
    content: "";
}
a.footnote-backref::after {
    content: "";
}
div.footnote > hr {
    margin-top: 3rem;
}

/* tabbed blocks */
.tabbed-set {
    display: flex;
    position: relative;
    flex-wrap: wrap;
    border: 1px solid #eee;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}
.tabbed-set > .tabbed-content {
    display: none;
    order: 99;
    width: 100%;
    padding: 1rem 0.5rem 0;
    border-top: #eee solid 1px;
}
.tabbed-set > label {
    width: auto;
    margin: 0;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--primary);
}
.tabbed-set > input {
    position: absolute;
    opacity: 0;
    z-index: -1;
}
.tabbed-set input:nth-child(n+1):checked + label {
    border-bottom: #eee solid 0.2rem;
    font-weight: bold;
    color: var(--dark);
}
.tabbed-set input:nth-child(n+1):checked + label + .tabbed-content {
    display: block;
}
@media print {
    .tabbed-set {
        display: block;
    }
    .tabbed-set > .tabbed-content {
        display: block;
    }
    .tabbed-set > label {
        border-bottom: #eee solid 0.2rem;
        font-weight: bold;
        color: var(--dark);
    }
}

/* line numbers for code blocks */
[data-linenos]:before {
    content: attr(data-linenos);
    color: var(--gray);
    margin: 0 0.25rem;
    padding-left: 0.25rem;
    display: inline-block;
    border-right: 1px solid #dee2e6;
}
span.lineno.special:before {
    background-color: #ddd;
}
