/* --- Base Variables & Reset --- */
:root {
    --bg-color: #080808;
    --text-main: #f0f0f0;
    --text-sub: #a0a0a0;
    --accent: #00f2ea; /* Cyan */
    --font-body: 'Inter', sans-serif;
    --font-code: 'JetBrains Mono', monospace;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; }

body {
    margin: 0; padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    line-height: 1.8;
}

a { color: inherit; text-decoration: none; transition: 0.3s; }
a:hover { color: var(--accent); }

ul, ol { padding-left: 1.2rem; }
li { margin-bottom: 0.8rem; }

/* --- Background Animation (Canvas) --- */
#canvas-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    opacity: 0.4;
    pointer-events: none;
}

/* --- Opening Animation --- */
#intro-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out;
}
.intro-text {
    font-family: var(--font-code);
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 5px;
}

/* --- Header & Logo --- */
header {
    position: fixed;
    top: 0; width: 100%;
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(8, 8, 8, 0.8);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: all 0.3s ease;
}
.logo {
    font-family: var(--font-code);
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 1.2rem;
}
.logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-accent {
    color: var(--accent);
    font-weight: 300;
}
.logo:hover .logo-accent {
    text-shadow: 0 0 10px var(--accent);
}

nav ul { display: flex; list-style: none; gap: 2rem; margin: 0; padding: 0; }
nav a { font-size: 0.85rem; text-transform: uppercase; font-weight: 600; color: var(--text-sub); letter-spacing: 0.5px; }
nav a:hover, nav a.active { color: var(--accent); }

/* --- Layout Utilities --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}
section { padding: 8rem 0; border-bottom: 1px solid #111; }

.section-title {
    font-family: var(--font-body);
    font-size: 4rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.1);
    margin-bottom: 3rem;
    display: block;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: -2px;
    -webkit-text-stroke: 1px rgba(255,255,255,0.2);
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.active { opacity: 1; transform: translateY(0); }

/* --- Hero Section Updates --- */
.hero {
    min-height: 95vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 80px;
}
.hero h1 {
    font-size: clamp(3.5rem, 8vw, 6.5rem);
    font-weight: 800;
    line-height: 1.05;
    margin: 0 0 2rem 0;
    color: #fff;
}
.hero-description {
    border-left: 3px solid var(--accent);
    padding-left: 1.5rem;
}
.typing-text {
    font-family: var(--font-code);
    font-size: 1.4rem;
    color: #ddd;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}
.text-highlight {
    color: var(--accent);
    background: linear-gradient(90deg, var(--accent), #ff00cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}
.hero-detail {
    font-size: 1rem;
    color: var(--text-sub);
    max-width: 700px;
    line-height: 1.6;
    animation: fadeIn 2s ease forwards;
    opacity: 0;
    animation-delay: 1s;
}
@keyframes fadeIn { to { opacity: 1; } }

/* --- About Grid --- */
.about-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
    align-items: stretch;
}
.about-img-container {
    height: 100%;
    min-height: 400px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}
.about-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(1.1);
    transition: 0.5s;
}
.about-img-container:hover img {
    filter: grayscale(0%);
    transform: scale(1.03);
}

/* --- Timeline --- */
.timeline-container {
    border-left: 1px solid #333;
    padding-left: 2rem;
    margin-top: 1rem;
}
.timeline-item { position: relative; margin-bottom: 2.5rem; }
.timeline-item::before {
    content: ''; position: absolute; left: -2.35rem; top: 8px;
    width: 10px; height: 10px; background: var(--bg-color);
    border: 1px solid var(--accent); border-radius: 50%;
}
.timeline-date { font-family: var(--font-code); font-size: 0.8rem; color: var(--accent); display: block; margin-bottom: 0.2rem;}
.timeline-title { font-weight: 700; font-size: 1.1rem; color: #fff; margin: 0; }
.timeline-desc { font-size: 0.9rem; color: var(--text-sub); }

/* --- Project Cards --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}
.project-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
    display: block;
    transition: 0.4s;
}
.project-card:hover { transform: translateY(-5px); border-color: var(--accent); }
.project-img-wrapper { height: 240px; overflow: hidden; }
.project-img-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: 0.6s; }
.project-card:hover .project-img-wrapper img { transform: scale(1.1); }
.project-content { padding: 1.5rem; }
.project-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.5rem 0; color: #fff; }
.project-tags { font-family: var(--font-code); font-size: 0.75rem; color: var(--accent); display: block; margin-bottom: 0.5rem;}

/* --- Gallery & Lightbox --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 3rem 0;
}
.gallery-item {
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #222;
}
.gallery-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: 0.3s;
}
.gallery-item:hover img { transform: scale(1.05); filter: brightness(1.1); }

/* Lightbox Modal */
#lightbox {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 10000;
    display: none;
    justify-content: center; align-items: center;
    cursor: zoom-out;
}
#lightbox.active { display: flex; animation: fadeIn 0.3s; }
#lightbox img {
    max-width: 90%; max-height: 90%;
    box-shadow: 0 0 50px rgba(0,242,234,0.1);
    border: 1px solid #333;
}

