* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --h1-size: 2.027rem;
    --h2-size: 1.802rem;
    --h3-size: 1.602rem;
    --h4-size: 1.424rem;
    --h5-size: 1.266rem;
    --h6-size: 1.125rem;
}

body {
    background: #fcf2e8 url(bg.png) fixed; 
    /*background: url(lace.png), url(bg.png) #fcf2e8;
    background-size: 400px, auto;
    background-repeat: repeat-x, repeat;
    background-position: top;
    background-attachment: scroll, fixed; */
    letter-spacing: 1px;
    font-family: "Nunito", "Kosugi Maru";
    font-size: 16px;
    line-height: 1.2rem;
    font-weight: 400;
    color: #9e847f;
    letter-spacing: 0.05rem;
}

#bg-lace-top {
    background: url(lace2.png);
    background-size: contain;
    background-repeat: repeat-x;
    height: 100px;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: -1;
}

#bg-lace-bottom {
    background: url(lace2.png);
    background-size: contain;
    background-repeat: repeat-x;
    height: 100px;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: -1;
    transform: rotate(180deg);
}

img {
    border: 0;
    border-radius: 4px;
}

#main {
    width: 90%;
    max-width: 680px;
    margin: 20px auto;
}

#left {
    float: left;
    width: 180px;
    margin: 0 auto;
}

#left-inner {
    padding: 4px;
    background: transparent;
}
#header-bow {
    display: block;
    margin: auto;

    &:hover {
        transform: rotate(5deg);
    }
}

#navigation {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
}

button {
    font-size: inherit;
    font-family: inherit;
    color: #E790A5;
    font-weight: 700;

    &.btn {
        filter: none;
    }
}

.btn {
    cursor: pointer;
    border-width: 8px;
    border-style: solid;
    border-image: url("bd2.png") 9 fill round;
    margin-bottom: 8px;
    padding: 2px 4px;
    filter: drop-shadow(0px 1px 0px #eed5cb);
    font-weight: 700;

    & a:not(.index-link) {
        text-decoration: none;
    }

    &.off {
        filter: grayscale(1);
        pointer-events: none;
    }

    &:hover {
        transform: translateY(1px);
        filter: none;
    }
}

#right {
    width: calc(100% - 180px);
    max-width: 500px;
    float: left;
    margin: 0 auto;
}

#right-inner {
    padding: 8px 8px 8px 16px;
}

.disclaimer {
    border-width: 8px;
    border-style: solid;
    border-image: url("bd2.png") 9 fill round;
    margin-top: 8px;
    margin-bottom: 12px;
    padding: 6px;
    filter: drop-shadow(0px 1px 0px #eed5cb);
    word-break: break-word;
}

#description {
    padding: 12px;
    margin-top: 0px;
}

.title {
    transform: translateZ(0); 
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ad9dc2;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 2px dotted #f1dbd1;
}

.post {
    position: relative;
    transform: translateZ(0); 
    border-width: 36px;
    border-style: solid;
    border-image: url(/resources/bd4.png) 50 fill round;
    border-image-repeat: round;
    background-color: white;
    background-clip: padding-box;
    margin-bottom: 8px;
    padding: 2px 0px 0px 0px;
    filter: drop-shadow(0px 1px 0px #eecbdf);

    & .title {
        display: flex;
        justify-content: space-between;
        column-gap: 12px;

        & .date {
            min-width: fit-content;
            align-self: flex-end;
        }

        & .subject {
            min-width: 0;
            overflow-wrap: anywhere;
        }
    }

    & .bows {
        display: flex;
        position: absolute;
        top: -16px;
        left: -20px;
        column-gap: 4px;
        
        & img {
            width: 20px;
        }
    }

    & img, & audio, & video, & iframe {
        max-width: 100%;

        &:has(+ p) {
            margin-block-end: 1rem;
        }
    }
}

p {
    margin-block-end: 0.5rem;

    &:has(+ img, + video, + iframe) {
        margin-block-end: 1rem;
    }
}

#navigation, #landpage-inner {
    & a:not(.index-link):not(:hover):visited {
        text-decoration: 2px underline rgba(231, 144, 165, 0.2);
        color: #E790A5;
    }
}

