@charset "utf-8";

/* --- 1. Base Setup --- */
:root {
    --bg-color: #000;
    --accent-color: #fff;
    --text-muted: #888;
    --card-bg: #050505;
    --section-gap: 15vh;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: 'Helvetica Neue', Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif; 
    background: var(--bg-color); 
    color: var(--accent-color); 
    overflow-x: hidden; 
    line-height: 1.8; 
    -webkit-font-smoothing: antialiased;
}

/* --- 2. Layout Framework --- */
.section-container {
    width: 100%;
    max-width: 2500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.section-title {
    width: 100%;
    text-align: center;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    letter-spacing: 0.5em; /* 広く取って高級感を出す */
    text-transform: uppercase;
    margin-bottom: 80px;
    font-weight: 700;
}

/* --- 3. Hero --- */
.hero { position: relative; width: 100%; height: 100vh; overflow: hidden; background: #000; }
.hero-video, #endImage { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.hero-content { position: relative; z-index: 10; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; pointer-events: none; background: rgba(0,0,0,0.3); }

.main-title { font-size: clamp(2rem, 8vw, 6rem); font-weight: 700; letter-spacing: 0.2em; text-align: center; line-height: 1; }
.sub-title { font-size: clamp(0.8rem, 2vw, 1.1rem); opacity: 0.7; letter-spacing: 0.4em; margin-top: 20px; font-weight: 300; }

/* --- 3.5. Scroll Rotate Section --- */
.chara-scroll-rotate-section {
    position: relative;
    width: 100%;
    height: 400vh !important; 
    display: block !important;
    background: #000;
    overflow: visible !important;
}

.chara-section-header {
    position: absolute;
    top: 8vh;
    left: 0;
    width: 100%;
    z-index: 101;
    text-align: center;
    pointer-events: none; /* 操作の邪魔にならないようにする */
}

.chara-rotate-sticky {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#chara-rotate-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.rotation-text-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 100; pointer-events: none;
}

.rot-text-block {
    position: absolute;
    max-width: 500px;
    padding: 50px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(20, 30, 40, 0.85), rgba(40, 20, 30, 0.85));
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.8), 
                0 0 15px rgba(255, 154, 158, 0.2), 
                0 0 15px rgba(161, 196, 253, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    opacity: 0;
    transition: opacity 0.8s, transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rot-text-block:nth-child(1) {
    top: 25%; left: 20%; text-align: left;
    transform: translateX(-100px) scale(0.8) rotateY(-15deg);
}
.rot-text-block:nth-child(1).active {
    opacity: 1; transform: translateX(0) scale(1) rotateY(0deg);
}

.rot-text-block:nth-child(2) {
    bottom: 25%; right: 20%; text-align: right;
    transform: translateX(100px) scale(0.8) rotateY(15deg);
}
.rot-text-block:nth-child(2).active {
    opacity: 1; transform: translateX(0) scale(1) rotateY(0deg);
}

.rot-text-block::before, .rot-text-block::after {
    content: ''; position: absolute; font-family: sans-serif;
    font-size: 1.5rem; color: rgba(255, 255, 255, 0.3);
    transition: transform 0.8s ease-in-out;
}
.rot-text-block::before { content: '🍃'; top: 20px; left: 20px; }
.rot-text-block::after { content: '🐾'; bottom: 20px; right: 20px; }
.rot-text-block.active::before { transform: rotate(15deg) scale(1.1); color: #a1c4fd; }
.rot-text-block.active::after { transform: rotate(-15deg) scale(1.1); color: #ff9a9e; }

.rot-text-block h2 { 
    font-family: 'Helvetica Neue', 'Arial', sans-serif;
    font-size: 2.2rem; letter-spacing: 0.15em; font-weight: 200; margin: 15px 0; 
    background: linear-gradient(135deg, #fff 0%, #a1c4fd 40%, #ff9a9e 60%, #fff 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; 
}

.rot-text-block .category-tag {
    font-family: monospace; font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5); letter-spacing: 0.3em;
}


/* --- 4. Expertise (Three Columns) --- */
.column-container { display: flex; width: 100%; border-bottom: 1px solid #111; }
.column { flex: 1; position: relative; height: 40vh; overflow: hidden; border-right: 1px solid #111; }
.column video { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.4); transition: 0.8s cubic-bezier(0.2, 1, 0.3, 1); }
.column:hover video { filter: brightness(0.7); transform: scale(1.08); }

.text-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; text-align: center; pointer-events: none; }
.text-overlay h3 { font-size: clamp(1.2rem, 2.5vw, 2rem); line-height: 1.2; margin-bottom: 10px; letter-spacing: 0.1em; }
.text-overlay p { font-size: 0.7rem; opacity: 0.5; letter-spacing: 0.2em; text-transform: uppercase; }

/* --- 5. Content Blocks (Works) --- */
.content-block { padding: var(--section-gap) 5%; background: var(--card-bg); width: 100%; }

.works-split-container { 
    display: flex; width: 100%; max-width: 2500px; margin: 0 auto !important; 
    gap: 100px; align-items: center; justify-content: center; 
}

@media (min-width: 1025px) { .is-reverse { flex-direction: row-reverse !important; } }

.split-left { flex: 0 1 1300px; min-width: 0; position: relative; }
.split-right { flex: 0 1 500px; padding: 20px; }

/* --- Slider & Image Styling --- */
.comparison-slider, .single-image-box { 
    position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; 
    border: 1px solid #222; box-shadow: 0 30px 60px rgba(0,0,0,0.5); 
}
.image-after, #before-box { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.image-after img, .single-image-box img { width: 100%; height: 100%; object-fit: cover; }

#before-box { position: absolute; top: 0; left: 0; height: 100%; width: 50%; overflow: hidden; z-index: 2; border-right: 1px solid rgba(255,255,255,0.4); }
#before-box img { 
    position: absolute; top: 0; left: 0; height: 100%; 
    width: calc(100% * (100 / var(--exposure-num, 50))); 
    object-fit: cover; max-width: none; 
}

.slider { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; z-index: 10; cursor: ew-resize; appearance: none; -webkit-appearance: none; }
.slider-line { position: absolute; top: 0; left: 50%; width: 1px; height: 100%; background: rgba(255,255,255,0.8); z-index: 3; pointer-events: none; }

/* --- 6. Typography (Works Text) --- */
.category-tag { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4em; display: block; margin-bottom: 20px; }
.tech-info h3 { font-size: clamp(1.8rem, 4vw, 3rem); margin-bottom: 30px; line-height: 1.1; font-weight: 600; }
.tech-info p { color: #aaa; font-size: 1rem; margin-bottom: 40px; font-weight: 300; }

.spec-list { list-style: none; border-top: 1px solid #222; padding-top: 40px; }
.spec-list li { font-size: 0.9rem; color: #777; margin-bottom: 18px; display: flex; align-items: center; }
.spec-list li strong { color: #fff; width: 110px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; }

/* --- 7. Archive (Horizontal Scroll) --- */
.archive-section { padding: var(--section-gap) 0; background: #000; }
.archive-container-wrapper { position: relative; width: 100%; }

.scroll-arrow { 
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 100; 
    background: rgba(0, 0, 0, 0.5); color: white; border: none; width: 70px; height: 120px; 
    font-size: 1.5rem; cursor: pointer; transition: 0.4s; display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(5px);
}
.scroll-arrow:hover { background: rgba(255, 255, 255, 0.1); }
.scroll-arrow.left { left: 0; border-radius: 0 10px 10px 0; }
.scroll-arrow.right { right: 0; border-radius: 10px 0 0 10px; }

.horizontal-scroll-wrapper { 
    display: flex; overflow-x: auto; gap: 40px; padding: 20px 5%; 
    scrollbar-width: none; cursor: grab; scroll-behavior: smooth; 
}
.horizontal-scroll-wrapper::-webkit-scrollbar { display: none; }

.scroll-item { 
    flex: 0 0 auto; width: 550px; aspect-ratio: 16 / 9; overflow: hidden; 
    border: 1px solid #111; transition: 0.5s; 
}
.scroll-item:hover { border-color: #555; transform: translateY(-15px); }
.scroll-item img { width: 100%; height: 100%; object-fit: cover; }

/* --- 8. Contact Section --- */
.contact-section { padding: var(--section-gap) 5%; background: var(--card-bg); border-top: 1px solid #111; }
.form-wrapper { 
    width: 100%; max-width: 900px; margin: 0 auto; background: #fff; 
    border-radius: 12px; overflow: hidden; 
    box-shadow: 0 40px 100px rgba(0,0,0,0.6);
}

/* --- 9. Responsive --- */
@media (max-width: 1024px) {
    :root { --section-gap: 8vh; }
    
    .hero { height: 50vh; }
    .sub-title { text-align: center; text-indent: 0.4em; padding: 0 5%; line-height: 1.6; }

    /* ★スマホでのセクションタイトル位置調整 */
    .chara-section-header {
        top: 4vh;
    }

    /* ★動画エリアを全画面に戻す（縦長動画対応） */
    .chara-rotate-sticky {
        height: 100vh;
        top: 0;
    }

    /* ★縦長動画を画面内に全体表示して見切れを防ぐ */
    #chara-rotate-video {
        object-fit: contain;
        object-position: center center;
    }

    /* ★スクロールテキストのレスポンシブ調整 */
    .rot-text-block { 
        width: 90%; 
        max-width: none; 
        padding: 25px; 
        border-radius: 15px;
    }
    
    /* スマホでは横からの3D回転をやめ、下からふんわり浮き上がる自然なアニメーションに変更 */
    .rot-text-block:nth-child(1) { 
        top: 15%; left: 5%; 
        transform: translateY(40px) scale(0.95); 
    }
    .rot-text-block:nth-child(1).active { 
        transform: translateY(0) scale(1); 
    }
    .rot-text-block:nth-child(2) { 
        bottom: 15%; right: 5%; 
        transform: translateY(40px) scale(0.95); 
    }
    .rot-text-block:nth-child(2).active { 
        transform: translateY(0) scale(1); 
    }
    .rot-text-block h2 { font-size: 1.4rem; margin: 10px 0; }
    .rot-text-block p { font-size: 0.85rem; line-height: 1.6; margin: 0; }

    /* ★セクション間の隙間を大幅に詰める */
    .content-block { padding: 3vh 5%; }
    #works.content-block { padding-bottom: 3vh; }
    .archive-section { padding: 3vh 0; }

    /* ★要素の分解と並べ替え */
    .works-split-container { 
        display: flex; 
        flex-direction: column; 
        max-width: 600px; 
        margin: 0 auto; 
        gap: 0 !important; 
    }
    
    .split-right, .tech-info { display: contents; }
    
    /* ★最大の原因を修正！ PC版の「1300px」設定を強制リセットし、縦の巨大化を防ぐ */
    .split-left { 
        order: 3; 
        flex: none !important; /* <- ここが隙間バグの特効薬です */
        width: 100%; 
        padding: 0; 
        margin: 15px 0; /* 画像の上下にだけ美しい15pxの隙間を確保 */
    }
    
    /* 1番目（上）: カテゴリタグ */
    .category-tag { order: 1; text-align: left; margin-bottom: 5px; }
    
    /* 2番目（画像の上）: タイトル */
    .tech-info h3 { 
        order: 2; text-align: left; margin-bottom: 0; line-height: 1.2;
        font-size: clamp(1.3rem, 4vw, 1.5rem);
    }
    
    /* 4番目（画像の下）: 説明文 */
    .tech-info p { 
        order: 4; text-align: left; margin: 0 0 15px 0; color: #aaa;
        font-size: 0.8rem;
    }
    
    /* 5番目（一番下）: リスト */
    .spec-list { order: 5; padding-top: 15px; border-top: 1px solid #222; margin-bottom: 0; }
    .spec-list li { 
        justify-content: flex-start; margin-bottom: 8px;
        font-size: 0.75rem;
    }
    .spec-list li strong { width: 95px; font-size: 0.65rem; }

    /* その他の既存レイアウト設定 */
    .column-container { flex-direction: column; }
    .column { height: 25vh; border-right: none; border-bottom: 1px solid #111; }
    .scroll-arrow { display: none; } 
    .scroll-item { width: 320px; }
    .section-title { margin-bottom: 30px; }
}