/* mujun.dev — Skeuomorphic Leather Journal */

/* ========================
   Reset & Base
   ======================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    display: flex;
    min-height: 100vh;
    background: #3D2B1F;
    overflow-x: hidden;
}

/* ========================
   Sidebar
   ======================== */
#sidebar {
    width: 220px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 8px,
            rgba(0,0,0,0.01) 8px,
            rgba(0,0,0,0.01) 9px
        ),
        linear-gradient(180deg, #3D2B1F 0%, #2B1810 100%);
    border-right: 3px dashed #8B4513;
    padding: 40px 16px;
}

#sidebar-inner {
    position: sticky;
    top: 40px;
}

#sidebar-title {
    font-family: 'Vollkorn', serif;
    font-weight: 600;
    font-size: 14px;
    color: #C19A6B;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 1px solid #8B4513;
}

/* Sidebar Navigation */
#sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 8px 8px 8px 28px;
    text-decoration: none;
    font-family: 'Vollkorn', serif;
    font-weight: 400;
    font-size: 14px;
    color: #C19A6B;
    position: relative;
    transition: color 0.3s;
    opacity: 0;
    transform: translateX(-10px);
}

.sidebar-link.entered {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar-link:hover {
    color: #F5F0E5;
}

.sidebar-link .link-text {
    flex: 1;
}

.sidebar-link .page-num {
    font-size: 12px;
    opacity: 0.6;
    text-align: right;
    min-width: 20px;
}

/* Bookmark Ribbon */
.bookmark-ribbon {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 20px;
    background: #CC3333;
    border-radius: 0 3px 3px 0;
    transition: width 0.2s ease;
}

.sidebar-link.active .bookmark-ribbon {
    width: 24px;
}

.sidebar-link.active {
    color: #F5F0E5;
}

/* ========================
   Main Content
   ======================== */
#main-content {
    margin-left: 220px;
    max-width: 740px;
    padding: 40px 50px 80px;
    background: #F5F0E5;
    min-height: 100vh;
    position: relative;
    transform-origin: left center;
    animation: pageOpen 0.8s ease-out forwards;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}

@keyframes pageOpen {
    from {
        transform: perspective(1000px) rotateY(-90deg);
        opacity: 0;
    }
    to {
        transform: perspective(1000px) rotateY(0deg);
        opacity: 1;
    }
}

/* ========================
   Stitched Rules
   ======================== */
.stitch-rule {
    border: none;
    border-top: 2px dashed #8B4513;
    margin: 50px 0;
    opacity: 0.6;
}

/* ========================
   Hero / Cover
   ======================== */
#hero {
    padding: 80px 0;
    text-align: center;
}

.hero-cover {
    padding: 60px 40px;
}

.stitched-border {
    border: 2px dashed #8B4513;
    border-radius: 4px;
    padding: 60px 40px;
}

.embossed-title {
    font-family: 'Vollkorn', serif;
    font-weight: 600;
    font-size: 48px;
    color: #2B1810;
    text-shadow:
        1px 1px 0 rgba(255,255,255,0.3),
        -1px -1px 0 rgba(0,0,0,0.2);
    letter-spacing: 0.04em;
}

.hero-subtitle {
    font-family: 'Vollkorn', serif;
    font-weight: 400;
    font-size: 17px;
    color: #3A2A20;
    margin-top: 16px;
    line-height: 1.8;
    font-style: italic;
}

/* ========================
   Content Sections
   ======================== */
.content-section {
    padding: 20px 0;
}

.section-title {
    font-family: 'Vollkorn', serif;
    font-weight: 600;
    font-size: 24px;
    color: #2B1810;
    margin-bottom: 20px;
}

.content-section p {
    font-family: 'Vollkorn', serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.8;
    color: #3A2A20;
    margin-bottom: 16px;
    max-width: 640px;
}

/* ========================
   Paradox Diagrams
   ======================== */
.diagram-container {
    margin: 40px auto;
    text-align: center;
}

.paradox-diagram {
    max-width: 100%;
    height: auto;
}

.draw-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s ease;
}

.diagram-container.visible .draw-line {
    stroke-dashoffset: 0;
}

/* ========================
   Code Blocks
   ======================== */
.code-block {
    background: #D4C5A9;
    border: 1px dashed #8B4513;
    border-radius: 3px;
    padding: 20px 24px;
    margin: 24px 0;
    overflow-x: auto;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s;
}

.code-block.visible {
    opacity: 1;
    transform: translateX(0);
}

.code-block pre {
    margin: 0;
}

.code-block code {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 14px;
    color: #3A2A20;
    line-height: 1.7;
}

.code-keyword {
    color: #2B1810;
    font-weight: 600;
}

.code-fn {
    color: #1A4A2A;
}

.code-comment {
    color: #8B4513;
    opacity: 0.7;
    font-style: italic;
}

.code-string {
    color: #8B4513;
}

/* ========================
   Page Curl
   ======================== */
#page-curl {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(
        225deg,
        #F5F0E5 0%,
        #D4C5A9 45%,
        #3D2B1F 50%,
        transparent 50%
    );
    z-index: 50;
    pointer-events: none;
}

/* ========================
   Colophon
   ======================== */
.colophon-note {
    font-style: italic;
    opacity: 0.7;
    font-size: 15px;
}

/* ========================
   Mobile Responsive
   ======================== */
@media (max-width: 900px) {
    #sidebar {
        width: 180px;
        padding: 30px 12px;
    }

    #main-content {
        margin-left: 180px;
        padding: 30px 30px 60px;
    }
}

@media (max-width: 680px) {
    #sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
        border-right: none;
        border-bottom: 3px dashed #8B4513;
        padding: 20px 16px;
    }

    #sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2px;
    }

    .sidebar-link {
        padding: 6px 12px 6px 16px;
        font-size: 12px;
    }

    .bookmark-ribbon {
        height: 14px;
    }

    .sidebar-link.active .bookmark-ribbon {
        width: 12px;
    }

    .sidebar-link .page-num {
        display: none;
    }

    body {
        flex-direction: column;
    }

    #main-content {
        margin-left: 0;
        padding: 20px 20px 60px;
        animation: none;
        opacity: 1;
    }

    .embossed-title {
        font-size: 36px;
    }

    #page-curl {
        display: none;
    }
}
