/* カスタムスタイル */

/* カスタムカーソル */
* {
    cursor: none !important;
}

.custom-cursor {
    position: fixed;
    width: 18px;
    height: 18px;
    border: 2px solid #2563eb;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}

.custom-cursor-dot {
    position: fixed;
    width: 5px;
    height: 5px;
    background: radial-gradient(circle, #3b82f6 0%, #2563eb 100%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease, width 0.2s ease, height 0.2s ease;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
}

/* カーソルのホバー状態 */
.custom-cursor.hover {
    width: 30px;
    height: 30px;
    border-color: #3b82f6;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.6), inset 0 0 10px rgba(59, 130, 246, 0.2);
}

.custom-cursor.hover + .custom-cursor-dot {
    width: 7px;
    height: 7px;
}

/* リンクホバー時 */
.custom-cursor.link-hover {
    width: 40px;
    height: 40px;
    border-color: transparent;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.2) 0%, rgba(59, 130, 246, 0.1) 50%, transparent 100%);
    border-width: 0;
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.5), 0 0 40px rgba(59, 130, 246, 0.3);
}

.custom-cursor.link-hover::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(45deg, #ec4899, #3b82f6, #ec4899);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    to {
        transform: rotate(360deg);
    }
}

/* クリック時のアニメーション */
.custom-cursor.click {
    animation: cursor-click 0.4s ease;
}

@keyframes cursor-click {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(0.85);
        box-shadow: 0 0 35px rgba(59, 130, 246, 0.8);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* カーソルのトレイル効果 */
.cursor-trail {
    position: fixed;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.6) 0%, rgba(236, 72, 153, 0.4) 100%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    opacity: 0;
    transform: translate(-50%, -50%);
    filter: blur(2px);
}

/* ライトボックス内でのカーソル */
.lightbox.active .custom-cursor {
    border-color: #ffffff;
    mix-blend-mode: normal;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.lightbox.active .custom-cursor-dot {
    background: radial-gradient(circle, #ffffff 0%, #e5e7eb 100%);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.lightbox.active .custom-cursor.hover {
    border-color: #ffffff;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.6);
}

.lightbox.active .custom-cursor.link-hover::before {
    background: linear-gradient(45deg, #ffffff, #3b82f6, #ffffff);
}

/* テキスト選択時のカーソル */
.custom-cursor.selecting {
    width: 25px;
    height: 25px;
    border-style: dashed;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* モバイルデバイスではカスタムカーソルを非表示 */
@media (hover: none) and (pointer: coarse) {
    * {
        cursor: auto !important;
    }
    
    .custom-cursor,
    .custom-cursor-dot,
    .cursor-trail {
        display: none !important;
    }
}

/* ページ全体のスムーズスクロール */
html {
    scroll-behavior: smooth;
}

/* ギャラリーアイテムのホバーエフェクト */
.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
    pointer-events: none;
}

.gallery-item:hover::before {
    opacity: 1;
}

/* LPに適したアスペクト比のオプション */
.gallery-item {
    aspect-ratio: 3/5; /* テキストエリアを含む縦長の比率 */
    background-color: #ffffff; /* 背景色を白に */
    position: relative;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .gallery-item {
        aspect-ratio: 3/5.5; /* デスクトップではさらに縦長に */
    }
}

/* 画像コンテナのスタイル */
.image-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* 画像のファーストビューを表示 */
.gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center; /* 画像の上部を表示 */
}

/* テキストコンテナのスタイル */
.text-container {
    border-top: 1px solid #e5e7eb;
    transition: background-color 0.3s ease;
    min-height: 90px; /* 固定の最小高さ */
}

.gallery-item:hover .text-container {
    background-color: #f9fafb;
}

/* テキストのホバー効果 */
.gallery-item:hover h3 {
    color: #2563eb;
    transition: color 0.3s ease;
}

/* オーバーレイのz-index調整 */
.gallery-item .overlay {
    z-index: 3;
    pointer-events: none;
}

/* ホバー時のエフェクトを調整 */
.gallery-item:hover img {
    transform: scale(1.05);
}

/* モバイルでのホバーエフェクトを軽減 */
@media (max-width: 768px) {
    .gallery-item:hover img {
        transform: scale(1.02);
    }
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
    .gallery-item {
        aspect-ratio: 3/4; /* モバイル2列表示に最適化 */
    }
    
    .text-container {
        min-height: 70px; /* モバイルではテキストエリアを少し小さく */
        padding: 0.75rem; /* パディングも調整 */
    }
    
    .text-container h3 {
        font-size: 0.875rem; /* 14px */
        margin-bottom: 0.25rem;
    }
    
    .text-container p {
        font-size: 0.7rem; /* 11px */
        line-height: 1.2;
    }
    
    /* image-containerの高さ調整 */
    .image-container {
        height: calc(100% - 70px) !important;
    }
}

/* 極小画面（400px以下）での調整 */
@media (max-width: 400px) {
    .text-container {
        min-height: 65px;
        padding: 0.5rem;
    }
    
    .text-container h3 {
        font-size: 0.75rem; /* 12px */
    }
    
    .text-container p {
        font-size: 0.625rem; /* 10px */
    }
}

/* ヘッダーのアニメーション */
header {
    animation: fadeInDown 0.8s ease-out forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* シンプルなホバーエフェクト */
.gallery-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* モバイルでのホバーエフェクトを軽減 */
@media (max-width: 768px) {
    .gallery-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.1);
    }
}

/* ライトボックススタイル */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.lightbox.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.lightbox-container > * {
    pointer-events: auto;
}

.lightbox-content {
    position: relative;
    width: 90%;
    height: 90%;
    max-width: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-slider {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-wrapper {
    width: 100%;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* カスタムスクロールバー */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.5) rgba(0, 0, 0, 0.3);
}

/* Webkitブラウザ用のスクロールバースタイル */
.lightbox-image-wrapper::-webkit-scrollbar {
    width: 12px;
}

.lightbox-image-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    margin: 10px 0;
}

.lightbox-image-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
}