a:not(.index-link) {
    text-decoration: 2px underline rgba(231, 144, 165, 0.2);
    text-underline-offset: 2px;
    color: #E790A5;

    &:hover {
        color: #BD6A7E;
        text-decoration: 2px underline rgba(231, 144, 165, 0.4);
    }

    &:not(:hover):visited {
        color: #6f92aa;
        text-decoration: 2px underline rgba(111, 146, 170, 0.2);
    }

    &:focus, &:focus-visible, &:focus-within {
        outline: none;
    }
}

b {
    color: #ad9dc2;
}
em, i {
    color: #BD6A7E;
}

hr {
    border: none;
    border-top: 2px dotted #f1dbd1;
    margin: 16px 0px;
}



*::selection {
    background-color: #e4f0f7;
}

h1,h2,h3,h4,h5,h6 {
    color: #ad9dc2;
    margin-bottom: 12px;
}

h1 {
    font-size: var(--h1-size);
}
h2 {
    font-size: var(--h2-size);
}
h3 {
    font-size: var(--h3-size);
}
h4 {
    font-size: var(--h4-size);
}
h5 {
    font-size: var(--h5-size);
}
h6 {
    font-size: var(--h6-size);
}

blockquote {
    padding-left: 10px;
    border-left: 2px solid #ad9dc2;
    margin: 8px 0;
}

::-webkit-scrollbar-thumb {
    background-color: #fff;  
    border-radius: 20px;
    border:1px solid #e0c2b6;
}
  
::-webkit-scrollbar {
    width: 8px; 
    background: #fcf6ee;
}

#close-refs {
    position: absolute;
    right: 8px;
    top: 4px;
    color: #e0c2b6;

    &:hover {
        color: #9e847f;
        cursor: pointer;
    }
}

ul {
    line-height: 1.4rem;
    padding-left: 0.5rem;
    list-style-position: outside;

    & li {
        padding-left: 8px;

        &::marker {
        color: #E790A5;
        content: '•';
        
        }
    }
}

#filters, #index-list {
    padding-left: 2px;
}

#filters li {
    padding-left: 0;

    &:hover {
        color: #906faa;
        text-decoration: 2px underline rgba(111, 146, 170, 0.2);
        cursor: pointer;
    }

    & img {
        margin-right: 8px;
        display: inline;
        margin-bottom: -2px;
    }

    &::marker {
        color: transparent;
    }
}

#index-list li {
    line-height: 1.2rem;
    margin-bottom: 4px;
    color: #9e847f;
    padding-left: 0;

    & .index-link {
        color: #9e847f;
        text-decoration: none;

        &:hover {
            color: #906faa;
            text-decoration: 2px underline rgba(111, 146, 170, 0.2);
        }
    }

    &::marker {
        color: transparent;
    }
}

#index-toggle {
    & summary:hover {
        cursor: pointer;
    }

    & summary::-webkit-details-marker,
    & summary::marker {
        display: none;
        content: none;
    }

    & summary .title::after {
        content: ' >';
        position: absolute;
        top: 0px;
        right: 0px;
        color: #ad9dc2;
    }
    &[open] summary .title::after {
        content: " >";
        transform: rotate(90deg);
    }
}


@media (max-width: 520px) {
    #main {
        width: 90%;
    }
    #left, #right {
        float: none;
        width: 100%;
    }
    #right-inner {
        padding-right: 0;
        padding-left: 0;
        padding-top: 12px;
    }
    #navigation {
        justify-content: center;
        column-gap: 16px;
    }
    /*#references {
        position: absolute;
        left: 20px;
        top: 24px;
        padding-right: 20px;
        z-index: 99;
    }*/
    #left-container {
        display: flex;
        column-gap: 12px;
        flex-wrap: wrap;
        
        & > * {
            flex: 1 1 0;
            height: fit-content;
        }
    }
    #index {
        order: 1;
    }
    #references {
        order: 2;
    }
    #interests {
        order: 3;
        flex-basis: 100%;
        max-width: 100%;
        margin-top: 0;

        display: flex;
        flex-direction: row-reverse;
        column-gap: 12px;

        & #stamp-pause {
            width: fit-content;
            padding-top: 6px;
        }

        & .stamp-content {
            line-height: 1rem;
        }
    }
}
@media (min-width: 520px) {
    #close-refs {
        display: none;
    }
}

