:root {
    --color-pop-mute: #cc6750;
    --background-color: white;
    --color-soft: #636463;
    --color-pop-2: #825382
}

body {
    margin-top: 100px;
    font-family: 'gill_sans', sans-serif;
}

/* ==LAYOUT== */
.horizontal-split {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-around;
}

.content {
    margin: 0 30px;
    width: min(90ch, 70%);
}

.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* grid-column-gap: 20px; */
    /* gap: minmax(20px, 1fr); */
    grid-column-gap: 10%;
}

.one-column {
    grid-column: 1 / span 2;
    width: 50%;
    padding-right: 5%;
}

.right-column {
    margin-left: auto;
    padding-left: 5%;
    padding-right: 0;
}

h2.one-column {
    width: 100% !important;
}

.goto-top {
    grid-column: 1 / span 2;
}

/* ==METADATA== */
#metadata {
    margin-top: 20px;
    /* margin-left: 10px; */
    margin: 20px 0px 20px 10px;
    max-width: 100ch;

    font-size: 14pt;
    font-weight: 300;
    font-family: 'psl_ornanong_pro', sans-serif;
    line-height: 0.7;

    p {
        line-height: 0.7;
    }

    div > *:last-child {
        margin: 0;
        margin-left: 20px;
        display: block;
    }

    ul {
        list-style: none;
        padding: 0;
    }

    li {
        display: inline-block;
        margin-right: 12px;
    }

    strong {
        font-weight: 600;
        color: var(--color-pop-mute);
    }
}

/* ==ABSTRACT== */
.abstract {
    width: 100%;
    margin-top: 64px;
}

.abstract p:first-of-type {
    border-top: 1px solid var(--highlight-color);
    padding-top: 0.5rem;
}

.abstract p:last-of-type {
    /* background-color: red; */
    border-bottom: 1px solid var(--highlight-color);
    padding-bottom: 0.5rem;
}

/* ==BLOCK QUOTES== */
blockquote {
    grid-column: 1 / span 2;
    width: 50%;
    margin: 100px auto;

    font-size: 16pt;

    cite {
        display: block;
        text-align: right;
    }
}

/* ==INDEX== */
/* leave some space between top and clicked header */
html {
    scroll-padding-top: 100px;
}

.index {
    position: sticky;
    top: 100px;
    right: 20px;
    width: 300px;
    height: fit-content;
    text-align: right;

    max-height: 80vh;
    overflow: auto;

    font-size: 8pt;

    background-color: var(--background-color);
}

.index h2 {
    margin-left: auto;
    margin-bottom: 0.2rem;
    width: 100px;
    padding-top: 1px;

    color: var(--color-pop-mute);
    background: var(--highlight-color);
    font-weight: 600;
}

#index-list {
    list-style: none;
}

.index a {
    text-decoration: none;
    color: var(--color-soft);
}

.index-chapter {
    margin: 30px 0;
    font-weight: 600;
}

.index-chapter h3 {
    color: var(--color-pop-mute);
}

/* --index highlighting-- */
.index a.active {
    color: var(--color-pop-2);
    font-weight: 600;
}

.index a.active h3 {
    color: var(--color-pop-bright);
}

/* ==REFERENCE LIST== */
.reference-section {
    margin: 150px max(30px, 5%) 30px max(30px, 5%);
    width: 90%;

    font-size: 10pt;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: break-word;

    /* h2::before {
        content: '▶';
        position: absolute;
        left: 0;
        top: 0;
        transform: scale(0.5) rotate(90deg);
        transition: transform 0.3s ease;
    } */

    #reference-title svg {
        transform: rotate(90deg);
        transition: transform 0.3s ease;
    }

    #reference-title {
        display: flex;
        align-items: center;
        gap: 0.7em;

        margin-bottom: 1.5em;
    }

    ol {
        padding-left: 0;
    }

    li {
        margin-left: 40px;
    }

    h3 {
        margin: 1em 0 0.5em;
    }

    h3::before {
        content: none;
    }

}

.reference-section.closed {
    ul, ol {
        display: none !important;
    }
}

.reference-section.closed #reference-title svg {
    transform: rotate(0deg);
}

