@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Space+Grotesk:wght@300;400;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    overflow-x: hidden;
    cursor: none;
}

.cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #ff6b6b, #4ecdc4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease;
}

.cursor-hover {
    transform: translate(-50%, -50%) scale(2);
    background: radial-gradient(circle, #ff9ff3, #54a0ff);
}

.header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 2rem;
    z-index: 1000;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
}

.nav {
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text {
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 1.5rem;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: glow 2s ease-in-out infinite alternate;
}

.logo-dot {
    color: #ff6b6b;
    font-size: 1.5rem;
    animation: pulse 1.5s infinite;
}

@keyframes glow {
    from { filter: brightness(1); }
    to { filter: brightness(1.2); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hero {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 107, 107, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(78, 205, 196, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(69, 183, 209, 0.2) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(1deg); }
    66% { transform: translate(-20px, 20px) rotate(-1deg); }
}

.hero-content {
    text-align: center;
    z-index: 10;
}

.hero-title {
    font-family: 'Orbitron', monospace;
    font-size: clamp(3rem, 8vw, 8rem);
    font-weight: 900;
    line-height: 0.9;
    margin-bottom: 2rem;
}

.title-line {
    display: block;
    opacity: 0;
    transform: translateY(100px);
    animation: slideUp 1s ease 0.5s forwards;
}

.title-line.accent {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #ff9ff3);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: slideUp 1s ease 0.8s forwards, gradientShift 3s ease-in-out infinite;
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 300;
    opacity: 0.8;
    opacity: 0;
    animation: fadeIn 1s ease 1.2s forwards;
}

@keyframes fadeIn {
    to { opacity: 0.8; }
}

.portfolio-section {
    padding: 5rem 2rem;
    background: linear-gradient(180deg, #0a0a0a 0%, #111111 100%);
}

.portfolio-container {
    max-width: 1400px;
    margin: 0 auto;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 3rem;
}

.project-tile {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    aspect-ratio: 1; /* 正方形に近い形 */
    display: flex;
    flex-direction: column;
}

.project-tile:hover {
    /* ホバー時のタイル移動エフェクトを削除、スクリーンショットに集中 */
}

.project-image {
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* 不要なオーバーレイエフェクトを削除 */
.image-overlay {
    display: none;
}

.project-preview {
    width: 100%;
    height: 100%;
    position: relative;
}

.preview-pattern {
    width: 100%;
    height: 100%;
    transition: transform 0.4s ease;
    position: relative;
    z-index: 2;
    opacity: 0; /* パターンを完全に非表示 */
    pointer-events: none;
}

.project-tile:hover .preview-pattern {
    transform: scale(1.05);
    opacity: 0; /* ホバー時も非表示のまま */
}

/* スクリーンショットコンテナとスクロール効果 */
.screenshot-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.screenshot-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    min-height: 800px; /* スクリーンショットの最小高さ */
    transition: transform 10s ease-in-out, opacity 0.3s ease;
    transform: translateY(0);
    opacity: 1; /* 初期状態から完全に鮮明 */
    object-fit: cover;
    object-position: top;
}

/* ホバー時のスクリーンショット表示とスクロール */
.project-tile:hover .screenshot-image {
    opacity: 1; /* ホバー時も完全に鮮明 */
}

/* グラデーションオーバーレイを削除 */
.screenshot-container::after {
    display: none;
}

/* 各プロジェクトごとのスクロール速度調整 */
.project-tile[data-project="1"]:hover .screenshot-image {
    transition-duration: 12s; /* Masaya Official Site - 実際のスクリーンショットに合わせて長め */
}

.project-tile[data-project="1"] .screenshot-image {
    /* Masaya Official Siteの実際のスクリーンショット用の調整 */
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: top;
}

/* Masaya Official Site専用のグラデーションオーバーレイ */
.project-tile[data-project="1"] .screenshot-container::after {
    background: linear-gradient(
        135deg, 
        rgba(255, 107, 107, 0.4) 0%, 
        rgba(78, 205, 196, 0.4) 100%
    );
}

.project-tile[data-project="2"]:hover .screenshot-image {
    transition-duration: 10s; /* Banjo Teto - 標準 */
}

.project-tile[data-project="3"]:hover .screenshot-image {
    transition-duration: 7s; /* School LP - さらに短め */
}

.project-tile[data-project="4"]:hover .screenshot-image {
    transition-duration: 9s; /* ボドゲつくらNight - やや短め */
}

.project-tile[data-project="5"]:hover .screenshot-image {
    transition-duration: 11s; /* オンライン講座プラットフォーム - 標準的 */
}

.pattern-1 {
    background: 
        radial-gradient(circle at 30% 30%, rgba(255, 107, 107, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(78, 205, 196, 0.2) 0%, transparent 50%),
        rgba(30, 30, 30, 0.3); /* さらに透明にしてスクリーンショットが鮮明に見えるように */
}

.pattern-2 {
    background: 
        linear-gradient(45deg, #ff9ff3 0%, #54a0ff 100%),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255, 255, 255, 0.1) 2px, rgba(255, 255, 255, 0.1) 4px);
}

.pattern-3 {
    background: 
        conic-gradient(from 0deg at 50% 50%, #ff6b6b, #4ecdc4, #45b7d1, #ff9ff3, #ff6b6b),
        radial-gradient(circle, transparent 40%, rgba(10, 10, 10, 0.8) 41%);
}

.pattern-4 {
    background: 
        linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%),
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 193, 7, 0.1) 10px, rgba(255, 193, 7, 0.1) 20px),
        radial-gradient(circle at 80% 20%, rgba(255, 87, 34, 0.3) 0%, transparent 50%);
}

.pattern-5 {
    background: 
        linear-gradient(135deg, #667eea 0%, #764ba2 100%),
        repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(255, 255, 255, 0.05) 15px, rgba(255, 255, 255, 0.05) 30px),
        radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.3) 0%, transparent 50%);
}

/* アニメーション要素を完全に削除 */
.animated-elements {
    display: none;
}

/* 初期状態では全てのアニメーションを一時停止 */
.animated-elements * {
    animation-play-state: paused;
}

/* ホバー時にアニメーションを再生 */
.project-tile:hover .animated-elements * {
    animation-play-state: running;
}

/* Project 1: Masaya Official Site - コーディング要素 */
.pattern-1 .code-lines {
    position: absolute;
    top: 20%;
    left: 10%;
    width: 80%;
    height: 60%;
    background: 
        linear-gradient(90deg, rgba(255, 107, 107, 0.6) 0%, transparent 40%),
        linear-gradient(90deg, rgba(78, 205, 196, 0.6) 0%, transparent 60%);
    background-size: 100% 4px, 100% 4px;
    background-position: 0 0, 0 20px;
    background-repeat: repeat-y;
    animation: codingLines 3s ease-in-out infinite;
}

.pattern-1 .typing-cursor {
    position: absolute;
    top: 50%;
    right: 30%;
    width: 2px;
    height: 20px;
    background: #4ecdc4;
    animation: typingBlink 1.5s infinite;
}

.pattern-1 .tech-particles::before,
.pattern-1 .tech-particles::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ff6b6b;
    border-radius: 50%;
    animation: techFloat 4s ease-in-out infinite;
}

.pattern-1 .tech-particles::before {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.pattern-1 .tech-particles::after {
    bottom: 20%;
    right: 20%;
    background: #4ecdc4;
    animation-delay: 2s;
}

@keyframes codingLines {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50% { transform: translateY(-10px); opacity: 1; }
}

@keyframes typingBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes techFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-15px) scale(1.2); }
}