/* --- Publications --- */
.pub-list { list-style: none; padding: 0; }
.pub-item { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid #222; }
.pub-item:last-child { border-bottom: none; }
.pub-title { display: block; font-weight: 600; font-size: 1.1rem; color: #eee; margin-bottom: 0.4rem; }
.pub-meta { display: block; font-family: var(--font-code); font-size: 0.85rem; color: #888; }
.pub-section-header { font-size: 1.5rem; color: var(--accent); margin-top: 3rem; margin-bottom: 1.5rem; border-left: 3px solid var(--accent); padding-left: 1rem; }

/* Badge Award */
.badge-award {
    display: inline-block;
    background: linear-gradient(90deg, #ffcc00 0%, #ffaa00 100%);
    color: #000;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* Buttons */
.btn-link {
    display: inline-flex; margin-top: 2rem;
    font-family: var(--font-code); color: #fff; border: 1px solid #333;
    padding: 0.8rem 2rem; border-radius: 30px; transition: 0.3s;
}
.btn-link:hover { border-color: var(--accent); color: var(--accent); }

/* Social Links */
.social-link-container {
    display: flex; justify-content: center; gap: 1.5rem; margin-top: 2rem; flex-wrap: wrap;
}
.social-link {
    font-family: var(--font-code); font-size: 0.9rem; color: #fff;
    border: 1px solid rgba(255,255,255,0.2); padding: 0.8rem 1.5rem; border-radius: 4px;
    transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 1px;
    background: rgba(0,0,0,0.3);
}
.social-link:hover {
    border-color: var(--accent); color: var(--accent);
    background: rgba(0, 242, 234, 0.1); transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 242, 234, 0.1);
}

/* Footer */
footer { text-align: center; padding: 4rem 0; font-family: var(--font-code); font-size: 0.8rem; color: #555; }

/* --- Mobile Optimization --- */
@media(max-width: 768px) {
    /* Header Stack Layout */
    header {
        padding: 0.8rem 1rem;
        flex-direction: column;
        gap: 0.8rem;
        background: rgba(8, 8, 8, 0.98);
    }
    
    .logo { 
        font-size: 0.9rem;
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .logo a { justify-content: center; } 

    nav ul { 
        gap: 0.8rem; 
        flex-wrap: nowrap;
        width: 100%;
        justify-content: center;
    }
    
    nav a { 
        font-size: 0.7rem;
        letter-spacing: 0;
        padding: 0.3rem 0;
    }

    /* Hero Fix */
    .hero { 
        padding-top: 180px;
        justify-content: flex-start; 
        min-height: auto;
        padding-bottom: 4rem;
    }
    .hero h1 { font-size: 2.2rem; line-height: 1.2; margin-bottom: 1.5rem; }
    .typing-text { font-size: 1rem; }
    .hero-detail { font-size: 0.9rem; }

    /* Layout Adjustments */
    .section-title { font-size: 2.2rem; margin-bottom: 2rem; }
    .about-layout { grid-template-columns: 1fr; gap: 2rem; }
    .about-img-container { height: 350px; }
    .intro-text { font-size: 1.2rem; letter-spacing: 3px; }
    .container { padding: 0 1.5rem; }

    /* --- Project Page Optimization (Mobile) --- */
    
    /* 1. Gallery: 2 Columns */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr); /* 強制的に2列 */
        gap: 0.5rem; /* 隙間を狭くして表示領域を確保 */
    }

    /* 2. Abstract Text: Smaller size for readability */
    section p {
        font-size: 0.85rem; /* 文字サイズ縮小 */
        line-height: 1.6;   /* 行間を詰める */
        color: #ccc;        /* 読みやすい色味に */
    }
}