/* ==TYPOGRAPHY== */
.content {
    h1, h2, h3 {
        margin-bottom: 1em;
        font-weight: 600;
    }

    h1, h2 {
        font-size: 21pt;
    }

    h3 {
        font-size: 14pt;
    }

    h3.one-column {
        margin-top: 4rem;
    }

    h2 {
        margin-top: 10rem;
        padding-top: 1rem;
        padding-bottom: 0.5rem;
        position: sticky;
        top: 0;
        z-index: 20;

        /* background-color: var(--background-color); */
        text-shadow:
                2px 2px 0 white,  /* Bottom-right */
                -2px 2px 0 white, /* Bottom-left */
                2px -2px 0 white, /* Top-right */
                -2px -2px 0 white, /* Top-left */
                2px 0 0 white,    /* Right */
                -2px 0 0 white,   /* Left */
                0 2px 0 white,    /* Bottom */
                0 -2px 0 white;   /* Top */
        color: var(--color-pop-bright);

        scroll-margin-top: 100rem;
    }

    p {
        margin-bottom: 1.2rem;

        font-family: 'psl_ornanong_pro', sans-serif;
        font-size: 10pt;
        font-size-adjust: 0.5;
        line-height: 19pt;

        strong {
            font-weight: 600;
        }
    }

    .indent {
        margin-left: 30px;
    }

    .poem {
        font-style: italic;

        p {
            padding-bottom: 1.4rem;
        }
    }

    ul {
        font-family: 'psl_ornanong_pro', sans-serif;
        font-size: 14pt;
        list-style-type: square;
    }

    sup {
        vertical-align: top;
        line-height: 1.1;
        font-size: 0.7em;
    }

}

/* ==MEDIA== */
figure div img{
    width: 50%;
    max-width: 200px;
}

.img-big {
   margin: 30px 0;
}

.img-small {
    margin: auto 0;
}

figcaption {
    font-size: 11pt;
    font-family: 'psl_ornanong_pro', sans-serif;
    margin-left: 10px;
}

figure > div {
    display: flex;
}

/* ==IMAGE ZOOM ANIMATION== */
.content img {
    position: relative;
    transition: transform 0.2s ease;
    cursor: crosshair;
}

.content img:hover {
    transform: scale(2.5);
    z-index: 30;
}

/* make left images open to the right */
.left img {
    transform-origin: left;
}

.img-big {
    transform-origin: top left;
}

/* ==GOTO TOP== */
div.goto-top {
    text-align: right;
}

div.goto-top a {
    text-decoration: none;
    color: var(--color-soft);
}

/* ==DEFINITIONS== */
.definition {
    position: relative;

    dfn {
        cursor: help;
        font-style: normal;
        text-decoration: underline;
        text-decoration-style: dotted;
    }

}

.definition:hover .popup,
.definition.touched .popup {
    display: block;
}

.popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;

    max-width: 300px;
    width: max-content;
    word-wrap: break-word;
    overflow-wrap: break-word;

    padding: 5px;
    background-color: var(--background-color);
    border: 1px solid var(--color-soft);
    box-shadow: 1px 1px 8px #aaa
}

/* ==RESPONSIVE== */
@media (max-width: 768px) {
    body {
        margin-top: 20px;
    }

    .content {
        margin: 0 30px;
        width: 90%;
    }

    .content {
        h3 {

            margin-top: 4rem;
        }
    }

    .two-column {
        display: block;
    }

    .horizontal-split {
        flex-direction: column;
        align-items: flex-end;
    }

    .index {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        width: 100%;
        font-size: 10pt;
        z-index: 900;
        /* display: none; */
        /* width: 0; */
    }

    .one-column {
        grid-column: 1 / span 2;
        width: 100%;
        padding-right: 0;
    }

    .right-column {
        padding-left: 0;
    }

    blockquote {
        width: 90%;
    }

    figure > div {
        flex-direction: column;
    }

    .content img {
        cursor: inherit;
    }

    /* --index colapsing-- */
    .index.closed {
        background: transparent;
    }

    .closed {
        ul, ol {
            display: none !important;
        }
    }

}

@media (hover: none), (pointer: coarse) {
    .content img:hover {
        transform: scale(1);
        z-index: auto;
    }

    .popup {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
}