#landpage {
    min-height: 90vh;
    display: flex;
    align-items: center;
}
#landpage-inner {
    margin: auto;
    justify-items: center;
    align-items: center;
    border-width: 36px;
    border-style: solid;
    border-image-source: url("bd4.png");
    border-image-slice: 50 fill;
    border-image-repeat: round;
    background-color: white;
    background-clip: padding-box;
    padding: 0px;
    filter: drop-shadow(0px 1px 0px #eed5cb);
    max-width: 460px;

    & #container {
        display: flex;
        column-gap: 16px;

        & > div {
            display: flex;
            margin: auto;
            flex-direction: column;
            justify-items: center;
            align-items: center;
            text-align: center;
            row-gap: 8px;
        }
    }
}

@media (max-width: 510px) {
    #landpage-inner {
        max-width: 90vw;
    }
}

@media (max-width: 460px) {
    #landpage-inner #container {
        flex-direction: column;
        row-gap: 16px;
    }
}

#top-btn {
    background-image: url(/resources/top-page.png);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 60px;
    width: 60px;
    position: fixed; 
    bottom: 30px; 
    right: 30px; 
    z-index: 99; 
    border: none; 
    outline: none; 
    background-color: transparent; 
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 10px;
    font-size: 16px;
    text-shadow: 2px 0 #E790A5, -2px 0 #E790A5, 0 2px #E790A5, 0 -2px #E790A5, 1px 1px #E790A5, -1px -1px #E790A5, -1px 1px #E790A5, 1px -1px #E790A5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 500ms;

    &:hover {
        background-image: url(/resources/top-page-h.png);
        color: #FDF5EC;
    }
    & span {
        display: inline-block;
        margin-top: 10px;
    }
    &.show {
        opacity: 1;
        pointer-events: all;
    }
}

.two-cols {
    display: flex;
    flex-wrap: wrap;
    container-type: inline-size;
    container-name: right;
    column-gap: 12px;
    margin-bottom: 12px;
    
    & > * {
        flex: 1 1 0;
    }

    &:has(div > img) {
        margin-top: 16px;
    }
}

@container right (width < 300px) {
    .two-cols > * {
        flex: 100%;
    }
}

.gallery {
    /* --count: 3;
    column-count: var(--count);
    column-width: 130px;
    column-gap: 8px;

    &.two-col {
        --count: 2;
    } */

    margin-block: 16px;

    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(
        min(100%/1, max(130px, 100%/4)), 1fr));
    row-gap: 4px;
    column-gap: 8px;

    & img {
        aspect-ratio: 1 / 1;
        object-fit: cover;
    }
}

.clickable-img {
    width: 100%;
    opacity: 0.75;
    transition: opacity 0.2s;

    &:hover {
        opacity: 1;
        cursor: pointer;
    }
}


#image-popup {
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(83, 61, 57, 0.75);
    background-blend-mode: multiply;
    width: 100%;
    height: 100%;
    z-index: 99;
    display: none;

    & #close-popup-btn {
        position: absolute;
        top: 20px;
        right: 20px;
        color: #fcf2e8;
        font-size: 48px;
        cursor: pointer;
    }

    & #popup-container {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        flex-direction: column;
        align-items: center;
        border-width: 4px;
        border-style: solid;
        border-image: url("btnborder.png") 6 fill round;
        padding: 12px 4px 12px 12px;
        filter: drop-shadow(0px 1px 0px #eed5cb);
        row-gap: 16px;
        width: max-content;
        max-width: 700px;
        max-height: 80vh;
        overflow-y: scroll;
        overflow-x: hidden;

        & img {
            width: auto;
            max-width: 100%;
            min-width: 350px;
        }
        & span {
            text-align: center;
        }
    }
}