/* Project 2: Banjo Teto - キャラクター要素 */
.pattern-2 .floating-chars {
    position: absolute;
    font-size: 2rem;
    animation: charFloat 6s ease-in-out infinite;
}

.pattern-2 .floating-chars:nth-child(1) {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.pattern-2 .floating-chars:nth-child(2) {
    bottom: 20%;
    right: 20%;
    animation-delay: 3s;
}

.pattern-2 .star-field::before,
.pattern-2 .star-field::after {
    content: '✦';
    position: absolute;
    color: rgba(255, 159, 243, 0.8);
    font-size: 1rem;
    animation: starTwinkle 2s ease-in-out infinite;
}

.pattern-2 .star-field::before {
    top: 30%;
    left: 60%;
    animation-delay: 0.5s;
}

.pattern-2 .star-field::after {
    bottom: 40%;
    left: 30%;
    animation-delay: 1.5s;
}

.pattern-2 .medieval-elements::before {
    content: '🏰';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    opacity: 0.7;
    animation: medievalPulse 4s ease-in-out infinite;
}

@keyframes charFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(5deg); }
    75% { transform: translateY(10px) rotate(-5deg); }
}

@keyframes starTwinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

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

/* Project 3: School - CAD要素 */
.pattern-3 .cad-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(90deg, rgba(52, 152, 219, 0.3) 1px, transparent 1px),
        linear-gradient(rgba(52, 152, 219, 0.3) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridPulse 3s ease-in-out infinite;
}

.pattern-3 .dimension-lines::before,
.pattern-3 .dimension-lines::after {
    content: '⟵ 100mm ⟶';
    position: absolute;
    color: rgba(52, 152, 219, 0.8);
    font-size: 0.8rem;
    font-family: monospace;
    animation: dimensionFade 4s ease-in-out infinite;
}

.pattern-3 .dimension-lines::before {
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
}

