/* ===========================================
   HEADER STYLES
   =========================================== */

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 70% 75%, rgba(255, 255, 255, 0.1) 0%, transparent 30%);
    pointer-events: none;
}

.loader-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-figure-8 {
    position: relative;
    width: 200px;
    height: 200px;
}

.loader-circle {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 1.5px solid transparent;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
    animation: circlePulse 3s ease-in-out infinite;
}

.loader-circle-top {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: #fff;
    border-right-color: rgba(255, 255, 255, 0.5);
    border-left-color: rgba(255, 255, 255, 0.5);
    animation-name: circlePulseTop;
}

.loader-circle-bottom {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: #fff;
    border-right-color: rgba(255, 255, 255, 0.5);
    border-left-color: rgba(255, 255, 255, 0.5);
    animation-name: circlePulseBottom;
}

@keyframes circlePulseTop {
    0%, 100% {
        transform: translateX(-50%) scale(1) rotate(0deg);
        opacity: 1;
        top: 0;
    }
    25% {
        transform: translateX(-50%) scale(1.2) rotate(90deg);
        opacity: 0.8;
        top: 10px;
    }
    50% {
        transform: translateX(-50%) scale(1) rotate(180deg);
        opacity: 0.6;
        top: 0;
    }
    75% {
        transform: translateX(-50%) scale(0.8) rotate(270deg);
        opacity: 0.8;
        top: -10px;
    }
}

@keyframes circlePulseBottom {
    0%, 100% {
        transform: translateX(-50%) scale(1) rotate(0deg);
        opacity: 1;
        bottom: 0;
    }
    25% {
        transform: translateX(-50%) scale(0.8) rotate(-90deg);
        opacity: 0.8;
        bottom: -10px;
    }
    50% {
        transform: translateX(-50%) scale(1) rotate(-180deg);
        opacity: 0.6;
        bottom: 0;
    }
    75% {
        transform: translateX(-50%) scale(1.2) rotate(-270deg);
        opacity: 0.8;
        bottom: 10px;
    }
}

/* Loader Particles */
.loader-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: particleFloat 4s ease-in-out infinite;
}

.particle:nth-child(1) {
    top: 20%;
    left: 30%;
    width: 4px;
    height: 4px;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    top: 30%;
    right: 30%;
    width: 5px;
    height: 5px;
    animation-delay: 0.5s;
}

.particle:nth-child(3) {
    bottom: 30%;
    left: 35%;
    width: 3px;
    height: 3px;
    animation-delay: 1s;
}

.particle:nth-child(4) {
    bottom: 25%;
    right: 35%;
    width: 4px;
    height: 4px;
    animation-delay: 1.5s;
}

.particle:nth-child(5) {
    top: 50%;
    left: 20%;
    width: 3px;
    height: 3px;
    animation-delay: 2s;
}

.particle:nth-child(6) {
    top: 50%;
    right: 20%;
    width: 4px;
    height: 4px;
    animation-delay: 2.5s;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.6;
    }
    25% {
        transform: translateY(-15px) translateX(10px) scale(1.2);
        opacity: 1;
    }
    50% {
        transform: translateY(0) translateX(20px) scale(0.8);
        opacity: 0.4;
    }
    75% {
        transform: translateY(15px) translateX(10px) scale(1.1);
        opacity: 0.8;
    }
}

.loader-progress {
    position: absolute;
    bottom: -40px;
    width: 200px;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
    border-radius: 1px;
}

.loader-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: rgba(255, 255, 255, 0.7);
    animation: progressAnimation 2.5s ease forwards;
}