@media (max-width: 850px) {
    #image-popup #popup-container {
        & img, & span {
            max-width: 80vw; 
        }
    }
}

.audio-player {
    padding: 12px;
    background-color: #FDF5EC;
    border: 1px solid #D9BFB4;
    border-radius: 8px;
    margin-top: 12px;
    box-shadow: 0px -2px 0px 0px #EFDFC9 inset;
    -webkit-box-shadow: 0px -2px 0px 0px #EFDFC9 inset;
    -moz-box-shadow: 0px -2px 0px 0px #EFDFC9 inset;

    &:has(+ p) {
        margin-bottom: 12px;
    }

    &:has(+ hr) {
        margin-bottom: 1.2rem;
    }

    & .custom-player {
        display: none;
    }

    & audio {
        display: block;
        height: 36px;
        background-color: #FDF5EC;

        &::-webkit-media-controls-panel {
            border-radius: 4px;
            background-color: #FDF5EC;
        }

        &::-webkit-media-controls-current-time-display {
            color: #9e847f;
        }

        &::-webkit-media-controls-time-remaining-display {
            color: #9e847f;
        }
    }

    & .controls-container {
        text-align: start;
        display: flex;
        justify-content: space-between;
        align-items: start;
        column-gap: 8px;

        & > div {
            display: flex;
            column-gap: 8px;
            overflow: hidden;
        }

        & .play-pause {
            min-width: 18px;
            width: 18px;
            height: 18px;
            border: none;
            outline: none;
            background: url(/resources/audio-pause.png);
            background-size: contain;
            cursor: pointer;

            &.playing {
                background: url(/resources/audio-play.png);
                background-size: contain;
            }
        }

        & .audio-title {
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;

            font-weight: 700;
            color: #E790A5;
        }

        & input[type=range] {
            -webkit-appearance: none;
            background: transparent;
            margin-top: 8px;
            width: 100px;

            &::-webkit-slider-thumb {
                -webkit-appearance: none;
            }

            &:focus {
                outline: none; 
            }

            &::-ms-track {
                width: 100%;
                cursor: pointer;
                background: transparent; 
                border-color: transparent;
                color: transparent;
            }

            &::-webkit-slider-thumb {
                -webkit-appearance: none;
                border: 1px solid #D9BFB4;
                height: 16px;
                width: 16px;
                border-radius: 20px;
                background: #ffffff;
                cursor: pointer;
                margin-top: -6px;
                box-shadow: 0px -1px 0px 0px #EFDFC9 inset;
                -webkit-box-shadow: 0px -1px 0px 0px #EFDFC9 inset;
                -moz-box-shadow: 0px -1px 0px 0px #EFDFC9 inset;
            }

            &::-ms-thumb,
            &::-webkit-slider-thumb {
                border: 1px solid #D9BFB4;
                height: 16px;
                width: 16px;
                border-radius: 20px;
                background: #ffffff;
                cursor: pointer;
                box-shadow: 0px -1px 0px 0px #EFDFC9 inset;
                -webkit-box-shadow: 0px -1px 0px 0px #EFDFC9 inset;
                -moz-box-shadow: 0px -1px 0px 0px #EFDFC9 inset;
            }
            
            &::-moz-range-thumb {
                -moz-appearance: none;
                border: 1px solid #D9BFB4;
                height: 16px;
                width: 16px;
                border-radius: 20px;
                background: #ffffff;
                cursor: pointer;
                box-shadow: 0px -1px 0px 0px #EFDFC9 inset;
                -webkit-box-shadow: 0px -1px 0px 0px #EFDFC9 inset;
                -moz-box-shadow: 0px -1px 0px 0px #EFDFC9 inset;
            }

            &::-webkit-slider-runnable-track {
                width: 100%;
                height: 4px;
                cursor: pointer;
                background: #D9BFB4;
                border-radius: 8px;
                border: 0.2px solid #ac9084;
            }

            &::-moz-range-track {
                width: 100%;
                height: 4px;
                cursor: pointer;
                background: #D9BFB4;
                border-radius: 8px;
                border: 0.2px solid #ac9084;
            }

            &::-ms-track {
                width: 100%;
                height: 4px;
                cursor: pointer;
                background: transparent;
                border-color: transparent;
                border-width: 16px 0;
                color: transparent;
            }

            &::-ms-fill-lower {
                background: #D9BFB4;
                border: 0.2px solid #ac9084;
                border-radius: 8px;
            }

            &::-ms-fill-upper {
                background: #D9BFB4;
                border: 0.2px solid #ac9084;
                border-radius: 8px;
            }
        }
    }
    
    & .audio-progress-container {
        display: flex;
        column-gap: 8px;
        margin-top: 4px;

        & .current-time {
            min-width: 36px;
        }

        & .progress {
            border-radius: 8px;
            overflow: hidden;
            height: 8px;
            background-color: #fff;
            margin-top: 6px;
            width: 100%;
            border: 1px solid #D9BFB4;
            box-shadow: 0px 1px 0px 0px #EFDFC9 inset;
            -webkit-box-shadow: 0px 1px 0px 0px #EFDFC9 inset;
            -moz-box-shadow: 0px 1px 0px 0px #EFDFC9 inset;

            & .progress-bar {
                width: 0;
                height: 100%;
                background-color: #ad9dc2;
                border-radius: 8px;
            }
        }
    }
}

