/* FONTS */
@font-face {
    font-family: "Pretendard";
    font-weight: 400;
    font-display: swap;
    src: local("Pretendard Regular"), url("https://unpkg.com/pretendard@1.2.2/dist/web/static/woff2/Pretendard-Regular.woff2") format("woff2"),
        url("https://unpkg.com/pretendard@1.2.2/dist/web/static/woff/Pretendard-Regular.woff") format("woff");
}

@font-face {
    font-family: "Pretendard";
    font-weight: 700;
    font-display: swap;
    src: local("Pretendard Bold"), url("https://unpkg.com/pretendard@1.2.2/dist/web/static/woff2/Pretendard-Bold.woff2") format("woff2"),
        url("https://unpkg.com/pretendard@1.2.2/dist/web/static/woff/Pretendard-Bold.woff") format("woff");
}

/* ANIMATION */
@keyframes rotation {
    0% {
        transform: rotate(0deg);
    } 100% {
        transform: rotate(360deg);
    }
} 

/* LAYOUT */
body {
    margin: 0;
    font-family: Pretendard;
    line-height: 1.75;
}

body,
.nav-wrapper,
.footer-wrapper {
    background-color: whitesmoke;
}

nav,
footer {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
}

nav {
    display: flex;
    justify-content: space-between;
}

nav h1 {
    margin: 0;
}

footer p {
    margin: 0;
}

.main-wrapper {
    background-color: white;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* BASIC ELEMENTS */
a {
    color: #485fc7;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a.not-exist {
    color: red;
}

a.external {
    color: forestgreen;
}

a.external::before {
    padding: 0 0.1rem;
    background: forestgreen;
    color: white;
    font-weight: bold;
    content: "外";
}

code {
    padding: 0.2rem;
    background-color: gainsboro;
}

main del,
.footnote-modal del {
    color: lightgray;
}

main del:hover
.footnote-modal del:hover {
    color: darkgray;
    text-decoration: none;
}

hr {
    border: none;
    border-top: 0.15rem solid;
    border-radius: 1rem;
    opacity: 0.1;
}

main img.wiki,
main iframe {
    max-width: 100% !important;
}

.quote {
    width: fit-content;
    margin: 1rem 0;
    padding: 1rem;
    background-color: whitesmoke;
    border-radius: 0.75rem;
}

.table-wrapper {
    display: block;
    overflow-x: auto;
}

table {
    max-width: 100%;
    background-color: whitesmoke;
    border-collapse: collapse;
}

table tr td {
    padding: 0.313rem 0.625rem;
    border: 1px solid gainsboro;
}

summary {
    cursor: pointer;
    text-decoration: none;
}

summary:hover {
    text-decoration: underline;
}

/* INTERFACE */
#search-form {
    display: flex;
    grid-column-gap: 0.2rem;
}

.article-tools {
    max-width: 900px;
    margin: 0 auto -2.5rem;
    padding: 1.5rem 1.5rem 0;
    text-align: right;
}

.article-tools a {
    margin-right: 1rem;
    padding: 0.5rem 1rem;
    background-color: white;
    border: 1px solid gainsboro;
    border-radius: 2rem;
}

.article-tools a:hover {
    background-color: whitesmoke;
    text-decoration: none;
}

.article-tools .xref::before {
    content: '☈ ';
    font-weight: bold;
}

.article-tools .back::before {
    content: '‹ ';
    font-weight: bold;
}

.loader {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: 0.5em;
    border: 0.15em solid currentColor;
    border-bottom-color: transparent;
    border-radius: 50%;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

main > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem 1rem;
    margin-bottom: 2rem;
    border: 1px solid gainsboro;
    border-radius: 0.75rem;
    box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.1);
}

.last-modified {
    font-size: 0.8rem;
}

.last-modified p {
    margin: 0;
}

.wikiTitle {
    margin: 0;
}

.redirect::before {
    opacity: 0.25;
    content: "➤";
}

.toc .toc-indent:not(.toc > .toc-indent) {
    margin-left: 1.5rem;
}

.toc .toc-item {
    display: list-item;
    list-style: none;
}

.wikiFolding dd {
    margin: 0;
}

.category {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    margin-top: 2rem;
    border: 1px solid gainsboro;
    border-radius: 0.75rem;
    box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.1);
}

.category h2 {
    margin: 0;
}

.category ul {
    margin: 0.5rem 0;
}

.wikiFootnote {
    font-size: 0.8em;
    vertical-align: text-bottom;
}

.footnote-modal {
    --box-shadow-color: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    grid-row-gap: 1.5rem;
    width: -webkit-fill-available;
    max-width: 450px;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 1.5rem 2rem;
    background-color: white;
    border: 1px solid gainsboro;
    box-shadow: 0 0 1rem var(--box-shadow-color);
    color: black;
    font-size: 1rem;
    text-align: center;
}

.modal-header {
    text-align: right;
}

.footnote-list {
    display: list-item;
    list-style: none;
}

iframe[src^="https://facilmap.org/#q="] {
    height: 50vh !important;
}

@media (prefers-color-scheme: dark) {
    /* LAYOUT */
    body {
        color: #ddd;
    }

    body,
    .nav-wrapper,
    .footer-wrapper {
        background-color: #333;
    }

    .main-wrapper {
        background-color: #222;
    }

    /* BASIC ELEMENTS */
    a {
        color: #748aec;
    }

    code {
        background-color: #444;
    }

    main del,
    .footnote-modal del {
        color: #555;
    }

    main del:hover,
    .footnote-modal del:hover {
        color: gray;
        text-decoration: none;
    }

    .quote {
        background-color: #444;
    }
    
    table {
        background-color: #333;
    }

    table tr td {
        border-color: gray;
    }

    table.wiki[style*="background-color:#fff"],
    table.wiki [style*="background-color:#fff"] {
        background-color: #333 !important;
    }

    /* INTERFACE */
    .article-tools a {
        background-color: #222;
        border-color: gray;
    }

    .article-tools a:hover {
        background-color: #333;
    }
    
    main > div:first-child,
    .category {
        border-color: gray;
    }

    .footnote-modal {
        --box-shadow-color: rgba(255, 255, 255, 0.2);
        background-color: #222;
        border-color: #444;
        color: #ddd;
    }
}
