:root {
    --lacquer-deep: #1E1A12;
    --lacquer: #221E16;
    --lacquer-border: #2A2018;
    --wood-dark: #7A6345;
    --wood: #8B7355;
    --wood-light: #A09478;
    --bamboo: #B8A888;
    --gold: #C4943A;
    --parchment: #D4C4A8;
}

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

body {
    background: var(--lacquer-deep);
    color: var(--bamboo);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

/* The Lid */
.lid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--lacquer);
    transition: transform 1.2s cubic-bezier(0.33, 0, 0.2, 1), opacity 0.8s ease;
    transform-origin: top center;
}

.lid.open {
    transform: perspective(1200px) rotateX(-90deg);
    opacity: 0;
    pointer-events: none;
}

.lid-inner {
    text-align: center;
}

.lid-label {
    font-family: 'Noto Serif JP', serif;
    font-weight: 500;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    letter-spacing: 0.06em;
    color: var(--parchment);
    margin-bottom: 20px;
}

.lid-stamp {
    margin: 0 auto;
    opacity: 0.6;
}

/* Bento Box */
.bento-box {
    width: 90vw;
    max-width: 1100px;
    height: 85vh;
    max-height: 720px;
    margin-top: 6vh;
    border: 16px solid var(--lacquer-border);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--lacquer);
    opacity: 0;
    transition: opacity 0.6s ease 0.8s;
}

.bento-box.visible {
    opacity: 1;
}

/* Upper region */
.upper-region {
    flex: 0 0 60%;
    display: flex;
    min-height: 0;
}

/* Lower region */
.lower-region {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* Partition bars -- the hero element */
.partition {
    flex-shrink: 0;
    background: linear-gradient(
        180deg,
        #5a4a30 0%,
        #7a6345 20%,
        #8B7355 40%,
        #7a6345 60%,
        #5a4a30 80%,
        #4a3a25 100%
    );
}

.partition-v {
    width: 8px;
}

.partition-h {
    height: 8px;
    width: 100%;
    background: linear-gradient(
        90deg,
        #5a4a30 0%,
        #7a6345 20%,
        #8B7355 40%,
        #7a6345 60%,
        #5a4a30 80%,
        #4a3a25 100%
    );
}

/* Compartments */
.compartment {
    position: relative;
    padding: 24px;
    overflow: hidden;
}

.comp-main {
    flex: 0 0 65%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.comp-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

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

/* Compartment label */
.comp-label {
    position: absolute;
    top: 12px;
    right: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    color: var(--wood-dark);
    letter-spacing: 0.04em;
}

/* Typography */
.comp-title {
    font-family: 'Noto Serif JP', serif;
    font-weight: 500;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    letter-spacing: 0.06em;
    color: var(--parchment);
    margin-bottom: 16px;
}

.comp-heading {
    font-family: 'Noto Serif JP', serif;
    font-weight: 500;
    font-size: 18px;
    letter-spacing: 0.04em;
    color: var(--bamboo);
    margin-bottom: 12px;
}

.comp-desc {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.65;
    color: var(--wood-light);
    max-width: 440px;
    margin-bottom: 20px;
}

.comp-detail {
    display: flex;
    gap: 12px;
}

.mono-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 400;
    color: var(--gold);
    letter-spacing: 0.02em;
    padding: 4px 10px;
    border: 1px solid var(--wood-dark);
    border-radius: 2px;
}

.comp-note {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--wood-dark);
    line-height: 1.5;
    margin-top: 12px;
}

.comp-body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.6;
    color: var(--wood-light);
}

/* Code blocks */
.code-block {
    background: var(--lacquer-deep);
    padding: 10px 14px;
    border-radius: 2px;
    margin-bottom: 8px;
}

.code-block code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 400;
    color: var(--gold);
    letter-spacing: 0.01em;
}

/* Tool icons */
.tool-icon {
    margin-top: auto;
    padding-top: 12px;
    opacity: 0.5;
}

/* Documentation below */
.documentation {
    width: 90vw;
    max-width: 720px;
    padding: 60px 0 80px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.documentation.in-view {
    opacity: 1;
    transform: translateY(0);
}

.doc-section {
    margin-bottom: 48px;
}

.doc-rule {
    width: 100%;
    height: 8px;
    margin-bottom: 24px;
    background: linear-gradient(
        90deg,
        #5a4a30 0%,
        #7a6345 20%,
        #8B7355 40%,
        #7a6345 60%,
        #5a4a30 80%,
        #4a3a25 100%
    );
}

.doc-title {
    font-family: 'Noto Serif JP', serif;
    font-weight: 500;
    font-size: 22px;
    letter-spacing: 0.04em;
    color: var(--bamboo);
    margin-bottom: 12px;
}

.doc-body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.7;
    color: var(--wood-light);
}

.doc-footer {
    text-align: center;
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--wood-dark);
}

.footer-domain {
    font-family: 'Noto Serif JP', serif;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: 0.06em;
    color: var(--parchment);
}

/* Mobile */
@media (max-width: 768px) {
    .bento-box {
        height: auto;
        max-height: none;
    }

    .upper-region {
        flex-direction: column;
        flex: none;
    }

    .comp-main {
        flex: none;
        padding: 32px 20px;
    }

    .comp-side {
        flex: none;
        padding: 24px 20px;
    }

    .upper-region .partition-v {
        width: 100%;
        height: 8px;
        background: linear-gradient(
            90deg,
            #5a4a30 0%,
            #7a6345 20%,
            #8B7355 40%,
            #7a6345 60%,
            #5a4a30 80%,
            #4a3a25 100%
        );
    }

    .lower-region {
        flex-direction: column;
    }

    .partition-lower {
        width: 100%;
        height: 8px;
        background: linear-gradient(
            90deg,
            #5a4a30 0%,
            #7a6345 20%,
            #8B7355 40%,
            #7a6345 60%,
            #5a4a30 80%,
            #4a3a25 100%
        );
    }

    .comp-tool {
        padding: 24px 20px;
    }

    .documentation {
        padding: 40px 20px 60px;
    }
}
