:root {
    --bg-color: #e6e6f4;
    --text-color: #2b2b2b;
    --grid-line-color: #7a7a8c;
    --footer-color: #9f9fb4;

    --paper-bg: #f9f9fa;
    --paper-line-color: #c9b4db;
    --side-box-color: #dfd4ef;
    --nav-text-color: #282828;

    --font-serif: 'Georgia', 'Times New Roman', serif;
    --font-sans: 'Malgun Gothic', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    overflow: hidden;
    transform: scale(0.9);
    transform-origin: center center;
    width: 100vw;
    height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("./images/paper-texture.png") repeat;
    background-size: 512px 512px;
    opacity: 0.2;
    pointer-events: none;
    z-index: 0;
}

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

a:hover, a:active, a:focus {
    text-decoration: none;
    outline: none;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    padding: 40px 20px 20px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.handwritten-wrapper {
    width: 100%;
    max-width: 450px;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    mix-blend-mode: multiply;
}

.handwritten-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    opacity: 0.65;
    filter: grayscale(100%);
    transform: translateY(20px);
}

.title {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: normal;
    letter-spacing: 4px;
    color: var(--text-color);
    overflow: hidden;
    transform: translateY(25px);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.title:hover {
    color: #22194e;
    letter-spacing: 6px;
    transform: translateY(22px);
}

.illustration-area {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 0;
    mix-blend-mode: multiply;
    transform: translateY(-60px);
}

.twin-images {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 100%;
    width: 100%;
    gap: 0;
}

.main-image {
    height: auto;
    max-height: 100vh;
    width: auto;
    object-fit: contain;
    mask-image: linear-gradient(to right, transparent, #000 0%, #000 95%, transparent);
}

.flipped {
    transform: scaleX(-1);
    margin-right: -5px;
}

.footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--footer-color);
    letter-spacing: 0;
    margin-top: 0;
    padding-bottom: 10px;
    position: relative;
    transform: translateY(25px);
}

.page2-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.top-nav {
    position: absolute;
    top: 30px;
    left: 40px;
    right: 40px;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-serif);
    font-size: 1.2rem;
    letter-spacing: 2px;
    z-index: 20;
}

.nav-link {
    color: var(--nav-text-color);
    margin-left: 20px;
}

.nav-left .nav-link {
    margin-left: 0;
}

.paper-container {
    width: 75%;
    height: 85vh;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 10;
}

.paper-box {
    width: 100%;
    height: 92%;
    background-color: var(--paper-bg);
    border-radius: 25px;
    padding: 40px 80px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    max-height: 100%;  
    overflow-y: auto;  
    box-sizing: border-box;
    scrollbar-width: none;
}

.paper-box::-webkit-scrollbar {
    display: none;
}

.paper-line {
    border: none;
    border-top: 3px solid var(--paper-line-color);
    margin-top: 10px;
}

.essay-subtitle {
    font-weight: bold;
    margin-top : 30px;
}

.essay-content p {
    word-break: keep-all;  
    overflow-wrap: break-word; 
    margin-bottom: 20px;
    font-family: sans-serif;
    white-space: pre-line;
    line-height: 1.8;
}

.essay-content p {
    word-break: keep-all;
    overflow-wrap: break-word;
    margin-bottom: 20px;
    font-family: sans-serif;
    white-space: pre-line;
}

.side-checkbox {
    display: none;
}

.side-toggle-button {
    display: none;
}

.side-box {
    position: absolute;
    left: 0;
    top: 15%;
    width: 60px;
    height: 80vh;
    background-color: var(--side-box-color);
    border-radius: 0 15px 15px 0;
    cursor: pointer;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 15;
    overflow: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

.side-box .side-content {
    height: 100%;
}

.side-checkbox:checked ~ .side-box {
    width: 200px;
    pointer-events: auto;
    overflow-y: auto;
    max-height: 80vh
}

.side-box::-webkit-scrollbar {
    display: none; 
}

.side-content {
    opacity: 0;
    white-space: nowrap;
    padding: 20px;
    color: #282828;
    transition: opacity 0.3s;
    letter-spacing: 1px;
    pointer-events: none;
}

.side-checkbox:checked + .side-box .side-content {
    opacity: 1;
    pointer-events: auto; 
}

.side-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px; 
}

