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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: #f5f0e8;
    color: #2c2518;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    line-height: 1.85;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
}

/* ===== Paper Texture Overlay ===== */
.paper-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.04;
    mix-blend-mode: multiply;
    z-index: 1000;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background-color: #1a1815;
    border-right: 1px solid #3d3831;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    height: 100%;
}

/* ===== Wordmark ===== */
.wordmark {
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: 'Noto Serif JP', serif;
    font-weight: 900;
    font-size: 2.4rem;
    color: #c4b99a;
    letter-spacing: 0.1em;
    cursor: default;
    user-select: none;
    line-height: 1;
}

.wordmark-char {
    display: block;
}

/* ===== Hanko Seal ===== */
.hanko-seal {
    width: 48px;
    height: 48px;
    border: 2px solid #b8432f;
    border-radius: 3px;
    transform: rotate(-3deg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 48px;
}

.hanko-char {
    font-family: 'Noto Serif JP', serif;
    font-weight: 900;
    font-size: 1.4rem;
    color: #b8432f;
    line-height: 1;
}

/* ===== Sidebar Navigation ===== */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 48px;
    margin-top: 48px;
    width: 100%;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #c4b99a;
    border-left: 2px solid transparent;
    padding-left: 12px;
    transition: border-left-color 0.3s ease, color 0.3s ease, text-shadow 0.3s ease;
}

.nav-item:hover {
    color: #f5f0e8;
    text-shadow: 0 0 8px rgba(196, 185, 154, 0.4);
}

.nav-item.active {
    border-left-color: #4a6741;
    color: #f5f0e8;
}

.nav-kanji {
    font-family: 'Noto Serif JP', serif;
    font-weight: 900;
    font-size: 1.6rem;
    line-height: 1;
    display: block;
}

.nav-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 6px;
}

/* ===== Sidebar Backdrop (Mobile) ===== */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0d0b09cc;
    z-index: 90;
}

.sidebar-backdrop.visible {
    display: block;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
    background-color: #f5f0e8;
    background-image: radial-gradient(ellipse at 30% 40%, #ede5d8 0%, transparent 70%);
    position: relative;
}

/* ===== Hero ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 96px 64px;
}

.hero-inner {
    max-width: 960px;
}

.hero-title {
    font-family: 'Noto Serif JP', serif;
    font-weight: 900;
    font-size: clamp(4rem, 12vw, 20rem);
    line-height: 1.0;
    letter-spacing: -0.03em;
    color: #2c2518;
}

.hero-tagline {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.85;
    color: #8a7f6e;
    margin-top: 32px;
}

/* ===== Wave Dividers ===== */
.wave-divider {
    max-width: 960px;
    padding: 0 64px;
    height: 40px;
    overflow: visible;
}

.wave-divider svg {
    width: 100%;
    height: 40px;
    overflow: visible;
}

.wave-divider path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.wave-divider.drawn path {
    stroke-dashoffset: 0;
}

/* ===== Content Sections ===== */
.content-section {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
    padding: 0 64px;
    position: relative;
}

.content-section.revealed {
    max-height: 2000px;
    opacity: 1;
    padding-top: 48px;
    padding-bottom: 96px;
}

/* ===== Tree Ring Indicators ===== */
.tree-rings {
    position: absolute;
    top: 48px;
    right: 64px;
    width: 60px;
    height: 60px;
}

.ring {
    position: absolute;
    border: 1px solid #3d3831;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.ring-1 { width: 20px; height: 20px; transition-delay: 0s; }
.ring-2 { width: 40px; height: 40px; transition-delay: 0.15s; }
.ring-3 { width: 60px; height: 60px; transition-delay: 0.3s; }

.content-section.revealed .ring {
    transform: translate(-50%, -50%) scale(1);
}

/* ===== Section Headers ===== */
.section-header {
    margin-bottom: 48px;
}

.section-title {
    font-family: 'Noto Serif JP', serif;
    font-weight: 900;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    color: #2c2518;
    line-height: 1.2;
}

.section-title-sub {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: #8a7f6e;
    margin-left: 12px;
}

.section-label {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #8a7f6e;
    display: block;
    margin-top: 8px;
}

/* ===== Tatami Grid ===== */
.tatami-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    max-width: 960px;
}

.tatami-block {
    padding: 32px;
    border: 1px solid #ede5d8;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tatami-block--wide {
    grid-column: span 2;
    aspect-ratio: 2 / 1;
}

.tatami-block--tall {
    grid-row: span 2;
    aspect-ratio: 1 / 2;
}

.body-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: #2c2518;
}

/* ===== Motifs ===== */

/* Seed: small dot */
.motif {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.seed-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #3d3831;
}

/* Root: downward lines */
.motif-root {
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.root-line {
    display: block;
    width: 1px;
    background-color: #3d3831;
}

.root-line-1 { height: 40px; }
.root-line-2 { height: 55px; transform: rotate(8deg); }
.root-line-3 { height: 60px; }
.root-line-4 { height: 45px; transform: rotate(-6deg); }
.root-line-5 { height: 35px; }

/* Trunk: vertical rectangle */
.trunk-rect {
    display: block;
    width: 24px;
    height: 80px;
    border: 1px solid #3d3831;
    background: transparent;
}

/* Branch: forking SVG */
.branch-svg {
    width: 120px;
    height: 120px;
}

/* Canopy: wide arc SVG */
.canopy-svg {
    width: 160px;
    height: 80px;
}

/* ===== Footer ===== */
.site-footer {
    padding: 96px 64px 48px;
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 960px;
}

.footer-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #8a7f6e;
}

.footer-divider {
    color: #c4b99a;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 48px;
        overflow: hidden;
    }

    .sidebar.open {
        width: 240px;
        overflow: visible;
    }

    .sidebar-inner {
        padding: 24px 8px;
        min-width: 240px;
    }

    .sidebar-nav,
    .hanko-seal {
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar.open .sidebar-nav,
    .sidebar.open .hanko-seal {
        opacity: 1;
    }

    .wordmark {
        font-size: 1.4rem;
        cursor: pointer;
    }

    .main-content {
        margin-left: 48px;
    }

    .hero {
        padding: 48px 24px;
    }

    .content-section {
        padding-left: 24px;
        padding-right: 24px;
    }

    .content-section.revealed {
        padding-top: 32px;
        padding-bottom: 64px;
    }

    .wave-divider {
        padding: 0 24px;
    }

    .tatami-grid {
        grid-template-columns: 1fr;
    }

    .tatami-block--wide {
        grid-column: span 1;
        aspect-ratio: auto;
    }

    .tree-rings {
        right: 24px;
    }

    .site-footer {
        padding: 64px 24px 32px;
        flex-direction: column;
        gap: 8px;
    }
}