.pattern-3 .dimension-lines::after {
    content: '∠90°';
    bottom: 15%;
    right: 15%;
    animation-delay: 2s;
}

.pattern-3 .countdown-numbers::before {
    content: '13:59:47';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(46, 204, 113, 0.9);
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    animation: countdownTick 1s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes dimensionFade {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes countdownTick {
    0%, 90% { opacity: 1; }
    95% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Project 4: ボドゲつくらNight - ゲーム要素 */
.pattern-4 .game-dice {
    position: absolute;
    top: 20%;
    left: 20%;
    font-size: 2rem;
    animation: diceRoll 5s ease-in-out infinite;
}

.pattern-4 .ai-brain {
    position: absolute;
    bottom: 20%;
    right: 20%;
    font-size: 2rem;
    animation: aiPulse 3s ease-in-out infinite;
}

.pattern-4 .night-stars::before,
.pattern-4 .night-stars::after {
    content: '✨';
    position: absolute;
    color: rgba(255, 193, 7, 0.8);
    animation: nightTwinkle 2.5s ease-in-out infinite;
}

.pattern-4 .night-stars::before {
    top: 25%;
    right: 30%;
    animation-delay: 0s;
}

.pattern-4 .night-stars::after {
    bottom: 30%;
    left: 30%;
    animation-delay: 1.25s;
}

.pattern-4 .creative-sparks::before {
    content: '💡';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    animation: creativeBurst 4s ease-in-out infinite;
}

@keyframes diceRoll {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1); }
    75% { transform: rotate(270deg) scale(1.1); }
}

@keyframes aiPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); filter: hue-rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2); filter: hue-rotate(45deg); }
}

@keyframes nightTwinkle {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3) rotate(45deg); }
}

@keyframes creativeBurst {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
}

/* Project 5: オンライン講座プラットフォーム - 教育要素 */
.pattern-5 .course-elements {
    position: absolute;
    top: 20%;
    left: 20%;
    width: 60%;
    height: 60%;
    background: 
        linear-gradient(90deg, rgba(102, 126, 234, 0.6) 0%, transparent 50%),
        linear-gradient(0deg, rgba(118, 75, 162, 0.6) 0%, transparent 50%);
    background-size: 100% 8px, 8px 100%;
    background-position: 0 0, 0 0;
    background-repeat: repeat-y, repeat-x;
    animation: courseGrid 4s ease-in-out infinite;
}

.pattern-5 .learning-progress {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 6px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 30%, rgba(255, 255, 255, 0.3) 30%, rgba(255, 255, 255, 0.3) 100%);
    border-radius: 3px;
    animation: progressFill 3s ease-in-out infinite;
}

.pattern-5 .education-particles::before,
.pattern-5 .education-particles::after {
    content: '📚';
    position: absolute;
    font-size: 1.5rem;
    animation: educationFloat 5s ease-in-out infinite;
}

.pattern-5 .education-particles::before {
    top: 30%;
    right: 20%;
    animation-delay: 0s;
}

.pattern-5 .education-particles::after {
    content: '🎓';
    bottom: 30%;
    left: 30%;
    animation-delay: 2.5s;
}

@keyframes courseGrid {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes progressFill {
    0% { background: linear-gradient(90deg, #667eea 0%, #764ba2 0%, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.3) 100%); }
    50% { background: linear-gradient(90deg, #667eea 0%, #764ba2 60%, rgba(255, 255, 255, 0.3) 60%, rgba(255, 255, 255, 0.3) 100%); }
    100% { background: linear-gradient(90deg, #667eea 0%, #764ba2 30%, rgba(255, 255, 255, 0.3) 30%, rgba(255, 255, 255, 0.3) 100%); }
}

@keyframes educationFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.7; }
    25% { transform: translateY(-8px) rotate(2deg); opacity: 1; }
    75% { transform: translateY(8px) rotate(-2deg); opacity: 0.8; }
}

.project-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.2rem;
    padding-bottom: 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 70%, transparent 100%);
    z-index: 3;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.project-tile:hover .project-content {
    transform: translateY(5px);
}

.project-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.tag {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.15rem 0.4rem;
    border-radius: 12px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.project-brief {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.2rem;
    font-size: 0.75rem;
    line-height: 1.3;
}

.project-focus {
    display: none;
}

.project-link {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    text-decoration: none;
    padding: 0.7rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    overflow: hidden;
}

.project-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.project-link:hover::before {
    left: 100%;
}

.project-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

@media (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .project-tile {
        margin: 0 1rem;
    }
    
    .hero-title {
        font-size: clamp(2rem, 12vw, 4rem);
    }
    
    .header {
        padding: 1rem;
    }
    
    body {
        cursor: auto;
    }
    
    .cursor {
        display: none;
    }
}