.essay-list-box {
    display: flex;
    flex-direction: column;
    gap: 10px;   
}

.essay-item {
    display: block;
    font-family: var(--font-sans);
    font-size: 1.0rem;
    color: var(--nav-text-color);
    transition: opacity 0.2s, color 0.2s;
}

.essay-item:hover {
    opacity: 0.7;
    color: #b0a0c9;
}

.essay-item.is-disabled {
    opacity: 0.45;
    cursor: default;
}

.essay-item.is-disabled:hover {
    opacity: 0.45;
    color: var(--nav-text-color);
}

.corner-illustration {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 280px;
    height: 280px;
    background-image: url('images/page.webp');
    background-position: right bottom;
    background-size: contain;
    background-repeat: no-repeat;
    mix-blend-mode: multiply;
    z-index: 15;
    pointer-events: none;
}

.footer-absolute {
    position: absolute;
    bottom: 20px;
    width: 100%;
    color: #b0a0c9;
}

.mobile-footer-break {
    display: none;
}

@media (max-width: 768px) {
    body {
        transform: scale(1);
    }

    .title {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

    .main-image {
        max-height: 50vh;
    }

    .top-nav {
        top: 20px;
        left: 20px;
        right: 20px;
        font-size: 1rem;
    }

    .paper-container {
        width: 90%;
        height: 75vh;
    }

    .paper-box {
        padding: 40px 20px;
    }

    .side-box {
        top: 10%;
        width: 0;
        height: 75vh;
        pointer-events: none;
    }

    .side-checkbox:checked + .side-box {
        width: min(300px, 85vw);
        pointer-events: auto;
        overflow-y: auto;
        max-height: 75vh;
    }

    .side-toggle-button {
        position: absolute;
        z-index: 30;
        top: 50%;
        left: 12px;
        display: flex;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background-color: var(--side-box-color);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
        color: var(--nav-text-color);
        cursor: pointer;
        transform: translateY(-50%);
        font-size: 1.4rem;
        line-height: 1;
        transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), top 0.4s, transform 0.4s;
    }

    .side-toggle-button:focus-visible {
        outline: 3px solid var(--nav-text-color);
        outline-offset: 3px;
    }

    .side-toggle-close {
        display: none;
    }

    .side-checkbox:checked ~ .side-toggle-button {
        top: calc(10% + 12px);
        left: min(calc(85vw - 48px), 252px);
        transform: none;
    }

    .side-checkbox:checked ~ .side-toggle-button .side-toggle-open {
        display: none;
    }

    .side-checkbox:checked ~ .side-toggle-button .side-toggle-close {
        display: inline;
    }

    .corner-illustration {
        width: min(38vw, 170px);
        height: min(38vw, 170px);
        right: 0;
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }

    .footer-absolute {
        left: 12px;
        right: calc(min(38vw, 170px) + 12px);
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
        width: auto;
        padding-bottom: 0;
        font-size: clamp(0.62rem, 2.8vw, 0.7rem);
        line-height: 1.5;
        text-align: left;
        transform: none;
    }

    .footer-absolute p {
        overflow-wrap: anywhere;
    }

    .mobile-footer-break {
        display: initial;
    }
}

.essay-divider {
    border: none;
    border-top: 1.5px dashed var(--paper-line-color); 
    margin: 45px 0 35px;
    opacity: 0.7;
}

.essay-subtitle {
    font-size: 1.1rem;
    font-weight: bold;
    color: #6b5b95;
    margin-top: 30px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.essay-subtitle::before {
    content: "🔖"; 
    font-size: 0.95rem;
}