img.inline {
    display: inline;
    margin-bottom: -2px;

    &:has(+ *) {
        margin-right: 4px;
    }
}
* + img.inline {
    margin-left: 4px;
}

.square-img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}


#stamps {
    --gap: 4px;
    position: relative;
    display: flex;
    overflow: hidden;
    user-select: none;
    gap: var(--gap);
    max-width: fit-content;

    &.stopped .stamp-content {
        animation-play-state: paused;
    }

    & .stamp-content {
        flex-shrink: 0;
        display: flex;
        justify-content: space-around;
        gap: var(--gap);
        min-width: 100%;
        animation: scroll 20s linear infinite;
        padding-left: 0;

        &:last-child {
            position: absolute;
            top: 0;
            left: 0;
            animation-name: scroll-abs;
        }
        & > * {
            flex: 0 0 auto;
            
        }

        & img {
            height: 40px;
            opacity: 0.75;
            transition: opacity 0.2s;

            &:hover {
                opacity: 1;
            }
        }

        & li::marker {
            color: transparent;
            padding-left: 8px;
        }
    }
}

#stamp-pause {
    margin-top: 4px;
    width: 100%;
    display: flex;
    justify-content: center;

    #stamp-pause-btn {
        width: 20px;
        height: 20px;
        border: none;
        outline: none;
        background: url(/resources/audio-play.png);
        background-size: contain;
        background-repeat: no-repeat;
        cursor: pointer;

        &.stopped {
            background: url(/resources/audio-pause.png);
            background-size: contain;
            background-repeat: no-repeat;
        }
    }
    
}

@keyframes scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(calc(-100% - var(--gap)));
    }
}

@keyframes scroll-abs {
    from {
        transform: translateX(calc(100% + var(--gap)));
    }
    to {
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .stamp-content {
        animation-play-state: paused !important;
    }
}

.censored {
    background: linear-gradient(0deg,rgba(255, 255, 255, 0) 8%, #9e847f 8%, #9e847f 92%, rgba(255, 255, 255, 0) 92%);
    
    &::selection {
        background-color: #9e847f;
    }
}


@supports (-webkit-touch-callout: none) {
    .audio-player .volume {
        display: none;
    }

    #image-popup #popup-container {
        padding: 12px;
    }
}

@supports (-moz-appearance: none) {
    #image-popup #popup-container {
        padding-right: 12px;
    }
    
    .audio-player .controls-container input[type="range"] {
        margin-top: 4px;
    }
}