@keyframes progressAnimation {
    0% {
        width: 0;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

/* Custom Cursor */
.cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 5px;
    height: 5px;
    background-color: #fff;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s, background 0.3s;
}

.cursor-circle {
    position: fixed;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s, border 0.3s;
}

.cursor-plus {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s, transform 0.3s;
}

.cursor-plus::before,
.cursor-plus::after {
    content: '';
    position: absolute;
    background-color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.cursor-plus::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    transform: translateY(-50%);
}

.cursor-plus::after {
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    transform: translateX(-50%);
}

/* Hover effect (8 shape) */
.cursor-circle.hover {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.cursor-circle.hover .cursor-plus {
    opacity: 0;
}

.cursor-circle.hover::before {
    content: '8';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
    line-height: 1;
}

@media (max-width: 768px) {
    .cursor-dot, .cursor-circle {
        display: none;
    }
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: all 0.3s ease;
}

.header.scrolled {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 90px;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.header.scrolled .header-container {
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo img {
    height: 60px;
    width: auto;
    filter: brightness(0) invert(1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.header.scrolled .logo img {
    height: 35px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* スクロール進捗表示 */
.scroll-meter {
    width: 60px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.scroll-meter-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.9));
    border-radius: 2px;
    transition: width 0.2s ease;
}

.scroll-progress {
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
    transition: all 0.3s ease;
}

.scroll-progress span {
    font-weight: 400;
    color: #fff;
}

/* ∞ハンバーガーメニュー */
.hamburger {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    width: 30px;
    height: 30px;
    justify-content: center;
    align-items: center;
    position: relative;
}

.infinity-icon {
    width: 20px;
    height: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.infinity-icon::before,
.infinity-icon::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.infinity-icon::before {
    left: 0;
    border-right: none;
    transform: rotate(-10deg);
}

.infinity-icon::after {
    right: 0;
    border-left: none;
    transform: rotate(10deg);
}

.hamburger.active .infinity-icon {
    transform: rotate(90deg);
}

.hamburger.active .infinity-icon::before,
.hamburger.active .infinity-icon::after {
    border-color: rgba(255, 255, 255, 0.7);
}

.menu-text {
    font-size: 8px;
    letter-spacing: 1px;
    margin-top: 4px;
    color: #fff;
    transition: all 0.3s ease;
    font-weight: 300;
}

.hamburger.active .menu-text {
    color: rgba(255, 255, 255, 0.7);
}

/* モバイルメニュー */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999;
    transition: right 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 60%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0%, transparent 80%);
    pointer-events: none;
    z-index: -1;
}

.mobile-menu .nav-link {
    display: block;
    padding: 20px 0;
    font-size: 32px;
    font-weight: 200;
    letter-spacing: 4px;
    text-transform: uppercase;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    text-align: center;
    transform: translateX(100px);
    opacity: 0;
}

.mobile-menu.active .nav-link {
    transform: translateX(0);
    opacity: 1;
}

/* メニューアイテムのスタガードアニメーション */
.mobile-menu .nav-link:nth-child(2) { transition-delay: 0.1s; }
.mobile-menu .nav-link:nth-child(3) { transition-delay: 0.15s; }
.mobile-menu .nav-link:nth-child(4) { transition-delay: 0.2s; }
.mobile-menu .nav-link:nth-child(5) { transition-delay: 0.25s; }
.mobile-menu .nav-link:nth-child(6) { transition-delay: 0.3s; }
.mobile-menu .nav-link:nth-child(7) { transition-delay: 0.35s; }
.mobile-menu .nav-link:nth-child(8) { transition-delay: 0.4s; }

.mobile-menu .nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.mobile-menu .nav-link:hover {
    color: #fff;
    transform: scale(1.05);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.mobile-menu .nav-link:hover::before {
    width: 120%;
}

.contact-mobile {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05)) !important;
    margin: 40px 0 0 0;
    padding: 15px 40px !important;
    border-radius: 50px;
    font-weight: 300;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 18px !important;
    letter-spacing: 3px;
    position: relative;
    overflow: hidden;
}

.contact-mobile::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.contact-mobile:hover::after {
    left: 100%;
}

.contact-mobile:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1)) !important;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 40px rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

/* メニュークローズボタン */
.menu-close {
    position: absolute;
    top: 40px;
    right: 40px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    transform: rotate(0deg);
    opacity: 0;
}

.mobile-menu.active .menu-close {
    opacity: 1;
    transition-delay: 0.5s;
}

.menu-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
    border-color: rgba(255, 255, 255, 0.6);
}

/* メニューオーバーレイ */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 998;
    backdrop-filter: blur(5px);
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===========================================
   RESPONSIVE STYLES
   =========================================== */

@media (max-width: 1024px) {
    .header-container {
        padding: 0 30px;
    }

    .logo img {
        height: 50px;
    }

    .header.scrolled .logo img {
        height: 30px;
    }
}

@media (max-width: 768px) {
    .nav {
        gap: 15px;
    }
    
    .scroll-meter {
        width: 40px;
        height: 2px;
    }
    
    .scroll-progress {
        font-size: 10px;
    }
    
    .header-container {
        padding: 0 20px;
        height: 75px;
    }

    .header.scrolled .header-container {
        height: 65px;
    }

    .logo img {
        height: 45px;
    }

    .header.scrolled .logo img {
        height: 28px;
    }

    .mobile-menu .nav-link {
        font-size: 24px;
        padding: 15px 0;
        letter-spacing: 3px;
    }

    .contact-mobile {
        font-size: 16px !important;
        padding: 12px 30px !important;
        margin: 30px 0 0 0;
    }

    .menu-close {
        top: 20px;
        right: 20px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }

    .mobile-menu {
        width: 320px;
    }

    .mobile-menu .nav-link {
        font-size: 16px;
        padding: 20px 40px;
    }
}

@media (max-width: 480px) {
    .nav {
        gap: 10px;
    }
    
    .scroll-meter {
        width: 30px;
        height: 2px;
    }
    
    .scroll-progress {
        font-size: 9px;
    }
    
    .header-container {
        padding: 0 15px;
        height: 65px;
    }

    .header.scrolled .header-container {
        height: 55px;
    }

    .logo img {
        height: 40px;
    }

    .header.scrolled .logo img {
        height: 25px;
    }

    .mobile-menu .nav-link {
        font-size: 20px;
        padding: 12px 0;
        letter-spacing: 2px;
    }

    .contact-mobile {
        font-size: 14px !important;
        padding: 10px 25px !important;
        margin: 25px 0 0 0;
    }

    .menu-close {
        top: 15px;
        right: 15px;
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
}