/* ===================== Base ===================== */
@font-face {
    font-family: "Freepixel";
    src: url("./assets/fonts/FreePixel.ttf") format("truetype");
}

@font-face {
    font-family: "Nosutaru Dot";
    src: url("./assets/fonts/Nosutaru-dotMPlusH-10-Regular.ttf") format("truetype");
}

@font-face {
    font-family: "VCR OSD Mono";
    src: url("./assets/fonts/VCR_OSD_MONO_1.001.ttf") format("truetype");
}

:root {
    --background: #15191a;
    --main-color: #c6c4c3;
    --main-color-dk: #9b959a;
    --accent-1: #7a726a;
    --accent-2: #2d2723;
    --text-color: #f3f2f2;
    --link-color: #af492c;
    --content-spacing: 5px;
    --border: 1px solid black;
    --background-img: url("./assets/sprites/background.png");
    --banner: url("./assets/sprites/banner.png");
    --titleBars: url("./assets/sprites/bar.png");
    --arrows: url("./assets/sprites/arrow.png");
}

/* ===================== Main ===================== */
html, body {
    margin: 0;
    box-sizing: border-box;
    font-family: "FreePixel";
}

body {
    background-image: var(--background-img);
    color: var(--text-color);
    background-attachment: fixed;
}

main {
    background-color: transparent !important;
    width: 74%;
}

aside {
    width: 30%;
    margin-left: var(--content-spacing);
    border-left: var(--border);
    background-color: var(--background);
}

nav {
    position: sticky;
    top: 20px;
}

footer {
    border: var(--border);
    height: 25px;
    margin-top: var(--content-spacing);
    background-image: var(--titleBars);
    text-align: center;
}

@media only screen and (max-width: 640px) {
    body, html {
        overflow-x: hidden;
    }
    html {
        background-color: #111;
    }

    main {
        width:100%;
        order:2;
    }

    aside {
        display:block;
        width:100%;
        order:1;
        margin-left:0;
    }
}

/* ================== Components ================== */
#flex {
    display: flex;
    max-width: 850px;
}

.topbar {
    background-image: var(--banner);
    height: 150px;
    margin-bottom: var(--content-spacing);
    border: var(--border);
}

.topbar img {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

#container, .topbar img {
    max-width: 850px;
    margin: 0 auto;
}

#container {
    border-top: none;
}

#container a {
    color: var(--link-color);
}

@media only screen and (max-width: 640px) {
    #flex {
        flex-wrap:wrap;
    }
}

/* ==================== Directory =================== */
    .directory {
        align-items: center;
        white-space: nowrap;
    }

    .tree {
        font-size: 0.9rem;
        margin-top: -15px;
        margin-left: -18px;
        line-height: 1.5;
    }

    .node-icon {
        width: 16px;
        height: 16px;
        vertical-align: text-bottom;
        position: relative;
        top: -0.3px;
        left: 3.8px;
    }
    
    .parent {
        padding-left: 0.5em;
    }

    .subdirectory {
        padding-left: 2em;
    }

    .child {
        padding-left: 3.5em;
    }

    .node a {
        color: inherit;
        text-decoration: none;
    }

    .node a:hover {
        text-decoration: underline;
    }

    @media only screen and (max-width: 640px) {
        .tree {
            margin-top: 0px;
            margin-left: -5px;
        }
    }

.sidebar-title, .title-bar {
    background-image: var(--titleBars);
    font-weight: bold;
    border: var(--border);
    font-size: 20px;
}

.title-bar {
    margin-top: var(--content-spacing);
}

.title-bar:first-child {
    margin-top: 0 !important;
}

.content {
    background-color: var(--background);
    padding: 25px;
}

/* ================== Desktop Shelf ================== */
    .desktop {
        display: inline-block;
        width: 100px;
        margin: 10px;
        text-align: center;
    }

    .ico {
        width: 32px;
        height: 32px;
        image-rendering: pixelated;
    }

    .label {
        font-size: 15px;
        line-height: 1.2;
        padding: 2px 4px;
        border-radius: 2px;
        display: inline-block;
    }