.lightbox-image-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 25px rgba(255, 255, 255, 1);
}

/* 初回表示時のスクロールバーパルスアニメーション */
.lightbox-image-wrapper.pulse-scrollbar::-webkit-scrollbar-thumb {
    animation: pulse-scrollbar 1.5s ease-in-out 0.3s 2;
}

@keyframes pulse-scrollbar {
    0%, 100% { 
        background: rgba(255, 255, 255, 0.7);
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    }
    50% { 
        background: rgba(255, 255, 255, 1);
        box-shadow: 0 0 40px rgba(255, 255, 255, 1);
    }
}

/* スクロール可能な場合のグラデーションオーバーレイ */
.lightbox-image-wrapper.scrollable::before {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.8) 0%, 
        rgba(0, 0, 0, 0.4) 30%,
        transparent 100%);
    pointer-events: none;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* スクロールが最下部に到達した時 */
.lightbox-image-wrapper.scrolled-bottom::before {
    opacity: 0;
}

.lightbox-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    display: block;
}

.lightbox-image.active {
    opacity: 1;
}

/* スクロールヒント */
.scroll-hint {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.8);
    padding: 14px 28px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.scroll-hint.show {
    opacity: 1;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

.scroll-hint-icon {
    width: 26px;
    height: 38px;
    margin: 0 auto 8px;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 13px;
    position: relative;
}

.scroll-hint-icon::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 12px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    animation: scroll-hint-animation 1.5s infinite;
}

@keyframes scroll-hint-animation {
    0% { transform: translateX(-50%) translateY(0); opacity: 0.7; }
    50% { transform: translateX(-50%) translateY(10px); opacity: 1; }
    100% { transform: translateX(-50%) translateY(0); opacity: 0.7; }
}

/* 画像下部のグラデーション */
.lightbox-content {
    position: relative;
    width: 90%;
    height: 90%;
    max-width: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.95) 0%, 
        rgba(0, 0, 0, 0.6) 30%,
        transparent 100%);
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.lightbox-content.show-gradient::after {
    opacity: 1;
}

/* 画像の初回表示アニメーション */
.lightbox-image-wrapper {
    width: 100%;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Firefoxのカスタムスクロールバー */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.7) rgba(255, 255, 255, 0.15);
    position: relative;
}

/* Firefox用のスクロールバーホバー効果（部分的サポート） */
@supports (scrollbar-width: thin) {
    .lightbox-image-wrapper:hover {
        scrollbar-color: rgba(255, 255, 255, 1) rgba(255, 255, 255, 0.2);
    }
}

/* 矢印アニメーション */
.scroll-arrow {
    position: fixed;
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10001;
}

.scroll-arrow.show {
    opacity: 1;
    animation: bounce 1.5s ease-in-out infinite;
}

.scroll-arrow svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.8; }
    50% { transform: translateX(-50%) translateY(15px); opacity: 1; }
}

/* 閉じるボタン */
.lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10002;
}

.lightbox-close:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* ナビゲーションボタン */
.lightbox-prev,
.lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10002;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

/* カウンター */
.lightbox-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 10001;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .lightbox-content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        padding: 0 10px;
    }
    
    .lightbox-image-wrapper {
        max-height: calc(100vh - 120px);
    }
    
    /* モバイルでのスクロールバー */
    .lightbox-image-wrapper::-webkit-scrollbar {
        width: 8px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-counter {
        bottom: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .scroll-hint {
        bottom: 60px;
        font-size: 13px;
        padding: 10px 20px;
    }
    
    .scroll-hint > div:last-child {
        display: none;
    }
    
    .scroll-hint-icon {
        width: 20px;
        height: 30px;
    }
    
    .scroll-arrow {
        bottom: 100px;
        width: 30px;
        height: 30px;
    }
    
    .lightbox-content::after {
        height: 100px;
    }
}

/* ローディングアニメーション */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* スクロール進捗インジケーター */
.scroll-indicator {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 120px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10001;
}

.scroll-indicator.show {
    opacity: 1;
}

.scroll-indicator-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    transition: height 0.1s ease;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    min-height: 3px;
}

@media (max-width: 768px) {
    .scroll-indicator {
        right: 20px;
        width: 4px;
        height: 100px;
    }
}