/* 0. ローディング画面のスタイル */
.loader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; background-color: #ffffff; z-index: 9999; transition: opacity 0.6s ease-out, visibility 0.6s ease-out; }
.loader.is-hidden { opacity: 0; visibility: hidden; }
.loader-content { text-align: center; }
.loader-logo { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 2.5rem; letter-spacing: 0.2em; color: #475569; animation: pulse 2.5s infinite ease-in-out; margin-bottom: 1.5rem; }
.line-spinner { width: 120px; height: 2px; background-color: #f1f5f9; border-radius: 2px; margin: 0 auto; }
.line-spinner::before { content: ''; display: block; height: 100%; width: 100%; background-color: #64748b; border-radius: 2px; animation: line-load 1.8s infinite ease-in-out; }
.loader-text { margin-top: 1rem; font-size: 0.875rem; color: #94a3b8; letter-spacing: 0.2em; text-transform: uppercase; }
@keyframes pulse { 0% { opacity: 0.7; } 50% { opacity: 1; } 100% { opacity: 0.7; } }
@keyframes line-load { 0% { transform: scaleX(0); transform-origin: left; } 45% { transform: scaleX(1); transform-origin: left; } 50% { transform: scaleX(1); transform-origin: right; } 100% { transform: scaleX(0); transform-origin: right; } }
body.is-loading { overflow: hidden; }
.main-content-wrapper { opacity: 0; transition: opacity 0.8s ease-in-out; transition-delay: 0.2s; }
body:not(.is-loading) .main-content-wrapper { opacity: 1; }

/* 1. 基本設定 */
body { font-family: 'Noto Sans JP', 'Inter', sans-serif; color: #475569; font-weight: 400; background-color: #f8fafc; }
html { scroll-behavior: smooth; }
#snowCanvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }

/* 2. ヘッダーのスタイル */
#main-header .logo-link { color: #1e293b; transition: color 0.3s ease; }
#main-header.is-transparent .logo-link { color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }
#main-header .nav-link { position: relative; transition: color 0.3s ease; color: #475569; }
#main-header.is-transparent .nav-link { color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }
#main-header.is-transparent .nav-link::after { background-color: white; }
#main-header .nav-link::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 100%; height: 2px; background-color: #64748b; transform: scaleX(0); transform-origin: right; transition: transform 0.4s ease-out; }
#main-header .nav-link:hover::after,
#main-header .nav-link.is-active::after { transform: scaleX(1); transform-origin: left; } /* is-activeクラスにも適用 */
#main-header .nav-link:hover,
#main-header .nav-link.is-active { color: #334155; } /* is-activeクラスにも適用 */
#main-header.is-transparent .nav-link:hover,
#main-header.is-transparent .nav-link.is-active { color: white; } /* is-activeクラスにも適用 */

.hamburger { cursor: pointer; width: 24px; height: 24px; transition: all 0.25s; position: relative; }
.hamburger-top, .hamburger-middle, .hamburger-bottom { position: absolute; width: 24px; height: 3px; top: 0; left: 0; background: #475569; transition: all 0.4s; border-radius: 2px; }
#main-header.is-transparent .hamburger-top, #main-header.is-transparent .hamburger-middle, #main-header.is-transparent .hamburger-bottom {
    background: #ffffff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
.hamburger-middle { transform: translateY(8px); }
.hamburger-bottom { transform: translateY(16px); }
.open .hamburger-top { transform: rotate(45deg) translateY(6px) translateX(6px); background: #ffffff; }
.open .hamburger-middle { display: none; }
.open .hamburger-bottom { transform: rotate(-45deg) translateY(6px) translateX(-6px); background: #ffffff; }

/* 3. ヒーローセクション */
.hero-section { position: relative; width: 100%; background-color: #e2e8f0; }
.hero-image { width: 100%; display: block; }
.hero-text-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 1rem; }
.hero-title { font-weight: 500; letter-spacing: 0.2em; background-image: linear-gradient(to right, #e0f2fe, #ffffff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3)); }
.hero-view-works { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.9; transition: opacity 0.3s ease; background-image: linear-gradient(to right, #e0f2fe, #ffffff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }
.hero-view-works:hover { opacity: 1; }
@media (min-width: 768px) { .hero-text-overlay { width: 50%; left: 0; padding: 2rem; } }

/* 4. セクション共通のスタイル */
.content-section { opacity: 0; transform: translateY(20px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.content-section.is-visible { opacity: 1; transform: translateY(0); }
.section-header { margin-bottom: 3rem; }
.section-title { font-weight: 700; letter-spacing: 0.05em; padding-bottom: 0.75rem; border-bottom: 2px solid #cbd5e1; display: inline-block; background-image: linear-gradient(to right, #475569, #94a3b8); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Aboutセクションのアイコンアニメーション */
.profile-image { opacity: 0; transition: opacity 0.5s ease-in-out; }
.profile-image.loaded { opacity: 1; }
.profile-image.shining { animation: shine 0.4s ease-out; }
@keyframes shine { 0% { filter: brightness(1); } 50% { filter: brightness(1.5); transform: scale(1.02); } 100% { filter: brightness(1); transform: scale(1); } }

/* Aboutセクションの文章アニメーション */
.about-text-content p { opacity: 0; transform: translateY(25px); animation-fill-mode: forwards; }
.content-section.is-visible .about-text-content p { animation-name: fade-up-staggered; animation-duration: 0.7s; animation-timing-function: ease-out; }
@keyframes fade-up-staggered { to { opacity: 1; transform: translateY(0); } }
.content-section.is-visible .about-text-content p:nth-child(2) { animation-delay: 0.2s; }
.content-section.is-visible .about-text-content p:nth-child(3) { animation-delay: 0.4s; }
.content-section.is-visible .about-text-content p:nth-child(4) { animation-delay: 0.6s; }

/* 5. Worksセクションのカードデザイン */
.work-card { background-color: #ffffff; border: 1px solid #e2e8f0; overflow: hidden; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); transition: transform 0.3s ease, box-shadow 0.3s ease; flex-shrink: 0; border-radius: 0.5rem; }
.work-card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
.work-card-image-wrapper { height: 100%; }
.work-card-image { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.work-card:hover .work-card-image { transform: scale(1.05); }
.gallery::-webkit-scrollbar { height: 8px; }
.gallery::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 10px; }
.gallery::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 10px; }
.gallery::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* 6.汎用ボタン */
.btn-primary { background-color: #475569; color: white; transition: background-color 0.3s ease; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.btn-primary:hover { background-color: #334155; box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }

/* 7. フッターのスタイル */
footer { background-image: linear-gradient(to right, #1e293b, #64748b); }

/* 8. 画像拡大モーダルのスタイル */
#image-modal.is-zoomed { overflow: auto; }
#modal-image { cursor: zoom-in; }
#modal-image.is-zoomed { max-width: none; max-height: none; cursor: zoom-out; }

/* パズルゲーム用CSS */
#puzzle-container { margin: 20px auto; position: relative; border: 5px solid #334155; box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.puzzle-piece { position: absolute; border: 1px solid #fff; box-sizing: border-box; background-size: 100% 100%; cursor: pointer; transition: top 0.3s ease, left 0.3s ease; background-repeat: no-repeat; }
#message { font-size: 1.5em; font-weight: bold; color: #ef4444; height: 30px; margin-top: 20px; }

/* イラストリクエストツール用CSS */
.option-label { display: block; width: 100%; cursor: pointer; }
.option-label > div:active { transform: scale(0.98); transition: transform 0.075s; }
.option-label input[type="radio"]:checked + div,
.option-label input[type="checkbox"]:checked + div { border-color: #64748b; background-color: #f1f5f9; --tw-ring-offset-shadow: 0 0 0 1px #fff; --tw-ring-shadow: 0 0 0 calc(2px + 1px) #cbd5e1; box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), 0 0 #0000; }

/* ▼▼▼【UX/UI改善】ここから追加CSS ▼▼▼ */
.gallery-nav {
    display: none; /* スマホでは非表示 */
}
@media (min-width: 768px) { /* md以上で表示 */
    .gallery-nav {
        display: block;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        cursor: pointer;
        background-color: rgba(255, 255, 255, 0.7);
        border-radius: 50%;
        padding: 0.75rem; /* 12px */
        color: #475569;
        transition: all 0.2s ease-in-out;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    .gallery-nav:hover {
        background-color: white;
        transform: translateY(-50%) scale(1.1);
        color: #1e293b;
    }
    #gallery-prev { left: -1.5rem; } /* -24px */
    #gallery-next { right: -1.5rem; } /* -24px */
}

.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001; /* モーダル本体より手前 */
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    padding: 0.75rem; /* 12px */
    color: white;
    transition: all 0.2s ease-in-out;
    border: 2px solid rgba(255,255,255,0.5);
}
.modal-nav:hover {
    background-color: rgba(0, 0, 0, 0.6);
    transform: translateY(-50%) scale(1.1);
}
#modal-prev { left: 2rem; } /* 32px */
#modal-next { right: 2rem; } /* 32px */
/* ▲▲▲【UX/UI改善】ここまで追加CSS ▲▲▲ */