/* Enhanced CSS for Koiwa Laboratory Website */
/* 全体のスタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: 'Noto Sans JP', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* アニメーション用のキーフレーム */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ヘッダースタイル */
.site-header {
    background: linear-gradient(135deg, #0A2342 0%, #1e3c72 100%);
    padding: 30px 0;
    color: white;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    animation: slideInLeft 0.8s ease-out;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 4s infinite;
}

.site-header h1 {
    font-size: clamp(2rem, 4.5vw, 2.8rem);
    margin-bottom: 15px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    animation: fadeInUp 1s ease-out 0.2s both;
    position: relative;
    z-index: 1;
}

.site-header p {
    font-size: clamp(1.05rem, 2.4vw, 1.3rem);
    opacity: 0.9;
    animation: fadeInUp 1s ease-out 0.4s both;
    position: relative;
    z-index: 1;
}

/* ナビゲーションスタイル */
.site-nav {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    animation: fadeInUp 1s ease-out 0.6s both;
}

.site-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
}

/* Mobile nav toggle button */
.nav-toggle {
    display: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 18px;
    font-size: 1em;
    cursor: pointer;
    font-weight: 600;
    border-radius: 8px;
    margin: 10px;
}

.nav-toggle:focus {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

/* When nav is open on mobile */
.site-nav.open ul {
    max-height: 600px;
    opacity: 1;
    visibility: visible;
}

.site-nav ul li a {
    color: white;
    text-decoration: none;
    padding: 18px 30px;
    display: block;
    font-weight: 500;
    font-size: 1.1em;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.site-nav ul li a::before {
    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.5s;
}

.site-nav ul li a:hover::before {
    left: 100%;
}

.site-nav ul li a:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* メインコンテンツエリア */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    animation: fadeInUp 1s ease-out 0.8s both;
}

/* ウェルカムタイトル */
.welcome-title {
    color: white;
    font-size: clamp(1.9rem, 6vw, 3rem);
    text-align: center;
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}

.welcome-summary {
    text-align: center;
    font-size: 1.3em;
    color: white;
    margin-bottom: 40px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}

/* Unified heading line-height */
h1, h2, h3 { line-height: 1.25; }

/* カードスタイル */
.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

/* プロフィールセクション */
.introduction-container {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.profile-image-container {
    flex: 0 0 auto;
    animation: float 3s ease-in-out infinite;
}

.profile-image {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    filter: brightness(1.05) contrast(1.1) saturate(1.1);
}

.profile-image:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    filter: brightness(1.1) contrast(1.15) saturate(1.15);
}

.text-container {
    flex: 1;
    min-width: 300px;
}

.text-container h2 {
    color: #1e3c72;
    font-size: 1.8em;
    margin-bottom: 20px;
    position: relative;
}

.text-container h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* ニュースコンテナ */
.news-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    padding: 30px;
    margin-top: 30px;
    position: relative;
    overflow: hidden;
}

.news-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(transparent, rgba(255,255,255,0.1), transparent);
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.news-title {
    font-size: 2.2em;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.news-content {
    position: relative;
    z-index: 1;
}

/* セクションコンテナ */
.section-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.section-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.section-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.section-container h2 {
    color: #1e3c72;
    font-size: 1.8em;
    margin-bottom: 20px;
    position: relative;
}

.section-container h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* 業績リスト */
.publication-item {
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
    list-style: none;
}

.publication-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(10px);
}

/* コンタクトページ */
.contact-container {
    text-align: center;
    padding: 40px;
}

.email-link {
    display: inline-block;
    font-size: 1.4em;
    color: #1e3c72;
    text-decoration: none;
    padding: 15px 30px;
    border: 2px solid #667eea;
    border-radius: 50px;
    transition: all 0.3s ease;
    margin: 20px 0;
    background: rgba(102, 126, 234, 0.1);
}

.email-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .site-header h1 {
        font-size: 2.2em;
    }
    
    .nav-toggle { display: inline-block; }
    .site-nav ul { 
        flex-direction: column; 
        align-items: stretch; 
        max-height: 0; 
        overflow: hidden; 
        transition: max-height 0.4s ease, opacity 0.4s ease; 
        opacity: 0; 
        visibility: hidden; 
    }
    .site-nav ul li a { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.1); }
    .site-nav ul li:first-child a { border-top: none; }
    
    .introduction-container {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-image {
        width: 220px;
        height: 220px;
    }
    
    .welcome-title {
        font-size: 2.2em;
    }
    
    .main-content {
        padding: 20px 15px;
    }

    /* Ensure images scale */
    img, .profile-image { max-width: 100%; height: auto; }

    /* Adjust section containers spacing */
    .section-container, .card { padding: 22px 20px; }

    /* Flex rows inside sections stack */
    .section-container > div[style*='display: flex'][style*='align-items'] { flex-wrap: wrap; }
    
    /* Large heading shrink */
    h1, h2 { word-break: keep-all; }
}

@media (max-width: 480px) {
    .site-header h1 {
        font-size: 1.8em;
    }
    
    .welcome-title {
        font-size: 1.8em;
    }
    
    .card {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .profile-image {
        width: 180px;
        height: 180px;
    }

    .nav-toggle { width: calc(100% - 20px); }
    .welcome-summary { font-size: 1.05em; }
    .section-container h2 { font-size: 1.4em; }
    .research-topic .research-description { font-size: 1em; }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* Very small devices */
@media (max-width: 360px) {
    .profile-image { width: 150px; height: 150px; }
    .nav-toggle { font-size: 0.9em; padding: 10px 14px; }
    .site-header p { font-size: 0.95rem; }
    .card, .section-container { padding: 18px 16px; }
}

/* スクロールバーのカスタマイズ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* フォーカススタイル */
a:focus, button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* プリント用スタイル */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .site-header, .site-nav {
        background: #333 !important;
        color: white !important;
    }
    
    .card, .section-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
