@charset "UTF-8";

/* =========================================
   1. Base & Background
   ========================================= */
body.sketch-page {
    background-color: #f4f4f4;
    background-image: 
        linear-gradient(#e0e0e0 1px, transparent 1px),
        linear-gradient(90deg, #e0e0e0 1px, transparent 1px);
    background-size: 20px 20px;
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    overflow-y: hidden; 
    
    /* オーバーレイの位置ズレを防ぐため transform/filter を無効化 */
    transform: none !important;
    filter: none !important;
    perspective: none !important;
}

body.sketch-page.loaded {
    overflow-y: auto;
}

/* ★修正: ヘッダー(z-index:3000)より下、コンテンツより上に設定 */
body.sketch-page .overlay-section {
    position: fixed !important; 
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 2500; 
}

#lenia-bg {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1; pointer-events: none; mix-blend-mode: normal; 
}

/* =========================================
   2. Loading Screen
   ========================================= */
#loading-screen {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: #f4f4f4; z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}
#loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader-content { 
    display: flex; flex-direction: column; align-items: center; 
    gap: 10px; 
}

.egg-shape {
    width: 80px; height: 110px;
    background-color: #ffffff;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1), inset -5px -5px 15px rgba(0,0,0,0.03);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: egg-bounce 1.5s infinite ease-in-out;
    margin-bottom: 10px;
}
@keyframes egg-bounce {
    0%, 100% { transform: translateY(0) scale(1, 1); }
    50% { transform: translateY(-15px) scale(0.95, 1.05); }
}