.update {
    border: 2px dashed var(--accent-1);
    padding: 5px;
}

.dev-tag {
    width: 16px;
    height: 16px;
    vertical-align: text-bottom;
    position: relative;
    top: -1.5px;
    left: 1.5px;
    margin-right: 4px;
}

/* ================== Story Detail =================== */
    .details {
        display: flex;
        gap: 16px;
        padding: 10px;
    }

    .cover > img {
        width: 150px;
        height: 200px;
        image-rendering: pixelated;
        margin-bottom: -5px;
        border: 1.5px solid rgba(255, 255, 255, 0.2);
    }

    .info {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .story-title {
        font-size: 1.5rem;
        color: var(--text-color);
        padding-top: 15px;
        margin-bottom: 5px;
    }

    .synopsis {
        font-size: 18px;
        color: var(--text-color);
        font-style: italic;
        text-align: justify;
        margin-left: 8px;
        margin-bottom: 8px;
        padding-bottom: 15px;
    }

    @media only screen and (max-width: 640px) {
        .info {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .story-title {
            padding-top: 0px;
        }
        
        .synopsis {
            font-size: 0.8rem;
            color: var(--text-color);
            text-align: justify;
            font-style: italic;
            margin-bottom: 8px;
            padding-bottom: 0px;
        }
    }

    /* ================= Image View ================== */
        .cover-img {
            cursor: pointer;
            transition: transform 0.2s ease;
        }

        .cover-img:hover {
            transform: scale(1.02);
        }

        .modal {
            display: none;
            position: absolute;
            z-index: 1000;
            left: 0; top: 0;
            width: 100%;
            height: 130%;
            background: rgba(0, 0, 0, 0.6);
        }

        .modal-cover > img {
            width: 612px;
            height: 792px;
        }

        .modal-window {
            position: absolute;
            top: 47%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: #1a1a1a;
            color: #ddd;
            border: 1px solid #444;
            border-radius: 4px;
            box-shadow: 0 0 20px #000;
        }

        @media only screen and (max-width: 640px) {
            .modal {
                width: 100%;
                height: 150%;
            }

            .modal-cover > img {
                width: 306px;
                height: 396px;
            }

            .modal-window {
                top: 55%;
            }
        }

    /* ============== Chapter Selection ============== */
        .locked {
            opacity: 60%;
            pointer-events: none;
        }

        .file-icon {
            width: 16px;
            height: 16px;
            vertical-align: text-bottom;
            position: relative;
            top: -1.5px;
            left: 1.5px;
        }

        .locked {
            opacity: 60%;
            pointer-events: none;
        }

        .chapters {
            margin: -20px 0px;
        }

        .chapters ul {
            list-style: none;
            padding-left: 0;
        }

        .chapters li {
            margin-bottom: 6px;
        }

        .chapters a {
            text-decoration: none;
        }

        .chapters a:hover {
            text-decoration: underline;
        }

/* =================== Transcript ==================== */
    .transcript {
        max-width: 720px;
        margin: 0 auto;
        padding: 16px 16px;
        text-align: justify;
        line-height: 1.7; 
        font-size: 1.15rem;
        text-indent: 1.8rem;
        margin-bottom: -25px;
    }

    .transcript h1{
        font-size: 20px;
        text-align: center;
        margin-top: -20px;
        margin-bottom: -5px;
    }

    .transcript h2 {
        font-size: 22px;
        text-align: center;
        margin-top: -5px;
    }

    /* =================== Letter ==================== */
        .text-icon {
            width: 16px;
            height: 16px;
            vertical-align: text-bottom;
            position: relative;
            top: -2px;
            left: 5px;
            margin-right: 4px;
        }

        .text-bar {
            background-color: #d0d0d0;
            padding: 0.4rem 0.4rem 0.2rem;
            font-weight: bold;
            color: #111;
            border-bottom: 2px solid #555;
            text-indent: 0em;
        }

        .window {
            width: 100%;
            max-width: 600px;
            margin: 1rem auto;
            border: 2px solid #555;
            background-color: #fefefe;
            box-shadow: 6px 6px 0 #333;
            font-size: 16px;
        }

        .window-content {
            padding: 1rem;
            color: #222;
            line-height: 1;
            white-space: pre-line;
        }

        .letter-file p {
            margin: 0 0 -0.4em 0;
            line-height: 1;
        }

        .letter-file .subject {
            font-weight: bold;
            text-align: left;
            text-indent: 0em;
            margin-top: -25px;
        }

        .letter-file .signed {
            font-weight: bold;
            text-align: right;
            margin-bottom: -20px;
        }

        .letter-file .unusual {
            margin-top: -25px;
            margin-bottom: -20px;
        }

        .letter-file .japanese {
            font-family: "Nosutaru Dot", monospace;
        }

    /* ============= Chapter Interface =============== */
        .chapter-nav {
            display: flex;
            justify-content: space-between;
            margin-top: 0rem;
            padding: 1rem 0;
            border-top: 1px solid var(--border-color);
        }

        .nav-button {
            background-color: var(--button-bg);
            color: var(--text-color);
            padding: 6px 12px;
            text-decoration: none;
            border: 1px solid var(--border-color);
            border-radius: 3px;
            transition: background 0.2s ease;
        }

        .nav-button:hover {
            text-decoration: underline;
        }

    /* =============== Glitch Overlay ================ */
        @keyframes rgbShift {
            0%, 100% {
                transform: none;
                opacity: 0;
            }
            25% {
                transform: translate(-2px, 0);
                opacity: 0.12;
            }
            50% {
                transform: translate(2px, 0);
                opacity: 0.15;
            }
            75% {
                transform: translate(-1px, 0);
                opacity: 0.1;
            }
        }

        .rgb-glitch-overlay::before,
        .rgb-glitch-overlay::after {
            content: "";
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            pointer-events: none;
            z-index: 9999;
            opacity: 0;
            transform: none;
            mix-blend-mode: screen;
        }

        .rgb-glitch.rgb-glitch-overlay::before,
        .rgb-glitch.rgb-glitch-overlay::after {
            animation: rgbShift 0.2s steps(1) infinite;
        }

        .rgb-glitch.rgb-glitch-overlay::before {
            background: rgba(255, 0, 0, 0.15);
        }

        .rgb-glitch.rgb-glitch-overlay::after {
            background: rgba(0, 255, 255, 0.15);
        }

    /* =================== Anomaly =================== */
        /* =================== 2.3 =================== */
        @keyframes anomalyDetected {
            0%, 49% {
                color: red;
                background-color: black;
            }
            50%, 100% {
                color: inherit;
                background-color: inherit;
            }
        }

        .blink-red {
            animation: anomalyDetected 1.2s step-end infinite;
        }

        .timeline-correction p {
            margin-top: 0rem;
        }

        /* =================== 3.1 =================== */
        .migraine {
            display: inline-block;
            text-indent: 0px;
            margin-top: 0px;
            margin-bottom: 0px;
            position: relative;
        }

        .disconnection .void{
            font-family: "VCR OSD Mono", monospace;
        }

        .void {
            display: inline-block;
            text-indent: 0px;
            margin-top: 0px;
            margin-bottom: 0px;
            position: relative;
            background-color: black;
        }

        #nothing {
            font-size: larger;
            font-weight: bold;
            transform: translate(203.8px, 50px);
        }

        #my-body {
            transform: translate(23.8px, -30px);
        }

        #cold {
            opacity: 80%;
            font-weight: 400;
            transform: translate(318.8px, -25px);
        }

        #stability {
            text-shadow: 13px 7px 0px rgba(197, 197, 197, 0.3);
        }

        #fall {
            text-indent: 1.8rem;
            font-size: 90%;
            font-weight: 100;
            font-family: 'VCR OSD Mono', monospace;
        }

        @media only screen and (max-width: 640px) {
            #nothing {
                transform: translate(113.8px, 40px);
            }

            #my-body {
            transform: translate(-10px, -30px);
            }

            #where {
                transform: translate(-40px, 0px);
            }

            #i-cant {
                transform: translate(-30px, 0px);
            }

            #cold {
                transform: translate(228.8px, -25px);
            }
        }