.loading-text {
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 14px; font-weight: 700; color: #1a1a1a; letter-spacing: 0.15em;
    text-transform: uppercase; animation: text-blink 1.5s infinite ease-in-out;
}
@keyframes text-blink { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

.loading-bar-container {
    width: 160px; height: 4px; background-color: #ddd; 
    border-radius: 2px; overflow: hidden; margin-top: 5px;
}
.loading-bar {
    width: 100%; height: 100%; background-color: #1a1a1a; 
    transform-origin: left; animation: loading-progress 1.5s infinite ease-in-out;
}
@keyframes loading-progress {
    0% { transform: scaleX(0); }
    50% { transform: scaleX(0.7); }
    100% { transform: scaleX(1); transform-origin: right; }
}

/* =========================================
   3. Header & UI 
   ========================================= */

body.overlay-open .lang-switch { opacity: 0; pointer-events: none; transition: opacity 0.3s; }

.sketch-container {
    position: relative; z-index: 10; 
    width: 100%; max-width: 100%; margin: 0; padding: 120px 0 100px;
}
.sketch-header, .filter-bar { max-width: 1200px; margin: 0 auto 40px; padding: 0 20px; }

.sketch-header h1 { 
    font-family: "Helvetica Neue", Arial, sans-serif; 
    font-size: clamp(60px, 8vw, 120px); 
    font-weight: 900; 
    line-height: 0.9; 
    letter-spacing: -0.03em; 
    color: #1a1a1a; 
    margin: 0; 
    text-transform: uppercase;
}

.sketch-desc { margin-top: 20px; font-size: 14px; color: #666; line-height: 1.8; font-feature-settings: "palt"; }

.filter-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.filter-group { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-btn {
    background: none; border: 1px solid #aaa; border-radius: 20px; padding: 6px 16px; 
    font-size: 12px; font-weight: 700; color: #666; cursor: pointer; transition: all 0.2s;
}
.filter-btn:hover, .filter-btn.active { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
#sort-btn { min-width: 80px; }

/* Grid Layout */
.sketch-grid { display: flex; flex-direction: column; width: 100%; overflow: hidden; gap: 40px; }
@media (max-width: 768px) { .sketch-grid { gap: 15px; } }

.sketch-row { width: 100%; position: relative; padding: 10px 0; }
@media (max-width: 768px) { .sketch-row { padding: 0; } }

.sketch-track { display: flex; width: max-content; will-change: transform; touch-action: pan-y; cursor: grab; }
@media (max-width: 768px) { .sketch-track { padding-left: 10px; } }
.sketch-track:active { cursor: grabbing; }

/* 静止モード時のスタイル */
.sketch-track.static {
    width: 100%;
    justify-content: center;
    transform: none !important;
    cursor: default;
    padding-left: 0;
}

@media (max-width: 768px) {
    .sketch-track.static {
        flex-wrap: wrap; 
        gap: 15px;
        padding: 0 10px;
        box-sizing: border-box;
    }
}

.scroll-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd; border-radius: 50%;
    cursor: pointer; z-index: 30;
    display: flex; justify-content: center; align-items: center;
    font-size: 20px; color: #333; opacity: 0; pointer-events: none; 
    transition: all 0.3s; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.scroll-nav:hover { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.scroll-nav.left { left: 20px; }
.scroll-nav.right { right: 20px; }
@media (hover: hover) { .sketch-row:hover .scroll-nav { opacity: 1; pointer-events: auto; } }

/* Card Design */
.sketch-card {
    width: 20vw; margin: 0 10px; flex-shrink: 0; 
    background: #fff; border-radius: 4px; overflow: hidden;
    cursor: pointer; position: relative; border: 1px solid transparent;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s, transform 0.3s;
    transform: translateZ(0); z-index: 15;
}
@media (max-width: 768px) { 
    .sketch-card { width: 45vw; margin: 0 4px; } 
    .sketch-header h1 { font-size: 60px; }
}

@media (hover: hover) {
    .sketch-card:hover { transform: translateY(-5px) scale(1.01); box-shadow: 0 10px 25px rgba(0,0,0,0.15); z-index: 20; }
    .sketch-card:hover .view-hint { opacity: 1; transform: translateY(0); }
}

.thumb-wrapper {
    position: relative !important; width: 100%; display: block; 
    overflow: hidden; background: #eee; aspect-ratio: 1 / 1; 
}

.card-thumb, .modal-viewer img, .modal-viewer video {
    width: 100%; height: 100%; display: block; object-fit: cover;
    -webkit-user-drag: none; 
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}

.sketch-preview-frame {
    position: absolute; top: 0; left: 0; 
    width: 100% !important; height: 100% !important;
    border: none; z-index: 5; background: #fff; 
    pointer-events: none; opacity: 0;
    animation: fadeInPreview 0.5s ease forwards;
    display: flex; justify-content: center; align-items: center;
}
.sketch-preview-frame canvas { 
    width: 100% !important; height: 100% !important; object-fit: cover; display: block; 
}
@keyframes fadeInPreview { to { opacity: 1; } }

.card-info { padding: 15px; background: #fff; position: relative; z-index: 20; text-align: left; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag-pill {
    font-size: 10px; font-weight: 700; color: #666; background: #eee;
    padding: 3px 8px; border-radius: 12px; text-transform: uppercase; 
    letter-spacing: 0.05em; transition: all 0.2s;
}
.sketch-card:hover .tag-pill { background: #333; color: #fff; }
.card-date { font-family: monospace; font-size: 11px; color: #888; display: block; margin-bottom: 5px; }
.card-title { font-size: 14px; font-weight: 700; line-height: 1.4; margin: 0; }
.view-hint {
    position: absolute; bottom: 15px; right: 15px;
    font-size: 11px; font-weight: 700; color: #1a1a1a;
    display: flex; align-items: center; gap: 5px;
    opacity: 0; transform: translateY(5px); transition: all 0.3s ease; z-index: 15;
}

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px); z-index: 2000; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; display: flex; justify-content: center; align-items: center; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { width: 90%; max-width: 1100px; max-height: 90vh; background: #fff; display: block; border-radius: 4px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); overflow-y: auto; position: relative; }
.modal-close-btn { position: fixed; top: 30px; right: 30px; font-size: 40px; cursor: pointer; line-height: 1; color: #fff; z-index: 2010; transition: transform 0.3s; }
.modal-close-btn:hover { transform: rotate(90deg); }
.modal-viewer { width: 100%; aspect-ratio: 16 / 9; background: #000; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.modal-viewer canvas, .modal-viewer iframe, .modal-viewer video, .modal-viewer img { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; object-fit: contain; border: none; display: block; }
.modal-info { padding: 40px; background: #fff; text-align: left; }
.modal-meta-row { display: flex; align-items: center; gap: 15px; margin-bottom: 10px; }
.modal-tag { background: #1a1a1a; color: #fff; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 2px; text-transform: uppercase; letter-spacing: 0.05em; }
.modal-date { font-family: monospace; font-size: 13px; color: #888; }
.modal-title { font-size: 28px; font-weight: 800; margin: 0 0 20px 0; line-height: 1.2; color: #1a1a1a; }
.modal-desc { font-size: 16px; color: #444; line-height: 2.0; margin-bottom: 30px; }
#modal-link-container { margin-top: 20px; }
.modal-link-btn { display: inline-block; padding: 10px 20px; border: 1px solid #1a1a1a; color: #1a1a1a; font-size: 12px; font-weight: 700; text-decoration: none; transition: all 0.3s; }
.modal-link-btn:hover { background: #1a1a1a; color: #fff; }

@media (max-width: 768px) {
    .modal-content { width: 95%; max-height: 85vh; }
    .modal-viewer { aspect-ratio: auto; height: 50vh; }
    .modal-info { padding: 25px; }
    .modal-close-btn { 
        top: auto; bottom: 30px; right: 30px; font-size: 30px;
        color: #1a1a1a; background: rgba(255,255,255,0.9);
        width: 50px; height: 50px; border-radius: 50%;
        display: flex; justify-content: center; align-items: center;
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    }
}